// This next little bit of code tests whether the user accepts cookies.
var WM_acceptsCookies = false;
if(document.cookie == '') {
    document.cookie = 'WM_acceptsCookies=yes'; // Try to set a cookie.
    if(document.cookie.indexOf('WM_acceptsCookies=yes') != -1) {
	WM_acceptsCookies = true; 
    }// If it succeeds, set variable
} else { // there was already a cookie
  WM_acceptsCookies = true;
}

function WM_setCookie (name, value, hours, path, domain, secure) {
    if (WM_acceptsCookies) { // Don't waste your time if the browser doesn't accept cookies.
	var not_NN2 = (navigator && navigator.appName 
		       && (navigator.appName == 'Netscape') 
		       && navigator.appVersion 
		       && (parseInt(navigator.appVersion) == 2))?false:true;

	if(hours && not_NN2) { // NN2 cannot handle Dates, so skip this part
	    if ( (typeof(hours) == 'string') && Date.parse(hours) ) { // already a Date string
		var numHours = hours;
	    } else if (typeof(hours) == 'number') { // calculate Date from number of hours
		var numHours = (new Date((new Date()).getTime() + hours*3600000)).toGMTString();
	    }
	}
	document.cookie = name + '=' + escape(value) + ((numHours)?(';expires=' + numHours):'') + ((path)?';path=' + path:'') + ((domain)?';domain=' + domain:'') + ((secure && (secure == true))?'; secure':''); // Set the cookie, adding any parameters that were specified.
    }
} // WM_setCookie

function WM_readCookie(name) {
    if(document.cookie == '') { // there's no cookie, so go no further
	return false; 
    } else { // there is a cookie
	var firstChar, lastChar;
	var theBigCookie = document.cookie;
	firstChar = theBigCookie.indexOf(name);	// find the start of 'name'
	var NN2Hack = firstChar + name.length;
	if((firstChar != -1) && (theBigCookie.charAt(NN2Hack) == '=')) { // if you found the cookie
	    firstChar += name.length + 1; // skip 'name' and '='
	    lastChar = theBigCookie.indexOf(';', firstChar); // Find the end of the value string (i.e. the next ';').
	    if(lastChar == -1) lastChar = theBigCookie.length;
	    return unescape(theBigCookie.substring(firstChar, lastChar));
	} else { // If there was no cookie of that name, return false.
	    return false;
	}
    }	
} // WM_readCookie

function WM_killCookie(name, path, domain) {
  var theValue = WM_readCookie(name); // We need the value to kill the cookie
  if(theValue) {
      document.cookie = name + '=' + theValue + '; expires=Fri, 13-Apr-1970 00:00:00 GMT' + ((path)?';path=' + path:'') + ((domain)?';domain=' + domain:''); // set an already-expired cookie
  }
} // WM_killCookie

function WM_checkIn(id) {
  // This function checks for DOM strategy, then 
  // returns an object reference.
  if (document.getElementById) {
	return document.getElementById(id).style;
  } else if (document.all) {
    return document.all[id].style;
  } else if(document.layers) {
    return document.layers[id];
  }
}

/*
WM_changeVisibility()
usage: WM_changeVisibility('targetLayer1',[visible|hidden|toggle],'targetLayer2',[visible|hidden|toggle],...,'targetLayerN',[visible|hidden|toggle])
*/

// set hidden/visible vars for Netscape 4 compatibility
if (document.getElementById) {
  var hidden = "hidden";
  var visible = "visible";
} else if (document.layers) {
  var hidden = "hide";
  var visible = "show";
} else {
  var hidden = "hidden";
  var visible = "visible";
}
var toggle = "toggle";

function WM_changeVisibility() {
  if (document.getElementById || document.layers || document.all) {
    var inc, endInc=arguments.length;
    // run through the args (objects) and set the visibility of each
    for (inc=0; inc<endInc; inc+=2) {
      // get a good object reference
      var daObj = WM_checkIn(arguments[inc]);
      if (arguments[inc+1] == hidden) {
        // hide the object
        daObj.visibility = hidden;
      } else if (arguments[inc+1] == visible) {
        // show the object
        daObj.visibility = visible;
      } else if (arguments[inc+1] == toggle) {
        // toggle the object's visibility
        if (daObj.visibility == visible) {
          daObj.visibility = hidden;
        } else if (daObj.visibility == hidden) {
          daObj.visibility = visible;
        }
      }
    }
  }
}

