/*************************/
/*** START DATE VALUES ***/
/*************************/

<!--
var m_names = new Array("January", "February", "March", 
"April", "May", "June", "July", "August", "September", 
"October", "November", "December");

var d = new Date();
var curr_date = d.getDate();
var curr_month = d.getMonth();
var curr_year = d.getFullYear();

//-->
function printDate() {
	document.write(m_names[curr_month] +"&nbsp;" + curr_date + ",&nbsp;" + curr_year);
}
function copyright() {
	document.write(curr_year);
}

/***********************/
/*** END DATE VALUES ***/
/***********************/



/******************************/
/*** START FORM VALIDATIONS ***/
/******************************/

/*** CONTACT FORM START ***/
<!-- Begin
function contactsubmit() {
var themessage = "You are required to complete the following fields:\n ";
if (document.form.Name.value=="") {
themessage = themessage + "\n - Name";
}
if (document.form.Email.value=="") {
themessage = themessage + "\n -  E-Mail";
}
if (document.form.Message.value=="") {
themessage = themessage + "\n - Your Message";
}
if (document.form.random.value=="") {
themessage = themessage + "\n - Verification Code";
}
//alert if fields are empty and cancel form submit
if (themessage == "You are required to complete the following fields:\n ") {
document.form.submit();
}
else {
alert(themessage);
return false;
   }
}
//  End -->
/*** CONTACT FORM END ***/

