var iClientInfo=1;
var szDomainMode="auto";
var szHash="on";
var iSessionTimeOut="1800";
var szGIFPath1="/pixel.gif";
var x10tfsp="|";
var iFlashDetectEnable=1;
var iTitleEnable=1;
var iLinkerEnable=0;
var iAnchorEnable=0;
var iCampaignTracking=1;
var iCookieTimeOut="15768000";
var szCampaignName="campaign";
var szCampaignMedium="medium";
var szCampaignSource="source";
var szCampaignKeyword="term";
var szCampaignContent="content";
var szCampaignID="id";
var szCampaignNoOverride="nooverride";
var szOrganicSearchSource=new Array();
var szOrganicKeywords=new Array();
szOrganicSearchSource[0]="google";	szOrganicKeywords[0]="q";
szOrganicSearchSource[1]="yahoo";	szOrganicKeywords[1]="p";
szOrganicSearchSource[2]="msn";		szOrganicKeywords[2]="q";
szOrganicSearchSource[3]="aol";		szOrganicKeywords[3]="query";
szOrganicSearchSource[4]="alexa";	szOrganicKeywords[4]="q";
szOrganicSearchSource[5]="lycos";	szOrganicKeywords[5]="query";
szOrganicSearchSource[6]="ask";		szOrganicKeywords[6]="q";
szOrganicSearchSource[7]="altavista";	szOrganicKeywords[7]="q";
szOrganicSearchSource[8]="netscape";	szOrganicKeywords[8]="query";
szOrganicSearchSource[9]="cnn";		szOrganicKeywords[9]="query";
szOrganicSearchSource[10]="looksmart";	szOrganicKeywords[10]="qt";
szOrganicSearchSource[11]="about";	szOrganicKeywords[11]="terms";
szOrganicSearchSource[12]="mamma";	szOrganicKeywords[12]="query";
szOrganicSearchSource[13]="alltheweb";	szOrganicKeywords[13]="q";
szOrganicSearchSource[14]="gigablast";	szOrganicKeywords[14]="q";
szOrganicSearchSource[15]="voila";	szOrganicKeywords[15]="rdata";
szOrganicSearchSource[16]="virgilio";	szOrganicKeywords[16]="qs";
szOrganicSearchSource[17]="live";	szOrganicKeywords[17]="q";
szOrganicSearchSource[18]="baidu";	szOrganicKeywords[18]="wd";
szOrganicSearchSource[19]="alice";	szOrganicKeywords[19]="qs";
szOrganicSearchSource[20]="yandex";	szOrganicKeywords[20]="text";
szOrganicSearchSource[21]="najdi";	szOrganicKeywords[21]="q";
szOrganicSearchSource[22]="buzzle";	  szOrganicKeywords[22]="query";
szOrganicSearchSource[23]="club-internet";szOrganicKeywords[23]="query";
szOrganicSearchSource[24]="mama";	szOrganicKeywords[24]="query";
szOrganicSearchSource[25]="seznam";	szOrganicKeywords[25]="q";
szOrganicSearchSource[26]="search";	  szOrganicKeywords[26]="q";
szOrganicSearchSource[27]="wp";		  szOrganicKeywords[27]="szukaj";
szOrganicSearchSource[28]="onet";	  szOrganicKeywords[28]="qt";
szOrganicSearchSource[29]="netsprint";	  szOrganicKeywords[29]="q";
szOrganicSearchSource[30]="click4choice"; szOrganicKeywords[30]="q";
szOrganicSearchSource[31]="szukacz";	  szOrganicKeywords[31]="q";
szOrganicSearchSource[32]="yam";	  szOrganicKeywords[32]="k";
szOrganicSearchSource[33]="pchome";	  szOrganicKeywords[33]="q";
szOrganicSearchSource[34]="kvasir";	  szOrganicKeywords[34]="searchExpr";
szOrganicSearchSource[35]="sesam";	  szOrganicKeywords[35]="q";
szOrganicSearchSource[36]="ozu"; 	  szOrganicKeywords[36]="q";
szOrganicSearchSource[37]="terra"; 	  szOrganicKeywords[37]="query";
szOrganicSearchSource[38]="nostrum"; 	  szOrganicKeywords[38]="query";
szOrganicSearchSource[39]="mynet"; 	  szOrganicKeywords[39]="q";
szOrganicSearchSource[40]="ekolay"; 	  szOrganicKeywords[40]="q";
szOrganicSearchSource[41]="search.ilse";  szOrganicKeywords[41]="search_for";
szOrganicSearchSource[42]="excite";       szOrganicKeywords[42]="qkw";
szOrganicSearchSource[43]="hotbot";	  szOrganicKeywords[43]="query";
szOrganicSearchSource[44]="clickey";	  szOrganicKeywords[44]="keyword";
szOrganicSearchSource[45]="deltis";	  szOrganicKeywords[45]="q";
szOrganicSearchSource[46]="earthlink";	  szOrganicKeywords[46]="q";
szOrganicSearchSource[47]="easaseek";	  szOrganicKeywords[47]="search";
szOrganicSearchSource[48]="mrwordsmith";  szOrganicKeywords[48]="str";
szOrganicSearchSource[49]="web-cmn";      szOrganicKeywords[49]="terms";
szOrganicSearchSource[50]="webcrawler";   szOrganicKeywords[50]="qkw";
szOrganicSearchSource[51]="teoma";        szOrganicKeywords[51]="q";
var iUniqueDomainHash;
var dCurrentTime;
var szCookieDomain="";
var iRandomNumber;
var iNewSessionFlag=0;
var iPageCount=0;
var szReferrer="-";
var iIgnoreKeyword=0;
var iSeconds=0;
var szCookiePath="/";
var Log="";
var poDocument=document;
var poDocumentLocation=poDocument.location;
var poDocumentHREF=(poDocumentLocation.hash)?poDocumentLocation.href.substring(poDocumentLocation.href.indexOf('#')):"";
var szGIFPath2=(poDocumentLocation.protocol=="https:")?"https://track.x10.com/pixel.gif":"http://track.x10.com/pixel.gif";
//var cDHTMLwin = new _DHTMLwindow( "cDHTMLwin" );
var tabPosition = 0;

