﻿//Error handling Constants 


reg_error_hds_customer 			= "Please choose Yes or No";



reg_error_first_name      		= "Please enter first name";
reg_error_first_name_error 		= "Please enter correct first name";

reg_error_last_name      		= "Please enter last name";
reg_error_last_name_error 		= "Please enter correct last name";

reg_error_company				= "Please enter company name";
reg_error_company_error			= "Please enter correct company name";

reg_error_address1				= "Please enter address";
reg_error_address1_error		= "Please enter correct address";

reg_error_country				= "Please select country";

reg_error_city					= "Please enter city";

reg_error_city_error			= "Please enter correct city";

reg_error_state					= "Please enter state/province";
reg_error_state_error			= "Please enter correct state/province";

reg_error_state1				= "Please enter state/province";
reg_error_state1_error			= "Please enter correct state/province";

reg_error_zip					= "Please enter zip/postal code";
reg_error_zip_error				= "Please enter correct zip/postal code";

reg_error_phone					= "Please enter a telephone number";
reg_error_phone_error			= "Please enter a valid telephone number";

reg_error_email_empty    		= "Please enter your email address";
reg_error_email_not_valid 		= "Please enter a valid email address";

reg_error_DescribesOther    	= "Please enter best describes option";
reg_error_DescribesOther_error 	= "Please enter correct best describes option";

reg_error_OtherIndustry     	= "Please enter other industry";
reg_error_OtherIndustry_error  	= "Please enter correct other industry";

reg_error_OtherDepartment  		= "Please enter your department name";
reg_error_OtherDepartment_error = "Please enter your correct department name";

reg_error_BusinessOther     	= "Please enter your role";
reg_error_BusinessOther_error  	= "Please enter your correct role";

reg_error_OtherInterest     	= "Please enter your interest";
reg_error_OtherInterest_error  	= "Please enter your correct interest";

reg_error_department		= "Please enter job title";
reg_error_department_error		= "Please enter your job title";

reg_error_textfield1		= "Please select your answer";

reg_error_textfield2		= "Please select your answer";

reg_error_textfield3		= "Please select your answer";

reg_error_textfield4		= "Please select your answer";


function getLabelForId(id) {
    var label, labels = document.getElementsByTagName('label');
    for (var i = 0; (label = labels[i]); i++) {
        if (label.htmlFor == id) {
            return label;
        }
    }
    return false;
}


function checkRequired(id) {
    var formfield = document.getElementById(id);
    var label = getLabelForId(id);
    if (formfield.value.length == 0) {
        label.className = 'problem';
    } else {
        label.className = 'completed';
    }
}


function checkRequired1(id,name) {
	//alert(id);
    var formfield = document.getElementById(id);
    var label = getLabelForId(id);
	//alert(formfield.value);
    if (formfield.value.length == 0) {
    	//alert(name);
        label.className = '';/*problem*/
        formfield.style.border='1px solid #7F9DB9';/*#c00*/
    } else {
        label.className = 'completed';
        formfield.style.border='1px solid #0c0';
    }
}


function addEventOnFocus(obj){
	if(obj!=null){
//alert("obj:" + obj);
		addEvent(obj, 'focus', oninputfocus);
	}
}


function addEvent(obj, evType, fn){
    if (obj.addEventListener){
        obj.addEventListener(evType, fn, true);
        return true;
    } else if (obj.attachEvent){
        var r = obj.attachEvent("on"+evType, fn);
        return r;
    } else {
        return false;
    }
}


function oninputfocus(e) {
    /* Cookie-cutter code to find the source of the event */
    if (typeof e == 'undefined') {
        var e = window.event;
    }
    var source;
    if (typeof e.target != 'undefined') {
        source = e.target;
    } else if (typeof e.srcElement != 'undefined') {
        source = e.srcElement;
    } else {
        return;
    }
    /* End cookie-cutter code */
    source.style.border='1px solid #c00';
}

window.onload=function(){
init_box_msg_fields();
document.getElementById("first_name").focus();
//checkCountry('Country');
//var label = getLabelForId('general_info');
//label.className = 'problem';
}


function isNumberInput(event) 
{
  var key, keyChar;
  if (window.event)



    key = window.event.keyCode;



  else if (event)



    key = event.which;



  else



    return true;



  // Check for special characters like backspace



  if (key == null || key == 0 || key == 8 || key == 13 || key == 27)



    return true;



  // Check to see if it's a number



  keyChar =  String.fromCharCode(key);



  if (/\d/.test(keyChar)) 



    {



     window.status = "";



     return true;



    } 



  else 



   {



    window.status = "Field accepts numbers only.";



    return false;



   }



}







