//Start everything up
//addLoadEvent(show);				//Show the menu
//addLoadEvent(startSlideshow);
//addLoadEvent(ticker_update);
//addLoadEvent(ticker_start);
/*
function startSlideshow() {
	var slideshow = new timedSlideShow($('mySlideshow'), mySlideData);
//	alert("Slideshow started");
}
*/
function show(id) {
	var d = document.getElementById(id);
	
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {
			document.getElementById('smenu'+i).style.display='none';
		}
	}

	if (d) {
		d.style.display='block';
	}
}

function init(){
//	window.onload=show;				//Dropdown Menus
//	window.onload=startSlideshow;	//Slideshow
}

function getLogIn(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");

	for(var i=0;i<vars.length;i++){
		var pair = vars[i].split("=");

		if (pair[0] == variable) {
			return "<a href='scr/LogOut.php'>Log Out</a>";
		}
	} 

	return "<a href='scr/LogIn.php'>Log In</a>";
}

function GetUser(){
	document.getElementById('idLogIn').innerHTML = getLogIn("User");
}

function isdefined(variable)
{
	if (typeof variable == 'undefined'){
		// variable x does not exist
		return false;
	}
	else
		return true;
}


function UpdateCharCount(fieldName){
//	alert("formName: "+formName+" fieldName: "+fieldName);
//	alert("got update char count: "+document.formName.fieldName.value.length+" innerHTML: "+document.getElementById(fieldName+'Count').innerHTML);
	var x=document.getElementsByName(fieldName);
//	alert(x[0].textLength);
	var tmpStr = x[0].value;
//	alert(tmpStr.replace(/[\r\n]/g, "x"));
	var repStr = tmpStr.replace(/[\r\n]/g, "cr");
//	alert(repStr);
//	document.getElementById(fieldName+'Count').innerHTML = x[0].textLength;
	document.getElementById(fieldName+'Count').innerHTML = repStr.length;
	
	//document.formName.fieldName.value.length;
}
