var PAGE = document.URL;
var AUTO_PLAY;
var SHOW;
var P;
var show_yaoti = new Boolean(true);

var MOVEON = '<sc'+'ript language="JavaScript" src="http://www.yaoti.com/yaoticode.php?UID='+UID+'&URL='+encodeURI(PAGE)+'&POSX='+POSX+'&POSY='+POSY+'&AUTO_PLAY='+AUTO_PLAY+'&SHOW='+SHOW+'&P='+P+'"></script>';

function getCookie(name){
   var i=0  //Suchposition im Cookie
   var suche = name+"="
   while (i<document.cookie.length){
      if (document.cookie.substring(i, i+suche.length)==suche){
         var ende = document.cookie.indexOf(";", i+suche.length)
         ende = (ende>-1) ? ende : document.cookie.length
         var cook = document.cookie.substring(i+suche.length, ende)
         return unescape(cook)
      }
      i++
   }
   return null
}

function setCookie(name, wert, domain, expires, path, secure){
   var cook = name+"="+unescape(wert)
   cook += (domain) ? "; domain="+ domain : ""
   cook += (expires) ? "; expires="+expires : ""
   cook += (path) ? "; path="+path : ""
   document.cookie = cook;
}
  

if (SHOW == "always")
	{
	show_yaoti = true;
	}
else if (SHOW == "session")
	{
	if (getCookie("YAOTI_JS_C") == null)
		{
		setCookie("YAOTI_JS_C", UID, null, 0);
		}
	else
		{
		show_yaoti = false;
		}
	}
else if (SHOW >= 0)
	{
	if (getCookie("YAOTI_JS_C") == null)
		{
		var ablauf = new Date();
		var zeit = ablauf.getTime() + (SHOW * 24 * 60 * 60 * 1000);
		ablauf.setTime(zeit);
		setCookie("YAOTI_JS_C", UID, null, ablauf);
		}
	else
		{
		show_yaoti = false;
		}
	}
		
if (show_yaoti == true)
	{
	document.write(MOVEON);
	}
	