function IsOnlyNumbers(str) {
	var nonums = /^[0-9]*$/;
	if (nonums.test(str))
		return true;
	else
		return false;
}

function ValidateURL( fieldName ) 
{
    var v = new RegExp();
    v.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
    //if (!v.test(form["userWebAddress"].value)) 
	if (!v.test(document["partnerRequestForm"].elements[fieldName].value)) 
	{
        return false;
    }
	return true;
}

function whitePapersValidation(thisValue)
{
	if( thisValue.firstName.value == "")
	{
		alert("Please enter your First Name.");
		thisValue.firstName.focus();
		return false;
	}

	if( thisValue.lastName.value == "")
	{
		alert("Please enter your Last Name.");
		thisValue.lastName.focus();
		return false;
	}
	
	
	if( thisValue.userCompany.value == "")
	{
		alert("Please enter Company name.");
		thisValue.userCompany.focus();
		return false;
	}
	
	if( thisValue.userAddress.value == "")
	{
		alert("Please enter your Address.");
		thisValue.userAddress.focus();
		return false;
	}
	
	if( thisValue.userCity.value == "")
	{
		alert("Please enter your City.");
		thisValue.userCity.focus();
		return false;
	}
	
	if( thisValue.userState.value == "")
	{
		alert("Please enter your State.");
		thisValue.userState.focus();
		return false;
	}	
	if( thisValue.userTelephone.value == "")
	{
		alert("Please enter your Telephone Number.");
		thisValue.userTelephone.focus();
		return false;
	}
	else
	{
		if(!ValidateUSPhone(thisValue.userTelephone.value))
		{
			alert("Please enter the correct format for phone number.e.g (111) 222-3333");
			thisValue.userTelephone.focus();
			return false;
		}
	}
	
	if( thisValue.userEmail.value == "" )
	{
		alert("Please enter your Email Address.");
		thisValue.userEmail.focus();
		return false;
	}
	else
	{
		if(!echeck(thisValue.userEmail.value))
		{
			thisValue.userEmail.focus();
			return false;
		}
	
	if( thisValue.NoOfUser.value == "")
	{
		alert("Please enter the number of active employee.");
		thisValue.NoOfUser.focus();
		return false;
	}
	else if(isNaN(thisValue.NoOfUser.value))
	{
		alert("Please enter only Numeric value for active employee.");
		thisValue.NoOfUser.focus();
		return false;
	}
	return true;
}

function ValidateUSPhone(phoneNumber) 
{
	validphone     =/^[ ]*[(]{0,1}[ ]*[0-9]{3,3}[ ]*[)]{0,1}[-]{0,1}[ ]*[0-9]{3,3}[ ]*[-]{0,1}[ ]*[0-9]{4,4}[ ]*$/;
	if (phoneNumber.match(validphone)) 
	   return true;
	else 
	   return false;
}

function getInfoSubmit(thisValue)
{
	//alert("testing is going on");return false;
	if( thisValue.firstName.value == "" )
	{
		alert("Please enter your First Name." );
		thisValue.firstName.focus();
		return false;
	}
	
	if( thisValue.lastName.value == "" )
	{
		alert("Please enter your Last Name." );
		thisValue.lastName.focus();
		return false;
	}
	
	if( thisValue.userCompany.value == "" )
	{
		alert("Please enter your Company.");
		thisValue.userCompany.focus();
		return false;
	}
		
	
	if( thisValue.userState.value == "")
	{
		alert("Please enter your State.");
		thisValue.userState.focus();
		return false;
	}
	
	
	if( thisValue.userTelephone.value == "" )
	{
		alert("Please enter your Telephone Number.");
		thisValue.userTelephone.focus();
		return false;
	}
	else
	{
		if(!ValidateUSPhone(thisValue.userTelephone.value))
		{
			alert("Please enter the correct format for phone number.e.g (111) 222-3333");
			thisValue.userTelephone.focus();
			return false;
		}
	}
	
	if( thisValue.userEmail.value == "" )
	{
		alert("Please enter your Email Address." );
		thisValue.userEmail.focus();
		return false;
	}
	else
	{
		if(!echeck(thisValue.userEmail.value))
		{
			//alert("Please check the format of email address." );
			thisValue.userEmail.focus();
			return false;
	}
	
	if( thisValue.NoOfUser.value == "")
	{
		alert("Please enter the number of active employee.");
		thisValue.NoOfUser.focus();
		return false;
	}
	else if(isNaN(thisValue.NoOfUser.value))
	{
		alert("Please enter only Numeric values.");
		thisValue.NoOfUser.focus();
		return false;
	}
		
	return true;
}

function WebinarSignUpValidataion(thisValue)
{
	if( thisValue.userName.value == "")
	{
		alert("Please enter your Name.");
		thisValue.userName.focus();
		return false;
	}
	
	if( thisValue.userCompany.value == "")
	{
		alert("Please enter your Company.");
		thisValue.userCompany.focus();
		return false;
	}
	
	if( thisValue.userState.value == "")
	{
		alert("Please enter your State.");
		thisValue.userState.focus();
		return false;
	}
		
	if( thisValue.userTelephone.value == "")
	{
		alert("Please enter your Telephone Number.");
		thisValue.userTelephone.focus();
		return false;
	}
	else
	{
		if(!ValidateUSPhone(thisValue.userTelephone.value))
		{
			alert("Please enter the correct format for phone number.e.g (111) 222-3333");
			thisValue.userTelephone.focus();
			return false;
		}
	}
	
	if( thisValue.userEmail.value == "" )
	{
		alert("Please enter your Email Address.");
		thisValue.userEmail.focus();
		return false;
	}
	else
	{
		if(!echeck(thisValue.userEmail.value))
		{
			thisValue.userEmail.focus();
			return false;
		}
	
	
	if( thisValue.NoOfUser.value == "" || thisValue.NoOfUser.value == undefined )
	{
		alert("Please enter the number of active employee.");
		thisValue.NoOfUser.focus();
		return false;
	}
	else if(isNaN(thisValue.NoOfUser.value))
	{
		alert("Please enter only Numeric value for active employee.");
		thisValue.NoOfUser.focus();
		return false;
	}

	if (!checkRadio("WebinarSignUp","webinarDayTime"))
	{
		alert("Please check atleast one webinar.");
		return false;
	}
	return true;
}

function checkRadio (frmName, rbGroupName) {
 var radios = document[frmName].elements[rbGroupName];
 for (var i=0; i <radios.length; i++) 
 {
  if (radios[i].checked) 
  {
   return true;
  }
 }
 return false;
}

function selectThis(frmName, ctrlName)
{
	//alert("Form Name::"+frmName+"Control Name::"+ctrlName);return false;
	var sourceValue = document[frmName].elements[ctrlName].options[document[frmName].elements[ctrlName].selectedIndex].value;
	//alert(sourceValue);
	if( sourceValue == 'Others' )
	{
		$('KnownOtherSpacify').disabled = false;
	}
	else
	{
		$('KnownOtherSpacify').disabled = true;
		$('KnownOtherSpacify').value = "";
	}
}


function ClientTrainingValidation(thisValue)
{
	if( thisValue.firstName.value == "")
	{
		alert("Please enter your first name.");
		thisValue.firstName.focus();
		return false;
	}
	
	if( thisValue.lastName.value == "")
	{
		alert("Please enter your last name.");
		thisValue.lastName.focus();
		return false;
	}
	
	if( thisValue.userTitle.value == "")
	{
		alert("Please enter your Title.");
		thisValue.userTitle.focus();
		return false;
	}
	
	if( thisValue.userCompany.value == "")
	{
		alert("Please enter company name.");
		thisValue.userCompany.focus();
		return false;
	}
	
	if( thisValue.userEmail.value == "" )
	{
		alert("Please enter User Email Address.");
		thisValue.userEmail.focus();
		return false;
	}
	else
	{
		if(!echeck(thisValue.userEmail.value))
		{
			thisValue.userEmail.focus();
			return false;
		}
	}
	
	if( thisValue.userTelephone.value == "")
	{
		alert("Please enter the phone number.");
		thisValue.userTelephone.focus();
		return false;
	}
	else
	{
		if(!ValidateUSPhone(thisValue.userTelephone.value))
		{
			alert("Please enter the correct format for phone number.e.g (111) 222-3333");
			thisValue.userTelephone.focus();
			return false;
		}
	}

	
	if( thisValue.userAddress.value == "")
	{
		alert("Please enter your address.");
		thisValue.userAddress.focus();
		return false;
	}

	if( thisValue.userCity.value == "")
	{
		alert("Please enter your city.");
		thisValue.userCity.focus();
		return false;
	}
	
	if( thisValue.userState.value == "")
	{
		alert("Please enter your state.");
		thisValue.userState.focus();
		return false;
	}
	
	if( thisValue.userZip.value == "")
	{
		alert("Please enter your zipcode.");
		thisValue.userZip.focus();
		return false;
	}
	
	if( thisValue.userCountry.value == "")
	{
		alert("Please enter your Country.");
		thisValue.userCountry.focus();
		return false;
	}
	return true;
}

function partnerRequestValidation(thisValue)
{
	if( thisValue.userName.value == "")
	{
		alert("Please enter your Name.");
		thisValue.userName.focus();
		return false;
	}
	
	if( thisValue.userTitle.value == "")
	{
		alert("Please enter your Title.");
		thisValue.userTitle.focus();
		return false;
	}
	
	if( thisValue.mainContact.value == "")
	{
		alert("Please enter your Contact.");
		thisValue.mainContact.focus();
		return false;
	}
	
	if( thisValue.userAddress1.value == "")
	{
		alert("Please enter Address 1.");
		thisValue.userAddress1.focus();
		return false;
	}
	
	if( thisValue.userCity.value == "")
	{
		alert("Please enter your City.");
		thisValue.userCity.focus();
		return false;
	}
	
	if( thisValue.userState.value == "")
	{
		alert("Please enter your State.");
		thisValue.userState.focus();
		return false;
	}
	
	if( thisValue.userZip.value == "")
	{
		alert("Please enter your zip.");
		thisValue.userZip.focus();
		return false;
	}
	
	
	if( thisValue.userTelephone.value == "")
	{
		alert("Please enter User Telephone Number.");
		thisValue.userTelephone.focus();
		return false;
	}
	else
	{
		if(!ValidateUSPhone(thisValue.userTelephone.value))
		{
			alert("Please enter the correct format for phone number.e.g (111) 222-3333");
			thisValue.userTelephone.focus();
			return false;
		}
	}
	
	if( thisValue.userEmail.value == "" )
	{
		alert("Please enter User Email Address.");
		thisValue.userEmail.focus();
		return false;
	}
	else
	{
		if(!echeck(thisValue.userEmail.value))
		{
			thisValue.userEmail.focus();
			return false;
		}
	}
	
	if( thisValue.userWebAddress.value == "")
	{
		alert("Please enter your web address.");
		thisValue.userWebAddress.focus();
		return false;
	}
	else if (thisValue.userWebAddress.value != "")
	{
		var is_protocol_ok = thisValue.userWebAddress.value.indexOf('http://');
		
		if (is_protocol_ok == -1)
		{ 
		  alert('Web URL should begin with http://');
		  thisValue.userWebAddress.focus();
		  return false;
		}
		if(!ValidateURL("userWebAddress"))
		{
			alert("Please enter the valid URL.");
			thisValue.userWebAddress.focus();
			return false;
		}
	}

	if (!checkRadio("partnerRequestForm", "NuViewRepresentative"))
	{
		alert("Please check for NuView Representative.");
		return false;
	}
	
	if( thisValue.CompanyStatusPublic.checked && thisValue.CompanyStatusPublicStockTicker.value == "" ) 
	{
			alert("Please enter in the state stock ticker symbol for public");
			return false;
	}
	
	if( thisValue.IE_Others.checked && thisValue.PleaseSpacifyOthers.value == "" ) 
	{
			alert("Please describe in the others.");
			return false;
	}
	
	if( thisValue.TCP_Large_Business.checked == false && thisValue.TCP_Medium_Business.checked == false && thisValue.TCP_Small_Business.checked == false )
	{
		alert("Please check atleast one checkbox for targeted customer profile.");
		return false;
	}
	
	if( thisValue.DS_ProductServices.value == ""  )
	{
		alert("Please write the overview for product/services.");
		thisValue.DS_ProductServices.focus();
		return false;
	}
	
	if( thisValue.DS_URL.value != "http://" )
	{
		if(!ValidateURL("DS_URL"))
		{
			alert("Please enter the correct URL.");	
			thisValue.DS_URL.focus();
			return false;
		}
	}
	
	if( thisValue.DS_Product_Language.value == ""  )
	{
		alert("Please indicate the lanaguage for product or service are avaialable.");
		thisValue.DS_Product_Language.focus();
		return false;
	}
	
	if( thisValue.DS_Products_OS.value == ""  )
	{
		alert("Please enter the operating system details for product or services are available.");
		thisValue.DS_Products_OS.focus();
		return false;
	}
	return true;
}

function moreInfoForm(thisValue)
{
	if( thisValue.userName.value == "")
	{
		alert("Please enter your Name.");
		thisValue.userName.focus();
		return false;
	}
	
	if( thisValue.userTitle.value == "")
	{
		alert("Please enter your Title.");
		thisValue.userTitle.focus();
		return false;
	}
	
	if( thisValue.userCompany.value == "")
	{
		alert("Please enter your Company.");
		thisValue.userCompany.focus();
		return false;
	}
	
	if( thisValue.userAddress.value == "")
	{
		alert("Please enter your Address.");
		thisValue.userAddress.focus();
		return false;
	}
	
	if( thisValue.userCity.value == "")
	{
		alert("Please enter your City.");
		thisValue.userCity.focus();
		return false;
	}
	
	if( thisValue.userState.value == "")
	{
		alert("Please enter your State.");
		thisValue.userState.focus();
		return false;
	}
	
	if( thisValue.userCountry.value == "")
	{
		alert("Please enter your Country.");
		thisValue.userCountry.focus();
		return false;
	}
	
	if( thisValue.userTelephone.value == "")
	{
		alert("Please enter your Telephone Number.");
		thisValue.userTelephone.focus();
		return false;
	}
	else
	{
		if(!ValidateUSPhone(thisValue.userTelephone.value))
		{
			alert("Please enter the correct format for phone number.e.g (111) 222-3333");
			thisValue.userTelephone.focus();
			return false;
		}
	}
	
	if( thisValue.userEmail.value == "" )
	{
		alert("Please enter your Email Address.");
		thisValue.userEmail.focus();
		return false;
	}
	else
	{
		if(!echeck(thisValue.userEmail.value))
		{
			thisValue.userEmail.focus();
			return false;
		}
	}
	
	var sourceValue = thisValue.HearAboutUs.options[thisValue.HearAboutUs.selectedIndex].value;
	
	if(sourceValue == "")
	{
		alert("Please select the Source where from you know about it.");	
		thisValue.HearAboutUs.focus();
		return false;
	}

	var sourceValue = thisValue.areaOfInterest.options[thisValue.areaOfInterest.selectedIndex].value;
	
	if(sourceValue == "")
	{
		alert("Please select the Area of Information.");	
		thisValue.areaOfInterest.focus();
		return false;
	}


	if( thisValue.NoOfUser.value == "" || thisValue.NoOfUser.value == undefined )
	{
		alert("Please enter the number of active employee.");
		thisValue.NoOfUser.focus();
		return false;
	}
	else if(isNaN(thisValue.NoOfUser.value))
	{
		alert("Please enter only Numeric value for active employee.");
		thisValue.NoOfUser.focus();
		return false;
	}
	return true;
}



