function validateRegister()
{
	if(trimString(document.getElementById('RegistrationFldUserEmail').value)=='')
	{
		alert("Please Enter Your Email Id!");
		document.getElementById('RegistrationFldUserEmail').focus();
		return false;
	}else{
		if(!emailCheck(trimString(document.getElementById('RegistrationFldUserEmail').value))){
		alert("Email Id is not valid, please enter your valid Email Id!");
		document.getElementById('RegistrationFldUserEmail').focus();
		return false;
		}
	}
	
	if(trimString(document.getElementById('RegistrationFldConfirmEmail').value)!=trimString(document.getElementById('RegistrationFldUserEmail').value))
	{
		alert("Please Re-enter Same Email Id!");
		document.getElementById('RegistrationFldConfirmEmail').focus();
		return false;
	}
	
	
	if(trimString(document.getElementById('RegistrationFldUserPassword').value)=='')
	{
		alert("Please Enter Your Password!");
		document.getElementById('RegistrationFldUserPassword').focus();
		return false;
	}else{
		if(document.getElementById('RegistrationFldUserPassword').value.length < 6){
           alert("Password should be more then 5 characters!");
           document.getElementById('RegistrationFldUserPassword').focus();
		   return false;
		}
	}
	
	if(trimString(document.getElementById('RegistrationFldConfirmPassword').value)!=trimString(document.getElementById('RegistrationFldUserPassword').value))
	{
		alert("Please Re-enter Same Password!");
		document.getElementById('RegistrationFldConfirmPassword').focus();
		return false;
	}
	
	if(trimString(document.getElementById('RegistrationFldUserName').value)=='')
	{
		alert("Please Enter Your Nick Name!");
		document.getElementById('RegistrationFldUserName').focus();
		return false;
	}
	else{
		if(hasSpecialCharaters(document.getElementById('RegistrationFldUserName').value)){
			alert("Please Enter Your Valid Nick Name!");
			document.getElementById('RegistrationFldUserName').focus();
		    return false;
		}
    }
    
    if(trimString(document.getElementById('RegistrationFldFname').value)=='')
	{
		alert("Please Enter Your First Name!");
		document.getElementById('RegistrationFldFname').focus();
		return false;
	}
	
     if(trimString(document.getElementById('RegistrationFldLname').value)=='')
	{
		alert("Please Enter Your Last Name!");
		document.getElementById('RegistrationFldLname').focus();
		return false;
	}
	
    
     if(trimString(document.getElementById('RegistrationFldPreferName').value)=='')
	{
		alert("Please Select What to show in public?");
		document.getElementById('RegistrationFldPreferName').focus();
		return false;
	}
	
    
}   
function validateRegisterProvider()
{
	if(trimString(document.getElementById('RegistrationFldUserEmail').value)=='')
	{
		alert("Please Enter Your Email Id!");
		document.getElementById('RegistrationFldUserEmail').focus();
		return false;
	}else{
		if(!emailCheck(trimString(document.getElementById('RegistrationFldUserEmail').value))){
		alert("Email Id is not valid, please enter your valid Email Id!");
		document.getElementById('RegistrationFldUserEmail').focus();
		return false;
		}
	}
	
	if(trimString(document.getElementById('RegistrationFldConfirmEmail').value)!=trimString(document.getElementById('RegistrationFldUserEmail').value))
	{
		alert("Please Re-enter Same Email Id!");
		document.getElementById('RegistrationFldConfirmEmail').focus();
		return false;
	}
	
	
	if(trimString(document.getElementById('RegistrationFldUserPassword').value)=='')
	{
		alert("Please Enter Your Password!");
		document.getElementById('RegistrationFldUserPassword').focus();
		return false;
	}else{
		if(document.getElementById('RegistrationFldUserPassword').value.length < 6){
           alert("Password should be more then 5 characters!");
           document.getElementById('RegistrationFldUserPassword').focus();
		   return false;
		}
	}
	
	if(trimString(document.getElementById('RegistrationFldConfirmPassword').value)!=trimString(document.getElementById('RegistrationFldUserPassword').value))
	{
		alert("Please Re-enter Same Password!");
		document.getElementById('RegistrationFldConfirmPassword').focus();
		return false;
	}
	
	if(trimString(document.getElementById('RegistrationFldScreenName').value)=='')
	{
		alert("Please Enter Your Screen Name!");
		document.getElementById('RegistrationFldScreenName').focus();
		return false;
	}
	
	if(trimString(document.getElementById('RegistrationFldDob').value)!=''){
	var dateformat = /^\d{4}\-\d{2}\-\d{2}$/; 

		if(!dateformat.test(document.getElementById('RegistrationFldDob').value)){
			alert("Please Enter Your Date of Birth like (yyyy-mm-dd)!");
			document.getElementById('RegistrationFldDob').focus();
		    return false;
		}
    }
    
}      

