/*js. functions of default.asp; validator caused problem when including it in the file.*/
function adjustLayout() {
	var intLHeight=0,intRHeight=0,intMHeight=0;
	/*get the natural heights*/
	intRHeight = getHeight("RC");
	intLHeight = getHeight("LC");
	intMHeight = getHeight("Content");

	var intMaxHeight = Math.max(intRHeight, Math.max(intLHeight,intMHeight));
	
	setHeight("RC",intMaxHeight);
	setHeight("LC",intMaxHeight);
	setHeight("Content",intMaxHeight);	
	/*after all said and done, show the footer*/
	showLayer("Footer");
}
function init() {
	addListener(window, "resize", adjustLayout, false);
	adjustLayout();
	if( document.forms && document.forms[0] && document.forms[0].strEmail ) 
		document.forms[0].strEmail.focus();
	alertError();
}
/*add listener before doing anyting else*/
addListener(window,"load",init,false);
/*form validation*/
function doValidate() {
	//try {		
		var objForm = document.forms[0];
		var objEmail = objForm.strEmail;
		var objPassword = objForm.strPassword;
		var strEmail = objEmail.value; //trimFieldValue(objEmail,"email");
		var strPassword = objForm.strPassword.value;
		var strMessage = "";
		//if( !isEmail(strEmail)  ) { strMessage += "- Email field should be a valid email address.\n"; objEmail.focus(); } 
		/*if( strPassword.length < 5 ) { strMessage += "- Password should be at least 5 characters long.\n";objPassword.focus();}*/
		if( strMessage != "" ) {
			alert( strMessage );
			return false;
		} else {
			doPost(objForm);
			return false;
		}
	//} catch(exception){alert(exception.description);}
}

var playerForm = null;
function playAllPicks(intMediaType) {
	if(!playerForm) playerForm = document.forms[1];
	
	/* v.o.: @20040709 - if there is no player form or the form is empty then exit. */
	if(!playerForm || playerForm.blnNoData) { return; }

	var objForm=playerForm;

	/* v.o.: @20040709 - reset playerform */
	playerForm = null;

	/*zeroeth form is the login form in header.*/
	var objTrackID=objForm.lngTrackID;
	//alert(objTrackID);
	if(objTrackID.length) {
		var strParam="";
		for(var i=0;i<objTrackID.length;i++) {
				//alert( objTrackID[i] );
			if(i==(objTrackID.length-1))
				strParam+=objTrackID[i].value;
			else
				strParam+=objTrackID[i].value+";"
		}
		//alert("debug:" + strParam );
		play(strParam,intMediaType);
	} else {
		play(objTrackID.value,intMediaType);
	}	
}

function playAllChart(intMediaType) {
	playerForm=document.forms[2];
	/* v.o.: @20040709 - if there is no player form or the form is empty then exit. */
	if(!playerForm || playerForm.blnNoData) { playerForm = null; return; }

	playAllPicks(intMediaType);
}


