
var FORMULARIO=0;

var fechahoy=new Date();
var sem;

if (fechahoy.getMonth()==10 || fechahoy.getMonth()==11 || fechahoy.getMonth()==0   )     {

sem=1
				if (fechahoy.getMonth()==10 && fechahoy.getDate()<25){
				sem=0;
				}
				
				if (fechahoy.getMonth()==0 && fechahoy.getDate()>8){
				sem=0;
				}


}else{

sem=0;
}

//Snow - http://www.btinternet.com/~kurt.grigg/javascript
if (sem==1){
if  ((document.getElementById) && 
window.addEventListener || window.attachEvent){

(function(){

//Configure here.

var num = 150;   //Number of flakes
var timer = 30; //setTimeout speed. Varies on different comps

//End.

var y = [];
var x = [];
var fall = [];
var theFlakes = [];
var sfs = [];
var step = [];
var currStep = [];
var h,w,r;
var d = document;
var pix = "px";
var domWw = (typeof window.innerWidth == "number");
var domSy = (typeof window.pageYOffset == "number");
var idx = d.getElementsByTagName('div').length;

if (d.documentElement.style && 
typeof d.documentElement.style.MozOpacity == "string")
num = 12;

for (i = 0; i < num; i++){
sfs[i] = Math.round(1 + Math.random() * 20);

document.write('<div id="flake'+(idx+i)+'" style="position:absolute;top:0px;left:0px;width:'
+sfs[i]+'px;height:'+sfs[i]+'px;color:#ffffff;font-size:'+sfs[i]+'px">*<\/div>');

currStep[i] = 0;
fall[i] = (sfs[i] == 1)?
Math.round(2 + Math.random() * 2): Math.round(3 + Math.random() * 2);
step[i] = (sfs[i] == 1)?
0.05 + Math.random() * 0.1 : 0.05 + Math.random() * 0.05 ;
}


if (domWw) r = window;
else{ 
  if (d.documentElement && 
  typeof d.documentElement.clientWidth == "number" && 
  d.documentElement.clientWidth != 0)
  r = d.documentElement;
 else{ 
  if (d.body && 
  typeof d.body.clientWidth == "number")
  r = d.body;
 }
}


function winsize(){
var oh,sy,ow,sx,rh,rw;
if (domWw){
  if (d.documentElement && d.defaultView && 
  typeof d.defaultView.scrollMaxY == "number"){
  oh = d.documentElement.offsetHeight;
  sy = d.defaultView.scrollMaxY;
  ow = d.documentElement.offsetWidth;
  sx = d.defaultView.scrollMaxX;
  rh = oh-sy;
  rw = ow-sx;
 }
 else{
  rh = r.innerHeight;
  rw = r.innerWidth;
 }
h = rh - 2;  
w = rw - 2; 
}
else{
h = r.clientHeight - 22; 
w = r.clientWidth - 22; 
}
}


function scrl(yx){
var y,x;
if (domSy){
 y = r.pageYOffset;
 x = r.pageXOffset;
 }
else{
 y = r.scrollTop;
 x = r.scrollLeft;
 }
return (yx == 0)?y:x;
}


function snow(){
var dy,dx;

for (i = 0; i < num; i++){
 dy = fall[i];
 dx = fall[i] * Math.cos(currStep[i]);

 y[i]+=dy;
 x[i]+=dx; 

 if (x[i] >= w || y[i] >= h){
  y[i] = -10;
  x[i] = Math.round(Math.random() * w);
  fall[i] = (sfs[i] == 1)?
  Math.round(2 + Math.random() * 2): Math.round(3 + Math.random() * 2);
  step[i] = (sfs[i] == 1)?
  0.05 + Math.random() * 0.1 : 0.05 + Math.random() * 0.05 ;
 }
 
 theFlakes[i].top = y[i] + scrl(0) + pix;
 theFlakes[i].left = x[i] + scrl(1) + pix;

 currStep[i]+=step[i];
}
setTimeout(snow,timer);
}


function init(){
winsize();
for (i = 0; i < num; i++){
 theFlakes[i] = document.getElementById("flake"+(idx+i)).style;
 y[i] = Math.round(Math.random()*h);
 x[i] = Math.round(Math.random()*w);
}
snow();
}


if (window.addEventListener){
 window.addEventListener("resize",winsize,false);
 window.addEventListener("load",init,false);
}  
else if (window.attachEvent){
 window.attachEvent("onresize",winsize);
 window.attachEvent("onload",init);
} 

})();
document.style.overflow='hidden';
}//End.


}



function abrir_contactar(){
	FORMULARIO=0;
document.getElementById('banner').style.backgroundImage='url(img/contactar5.jpg)';
$('contenido_dispo').style.display='none'
$('enviado').style.display='none';
$('contenido2').style.display='none'
$('contenido').style.display='block'


try{
if (navigator.appName=="Microsoft Internet Explorer"){

document.body.onresize=function(){resiza();}
}else{

document.body.setAttribute("onresize", "resiza();");

}
//
resiza();
document.getElementById('banner').style.display='block';
document.getElementById('contenidobanner').style.display='block';
document.getElementById('fondo').style.display='block';
}catch(e){alert(e.message)}
}


function abrir_comprar(){
	FORMULARIO=1;
	document.getElementById('banner').style.backgroundImage='url(img/contactar7.jpg)';
	$('contenido_dispo').style.display='none'
$('enviado').style.display='none';
$('contenido').style.display='none'
$('contenido2').style.display='block'

try{
if (navigator.appName=="Microsoft Internet Explorer"){

document.body.onresize=function(){resiza();}
}else{

document.body.setAttribute("onresize", "resiza();");

}


//
resiza();
document.getElementById('banner').style.display='block';
document.getElementById('contenidobanner').style.display='block';
document.getElementById('fondo').style.display='block';
}catch(e){alert(e.message)}
}