//DHTML EMAIL FORM
var nonew = 0;

//http://site.x10.com/?Z3gxT3NpdGVtYWlscG9wMS5kYXQ=
// old http://site.x10.com/?Z3gxT3NpdGVtYWlscG9wLmRhd=
if( ( ( poDocument.cookie.indexOf("x_10c1=") == -1 ) || ( poDocument.cookie.indexOf("NoContest=0") != -1 ) ) && ( poDocument.cookie.indexOf("NoContest=1") == -1 ) ) {
	if( ( poDocument.cookie.indexOf("NoContest=0") != -1 ) ) {
		var giveaway = new sptab( "giveaway", tabPosition, "http://site.x10.com/?Z3gxT3NpdGVtYWlscG9wMS5kYXQ=", "http://site.x10.com/?Z3gxT3RhYnJvdC5kYXQ=", "http://site.x10.com/?bHgxT3RhYnJvdC5kYXQ=" );
	} else {
		var giveaway = new sptab( "giveaway", tabPosition, "http://site.x10.com/?Z3gxT3NpdGVtYWlscG9wLmRhd=", "http://site.x10.com/?Z3gxT3RhYnJvdC5kYXQ=", "http://site.x10.com/?bHgxT3RhYnJvdC5kYXQ=" );
	}
	tabPosition++;
} else {
	nonew = 1;
	var giveaway = new sptab( "giveaway", tabPosition, "http://site.x10.com/?Z3gxT3Ryc2Jhbi5kYXQ=", "http://site.x10.com/?Z3gxT3RhYnJvdGIuZGF0=", "http://site.x10.com/?bHgxT3RhYnJvdGIuZGF0=" );
	tabPosition++;
}
/*if( ( poDocument.cookie.indexOf("NoHelp=1") < 0 ) ) {
	var chatbox = new sptab( "chatbox", tabPosition, "http://www.x10.com/support/gotquestions_pop.html", "http://graphics.x10.com/images_support/livechat_poptab.gif", null );
	tabPosition++;
}*/

