window.onload = function()
{
	var favoritos =	document.getElementById('favoritos');
	
	if(favoritos)
	{
		favoritos.onclick = function()
		{
			AgregarFavoritos();
		}
	}
	var recomendar = document.getElementById('recomendar');			
	if(recomendar)
	{
		recomendar.onclick = function()
		{
			openWindow('recomendar.php','Recomendar a un amigo');
		}
	}	
	
	var imprimir = document.getElementById('imprimir');
	if(imprimir)
	{
		imprimir.onclick = function()
		{
			window.print();
		}
	}
	

}	
function AgregarFavoritos() 
{
	if (navigator.appName=="Netscape") 
	{
		window.sidebar.addPanel(document.title,document.location.href,""); 
	}

	if (navigator.appName=="Microsoft Internet Explorer"){
	
		window.external.AddFavorite(location.href, document.title);
	}
}
function openWindow(modulo,titulo)
{
	var ancho=400,alto=350;
	var W=window.open(modulo,"_blank","scrollbars=yes,width="+ancho+",height="+alto);
	W.focus();	
	iz=(screen.width-ancho) / 2;
	de=(screen.height-alto) / 2;
	W.moveTo(iz,de);

}
function validarEmail(email)
{
	re=/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$/
    if(!re.exec(email))    {
        return false;
    }else{
        return true;
    }
}

function showMenu(menuid)
{
	document.getElementById(menuid).style.display = 'block';
	if(menuid == 'menu-1')
	{
		document.getElementById('mn2').style.backgroundPosition = '0 -41px';
	}else if(menuid == 'menu-2')
	{
		document.getElementById('mn3').style.backgroundPosition = '0 -41px';
	}
	else if(menuid == 'menu-3')
	{
		document.getElementById('mn4').style.backgroundPosition = '0 -41px';
	}
	else{
	
		document.getElementById('mn5').style.backgroundPosition = '0 -41px';
	}
	
}
function hiddeMenu(menuid,archivo)
{
	document.getElementById(menuid).style.display = 'none';
	if(menuid == 'menu-1')
	{
		document.getElementById('mn2').style.background = 'url(images/mnu2.jpg)';
		if(archivo == "/productos.php" || archivo == "/novedades.php"){
		document.getElementById('mn2').style.backgroundPosition = '0 -82px';
		}
		
	}else if(menuid == 'menu-2')
	{
		document.getElementById('mn3').style.background = 'url(images/mnu3.jpg)';
		if(archivo == "/sobre-donde.php" || archivo == "/nuestra-calidad.php"
		|| archivo == "/historia.php"

		|| archivo == "/boletin-electronico.php"
		|| archivo == "/contacto.php"
		
		){
		document.getElementById('mn3').style.backgroundPosition = '0 -82px';
		}
		
	}

	else if(menuid == 'menu-3')
	{
	document.getElementById('mn4').style.background = 'url(images/mnu4.jpg)';
			if(archivo == "/donde-en-tu-vida.php" || archivo == "/recetas.php"
			|| archivo == "/tips.php" || archivo == "/tabla-nutrimental.php"
			|| archivo == "/galeria.php"
					|| archivo == "/dondetv.php"
			){
		document.getElementById('mn4').style.backgroundPosition = '0 -82px';
		}
		
	}		
	else
	{
	document.getElementById('mn5').style.background = 'url(images/mnu5.jpg)';
			if(archivo == "/divertida.php" || archivo == "/wallpapers.php"){
		document.getElementById('mn5').style.backgroundPosition = '0 -82px';
		}
		
	}		
}

function verVideo(video)
{
		
	location.href = '?video='+video;
	document.getElementById('videoplayer').SetVariable("player:jsPlay","");
}
function irCategoria(select)
{
	location.href = 'recetas.php?cat='+select.options[select.selectedIndex].value;
}
function enviarReceta(){
var nombre = document.getElementById('nombre_rec').value;
var email = document.getElementById('email_rec').value;
var pais = document.getElementById('pais_rec').value;
var ciudad = document.getElementById('ciudad_rec').value;
var receta = document.getElementById('rec').value;

var body = "Receta enviada desde galletasdonde.com.mx\n"+
"Nombre: "+nombre+"\n"+
"Email: "+email+"\n"+
"Pais: "+pais+"\n"+
"Ciudad: "+ciudad+"\n"+
"Receta: "+receta+"\n";

xajax_enviarForm("",body,nombre,email)

}

