﻿var InterstitialDIVFondoNegro;

    function interstitial (j) {        if (j=='1')
            InterstitialPopUp('/interstitial/interstitial.htm','interstitial',800,600);        else            InterstitialClosePopUp();
        }
    
    function InterstitialPopUp(url,titulo,w,h)
    {
        InterstitialDIVFondoNegro=document.createElement('div');
        InterstitialDIVFondoNegro.id='fondonegroInterstitial';
         InterstitialDIVFondoNegro.onclick=function() {InterstitialClosePopUp();};
       
        var InterstitialDIVPop=document.createElement('div');
        InterstitialDIVPop.id='popInterstitial';
        
      
        var sheetX = document.createElement('style');
        var rulesX = document.createTextNode('#popXLinkInterstitial { display:block; position:relative; z-index: 999; margin: -10px -10px 0px 0px; float: right; cursor: pointer; }'); 
        sheetX.type = 'text/css'; 
        if(sheetX.styleSheet) 
            sheetX.styleSheet.cssText = rulesX.nodeValue; 
        else 
            sheetX.appendChild(rulesX); 

        InterstitialDIVPop.appendChild(sheetX);
        
        InterstitialDIVFondoNegro.appendChild(InterstitialDIVPop);
        
        
        
       var InterstitialIframe = document.createElement('iframe') 
       
       InterstitialIframe.id='iframeInterstitial'; 
       InterstitialIframe.setAttribute("src", url); 
       InterstitialIframe.style.display='block';
       InterstitialIframe.style.width = w+"px"; 
       InterstitialIframe.style.height = h+"px"; 
       InterstitialIframe.scrolling='no';
       InterstitialIframe.frameBorder='0';
       
       InterstitialDIVPop.appendChild(InterstitialIframe); 

        var sheetPop = document.createElement('style');
        var rules = document.createTextNode('#popInterstitial { border:#FFF solid 0px; background:#FFFFFF; width:' + w + 'px; height:' + h + 'px; left:50%; top:50%; margin-left:-' + (w/2) + 'px; margin-top:-' + (h/2) + 'px; position:fixed; display:block; }'); 
        sheetPop.type = 'text/css'; 
        if(sheetPop.styleSheet) 
            sheetPop.styleSheet.cssText = rules.nodeValue; 
        else 
            sheetPop.appendChild(rules); 

        InterstitialDIVPop.appendChild(sheetPop);

        var sheetFondo = document.createElement('style');
        var rulesFondo = document.createTextNode('#fondonegroInterstitial { z-index:9999; background: url(/images/transparency.png) 0 0 repeat; width:100%; height:100%; position:fixed; top:0; left:0; ); display:block; }'); 
        sheetFondo.type = 'text/css'; 
        if(sheetFondo.styleSheet) 
            sheetFondo.styleSheet.cssText = rulesFondo.nodeValue; 
        else 
            sheetFondo.appendChild(rulesFondo); 

        InterstitialDIVFondoNegro.appendChild(sheetFondo);


        document.body.appendChild(InterstitialDIVFondoNegro);
    }

    function InterstitialClosePopUp(){
        document.body.removeChild(InterstitialDIVFondoNegro);
    }
    
    function cerrarPopUp()
    {
        InterstitialClosePopUp();
    }
    