function x10Tracker() {

  var a;
  var b;
  var c;
  var v;
  var z;
  var k;
  var szExpire="";
  var s="";
  var f=0;
  var szLifeTimeExpire=" expires=Sun, 18 Jan 2038 00:00:00 GMT;";
  var szCookie=poDocument.cookie;
  var iShowDHTML=0;
  
  iUniqueDomainHash=GetDomain();

  iRandomNumber=Math.round(Math.random()*2147483647);
  
  dCurrentTime=new Date();
  
  iSeconds=Math.round(dCurrentTime.getTime()/1000);

  a=szCookie.indexOf("x_10c1="+iUniqueDomainHash);
  
  b=szCookie.indexOf("x_10c2="+iUniqueDomainHash);
  
  c=szCookie.indexOf("x_10c3="+iUniqueDomainHash);

  if (szDomainMode && szDomainMode!=""){
    szCookieDomain=" domain="+szDomainMode+";";
  }

  if (iSessionTimeOut && iSessionTimeOut!=""){
    szExpire=new Date(dCurrentTime.getTime()+(iSessionTimeOut*1000));
    szExpire=" expires="+szExpire.toGMTString()+";";
  }
  
  if( ( document.title.indexOf("X10.com order number") != -1 ) ) {//Incase they return from paypal
    poDocument.cookie="x_10c2="+iUniqueDomainHash+"; path="+szCookiePath+";"+szExpire+szCookieDomain;
  } else if (a>=0 && b>=0 && c>=0 ) {
    poDocument.cookie="x_10c2="+iUniqueDomainHash+"; path="+szCookiePath+";"+szExpire+szCookieDomain;
  } else {
    iShowDHTML=(a>=0)?0:1; // only show DHTML window to new visitors
    a=(a>=0)?AddPage(poDocument.cookie,";",iSeconds):iUniqueDomainHash+"."+iRandomNumber+"."+iSeconds+"."+iSeconds+"."+iSeconds+".1";
    poDocument.cookie="x_10c1="+a+"; path="+szCookiePath+";"+szLifeTimeExpire+szCookieDomain;
    poDocument.cookie="x_10c2="+iUniqueDomainHash+"; path="+szCookiePath+";"+szExpire+szCookieDomain;
    poDocument.cookie="x_10c3="+iUniqueDomainHash+"; path="+szCookiePath+";"+szCookieDomain;
    iNewSessionFlag=1;
    Log="&log=1";
  }

 poDocument.cookie="PopUnder=; expires=Thu, 01-Jan-1970 00:00:01 GMT";
 poDocument.cookie="NoHelp=; expires=Thu, 01-Jan-1970 00:00:01 GMT";
 poDocument.cookie="VST=; expires=Thu, 01-Jan-1970 00:00:01 GMT";
 poDocument.cookie="Apache=; expires=Thu, 01-Jan-1970 00:00:01 GMT";
 poDocument.cookie="Name=; expires=Thu, 01-Jan-1970 00:00:01 GMT";
 poDocument.cookie="Deal=; expires=Thu, 01-Jan-1970 00:00:01 GMT";
 poDocument.cookie="SID=; expires=Thu, 01-Jan-1970 00:00:01 GMT";
 
 /*DHTML EMAIL FORM
 if( ( poDocument.cookie.indexOf("x_10c1=") != -1 ) &&
     ( poDocument.location.href.indexOf("store.x10.com") == -1 ) &&
     ( poDocument.location.href.indexOf("/whatsincluded/") == -1 ) &&
     ( poDocument.location.href.indexOf("/onlinesupport/") == -1 ) &&
     ( poDocument.location.href.indexOf("/minisites/") == -1 ) &&
     ( poDocument.location.href.indexOf("/promotions/") == -1 ) &&
     ( poDocument.location.href.indexOf("x10securitysystems") == -1 ) &&
     ( poDocument.location.href.indexOf("x10minitimer") == -1 ) &&
     ( poDocument.location.href.indexOf("newtox10") == -1 ) &&
     ( poDocument.location.href.indexOf(".x10sentinel.com") == -1 ) &&
     ( poDocument.location.href.indexOf(".x10community.com") == -1 ) &&
     ( poDocument.location.href.indexOf("kbase.x10.com") == -1 ) &&
     ( poDocument.location.href.indexOf("ads.x10.com") == -1 ) &&
     ( poDocument.location.href.indexOf("images.x10.com") == -1 ) &&
     ( poDocument.location.href.indexOf("theworldsbestwebcam.com") == -1 ) &&
     ( poDocument.location.href.indexOf("igettogether.com") == -1 ) &&
     ( poDocument.location.protocol != "https:" ) ) {
	if( ( nonew == 0 ) && ( poDocument.cookie.indexOf("NoContest=1") < 0 ) && ( poDocument.cookie.indexOf("NoContest=2") < 0 ) ) {
		 if( ( giveaway ) ) {
			 if( poDocument.cookie.indexOf("NoContest=0") < 0 ) {
				 giveaway.init(0);
			 } else {
				giveaway.init(1);
			 }
			 document.cookie = "NoContest=0; path=/;";
		 }
	 } else if ( poDocument.cookie.indexOf("NoContest=3") < 0 ) {
		 if( ( giveaway ) ) {
			 if( poDocument.cookie.indexOf("NoContest=2") < 0 ) {
				 giveaway.init(0);
		
			 } else {
				 giveaway.init(1);
			 }
			 document.cookie = "NoContest=2; path=/;";
		 }
		 
	 }
  }*/

  // collect user information
  GetSessionInfo();
}