function abrir_dispo(){
	FORMULARIO=1;
	document.getElementById('banner').style.backgroundImage='url(img/contactar5.jpg)';
	

$('enviado').style.display='none';
$('contenido').style.display='none'
$('contenido2').style.display='none'
	

$('contenido_dispo').style.display='block'

try{
if (navigator.appName=="Microsoft Internet Explorer"){

document.body.onresize=function(){resiza();}
}else{

document.body.setAttribute("onresize", "resiza();");

}


//
resiza();
document.getElementById('banner').style.display='block';
document.getElementById('contenidobanner').style.display='block';
document.getElementById('fondo').style.display='block';
}catch(e){alert(e.message)}
}



function resiza(){
if (navigator.appName=="Microsoft Internet Explorer"){
 var altura = parseInt(document.body.offsetHeight);
 var anchura= parseInt(document.body.offsetWidth);
  document.getElementById('fondo').style.height =altura//-33
}else
{
var altura = parseInt(window.innerHeight);
var anchura = parseInt(window.innerWidth);
document.getElementById('fondo').style.height =altura//-15
document.getElementById('fondo').style.width=anchura//-16
}
//document.getElementById('banner').style.marginTop =(altura-350)/2+'px'
document.getElementById('banner').style.marginTop =(altura-555)/2+'px'


}

function cerrar_contactar(){

document.getElementById('banner').style.display='none';
document.getElementById('tlegal').style.display='none';
document.getElementById('contenidobanner').style.display='none';
document.getElementById('fondo').style.display='none';



if (navigator.appName=="Microsoft Internet Explorer"){
document.body.onresize=function(){}

}else{

document.body.setAttribute("onresize", "");

}
	$('contenido').style.display='none'
		$('enviado').style.display='block';

}


function cerrar_dispo(){
document.getElementById('contenido_dispo').style.display='none';
document.getElementById('banner').style.display='none';
document.getElementById('tlegal').style.display='none';
document.getElementById('contenidobanner').style.display='none';
document.getElementById('fondo').style.display='none';
$('contenido_dispo').style.display='none'



if (navigator.appName=="Microsoft Internet Explorer"){
document.body.onresize=function(){}

}else{

document.body.setAttribute("onresize", "");

}
	$('contenido').style.display='none'
		$('enviado').style.display='block';

}




function querySt(ji) {

hu = window.location.search.substring(1);
gy = hu.split("&");
for (i=0;i<gy.length;i++) {
ft = gy[i].split("=");
if (ft[0] == ji) {
return ft[1];
}
}
}

function buscaquery(){
var pagina
if (querySt('pagina')){
		pagina=querySt('pagina')
		
		}else{
		pagina="";
		}

	if (pagina=="contactar")	{
	abrir_contactar();
	}else{
	
	
	}
}

function valida(n){
if (n==0){
var validado=0;

if ($('nombre').value =='' || $('email').value=='' || $('telefono').value==''){
validado=1;
}else{
validado=0;

}
}
		if (n==1){
		var elementos=document.getElementById('fcomprar').elements

					for (i = 0; i < elementos.length; i++){

							if (elementos[i].value==''){



						
							validado=1;
							break;




							}

					}

		}

return validado
}

function enviar(n){
var url='';
var chkl=''
if (n==0){
chkl='chklegal'
url="contacto/envia2.asp"
}
if (n==1){
chkl='chklegal2'
url="contacto/envia2mas.asp"
}
if (! $(chkl).checked){
alert('Debe de estar de acuerdo con los términos legales')

}else{

if (valida(n)==1){

alert('Debe de rellenar los campos obligatorios')
}else{
var semaforo=0
var parametros='';
var fe=new Date();
if (n==0){
parametros=parametros+Form.serialize('fcontactar'); 
}
if (n==1){
parametros=parametros+Form.serialize('fcomprar'); 

}
parametros=parametros+'&time='+fe.getTime()
$('fcontactar').reset();
$('fcomprar').reset();
$('contenido').style.display='none'
$('contenido2').style.display='none'
$('enviado').style.display='block';
$('enviado').innerHTML='<br><br><img src="img/cargando.gif">';



navegant2 = new Ajax.Request( url, {
											parameters:  parametros,
											method:"post",											
											//contentType: 'multipart/form-data ',
											asynchronous: "True",
											// encoding:'iso-8859-1' ,
											onComplete: function(resp){
											respuesta=resp.responseText;
											//alert(respuesta)
											//muestrap(2,respuesta)
											//alert(resp.responseText);
									     
										$('contenido').style.display='none' 
										$('contenido2').style.display='none'
										$('enviado').style.display='block';
										$('enviado').innerHTML='  <br><br><br><label style="font-size:14px;font-weight:bold;font-family:arial;color:#fffffff"><div style="font-size:14px;font-weight:bold;font-family:arial;color:#fffffff;">Se ha enviado correctamente su consulta.</div><div style="font-size:14px;font-weight:bold;font-family:arial;color:#fffffff"><br>En un espacio breve de tiempo contactaremos con usted.</div><br /><br />Gracias</div></label>'
										
											}
										
										
											 }
											 
											 
											
											 
											 
										
							   ); 	
							   
							  
							   

}
}
}
