function submitForm(target)
{
	document.forms[0].submit();
}
function validateContact() 
{
//namePat=/[^a-zA-Z\\s]/;
namePat=/[^a-zA-Z\\s]/;
emailPat=/(^[a-z0-9_\.-]+@([a-z0-9]+(\-*[a-z0-9]+)*\.)+[a-z]{2,}$)/;
phonePat=/^[0-9]{3}-[0-9]{3}-[0-9]{4}$/;

	var error ='no';
	var nameTmp  = trimAll(formmail.nameTxt.value);
	var emailTmp = trimAll(formmail.emailTxt.value);
	var phoneTmp = trimAll(formmail.phoneTxt.value);
	var subjectTxtTmp = trimAll(formmail.subjectTxt.value);
	var feedbackTxtATmp = trimAll(formmail.feedbackTxtA.value);
	var showErrorStr = '';
	//alert('Entered Validate');
	//Start  -- Pattern validation for name
	if (nameTmp == '' )
	{
		showErrorStr = 'Name is required \n\n'
		error ='yes';
	}
	else
	{
		//Start  -- Pattern validation for name
		if (namePat.test(nameTmp))
		{
			showErrorStr = showErrorStr + 'Name can have alphabets only \nNo numbers or special characters allowed \n'+nameTmp+' ?\n\n';;
			error ='yes';
		}
		//End  -- Pattern validation for name
	}
	if (emailTmp == '' )
	{
		showErrorStr = showErrorStr + 'Email is required \n\n';
		error ='yes';
	}
	else
	{
		//Start  -- Pattern validation for email
		if (! emailPat.test(emailTmp))
		{ 
			showErrorStr = showErrorStr + 'Email doesnot appear to be in the right format\n' +emailTmp+' ?\n\n';
			error ='yes';
		}
		//End  -- Pattern validation for email
	}
	
	if (phoneTmp != '' )
	{
		//Start  -- Pattern validation for phone
		if (! phonePat.test(phoneTmp))
		{ 
			showErrorStr = showErrorStr + 'Phone doesnot appear to be in the right format\n' +phoneTmp+' ?\n\n';
			error ='yes';
		}
		//End  -- Pattern validation for phone
	}

	if (subjectTxtTmp == '' )
	{
		showErrorStr = showErrorStr + 'Subject is required \n\n';
		error ='yes';
	}
	
	if (feedbackTxtATmp == '' )
	{
		showErrorStr = showErrorStr + 'Feedback text is required \n\n';
		error ='yes';
	}
	
	if	(error == 'no')
	{
		submitForm();
	}
	else
	{
		alert(showErrorStr);
	}
	//End  -- Pattern validation for email
}
function validateRequirement() 
{
namePat=/[^a-zA-Z\s]/;
projLocationPat=/[^a-zA-Z0-9\s\/\-\,\.]/;
projDurationPat=/[^a-zA-Z0-9\s\-\+]/;
projRatePat=/[^a-zA-Z0-9\s\.\$\/\-]/;
datePat=/[0-9]{2}\/[0-9]{2}\/[0-9]{4}/;

	var counter = 1;
	var error ='no';
	var fnameTmp  = trimAll(frmManageRequirement.Requirement_Submitter_FirstName.value);
	var lnameTmp = trimAll(frmManageRequirement.Requirement_Submitter_LastName.value);
	var subStateTmp = trimAll(frmManageRequirement.Requirement_Submitter_State.value);
	var projLocTmp = trimAll(frmManageRequirement.Project_Location.value);
	var projDurationTmp = trimAll(frmManageRequirement.Project_Duration.value);
	var projRateTmp = trimAll(frmManageRequirement.Project_Rate.value);
	var subDateTmp = trimAll(frmManageRequirement.Requirement_Submission_Date.value);
	var reqDescTmp = trimAll(frmManageRequirement.Requirement_Description.value);
	var showErrorStr = '';
	//alert('Entered Validate');
	//Start  -- Pattern validation for Requirement_Submitter_FirstName
	if (fnameTmp == '' )
	{
		showErrorStr = showErrorStr+counter+") "+' First Name is required \n\n'
		counter=counter+1;			
		error ='yes';
	}
	else
	{
		//Start  -- Pattern validation for Requirement_Submitter_FirstName
		if (namePat.test(fnameTmp))
		{
			showErrorStr = showErrorStr+counter+") "+  ' First Name can have alphabets only \n      No numbers or special characters allowed \n\n      '+fnameTmp+' ?\n\n';
			counter=counter+1;			
			error ='yes';
		}
		//End  -- Pattern validation for name
	}
	
	//Start  -- Pattern validation for Requirement_Submitter_LastName
	if (lnameTmp == '' )
	{
		showErrorStr = showErrorStr+counter+") "+' Last Name is required \n\n'
		counter=counter+1;			
		error ='yes';
	}
	else
	{
		//Start  -- Pattern validation for Requirement_Submitter_LastName
		if (namePat.test(lnameTmp))
		{
			showErrorStr = showErrorStr+counter+") " + ' Last Name can have alphabets only \n      No numbers or special characters allowed \n\n      '+lnameTmp+' ?\n\n';
			counter=counter+1;			
			error ='yes';
		}
		//End  -- Pattern validation for name
	}

	//Start  --  validation for Requirement_Submitter_State
	if (subStateTmp == '' )
	{
		showErrorStr = showErrorStr+counter+") " + ' State is required \n\n'
		counter=counter+1;			
		error ='yes';
	}

	//Start  -- Pattern validation for Project_Location
	if (projLocTmp == '' )
	{
		showErrorStr = showErrorStr+counter+") "+' Location is required \n\n'
		counter=counter+1;			
		error ='yes';
	}
	else
	{
		//Start  -- Pattern validation for Project_Location
		if (projLocationPat.test(projLocTmp))
		{
			showErrorStr = showErrorStr+counter+") " + ' Location can have alphabets, numbers and .,-/ and space  \n\n      '+projLocTmp+' ?\n\n';
			counter=counter+1;			
			error ='yes';
		}
		//End  -- Pattern validation for Project_Location
	}

	//Start  -- Pattern validation for Project_Duration
	if(projDurationTmp != '')
	{
		//Start  -- Pattern validation for Project_Duration
		if (projDurationPat.test(projDurationTmp))
		{
			showErrorStr = showErrorStr+counter+") " + ' Duration can have alphabets, numbers, - (dash) + (plus) and space  \n\n      '+projDurationTmp+' ?\n\n';
			counter=counter+1;			
			error ='yes';
		}
		//End  -- Pattern validation for Project_Duration
	}

	//Start  -- Pattern validation for Project_Rate
	if(projRateTmp != '')
	{
		//Start  -- Pattern validation for Project_Rate
		if (projRatePat.test(projRateTmp))
		{
			showErrorStr = showErrorStr+counter+") " + ' Rate can have alphabets, numbers, space, .,$,/,-  \n\n      '+projRateTmp+' ?\n\n';
			counter=counter+1;			
			error ='yes';
		}
		//End  -- Pattern validation for Project_Rate
	}

	//Start  --  validation for Requirement_Submission_Date
	if (subDateTmp == '' )
	{
		showErrorStr = showErrorStr+counter+") " + ' Date is required \n\n';
		counter=counter+1;			
		error ='yes';
	}
	else
	{
		if (! datePat.test(subDateTmp))
		{
			showErrorStr = showErrorStr+counter+") " + ' Date does not appear to be in the right format  \n\n      '+subDateTmp+' ?\n\n';
			counter=counter+1;			
			error ='yes';
		}
	
	}

	//Start  --  validation for Requirement_Description
	if (reqDescTmp == '' )
	{
		showErrorStr = showErrorStr+counter+") " + ' Description is required \n\n'
		counter=counter+1;			
		error ='yes';
	}

	if	(error == 'no')
	{
		frmManageRequirement.submit();
	}
	else
	{
		alert(showErrorStr);
	}
}


