// JavaScript Document
function rotateImages(){	
	var currentPhoto = $("#header div.current");
	var nextPhoto = currentPhoto.next();
	if(nextPhoto.length == 0) nextPhoto=$("#header div:first");
	currentPhoto.removeClass('current').addClass('previous');
	nextPhoto.removeClass('previous').addClass('current');
}
function checkform(){
	var urlProtocol = /^http:/;
	if(document.getElementById('url') && document.getElementById('url').value !== ""){
		var url = document.getElementById('url');
		if (!urlProtocol.test(url.value)){
			window.alert("You must include http:// in the url.");
			return false;
		}
	} else if(document.getElementById('must') && document.getElementById('must').value == ""){
		window.alert("You must enter a name for the venue or band");
		return false;
	}else if(document.getElementById('showDate') && document.getElementById('showDate').value == ""){
		window.alert("You must enter the show date.");
		return false;
	}else if(document.getElementById('showTime') && document.getElementById('showTime').value == ""){
		window.alert("You must enter the show time.");
		return false;
	}else if(document.getElementsByName('showDay')){
		var showDaychecked = false;
		for (var i=0; i<7; ++i){
		 if(document.getElementsByName('showDay')[i].checked == true){
			showDaychecked = true;
			break;
		 }
		}
		if(showDaychecked == false){ 
			window.alert("You must enter the show day.");
			return false;
		}	
	} else {
		return true;
	}
	
/*	if (document.getElementById('must').value == ""){
		window.alert("You must enter a name for the venue or band");
		return false;
	} else if (document.getElementById('showDate')){
		if (document.getElementById('showDate').value == ""){
			window.alert("You must enter a show date.");
			return false;
		}
	} else if (document.getElementById('showTime')){
		if (document.getElementById('showTime').value == ""){
			window.alert("You must enter a show time.");
			return false;
		}
	} */ 
	
}
function onSubmitForm(){
  if(document.pressed == 'edit')
  {
   document.editshow.action ="../editshow/";
  }
  else if(document.pressed == 'delete')
  {
    document.editshow.action ="../deleteshow/";
  }
  return true;
}
