// parse and store the query string values if there are any
var qryVals = parseQueryString();;

// window onload
function globalOnload(){

	d = document;

	// hide elements that should not be visible to logged in users

	if (isAuthed() == false){

		/*
		// display sign up link
		d.getElementById('signupLink').style.visibility="visible";

		// display flash pitch if present
		try{d.getElementById('topflash').style.visibility="visible";}catch(e){}

		// display the join holder
		var jh = d.getElementById('joinholder');

		jh.style.width = '176px';
		jh.style.overflow = 'hidden';
		jh.style.visibility = 'visible';
		*/

		// store affiliate params if they exist in qryVals
		if (qryVals['tp'] != undefined) setCookie('tp', qryVals['tp']);
		if (qryVals['ts'] != undefined) setCookie('ts', qryVals['ts']);

	}

}

addEvent(window, 'load', 'addLoadEvent', globalOnload, true, 'stopVideo');

// misc
function getPgLoc(theForm){

	theForm.r.value = document.location;

}

function isAuthed() {

	if(getCookie("setauth") == 1){

		return(true);

	} else {

		return(false);

	}

}

function popGallery (URL){

	var load = window.open(URL,'','scrollbars=no, menubar=no,height=540,width=643,resizable=yes,toolbar=no, location=no,status=no');

}

function popthumb(loc,mytitle){

		//var myID = 'win' + Math.round(Math.random()*10000);
		var pageGuts = '<HTML><HEAD><TITLE>' + mytitle + '</TITLE></HEAD><BODY BGCOLOR="#000000" onblur="self.close()">';
		pageGuts += '<table width="100%" height="100%" cellpadding="0" cellspacing="0"><tr>';
		pageGuts += '<td align="center"><img src="' + loc + '" onclick="self.close()" onmouseover="this.style.cursor=\'hand\'"></td>';
		pageGuts += '</tr></table>';
		pageGuts += '</BODY></HTML>';

		theWin = window.open('','pop','width=660,height=500');
		theWin.document.write(pageGuts);

}

function popthumb2(loc,mytitle){

		//var myID = 'win' + Math.round(Math.random()*10000);
		var pageGuts = '<HTML><HEAD><TITLE>' + mytitle + '</TITLE></HEAD><BODY BGCOLOR="#000000" onblur="self.close()">';
		pageGuts += '<table width="100%" height="100%" cellpadding="0" cellspacing="0"><tr>';
		pageGuts += '<td align="center"><img src="' + loc + '" onclick="self.close()" onmouseover="this.style.cursor=\'hand\'"></td>';
		pageGuts += '</tr></table>';
		pageGuts += '</BODY></HTML>';

		theWin = window.open('','pop','width=500,height=670');
		theWin.document.write(pageGuts);

}

function openBase(URL){
	aWindow=window.open(URL,"BoxCover","width=515,height=720,status=yes,scrollbars=no,resize=no,menubar=no");
}

/*
	Function: parseQueryString()

	Populates an associative array with values from the URL query string.
	Each n/v pair in the query string is given an entry in the returned array in the format returnArray[n] = v.

	Arguments:
		none

	Returns:
		Array

*/

function parseQueryString(){

	var returnArray = new Array();

	var data = location.search.substring(1);

	if (data){

	    pairs = new Array();
	    pairs = data.split("&");

		for(i = 0; i < pairs.length;i++){
	        var tempPair = new Array();
	        tempPair = pairs[i].split("=");

			returnArray[tempPair[0]] = unescape(tempPair[1]);

		}

	}

	return returnArray;

}