function WM_imageSwap(daImage, daSrc){
  var objStr,obj;
/*
Usage: WM_imageSwap(originalImage, 'newSourceUrl');
Example: <a href="#" onMouseOver="WM_imageSwap('myImg', 'on.gif');" onMouseOut="WM_imageSwap('myImg', 'off.gif');"><img name="myImg" src="off.gif"></a>
*/

  // Check to make sure that images are supported in the DOM.
  if(document.images){
    // Check to see whether you are using a name, number, or object
	if (typeof(daImage) == 'string') {
      // This whole objStr nonesense is here solely to gain compatability
      // with ie3 for the mac.
      objStr = 'document.' + daImage;
      obj = eval(objStr);
      obj.src = daSrc;
    } else if ((typeof(daImage) == 'object') && daImage && daImage.src) {
      daImage.src = daSrc;
    }
  }
}

function WM_preloadImages() {
/*
Usage: WM_preloadImages('image 1 URL', 'image 2 URL', 'image 3 URL', ...);
*/

  // Don't bother if there's no document.images
  if (document.images) {
    if (typeof(document.WM) == 'undefined'){
      document.WM = new Object();
    }
    document.WM.loadedImages = new Array();
    // Loop through all the arguments.
    var argLength = WM_preloadImages.arguments.length;
    for(arg=0;arg<argLength;arg++) {
      // For each arg, create a new image.
      document.WM.loadedImages[arg] = new Image();
      // Then set the source of that image to the current argument.
      document.WM.loadedImages[arg].src = WM_preloadImages.arguments[arg];
    }
  }
}

function WM_netscapeCssFix() {
  if (document.WM.WM_netscapeCssFix.initWindowWidth != window.innerWidth || document.WM.WM_netscapeCssFix.initWindowHeight != window.innerHeight) {
    document.location = document.location;
  }
}

function WM_netscapeCssFixCheckIn() {
  if ((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) == 4)) {
    if (typeof document.WM == 'undefined'){
      document.WM = new Object;
    }
    if (typeof document.WM.WM_scaleFont == 'undefined') {
      document.WM.WM_netscapeCssFix = new Object;
      document.WM.WM_netscapeCssFix.initWindowWidth = window.innerWidth;
      document.WM.WM_netscapeCssFix.initWindowHeight = window.innerHeight;
    }
    window.onresize = WM_netscapeCssFix;
  }
}

//var msg="Copyright ©2005 DirectTrack. All rights reserved.";
//function disableIE() 
//{
//	if (document.all) {alert(msg);return false;}
//}
//function disableNS(e) 
//{
//	if (document.layers||(document.getElementById&&!document.all))
//	{
//		if (e.which==2||e.which==3) {alert(msg);return false;}
//	}
//}
//if (document.layers) 
//{
//  document.captureEvents(Event.MOUSEDOWN);document.onmousedown=disableNS;
//} 
//else 
//{
//	document.onmouseup=disableNS;document.oncontextmenu=disableIE;
//}
//document.oncontextmenu=new Function("alert(msg);return false")

function openWin()
{
	width = 300;
	height = 250;
	if(openWin.arguments[0])
	{
		url = openWin.arguments[0];
	}
	if(openWin.arguments[1])
	{
		width=openWin.arguments[1];
	}
	if(openWin.arguments[2])
	{
		height = openWin.arguments[2];
	}
	x = screen.width/2 - 150;
	y = screen.height/2 - 125;
	aWindow = window.open(url,"thewindow",'dependent=yes,toolbar=0,location=0,directories=0,status=0,menubar=0, width='+width+', height='+height+', scrollbars, resizable');
	if(aWindow)
	{
		aWindow.moveTo(x,y);
		aWindow.focus();
	}
	else
	{
		alert('Please disable your popup blocker to view this message');
	}
}

text="hello";
function win(text) {
msg=window.open("","msg","height=200,width=200,left=400,top=300");
msg.document.write("<html><head><style>.main{font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;color: #000000;}</style>");
msg.document.write("<title>FAQ</title>");
msg.document.write("</head>");
msg.document.write("<body bgcolor='B1BBAE' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'><table width='200' border='0' cellspacing='0' cellpadding='0'><tr><td width='42' rowspan='2'><img src='/images/home/question_lg.gif'width='42'hspace='0'height='58'vspace='0'align='LEFT'border='0'></td><td align='center' bgcolor='ffffff' height='38' width='100%'><a href=# onClick=window.close()>close window</a></td></tr><tr><td  height='20' bgcolor='#663366'></td></tr>");
msg.document.write("<tr><td class='maintext' colspan='2'><table border='0' cellpadding='4'><tr><td class='main'>" + text + "</td></tr></table></td></tr></table>");
msg.document.write("</body></html>");


// If you just want to open an existing HTML page in the 
// new window, you can replace win()'s coding above with:
// window.open("page.html","","height=200,width=200,left=80,top=80");

}
function MM_popupMsg(msg) {
  alert(msg);
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

WM_netscapeCssFixCheckIn()
