var ie=(document.all) ? 1:0;
var n4=(document.layers) ? 1:0;
var n6=(document.getElementById) ? 1:0;  

function scrollIt(ev){
	var pos = "";
	if(window.parent.pageYOffset){
		pos = window.parent.pageYOffset;
	}else {
		pos = Math.max(window.parent.document.body.scrollTop,window.parent.document.documentElement.scrollTop);
	}
	window.parent.document.getElementById('interstt1').style.top  = pos + "px";
	window.parent.document.getElementById('interstt2').style.top  = pos + "px";
}

function scrollItInterno(ev){
	var pos = "";
	if(window.parent.pageYOffset){
		pos = window.parent.pageYOffset;
	}else {
		pos = Math.max(window.parent.document.body.scrollTop,window.parent.document.documentElement.scrollTop);
	}
	window.parent.document.getElementById('interstt1').style.top  = pos + "px";
	window.parent.document.getElementById('interstt2').style.top  = pos + "px";
}

function scrollItVentajas(ev){
	var pos = "";
	if(window.pageYOffset){
		pos = window.pageYOffset;
	}else {
		pos = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
	}

	document.getElementById('interstt1').style.top  = pos + "px";
	//document.getElementById('interstt2').style.top  = pos + "px";
}

function clearJorBox(padre){
	if (padre==true){
		//alert(parent.document.getElementById("interstt2"));
		parent.document.getElementById("interstt2").style.display="none";
		parent.document.getElementById("interstt1").style.display="none";
	}else{
		document.getElementById("interstt1").style.display="none";
		document.getElementById("interstt2").style.display="none";
	}
}
function clearJorBoxInterna(padre){
	if (window.parent.document.getElementById("interstt2")){
		parent.document.getElementById("interstt2").style.display="none";
		parent.document.getElementById("interstt1").style.display="none";
		//document.getElementById("interstt1").style.display="none";
		//document.getElementById("interstt2").style.display="none";
	}else{
		//document.getElementById("interstt1").style.display="none";
		//document.getElementById("interstt2").style.display="none";
	}
}


function displayCloseButton(){
	//alert(document.getElementById("btn_close"));
	document.getElementById("btn_close").style.display="";
}

function loadJorBox(url){
window.parent.onscroll=scrollIt;

var tmp="";
tmp += "<div id='interstt1' style='opacity:0.5;filter:alpha(opacity=50);position: absolute; top: 0px; left: 0px; width:100%;height:100%;z-index:1000;background-color:#000'></div>";
//tmp += "<div id='interstt2' style='position: absolute; top: 0px; left: 0px; width:100%;height:100%;z-index:1001;background-image:url(http://www.adsl-jazztelonline.com/images/comprobador/fondo.comprobador.direccion.png);background-repeat:no-repeat;background-position:center'>";
tmp += "<div id='interstt2' style='position: absolute; top: 0px; left: 0px; width:100%;height:100%;z-index:1001;'>";
tmp += "<table width='100%' height='100%' cellspacing='0' cellpadding='0' align='center' border='0' style=''>";
tmp += "<tr>";	
tmp += "<td valign='center' align='center' style=''>";
tmp += "<iframe src='"+url+"' style='width:435px; height:495px;' frameborder='0' scrolling='no' allowtransparency='yes'></iframe>";
tmp += "</td>";
tmp += "</tr>";
tmp += "</table>";
tmp += "</div>";
//paco=document.body.innerHTML;
//document.body.innerHTML=tmp+paco;

	if (window.parent.document.getElementById("divTraca")){
		if(ie){    
			window.parent.document.all["divTraca"].innerHTML = tmp;
		}else{
			if(n4){
				window.parent.document.layers["divTraca"].innerHTML = tmp;
			}else{
				if(n6){      
					window.parent.document.getElementById("divTraca").innerHTML = tmp;
				}
			}
		}
	}else{
		fi = window.parent.document.body;
		contenedor = window.parent.document.createElement('div');
		contenedor.id = 'divTraca';
		contenedor.innerHTML=tmp;
		fi.appendChild(contenedor);
	}
}