function GetSessionInfo() {        
  var p;
  var szInfoQuery="";
  var pg=poDocumentLocation.pathname+poDocumentLocation.search;
  // if the referrer is null, set to '-', else if this site, set to '0' else if encapsulated in square brackets, set to '-'
  szReferrer=poDocument.referrer;
  
  if (!szReferrer || szReferrer=="")
    szReferrer="-";
  else {
          
    p=szReferrer.indexOf(poDocument.domain);
    
    if ((p>=0) && (p<=8))
      szReferrer="0";

    if (szReferrer.indexOf("[")==0 && szReferrer.lastIndexOf("]")==(szReferrer.length-1))
      szReferrer="-";

  }

  // create the query string for the tracking image
  szInfoQuery+="x_10irn="+iRandomNumber;

  // get the client information - screen size, color depth, language, java and flash
  if (iClientInfo)
    szInfoQuery+=GetBasicClientInfo();
  // get the keyword and domain
  if (iCampaignTracking)
    szInfoQuery+=GetKeywordInfo();

  // get the page document title
  if (iTitleEnable && poDocument.title && poDocument.title!="")
    szInfoQuery+="&x_10ti="+Escape(poDocument.title);

  // extract the document host name
  if (poDocumentLocation.hostname && poDocumentLocation.hostname!="")
    szInfoQuery+="&x_10host="+Escape(poDocumentLocation.hostname);

  
  // add the referral information
  szInfoQuery+="&x_10ref="+Escape(szReferrer);

  // add the current page name
  szInfoQuery+="&x_10pn="+Escape(pg);
 
  // if locally installed
  var i=new Image(1,1);
  if( typeof( cartTrack ) != "undefined" ) {
	  if( typeof( changestate ) != "undefined" ) {
			  cartTrack+="&changestate="+changestate;
	  }
	  i.src=szGIFPath2+"?"+szInfoQuery+"&cartTrack="+cartTrack+"&x_10cc="+GetClientCookies()+Log; 
  } else if ( typeof( version ) != "undefined" &&
	      typeof( trial ) != "undefined" &&
	      typeof( digest ) != "undefined" ) {
  	  i.src=szGIFPath2+"?"+szInfoQuery+"&taguchi="+version+"-"+trial+"-"+digest+"&x_10cc="+GetClientCookies()+Log;
  } else {
	  i.src=szGIFPath2+"?"+szInfoQuery+"&x_10cc="+GetClientCookies()+Log;
  }
  i.onload=function() { Void(); }

  return;
}
function Void(){return;}
function GetKeywordInfo()
{
  if (!iCookieTimeOut || iCookieTimeOut=="")
    iCookieTimeOut="15768000";  // 365/2 days

  var szCampaignBuffer="";
  var t="-";
  var t2="-";
  var t3="-";
  var iNoOverride=0;
  var iSameCampaignSource=0;
  var iCampaignCount=0;
  var i=0;
  var z="-";
  var s="";

  if (iAnchorEnable && poDocumentHREF && poDocumentHREF!="")
    s=poDocumentHREF+"&";

  s+=poDocumentLocation.search;

  // get the cookie and 6 month expiration time
  var sz6MonExpire=new Date(dCurrentTime.getTime()+(iCookieTimeOut*1000));
  var szCookie=poDocument.cookie;
  sz6MonExpire=" expires="+sz6MonExpire.toGMTString()+";";
  
  z=szCookie.indexOf("x_10c4="+iUniqueDomainHash);
  
  z=(z>-1)?ExtractData(szCookie,"x_10c4="+iUniqueDomainHash,";"):"-";
 
  // get the campaign parameters - from the referring URL
  t=ExtractData(s,szCampaignID+"=","&");
  t2=ExtractData(s,szCampaignSource+"=","&");
  t3=ExtractData(s,"gclid=","&");

  // if the parameters are valid...
  if ((t!="-" && t!="") || (t2!="-" && t2!="") || (t3!="-" && t3!=""))
  {
    if (t!="-" && t!="")
      szCampaignBuffer+="x_10cid="+EncodeSpace(t);

    if (t2!="-" && t2!="")
    {
      if (szCampaignBuffer != "")
        szCampaignBuffer+="|";

      szCampaignBuffer+="x_10csr="+EncodeSpace(t2);
    }

    if (t3!="-" && t3!="")
    {
      if (szCampaignBuffer != "")
        szCampaignBuffer+="|";

      szCampaignBuffer+="x_10gclid="+EncodeSpace(t3);
    }

    t=ExtractData(s,szCampaignName+"=","&");

    if (t!="-" && t!="")
      szCampaignBuffer+="|x_10ccn="+EncodeSpace(t);
    else
      szCampaignBuffer+="|x_10ccn=(not+set)";

    t=ExtractData(s,szCampaignMedium+"=","&");

    if (t!="-" && t!="")
      szCampaignBuffer+="|x_10dne="+EncodeSpace(t);
    else
      szCampaignBuffer+="|x_10dne=(not+set)";

    t=ExtractData(s,szCampaignKeyword+"=","&");

    if (t!="-" && t!="")
      szCampaignBuffer+="|x_10ctr="+EncodeSpace(t);
    else
    {
      t=GetKeyword(1);

      if (t!="-" && t!="")
        szCampaignBuffer+="|x_10ctr="+EncodeSpace(t);
    }

    t=ExtractData(s,szCampaignContent+"=","&");

    if (t!="-" && t!="")
         szCampaignBuffer+="|x_10cct="+EncodeSpace(t);

    t=ExtractData(s,szCampaignNoOverride+"=","&");

    if (t=="1")
      iNoOverride=1;

    if (z!="-" && iNoOverride==1)
      return "";
  }

  // if there was no buffer then get the keyword buffer
  if (szCampaignBuffer=="-" || szCampaignBuffer=="")
  {
    szCampaignBuffer=GetKeyword();

    if (z!="-" && iIgnoreKeyword==1)
      return "";
  }

  // if no buffer and a new session, get the referring domain
  if (szCampaignBuffer=="-" || szCampaignBuffer=="")
  {
    if (iNewSessionFlag==1)
      szCampaignBuffer=GetReferringDomain();

    if (z!="-" && iIgnoreKeyword==1)
      return "";
  }

  // if no buffer, set to defaults
  if (szCampaignBuffer=="-" || szCampaignBuffer=="")
  {
    if (z=="-" && iNewSessionFlag==1)
    {
      szCampaignBuffer="x_10ccn=dir|x_10csr=dir|x_10dne=no";
    }

    if (szCampaignBuffer=="-" || szCampaignBuffer=="")
      return "";
  }

  // if there is a x_10c4 cookie...
  if (z!="-")
  {
    i=z.indexOf(".");         // skip unique domain hash

    if (i>-1)
      i=z.indexOf(".",i+1);   // skip time in seconds

    if (i>-1)
      i=z.indexOf(".",i+1);   // skip page view count

    if (i>-1)
      i=z.indexOf(".",i+1);   // skip campaign entry count

    t=z.substring(i+1,z.length);

    if (t.toLowerCase()==szCampaignBuffer.toLowerCase())
      iSameCampaignSource=1;

    t=z.substring(0,i);

    if ((i=t.lastIndexOf(".")) > -1)
    {
      t=t.substring(i+1,t.length);
      iCampaignCount=(t*1);
    }
  }

  // if new session OR entry from a different campaign increment the page view count and the campaign entry count
  if (iSameCampaignSource==0 || iNewSessionFlag==1)
  {
    t=ExtractData(szCookie,"x_10c1="+iUniqueDomainHash,";");

    if ((i=t.lastIndexOf(".")) > 9)
    {
      iPageCount=t.substring(i+1,t.length);
      iPageCount=(iPageCount*1);
    }

    iCampaignCount++;
    if (iPageCount==0)
      iPageCount=1;

    poDocument.cookie="x_10c4="+iUniqueDomainHash+"."+iSeconds+"."+iPageCount+"."+iCampaignCount+"."+szCampaignBuffer+"; path="+szCookiePath+"; "+sz6MonExpire+szCookieDomain;
  }

  if (iSameCampaignSource==0 || iNewSessionFlag==1)
    return "&x_10cn=1";  // if not same campaign or a new campaign, add the appropriate parameter to the GIF
  else
    return "&x_10cr=1";  //
}
function GetReferringDomain()
{
  // fail if no valid referrer
  if (szReferrer=="0" || szReferrer=="" || szReferrer=="-")
    return "";

  var i=0;
  var h;
  var k;
  var n;

  // fail if no valid protocol
  if ((i=szReferrer.indexOf("://"))<0)
    return "";

  // extract the referring domain
  h=szReferrer.substring(i+3,szReferrer.length);
  
  if (h.indexOf("/") > -1) {
    k=h.substring(h.indexOf("/"),h.length);

    if (k.indexOf("?") > -1)
      k=k.substring(0,k.indexOf("?"));

    h=h.substring(0,h.indexOf("/"));
  }

  h=h.toLowerCase();
  n=h;

  // check for a port at the end of the domain
  if ((i=n.indexOf(":")) > -1)
    n=n.substring(0,i);

  // remove the www. if present
  if (h.indexOf("www.")==0)
    h=h.substring(4,h.length);

  return "x_10ccn=ref|x_10csr="+EncodeSpace(h)+"|"+"x_10cct="+EncodeSpace(k)+"|x_10dne=ref";
  
}
function GetKeyword(iKeywordOnly)
{
  // if no referrer, quit
  if (szReferrer=="0" || szReferrer=="" || szReferrer=="-")
    return "";

  var i=0,h,k;

  // if no protocol, quit
  if ((i=szReferrer.indexOf("://")) < 0)
    return "";

  // get the request domain
  h=szReferrer.substring(i+3,szReferrer.length);
  if (h.indexOf("/") > -1)
  {
    h=h.substring(0,h.indexOf("/"));
  }

  // test all of the search engines for the keyword query name-value pair
  for (var ii=0;ii<szOrganicSearchSource.length;ii++)
  {
    if (h.indexOf(szOrganicSearchSource[ii]) > -1)
    {
      if ((i=szReferrer.indexOf("?"+szOrganicKeywords[ii]+"=")) > -1 || (i=szReferrer.indexOf("&"+szOrganicKeywords[ii]+"=")) > -1)
      {
        k=szReferrer.substring(i+szOrganicKeywords[ii].length+2,szReferrer.length); // extract the keyword value

        if ((i=k.indexOf("&")) > -1)
          k=k.substring(0,i);

        // return/format the keyword buffer - else add the campaign soruce and keyword
        if (iKeywordOnly)
          return EncodeSpace(k);
        else
          return "x_10ccn=org|x_10csr="+EncodeSpace(szOrganicSearchSource[ii])+"|"+"x_10ctr="+EncodeSpace(k)+"|x_10dne=org";
      }
    }
  }

  return "";
}
function GetBasicClientInfo() {
        
  var sr="-";
  var sc="-";
  var ul="-";
  var fl="-";
  var je=1;
  var n=navigator;

  // get the screen dimensions
  if (self.screen) {
    sr=screen.width+"x"+screen.height;
    sc=screen.colorDepth+"-bit";
  } else if (self.java) {
    var j=java.awt.Toolkit.getDefaultToolkit();
    var s=j.getScreenSize();
    sr=s.width+"x"+s.height;
  }
  
  // get the language
  if (n.language){
    ul=n.language.toLowerCase();
  } else if (n.browserLanguage){
    ul=n.browserLanguage.toLowerCase();
  }

  // determine whether Java enabled
  je=n.javaEnabled()?1:0;

  if (iFlashDetectEnable)
    fl=FlashDetect();
  
  return "&x_10screen="+sr+"&x_10color="+sc+"&x_10lang="+ul+"&x_10java="+je+"&x_10flash="+fl;
  
}

