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.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 displayCloseButton(){
    //alert(document.getElementById("btn_close"));
    document.getElementById("btn_close").style.display="";
}

function loadJorBox(url){
	if(window.pageYOffset){
		pos = window.pageYOffset;
	}else {
		pos = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
	}

	window.onscroll=scrollIt;

	var tmp="";
	tmp += "<div id='interstt1' style='background-color:#000;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='interstt2' 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 += "<iframe src='"+url+"' style='width:659px; height:582px;' 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 loadJorBox2(url){
if(window.pageYOffset){
    pos = window.pageYOffset;
}else {
    pos = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
}

window.onscroll=scrollIt;

var tmp="";
tmp += "<div id='interstt1' style='background-color:#000;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='interstt2' style='position: absolute; top: "+pos+"px; left: 0px; width:100%;height:100%;z-index:1001;background-image:url(/images/formularioLayer/fondo.formulario.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:482px; height:472px;' 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 loadJorBox3(url){
	if(window.pageYOffset){
		pos = window.pageYOffset;
	}else {
		pos = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
	}

	window.onscroll=scrollIt;

	var tmp="";
	tmp += "<div id='interstt1' style='background-color:#000;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='interstt2' style='position: absolute; top: "+pos+"px; left: 0px; width:100%;height:100%;z-index:1001;background:url(/images/formularioLayer/fondo.formulario.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:659px; height:582px;' 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 loadJorBox4(url){
	if(window.pageYOffset){
		pos = window.pageYOffset;
	}else {
		pos = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
	}

	window.onscroll=scrollIt;

	var tmp="";
	tmp += "<div id='interstt1' style='background-color:#000;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='interstt2' style='position: absolute; top: "+pos+"px; left: 0px; width:100%;height:100%;z-index:1001;background-image:url(/images/sol_info/fondofor.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:745px; height:537px;' frameborder='0' scrolling='no' allowtransparency='yes'></iframe>";
	tmp += "</td>";
	tmp += "</tr>";
	tmp += "</table>";
	tmp += "</div>";


    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 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:750px;' 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);
	}
}
