function hideInputs(object){
  var menuIndex = object.options[object.selectedIndex].value;
    if (menuIndex == 'Afghanistan' || menuIndex == 'Albania' || menuIndex == 'Algeria' || menuIndex == 'Andorra' || menuIndex == 'Angola' || menuIndex == 'Armenia' || menuIndex == 'Austria' || menuIndex == 'Azerbaijan' || menuIndex == 'Bahrain' || menuIndex == 'Bangladesh' || menuIndex == 'Belarus' || menuIndex == 'Belgium' || menuIndex == 'Benin' || menuIndex == 'Bhutan' || menuIndex == 'Bosnia-Herzegovina' || menuIndex == 'Botswana' || menuIndex == 'Bulgaria' || menuIndex == 'Burkina' || menuIndex == 'Burundi' || menuIndex == 'Cambodia' || menuIndex == 'Cameroon' || menuIndex == 'Cape Verde' || menuIndex == 'Central African Republic' || menuIndex == 'Chad' || menuIndex == 'Comoros' || menuIndex == 'Congo' || menuIndex == 'Congo (Dem. Rep.)' || menuIndex == 'Croatia' || menuIndex == 'Cyprus' || menuIndex == 'Czech Republic' || menuIndex == 'Denmark' || menuIndex == 'Djibouti' || menuIndex == 'Egypt' || menuIndex == 'Equatorial Guinea' || menuIndex == 'Eritrea' || menuIndex == 'Estonia' || menuIndex == 'Ethiopia' || menuIndex == 'Finland' || menuIndex == 'France' || menuIndex == 'Gabon' || menuIndex == 'Gambia' || menuIndex == 'Georgia' || menuIndex == 'Germany' || menuIndex == 'Ghana' || menuIndex == 'Greece' || menuIndex == 'Guinea' || menuIndex == 'Guinea-Bissau' || menuIndex == 'Hungary' || menuIndex == 'Iceland' || menuIndex == 'India' || menuIndex == 'Ireland' || menuIndex == 'Israel' || menuIndex == 'Italy' || menuIndex == 'Ivory Coast' || menuIndex == 'Jordan' || menuIndex == 'Kazakhstan' || menuIndex == 'Kenya' || menuIndex == 'Kuwait' || menuIndex == 'Kyrgyzstan' || menuIndex == 'Latvia' || menuIndex == 'Lebanon' || menuIndex == 'Lesotho' || menuIndex == 'Liberia' || menuIndex == 'Liechtenstein' || menuIndex == 'Lithuania' || menuIndex == 'Luxembourg' || menuIndex == 'Macedonia' || menuIndex == 'Madagascar' || menuIndex == 'Malawi' || menuIndex == 'Maldives' || menuIndex == 'Mali' || menuIndex == 'Malta' || menuIndex == 'Mauritania' || menuIndex == 'Mauritius' || menuIndex == 'Moldova' || menuIndex == 'Monaco' || menuIndex == 'Morocco' || menuIndex == 'Mozambique' || menuIndex == 'Namibia' || menuIndex == 'Nepal' || menuIndex == 'Netherlands' || menuIndex == 'Niger' || menuIndex == 'Nigeria' || menuIndex == 'Norway' || menuIndex == 'Oman' || menuIndex == 'Pakistan' || menuIndex == 'Poland' || menuIndex == 'Portugal' || menuIndex == 'Qatar' || menuIndex == 'Romania' || menuIndex == 'Russian Federation' || menuIndex == 'Rwanda' || menuIndex == 'San Marino' || menuIndex == 'Sao Tome & Principe' || menuIndex == 'Saudi Arabia' || menuIndex == 'Senegal' || menuIndex == 'Serbia/Montenegro (Yugoslavia)' || menuIndex == 'Seychelles' || menuIndex == 'Sierra Leone' || menuIndex == 'Slovakia' || menuIndex == 'Slovenia' || menuIndex == 'Somalia' || menuIndex == 'South Africa' || menuIndex == 'Spain' || menuIndex == 'Sri Lanka' || menuIndex == 'Swaziland' || menuIndex == 'Sweden' || menuIndex == 'Switzerland' || menuIndex == 'Tajikistan' || menuIndex == 'Tanzania' || menuIndex == 'Togo' || menuIndex == 'Tunisia' || menuIndex == 'Turkey' || menuIndex == 'Turkmenistan' || menuIndex == 'Uganda' || menuIndex == 'Ukraine' || menuIndex == 'United Arab Emirates (UAE)' || menuIndex == 'United Kingdom' || menuIndex == 'Uzbekistan' || menuIndex == 'Vatican City' || menuIndex == 'Yemen' || menuIndex == 'Zambia' || menuIndex == 'Zimbabwe'){
      document.getElementById("hide").style.display = 'block';
                               }
     else
     {
       document.getElementById("hide").style.display = 'none';
      }
   
    if (menuIndex == 'United States' || menuIndex == 'Canada')
    { 
     document.getElementById("hidestate").style.display = 'block';
    } 
    else 
    {
     document.getElementById("hidestate").style.display = 'none';
     document.ss_general.state.options[0].selected = true;
     
     if(document.ss_general.acode)
     {
      document.getElementById("hideacode").style.display = 'none'; 
      document.ss_general.acode.options[0].selected = true;
     } 
   }   
 }     
      
 function hideCode(object){
  var menuIndex = object.options[object.selectedIndex].value;
    
    if (menuIndex == 'CA')
    { 
     document.getElementById("hideacode").style.display = 'block';
    } 
    else 
    {
     document.getElementById("hideacode").style.display = 'none';
    } 
   
   }   

