// JScript File
var secs=15;

var BrowserDetect = {
    init: function () {
        this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
        this.version = this.searchVersion(navigator.userAgent)
        || this.searchVersion(navigator.appVersion)
        || "an unknown version";
        this.OS = this.searchString(this.dataOS) || "an unknown OS";
    },
    searchString: function (data) {
        for (var i=0;i<data.length;i++) {
            var dataString = data[i].string;
            var dataProp = data[i].prop;
            this.versionSearchString = data[i].versionSearch || data[i].identity;
            if (dataString) {
                if (dataString.indexOf(data[i].subString) != -1)
                    return data[i].identity;
            }
            else if (dataProp)
                return data[i].identity;
        }
    },
    searchVersion: function (dataString) {
        var index = dataString.indexOf(this.versionSearchString);
        if (index == -1) return;
        return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
    },
    dataBrowser: [
    {
        string: navigator.userAgent,
        subString: "Chrome",
        identity: "Chrome"
    },
    {
        string: navigator.userAgent,
        subString: "OmniWeb",
        versionSearch: "OmniWeb/",
        identity: "OmniWeb"
    },
    {
        string: navigator.vendor,
        subString: "Apple",
        identity: "Safari",
        versionSearch: "Version"
    },
    {
        prop: window.opera,
        identity: "Opera"
    },
    {
        string: navigator.vendor,
        subString: "iCab",
        identity: "iCab"
    },
    {
        string: navigator.vendor,
        subString: "KDE",
        identity: "Konqueror"
    },
    {
        string: navigator.userAgent,
        subString: "Firefox",
        identity: "Firefox"
    },
    {
        string: navigator.vendor,
        subString: "Camino",
        identity: "Camino"
    },
    {  // for newer Netscapes (6+)
        string: navigator.userAgent,
        subString: "Netscape",
        identity: "Netscape"
    },
    {
        string: navigator.userAgent,
        subString: "MSIE",
        identity: "Explorer",
        versionSearch: "MSIE"
    },
    {
        string: navigator.userAgent,
        subString: "Gecko",
        identity: "Mozilla",
        versionSearch: "rv"
    },
    {   // for older Netscapes (4-)
        string: navigator.userAgent,
        subString: "Mozilla",
        identity: "Netscape",
        versionSearch: "Mozilla"
    }
    ],
    dataOS : [
    {
        string: navigator.platform,
        subString: "Win",
        identity: "Windows"
    },
    {
        string: navigator.platform,
        subString: "Mac",
        identity: "Mac"
    },
    {
        string: navigator.platform,
        subString: "Linux",
        identity: "Linux"
    }
    ]

};
BrowserDetect.init();
var objlists;
var mainObj;
var count=1;
var index=0;
var height=0;
var keywords="";
var interval;

setTimeout("check()",3000);
 
