function arrancar(){
	changeOpac(0, 'que_es');
	changeOpac(0, 'que_servicio');
	changeOpac(0, 'sombra10');
	changeOpac(0, 'coste_servicio');
    if (document.form1)
        document.form1.Promocion.value=promocion
}

window.onload=function(){arrancar()}

/***************************************************************/
/***************************************************************/
/***************************************************************/
/***************************************************************/

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

/***************************************************************/
/***************************************************************/

function NewWindow(theURL, hauteur, largeur) 
{
var winl = (screen.width - largeur) / 2;
var wint = (screen.height - hauteur) / 2;
winprops = 'height='+hauteur+',width='+largeur+',top='+wint+',left='+winl+',scrollbars=0'
win = window.open(theURL, "", winprops)
}

function NewWindowScroll(theURL, hauteur, largeur) 
{
var winl = (screen.width - largeur) / 2;
var wint = (screen.height - hauteur) / 2;
winprops = 'height='+hauteur+',width='+largeur+',top='+wint+',left='+winl+',scrollbars=1'
win = window.open(theURL, "", winprops)
}

function NewWindowScrollResize(theURL, hauteur, largeur) 
{
var winl = (screen.width - largeur) / 2;
var wint = (screen.height - hauteur) / 2;
winprops = 'height='+hauteur+',width='+largeur+',top='+wint+',left='+winl+',scrollbars=1,resizable=1'
win = window.open(theURL, "", winprops)
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&id.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n) ; return x;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function baja(email)
{
	if (confirm("¿Estás seguro?"))	frames["datos"].location.href="../content/comun/mailbaja.php?email="+email;
}

function muestracapa(capa) {
	document.getElementById(capa).style.display='inline';
}

function ocultacapa(capa) {
	document.getElementById(capa).style.display='none';
}


function olvido_mensaje(texto){
	capa=document.getElementById('olvido_msg')
	capa.innerHTML=texto
	capa.style.color="#FF3300"
}

function olvido_mensaje2(texto){
	capa=document.getElementById('olvido_msg2')
	capa.innerHTML=texto
	capa.style.color="#FF3300"
}

function valida_email_recomendar() {
		bien=true;
		
		if (document.form_recomendar.email.value==""){ bien=false;}
		
		if (document.form_recomendar.nombre.value==""){ bien=false;}
		
		if(bien==false){alert("Has de rellenar el nombre")}

		return bien;
}



/***************************************************************/
/***************************************************************/

/***************************************************************/
/***************************************************************/
	function valida_email_getpass() {
		bien=false;
		if (document.form2.email.value!="") bien=true;
		else	alert("Has de rellenar el email");
		return bien;
	}
/***************************************************************/
/***************************************************************/
function false_pop(id)
{
	//Detección de si es IE6
	str=navigator.userAgent
	response=str.search(/MSIE 6/)
	if(response>0){
	//Estamos en IE6 hay que escalar la capa de sombra porque IE6 no acepta : width=100%
		document.getElementById("que_es").style.position="absolute";
		document.getElementById("que_servicio").style.position="absolute";
		document.getElementById("coste_servicio").style.position="absolute";
		document.getElementById("sombra10").style.position="absolute";
		document.getElementById("sombra10").style.height=document.documentElement.clientHeight
		document.getElementById("sombra10").style.width=document.documentElement.clientWidth
	}
shiftOpacity(id, 500);
}



/***************************************************************/
/***************************************************************/


function opacity(id, opacStart, opacEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;

	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
		for(i = opacStart; i >= opacEnd; i--) {
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
		
	} else if(opacStart < opacEnd) {
		for(i = opacStart; i <= opacEnd; i++)
			{
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
			}
			
	}
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
        if (document.getElementById(id)) {
            var object = document.getElementById(id).style;
            object.opacity = (opacity / 100);
            object.MozOpacity = (opacity / 100);
            object.KhtmlOpacity = (opacity / 100);
            object.filter = "alpha(opacity=" + opacity + ")";

            if(opacity<1) document.getElementById(id).style.display="none";
            if(opacity>1) document.getElementById(id).style.display="block";
        }
}

