//Preload Images here

if(document.images)
{
  homeOn = new Image(); 
  homeOff = new Image();
  galleryOn = new Image();
  galleryOff = new Image();
  groupOn = new Image();
  groupOff = new Image();  
  eventsOn = new Image();
  eventsOff = new Image();
  musicOn = new Image();
  musicOff = new Image();
  myspaceOn = new Image();
  myspaceOff = new Image();
  accessOn = new Image();
  accessOff = new Image();

  bookingOn = new Image();
  bookingOff = new Image();
  gospelOn = new Image();
  gospelOff = new Image();
  purchaseOn = new Image();
  purchaseOff = new Image();	
  commentOn = new Image();
  commentOff = new Image();


  homeOn.src = "./util/bhomeON.PNG";
  homeOff.src = "./util/bhomeOFF.PNG";
  galleryOn.src = "./util/bgalleryON.PNG";
  galleryOff.src = "./util/bgalleryOFF.PNG";
  groupOn.src = "./util/bgroupON.PNG";
  groupOff.src = "./util/bgroupOFF.PNG";
  eventsOn.src = "./util/beventsON.PNG";
  eventsOff.src = "./util/beventsOFF.PNG";
  musicOn.src = "./util/bmusicON.PNG";
  musicOff.src = "./util/bmusicOFF.PNG";
  myspaceOn.src = "./util/bmyspaceON.PNG";
  myspaceOff.src = "./util/bmyspaceOFF.PNG";
  gospelOn.src = "./util/bgospelON.PNG";
  gospelOff.src = "./util/bgospelOFF.PNG";
  bookingOn.src = "./util/bbookingON.PNG";
  bookingOff.src = "./util/bbookingOFF.PNG";
  purchaseOn.src = "./util/bpurchaseON.PNG";
  purchaseOff.src = "./util/bpurchaseOFF.PNG";
  commentOn.src = "./util/bcommentON.PNG";
  commentOff.src = "./util/bcommentOFF.PNG"; 
  accessOn.src = "./util/baccessON.PNG";
  accessOff.src = "./util/baccessOFF.PNG"; 

}

//-----------------Embedded Music------------------
/*
var string = "";
if(navigator.appName == "Microsoft Internet Explorer")
{
	// IE
	string = "<embed autostart=\"true\" width=\"0\" height=\"0\" src=\"./You_Could_Have_Been_My_Friend.mp3\" loop=\"true\" />";
}else{	
	//Mozilla
	string = "<object width=\"0\" height=\"0\" data=\"./You_Could_Have_Been_My_Friend.mp3\" type=\"audio/mpeg\" />";
	string = string + "<param name=\"autoplay\" value=\"true\" /></object>";
}
*/
//document.write(string);


//-------------------FUNCTIONS --------------------
function OnButton(name)
{  
  //id = name

   if(document.images){ 
        document[name].src = eval(name + "On.src");	
   }
}

function OffButton(name)
{
   if(document.images){ 
      document[name].src = eval(name + "Off.src");
   }
}

function toggleColor(id) {
	document.getElementById(id).style.backgroundColor = '#CCCCCC';	
}

function resetColor(id) {
	document.getElementById(id).style.backgroundColor = "#ffffff";
}

function makeArray(length) {
   for(var i=0; i<length; i++) {

      this[i] = null;
   }
this.length = length;
}



//--------------------- DATE -------------------
var now = new Date();
var seed = now.getTime() % 0xffffffff;
var dayNames = new makeArray(7);
dayNames[0]="Sunday";
dayNames[1]="Monday";
dayNames[2]="Tuesday";
dayNames[3]="Wednesday";
dayNames[4]="Thursday";
dayNames[5]="Friday";
dayNames[6]="Saturday";

var monthNames = new makeArray(12);
monthNames[0]="January";
monthNames[1]="February";
monthNames[2]="March";
monthNames[3]="April";
monthNames[4]="May";
monthNames[5]="June";
monthNames[6]="July";
monthNames[7]="August";
monthNames[8]="September";
monthNames[9]="October";
monthNames[10]="November";
monthNames[11]="December";

var now = new Date();
var day = now.getDay();
var month = now.getMonth();
var date = now.getDate();
var year = now.getYear();

if(year < 1900){
   year += 1900;
}

function getPage(form) {
 var i = form.sports.selectedIndex;

 if (i != 0) {

    window.top.location.href = urls[i];
  }
} 


function validateDonation()
{
	var valid = true;
	var value = document.order.donation.value;	
	document.order.x_Amount.value = document.order.donation.value;
	
	if(!isValidInt(value)){
		alert("Donation value is invalid");
		return false;
	}
	
	if(value <= 0){
		alert("No Donation Value was entered");
		return false;
	}		
	return valid;
} 

function isValidInt(val) {
   var digits = "0123456789.";
  
   for(var i = 0; i < val.length; i++ ) {
      if(digits.indexOf(val.charAt(i)) == -1) {
          return false;
      }
   }
 
   if(val.length == 0) {
      return false;
   } else {
      return true;
   }
}

