function setPageButton(){
    if (sPage == 1) {
    	document.images['Image1511'].src = "SoundRoomStudios/images/adapter_over.gif";
    } else if (sPage == 2) {
    	document.images['Image1411'].src = "images/about_over.gif";
    } else if (sPage == 3) {
    	document.images['Image19111'].src = "images/cassette_over.gif";
    } else if (sPage == 4) {
    	document.images['Image1811'].src = "images/microphone_over.gif";
    } else if (sPage == 5) {
    	document.images['Image231'].src = "images/speaker_over.gif";
    } else if (sPage == 6) {
    	document.images['Image1911'].src = "images/recording_over.gif";
    } else if (sPage == 7) {
    	document.images['Image1711'].src = "images/photo_over.gif";
    } else if (sPage == 8) {
    	document.images['Image211'].src = "images/briefcase_over.gif";
    } else if (sPage == 9) {
    	document.images['Image16111'].src = "images/map1_over.gif";
    } else if (sPage == 10) {
    	document.images['Image1611'].src = "images/contact_over.gif";
    } 
}

function toggleStudio(){
	if (document.getElementsByName('session')[0].checked){
		document.getElementById('studio_name').disabled = false;
	} else {
		document.getElementById('studio_name').disabled = true;
	}
}

function activateDates(){
	document.getElementById('contbtn').style.display = 'none';
/*	if ( (document.getElementsByName('studio_name')[0].value == 'none') ||
		  (document.getElementById('date_picker').value == '') ){
		document.getElementById('time_start').disabled = true;
		document.getElementById('time_end').disabled = true;
	} else {
		getBookingTimes();
		document.getElementById('time_start').value = "";
		document.getElementById('time_end').value = "";
		
		document.getElementById('time_start').disabled = false;
		document.getElementById('time_end').disabled = false;
	}*/
	if ( (document.getElementsByName('studio_name')[0].value == 'none') ||
		  (document.getElementById('date_picker').value == '') ){
		document.getElementById('book_time').disabled = true;
	} else {
		var sn = document.getElementsByName('studio_name')[0].value;
		var dp = document.getElementById('date_picker').value;
		
		//getBookingTimes();
		document.getElementById('book_time').value = "";
		document.getElementById('book_time').disabled = false;
		
		var val=document.pickDate.date_picker.value;
		self.location='indexTest.php?theDay=' + val ;

	}
}

function adminActivateContinue(){
	
	if ( (document.getElementById('date_picker').value != "") && (document.getElementById('studio_name').value != "none") ){
		document.getElementById('contbtn').style.display = 'inline';
	} else {
		document.getElementById('contbtn').style.display = 'none';
	}

	var theDay = document.getElementById('date_picker').value;
	endDay = new Date( theDay.substr(-4), theDay.substr(0,2)-01, theDay.substr(3,2));
	endDay.setDate(endDay.getDate()+1);
	endDay = (endDay.getMonth() < 10?'0'+(endDay.getMonth()+1):endDay.getMonth()+1)+"-"+(endDay.getDate() < 10?'0'+endDay.getDate():endDay.getDate())+"-"+endDay.getFullYear();
	theFile = document.getElementsByName('studio_name')[0].value;
	var theSet = theFile.slice(-1);

	document.recform.theSet.value = theSet;
	document.recform.theDay.value = theDay;
    document.recform.endDay.value = endDay;
}

function activateContinue(){
	/*if ( (document.getElementById('time_start').value != "") &&
		(document.getElementById('time_end').value != "") ){
		document.getElementById('contbtn').style.display = 'inline';
	} else {
		document.getElementById('contbtn').style.display = 'none';
	}*/
	
	if ( (document.getElementById('date_picker').value != "") && (document.getElementById('studio_name').value != "none") ){
		document.getElementById('contbtn').style.display = 'inline';
	} else {
		document.getElementById('contbtn').style.display = 'none';
	}


/*	if ( (document.getElementById('book_time').value != "") ){
		document.getElementById('contbtn').style.display = 'inline';
	} else {
		document.getElementById('contbtn').style.display = 'none';
	}
*/
}

function openName(theFile) {
	window.open(theFile,'Session','width=500,height=700,scrollbars=1');
}

function openAdmin(theFile) {
	window.open(theFile,'Session','width=950,height=650,scrollbars=1');
}

