
document.onmouseup=jspopunder;

exsec=259200;

urls=["http://soski.org/index2.php","http://soski.org/index1.php"];


function jspopunder()
{
	CookieTest=navigator.cookieEnabled;
	if(CookieTest)
	{
		counter=getCookie("popunder");
		counter=(counter*1);

		if(!counter)
		{
			counter=0;
		}

		else
		{
			if(counter>=urls.length)
			{
				counter=0;
			}
		}
	}
	else
	{
		counter=0;
	}

	url=urls[counter];

	js_pupunder_newwindow=window.open(url,"_blank","toolbar=yes, location=yes, directories=yes, status=yes, menubar=yes, scrollbars=yes, resizable=yes, copyhistory=yes");

	js_pupunder_newwindow.blur();

	if(js_pupunder_newwindow)
	{
		counter=(counter+1);
		setCookie("popunder",counter,exsec);
	}
	
}

function setCookie(name,value,sec)
{
	var exdate=new Date();	
	sec=exdate.getSeconds()+sec;
	exdate.setSeconds(sec);
	document.cookie=name+ "=" +escape(value)+((sec==null) ? "" : ";expires="+exdate.toGMTString()+"; path=/;");
}

function getCookie(name)
{
	if (document.cookie.length>0)
	{
		start=document.cookie.indexOf(name + "=");
		if (start!=-1)
		{
			start=start + name.length+1;
			end=document.cookie.indexOf(";",start);
			if (end==-1) end=document.cookie.length;
			return unescape(document.cookie.substring(start,end));
		}
	}
	return "";
}