var specialChars 	  = /[\(\)\<\>\,\'\.\~\`\|\?\}\{\/\!\@\#\$\%\^\&\*\_\+\-\=\;\:\\\"\[\]]/ ; // Used to check special characters for all

var specialCharstitle 	  = /[\(\)\<\>\,\'\~\`\|\?\}\{\/\!\@\#\$\%\^\&\*\_\+\-\=\;\:\\\"\[\]]/ ; // Used to check special characters for all



var specialCharsLastName 	  = /[\(\)\<\>\,\'\~\`\|\?\}\{\/\!\@\#\$\%\^\&\*\_\+\=\;\:\\\"\[\]]/ ; // Used to check special characters for last name



var specialCharsAll = /[\<\>\,\'\`\}\{\|\~\?\!\@\#\$\%\^\*\_\=\;\:\\\"\[\]]/ ;



var specialCharsZip = /[\<\>\,\'\`\}\{\|\~\?\/\!\@\#\$\%\^\&\*\_\=\;\:\\\"\[\]]/ ;



var specialCharsCommon = /[\<\>\`\}\{\|\~\?\!\@\$\%\^\*\_\=\;\:\\\"\[\]]/ ;



var specialCharsAlpha = /[a-zA-Z]/ ;



var specialCharsAlphaNum = /[0-9a-zA-Z]/ ;



var specialCharsAllAnd = /[\<\>\,\'\`\}\{\|\~\?\/\!\@\#\$\%\^\*\_\=\;\:\\\"\[\]]/ ;



var specialCharsPhone = /[\<\>\'\`\}\{\|\~\?\/\!\@\#\$\%\^\&\*\_\=\;\:\\\"\[\]]/ ; // Used to check special characters for phone



var specialCharsPlus = /[+]{2,3}/;



var specialCharsBrack = /[(]{2,3}/;



var specialCharsBrackB = /[)]{2,3}/;



var specialCharsDash = /[-]{2,3}/;



var specialCharsDot = /[.]{2,3}/;



var specialCharsColon = /[:]{2,3}/;



var specialCharsAnd = /[&]{2,3}/;



var specialCharsCama = /[,]{2,3}/;



var specialCharsPostS = /[']{2,3}/;



var specialCharsHash = /[#]{2,3}/;



var specialCharsFslash = /[\/]{2,3}/;







//hds_customer



var hds_customer;



var hds_customer_label;



var box_hds_customer;



var msg_hds_customer;







//first_name



var first_name;



var first_name_label;



var box_first_name;



var msg_first_name;







//last_name



var last_name;



var last_name_label;



var box_last_name;



var msg_last_name;





var department1;

var department1_label;

var box_department1;

var msg_department1;



//Deapartment

var department;

var department_label;

var box_department;

var msg_department;



//Company



var company;



var company_label;



var box_company;



var msg_company;







//address1



var address1;



var address1_label;



var box_address1;



var msg_address1;







//Country



var country;



var country_label;



var box_country;



var msg_country;







//City



var city;



var city_label;



var box_city;



var msg_city;







//State
var state;
var state1;
var state_label;
var box_state;
var msg_state;

//Zip
var zip;
var zip_label;
var box_zip;
var msg_zip;

//Telephone
var phone;
var phone_label;
var box_phone;
var msg_phone;

//Email
var email;
var email_label;
var box_email;
var msg_email;

//BusinessOther
var BusinessOther;
var BusinessOther_label;
var box_BusinessOther;
var msg_BusinessOther;

//DescribesOther
var DescribesOther;
var DescribesOther_label;
var box_DescribesOther;
var msg_DescribesOther;

//OtherIndustry
var OtherIndustry;
var OtherIndustry_label;
var box_OtherIndustry;
var msg_OtherIndustry;

//OtherDepartment
var OtherDepartment;
var OtherDepartment_label;
var box_OtherDepartment;
var msg_OtherDepartment;

//OtherInterest
var OtherInterest;
var OtherInterest_label;
var box_OtherInterest;
var msg_OtherInterest;

//TestField1
var textfield1;
var textfield1_label;
var box_textfield1;
var msg_textfield1;

//TestField2
var textfield2;
var textfield2_label;
var box_textfield2;
var msg_textfield2;

//TestField3
var textfield3;
var textfield3_label;
var box_textfield3;
var msg_textfield3;

//TestField4
var textfield4;
var textfield4_label;
var box_textfield4;
var msg_textfield4;


function init_box_msg_fields()
{
	//hds_customer
	//hds_customer = document.getElementById('hds_customer');
	hds_customer = document.getElementsByName("hds_customer");
	hds_customer_label = getLabelForId('hds_customer');
	box_hds_customer= document.getElementById('box_hds_customer');
	msg_hds_customer = document.getElementById('msg_hds_customer');

	//fist_name
	first_name = document.getElementById('first_name');
	first_name_label = getLabelForId('first_name');
	box_first_name = document.getElementById('box_first_name');
	msg_first_name = document.getElementById('msg_first_name');

	//last_name
	last_name = document.getElementById('last_name');
	last_name_label = getLabelForId('last_name');
	box_last_name= document.getElementById('box_last_name');
	msg_last_name = document.getElementById('msg_last_name');

	//Department
	department = document.getElementById('department');
	department_label = getLabelForId('department');
	box_department = document.getElementById('box_department');
	msg_department = document.getElementById('msg_department');	

	//Department
	department1 = document.getElementById('department1');
	department1_label = getLabelForId('department1');
	box_department1 = document.getElementById('box_department1');
	msg_department1 = document.getElementById('msg_department1');	

	//company
	company = document.getElementById('company');
	company_label = getLabelForId('company');
	box_company= document.getElementById('box_company');
	msg_company = document.getElementById('msg_company');

	//address1
	address1 = document.getElementById('address1');
	address1_label = getLabelForId('address1');
	box_address1 = document.getElementById('box_address1');
	msg_address1 = document.getElementById('msg_address1');	
	
	//country
	country = document.getElementById('country');
	country_label = getLabelForId('country');
	box_country= document.getElementById('box_country');
	msg_country = document.getElementById('msg_country');

	//city
	city = document.getElementById('city');
	city_label = getLabelForId('city');
	box_city = document.getElementById('box_city');
	msg_city = document.getElementById('msg_city');

	//State
	state = document.getElementById('state');
	state1 = document.getElementById('state1');
	state2 = document.getElementById('state2');
	state_label = getLabelForId('state');
	box_state = document.getElementById('box_state');
	msg_state = document.getElementById('msg_state');	

	//Zip
	zip = document.getElementById('zip');
	zip_label = getLabelForId('zip');
	box_zip = document.getElementById('box_zip');
	msg_zip = document.getElementById('msg_zip');	

	//telephone
	phone = document.getElementById('phone');
	phone_label = getLabelForId('phone');
	box_phone= document.getElementById('box_phone');
	msg_phone = document.getElementById('msg_phone');
	
	//email
	email = document.getElementById('email');
	email_label = getLabelForId('email');
	box_email= document.getElementById('box_email');
	msg_email = document.getElementById('msg_email');	

	//BusinessOther
	textfield2Drop = document.getElementById('textfield2Drop');
	BusinessOther = document.getElementById('BusinessOther');
	BusinessOther_label = getLabelForId('BusinessOther');
	box_BusinessOther= document.getElementById('box_BusinessOther');
	msg_BusinessOther = document.getElementById('msg_BusinessOther');


	//DescribesOther
	textfield1Drop = document.getElementById('textfield1Drop');
	DescribesOther = document.getElementById('DescribesOther');
	DescribesOther_label = getLabelForId('DescribesOther');
	box_DescribesOther= document.getElementById('box_DescribesOther');
	msg_DescribesOther = document.getElementById('msg_DescribesOther');

	//OtherIndustry
	textfield5Drop = document.getElementById('textfield5Drop');
	OtherIndustry = document.getElementById('OtherIndustry');
	OtherIndustry_label = getLabelForId('OtherIndustry');
	box_OtherIndustry= document.getElementById('box_OtherIndustry');
	msg_OtherIndustry = document.getElementById('msg_OtherIndustry');

	//OtherDepartment
	departmentDrop = document.getElementById('departmentDrop');
	OtherDepartment = document.getElementById('OtherDepartment');
	OtherDepartment_label = getLabelForId('OtherDepartment');
	box_OtherDepartment= document.getElementById('box_OtherDepartment');
	msg_OtherDepartment = document.getElementById('msg_OtherDepartment');

	//OtherInterest
	textfield10Drop = document.getElementById('textfield10Drop');
	textfield10 = document.getElementById('textfield10');
	OtherInterest = document.getElementById('OtherInterest');
	OtherInterest_label = getLabelForId('OtherInterest');
	box_OtherInterest= document.getElementById('box_OtherInterest');
	msg_OtherInterest = document.getElementById('msg_OtherInterest');

	//textfield1
	textfield1 = document.getElementById('textfield1');
	textfield1_label = getLabelForId('textfield1');
	box_textfield1 = document.getElementById('box_textfield1');
	msg_textfield1 = document.getElementById('msg_textfield1');
	
	//textfield2
	textfield2 = document.getElementById('textfield2');
	textfield2_label = getLabelForId('textfield2');
	box_textfield2 = document.getElementById('box_textfield2');
	msg_textfield2 = document.getElementById('msg_textfield2');
	
	//textfield3
	textfield3 = document.getElementById('textfield3');
	textfield3_label = getLabelForId('textfield3');
	box_textfield3 = document.getElementById('box_textfield3');
	msg_textfield3 = document.getElementById('msg_textfield3');
	
	//textfield4
	textfield4 = document.getElementById('textfield4');
	textfield4_label = getLabelForId('textfield4');
	box_textfield4 = document.getElementById('box_textfield4');
	msg_textfield4 = document.getElementById('msg_textfield4');
}



function trim(s)
{
  return s.replace(/^\s+|\s+$/, '');
}

function checkRadio() {
		var i = 0;
		var position=0;
		var selected=false;
		for (i = 0; i < hds_customer.length; i++)
		{
			if (hds_customer[i].checked)
			{	
				position = i;
				i = hds_customer.length + 1;
				//hds_customer[position].style.border='1px solid #0C0';
				selected=true;
			}
		}
		if (!selected)
		{
			//hds_customer[position].focus(); 
			//hds_customer[position].style.border='1px solid #c00';
			hds_customer_label.className = 'problem';
			box_hds_customer.style.display     = 'block';
			msg_hds_customer.innerHTML         = reg_error_hds_customer;
			return false;			
		}
		else{
			hds_customer_label.className = 'completed';
			hds_customer[position].style.border='1px solid #0C0';
			box_hds_customer.style.display     = 'none';
			return true;
		}
}


function checkDepartment() {







	if (!department.disabled) {



		var digits = department.value.replace(/[^0-9]/ig, '');



	    if (trim(department.value).length == 0 || trim(department.value).length <= 1)



	    {



		department.style.border='1px solid #c00';



		department_label.className = 'problem';



		box_department.style.display     = 'block';



		msg_department.innerHTML         = reg_error_department



		return false;



	    }



	    else if (digits || department.value.match(specialCharstitle))



	    { 



		department.style.border='1px solid #c00';



		department_label.className = 'wrongFormat';



		box_department.style.display     = 'block';



		msg_department.innerHTML         = reg_error_department_error;



		return false;



	    }



	    else {



		department_label.className = 'completed';



		department.style.border='1px solid #0C0';



		box_department.style.display     = 'none';



		return true;



	    }



    	}



}





function checkDepartment1() {



	if (!department1.disabled) {

		if (department1.value.length == 0)

		{ 

			department1.style.border='1px solid #c00';

			department1_label.className = 'problem';

			box_department1.style.display     = 'block';

			msg_department1.innerHTML         = reg_error_department1;

			return false;

		}

		else{

			department1_label.className = 'completed';

			department1.style.border='1px solid #0C0';

			box_department1.style.display     = 'none';

			return true;

		}

		

	}

}





function checkFirstName() {







	if (!first_name.disabled) {



		var digits = first_name.value.replace(/[^0-9]/ig, '');



	    if (trim(first_name.value).length == 0 || trim(first_name.value).length <= 1)



	    {



		first_name.style.border='1px solid #c00';



		first_name_label.className = 'problem';



		box_first_name.style.display     = 'block';



		msg_first_name.innerHTML         = reg_error_first_name



		return false;



	    }



	    else if (digits || first_name.value.match(specialChars))



	    { 



		first_name.style.border='1px solid #c00';



		first_name_label.className = 'wrongFormat';



		box_first_name.style.display     = 'block';



		msg_first_name.innerHTML         = reg_error_first_name_error;



		return false;



	    }



	    else {



		first_name_label.className = 'completed';



		first_name.style.border='1px solid #0C0';



		box_first_name.style.display     = 'none';



		return true;



	    }



    	}



}







function checkLastName() {







	if (!last_name.disabled) {



		var digits = last_name.value.replace(/[^0-9]/ig, '');



	    if (trim(last_name.value).length == 0 || trim(last_name.value).length <= 1)



	    {



		last_name.style.border='1px solid #c00';



		last_name_label.className = 'problem';



		box_last_name.style.display     = 'block';



		msg_last_name.innerHTML         = reg_error_last_name



		return false;



	    }



	    else if (digits || last_name.value.match(specialCharsLastName))



	    { 



		last_name.style.border='1px solid #c00';



		last_name_label.className = 'wrongFormat';



		box_last_name.style.display     = 'block';



		msg_last_name.innerHTML         = reg_error_last_name_error;



		return false;



	    }



	    else {



		last_name_label.className = 'completed';



		last_name.style.border='1px solid #0C0';



		box_last_name.style.display     = 'none';



		return true;



	    }



    	}



}







function checkCompany() {







	if (!company.disabled) {



	    if (trim(company.value).length == 0 || trim(company.value).length <= 1)



	    {



		company.style.border='1px solid #c00';



		company_label.className = 'problem';



		box_company.style.display     = 'block';



		msg_company.innerHTML         = reg_error_company



		return false;



	    }



	   /* else if (company.value.match(specialCharsCommon)  || company.value.match(specialCharsAnd) || company.value.match(specialCharsDot) || company.value.match(specialCharsPostS) || company.value.match(specialCharsHash) || company.value.match(specialCharsCama) || company.value.match(specialCharsFslash))



	    { 



		company.style.border='1px solid #c00';



		company_label.className = 'wrongFormat';



		box_company.style.display     = 'block';



		msg_company.innerHTML         = reg_error_company_error;



		return false;



	    }*/



		else



		{



		company_label.className = 'completed';



		company.style.border='1px solid #0C0';



		box_company.style.display     = 'none';



		return true;



	    }



   		}



}







function checkStreetAddress1() {







	if (!address1.disabled) {



	    if (trim(address1.value).length == 0 || trim(address1.value).length <= 1)



	    {



		address1.style.border='1px solid #c00';



		address1_label.className = 'problem';



		box_address1.style.display     = 'block';



		msg_address1.innerHTML         = reg_error_address1



		return false;



	    }



	    /*else if (address1.value.match(specialCharsCommon)  || address1.value.match(specialCharsAnd) || address1.value.match(specialCharsDot) || address1.value.match(specialCharsPostS) || address1.value.match(specialCharsHash) || address1.value.match(specialCharsCama) || address1.value.match(specialCharsFslash))



	    { 



		address1.style.border='1px solid #c00';



		address1_label.className = 'wrongFormat';



		box_address1.style.display     = 'block';



		msg_address1.innerHTML         = reg_error_address1_error;



		return false;



	    }*/



		else



		{



		address1_label.className = 'completed';



		address1.style.border='1px solid #0C0';



		box_address1.style.display     = 'none';



		return true;



	    }



   		}



}

function checkContry1() {



	var statelen=document.getElementById('state').length;



	if (country.value =="")



		{	



			document.getElementById('state1').disabled=true;



			document.getElementById('state1').value ="Select a country first";



			return true;



		}



		else



		{	



			if (statelen==0 )



			{



				document.getElementById('state1').disabled=false;



				document.getElementById('state1').value ="";



			}



			else



			{



				document.getElementById('state1').disabled=true;



				document.getElementById('state1').value ="Select a country first";



			}



	}



	



}







function checkCountry() {



	if (!country.disabled) {



		if (country.value.length == 0)



		{ 



			country.style.border='1px solid #c00';



			country_label.className = 'problem';



			box_country.style.display     = 'block';



			box_state.style.display     = 'none';



		msg_country.innerHTML         = reg_error_country;	



			return false;



		} 



		else{



		country_label.className = 'completed';



		country.style.border='1px solid #0C0';



			box_country.style.display     = 'none';



			return true;



		}



	}



}







function checkCity() {
	if (!city.disabled) {
		var digitscity = city.value.replace(/[^0-9]/ig, '');
	    if (trim(city.value).length == 0 || trim(city.value).length <= 1)
	    {
		city.style.border='1px solid #c00';
		city_label.className = 'problem';
		box_city.style.display     = 'block';
		msg_city.innerHTML         = reg_error_city
		return false;
	    }
	    else if (digitscity || city.value.match(specialCharsAll) || city.value.match(specialCharsPlus) || city.value.match(specialCharsBrack) || city.value.match(specialCharsBrackB) || city.value.match(specialCharsDash) || city.value.match(specialCharsDot) || city.value.match(specialCharsAnd) || city.value.match(specialCharsFslash))
	    { 
		city.style.border='1px solid #c00';
		city_label.className = 'wrongFormat';
		box_city.style.display     = 'block';
		msg_city.innerHTML         = reg_error_city_error;
		return false;
	    }
	    else {
		city_label.className = 'completed';
		city.style.border='1px solid #0C0';
		box_city.style.display     = 'none';
		return true;
	    }
   		}
}


function checkState() {
	if (!state.disabled) {
		var digitsstate = state.value.replace(/[^0-9]/ig, '');
	    if (trim(state.value).length == 0 || state.value == 'Select a country first' &&  trim(state.value).length <= 1)
	    {
		state.style.border='1px solid #c00';
		state_label.className = 'problem';
		box_state.style.display     = 'block';
		msg_state.innerHTML         = reg_error_state
		return false;

	    }

	    else if (digitsstate || state.value.match(specialCharsAll) || state.value.match(specialCharsPlus) || state.value.match(specialCharsBrack) || state.value.match(specialCharsBrackB) || state.value.match(specialCharsDash) || state.value.match(specialCharsAnd) || state.value.match(specialCharsFslash))

	    { 

		state.style.border='1px solid #c00';

		state_label.className = 'wrongFormat';

		box_state.style.display     = 'block';

		msg_state.innerHTML         = reg_error_state_error;

		return false;

	    }
		else{
			state_label.className = 'completed';
			state.style.border='1px solid #0C0';
			box_state.style.display     = 'none';
			return true;
		}
	}
	else
	{
		return true;
	}
}


function checkState1() {
	if (!state1.disabled) {
		var digitsstate1 = state1.value.replace(/[^0-9]/ig, '');
	    if (trim(state1.value).length == 0 || state1.value == 'Select a country first' &&  trim(state1.value).length <= 1)
	    {
		state1.style.border='1px solid #c00';
		state_label.className = 'problem';
		box_state.style.display     = 'block';
		msg_state.innerHTML         = reg_error_state1
		return false;
	    }
	    else if (digitsstate1 || state1.value.match(specialCharsAll) || state1.value.match(specialCharsPlus) || state1.value.match(specialCharsBrack) || state1.value.match(specialCharsBrackB) || state1.value.match(specialCharsDash) || state1.value.match(specialCharsDot) || state1.value.match(specialCharsAnd) || state1.value.match(specialCharsFslash))
	    { 
		state1.style.border='1px solid #c00';
		state_label.className = 'wrongFormat';
		box_state.style.display     = 'block';
		msg_state.innerHTML         = reg_error_state1_error;
		return false;
	    }
	    else {
		state_label.className = 'completed';
		state1.style.border='1px solid #0C0';
		box_state.style.display     = 'none';
		return true;
	    }
   		}
	else
	{
		return true;
	}
}


function checkZip() {
	if (!zip.disabled) {
	    if (trim(zip.value).length == 0 || trim(zip.value).length <= 3)
	    {
		zip.style.border='1px solid #c00';
		zip_label.className = 'problem';
		box_zip.style.display     = 'block';
		msg_zip.innerHTML         = reg_error_zip
		return false;
	    }
	    else if (zip.value.match(specialCharsZip) || zip.value.match(specialCharsPlus) || zip.value.match(specialCharsBrack) || zip.value.match(specialCharsBrackB) || zip.value.match(specialCharsDash) || zip.value.match(specialCharsDot))
	    { 
		zip.style.border='1px solid #c00';
		zip_label.className = 'wrongFormat';
		box_zip.style.display     = 'block';
		msg_zip.innerHTML         = reg_error_zip_error;
		return false;
	    }
	    else {
		zip_label.className = 'completed';
		zip.style.border='1px solid #0C0';
		box_zip.style.display     = 'none';
		return true;
	    }
   		}
}


function checkPhone() {
	if (!phone.disabled) {
var digitsPhone = phone.value.replace(/[^a-zA-Z]/ig, '');
	    if (trim(phone.value).length == 0 || trim(phone.value).length <= 5)
	    {
		phone.style.border='1px solid #c00';
		phone_label.className = 'problem';
		box_phone.style.display     = 'block';
		msg_phone.innerHTML         = reg_error_phone
		return false;
	    }
	    else if (digitsPhone || phone.value.match(specialCharsPhone) || phone.value.match(specialCharsPlus) || phone.value.match(specialCharsBrack) || phone.value.match(specialCharsBrackB) || phone.value.match(specialCharsDash) || phone.value.match(specialCharsCama) || phone.value.match(specialCharsDot))
	    { 
		phone.style.border='1px solid #c00';
		phone_label.className = 'wrongFormat';
		box_phone.style.display     = 'block';
		msg_phone.innerHTML         = reg_error_phone_error;
		return false;
	    }
	    else {
		phone_label.className = 'completed';
		phone.style.border='1px solid #0C0';
		box_phone.style.display     = 'none';
		return true;
	    }
   		}
}


function checkEmail() {
	if (!email.disabled) {



	    if (email.value == "")



	    {







		email.style.border='1px solid #c00';



		email_label.className = 'problem';



		box_email.style.display     = 'block';



		msg_email.innerHTML         = reg_error_email_empty;



		return false;



	    }



	    else if (email.value != "" && !email.value.match(/^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-.]?[0-9a-zA-Z])*[.][a-zA-Z]{2,3}$/))



	    { 



		email.style.border='1px solid #c00';



		email_label.className = 'wrongFormat';



		box_email.style.display     = 'block';



		msg_email.innerHTML         = reg_error_email_not_valid;



		return false;



	    }



	    else {



		email_label.className = 'completed';



		email.style.border='1px solid #0C0';



		box_email.style.display     = 'none';



		return true;



	    }



    	}



}











function checkDescribesOther1() {



	



	var digitsDescribesOther = DescribesOther.value.replace(/[^0-9]/ig, '');



	if (!DescribesOther.disabled) {



		if (textfield1Drop.value == "Technology Partner" && trim(DescribesOther.value).length == 0 || textfield1Drop.value == "Value Added Reseller" && trim(DescribesOther.value).length == 0)



		{ 



		DescribesOther.style.border='1px solid #c00';



		//DescribesOther_label.className = 'problem';



		box_DescribesOther.style.display     = 'block';



		msg_DescribesOther.innerHTML         = reg_error_DescribesOther;		



		return false;



		}



		else if (digitsDescribesOther || DescribesOther.value.match(specialCharsAll) || DescribesOther.value.match(specialCharsBrack) || DescribesOther.value.match(specialCharsBrackB) || DescribesOther.value.match(specialCharsDash) || DescribesOther.value.match(specialCharsDot) || DescribesOther.value.match(specialCharsAnd) || DescribesOther.value.match(specialCharsFslash))



	    { 



		DescribesOther.style.border='1px solid #c00';



		//DescribesOther_label.className = 'wrongFormat';



		box_DescribesOther.style.display     = 'block';



		msg_DescribesOther.innerHTML         = reg_error_DescribesOther_error;



		return false;



	    }



		else



		{



		//DescribesOther_label.className = 'completed';



		DescribesOther.style.border='1px solid #0C0';



		box_DescribesOther.style.display     = 'none';



		return true;



		}



	}else



	{



		return true;



		}



}







function checkDescribesOther(describeValue) {



    if(describeValue == "Technology Partner" && DescribesOther.value.length == 0 || describeValue == "Value Added Reseller" && DescribesOther.value.length == 0)



    {



        document.getElementById("DescribesOther").style.display = "block";		



		document.getElementById('DescribesOther').disabled=false;



		document.getElementById("DescribesOther").focus();



    }



    else



    {



		document.getElementById("DescribesOther").style.display = "none";



		box_DescribesOther.style.display='none';



		document.getElementById("DescribesOther").value = "";



    }



}function checkOtherIndustry1() {



	



	var digitsOtherIndustry = OtherIndustry.value.replace(/[^0-9]/ig, '');



	if (!OtherIndustry.disabled) {



		



		if (textfield5Drop.value == "Other" && trim(OtherIndustry.value).length == 0)



		{ 



		OtherIndustry.style.border='1px solid #c00';



		//OtherIndustry_label.className = 'problem';



		box_OtherIndustry.style.display     = 'block';



		msg_OtherIndustry.innerHTML         = reg_error_OtherIndustry;



		return false;



		}



		else if (digitsOtherIndustry || OtherIndustry.value.match(specialCharsAll) || OtherIndustry.value.match(specialCharsBrack) || OtherIndustry.value.match(specialCharsBrackB) || OtherIndustry.value.match(specialCharsDash) || OtherIndustry.value.match(specialCharsDot) || OtherIndustry.value.match(specialCharsFslash) || OtherIndustry.value.match(specialCharsAnd))



	    { 



		OtherIndustry.style.border='1px solid #c00';



		//OtherIndustry_label.className = 'wrongFormat';



		box_OtherIndustry.style.display     = 'block';



		msg_OtherIndustry.innerHTML         = reg_error_OtherIndustry_error;



		return false;



	    }



		else{



		//OtherIndustry_label.className = 'completed';



		OtherIndustry.style.border='1px solid #0C0';



		box_OtherIndustry.style.display     = 'none';



		return true;



		}



	}else



	{



		return true;



		}



}







function checkOtherIndustry(industryValue) {



    if(industryValue == "Other" && OtherIndustry.value.length == 0)



    {



		document.getElementById("OtherIndustry").style.display = "block";



		document.getElementById('OtherIndustry').disabled=false;



		document.getElementById("OtherIndustry").focus();



    }



    else



    {



		document.getElementById("OtherIndustry").style.display = "none";



		document.getElementById("OtherIndustry").value = "";



		box_OtherIndustry.style.display     = 'none';



		OtherIndustry_label.className = '';



    }



}







function checkOtherDepartment1() {



	



	var digitsOtherDepartment = OtherDepartment.value.replace(/[^0-9]/ig, '');



	if (!OtherDepartment.disabled) {



		



		if (departmentDrop.value == "Other" && trim(OtherDepartment.value).length == 0)



		{ 



		OtherDepartment.style.border='1px solid #c00';



		//OtherDepartment_label.className = 'problem';



		box_OtherDepartment.style.display     = 'block';



		msg_OtherDepartment.innerHTML         = reg_error_OtherDepartment;



		return false;



		}



		else if (digitsOtherDepartment || OtherDepartment.value.match(specialCharsAll) || OtherDepartment.value.match(specialCharsBrack) || OtherDepartment.value.match(specialCharsBrackB) || OtherDepartment.value.match(specialCharsDash) || OtherDepartment.value.match(specialCharsDot) || OtherDepartment.value.match(specialCharsFslash) || OtherDepartment.value.match(specialCharsAnd))



	    { 



		OtherDepartment.style.border='1px solid #c00';



		//OtherDepartment_label.className = 'wrongFormat';



		box_OtherDepartment.style.display     = 'block';



		msg_OtherDepartment.innerHTML         = reg_error_OtherDepartment_error;



		return false;



	    }



		else{



		//OtherDepartment_label.className = 'completed';



		OtherDepartment.style.border='1px solid #0C0';



		box_OtherDepartment.style.display     = 'none';



		return true;



		}



	}else



	{



		return true;



		}



}







function checkOtherDepartment(departmentValue) {



    if(departmentValue == "Other" && OtherDepartment.value.length == 0)



    {



		document.getElementById("OtherDepartment").style.display = "block";



		document.getElementById('BusinessOther').disabled=false;



		document.getElementById("OtherDepartment").focus();



    }



    else



    {



		document.getElementById("OtherDepartment").style.display = "none";



		box_OtherDepartment.style.display     = 'none';



		document.getElementById("OtherDepartment").value = "";



    }



}







function checkBusinessOther1() {



	



	var digitsBusinessOther = BusinessOther.value.replace(/[^0-9]/ig, '');



	if (!BusinessOther.disabled) {



		



		if (textfield2Drop.value == "Other" && trim(BusinessOther.value).length == 0)



		{ 



		BusinessOther.style.border='1px solid #c00';



		//BusinessOther_label.className = 'problem';



		box_BusinessOther.style.display     = 'block';



		msg_BusinessOther.innerHTML         = reg_error_BusinessOther;



		return false;



		}



		else if (digitsBusinessOther || BusinessOther.value.match(specialCharsAll) || BusinessOther.value.match(specialCharsBrack) || BusinessOther.value.match(specialCharsBrackB) || BusinessOther.value.match(specialCharsDash) || BusinessOther.value.match(specialCharsDot) || BusinessOther.value.match(specialCharsFslash) || BusinessOther.value.match(specialCharsAnd))



	    { 



		BusinessOther.style.border='1px solid #c00';



		//BusinessOther_label.className = 'wrongFormat';



		box_BusinessOther.style.display     = 'block';



		msg_BusinessOther.innerHTML         = reg_error_BusinessOther_error;



		return false;



	    }



		else{



		//BusinessOther_label.className = 'completed';



		BusinessOther.style.border='1px solid #0C0';



		box_BusinessOther.style.display     = 'none';



		return true;



		}



	}else



	{



		return true;



		}



}







function checkBusinessOther(businessValue) {



    if(businessValue == "Other")



    {



        document.getElementById("BusinessOther").style.display = "block";		



		document.getElementById('BusinessOther').disabled=false;



		document.getElementById("BusinessOther").focus();		



    }







    else



    {



		document.getElementById("BusinessOther").style.display = "none";



		box_BusinessOther.style.display     = 'none';



		document.getElementById("BusinessOther").value = "";	



    }



}







function checkOtherInterest1() {







	var digitsOtherInterest = OtherInterest.value.replace(/[^0-9]/ig, '');



	if (!OtherInterest.disabled) {



			var items=new Array();



			var i,j,flag;







			i=0;j=0;flag=0;



			var prod_Sol=document.getElementById("textfield10Drop");



			while (i<prod_Sol.length)



				{



					if(prod_Sol.options[i].selected)



					{



						items[j] = new Array(prod_Sol.options[i].value);



						if (items[j]=="Other"){flag=1;}



						j=j+1;



					}



					i=i+1;



				}







	if((flag==1) && (items.length==1) && trim(OtherInterest.value).length == 0)



    {



			OtherInterest.style.border='1px solid #c00';



			//OtherInterest_label.className = 'problem';



			box_OtherInterest.style.display     = 'block';



			msg_OtherInterest.innerHTML         = reg_error_OtherInterest;		



			return false;



    }



	else 	if((flag==1) && (items.length>=1) && trim(OtherInterest.value).length == 0)



	{



			OtherInterest.style.border='1px solid #c00';



			//OtherInterest_label.className = 'problem';



			box_OtherInterest.style.display     = 'block';



			msg_OtherInterest.innerHTML         = reg_error_OtherInterest;		



			return false;



    }



	else 	if (digitsOtherInterest || OtherInterest.value.match(specialCharsAll) || OtherInterest.value.match(specialCharsBrack) || OtherInterest.value.match(specialCharsBrackB) || OtherInterest.value.match(specialCharsDash) || OtherInterest.value.match(specialCharsDot) || OtherInterest.value.match(specialCharsFslash) || OtherInterest.value.match(specialCharsAnd))



	{ 



		OtherInterest.style.border='1px solid #c00';



		//OtherInterest_label.className = 'wrongFormat';



		box_OtherInterest.style.display     = 'block';



		msg_OtherInterest.innerHTML         = reg_error_OtherInterest_error;



		return false;



	}



	else



		{



			//OtherInterest_label.className = 'completed';



			OtherInterest.style.border='1px solid #0C0';



			box_OtherInterest.style.display     = 'none';



			return true;



		}



	}



	else



		{



		return true;



		}



}







function checkOtherInterest(interestValue) {



	var items=new Array();



	var i,j,flag;



	i=0;j=0;flag=0;



	var prod_Sol=document.getElementById("textfield10Drop");



		while (i<prod_Sol.length)



			{



				if(prod_Sol.options[i].selected)



				{



					items[j] = new Array(prod_Sol.options[i].value);



					if (items[j]=="Other"){flag=1;}



					j=j+1;



					



				}



				i=i+1;



			}



j=0;



	//-------------------------------------------------------------------------------------------



	



	if((flag==1) && (items.length==1))



    {



		document.getElementById("OtherInterest").style.display = "block";



		document.getElementById('OtherInterest').disabled=false;



    }



	else 	if((flag==1) && (items.length>=1))



	{



		document.getElementById("OtherInterest").style.display = "block";



		document.getElementById('OtherInterest').disabled=false;



    }



	else if((flag==0)&& (items.length>=1)) 



	{



		document.getElementById("OtherInterest").style.display = "none";



		box_OtherInterest.style.display     = 'none';



		document.getElementById("OtherInterest").value = "";



		}
}


var check_form_error_obj = null;



function check_form () {
var obj, e;
try {
 if (!checkFirstName()) {
	first_name.focus();
	return false;
}
else if (!checkLastName()) {
last_name.focus();
return false;
}
else if (!checkDepartment()) {
department.focus();
return false;
}
else if (!checkCompany()) {
company.focus();
return false;
}
else if (!checkStreetAddress1()) {
address1.focus();
return false;
}
else if(!checkCity()){
city.focus();
return false;
}
else if (!checkState()) {
state.focus();
return false;
}
else if (!checkZip()) {
	zip.focus();
	return false;
}
else if (!checkEmail()) {
email.focus();
return false;
}
else if (!checkPhone()) {
phone.focus();
return false;
}
else if (!checktextfield1()) {
document.getElementById('Q1-1').focus();
return false;
}
else if (!checkTextfield2()) {
textfield2.focus();
return false;
}
else if (!checkTextfield3()) {
textfield3.focus();
return false;
}
else if (!checktextfield4()) {
document.getElementById('Q4-1').focus();
return false;
}
else{
sendtextfield1();
sendtextfield4();
return true;
}
} catch (e) { check_form_error_obj = obj; return false;}
return false;
}


function DescribesOtherData()
{	if (!DescribesOther.disabled){
		if (textfield1Drop.value == "Technology Partner")
		{
			document.getElementById("textfield1").value = document.getElementById("textfield1Drop").value + ": " + document.getElementById("DescribesOther").value;
		}
		else if(textfield1Drop.value == "Value Added Reseller" )
		{
			document.getElementById("textfield1").value = document.getElementById("textfield1Drop").value + ": " + document.getElementById("DescribesOther").value;
		}
		else
		{
			document.getElementById("textfield1").value = document.getElementById("textfield1Drop").value;
		}
	}
}


function OtherIndustryData()
{	if (!OtherIndustry.disabled){
		if (textfield5Drop.value == "Other")
		{
document.getElementById("textfield5").value = document.getElementById("textfield5Drop").value + ": " + document.getElementById("OtherIndustry").value;
		}
		else
		{
			document.getElementById("textfield5").value = document.getElementById("textfield5Drop").value;
		}
	}
}


function OtherDepartmentData()
{	if (!OtherDepartment.disabled){
		if (departmentDrop.value == "Other")
		{
			document.getElementById("department").value = document.getElementById("departmentDrop").value + ": " + document.getElementById("OtherDepartment").value;
		}
		else
		{
			document.getElementById("department").value = document.getElementById("departmentDrop").value;
		}
	}
}


function BusinessOtherData()
{	if (!BusinessOther.disabled){
		if (textfield2Drop.value == "Other")
		{
			document.getElementById("textfield2").value = document.getElementById("textfield2Drop").value + ": " + document.getElementById("BusinessOther").value;
		}
		else
		{
			document.getElementById("textfield2").value = document.getElementById("textfield2Drop").value;
		}
	}
}



function stateupdate(){
	if ( country.value != 'Canada' && country.value != 'United States' ){
		con = country.value;
		state.value = con;
		state1.value = con;
		document.getElementById('dummy-state').style.display = 'block';
		state.style.display = 'none';
		state1.style.display = 'none';
		box_state.style.display     = 'none';
		state.disabled = true;
		state1.disabled = true;
	}else {
		document.getElementById('dummy-state').style.display = 'none';
		state.disabled = "";
		state1.disabled = "";
		}
}


function checktextfield1(){
		if (document.getElementById('Q1-1').checked == false && document.getElementById('Q1-2').checked == false && document.getElementById('Q1-3').checked == false && document.getElementById('Q1-4').checked == false && document.getElementById('Q1-5').checked == false && document.getElementById('Q1-6').checked == false && (trim(document.getElementById('Q1-7').value).length == 0 || trim(document.getElementById('Q1-7').value).length <= 1) )
		{
		document.getElementById('box_textfield1').style.display     = 'block';
		document.getElementById('msg_textfield1').innerHTML         = reg_error_textfield1;
			return false;
		}else {
			document.getElementById('box_textfield1').style.display     = 'none';
		   return true;
		}
}


function checkTextfield2() {
	if (!textfield2.disabled) {
		if (textfield2.value.length == 0 || textfield2.value == "Select One")
		{ 
			textfield2.style.border='1px solid #c00';
			textfield2_label.className = 'problem';
			box_textfield2.style.display     = 'block';
			msg_textfield2.innerHTML         = reg_error_textfield2;
			return false;
		}
		else{
			textfield2_label.className = 'completed';
			textfield2.style.border='1px solid #0C0';
			box_textfield2.style.display     = 'none';
			return true;
		}
	}
	else
	{
		return true;
	}
}


function checkTextfield3() {
	if (!textfield3.disabled) {
		if (textfield3.value.length == 0 || textfield3.value == "Select One")
		{ 
			textfield3.style.border='1px solid #c00';
			textfield3_label.className = 'problem';
			box_textfield3.style.display     = 'block';
			msg_textfield3.innerHTML         = reg_error_textfield3;
			return false;
		}
		else{
			textfield3_label.className = 'completed';
			textfield3.style.border='1px solid #0C0';
			box_textfield3.style.display     = 'none';
			return true;
		}
	}
	else
	{
		return true;
	}
}


function checktextfield4(){
	if (document.getElementById('Q2-1').checked == false && document.getElementById('Q2-2').checked == false && document.getElementById('Q2-3').checked == false && document.getElementById('Q2-4').checked == false && document.getElementById('Q2-5').checked == false && document.getElementById('Q2-6').checked == false && (trim(document.getElementById('Q2-7').value).length == 0 || trim(document.getElementById('Q2-7').value).length <= 1) ){
		document.getElementById('box_textfield4').style.display     = 'block';
		document.getElementById('msg_textfield4').innerHTML         = reg_error_textfield4;
		return false;
		}	else {
			document.getElementById('box_textfield4').style.display     = 'none';
		   return true;
		}
}

function sendtextfield1(){

	var textfields1value = new Array();
		
	if (document.getElementById('Q1-1').checked == true){
		textfields1value.push(document.getElementById('Q1-1').value);
	
	}if (document.getElementById('Q1-2').checked == true){
		
		textfields1value.push(document.getElementById('Q1-2').value);
	
	}if (document.getElementById('Q1-3').checked == true){
		
		textfields1value.push(document.getElementById('Q1-3').value);
	
	}if (document.getElementById('Q1-4').checked == true){
		
		textfields1value.push(document.getElementById('Q1-4').value);
	
	}if (document.getElementById('Q1-5').checked == true){
		
		textfields1value.push(document.getElementById('Q1-5').value);
		
		
	}if (document.getElementById('Q1-6').checked == true){
		
		textfields1value.push(document.getElementById('Q1-6').value);

	}if (document.getElementById('Q1-7').value!=""){
		
		textfields1value.push("Other: "+ document.getElementById('Q1-7').value);
	
	
	}


	document.getElementById('textfield1').value = textfields1value;
	return true;
}
function sendtextfield4(){
	
	var textfield4value = new Array();
	
	if (document.getElementById('Q2-1').checked == true){
		textfield4value.push(document.getElementById('Q2-1').value);
	
	}if (document.getElementById('Q2-2').checked == true){
		
		textfield4value.push(document.getElementById('Q2-2').value);
	
	}if (document.getElementById('Q2-3').checked == true){
		
		textfield4value.push(document.getElementById('Q2-3').value);
	
	}if (document.getElementById('Q2-4').checked == true){
		
		textfield4value.push(document.getElementById('Q2-4').value);
	
	}if (document.getElementById('Q2-5').checked == true){
		
		textfield4value.push(document.getElementById('Q2-5').value);
		
		
	}if (document.getElementById('Q2-6').checked == true){
		
		textfield4value.push(document.getElementById('Q2-6').value);

	}if (document.getElementById('Q2-7').value!=""){
		
		textfield4value.push(document.getElementById('Q2-7').value);
	
	
	}
	//alert('fwefewfewfewfw')
	document.getElementById('textfield4').value = textfield4value;
		return true;
}



//end-->
