function checkFormSignIn(){
	if(!validate({id:"Username"})) return false;
	if(!validate({id:"Password"})) return false;
	return true;
}

function checkFormNewAccount(){
	if(!validate({id:"new_Username",type:"email"})) return false;
	if(!validate({id:"new_Password"})) return false;
	if(!validate({id:"conf_password",type:"compare",id2:"new_Password"})) return false;		
	if(!validate({id:"Event_Location"})) return false;		
	if(!validate({id:"InterestedIn"})) return false;		
	//if(!validate({id:"month"})) return false;
	//if(!validate({id:"day"})) return false;	
	//if(!validate({id:"year"})) return false;
	
	return true;
}


function checkFormForgotPW(){
	if(!validate({id:"Username"})) return false;
	return true;
}

var begindatearr = new Array('1999-01-01');
var enddatearr = new Array('2007-12-31');

function checkAvailableDate(){
	var year = _$('year').value;
	var month = _$('month').value;
	var dayObj = _$('day');	
	var day = dayObj.value;
	var roof = month < 8 ? ( month % 2 == 0 ? ( month == 2 ?(year%4==0 ? (29):(28)):(30)):(31)):( month % 2 == 0 ? 31 : 30 );
	var l = dayObj.length;
	for( var i = 27; i < 31; i++ ){
		if( i < roof && dayObj.options[ i ] == null ){
		   dayObj.options[ i ]= new Option( i + 1, i + 1 );
		}
		if( i >= roof && dayObj.options[ i ] != null ){
		  if( dayObj.selectedIndex > ( roof - 1 ) ){
			  dayObj.selectedIndex = roof - 1;        
		  }
		  dayObj.options[ i ] = null;
		  i--;
		}
	}
	
	var obj = year + "-" + month + "-" + day;
	
	_$('checking_found').style.display = 'none';
	
	if( year.length > 0 && month.length > 0 && day.length > 0 ){
		if ( _$('twenty').value > obj ){
			 alert("Sorry! Your wedding date is no longer available.");
			 _$('datealert').style.display = '';
			 _$('cont').disabled = true;
			 return;
		}else{
			var allow = 1;
			for ( var i = 0; i < begindatearr.length; i++){
				if( begindatearr[ i ] <= obj && enddatearr[ i ] >= obj){
					allow = 0;
					break;
				}
			}
			if( allow == 1 ){
				 _$('datealert').style.display = 'none';
			 	 _$('cont').disabled = false;
			}else{
				alert("Sorry! Your wedding date is no longer available.");
				_$('datealert').style.display='';
				_$('cont').disabled = true;
				return;
			}
		}
		ShowCheckingAvailability();
	}
}

function HideCheckingAvailability(){
	_$('checking').style.display = 'none';
	_$('checking_found').style.display = '';
}

function ShowCheckingAvailability(){
	_$('checking').style.display = '';
	_$('checking_found').style.display = 'none';
	setTimeout( "HideCheckingAvailability()", 10000 ); 
}