/*** INPUT CHECK START ***/
function checkInput(ob) { 
  var invalidChars = /["'\\]/gi
  if(invalidChars.test(ob.value)) {
        alert("Invalid characters. Quotation marks, apostrophes, and backslashes are not allowed.");
            ob.value = ob.value.replace(invalidChars,"");
      }
}
/*** INPUT CHECK END ***/

<!-- Begin
function announcements() {
var themessage = "";
if (document.form.message.value=="") {
themessage = "Please enter a message.";
document.getElementById("message").className='requiredfield';
}
//alert if fields are empty and cancel form submit
if (themessage == "") {
document.form.submit();
}
else {
alert(themessage);
return false;
   }
}
//  End -->

function removeannouncement(id) { 
var ans; ans=window.confirm('Are you sure you want to permanently remove this announcement?'); 
if (ans==true) { 
document.removelisting.del_id.value = id;
document.removelisting.action = 'deletelisting.php';
document.removelisting.submit();
} else { 
return false;
} 
}

<!-- Begin
function polls() {
var themessage = "";
if (document.form.question.value=="") {
themessage = "Please enter a question.";
document.getElementById("question").className='requiredfield';
}
//alert if fields are empty and cancel form submit
if (themessage == "") {
document.form.submit();
}
else {
alert(themessage);
return false;
   }
}
//  End -->

function removepolls(id) { 
var ans; ans=window.confirm('Are you sure you want to permanently remove this poll?'); 
if (ans==true) { 
document.removepoll.del_id.value = id;
document.removepoll.action = 'deletepoll.php';
document.removepoll.submit();
} else { 
return false;
} 
}

/****************************/
/*** END FORM VALIDATIONS ***/
/****************************/



/***************************/
/*** START PAGE INCLUDES ***/
/***************************/

actionname = unescape(params["action"]);


/*** INDEPENDENT FUNCTIONS START ***/

function votesubmit(songid, divtag, userid, isholiday) {
if (document.getElementById('rate'+divtag+'field').value != '') {
$.post(findRootURL()+"pages/stations/top40/votesubmit.php", { rate: document.getElementById('rate'+divtag+'field').value, songid: songid, userid: userid }, 
function() {
$("#popularity"+divtag).load(findRootURL()+"pages/stations/top40/popularity.php?isholiday=" + isholiday + "&songid=" + songid + "&" + Math.random() * 999999);
});

if (isholiday == 0) {
if (document.getElementById('rate'+divtag+'field').value == 1) {
	document.getElementById("vote"+divtag).innerHTML = "<b>My Vote: Poor</b>";
return;
}
if (document.getElementById('rate'+divtag+'field').value == 2) {
	document.getElementById("vote"+divtag).innerHTML = "<b>My Vote: Fair</b>";
return;
}
if (document.getElementById('rate'+divtag+'field').value == 3) {
	document.getElementById("vote"+divtag).innerHTML = "<b>My Vote: Good</b>";
return;
}
if (document.getElementById('rate'+divtag+'field').value == 4) {
	document.getElementById("vote"+divtag).innerHTML = "<b>My Vote: Awesome</b>";
return;
}
if (document.getElementById('rate'+divtag+'field').value == 5) {
	document.getElementById("vote"+divtag).innerHTML = "<b>My Vote: Excellent</b>";
return;
}
} else {
if (document.getElementById('rate'+divtag+'field').value == 1) {
	document.getElementById("vote"+divtag).innerHTML = "<font color='#ffffff'><b>My Vote: Poor</b></font>";
return;
}
if (document.getElementById('rate'+divtag+'field').value == 2) {
	document.getElementById("vote"+divtag).innerHTML = "<font color='#ffffff'><b>My Vote: Fair</b></font>";
return;
}
if (document.getElementById('rate'+divtag+'field').value == 3) {
	document.getElementById("vote"+divtag).innerHTML = "<font color='#ffffff'><b>My Vote: Good</b></font>";
return;
}
if (document.getElementById('rate'+divtag+'field').value == 4) {
	document.getElementById("vote"+divtag).innerHTML = "<font color='#ffffff'><b>My Vote: Awesome</b></font>";
return;
}
if (document.getElementById('rate'+divtag+'field').value == 5) {
	document.getElementById("vote"+divtag).innerHTML = "<font color='#ffffff'><b>My Vote: Excellent</b></font>";
return;
}
}
}
}

function popularity(popnum, divtag, isholiday) {
$("#popularity"+divtag).load(findRootURL()+"pages/stations/top40/popularity.php?isholiday=" + isholiday + "&songid=" + popnum + "&" + Math.random() * 999999); 
}

function playlistdisplay09(username, userid) {
$("#playlistsub").load(findRootURL()+"pages/stations/top40/playlist_display.php?type=number&username="+username+"&userid="+userid+"&" + Math.random() * 999999); 
}

function playlistdisplay_recentadd(username, userid) {
$("#playlistsub").load(findRootURL()+"pages/stations/top40/playlist_display.php?type=recadd&username="+username+"&userid="+userid+"&" + Math.random() * 999999); 
}

function playlistsearch(searchval, username, userid) {
$("#playlistsub").load(findRootURL()+"pages/stations/top40/playlist_display.php?type=search&username="+username+"&userid="+userid+"&search="+searchval.replace(' ','%20')+"&"+ Math.random() * 999999); 
document.search1.searchtxt1.value='';
document.search2.searchtxt2.value='';
}
function playlistdisplayletter(letter, username, userid) {
$("#playlistsub").load(findRootURL()+"pages/stations/top40/playlist_display.php?type=letter&username="+username+"&userid="+userid+"&char="+letter+"&"+ Math.random() * 999999); 
}

   	function moreclick(divtag) {
      $("#more"+divtag).show("slow");
	document.getElementById("more"+divtag+"link").innerHTML = "";
	}

	function lessclick(divtag) {
   	$("#more"+divtag).hide("slow");
	document.getElementById("more"+divtag+"link").innerHTML = "[+] More";
	}

	function hideonload(divtag) {
   	$("#more"+divtag).hide();
	}

   	function moreclickreq(divtag) {
      $("#morereq"+divtag).show("slow");
	document.getElementById("morereq"+divtag+"link").innerHTML = "";
	}

	function lessclickreq(divtag) {
   	$("#morereq"+divtag).hide("slow");
	document.getElementById("morereq"+divtag+"link").innerHTML = "[+] More";
	}

	function hideonloadreq(divtag) {
   	$("#morereq"+divtag).hide();
	}

/*** INDEPENDENT FUNCTIONS END ***/

/*************************/
/*** END PAGE INCLUDES ***/
/*************************/



/**********************/
/*** START PLAYLIST ***/
/**********************/
function searchTopEnterKey(username, userid) {
if(event.keyCode==13) {
event.keyCode=0;
submitsearch(document.search1.searchtxt1.value, username, userid);
}
}

function searchBottomEnterKey(username, userid) {
if(event.keyCode==13) {
event.keyCode=0;
submitsearch(document.search2.searchtxt2.value, username, userid);
}
}

function submitsearch(value, username, userid) {
if (value != '' && value != ' ') {
playlistsearch(value, username, userid); return false;
} else {
alert("You must enter a search value.");
}
}
/********************/
/*** END PLAYLIST ***/
/********************/



/***********************/
/*** START MENU CODE ***/
/***********************/
function findRootURL() {
	var url = document.location.toString() ; //url
	var e_url = '' ; //edited url
	var p = 0 ; //position
	var p2 = 0 ;//position 2
	p = url.indexOf("//") ;
	e_url = url.substring(p+2) ;
	p2 = e_url.indexOf("/") ;
	var root_url = url.substring(0,p+p2+3);
	return root_url;
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function setImages() {
MM_preloadImages(findRootURL()+'images/home_h.jpg',findRootURL()+'images/about-us_h.jpg',findRootURL()+'images/music_h.jpg',findRootURL()+'images/faq_h.jpg',findRootURL()+'images/contact-us_h.jpg');
}
/*********************/
/*** END MENU CODE ***/
/*********************/
