function stat (page) {
    document.write ('<SCRIPT LANGUAGE="javascript1.1"> page="'+page+'";</SCRIPT>');
    document.write ('<SCRIPT LANGUAGE="javascript1.1" src="http://hits.truehits.in.th/data/e0008301.js"></SCRIPT>');
}

function getCookieVal (offset) {
    var endstr = document.cookie.indexOf (";", offset);
    if (endstr == -1)
      endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (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 getCookieVal (j);
      i = document.cookie.indexOf(" ", i) + 1;
      if (i == 0) break;
    }
    return null;
}

function SetCookie (name, value, expires, path, domain) {
    var argv = SetCookie.arguments;
    var argc = SetCookie.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 set_name() {
    var expdate = new Date ();
    expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000));
    var homepage = "thaiza";
    SetCookie ("thaiza", homepage, expdate, "", ".thaiza.com");
    parent.focus()
}

function set_name_popup() {
    var expdate = new Date ();
    expdate.setTime (expdate.getTime() + (5 * 60 * 1000));
    var homepage = "thaiza";
    SetCookie ("thaiza", "thaiza", expdate, "", ".thaiza.com");
    parent.focus()
}

function auto_load(behavior) {
    var homepage = GetCookie("thaiza");
    if(homepage != null){
      return homepage;
    }else{
      set_name();
      return behavior;
    }
}

function auto_popup() {
    var homepage = GetCookie("thaiza");
    if(homepage != null){
      return homepage;
    }else{
      set_name_popup();
      return "";
    }
}

var Type = 'unknow';
var rightGap = 5;
var topRightGap = 50;
var leftGap = 5; 
var topLeftGap = 50;
var areaSize = 100;

/*
///////////////////////////////////// FUNCTION ///////////////////////////////////////
function StartFloatRight()
{
	if(document.all) // Compatible with Internet Explorer & Opera
	{

		document.all.FloatingAdRight.style.pixelLeft = (document.body.clientWidth - document.all.FloatingAdRight.offsetWidth) - rightGap;

		document.all.FloatingAdRight.style.pixelTop = document.body.scrollTop + topRightGap;

		document.all.FloatingAdRight.style.visibility = 'visible';
		Type = 'all';
	}
	else if(document.getElementById) // Compatible with Firefox & Netscape
	{

		document.getElementById('FloatingAdRight').style.left = (window.innerWidth - areaSize - 20) - rightGap + 'px';

		document.all.FloatingAdRight.style.pixelTop = topRightGap;

		document.getElementById('FloatingAdRight').style.visibility = 'visible';
		Type = 'getelement';
	}
	
	if (document.all) { 
		window.onscroll = FloatBoth; 
		window.onresize = AdjustRight;
	} 
	else { 
		setInterval('FloatBoth()',100);
		setInterval('AdjustRight()',100);
	} 
}
function FloatRight() 
{
	if (Type == 'all') 
	{ 
		document.all.FloatingAdRight.style.pixelTop = document.body.scrollTop + topRightGap; 
	}
	else if (Type == 'getelement') { document.getElementById('FloatingAdRight').style.top = window.pageYOffset + topRightGap + 'px'; }
}
function AdjustRight()
{
	if(document.all) {
		document.all.FloatingAdRight.style.pixelLeft = (document.body.clientWidth - document.all.FloatingAdRight.offsetWidth) - rightGap;
	} else if(document.getElementById) {
		document.getElementById('FloatingAdRight').style.left = (window.innerWidth - areaSize - 20) - rightGap + 'px';
	}
}

function StartFloatLeft()
{
	if(document.all) // Compatible with Internet Explorer & Opera
	{

		document.all.FloatingAdLeft.style.pixelLeft = leftGap;

		document.all.FloatingAdLeft.style.pixelTop = document.body.scrollTop + topLeftGap;

		document.all.FloatingAdLeft.style.visibility = 'visible';
		Type = 'all';
	}
	else if(document.getElementById) // Compatible with Firefox & Netscape
	{

		document.getElementById('FloatingAdLeft').style.left = leftGap + 'px';

		document.all.FloatingAdLeft.style.pixelTop = topLeftGap;

		document.getElementById('FloatingAdLeft').style.visibility = 'visible';
		Type = 'getelement';
	}
	
	if (document.all) { window.onscroll = FloatBoth; } 
	else { setInterval('FloatBoth()', 100); } 
}
function FloatLeft() 
{
	if (Type == 'all') { document.all.FloatingAdLeft.style.pixelTop = document.body.scrollTop + topLeftGap; }
	else if (Type == 'getelement') { document.getElementById('FloatingAdLeft').style.top = window.pageYOffset + topLeftGap + 'px'; }
}

function FloatBoth()
{
	if (document.getElementById('FloatingAdRight')!=null)
	{
		FloatRight();
	}
	if (document.getElementById('FloatingAdLeft')!=null)
	{
		FloatLeft();
	}
}

function closeAd(adArea)
{
	adArea.style.display = 'none';
}

document.write("<div id='FloatingAdRight' name='FloatingAdRight' style='position: absolute; visibility: hidden;border:1px solid #cccccc;width:100px;'><div style='clear:both'><a href='javascript:;' onClick='closeAd(FloatingAdRight);' style='font-weight: bold; color: #0066CC;'>[close]</a></div><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='120' height='600'><param name='movie' value='http://www.thaiza.com/BumQ/fads.swf'><param name='quality' value='high'><embed src='http://www.thaiza.com/BumQ/fads.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='120' height='600'></embed></object><div style='clear:both'><a href='javascript:;' onClick='closeAd(FloatingAdRight);' style='font-weight: bold; color: #0066CC;'>[close]</a></div></div>");

StartFloatRight();
*/