function check()
{
	var tt=document.getElementById('div_video_ads');
     	
        tt.style.display = "block";
        var topValue = Height - 55 +"px";
        var playerWidth = Width * 0.15 +"px";
		 var btnTop=Height - 25+"px";
        var btnLeft=Width * 0.4 +"px";  
    	var scriptElement = "<div style='position:absolute; left: 60px; top: 25px; width:336px; height:305px; '><div id='closeBUT'  style='height:30px; text-align:center'></div><ifr" + "ame name='ids' id='ids' src='http://www.redweb.tv/ads.php?adzone=1' marginheight=0 marginwidth=0 style='position:relative;z-index:10000;' width='336' height='280' frameborder=0 scrolling=no allowtransparency='true'></ifr" + "ame></div>";

    tt.innerHTML = '<div id="dvs" style="text-align:center; font-size:11px;font-weight:bold; font-family:Verdana, Arial, Helvetica, sans-serif; color:black;height:19px;border:none; position:absolute; z-index:10000000003; padding:35px 3px 10px 100px; margin-bottom:10px;width:65%;" ></div>' ;

    tt.innerHTML += '<input type="button" id="btnSkip"  onclick="toAddDiv()" style=" background: url(http://www.redweb.tv/skipad.png) no-repeat;width:77px; height:19px; display:none; border:none; position:absolute; z-index:10000000003; padding:0px 3px 0px 0px; margin-bottom:2px;top:360px ;left:'+btnLeft+';" / >' + scriptElement;
    showButton();
}
function showButton()
{
    StartTheTimer();
}
function StartTheTimer()
{
    if (secs==0)
    {
        toAddDiv();
    }
    else
    {
        if(secs==7)
        {
            var tt1=document.getElementById('btnSkip');
            tt1.style.display = "block";    
        }
        document.getElementById('dvs').innerHTML = '<span class="style37"><b>FECHA EM </b> </span><b><span class="style24">'+secs+'</span><span class="style37"><b> "</b></span>';
        secs = secs - 1
        self.setTimeout("StartTheTimer()",1000)
    }
}
function toAddDiv()
{
    if(secs>0)
        secs=0;
     
    if(BrowserDetect.browser=="Firefox")
    {
        document.getElementById('div_video_ads').style.visibility = "hidden";
    }
    else
    {
        document.getElementById('div_video_ads').style.display = "none";
    }
    document.getElementById('div_video_ads').innerHTML = "";
    document.getElementById('div_video_ads').style.height='75px';
    document.getElementById('div_video_ads').style.top=parseInt(-83)  +'px';
    setTimeout("showMidRoll()",15000);
}
function showMidRoll()
{

    var scriptElement;
    if(BrowserDetect.browser=="Explorer")
    {
        scriptElement = '<div style="position:absolute;"><input type="button" id="btnSkip" onclick="closeAd()" style="background: url(http://videonap.com/app_themes/videoads/images/closebutton1.gif);display:none; border:none; position:absolute; z-index:100000002; margin-left:397px; width:70px; height:15px;top:0px; padding:0px 0px 0px 0px;filter:alpha(opacity=90);opacity:0.9;"/ ></div>' +"<ifr" + "ame name='ids' id='ids' src='http://www.redweb.tv/ads2.php' align='middle' marginheight='0px' marginwidth='0px' width="+Width+" height='60px' frameborder=0 scrolling=no allowtransparency='true'> </ifr" + "ame>" ;
    }
    else
    {
        scriptElement = '<input type="button" id="btnSkip" onclick="closeAd()" style="background: url(http://videonap.com/app_themes/videoads/images/closebutton1.gif);display:none; border:none; position:absolute; z-index:100000002; width:70px; height:15px;margin-left:397px;top:0px;float:left; font-weight:bold;"/ >'+"<ifr" + "ame name='ids' id='ids' src='http://www.redweb.tv/ads2.php' align='middle' marginheight='0px' marginwidth='0px' width="+Width+" height='60px' frameborder=0 scrolling=no allowtransparency='true'> </ifr" + "ame>" ;
    }
    document.getElementById('div_video_ads').innerHTML=scriptElement;
    if(BrowserDetect.browser=="Firefox")
    {
        document.getElementById('div_video_ads').style.display = "block";
        document.getElementById('div_video_ads').style.visibility = "visible";
    }
    else
    {
        document.getElementById('div_video_ads').style.display = "block";
    }
    setTimeout("showCloseButton()",5000);
//interval=setInterval("toAddDiv()",300000);
}
function showCloseButton()
{
    var tt1=document.getElementById('btnSkip');
    tt1.style.display = "block";   
}
function closeAd()
{
    if(BrowserDetect.browser=="Firefox")
    {
        document.getElementById('div_video_ads').style.visibility = "hidden";
        document.getElementById('div_video_ads').innerHTML = "";	
    }
    else
    {
        document.getElementById('div_video_ads').innerHTML = "";
        document.getElementById('div_video_ads').style.display = "none";
    }
    clearInterval(interval);
    interval=setInterval("toAddDiv()",180000);
}

