/**
 * Add Account Module JS Files
 * @author Pathfinder Solutions India
 * @link http://www.pathfindersolutions.biz
 * @version 1.0
 * @package MyImpact2
 * @subpackage Registration
 */
/**
 * Validate Input
 * fnValidateInput function
 * @param 
 * @return bool true or false
 */
	function fnValidateInput()
	{
		var strErrorMessage = "";
			if(document.getElementById('txtUserName').value == "")
			{
				strErrorMessage = strErrorMessage + "# Enter Account Name. \n";
			}
			else
			{
				var strUserName = document.getElementById('txtUserName').value;
				if (strUserName.length < 6 || strUserName.length > 50)
				{
					strErrorMessage = strErrorMessage + "# User name should be greater than 6 and less than 50 characters. \n";
				}
			}
			
			if(document.getElementById('txtUserPassword').value == "")
			{
				strErrorMessage = strErrorMessage + "# Enter Password For Account. \n";
			}
			else
			{
				if (document.getElementById('txtUserPassword').value.length < 4)
				{
					strErrorMessage = strErrorMessage + "# User password should be greater than 4 digits. \n";
				}
			}

			if(document.getElementById('txtEmail').value == "")
			{
				strErrorMessage = strErrorMessage + "# Enter Email Id. \n";
			}
			else
			{
				var str=document.getElementById('txtEmail').value
				var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
				if (filter.test(str))
				{
					strErrorMessage = strErrorMessage + "";
				}
				else
				{
					strErrorMessage = strErrorMessage + "# Please input a valid email address!. \n";
				}
			}

			if(document.getElementById('txtfullName').value == "")
			{
				strErrorMessage = strErrorMessage + "# Enter Full Name. \n";
			}
			
			if ( document.frmRegistration.selectScope.selectedIndex == 0 )
		    {
		        strErrorMessage = strErrorMessage + "# Select Program For which you are applying. \n";
		    }
			
			if ( document.frmRegistration.selectCountry.selectedIndex == 0 )
		    {
		        strErrorMessage = strErrorMessage + "# Select Country. \n";
		    }
			
			var strGetScope=document.frmRegistration.txtScope.value;
			var strGetCountry=document.frmRegistration.txtCountry.value;
			if(strGetScope == "National" && strGetCountry.toLowerCase() == 'mexico')
			{
				//if ( document.frmRegistration.selectCity.selectedIndex == 0 )
				if ( document.frmRegistration.selectArea.selectedIndex == 0 )
				{
					strErrorMessage = strErrorMessage + "# Select City. \n";
				}
			}
			else
			{
				if ( document.frmRegistration.selectArea.selectedIndex == 0 )
				{
					strErrorMessage = strErrorMessage + "# Select Area. \n";
				}
			}
			
			if ( document.frmRegistration.selectRegion.selectedIndex == 0 )
		    {
		        strErrorMessage = strErrorMessage + "# Select Region. \n";
		    }
			if( document.getElementById('id_seccheck').value == "" )		
				strErrorMessage += "# Enter text from Image above.\n";
			
			if(strErrorMessage == "")
			{
				return true;
			}
			else
			{
				alert(strErrorMessage);
				return false;
			}

		}
		
function reload1(form)
{
	var strName=document.frmRegistration.txtUserName.value ;
	var strPass=document.frmRegistration.txtUserPassword.value ;
	var strFullName=document.frmRegistration.txtfullName.value ;
	var strEmail=document.frmRegistration.txtEmail.value ;
	var strScope=form.selectScope.options[form.selectScope.options.selectedIndex].value; 
	//var strType=form.selectType.options[form.selectType.options.selectedIndex].value; 
	
	var strGetScope=document.frmRegistration.txtScope.value;
	var strGetCountry=document.frmRegistration.txtCountry.value ;
	
	var val=form.selectArea.options[form.selectArea.options.selectedIndex].value; 
	if(strGetScope == "International")
	self.location='index.php?fuse=registration&area=' + val + '&getName=' + strName + '&getPassword=' + strPass + '&getfullName=' + strFullName + '&getEmail=' + strEmail + '&getselectScope=' + strScope ;
	
	if(strGetScope == "National")
	self.location='index.php?fuse=registration&scope='+strGetScope+'&name='+strGetCountry+'&area=' + val + '&getName=' + strName + '&getPassword=' + strPass + '&getfullName=' + strFullName + '&getEmail=' + strEmail + '&getselectScope=' + strScope ;
}

