
// spotlight tags
function spotlightTag() {
	var spotlightSRC, slType, slCat;
	var args = spotlightTag.arguments;
	
	spotlightSRC = args[0];
	slType = args[1];
	slCat = args[2];
	 
	var a = Math.random() * 10000000000000;
	
	var url = 'http://ad.au.doubleclick.net/activity;src='+ spotlightSRC +';type='+ slType +';cat='+slCat+';ord=1;num='+ a + '?';
	var tag = '<img src="' + url + '" width="1" height="1" border="0">';
	
	document.getElementById("sl").innerHTML = tag;
}


function updateHistory() {
	var path = updateHistory.arguments[0];
	var q_str = new String();
	q_str = parseQueryObject(path);
	top.frames["hist"].location.href = "history.html?" + q_str ;
}


function createHistoryFrame() {
	var URL = 'history.html?';	
	
	var historyFrame = document.createElement("iframe");
	historyFrame.setAttribute("id", "hist");
	historyFrame.setAttribute("name", "hist");
	historyFrame.setAttribute("src", URL);
	historyFrame.style.border = "0px";
	historyFrame.style.width = "0px";
	historyFrame.style.height = "0px";
	
	document.body.appendChild(historyFrame);
}

function parseQuery(){
	var pairHalves;
	var queryVars = {};
	var q_str = parseQuery.arguments[0];
		
	var N_V_pairs = q_str.split("&");
	var l = N_V_pairs.length;
	for(i=0; i<l; i++){
		pairHalves = N_V_pairs[i].split("=");
		queryVars[pairHalves[0]] = pairHalves[1];
	}
	return queryVars;
}

function parseQueryObject() {
	var query = parseQueryObject.arguments[0]
	var q_str = ''; 
	for (var key in query) {
		q_str += key + '=' + query[key] + '&';
	} 

	q_str = q_str.substr(0, q_str.length - 1);
	return q_str
}

function setScrollTop(){
	self.scrollTo(0,0);
}
function setScrollBottom(){
	self.scrollTo(0,3000);
}
function setScrollPos(numPos){
	self.scrollTo(0,numPos);
}

function setFocus() {
	window.focus();
}
function notFound(){
	parent.window.location = "404.html";
}
function addBookmark(){
	
	var appName = navigator.appName.toLowerCase(); 
	var userAgent = navigator.userAgent.toLowerCase();
	
	if (appName.indexOf("explorer") != -1){
		window.external.AddFavorite(location.href, document.title);
	} else {
		var info;
		if (userAgent.indexOf("mac") != -1){
			info = "Please use Cmd-D or the menu to bookmark this site";
		} else {
			info = "Please use Ctrl-D or the menu to bookmark this site";
		}
		alert(info);		
	}
}

function traceOut() {
	var args = traceOut.arguments;
	document.getElementById("debug").innerHTML = args[0] + "<br>" + document.getElementById("debug").innerHTML;
}

function buildDebug() {
        var debugDiv = document.createElement("div");
        debugDiv.setAttribute("id", "debug");
        document.body.appendChild(debugDiv);
}

function initPage() {
	createHistoryFrame();
}


