function prestitialTimer(BannerDelay) {
	var secs = (BannerDelay*1) / 1000;
    if (secs == 0) prestitialKapat();
	else {
        $("#timerText").html("<strong>"+secs+"</strong> saniye içinde yönlendirileceksiniz...");
        BannerDelay = BannerDelay - 1000;
        setTimeout("prestitialTimer("+BannerDelay+")", 1000);
    }
}

function prestitialAc(BannerDelay){
  a_int_windowWidth = 800;
  var int_windowLeft = (screen.width - a_int_windowWidth) / 2;
  newdiv = document.createElement("div");
  newdiv.style.width = '800px';
  newdiv.id = 'prestitial_container';
  newdiv.style.position = "absolute";
  newdiv.style.zIndex = "1000";
  newdiv.style.top = "20px";
  newdiv.style.left = int_windowLeft+"px";
  document.body.appendChild(newdiv);  
  var txt = '<div><div style="float:left; height:20px; margin:2px; color:#FFF; overflow:hidden;" id="timerText"> </div><div style="float:right; height:20px; overflow:hidden; margin:2px;"><a href="javascript:;" onclick="prestitialKapat();"><font color="white">Reklamı Geç</font></a></div></div>';
  $('#blackBG').show();
  $('#prestitial_container').append(""+txt+"").append($('#prestitial').show());
  prestitialTimer(BannerDelay);
}

function interstitialAc(BannerDelay){
  a_int_windowWidth = 800;
  var int_windowLeft = (screen.width - a_int_windowWidth) / 2;
  newdiv = document.createElement("div");
  newdiv.style.width = '800px';
  newdiv.id = 'prestitial_container';
  newdiv.style.position = "absolute";
  newdiv.style.zIndex = "1000";
  newdiv.style.top = "20px";
  newdiv.style.left = int_windowLeft+"px";
  document.body.appendChild(newdiv);  
  var txt = '<div><div style="float:left; height:20px; margin:2px; color:#FFF; overflow:hidden;" id="timerText"> </div><div style="float:right; height:20px; overflow:hidden; margin:2px;"><a href="javascript:;" onclick="interstitialKapat();"><font color="white">Reklamı Geç</font></a></div></div>';
  $('#blackBG').show();
  $('#prestitial_container').append(""+txt+"").append($('#prestitial').show());
  interstitialTimer(BannerDelay);
}

function interstitialTimer(BannerDelay) {	
	var secs = (BannerDelay*1) / 1000;
    if (secs == 0) interstitialKapat();
	else {
        $("#timerText").html("<strong>"+secs+"</strong> saniye içinde yönlendirileceksiniz...");
        BannerDelay = BannerDelay - 1000;
        setTimeout("interstitialTimer("+BannerDelay+")", 1000);
    }
}

function prestitialKapat(){
  $('#blackBG').hide();
  document.body.removeChild(newdiv);
  floatingAc();
}
function interstitialKapat(){
  $('#blackBG').hide();
  document.body.removeChild(newdiv);
}

function floatingAc(){
  newdiv2 = document.createElement("div");
  newdiv2.id = 'floating_container';
  newdiv2.style.position = "absolute";
  //newdiv2.style.border = "1px solid #DDD";
  newdiv2.style.zIndex = "1001";
  newdiv2.style.top = "0px";
  newdiv2.style.left = "0px";
  document.body.appendChild(newdiv2);
  $('#floating_container').load("/_ajax/floating.php");
}

function floatingWorkAround() {
    var browser=navigator.appName;
    var b_version=navigator.appVersion;
    var version=parseFloat(b_version);
    f_div = document.getElementById('floating_sx');
    //if (floating_div_e != 'undefined') {
        floatingHide();
    //}
}

function showFloatingDiv(){
        /*f_div = document.getElementById('floating_sx');
    text = '<OBJECT style="position:absolute;left:75px;top:50px;width:480px;height:315px;z-index:222800;" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" id="divflash" ALIGN="">';
    text = text + '<PARAM NAME=movie width="480" height="315" VALUE="http://ads.maksimum.net/advertpro/servlet/file?id=3462&clickTAG=http%3A%2F%2Fwww.zapadserver2.com%2Fadserver%2Fadx%2Fgoto2.aspx%3Fpbk%3D17127-17430-4069">';
    text = text + ' <PARAM NAME=quality VALUE=high>';
    text = text + ' <PARAM NAME=wmode VALUE=transparent>';
    text = text + '<EMBED width="480" height="315" src="http://ads.maksimum.net/advertpro/servlet/file?id=3462&clickTAG=http%3A%2F%2Fwww.zapadserver2.com%2Fadserver%2Fadx%2Fgoto2.aspx%3Fpbk%3D17127-17430-4069" quality=high wmode=transparent NAME="divflash" ALIGN=""';
    text = text + ' TYPE="application/x-shockwave-flash"';
    text = text + 'PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">'
    text = text + ' </EMBED>';
    text = text + '</OBJECT>';
    f_div.style.display = 'block';
    f_div.innerHTML = text;
    floatingHide();*/
}

var floating_time;
function floatingHide() {
    if (floating_time == null)
        floating_time = 11000;
    floatingDiv = document.getElementById("floating_sx");
    //if (floatingDiv != null){
        setTimeout('hideFloatingDiv();',floating_time);
    //}
}
//
function hideFloatingDiv(){
    obj = document.getElementById("floating_sx");
    obj.style.display = 'none';
}