function reload3(form)
{
	var strGetScope=document.frmRegistration.txtScope.value ;
	var strGetCountry=document.frmRegistration.txtCountry.value;

	var strName=document.frmRegistration.txtUserName.value ;
	var strPass=document.frmRegistration.txtUserPassword.value ;
	var strFullName=document.frmRegistration.txtfullName.value ;
	var strEmail=document.frmRegistration.txtEmail.value ;
	var strScope=form.selectScope.options[form.selectScope.options.selectedIndex].value; 
	//var strType=form.selectType.options[form.selectType.options.selectedIndex].value; 
	
	if (strGetCountry.toLowerCase() == 'mexico')
		var val = ""; 
	else
		var val = form.selectArea.options[form.selectArea.options.selectedIndex].value; 
	
	if (strGetCountry.toLowerCase() != 'mexico')
		var val2=form.selectCountry.options[form.selectCountry.options.selectedIndex].value; 

	if(strGetScope == "International")
		self.location='index.php?fuse=registration&area=' + val + '&country=' + val2 + '&getName=' + strName + '&getPassword=' + strPass + '&getfullName=' + strFullName + '&getEmail=' + strEmail + '&getselectScope=' + strScope ;
	
	if(strGetScope == "National")
	{
		if(strGetCountry.toLowerCase() != 'mexico')
			self.location='index.php?fuse=registration&scope='+strGetScope+'&name='+strGetCountry+'&area=' + val + '&country=' + val2 + '&getName=' + strName + '&getPassword=' + strPass + '&getfullName=' + strFullName + '&getEmail=' + strEmail + '&getselectScope=' + strScope ;
		else
			self.location='index.php?fuse=registration&scope='+strGetScope+'&name='+strGetCountry+'&country=' + val2 + '&getName=' + strName + '&getPassword=' + strPass + '&getfullName=' + strFullName + '&getEmail=' + strEmail + '&getselectScope=' + strScope ;
	}
}
function fnReloadCity(form)
{
	var strGetScope=document.frmRegistration.txtScope.value;
	var strGetCountry=document.frmRegistration.txtCountry.value;

	var strName=document.frmRegistration.txtUserName.value;
	var strPass=document.frmRegistration.txtUserPassword.value;
	var strFullName=document.frmRegistration.txtfullName.value;
	var strEmail=document.frmRegistration.txtEmail.value;
	var strScope=form.selectScope.options[form.selectScope.options.selectedIndex].value; 
	//var strRegion=form.selectRegion.options[form.selectRegion.options.selectedIndex].value; 
	var strRegion=document.getElementById('selectRegion').value; 

	if (strGetCountry.toLowerCase() != 'mexico')
	{
		var val=form.selectArea.options[form.selectArea.options.selectedIndex].value; 
		var val2=form.selectCountry.options[form.selectCountry.options.selectedIndex].value; 
	}
	if(strGetScope == "International")
	self.location='index.php?fuse=registration&area=' + val + '&country=' + val2 + '&getName=' + strName + '&getPassword=' + strPass + '&getfullName=' + strFullName + '&getEmail=' + strEmail + '&getselectScope=' + strScope ;
	
	if(strGetScope == "National" && strGetCountry.toLowerCase() != 'mexico')
		self.location='index.php?fuse=registration&scope='+strGetScope+'&name='+ strGetCountry + '&country=' + val2 + '&getName=' + strName + '&getPassword=' + strPass + '&getfullName=' + strFullName + '&getEmail=' + strEmail + '&getselectScope=' + strScope + '&getRegion=' + strRegion;
	else
		self.location='index.php?fuse=registration&scope='+strGetScope+'&name='+strGetCountry+'&area=' + val + '&country=' + val2 + '&getName=' + strName + '&getPassword=' + strPass + '&getfullName=' + strFullName + '&getEmail=' + strEmail + '&getselectScope=' + strScope + '&getRegion=' + strRegion;
}
