dojo.addOnLoad(checkUserApprovalPendingStatus);

function checkUserApprovalPendingStatus(){
	if (dijit.byId('userRegistrationApprovalPendingStatus') == "true") {
		dijit.byId('userRegistrationApprovalPendingDialog').show();
	}
	return;	
}

function userRegistrationFormSubmit(){
    if (dijit.byId("userRegistrationForm").validate()) {
		
			//Password Validation vinoth
	//	if(passwordValidator(dijit.byId('password').getValue()) == false)  {
	//				showMessageDialogBox('User Registration', 'Length of password should be min 6 and max 10 characters which contain alphanumeric with atleast one special character (!@#$%&*)', "{width:200, height:100}");
	//	}else {
			

        if (document.userRegistrationForm.industry.selectedIndex == 0 ||
        document.userRegistrationForm.size.selectedIndex == 0 ||
        document.userRegistrationForm.country.selectedIndex == 0) {
            messageDialogBox("validationError", "Error", "Please input all mandatory fields.", '{width:200,height:100}');
            showDialogBox("validationError");
            return;
        }        
        if (dijit.byId('password').getValue() !=
        dijit.byId('confirmPassword').getValue()) {
            messageDialogBox("confirmPasswordError", "Error", "Password and Confirm Password doesn't match.", '{width:200,height:100}');
            showDialogBox("confirmPasswordError");
            return;
        }        
        if (dijit.byId("termsAndConditions").checked) {
            dijit.byId('registerButton').setDisabled(true);        	
            dijit.byId("userRegistrationForm").submit();
            return;
        }
        messageDialogBox("termsAndConditionsError", "Error", "Please accept the Terms and Conditions to register.", '{width:200,height:100}');
        showDialogBox("termsAndConditionsError");
   // }

}
}


function editUserProfileFormSubmit(){
    if (dijit.byId("userRegistrationForm").validate()) {
		
			//Password Validation vinoth
	//	if(passwordValidator(dijit.byId('password').getValue()) == false)  {
	//				showMessageDialogBox('User Registration', 'Length of password should be min 6 and max 10 characters which contain alphanumeric with atleast one special character (!@#$%&*)', "{width:200, height:100}");
	//	}else {
			

        if (document.userRegistrationForm.industry.selectedIndex == 0 ||
        document.userRegistrationForm.size.selectedIndex == 0 ) {
            messageDialogBox("validationError", "Error", "Please input all mandatory fields.", '{width:200,height:100}');
            showDialogBox("validationError");
            return;
        }        
           dijit.byId('updateButton').setDisabled(true);        
           dijit.byId("userRegistrationForm").submit();
           return;

      
   // }

}
}


function setRegisterButton(){
    if (dijit.byId('termsAndConditions').checked) {
        dijit.byId('registerButton').setDisabled(false);
    }
    else {
        dijit.byId('registerButton').setDisabled(true);
    }
}

function resetForm()
{
	dijit.byId("userRegistrationForm").reset();
	document.userRegistrationForm.industry.selectedIndex=0;
	document.userRegistrationForm.size.selectedIndex=0;
	document.userRegistrationForm.country.selectedIndex=0;
	document.userRegistrationForm.implTimeline.selectedIndex=0;	
}


function editResetForm()
{
	dijit.byId("userRegistrationForm").reset();
	dojo.byId('industry').value = dojo.byId('industryHiddenField').value;
	dojo.byId('size').value = dojo.byId('revenueHiddenField').value;
	dojo.byId('country').value = dojo.byId('countryHiddenField').value;
	dojo.byId('implTimeline').value = dojo.byId('implTimelineHiddenField').value;
}


function showTermsAndCondition() {

	dijit.byId('termsAndCondition').show();
		return;

}
function hideTermsAndCondition() {

		 dijit.byId('termsAndCondition').hide(); 
		return;

}
