// declare variables
livePictures1 = new Image(129,27);
livePictures2 = new Image(129,27);
theBand1 = new Image(129,27);
theBand2 = new Image(129,27);
bookYesTerday1 = new Image(129,27);
bookYesTerday2 = new Image(129,27);
calendar1 = new Image(129,27);
calendar2 = new Image(129,27);
emailUs1 = new Image(129,27);
emailUs2 = new Image(129,27);
songList1 = new Image(129,27);
songList2 = new Image(129,27);
home1 = new Image(129,27);
home2 = new Image(129,27);
wgrr1 = new Image(50,50);
wgrr2 = new Image(50,50);

// assign varaibles
livePictures1.src = "images/livePictures1.gif";
livePictures2.src= "images/livePictures2.gif";
theBand1.src = "images/theBand1.gif";
theBand2.src= "images/theBand2.gif";
bookYesTerday1.src = "images/bookYesTerday.gif";
bookYesTerday2.src= "images/bookYesTerday2.gif";
calendar1.src = "images/calendar1.gif";
calendar2.src= "images/calendar2.gif";
emailUs1.src = "images/emailUs1.gif";
emailUs2.src= "images/emailUs2.gif";
songList1.src = "images/songList1.gif";
songList2.src= "images/songList2.gif";
home1.src = "images/home1.gif";
home2.src= "images/home2.gif";
wgrr1.src = "images/wgrrLogo.gif";
wgrr2.src= "images/wgrrLogo2.gif";


function customDateString(oneDate) 
{
	var theYear = oneDate.getYear();
	return "Copyright &copy; " + oneDate.getYear();
}

function overLivePictures() 
{
 	var image = document.getElementById('livePictures1');
	image.src = livePictures2.src; 
	return true;
}

function outLivePictures() 
{
	var image = document.getElementById('livePictures1');
	image.src = livePictures1.src;
	return true;
}

function overtheBand() 
{
	var image = document.getElementById('theBand1');
	image.src = theBand2.src; 
	return true;
}

function outtheBand() 
{
	var image = document.getElementById('theBand1');
	image.src = theBand1.src; 
	return true;
}

function overbookYesTerday() 
{
	var image = document.getElementById('bookYesTerday1');
	image.src = bookYesTerday2.src;
	return true;
}

function outbookYesTerday() 
{
	var image = document.getElementById('bookYesTerday1');
	image.src = bookYesTerday1.src;
	return true;
}

function overcalendar() 
{
	var image = document.getElementById('calendar1');
	image.src = calendar2.src; 
	return true;
}	

function outcalendar() 
{
	var image = document.getElementById('calendar1');
	image.src = calendar1.src;
	return true;
}

function overemailUs() 
{
	var image = document.getElementById('emailUs1');
	image.src = emailUs2.src;
	return true;
}

function outemailUs()
{
	var image = document.getElementById('emailUs1');
	image.src = emailUs1.src;
	return true;
}

function oversongList() 
{
	var image = document.getElementById('songList1');
	image.src = songList2.src;
	return true;
}

function outsongList() 
{
	var image = document.getElementById('songList1');
	image.src = songList1.src; 
	return true;
}

function overhome() 
{
	var image = document.getElementById('home1');
	image.src = home2.src;
	return true;
}

function outhome()
{
	var image = document.getElementById('home1');
	image.src = home1.src;
	return true;
}

function overwgrr() 
{
	var image = document.getElementById('wgrr1');
	image.src = wgrr2.src;
	return true;
}

function outwgrr()
{
	var image = document.getElementById('wgrr1');
	image.src = wgrr1.src;
	return true;
}

function getParameterValue(paramName)
{
	var params = location.search;
	var idxStart = params.indexOf(paramName) + paramName.length + 1;
	var idxEnd = ((params.indexOf("&",idxStart) != -1) ? params.indexOf("&",idxStart) : params.length);
	return params.substring(idxStart,idxEnd);
}

function myredirect(mtype)
{
 	window.location = "index.php?pageid="+getParameterValue('pageid')+"&entry="+mtype;
}

function submitform()
{
	document.forms[0].submit();
}



//--------------------------------------------------------------------------------
// Overrides
//--------------------------------------------------------------------------------
window.onload = OnLoad;
	
	
//--------------------------------------------------------------------------------
// Name: OnLoad
// Abstract: ...
//--------------------------------------------------------------------------------
function OnLoad( )
{
	try
	{
		// Get a reference to the form
		var frmForm = document.getElementById('frmForm');
		
		//Trim all fields
		TrimAllFormTextBoxes( frmForm );
		
	}
	catch( expError )
	{
		alert( "index.php::OnLoad( ).\nError:" + expError.number + ", " + expError.description ); 
	}
}

// ////////////////////////////////////////////////////////////////////////////////
//     Name: TrimAllFormTextBoxes  
//     Abstract: Trim all the textboxes on the form 
// ////////////////////////////////////////////////////////////////////////////////
function TrimAllFormTextBoxes( frmTarget )  
{  
  	try
  	{
		var intIndex = 0; 
		var objCurrentElement = 0; 
		var strMessage = "";
  	  	
		// Loop through each element in the form 
		for( intIndex = 0; intIndex < frmTarget.elements.length; intIndex++ ) 
		{ 
			// Next element 
			objCurrentElement = frmTarget.elements.item( intIndex ); 
  	  	  	
			// Textbox? 
			if( ( objCurrentElement.type == "text" ) || ( objCurrentElement.type == "textarea" ) )
			{ 
				// Yes, trim it 
			  	objCurrentElement.value = Trim( objCurrentElement.value ); 
			} 
			else
			{
				strMessage = strMessage + objCurrentElement.name + " - " + objCurrentElement.type + "\n";
			}
		}
		
		//alert(strMessage) ;
		
	}  
	catch( expError )  
	{  
		//alert( "index.php::TrimAllFormTextBoxes( ).\nError:" + expError.number + ", " + expError.description ); 
	}  
} // TrimAllFormTextBoxes 
	


// -------------------------------------------------------------------------
//  Name: Trim
//  Abstract: Trim leading and trailing white space.
// -------------------------------------------------------------------------
function Trim( strString )
{
	try
	{
		var strBuffer = "" + strString;	// Force copy by value using ""
		
		// Replace leading with space with nothing( global/ignore case )
		strBuffer = strBuffer.replace( /^\s*/gi, "");
		
		// Replace trailing with space with nothing( global/ignore case )
		strBuffer = strBuffer.replace( /\s*$/gi, "");
		
		return strBuffer;
	}
	catch( expError )
	{
		alert( "index.php::Trim( ).\nError:" + expError.number + ", " + expError.description );
	}
} // Trim