//para insertar flash
function pongoflash(pelicula,ancho,alto){
		document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0' width='"+ancho+"' height='"+alto+"'>");
		document.write("<param name='movie' value='"+pelicula+"' />");
		document.write("<param name='quality' value='high' />");
		document.write("<param name='allowScriptAccess' value='always' />");
		document.write("<embed src='"+pelicula+"' quality='high' pluginspage='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='"+ancho+"' height='"+alto+"'></embed>");
		document.write("</object>");
}

//para insertar flash transparente
function flash(pelicula,ancho,alto){
		document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0' width='"+ancho+"' height='"+alto+"'>");
		document.write("<param name='movie' value='"+pelicula+"' />");
		document.write("<param name='quality' value='high' />");
		document.write("<param name='wmode' value='transparent' />");
		document.write("<embed src='"+pelicula+"' quality='high' pluginspage='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' wmode='transparent' width='"+ancho+"' height='"+alto+"'></embed>");
		document.write("</object>");
}

//para insertar pop-up centrados
function popup(pag,alto,ancho){

resx = screen.width;
resy = screen.height;
posx = (resx-ancho)/2
posy = (resy-alto)/2



propiedades="width="+ancho+", height="+alto+",top="+posy+",left="+posx+",scrollbars=yes, toolbar=no";
window.open(pag,"x",propiedades)

}

function botogaleria(idseccion){
 var seccion;
 
 seccion = document.getElementById(idseccion);
 seccion.innerHTML = "<span class='menuseleccionado'>"+idseccion+"</span>"  
}

function botonera(idelem) {
	//alert(idelem)
	document.getElementById(idelem).className = "bottom"
}
function equalHeight(group) {
    tallest = 0;
    group.each(function() {
        thisHeight = $(this).height();
        if(thisHeight > tallest) {
            tallest = thisHeight;
        }			
    });
    group.height(tallest);
}
function equalHeight2(group2) {
    tallest2 = 0;
    group2.each(function() {
        thisHeight2 = $(this).height();
        if(thisHeight2 > tallest2) {
            tallest2 = thisHeight2;
        }
    });
    group2.height(tallest2);
}

function validaasistente(){
	var erroneos = new Array();
	i = 0;
	pass = true;
	mailmal = false;
	var	mensaje1 = "Debe completar los datos marcados con *.";
	var mensaje2 = "Debe aceptar los términos y condiciones.";
	var mensaje3 = "Ingrese una dirección de e-mail válida.";
	
	if(document.getElementById("nombre").value == "") {
		erroneos[i] = "nombre";
		i++;
		pass = false;
	}
	if(document.getElementById("apellido").value == "") {
		erroneos[i] = "apellido";
		i++;
		pass = false;		
	}
	if(document.getElementById("email").value == "") {
		erroneos[i] = "email";
		i++;
		pass = false;		
	} 
	else {
		var b=/^[^@\s]+@[^@\.\s]+(\.[^@\.\s]+)+$/
		if(! b.test(document.getElementById("email").value)){
			erroneos[i] = "email";
			i++;
			mailmal = true;		
		}
	}

	var term = true;
	if(document.getElementById("terminos").checked == false){
		term = false;
	}
	
	if(!pass){
		for(j=0; j<erroneos.length; j++){
			document.getElementById(erroneos[j]).className="boxmal";
		}
		document.getElementById("mensaje").innerHTML=mensaje1;
		document.getElementById("mensaje").className="visible";
		return false;
	} else {
		if(mailmal == true){
			document.getElementById("mensaje").innerHTML=mensaje3;
			document.getElementById("mensaje").className="visible";
			return false;
		} else {
			if(!term){
				document.getElementById("mensaje").innerHTML=mensaje2;
				document.getElementById("mensaje").className="visible";
				return false;
			}
		}
	} 
	return true;

}
function validacontacto(){
	var erroneos = new Array();
	i = 0;
	pass = true;
	mailmal = false;
	var	mensaje1 = "Debe completar los datos marcados con *.";
	var mensaje2 = "Debe aceptar los términos y condiciones.";
	var mensaje3 = "Ingrese una dirección de e-mail válida.";
	
	if(document.getElementById("nombre").value == "") {
		erroneos[i] = "nombre";
		i++;
		pass = false;
	}
	if(document.getElementById("apellido").value == "") {
		erroneos[i] = "apellido";
		i++;
		pass = false;		
	}
	if(document.getElementById("email").value == "") {
		erroneos[i] = "email";
		i++;
		pass = false;		
	} 
	if(document.getElementById("dianac").value == "") {
		erroneos[i] = "dianac";
		i++;
		pass = false;		
	}
	if(document.getElementById("mesnac").value == "") {
		erroneos[i] = "mesnac";
		i++;
		pass = false;		
	}
	if(document.getElementById("anionac").value == "") {
		erroneos[i] = "anionac";
		i++;
		pass = false;		
	}
	if(document.getElementById("direccion").value == "") {
		erroneos[i] = "direccion";
		i++;
		pass = false;		
	}
	else {
		var b=/^[^@\s]+@[^@\.\s]+(\.[^@\.\s]+)+$/
		if(! b.test(document.getElementById("email").value)){
			erroneos[i] = "email";
			i++;
			mailmal = true;		
		}
	}

	var term = true;
	if(document.getElementById("terminos").checked == false){
		term = false;
	}
	
	if(!pass){
		for(j=0; j<erroneos.length; j++){
			document.getElementById(erroneos[j]).className="boxmal";
		}
		document.getElementById("mensaje").innerHTML=mensaje1;
		document.getElementById("mensaje").className="visible";
		return false;
	} else {
		if(mailmal == true){
			document.getElementById("mensaje").innerHTML=mensaje3;
			document.getElementById("mensaje").className="visible";
			return false;
		} else {
			if(!term){
				document.getElementById("mensaje").innerHTML=mensaje2;
				document.getElementById("mensaje").className="visible";
				return false;
			}
		}
	} 
	return true;

}

