var ov = false;

var _ppCookieName = '_pp201111_1';

function GetCookieCMSPopVal (offset) {
	var endstr = document.cookie.indexOf (";", offset);
	
	if (endstr == -1)
		endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

function GetCookieCMSPop (name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
	var j = i + alen;
	if (document.cookie.substring(i, j) == arg)
	return GetCookieCMSPopVal (j);
	i = document.cookie.indexOf(" ", i) + 1;
	if (i == 0)
	break;
	}
	return null;
}

function SetCookiePop(name, value) {
	var argv = SetCookiePop.arguments;
	var argc = SetCookiePop.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : "");
}

function popup_gelCMSPOP(notHide){
	notHide = notHide || false;
    day = new Date();
    id = day.getTime();
    //eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=600,height=600,left = 276,top = 132');");
    //window.focus();
    if (notHide == true) {
    }
    else {
    	document.getElementById('popup_divMenuPOPruu').style.display = 'none';
    }
	pathname = "/";
    myDomain = "/";
    var largeExpDate = new Date ();
    largeExpDate.setTime(largeExpDate.getTime() + (365 * 24 * 3600 * 1000));
    SetCookiePop(_ppCookieName,'1',largeExpDate, "/");
    
    top.location.href = 'javascript:void();';
    //top.location.href = 'http://www.drive.ge/?m=302';
    //top.location.href = 'http://localhost';
}

/**/

popru = GetCookieCMSPop(_ppCookieName);

if (popru == null){
	document.write('<div style="position: absolute; top:25%; left:50%; margin-left:-200px; visibility:hidden; z-index:9996570;" id="popup_divMenuPOPruu"><a href="http://www.drive.ge/?m=302" onClick="popup_gelCMSPOP();"><img src="http://drive.ge/_pp/2011.11.04_practice.png" width="450" height="300" style="border:5px Solid red;"></a></div>');
	
	document.getElementById('popup_divMenuPOPruu').style.visibility='visible';
	
	if (document.getElementById('popup_divMenuPOPruu').style)
	window.setInterval("MovePopupWinPOPruu()", 10);
	window.onerror=null;
	document.body.scrollTop=10;
	
	function MovePopupWinPOPruu() {
		if (document.body.scrollTop==0)
			document.getElementById('popup_divMenuPOPruu').style.top=document.documentElement.scrollTop+150;
		else
			document.getElementById('popup_divMenuPOPruu').style.top=document.body.scrollTop+150;
	}
	popup_gelCMSPOP(true);
}


window.onload = function () {
	if (document.body.clientWidth < document.body.offsetWidth){
		if (document.body.clientWidth > 0)
			var ww=document.body.clientWidth;
		else
			var ww=document.body.offsetWidth;
	}
	else {
		if (document.body.offsetWidth > 0)
			var ww=document.body.offsetWidth - 2;
		else
			var ww=document.body.clientWidth;
	}
}
/**/