function loadJorBoxRegalos(){
window.parent.window.scrollTo(0,0);
window.parent.window.onscroll=scrollItInterno;

var tmp="";
tmp += "<div id='interstt1' style='opacity:0.5;filter:alpha(opacity=50);position: absolute; top: 0px; left: 0px; width:100%;height:100%;z-index:1000;background-color:#000'></div>";
tmp += "<div id='interstt2' style='position: absolute; top: 0px; left: 0px; width:100%;height:100%;z-index:1001;'>";
tmp += "<table width='100%' height='100%' cellspacing='0' cellpadding='0' align='center' border='0'>";
tmp += "<tr>";    
tmp += "<td valign='center' align='center' style=''>";
tmp += "<table width='419' height='326' cellspacing='0' cellpadding='0' align='center' border='0' style='background-image:url(/images/banner.comprobador.png);background-repeat:no-repeat'>";
tmp += "<tr>";    
tmp += "<td valign='top' align='left' style='padding-top:47px;padding-left:205px'>";
tmp += "<img src='/images/comprobando.gif' />";
tmp += "</td>";
tmp += "</tr>";
tmp += "</table>";
tmp += "</td>";
tmp += "</tr>";
tmp += "</table>";
tmp += "</div>";

//paco=document.body.innerHTML;
//document.body.innerHTML=tmp+paco;

    if (window.parent.document.getElementById("divTraca")){
        if(ie){    
            window.parent.document.all["divTraca"].innerHTML = tmp;
        }else{
            if(n4){
                window.parent.document.layers["divTraca"].innerHTML = tmp;
            }else{
                if(n6){      
                    window.parent.document.getElementById("divTraca").innerHTML = tmp;
                }
            }
        }
    }else{
        fifi= window.parent.document.body;
        contenedor = document.createElement('div');
        contenedor.id = 'divTraca';
        contenedor.innerHTML=tmp;
        fifi.appendChild(contenedor);
        
    }
}

function loadJorBoxVentajas(){
window.scrollTo(0,0);
window.onscroll=scrollItVentajas;

var tmp="";
tmp += "<div id='interstt1' style='opacity:0.5;filter:alpha(opacity=50);position: absolute; top: 0px; left: 0px; width:100%;height:100%;z-index:1000;background-color:#000'></div>";
tmp += "<div id='interstt2' style='position: absolute; top: 0px; left: 0px; width:100%;height:100%;z-index:1001;'>";
tmp += "<table width='100%' height='100%' cellspacing='0' cellpadding='0' align='center' border='0' style=''>";
tmp += "<tr>";	
tmp += "<td valign='center' align='center'>";
tmp += "<a href=\"javascript:cerrarVentana(false)\"><img src=\"/images/ventajas1.png\" width=\"561\" height=\"55\" style=\"display:block\"/></a>";
tmp += "</td></tr>";
tmp += "<tr><td valign='center' align='center'>";
tmp += "<img src=\"/images/ventajas2.png\" width=\"561\" height=\"825\" style=\"display:block\"/>";
tmp += "</td></tr>";
tmp += "</tr>";
tmp += "</table>";
tmp += "</div>";
//paco=document.body.innerHTML;
//document.body.innerHTML=tmp+paco;

	if (document.getElementById("divTraca")){
		if(ie){    
			document.all["divTraca"].innerHTML = tmp;
		}else{
			if(n4){
				document.layers["divTraca"].innerHTML = tmp;
			}else{
				if(n6){      
					document.getElementById("divTraca").innerHTML = tmp;
				}
			}
		}
	}else{
		fi = document.body;
		contenedor = document.createElement('div');
		contenedor.id = 'divTraca';
		contenedor.innerHTML=tmp;
		fi.appendChild(contenedor);
	}
}

function loadJorBoxTerms(url){
window.scrollTo(0,0);
window.onscroll=scrollIt;

var tmp="";
tmp += "<div id='interstt1' style='opacity:0.5;filter:alpha(opacity=50);position: absolute; top: 0px; left: 0px; width:100%;height:100%;z-index:1000;background-color:#000'></div>";
tmp += "<div id='interstt2' style='position: absolute; top: 0px; left: 0px; width:100%;height:100%;z-index:1001;background-image:url(/images/terms/fondo.pol.privacidad.png);background-repeat:no-repeat;background-position:center'>";
tmp += "<table width='100%' height='100%' cellspacing='0' cellpadding='0' align='center' border='0' style=''>";
tmp += "<tr>";	
tmp += "<td valign='center' align='center' style=''>";
tmp += "<iframe src='"+url+"' style='width:628px; height:407px;' frameborder='0' scrolling='no' allowtransparency='yes'></iframe>";
tmp += "</td>";
tmp += "</tr>";
tmp += "</table>";
tmp += "</div>";

//paco=document.body.innerHTML;
//document.body.innerHTML=tmp+paco;

	if (document.getElementById("divTraca")){
		if(ie){    
			document.all["divTraca"].innerHTML = tmp;
		}else{
			if(n4){
				document.layers["divTraca"].innerHTML = tmp;
			}else{
				if(n6){      
					document.getElementById("divTraca").innerHTML = tmp;
				}
			}
		}
	}else{
		fi = document.body;
		contenedor = document.createElement('div');
		contenedor.id = 'divTraca';
		contenedor.innerHTML=tmp;
		fi.appendChild(contenedor);
	}
}