function validarecomendacion(){
	var erroneos = new Array();
	i = 0;
	pass = true;
	mailmal = false;
var	mensaje1 = "Todos los campos son obligatorios.";
	var mensaje3 = "Ingrese una dirección de e-mail de destino válida.";
	
	if(document.getElementById("nombre").value == "") {
		erroneos[i] = "nombre";
		i++;
		pass = false;
	}
	if(document.getElementById("nombredest").value == "") {
		erroneos[i] = "nombredest";
		i++;
		pass = false;		
	}
	if(document.getElementById("emailorig").value == "") {
		erroneos[i] = "emailorig";
		i++;
		pass = false;		
	} 
	if(document.getElementById("emaildest").value == "") {
		erroneos[i] = "emaildest";
		i++;
		pass = false;		
	}
	else {
		var b=/^[^@\s]+@[^@\.\s]+(\.[^@\.\s]+)+$/
		if(! b.test(document.getElementById("emaildest").value)){
			erroneos[i] = "emaildest";
			i++;
			mailmal = true;		
		}
	}
	
	if(!pass){
		for(j=0; j<erroneos.length; j++){
			document.getElementById(erroneos[j]).className="boxmalamigo";
		}
		document.getElementById("mensaje").innerHTML=mensaje1;
		document.getElementById("mensaje").className="visibleamigo";
		return false;
	} else {
		if(mailmal == true){
			document.getElementById("mensaje").innerHTML=mensaje3;
			document.getElementById("mensaje").className="visibleamigo";
			return false;
		} 
	} 
	return true;

}



function popupHome(nombre,imagen,ancho,alto,link) {
	resx = screen.width;
	resy = screen.height;
	posx = (resx - ancho)/2;
	posy = (resy - alto)/2;
	
	
	
	ultpunto = imagen.lastIndexOf(".");
	ext = imagen.substring(ultpunto+1,imagen.length);
	
	if(ext != "swf") {
		salida = "<html><head><title>"+nombre+"</title></head><body style='margin:0px'>";
		if(link != "") {
			salida+="<a href='javascript:window.opener.document.location=\""+link+"\"; window.close()'><img src='imgpopups/"+imagen+"' border='0' width='"+ancho+"' height='"+alto+"'></a>"
		} else {
			salida+="<a href='javascript:window.close()'><img src='imgpopups/"+imagen+"' border='0' width='"+ancho+"' height='"+alto+"'></a>"
		}
		salida+="</body></html>";
	} else {
		salida = "<html><head><title>"+nombre+"</title></head><body style='margin:0px'>";
		salida+="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0' width='"+ancho+"' height='"+alto+"'>";
		salida+="<param name='movie' value='imgpopups/"+imagen+"' />";
		salida+="<param name='quality' value='high' />";
		salida+="<param name='allowScriptAccess' value='always' />";
		salida+="<embed src='imgpopups/"+imagen+"' quality='high' pluginspage='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='"+ancho+"' height='"+alto+"'></embed>";
		salida+="</object>";
		salida+="</body></html>";
	}
	ventana = window.open("","x","width="+ancho+",height="+alto+",top="+posy+",left="+posx+",scrollbars=no,toolbar=no,resizable");
	ventana.document.open();
	ventana.document.write(salida);
	ventana.document.close();
}