function validate_regform(theForm)
{
    var valid = true;

    if ( theForm.reg_username.value == "" )
    {
        alert ( "Please fill in the 'Username' box." );
        valid = false;
		theForm.reg_username.focus();
    } else
   /* if ( theForm.reg_usernameC.value == "" )
    {
        alert ( "Please fill in the 'Confirm Email' box." );
        valid = false;
		theForm.reg_usernameC.focus();
    } else
    if ( theForm.reg_username.value != theForm.reg_usernameC.value )
    {
        alert ( "The Emails do not match, please re-enter." );
        valid = false;
		theForm.reg_username.focus();
    } else*/
	
    if ( theForm.reg_password.value == "" )
    {
        alert ( "Please fill in the 'Password' box." );
        valid = false;
		theForm.reg_password.focus();
    } else
   /* if ( theForm.reg_passwordC.value == "" )
    {
        alert ( "Please fill in the 'Confirm Password' box." );
        valid = false;
		theForm.reg_passwordC.focus();
    } else
    if ( theForm.reg_password.value != theForm.reg_passwordC.value )
    {
        alert ( "The Passwords do not match, please re-enter." );
        valid = false;
		theForm.reg_password.focus();
    } else*/

	if ( theForm.reg_group.value == "" )
    {
        alert ( "Please fill in the 'Group Name' box." );
        valid = false;
		theForm.reg_group.focus();
    } else
    if ( theForm.reg_genre.value == "" )
    {
        alert ( "Please fill in the 'Genre' box." );
        valid = false;
		theForm.reg_genre.focus();
    } else
    if ( theForm.reg_phone.value == "" )
    {
        alert ( "Please fill in the 'Phone Number' box." );
        valid = false;
		theForm.reg_phone.focus();
    } else
    if ( theForm.reg_nummem.value == "" )
    {
        alert ( "Please fill in the 'Number of Members' box." );
        valid = false;
		theForm.reg_nummem.focus();
    } else
    if ( theForm.reg_contact.value == "" )
    {
        alert ( "Please fill in the 'Primary Contact' box." );
        valid = false;
		theForm.reg_email.focus();
    }

    return valid;
}

function validate_newmemform(theForm)
{
    var valid = true;

    if ( theForm.name.value == "" )
    {
        alert ( "Please fill in the 'Name' box." );
        valid = false;
		theForm.name.focus();
    } else
    if ( theForm.email.value == "" )
    {
        alert ( "Please fill in the 'Email Address' box." );
        valid = false;
		theForm.email.focus();
    } else
    if ( theForm.phone.value == "" )
    {
        alert ( "Please fill in the 'Phone Number' box." );
        valid = false;
		theForm.phone.focus();
    }
    return valid;
}

function doAdds(e, addThis){
	if(e.checked){
		theAdds += addThis;
	} else {
		theAdds -= addThis;
	}
	var theTotal=theRate*hours+theAdds;
	document.getElementById('total_id').innerHTML = theTotal;
    document.recform.total_services.value = theTotal;
}

function doAdminAdds(e, addThis){
	var theTotal=document.getElementById('total_id').innerHTML;
	if(e.checked){
		theTotal = Number(theTotal)+addThis;
		//theAdds += addThis;
	} else {
		theTotal = Number(theTotal)-addThis;
		//theAdds -= addThis;
	}
	//alert(theAdds);
	document.getElementById('total_id').innerHTML = theTotal;
    document.recform.total_services.value = theTotal;
}


function updatePackage(theNum){
	if(theNum == 1){
		theRate = 65;
		thePackage = 'Multitrack';
	} else 
	if(theNum == 2){
		theRate = 50;
		thePackage = 'Live Multitrack';
	} else {
		theRate = 40;
		thePackage = 'VocalsS';
	}
	document.getElementById('package_id').innerHTML = thePackage;
	document.getElementById('rate_id').innerHTML = theRate;
	var theTotal=theRate*hours+theAdds;
	document.getElementById('total_id').innerHTML = theTotal;
}

function updateStudio(theNum){
	if(theNum == 1){
		theRate = 29;
		theStudio = 'A';
	} else 
	if(theNum == 2){
		theRate = 28;
		theStudio = 'B';
	} else 
	if(theNum == 3){
		theRate = 23;
		theStudio = 'C';
	} else {
		theRate = 19;
		theStudio = 'D';
	}
	document.getElementById('studio_id1').innerHTML = theStudio;
	document.getElementById('studio_id2').innerHTML = theStudio;
	document.getElementById('rate_id').innerHTML = theRate;
	var theTotal=theRate*hours+theAdds;
	document.getElementById('total_id').innerHTML = theTotal;
}

function toggleDiv(obj) {
	var rg = document.getElementById(obj);
	if ( rg.style.display != 'none' ) {
		rg.style.display = 'none';
	}else {
		rg.style.display = '';
	}
}

