function ir_a_tienda(dominio, codProducto) {
	open('http://'+dominio+'/ir-a-tienda/'+codProducto);
		
}


function descargarScript(idProducto,urlDescarga){
	var querystring ="idProducto="+idProducto;
//	xmlhttpPost(querystring,"/descargarScript.phtml",8);
	xmlhttpPost("/descargarScript.phtml",querystring,urlDescarga);
	
}


function xmlhttpPost(strURL,querystring,urlDescarga) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
        	if(self.xmlHttpReq.responseText != ""){
        		window.location=self.xmlHttpReq.responseText
        	} 
        	// en self.xmlHttpReq.responseText tengo la respuesta del phtml
//        	 window.location=urlDescarga;
        	//open(urlDescarga); no funciona
        }
    }
    self.xmlHttpReq.send(querystring);
}