function valRegister()
{
	
	if(trimString(document.getElementById('RegistrationFldUserName').value)=='')
	{
		alert("Please Enter Username!");
		document.getElementById('RegistrationFldUserName').focus();
		return false;
	}
	else{
	    if(hasWhiteSpace(document.getElementById('RegistrationFldUserName').value)){
			alert("No space allowed in Username!");
			document.getElementById('RegistrationFldUserName').focus();
		    return false;
		}
   	else if(hasSpecialCharaters(document.getElementById('RegistrationFldUserName').value)){
			alert("Please Enter Valid Username!");
			document.getElementById('RegistrationFldUserName').focus();
		    return false;
		}
   }	
		
   if(trimString(document.getElementById('RegistrationFldUserPassword').value)=='')
	{
		alert("Please Enter Password!");
		document.getElementById('RegistrationFldUserPassword').focus();
		return false;
	}else{
		if(document.getElementById('RegistrationFldUserPassword').value.length < 6){
           alert("Password should be more then 5 characters!");
           document.getElementById('RegistrationFldUserPassword').focus();
		   return false;
		}
	}
	
	if(trimString(document.getElementById('RegistrationFldConfirmPassword').value)!=trimString(document.getElementById('RegistrationFldUserPassword').value))
	{
		alert("Please Re-enter Same Password!");
		document.getElementById('RegistrationFldConfirmPassword').focus();
		return false;
	}
	
	
	
	if(trimString(document.getElementById('RegistrationFldUserEmail').value)=='')
	{
		alert("Please Enter Email Id!");
		document.getElementById('RegistrationFldUserEmail').focus();
		return false;
	}else{
		if(!emailCheck(trimString(document.getElementById('RegistrationFldUserEmail').value))){
		alert("Email Id is not valid, please enter valid Email Id!");
		document.getElementById('RegistrationFldUserEmail').focus();
		return false;
		}
	}
	
	if(trimString(document.getElementById('RegistrationFldAddress').value)=='')
	{
		alert("Please Enter Address!");
		document.getElementById('RegistrationFldAddress').focus();
		return false;
	}
	
	if(trimString(document.getElementById('RegistrationFldCountry').value)=='')
	{
		alert("Please Enter Location!");
		document.getElementById('RegistrationFldCountry').focus();
		return false;
	}
	
	if(trimString(document.getElementById('RegistrationFldZipCode').value)=='')
	{
		alert("Please Enter Zip Code!");
		document.getElementById('RegistrationFldZipCode').focus();
		return false;
	}
	

    
}   