function showForm()
{
	 document.getElementById('receta-banner').style.display = 'none';
	 xajax_mostrarForm();
}
function recomendarReceta(id)
{
	ancho=400; alto=350;
	var _W=window.open('recomendar-receta.php?recetaid='+id,"_blank","scrollbars=yes,width="+ancho+",height="+alto); 
	_W.focus(); 
    iz=(screen.width-ancho) / 2;
    de=(screen.height-alto) / 2;
    _W.moveTo(iz,de);	
}
function printReceta(id)
{
	ancho=710; alto=500;
	var _W=window.open('/imprimir-receta.php?id='+id,"_blank","scrollbars=yes,width="+ancho+",height="+alto); 
	_W.focus(); 
    iz=(screen.width-ancho) / 2;
    de=(screen.height-alto) / 2;
    _W.moveTo(iz,de);	
}
function share()
{

	var divShare = document.getElementById('share');
	if(divShare.style.display == 'block')
	{
		divShare.style.display = 'none';
	}else
	{
	divShare.style.display = 'block';
	}
}

function verReceta(imagen)
{
	ancho=800; alto=600;
	var _W=window.open('imagenes/recetas/'+imagen,'Platillo terminado.',"scrollbars=yes,width="+ancho+",height="+alto); 
	_W.focus(); 
    iz=(screen.width-ancho) / 2;
    de=(screen.height-alto) / 2;
    _W.moveTo(iz,de);	
}

function seleccion_estado(){
	var index=document.forms.fciudades.estados.selectedIndex;
	var PATH="www.galletasdonde.com/formulario";

	if (index==0){ 
		alert("Por favor Seleccione un estado");
	}

	if (index==1){
	document.location.href = 'contacto.php?id=empleo&valor=villahermosa&b=emp&a=1';
	}

	if (index==2){
	document.location.href='contacto.php?id=empleo&valor=tapachula&b=emp&a=2';
	}

	if (index==3){
	document.location.href='contacto.php?id=empleo&valor=campeche&b=emp&a=3';
	}

	if (index==4){
	document.location.href='contacto.php?id=empleo&valor=tuxtla&b=emp&a=4';
	}

	if (index==5){
	document.location.href='contacto.php?id=empleo&valor=cancun&b=emp&a=5';
	}

	if (index==6){
	document.location.href='contacto.php?id=empleo&valor=chetumal&b=emp&a=6';
	}


	if (index==7){
	document.location.href = 'contacto.php?id=empleo&valor=playa&b=emp&a=7';
	}

	if (index==8){
	document.location.href='contacto.php?id=empleo&valor=tampico&b=emp&a=8';
	}

	if (index==9){
	document.location.href='contacto.php?id=empleo&valor=cozumel&b=emp&a=9';
	}
	
	if (index==10){
	document.location.href='contacto.php?id=empleo&valor=ciudad&b=emp&a=10';
	}

	if (index==11){
	document.location.href='contacto.php?id=empleo&valor=oxcutzcab&b=emp&a=11';
	}

	if (index==12){
	document.location.href='contacto.php?id=empleo&valor=tizimin&b=emp&a=12';
	}

	if (index==13){
	document.location.href='contacto.php?id=empleo&valor=izamal&b=emp&a=13';
	}

	if (index==14){
	document.location.href='contacto.php?id=empleo&valor=maxcanu&b=emp&a=14';
	}

	if (index==15){
	document.location.href='contacto.php?id=empleo&valor=valladolid&b=emp&a=15';
	}

	if (index==16){
	document.location.href='contacto.php?id=empleo&valor=expendio&b=emp&a=16';
	}

	if (index==17){
	document.location.href='contacto.php?id=empleo&valor=expendiof&b=emp&a=17';
	}

	if (index==18){
	document.location.href='contacto.php?id=empleo&valor=mexico&b=emp&a=18';
	}

}