function trimAll(sString) 
{
	while (sString.substring(0,1) == ' ')
	{
	sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' ')
	{
	sString = sString.substring(0,sString.length-1);
	}
	return sString;
}
function showHideLayer()
{
	var countryOfResidence=document.forms[0].country.value;
	
	if (countryOfResidence=='US') // Netscape 6 and IE 5+
	{
		document.getElementById("showSSN").style.display = '';
		document.getElementById("showPassport").style.display = 'none';
	}
	else
	{
		document.getElementById("showPassport").style.display = '';
		document.getElementById("showSSN").style.display = 'none';
	}
}
function setFocus() {

   ignoredForms =  new Array('ignoredFORM');
   for ( i = 0; i < document.forms.length; i++)
   {
      var isIgnoredForm	= false;
      for (j = 0; j < ignoredForms.length; j++)
      {
         if ( ignoredForms[j] == document.forms[i].name)
         {
            var isIgnoredForm	= true;
            j = ignoredForms.length;
         }
      }
      if (!isIgnoredForm){
         if ( document.forms[i].name != ignoredForms[j])
         {
                if(document.forms[i].elements != null)
                {
                for (k = 0; k < document.forms[i].elements.length; k++)
                {
					//alert("Object type is -> "+ document.forms[i].elements[k].type);
                   if ( ( document.forms[i].elements[k].type == 'text' || document.forms[i].elements[k].type == 'radio' || document.forms[i].elements[k].type == 'select-one') && document.forms[i].elements[k].disabled == false)
                   {
                      //alert("document.forms[i].elements[k].type -> "+document.forms[i].elements[k].type);  
					  document.forms[i].elements[k].focus();
                      break;
                    /*
                      i = document.forms.length;
                      if(document.forms[i].elements != null)
                        k = document.forms[i].elements.length;
                    */
                   }
                }
            }
         }
      }
   }
}

function IsNumericOnly(sText)
{
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }
function IsAlphabeticOnly(sText)
{
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }