function cargarTiendas(element,mall){
	var rubro = element.options[element.selectedIndex].value;

	nombMall = mall.split(" ");
	nombreM = nombMall[0]+nombMall[1];
	nMall = nombreM.split("undefined");
	nombreMall = nMall[0];

	if(rubro != ''){
		location.href = '../../'+nombreMall+'/tiendas/tiendas.php?&rubro='+rubro+'&mall='+mall;
	}
}

function tiendaDetail(element, mall){
	var elem = document.busqueda;

	rubroSel = elem.rubro.options[elem.rubro.selectedIndex].value;
	tienda = element.options[element.selectedIndex].value;

	nombMall = mall.split(" ");
	nombreM = nombMall[0]+nombMall[1];
	nMall = nombreM.split("undefined");
	nombreMall = nMall[0];
	//	alert(nombMall[1])
	location.href = '../../'+nombreMall+'/tiendas/tiendas_detalle.php?id='+tienda+'&rubro='+rubroSel;

}

/*function loadCupon(id_cupon){

	

	var arrayPageSize = getPageSize();

	document.getElementById('fade').style.height = arrayPageSize[1] + 'px';

  

  	send_data = 'id='+id_cupon;



	Effect.Appear('fade');

	new Ajax.Updater('main','../../inc/php/cupon.php', {

		method:'get',

		parameters : send_data,

		evalScripts: true,

		onSuccess : function(t){

				var elem = document.getElementById('light');

				var elem2 = document.getElementById('fade');				

			

				elem.innerHTML = t.responseText;

				elem.style.display = 'block';

				elem2.style.display = 'block';

		}

  });

 }*/

 

 







// getPageSize()

// Returns array with page width, height and window width, height

// Core code from - quirksmode.com

// Edit for Firefox by pHaez

//

function getPageSize(){

	var xScroll, yScroll;

	if (window.innerHeight && window.scrollMaxY) {	

		xScroll = document.body.scrollWidth;

		yScroll = window.innerHeight + window.scrollMaxY;

	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac

		xScroll = document.body.scrollWidth;

		yScroll = document.body.scrollHeight;

	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari

		xScroll = document.body.offsetWidth;

		yScroll = document.body.offsetHeight;

	}

	var windowWidth, windowHeight;

	if (self.innerHeight) {	// all except Explorer

		windowWidth = self.innerWidth;

		windowHeight = self.innerHeight;

	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode

		windowWidth = document.documentElement.clientWidth;

		windowHeight = document.documentElement.clientHeight;

	} else if (document.body) { // other Explorers

		windowWidth = document.body.clientWidth;

		windowHeight = document.body.clientHeight;

	}		

	// for small pages with total height less then height of the viewport

	if(yScroll < windowHeight){

		pageHeight = windowHeight;

	} else { 

		pageHeight = yScroll;

	}

	// for small pages with total width less then width of the viewport

	if(xScroll < windowWidth){	

	pageWidth = windowWidth;

	} else {



		pageWidth = xScroll;

	}

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 

	return arrayPageSize;



}





function getPageScroll(){



	var xScroll, yScroll;



	if (self.pageYOffset) {

		yScroll = self.pageYOffset;

		xScroll = self.pageXOffset;

	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict

		yScroll = document.documentElement.scrollTop;

		xScroll = document.documentElement.scrollLeft;

	} else if (document.body) {// all other Explorers

		yScroll = document.body.scrollTop;

		xScroll = document.body.scrollLeft;	

	}



	arrayPageScroll = new Array(xScroll,yScroll) 

	return arrayPageScroll;

}





function showBlockPantallaForm(id){

	var idElem = 'puntuacion';

	var block = $('blockPantallaWarn');

	var msg;

	var alto;

	var ancho;

	var pageSize = getPageSize();

	var mgsHeight;

	var msgWidth;

	

	block.style.height = pageSize[1]+'px';

	block.style.width = pageSize[0]+'px';

	

	msg = $(idElem);

	msg.style.opacity = 0.7;

	Effect.Appear(idElem);

	Effect.Appear('blockPantallaWarn', {to:0.7});

	

	

	 alto = pageSize[3];

	 ancho = pageSize[2];



	var aux = function (){

		var varAux =pageSize[1];

		msgWidth = msg.offsetWidth;

		msgHeight = msg.offsetHeight;

		//alert(msgWidth +'-'+msgHeight);

		var sasa = getPageScroll();

		//alert(varAux+'-'+ancho+'-'+sasa[1]+'-'+msgHeight);

		msg.style.top = ((((Math.floor(varAux/2)) - ((Math.floor(msgHeight))/2))/2) + (sasa[1])) +'px';

		msg.style.left = ((Math.floor(ancho/2)) + document.body.scrollLeft - (Math.floor(msgWidth/2)))+'px';	

		

	}

	

	setTimeout(aux, 200);

	new Ajax.Updater(idElem, '../../inc/php/cupon.php?id='+id);

} 

 

function ocultar(){

	var block = $('blockPantallaWarn');

	if(block)

		Effect.Fade('blockPantallaWarn');



	var msg = $('puntuacion');

	

	if(msg) {

		Effect.Fade('puntuacion');	

	}

}

// isMail: devuelve verdadero si value es una direccion de correo valida
function isMail(value) {
    try
	{
		var pattern=new RegExp("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");
		return value.match(pattern);
	}
	catch(e)
	{
		return false;
	}
}


function show_elem(valores)
	{
		arreglo = valores.split(',');
		for(i=0;i<arreglo.length;i++)
		{
			window.document.getElementById(arreglo[i]).style.display='';
		}
	}
	
function hide_elem(valores)
	{
		arreglo = valores.split(',');
		for(i=0;i<arreglo.length;i++)
		{
			window.document.getElementById(arreglo[i]).style.display='none';
		}
	}


function validaInscripcion(form)
{
	if(!isMail(form.email.value)) // Valida que no venga vacio y sea un e-mail válido 
	{
		alert('Ingrese su e-mail')  // Si no es valido envia un alerta
		form.email.focus(); // Pone el cursor en el campo validado
 		form.email.select(); // Selecciona el texto ingresado en el campo
		return false; // Detine el envio del formulario
	}
	
return; 

}