function shiftOpacity(id, millisec) {	
	str=navigator.userAgent
response=str.search(/MSIE 6/)
	//if an element is invisible, make it visible, else make it ivisible 
	if(document.getElementById(id).style.opacity == 0) {
			if(response>0){
				document.forms["formulario"].style.display="none";
			}
			opacity(id, 0, 100, millisec);
			opacity("sombra10", 0, 40, 300) 
		} else {
			if(response>0){
				document.forms["formulario"].style.display="block";
			}
			opacity(id, 100, 0, millisec);
			opacity("sombra10", 40, 0, 300) 
		}
}


	function changecss(theClass,element,value) {
	//documentation for this script at http://www.shawnolson.net/a/503/
	 var cssRules;
	 if (document.all) {
	  cssRules = 'rules';
	 }
	 else if (document.getElementById) {
	  cssRules = 'cssRules';
	 }
	 for (var S = 0; S < document.styleSheets.length; S++){
	  for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
	   if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
	    document.styleSheets[S][cssRules][R].style[element] = value;
	   }
	  }
	 }	
	}
function blendimage(divid, imageid, imagefile, millisec) {
	var speed = Math.round(millisec / 100);
	var timer = 0;
	
	//set the current image as background
	document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
	
	//make image transparent
	changeOpac(0, imageid);
	
	//make new image
	document.getElementById(imageid).src = imagefile;

	//fade in image
	for(i = 0; i <= 100; i++) {
		setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
		timer++;
	}
}

function currentOpac(id, opacEnd, millisec) {
	//standard opacity is 100
	var currentOpac = 100;
	
	//if the element has an opacity set, get it
	if(document.getElementById(id).style.opacity < 100) {
		currentOpac = document.getElementById(id).style.opacity * 100;
	}

	//call for the function that changes the opacity
	opacity(id, currentOpac, opacEnd, millisec)
}


/***************************************************************/
/***************************************************************/

function opacity(id, opacStart, opacEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;
 
	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
		for(i = opacStart; i >= opacEnd; i--) {
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
		
	} else if(opacStart < opacEnd) {
		for(i = opacStart; i <= opacEnd; i++)
			{
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
			}
			
	}
}
 
//change the opacity for different browsers
function changeOpac(opacity, id) {
    if (document.getElementById(id)) {
        var object = document.getElementById(id).style;
        object.opacity = (opacity / 100);
        object.MozOpacity = (opacity / 100);
        object.KhtmlOpacity = (opacity / 100);
        object.filter = "alpha(opacity=" + opacity + ")";

        if(opacity<1) document.getElementById(id).style.display="none";
        if(opacity>1) document.getElementById(id).style.display="block";
    }
}
 
function shiftOpacity(id, millisec) {	
	str=navigator.userAgent
response=str.search(/MSIE 6/)
	//if an element is invisible, make it visible, else make it ivisible 
	if(document.getElementById(id).style.opacity == 0) {
			if(response>0){
				document.forms["formulario"].style.display="none";
			}
			opacity(id, 0, 100, millisec);
			opacity("sombra10", 0, 40, 300) 
		} else {
			if(response>0){
				document.forms["formulario"].style.display="block";
			}
			opacity(id, 100, 0, millisec);
			opacity("sombra10", 40, 0, 300) 
		}
}
 
 
	function changecss(theClass,element,value) {
	//documentation for this script at http://www.shawnolson.net/a/503/
	 var cssRules;
	 if (document.all) {
	  cssRules = 'rules';
	 }
	 else if (document.getElementById) {
	  cssRules = 'cssRules';
	 }
	 for (var S = 0; S < document.styleSheets.length; S++){
	  for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
	   if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
	    document.styleSheets[S][cssRules][R].style[element] = value;
	   }
	  }
	 }	
	}
function blendimage(divid, imageid, imagefile, millisec) {
	var speed = Math.round(millisec / 100);
	var timer = 0;
	
	//set the current image as background
	document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
	
	//make image transparent
	changeOpac(0, imageid);
	
	//make new image
	document.getElementById(imageid).src = imagefile;
 
	//fade in image
	for(i = 0; i <= 100; i++) {
		setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
		timer++;
	}
}
 
function currentOpac(id, opacEnd, millisec) {
	//standard opacity is 100
	var currentOpac = 100;
	
	//if the element has an opacity set, get it
	if(document.getElementById(id).style.opacity < 100) {
		currentOpac = document.getElementById(id).style.opacity * 100;
	}
 
	//call for the function that changes the opacity
	opacity(id, currentOpac, opacEnd, millisec)
}