function FlashDetect()
{
  var f="-",n=navigator;

  // search enumerated plugins for Flash object and get the version
  if (n.plugins && n.plugins.length)
  {
    for (var ii=0;ii<n.plugins.length;ii++)
    {
      if (n.plugins[ii].name.indexOf('Shockwave Flash')!=-1)
      {
        f=n.plugins[ii].description.split('Shockwave Flash ')[1];
        break;
      }
    }
  }

  // or try to create the flash object - versions 2 through 11 to find the max version
  else if (window.ActiveXObject)
  {
    for (var ii=10;ii>=2;ii--)
    {
      try
      {
        var fl=eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash."+ii+"');");
        if (fl)
        {
          f=ii + '.0';
          break;
        }
      }
      catch(e)
      {
      }
    }
  }

  return f;
}
function GetClientCookies()
{
  var t,c="",szCookie=poDocument.cookie;

  // extract a buffer containing all of the client tracking cookies
  if ((t=ExtractData(szCookie,"x_10c1="+iUniqueDomainHash,";"))!="-")
    c+=Escape("x_10c1="+t+";+");

  if ((t=ExtractData(szCookie,"x_10c2="+iUniqueDomainHash,";"))!="-")
    c+=Escape("x_10c2="+t+";+");

  if ((t=ExtractData(szCookie,"x_10c3="+iUniqueDomainHash,";"))!="-")
    c+=Escape("x_10c3="+t+";+");

  if ((t=ExtractData(szCookie,"x_10c4="+iUniqueDomainHash,";"))!="-")
    c+=Escape("x_10c4="+t+";+");

  if ((t=ExtractData(szCookie,"t_x10v="+iUniqueDomainHash,";"))!="-")
    c+=Escape("t_x10v="+t+";");

  if (c.charAt(c.length-1)=="+")
    c=c.substring(0,c.length-1);

  return c;
}

