/*
	# Copyright (c) 2001 Moonstone Interactive, Inc.  
	#
	# For more information, see:
	#     http://www.msinteractive.com/
	#
*/			
	
// Code starts here

function logGoal(a) {
	var u = document.location.pathname;
	var h = a.hostname;
	var t = a.text;
	if (t == undefined || t.length == 0) {
		t = a.hostname +  a.pathname;
	}
	var i = a.pagePosition;
	
	var sGoal;	
	sGoal = '/goal' + u 
	if (i != undefined) {
		sGoal += '/' + i;
	}
	sGoal += '/' + t;
	urchinTracker(sGoal);
	return true;
}

function getCookie ( cookie_name )
{
  var results = document.cookie.match ( cookie_name + '=(.*?)(;|$)' );

  if ( results )
    return ( unescape ( results[1] ) );
  else
    return '';
}

function addUTM () {
	var a = document.links;
	var d = document.domain;
	var c = escape(getCookie("__utma") + "-" + getCookie("__utmb") + "-" + getCookie("__utmc"));
	var s = '?';
	var bShowLink = (document.location.search.indexOf('showlinknumber') >= 0);
	for (i=0;i<a.length;i++) {
		if ((a[i].protocol.substr(0,4) == 'http') && (d != a[i].hostname)) {
			//alert("i=" + i + "\ndomain=" + document.domain + "\nhref=" + a[i].href + "\nhost=" + a[i].host + "\nhostname=" + a[i].hostname + "\npathname=" + a[i].pathname);
			if (a[i].href.indexOf(s) > -1) {
				s = '&';
			} 
			else {
				s = '?';
			}
			a[i].href = a[i].href + s + 'sid=' + c;
		}
		a[i].pagePosition = i;
		if (bShowLink) {
			a[i].title += "Link #:" + i;
		}
	}
	return true;
}

//preload spacer
function preloader(){
	var spacer = new Image();
	spacer.src = "images/spacer.gif";
	}

function LoadGIF(image) {
	var rollover = document.images;
	if (rollover) {
		eval (image + '= new Image()');
		eval (image + '.src  = "images/' + image + '.gif"');
	}
}



//this creates the button script 


function but_up(butname, imagename) {
	var imagepath;
	if (is_nav4) {
		// Netscape 4
		imagepath=document.images;
	} else {
		// IE, Netscape 6
		imagepath=document.images;
	}
	// Turn on nav item
	eval("imagepath." + imagename + ".src='images/" + butname + "_up.gif'");
}

function but_down(butname, imagename) {
	var imagepath = document.images;

	// Turn off nav item
	eval("imagepath." + imagename + ".src='images/" + butname + "_down.gif'");

}



function WM_netscapeCssFixCheckIn() {
  // This function checks to make sure the version of Netscape 
  // in use contains the bug; if so, it records the window's 
  // width and height and sets all resize events to be handled 
  // by the WM_netscapeCssFix() function.
  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;
  }
}

/*
** msi_copyright.js
** Version: 004 -- 06.22.00
*/

function include_copyright(startyear) {
	var	blob="";
	var msistartyear = 2001;
	var	today=new Date(); 
	var	thisyear = get_full_year(today);
	if (startyear < thisyear && startyear >= msistartyear) {
		blob += startyear + " - ";
	}
	blob += thisyear;
	blob = "Copyright &copy; " + blob;
	return blob;
}

/* 
** subroutine: get_full_year
** param1: d -> date.  any date object.
*/
function get_full_year(d) { // d is a date object
	yr = d.getYear();
	if (yr < 1000) {
	 	yr+=1900;
	}
	return yr;
}

/*For privacy policy/terms child window */
function openPrivacy() {
var openWin = window.open("http://www.getittoday.com/privacy_policy.html","privacy_terms","resizable=0,location=0,status=0,menubar=0,toolbar=0,scrollbars=1,width=450,height=400,left=0,top=0,screenX=0,screenY=0");
openWin.opener = window;

openWin.focus();
}

function openTerms() {
var openWin = window.open("http://www.getittoday.com/terms_of_service.html","privacy_terms","resizable=0,location=0,status=0,menubar=0,toolbar=0,scrollbars=1,width=450,height=400,left=0,top=0,screenX=0,screenY=0");
openWin.opener = window;

openWin.focus();
}

function openAffiliate(aURL) {
var openWin = window.open(aURL,"affiliate_win","resizable=1,location=1,status=1,menubar=1,toolbar=1,scrollbars=1,width=660,height=400,left=0,top=0,screenX=0,screenY=0");
openWin.opener = window;

openWin.focus();
}