function loadJorBoxTermsInterno(url){
clearJorBox(true);
window.parent.window.scrollTo(0,0);
window.parent.window.onscroll=scrollItInterno;

var tmp="";
tmp += "<div id='interstt1' style='opacity:0.5;filter:alpha(opacity=50);position: absolute; top: 0px; left: 0px; width:100%;height:100%;z-index:1000;background-color:#000'></div>";
tmp += "<div id='interstt2' style='position: absolute; top: 0px; left: 0px; width:100%;height:100%;z-index:1001;background-image:url(/images/terms/fondo.pol.privacidad.png);background-repeat:no-repeat;background-position:center'>";
tmp += "<table width='100%' height='100%' cellspacing='0' cellpadding='0' align='center' border='0' style=''>";
tmp += "<tr>";	
tmp += "<td valign='center' align='center' style=''>";
tmp += "<iframe src='"+url+"' style='width:628px; height:407px;' frameborder='0' scrolling='no' allowtransparency='yes'></iframe>";
tmp += "</td>";
tmp += "</tr>";
tmp += "</table>";
tmp += "</div>";

//paco=document.body.innerHTML;
//document.body.innerHTML=tmp+paco;

	if (document.getElementById("divTraca")){
		if(ie){    
			document.all["divTraca"].innerHTML = tmp;
		}else{
			if(n4){
				document.layers["divTraca"].innerHTML = tmp;
			}else{
				if(n6){      
					document.getElementById("divTraca").innerHTML = tmp;
				}
			}
		}
	}else{
		fi = window.parent.document.body;
		contenedor = document.createElement('div');
		contenedor.id = 'divTraca';
		contenedor.innerHTML=tmp;
		fi.appendChild(contenedor);
	}
}

function cerrarVentana(a){
	clearJorBox(true);
}

function cerrarVentanaInterna(a){
	clearJorBoxInterna(true);
}

function loadJorBoxNuevo(url){
window.parent.onscroll=scrollIt;

var tmp="";
tmp += "<div id='interstt1' style='background-color:black;opacity:0.5;filter:alpha(opacity=50);position: absolute; top: 0px; left: 0px; width:100%;height:100%;z-index:1000;'></div>";
tmp += "<div id='interstt2' style='position: absolute; top: 0px; left: 0px; width:100%;height:100%;z-index:1001;'>";
tmp += "<table width='100%' height='100%' cellspacing='0' cellpadding='0' align='center' border='0' style=''>";
tmp += "<tr>";	
tmp += "<td valign='center' align='center' style=''>";
tmp += "<iframe src='"+url+"' style='width:900px; height:577px;' frameborder='0' scrolling='no' allowtransparency='yes'></iframe>";
tmp += "</td>";
tmp += "</tr>";
tmp += "</table>";
tmp += "</div>";
//paco=document.body.innerHTML;
//document.body.innerHTML=tmp+paco;

	if (window.parent.document.getElementById("divTraca")){
		if(ie){    
			window.parent.document.all["divTraca"].innerHTML = tmp;
		}else{
			if(n4){
				window.parent.document.layers["divTraca"].innerHTML = tmp;
			}else{
				if(n6){      
					window.parent.document.getElementById("divTraca").innerHTML = tmp;
				}
			}
		}
	}else{
		fi = window.parent.document.body;
		contenedor = window.parent.document.createElement('div');
		contenedor.id = 'divTraca';
		contenedor.innerHTML=tmp;
		fi.appendChild(contenedor);
	}
}

