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, w, h){
    if(window.pageYOffset){
        pos = window.pageYOffset;
    }else {
        pos = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
    }

    window.onscroll=scrollIt;
	w = parseInt(w) + 45;
	h = parseInt(h) + 40;
    var tmp="";
    tmp += "<div id='interstt1' style='background-color:#F5F2E1;opacity:0.9;filter:alpha(opacity=90);position: absolute; top: "+pos+"px; left: 0px; width:100%;height:115%;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:"+w+"px; height:"+h+"px;' 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 loadJorBoxBlack(url, w, h){
    if(window.pageYOffset){
        pos = window.pageYOffset;
    }else {
        pos = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
    }

    window.onscroll=scrollIt;
	w = parseInt(w) + 45;
	h = parseInt(h) + 40;
    var tmp="";
    tmp += "<div id='interstt1' style='background-color:#000000;opacity:1;filter:alpha(opacity=100);position: absolute; top: "+pos+"px; left: 0px; width:100%;height:115%;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:"+w+"px; height:"+h+"px;' 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(/img/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:765px; height:620px;' 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 loadJorBox675(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:#999999;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(/img/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:685px; height:400px;' 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 loadJorBox720(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:#999999;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(/img/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:720px; height:575px;' 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 jorboxParent(url){
    if(window.pageYOffset){
        pos = window.pageYOffset;
    }else {
        pos = Math.max(parent.document.body.scrollTop,parent.document.documentElement.scrollTop);
    }

    window.onscroll=scrollIt;

    var tmp="";
    tmp += "<div id='interstt1' style='background-color:#999999;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(http://www.grupomotoroceano.com/img/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:400px; height:300px;' frameborder='0' scrolling='no' allowtransparency='yes'></iframe>";
    tmp += "</td>";
    tmp += "</tr>";
    tmp += "</table>";
    tmp += "</div>";


    if (parent.document.getElementById("divTraca")){
        if(ie){    
            parent.document.all["divTraca"].innerHTML = tmp;
        }else{
            if(n4){
                parent.document.layers["divTraca"].innerHTML = tmp;
            }else{
                if(n6){      
                    parent.document.getElementById("divTraca").innerHTML = tmp;
                }
            }
        }
    }else{
        fi = parent.document.body;
        contenedor = parent.document.createElement('div');
        contenedor.id = 'divTraca';
        contenedor.innerHTML=tmp;
        fi.appendChild(contenedor);
    }
}
function jorboxPrivacidad(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:#999999;opacity:1;filter:alpha(opacity=100);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(http://www.grupomotoroceano.com/img/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:400px; height:300px;' 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 loadJorBoxB(url, w, h){
    if(window.pageYOffset){
        pos = window.pageYOffset;
    }else {
        pos = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
    }

    window.onscroll=scrollIt;
	w = parseInt(w) + 45;
	h = parseInt(h) + 40;
    var tmp="";
    tmp += "<div id='interstt1' style='opacity:0.9;filter:alpha(opacity=90);position: absolute; top: "+pos+"px; left: 0px; width:100%;height:115%;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:"+w+"px; height:"+h+"px;' 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);
    }
}
