function abrir(strFile, strNombre, intWidth, intHeight)
{
	leftVal = (screen.width - intWidth) / 2;
	topVal = (screen.height - intHeight) / 2;

	window.open(strFile, strNombre,'width=' + intWidth + ',height=' + intHeight + ',left=' + leftVal + ',top=' + topVal + ",scrollbars=yes");
}

function openWin(strFile, strNombre, intWidth, intHeight)
{
	leftVal = (screen.width - intWidth) / 2;
	topVal = (screen.height - intHeight) / 2;

	window.open(strFile, strNombre,'width=' + intWidth + ',height=' + intHeight + ',left=' + leftVal + ',top=' + topVal + ",scrollbars=no");
}

function votar(id)
{
	abrir("votar.php?id=" + id, "votar", 300, 200);
}

function showSuscribir()
{
	email = prompt("Por favor, ingrese su email", "");
	if(validaMail(email)) suscribir(email);
}

	function suscribir(email)
	{
		var oEmail = email
		var sendURL = "suscribir.php?email=" + encodeURIComponent(oEmail);			

		var oXmlHttp = zXmlHttp.createRequest();
		oXmlHttp.open("get", sendURL, true);
		oXmlHttp.onreadystatechange = function ()
		{
			if (oXmlHttp.readyState == 4)
			{
				if (oXmlHttp.status == 200)
				{
					var arrInfo = oXmlHttp.responseText.split("||");
					
					if (arrInfo[0] == "true")
					{
						alert(arrInfo[1]);
					}
					else
					{
						alert(arrInfo[1]);
					}
				}
				else
				{
					alert("An error occurred while trying to contact the server.");
				}
			}
		};
		oXmlHttp.send(null);
	}

function validaMail(email)
{
	var Template = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	if(email != "")
	{
		if (Template.test(email))
    {
      return true;
		}
    else
    {
		  alert("Error... El e-mail es incorrecto");
      return false;
    }       
  }
  return false;
}