var window_onload=new Array();
add_event("onload","contacto_init();");
function contacto_init() {
	//var bod=document.getElementsByTagName("body");
	document.body.style.height="100%";
	
	var o=document.createElement("div");
	o.setAttribute("id","negro");
	o.setAttribute("style","background-color:#000000;position:absolute;top:0px;left:0px;z-index:1000;height:100%;width:100%;visibility:hidden;");
	document.body.appendChild(o);
	
	o=document.createElement("div");
	o.setAttribute("id","contactopopcontainer");
	o.setAttribute("style","text-align:center;background:none;position:absolute;top:0px;left:0px;z-index:1001;height:100%;width:100%;visibility:hidden;");
	
	var p=document.createElement("div");
	p.setAttribute("class","contactopop");
	p.setAttribute("id","contactopop");
		
	o.appendChild(p);
	document.body.appendChild(o);
	
	var pgs=getPageSize();
	document.getElementById("negro").style.height=pgs[1]+"px";
	document.getElementById("contactopopcontainer").style.height=pgs[1]+"px";
	
	fade_step("negro",0.5,0,0);
	
	document.getElementById("contactopop").innerHTML='<a href="javascript:contacto_cerrar();" class="cerrar">x cerrar</a><h2 id="contit">¿Quieres más información?</h2><span id="contacto_res">Déjanos tus datos un número de teléfono o email  y nos pondremos en contacto.</span><form name="contacto" action="/contacto/enviar.php" method="post"><input name="bt" type="hidden" id="bt" value="'+contacto_w+'pop" /><label>Nombre:</label><label>Empresa:</label><input type="text" name="nombre" class="cl" /><input type="text" name="empresa" class="cl" /><label>Email:</label><label>Tel&eacute;fono:</label><input type="text" name="email" class="cl" /><input type="text" name="telefono" class="cl" /><label>Mensaje:</label> <textarea name="mensaje" class="ct"></textarea><input type="submit" name="submit" value="enviar" class="cb" /></form>';
}
function contacto(q,p) {
	if(typeof(q)=="string") {
		document.getElementById("contacto_res").innerHTML=q;
	} else {
		document.getElementById("contacto_res").innerHTML="";
	}
	
	document.getElementById("negro").style.visibility="visible";
	document.getElementById("contactopopcontainer").style.visibility="visible";
	
	var top=0;
	if(typeof(p)=="number") {
		top=650;
		document.getElementById("contit").innerHTML="Datos para la compra";
	} else {
		top=50;
		document.getElementById("contit").innerHTML="¿Quieres más información?";
	}
	document.getElementById("contactopop").style.marginTop=top+"px";
}
function contacto_cerrar() {
	document.getElementById("negro").style.visibility="hidden";
	document.getElementById("contactopopcontainer").style.visibility="hidden";
}

function fade_step(q,t,r,s) {
	var a_op;
	a_op=getopacity(q);
	var n_op;
	var n_op_ie;
	if(t>-1) {
		n_op=t;
		n_op_ie=t*100;
	} else {
		if(r>0) {
			n_op=a_op-r;
			n_op_ie=(a_op*100)-(r*100);
		} else if(s>0) {
			n_op=a_op+s;
			n_op_ie=(a_op*100)+(s*100);
		}
	}
	document.getElementById(q).style.filter="alpha(opacity="+n_op_ie+")";
	document.getElementById(q).style.opacity=n_op;
	document.getElementById(q).style.KHTMLOpacity=n_op;
	document.getElementById(q).style.MozOpacity=n_op;
}
function getopacity(q) {
	var a_op=document.getElementById(q).style.opacity;
	if(a_op==undefined) a_op=1; else a_op=parseFloat(a_op);
	return a_op;
}

function add_event(q,e) {
	switch(q) {
		case "onload":
			window_onload.push(e);
			break;
	}
}
window.onload=function() {
	for(i=0;i<window_onload.length;i++) {
		if(window_onload[i]!=""&&window_onload[i]!=undefined) {
			eval(window_onload[i]);
		}
	}
};

document.getElementsByClassName = function(cl) {
var retnode = [];
var myclass = new RegExp('\\b'+cl+'\\b');
var elem = this.getElementsByTagName('*');
for (var i = 0; i < elem.length; i++) {
var classes = elem[i].className;
if (myclass.test(classes)) retnode.push(elem[i]);
}
return retnode;
};
/*@cc_on
(function(f){
 window.setTimeout =f(window.setTimeout);
 window.setInterval =f(window.setInterval);
})(function(f){return function(c,t){var a=[].slice.call(arguments,2);return f(function(){c.apply(this,a)},t)}});
@*/
function getPageSize() {
     var xScroll, yScroll;
	
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = window.innerWidth + window.scrollMaxX;
			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
			if(document.documentElement.clientWidth){
				windowWidth = document.documentElement.clientWidth; 
			} else {
				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 = xScroll;		
		} else {
			pageWidth = windowWidth;
		}

		return [pageWidth,pageHeight];
	}

