
// sniff
var isWin = window.navigator.platform.toLowerCase().indexOf('win') != -1 ? 1:0;
var isMac = window.navigator.platform.toLowerCase().indexOf('mac') != -1 ? 1:0;
var isDOM = document.getElementById ? 1:0;
var isIE = document.all ? 1:0;
var isIE4 = isIE && !isDOM ? 1:0;
var isIE5 = isIE && isDOM ? 1:0;
var isNS = navigator.appName=='Netscape';
var isNS4 = isNS && !isDOM ? 1:0;
var isNS6 = isNS && isDOM ? 1:0;
var isOp = window.opera ? 1:0;
var isDyn = isDOM||isIE||isNS4;

var dq = "";
var agt= navigator.userAgent.toLowerCase();
var is_nav = ((agt.indexOf('spoofer') > -1) || (agt.indexOf('webtv') > -1) || (agt.indexOf('hotjava') > -1));
if (!is_nav) {
	if ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1)) { dq += "&os=win95"; }
	else if (agt.indexOf("mac")!=-1) { dq += "&os=mac";}
	else { dq += "&os=winX";}
} else { dq += "&os=other";}
dq += ((isIE) ? "&browser=IE" : "&browser=nonIE");

// append stc to url
function appendSTC(page) { 
	var ran_unrounded = Math.random() * 1000000000;
	var ran_number = Math.round(ran_unrounded);
	if ( page.indexOf("?") == -1 ) window.location.href = page + "?stc=" + ran_number;
	else window.location.href = page + "&stc=" + ran_number;
}

function isPageSecure(){
	if (document.location.href.indexOf("https://") != -1) return true;
	else return false;
}

// include script files. accepts both full paths, or filenames (no extension) of files in /scripts/
function includeJS(){
	if(arguments.length>0) INCLUDES=arguments;
	if(typeof INCLUDES != "undefined"){
		for(var i=0;i<INCLUDES.length;i++){
			if (INCLUDES[i].indexOf("/") != -1) document.writeln("<scr"+"ipt src='"+INCLUDES[i]+"' type='text/javascript'></scr"+"ipt>");
			else document.writeln("<scr"+"ipt src='/scripts/"+INCLUDES[i]+".js' type='text/javascript'></scr"+"ipt>");
		}
	}
}

function addLoadEvent(func) {
	var oldFunc=window.onload;
	if (typeof window.onload!='function') { window.onload=func; } 
	else { window.onload=function() { oldFunc(); func(); } }
}

// cookie, tracking, util and media player scripts
includeJS("util", "cookie","global_tracking");

