/*js. functions of station.asp;*/
function adjustLayout() {
	var inLH=0;intMH=0;
	intLH=getHeight("LC");
	intMH=getHeight("Content");
	var intMaxH = Math.max(intLH,intMH);
	setHeight("LC",intMaxH);
	setHeight("Content",intMaxH);
	showLayer("Footer");
}
function init() {
	addListener(window, "resize", adjustLayout, false);
	adjustLayout();
	FrmPaging = document.forms[1];
}
/*add listener before doing anyting else*/
addListener(window,"load",init,false);

function deleteBlogEntry(lngBlogID) {
	var objForm=null;
	if(!(objForm=document.forms[1]))return;
	objForm.lngBlogID.value=lngBlogID;
	if(confirm("Are you sure you want to delete the selected entry?"))
		doPost(objForm,"DeleteBlog");
}

var playerForm=null;
function playAllPicks(intMediaType){
	if(!playerForm)playerForm=document.forms[2];
	if(!playerForm)return;
	
	var objForm=playerForm;
	/*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( strParam );
		play(strParam,intMediaType,false);
	} else {
		play(objTrackID.value,intMediaType,false);
	}
}

function playAllChart(intMediaType) {
	playerForm=document.FrmChart;
	/* v.o.: @20040709 - if there is no player form or the form is empty then exit. */
	if(!playerForm || playerForm.blnNoData) { playerForm = null; alert("null");return; }

	playAllPicks(intMediaType);
}


function releaseTrack(lngTrackID) {
	if(confirm("Are you sure you want to release the selected Track?")) {
		var objForm = new FormObject(document.forms[1],"ReleaseTrack")
		objForm.setFieldValue("lngTrackID", lngTrackID);
		objForm.post();
	}
}

function releaseTrack_(lngTrackID,lngLabelID) {
	
	if(confirm("Are you sure you want to release the selected Track?")) {
		var objForm = new FormObject(document.forms[1],"ReleaseTrack")
		
		objForm.setFieldValue("lngTrackID", lngTrackID);
		objForm.setFieldValue("lngLabelID", lngLabelID);
		objForm.post();
	}
}

function sortbyhit() {
	var objForm = new FormObject(document.forms[1]);
	objForm.setFieldValue("SortType","Sort ByHit");
	objForm.post();
}
function sortbydate() {
	var objForm = new FormObject(document.forms[1]);
	objForm.setFieldValue("SortType","Sort ByDate");
	objForm.post();
}

function shout() {
	//2004.09.16 - b.b. - added to check if user is a trial user
	
	if( USER_TRIAL.toLowerCase()== "true" ){
		alert("You are a trial user. You can not send message to this artist.");
		return;
	}
	
	//finished here
	
	
	if( USER_LOGGED_IN.toLowerCase() == "false" ) {
		alert("You have to sign in before you send a comment.");
		self.location = "signin.asp";
	} else {
		var objForm=null;
		if(!(objForm=document.forms['shoutboardform']))return;		
		
		var objComment = objForm.txtComments;
		objComment.value = objComment.value.trim();
		if( objComment.value == "" ) {
			alert("Aren't you going to say something?");
			objComment.focus();
		} else doPost(objForm,"Send Comment");
		
	}
}

function deleteComment() {
	var objForm=null;
	if(!(objForm=document.forms['FrmPaging']))return;
	doPost(objForm,"Delete Comment");
}

function deleteShout(ShoutID) {
	
	var objForm=null;
	if(!(objForm=document.forms['FrmPaging']))return;
	if(confirm("Are you sure you want to delete the selected shout?")) {
		objForm.ShoutID.value = ShoutID;
		doPost(objForm,"Delete Shout");
	}
}

function tellUs()
{
	var objForm=null;
	if(!(objForm=document.getElementById("shoutboardform"))) return;
	doPost(objForm,"Tell Us");
	alert ("Thanks, we will check this out. You can contact us at members@numu.org.uk");
}