function loadJorBoxRegalos1(url){
window.parent.onscroll=scrollIt;

var tmp="";
tmp += "<div id='interstt1' style='background-color:black;opacity:0.5;filter:alpha(opacity=50);position: absolute; top: 0px; left: 0px; width:100%;height:100%;z-index:1000;'></div>";
tmp += "<div id='interstt2' style='position: absolute; top: 0px; left: 0px; width:100%;height:100%;z-index:1001;'>";
tmp += "<table width='100%' height='100%' cellspacing='0' cellpadding='0' align='center' border='0' style=''>";
tmp += "<tr>";	
tmp += "<td valign='center' align='center' style=''>";
tmp += "<iframe src='"+url+"' style='width:900px; height:500px;' frameborder='0' scrolling='no' allowtransparency='yes'></iframe>";
tmp += "</td>";
tmp += "</tr>";
tmp += "</table>";
tmp += "</div>";
//paco=document.body.innerHTML;
//document.body.innerHTML=tmp+paco;

	if (window.parent.document.getElementById("divTraca")){
		if(ie){    
			window.parent.document.all["divTraca"].innerHTML = tmp;
		}else{
			if(n4){
				window.parent.document.layers["divTraca"].innerHTML = tmp;
			}else{
				if(n6){      
					window.parent.document.getElementById("divTraca").innerHTML = tmp;
				}
			}
		}
	}else{
		fi = window.parent.document.body;
		contenedor = window.parent.document.createElement('div');
		contenedor.id = 'divTraca';
		contenedor.innerHTML=tmp;
		fi.appendChild(contenedor);
	}
}



/************************************************** JORBOX MANOLO **************************************************/

var LB_ie=(document.all) ? 1:0;
var LB_n4=(document.layers) ? 1:0;
var LB_n6=(document.getElementById) ? 1:0;  

function LB_scrollIt(ev){
    var pos = "";
    if(window.top.pageYOffset){
        pos = window.top.pageYOffset;
    }else {
        pos = Math.max(window.top.document.body.scrollTop,window.top.document.documentElement.scrollTop);
    }
    window.top.document.getElementById('LB_inte1').style.top  = pos + "px";
    window.top.document.getElementById('LB_inte2').style.top  = pos + "px";
}

function LB_clearJorBox(padre){
    if (padre==true){
        window.top.document.getElementById('LB_inte2').style.display="none";
        window.top.document.getElementById('LB_inte1').style.display="none";
    }else{
        document.getElementById('LB_inte1').style.display="none";
        document.getElementById('LB_inte2').style.display="none";
    }
}

function LB_loadJorBox(url, w, h, opt){
    if(window.pageYOffset){
        pos = window.pageYOffset;
    }else {
        pos = Math.max(window.top.document.body.scrollTop,window.top.document.documentElement.scrollTop);
    }
    
    window.top.onscroll=LB_scrollIt;
    w = parseInt(w) + 55;
    h = parseInt(h) + 40;
    var tmp="";
    tmp += "<div id='LB_inte1' style='background-color:black;opacity:0.5;filter:alpha(opacity=50);position: absolute; top: "+pos+"px; left: 0px; width:100%;height:100%;z-index:1000;'></div>";
    tmp += "<div id='LB_inte2' style='position: absolute; top: "+pos+"px; left: 0px; width:100%;height:100%;z-index:1001;'>";
    tmp += "<table width='100%' height='100%' cellspacing='0' cellpadding='0' align='center' border='0' style=''>";
    tmp += "<tr>";
    tmp += "<td valign='center' align='center' style=''>";
    tmp += "<table width='"+w+"' height='"+h+"' cellspacing='0' cellpadding='0' align='center' border='0'>";
    tmp += "<tr><td valign='center' align='center' style=''>";
    
    tmp += "<iframe src='"+url+"' style='width:"+w+"px; height:"+h+"px;' frameborder='0' scrolling='no' allowtransparency='yes'></iframe>";
    
    tmp += "</td></tr>";
    tmp += "</table>";
    tmp += "</td>";
    tmp += "</tr>";
    tmp += "</table>";
    tmp += "</div>";

    if (window.top.document.getElementById("LB_divTraca")){
        if(LB_ie){    
            window.top.document.all["LB_divTraca"].innerHTML = tmp;
        }else{
            if(LB_n4){
                window.top.document.layers["LB_divTraca"].innerHTML = tmp;
            }else{
                if(LB_n6){      
                    window.top.document.getElementById("LB_divTraca").innerHTML = tmp;
                }
            }
        }
    }else{
        fi = window.top.document.body;
        contenedor = window.top.document.createElement('div');
        contenedor.id = 'LB_divTraca';
        contenedor.innerHTML=tmp;
        fi.appendChild(contenedor);
    }
    return false;
}