function ValidateAll()
{
	if(CheckFirstname(document.ss_general.firstname.value) == false) return false;
	if(CheckLastname(document.ss_general.lastname.value) == false) return false;
	if(CheckJobtitle(document.ss_general.title.value) == false) return false;
	if(CheckCompany(document.ss_general.company.value) == false) return false;
	if(CheckCountry(document.ss_general.country.value) == false) return false;
	if(CheckEmail(document.ss_general.email.value) == false) return false;
	if(CheckIndustry(document.ss_general.industry.value) == false) return false;
    if(CheckOrganization(document.ss_general.product.value) == false) return false;
	return true;
}

function StripSpacesFromEnds(s)
{
	// developed by willmaster.com
	while((s.indexOf(' ',0) == 0) && (s.length > 1))
	{
		s = s.substring(1,s.length);
	}
	while((s.lastIndexOf(' ') == (s.length - 1) && (s.length > 1)))
	{
		s = s.substring(0,(s.length - 1));
	}
	if((s.indexOf(' ',0) == 0) && (s.length == 1)) s = '';
	return s;
}

function IsItPresent(s,explanation)
{
	// developed by willmaster.com
	s = StripSpacesFromEnds(s);
	if(s.length) return s;
	alert('Please ' + explanation + '.');
	return '';
}

function CheckFirstname(s_firstname)
{
	// developed by willmaster.com
	s_firstname = IsItPresent(s_firstname,'enter your first name');
	if(! s_firstname) return false;

	document.ss_general.firstname.value = s_firstname;
	return true;
}

function CheckLastname(s_lastname)
{
	// developed by willmaster.com
	s_lastname = IsItPresent(s_lastname,'enter your last name');
	if(! s_lastname) return false;

	document.ss_general.lastname.value = s_lastname;
	return true;
}

function CheckJobtitle(s_title)
{
	// developed by willmaster.com
	s_title = IsItPresent(s_title,'select your job title');
	if(! s_title) return false;

	document.ss_general.title.value = s_title;
	return true;
}


function CheckCompany(s_company)
{
	// developed by willmaster.com
	s_company = IsItPresent(s_company,'enter your company');
	if(! s_company) return false;

	document.ss_general.company.value = s_company;
	return true;
}



function CheckCountry(s_country)
{

	s_country = IsItPresent(s_country,'select your country');
	if(! s_country) return false;

	document.ss_general.country.value = s_country;
	
	
	
	if((document.ss_general.country.value == 'United States' || document.ss_general.country.value == 'Canada') && document.ss_general.state && document.ss_general.state.value == "")

	{ 
	  alert("Please select state");
	  return false;
	}

        if((document.ss_general.country.value != 'United States' && document.ss_general.country.value != 'Canada'))
	
	{
	
	 document.ss_general.state.value = "";
	 
	 }

	if(document.ss_general.state.value != 'CA')
	
	{
	
	 document.ss_general.acode.value = "";
	 
	 }
	 	

	if(document.ss_general.state && (document.ss_general.country.value== 'United States' || document.ss_general.country.value== 'Canada') && document.ss_general.state.value=="CA" && document.ss_general.acode.value=="")

	{

	  alert("Please select area code");
	  return false;

	}  
	

	return true;
}

function CheckEmail(s_email)
{
	// developed by willmaster.com
	s_email = IsItPresent(s_email,'enter your email address');
	if(! s_email) return false;
	var i = s_email.indexOf(' ',0);
	while(i > -1)
	{
		s_email = s_email.substring(0,i) + 
			s_email.substring((i + 1),s_email.length);
		i = s_email.indexOf(' ',0);
	}
	document.ss_general.email.value = s_email;
	if((s_email.length < 6) ||
	   (s_email.indexOf('@',0) < 1) ||
	   (s_email.lastIndexOf('@') != s_email.indexOf('@',0)) ||
	   (s_email.lastIndexOf('@') > (s_email.length - 5)) ||
	   (s_email.lastIndexOf('.') > (s_email.length - 3)) ||
	   (s_email.lastIndexOf('.') < (s_email.length - 4)) ||
	   (s_email.indexOf('..',0) > -1) ||
	   (s_email.indexOf('@.',0) > -1) ||
	   (s_email.indexOf('.@',0) > -1) ||
	   (s_email.indexOf(',',0) > -1))
	{
		alert('The email address "' + s_email + '" is not valid. Please re-enter.');
		return false;
	}
	return true;
}

function CheckIndustry(s_industry)
{

	s_industry = IsItPresent(s_industry,'select your industry');
	if(! s_industry) return false;

	document.ss_general.industry.value = s_industry;
	return true;
}

function CheckOrganization(s_organization)
{

	s_organization = IsItPresent(s_organization,'select your organization type');
	if(! s_organization) return false;

	document.ss_general.product.value = s_organization;
	return true;
}