function ExtractData(szBuffer,szSearch,szSeparator)
{
  // validate parameters
  if (!szBuffer || szBuffer=="" || !szSearch || szSearch=="" || !szSeparator || szSeparator=="")
    return "-";

  var i,i2,i3,szReturn="-";

  // find the search string in the buffer
  i=szBuffer.indexOf(szSearch);

  // find location of character after '='
  i3=szSearch.indexOf("=")+1;

  // if the search string is found truncate after the separator
  if (i > -1)
  {
    i2=szBuffer.indexOf(szSeparator,i);
    if (i2 < 0)
      i2=szBuffer.length;
  
    szReturn=szBuffer.substring((i+i3),i2);
  }

  return szReturn;
}
function GetDomain()
{
  if (!szDomainMode || szDomainMode=="" || szDomainMode=="none")
  {
    szDomainMode="";
    return 1;
  }
  if (szDomainMode=="auto")
  {
    var szDomain=poDocument.domain;
    regex = new RegExp( "x10.com", "i" );
    if ( ( szDomain.substring(0,4) != "x10." ) && ( szDomain.match( regex ) ) )
            szDomain=szDomain.substring(szDomain.indexOf( "." ),szDomain.length);
    szDomainMode=szDomain;
  }
  if (szHash=="off")
    return 1;
  return BasicHash(szDomainMode);
}
function BasicHash(szDomain){
  if (!szDomain || szDomain=="")
    return 1;
  var h=0,g=0;
  for (var i=szDomain.length-1;i>=0;i--)
  {
    var c=parseInt(szDomain.charCodeAt(i));

    h=((h << 6) & 0xfffffff) + c + (c << 14);

    if ((g=h & 0xfe00000)!=0) h=(h ^ (g >> 21));
  }
  return h;
}
function AddPage(szBuffer,szSeparator,iTime) {
  if (!szBuffer || szBuffer=="" || !szSeparator || szSeparator=="" || !iTime || iTime=="")
    return "-";
  var szID=ExtractData(szBuffer,"x_10c1="+iUniqueDomainHash,szSeparator);
  var iLastTime=0,i=0;
  if ((i=szID.lastIndexOf(".")) > 9)
  {
    iPageCount=szID.substring(i+1,szID.length);
    iPageCount=(iPageCount*1)+1;
    szID=szID.substring(0,i);
    if ((i=szID.lastIndexOf(".")) > 7)
    {
      iLastTime=szID.substring(i+1,szID.length);
      szID=szID.substring(0,i);
    }
    if ((i=szID.lastIndexOf(".")) > 5)
      szID=szID.substring(0,i);
    szID+="."+iLastTime+"."+iTime+"."+iPageCount;
  }
  return szID;
}
function x10Trim(s) {
  if (!s || s=="") return "";
  while ((s.charAt(0)==' ') || (s.charAt(0)=='\n') || (s.charAt(0,1)=='\r')) s=s.substring(1,s.length);
  while ((s.charAt(s.length-1)==' ') || (s.charAt(s.length-1)=='\n') || (s.charAt(s.length-1)=='\r')) s=s.substring(0,s.length-1);
  return s;
}
function EncodeSpace(szBuffer) {
  var n="";
  if (!szBuffer || szBuffer=="")
    return "";
  for (var i=0;i<szBuffer.length;i++) {
    if (szBuffer.charAt(i)==" ")
      n+="+";
    else n+=szBuffer.charAt(i);
  }
  return n;
}
function IsNumericBuffer(szBuffer){
  if (!szBuffer)
    return false;
  for (i=0;i<szBuffer.length;i++){
    var c=szBuffer.charAt(i);
    if ((c<"0" || c>"9") && (c!="."))
      return false;
  }

  return true;
}
function Escape(szBuffer) {
        if (typeof(encodeURIComponent) == 'function')
                return encodeURIComponent(szBuffer);
        else
                return escape(szBuffer);
}
function UnEscape(szBuffer) {
        if (typeof(decodeURIComponent) == 'function')
                return decodeURIComponent(szBuffer);
        else
                return unescape(szBuffer);
}
function sptab( name, tabPosition, ads, tabgraphic, tabTrack ) {
	//Set Objects name
	this.name = name;
	this.tabPosition = tabPosition;
	this.ads = ads;
	this.tabgraphic = tabgraphic;
	this.tabTrack = tabTrack;
	this.tabTrackClick = 0;
	this.leftpad = 0;
	this.dtWidth = 200;
	this.dtHeight = 49;
	this.dwWidth = 600;
	this.dwHeight = 200;
	this.delay = 10000;
	this.TimerID=0;
	this.TimerScroll=0;
	this.TimerShowTab=0;
	this.ScrollTop = -1;
	this.docHeight = -1;
	this.docWidth = -1;
	this.ie=( document.all );
	this.w3=( document.getElementById && !this.ie );
	this.startat=0;
	//Functions
	this.init = function( startat ){
		this.create();
		this.ScrollTop = this.getScrolling();
		this.docHeight = this.getDocHeight();
		this.moveTabScroll();
		this.TimerID = setTimeout( this.name+".showTab();", 5000 );
		this.startat=startat;
	}
	this.showTab = function() {
		document.getElementById( this.name+"table" ).style.display = "block";
		document.getElementById( this.name ).style.display = "block";
		if( this.startat == 0 ) {
			//Turn off for steve
			//this.TimerID = setTimeout( this.name+".moveTabDown();", this.delay );
		} else {
			if( this.w3 ) {
				this.TimerID = setTimeout( this.name+".moveTabDown();", 500 );
			} else {
				this.moveTab();
			}
		}
	}
	this.create = function(){
		document.writeln( "<map name=\""+this.name+"tabButton\" id=\""+this.name+"tabButton\">" );
		document.writeln( "<area shape=\"poly\" coords=\"0,0,0,44,199,44,197,0,187,0,187,24,166,24,167,0\" href=\"javascript:"+this.name+".moveTab( 1 );\" title=\"Click to Open or Minimize\" />" );
		document.writeln( "<area shape=\"poly\" coords=\"168,1,168,21,185,21,184,0\" href=\"javascript:"+this.name+".closeTab();\" title=\"Click to Close\" />" );
		document.writeln( "<area shape=\"default\" nohref=\"nohref\" />" );
		document.writeln( "</map>" );
		document.writeln( "<div id=\""+this.name+"\" style=\"position:absolute;top:"+( this.getDocHeight() - (this.dwHeight + this.dtHeight ) - 5 )+"px;left:"+( (this.tabPosition * this.dtWidth ) + this.leftpad )+"px;height:"+this.dtHeight+"px;width:"+this.dtWidth+"px;z-index:"+(1000 - this.tabPosition)+";display:none;\">" );
		document.writeln( "<img usemap=\"#"+this.name+"tabButton\" src=\""+this.tabgraphic+"\" border=\"0\"></div>" );
		document.writeln( "<div id=\""+this.name+"table\" style=\"position:absolute;top:"+( this.getDocHeight() - this.dwHeight - 10 )+"px;left:"+( (this.tabPosition * this.dtWidth ) + this.leftpad )+"px;height:"+(this.dtHeight+4)+"px;width:"+(this.dtWidth+4)+"px;z-index:"+(1000 - this.tabPosition)+";display:none;\">" );
		document.writeln( "<table cellpadding=\"0\" cellspacing=\"0\" border=\"2\" width=\""+this.dwWidth+"\" height=\""+this.dwHeight+"\">" );
		document.writeln( "<tr><td><iframe onmouseover=\""+this.name+".clearTimerID();\" width=\""+this.dwWidth+"\" height=\""+this.dwHeight+"\" src=\""+this.ads+"\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\"></iframe></td></tr>" );
		document.writeln( "</table></div>" );
	}
	this.closeTab = function( type ) {
		if( this.name == "chatbox" ) {
			document.cookie = "NoHelp=1; path=/;";
		}
		if( this.name == "giveaway" ) {
			if( poDocument.cookie.indexOf("NoContest=0") > 0 )
				document.cookie = "NoContest=1; Max-Age=2592000; path=/;";
			else
				document.cookie = "NoContest=3; Max-Age=2592000; path=/;";
		}
		document.getElementById( this.name+"table" ).style.display = "none";
		document.getElementById( this.name ).style.display = "none";
	}
	this.clearTimerID = function() {
		clearTimeout( this.TimerID );
	}
	this.moveTab = function( type ) {
		clearTimeout( this.TimerID );
		if( document.getElementById( this.name+"table" ).style.display == "none" ) {
			if( ( type )  && ( this.tabTrack ) && ( ! this.tabTrackClick ) ) {
				var i=new Image(1,1);
				i.src=this.tabTrack;
				i.onload=function() { Void(); }
				this.tabTrackClick = 1;
			}
			this.moveTabUp();
		} else {
			this.moveTabDown();
		}

	}
	this.moveTabDown = function() {
		document.getElementById( this.name+"table" ).style.display = "none";
		document.getElementById( this.name ).style.top = ( ( this.ScrollTop + this.getDocHeight() ) - this.dtHeight - 4 ) + "px";
	}
	this.moveTabUp = function() {
		document.getElementById( this.name ).style.top = ( ( this.ScrollTop + this.getDocHeight() ) - (this.dwHeight + this.dtHeight ) - 5 ) + "px";
		document.getElementById( this.name+"table" ).style.top = ( ( this.ScrollTop + this.getDocHeight() ) - this.dwHeight - 10 ) + "px";
		document.getElementById( this.name+"table" ).style.display = "block";
	}
	this.moveTabScroll = function() {
		var documentHeight = this.getDocHeight();
		var scrolling = this.getScrolling();
		if( ( this.ScrollTop != scrolling ) || ( documentHeight != this.docHeight ) ) {
			this.ScrollTop =  scrolling;
			this.docHeight = documentHeight;
			this.moveTabDown();
/*			if( document.getElementById( this.name+"table" ).style.display == "none" ) {
				document.getElementById( this.name+"table" ).style.display = "none";
				document.getElementById( this.name ).style.top = ( ( this.ScrollTop + documentHeight ) - this.dtHeight - 4 ) + "px";
			} else {
				document.getElementById( this.name+"table" ).style.display = "none";
				document.getElementById( this.name ).style.top = ( ( this.ScrollTop + this.getDocHeight() ) - (this.dwHeight + this.dtHeight ) - 5 ) + "px";
				document.getElementById( this.name+"table" ).style.top = ( ( this.ScrollTop + this.getDocHeight() ) - this.dwHeight - 10 ) + "px";
			}*/
		}
		this.TimerScroll = setTimeout( this.name+".moveTabScroll();", 10 );
	}
	this.getDocWidth = function() {
		if ( this.ie ){
			var truebody = (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
			var documentWidth = truebody.offsetWidth;
		} else if ( this.w3 ){
			var documentWidth = self.innerWidth;
		}
		return documentWidth;
	}
	this.getDocHeight = function() {
		if ( this.ie ) {
			var truebody = (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
			var documentHeight = truebody.offsetHeight;
		} else if ( this.w3 ) {
			var documentHeight = self.innerHeight;
		}
		return documentHeight;
	}
	this.getScrolling = function() {
		return ( document.documentElement.scrollTop > 0 )?document.documentElement.scrollTop:document.body.scrollTop;
	}
}
x10Tracker();