function validateUser()
{
	
	
	if(trimString(document.getElementById('RegistrationFldUserName').value)=='')
	{
		alert("Please Enter Your Username!");
		document.getElementById('RegistrationFldUserName').focus();
		return false;
	}
	else{
		if(hasWhiteSpace(document.getElementById('RegistrationFldUserName').value)){
			alert("No space allowed in Username!");
			document.getElementById('RegistrationFldUserName').focus();
		    return false;
		}
   	   else if(hasSpecialCharaters(document.getElementById('RegistrationFldUserName').value)){
			alert("Please Enter Your Valid Username!");
			document.getElementById('RegistrationFldUserName').focus();
		    return false;
		}
    }
    
	if(trimString(document.getElementById('RegistrationFldUserPassword').value)=='')
	{
		alert("Please Enter Your Password!");
		document.getElementById('RegistrationFldUserPassword').focus();
		return false;
	}else{
		if(document.getElementById('RegistrationFldUserPassword').value.length < 6){
           alert("Password should be more then 5 characters!");
           document.getElementById('RegistrationFldUserPassword').focus();
		   return false;
		}
	}
	
    if(trimString(document.getElementById('RegistrationFldConfirmPassword').value)!=trimString(document.getElementById('RegistrationFldUserPassword').value))
	{
		alert("Please Re-enter Same Password!");
		document.getElementById('RegistrationFldConfirmPassword').focus();
		return false;
	}
	
	if(trimString(document.getElementById('RegistrationFldUserEmail').value)=='')
	{
		alert("Please Enter Your Email Id!");
		document.getElementById('RegistrationFldUserEmail').focus();
		return false;
	}else{
		if(!emailCheck(trimString(document.getElementById('RegistrationFldUserEmail').value))){
		alert("Email Id is not valid, please enter your valid Email Id!");
		document.getElementById('RegistrationFldUserEmail').focus();
		return false;
		}
	}
	
	
if(trimString(document.getElementById('RegistrationFldFname').value)=='')
	{
		alert("Please Enter Your First Name!");
		document.getElementById('RegistrationFldFname').focus();
		return false;
	}
	
	
	
if(trimString(document.getElementById('RegistrationFldLname').value)=='')
	{
	alert("Please Enter Your Last Name!");
	document.getElementById('RegistrationFldLname').focus();
	return false;
	}
}



function validateLogin()
{
	if(trimString(document.getElementById('LoginLoginname').value)=='')
	{
		alert("Please Enter Username!");
		document.getElementById('LoginLoginname').focus();
		return false;
	}
	
	if(trimString(document.getElementById('LoginLoginpassword').value)=='')
	{
		alert("Please Enter Password!");
		document.getElementById('LoginLoginpassword').focus();
		return false;
	}else{
		if(document.getElementById('LoginLoginpassword').value.length < 6){
           alert("Password should be more then 5 characters!");
           document.getElementById('LoginLoginpassword').focus();
		   return false;
		}
	}
}	

function validateWelcomeLogin()
{
	if(trimString(document.getElementById('LoginLoginname').value)=='')
	{
		alert("Please Enter Username!");
		document.getElementById('LoginLoginname').focus();
		return false;
	}
	
	if(trimString(document.getElementById('LoginLoginpassword').value)=='')
	{
		alert("Please Enter Password!");
		document.getElementById('LoginLoginpassword').focus();
		return false;
	}
}	

function validateForgot()
{
	if(trimString(document.getElementById('LoginForname').value)=='')
	{
		alert("Please Enter Username!");
		document.getElementById('LoginForname').focus();
		return false;
	}
	
}	




function validateCode()
{
	if(trimString(document.getElementById('RegistrationFldRegcode').value)=='')
	{
		alert("Please Enter Invitation Code!");
		document.getElementById('RegistrationFldRegcode').focus();
		return false;
	}
	else{
		if(hasSpecialCharaters(document.getElementById('RegistrationFldRegcode').value)){
			alert("Please Enter Valid Invitation Code!");
			document.getElementById('RegistrationFldRegcode').focus();
		    return false;
		}
	}
			
}

function validateOffer()
{
	if(trimString(document.getElementById('SpecialFldTitle').value)=='')
	{
		alert("Please enter title!");
		document.getElementById('SpecialFldTitle').focus();
		return false;
	}
		
	if(trimString(document.getElementById('SpecialFldImage').value)=='')
	{
		alert("Please select image!");
		document.getElementById('SpecialFldImage').focus();
		return false;
	}
	
	if(trimString(document.getElementById('SpecialFldImage').value)!='')
	 {
        var prodext  = document.getElementById('SpecialFldImage').value;
		var prodext2 = document.getElementById('SpecialFldImage').value;
		prodext = prodext.substring(prodext.length-3,prodext.length);
		prodext2 = prodext2.substring(prodext2.length-4,prodext2.length);
		prodext = prodext.toLowerCase();
		prodext2 = prodext2.toLowerCase();
		if((prodext != 'jpg') && (prodext != 'gif') &&  (prodext != 'png') && (prodext2 != 'jpeg')){
		alert("Please select .jpg or .gif or .png image only!");
		document.getElementById('SpecialFldImage').focus();
	    return false;
		}
	 }
	
	if(trimString(document.getElementById('SpecialFldDesp').value)=='')
	{
		alert("Please enter description!");
		document.getElementById('SpecialFldDesp').focus();
		return false;
	}
			
}

function valService(fieldValue)
{
	/*if (fieldValue == "" || fieldValue == null) {
    document.getElementById('RegistrationButtonID').value = 'next';
    }
    else
    */
	
    if (fieldValue == "1") {
    document.getElementById('RegistrationButtonID').value = 'submit';
    }
    else if (fieldValue == "2") {
    document.getElementById('RegistrationButtonID').value = 'next';
    }

	if(trimString(document.getElementById('Step1ServiceDurationFrom').value)=='' || trimString(document.getElementById('Step1ServiceDurationFrom').value)=='Start Date' || trimString(document.getElementById('Step1ServiceDurationTo').value)=='' || trimString(document.getElementById('Step1ServiceDurationTo').value)=='End Date')
	{
		alert("Please Select Start Date and End Date from Calender!");
		document.getElementById('Step1ServiceDurationFrom').focus();
		return false;
	}
	else {
	if(trimString(document.getElementById('Step1ServiceDurationFrom').value)!=''){
	var dateformat = /^\d{4}\-\d{2}\-\d{2}$/; 

		if(!dateformat.test(document.getElementById('Step1ServiceDurationFrom').value)){
			alert("Please Select Start Date from Calender or Enter Start Date like (yyyy-mm-dd)!");
			document.getElementById('Step1ServiceDurationFrom').focus();
		    return false;
		}
    }
    if(trimString(document.getElementById('Step1ServiceDurationTo').value)!=''){
	var dateformat = /^\d{4}\-\d{2}\-\d{2}$/; 

		if(!dateformat.test(document.getElementById('Step1ServiceDurationTo').value)){
			alert("Please Select End Date from Calender or Enter End Date like (yyyy-mm-dd)!");
			//document.getElementById('Step1ServiceDurationTo').focus();
		    return false;
		}
    }
	}
	
    var currentTime = new Date();
	var dtCh= "/";
    var minYear=1900;
    var maxYear=2100;
    var daysInMonth = DaysArray(12);
    
	var event_dtoday_date_year  =  currentTime.getFullYear();
	var event_dtoday_date_month =  currentTime.getMonth() + 1;
	var event_dtoday_date_day   =  currentTime.getDate();
	
	var event_start_date = trimString(document.getElementById('Step1ServiceDurationFrom').value);
	
	var event_dtart_date_year  =  event_start_date.substring(0,4);
	var event_dtart_date_month =  event_start_date.substring(5,7);
	var event_dtart_date_day   =  event_start_date.substring(8,10);
	
	var event_end_date = trimString(document.getElementById('Step1ServiceDurationTo').value);
	
	var event_end_date_year  =  event_end_date.substring(0,4);
	var event_end_date_month =  event_end_date.substring(5,7);
	var event_end_date_day   =  event_end_date.substring(8,10);
	
	var cc_totay_date = new Date(event_dtoday_date_year,event_dtoday_date_month,event_dtoday_date_day,0,0,0,0);
	
	var cc_start_date = new Date(event_dtart_date_year,event_dtart_date_month,event_dtart_date_day,0,0,0,0);
		
	var cc_end_date = new Date(event_end_date_year,event_end_date_month,event_end_date_day,0,0,0,0); 
	
	month=parseInt(event_dtart_date_month);
	day=parseInt(event_dtart_date_day);
	year=parseInt(event_dtart_date_year);
	
	if (event_dtart_date_year.length != 4 || year==0 || year<minYear || year>maxYear){
		alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear+" in Start date");
		document.getElementById('Step1ServiceDurationFrom').focus();
		return false
	}
	
	if (event_dtart_date_month.length<2 || month>12){
		//alert(event_dtart_date_month);
		alert("Please enter a valid month in Start date");
		document.getElementById('Step1ServiceDurationFrom').focus();
		return false
	}
	
	if (event_dtart_date_day.length<2 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		alert("Please enter a valid day in Start date");
		document.getElementById('Step1ServiceDurationFrom').focus();
		return false
	}
	
	
	if(cc_start_date < cc_totay_date){
		alert("Start date should not be less than today date!");
		document.getElementById('Step1ServiceDurationFrom').focus();
		return false;
	}
	
	month1=parseInt(event_end_date_month);
	day1=parseInt(event_end_date_day);
	year1=parseInt(event_end_date_year);
	
	if (event_end_date_year.length != 4 || year1==0 || year1<minYear || year1>maxYear){
		alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear+" in End date");
		document.getElementById('Step1ServiceDurationFrom').focus();
		return false
	}
	
	if (event_end_date_month.length<2 || month1>12){
		alert("Please enter a valid month in End date");
		document.getElementById('Step1ServiceDurationFrom').focus();
		return false
	}
	
	if (event_end_date_day.length<2 || day1>31 || (month1==2 && day1>daysInFebruary(year1)) || day1 > daysInMonth[month1]){
		alert("Please enter a valid day in End date");
		document.getElementById('Step1ServiceDurationFrom').focus();
		return false
	}
	
	
	if(cc_end_date < cc_start_date){
		alert("End Date should not be less than start date!");
		document.getElementById('Step1ServiceDurationFrom').focus();
		return false;
	}
			
	if(trimString(document.getElementById('Step1ServicePrice').value)=='' || trimString(document.getElementById('Step1ServicePrice').value)=='Price')
	 {
		alert("Please Enter Service Price!");
		document.getElementById('Step1ServicePrice').focus();
		return false;
	 }else{
	 if(!isDecimal(document.getElementById('Step1ServicePrice').value)){
			alert("Enter Valid Service Price!");
			document.getElementById('Step1ServicePrice').focus();
		    return false;
		}
	 }
	
     if(trimString(document.getElementById('Step1ServiceQuantity').value)=='' || trimString(document.getElementById('Step1ServiceQuantity').value)=='Quantity')
	   {
		alert("Please Enter Service Quantity!");
		document.getElementById('Step1ServiceQuantity').focus();
		return false;
	  }else{
	 if(!isNumeric(document.getElementById('Step1ServiceQuantity').value)){
			alert("Enter Valid Service Quantity!");
			document.getElementById('Step1ServiceQuantity').focus();
		    return false;
		}
	}
	
	if(trimString(document.getElementById('Step1ServiceDescription').value)=='' || trimString(document.getElementById('Step1ServiceDescription').value)=='Description')
	{
		alert("Please Enter Service Description!");
		document.getElementById('Step1ServiceDescription').focus();
		return false;
	}
	
	
	
	return true;
	
}

function valPhoto(fieldValue)
{
	
	if (fieldValue == "1") {
    document.getElementById('RegistrationButtonID').value = 'submit';
    }
    else if (fieldValue == "2") {
    document.getElementById('RegistrationButtonID').value = 'next';
    }
     
    if(trimString(document.getElementById('UserservicesLocation').value)=='')
	{
		alert("Please enter location!");
		document.getElementById('a2').style.display='none';
		document.getElementById('a1').style.display='block';
		document.getElementById('Step2Location').focus();
		return false;
	}
	
	if(trimString(document.getElementById('Step1FldFacility').value)=='')
	{
		alert("Please select facility icons!");
		document.getElementById('a1').style.display='none';
		document.getElementById('a2').style.display='block';
		//document.getElementById('Step2FldFacility').focus();
		return false;
	}
		
}


function valRequest()
{
	if(trimString(document.getElementById('RegistrationFldText').value)=='')
	{
		alert("Please Enter Message!");
		document.getElementById('RegistrationFldText').focus();
		return false;
	}
	
	
}
