//Error handling Constants 



reg_error_country				= "Please select country";



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_city					= "Please enter city";

reg_error_city_error			= "Please enter correct city";



reg_error_state					= "Please select 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_ResponsibilityOther   = "Please enter your area of responsibility";

reg_error_ResponsibilityOther_error   = "Please enter your correct area of responsibility";



reg_error_OtherInterest     	= "Please enter your interest";

reg_error_OtherInterest_error  	= "Please enter your correct interest";



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 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}/;



//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;



//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;



//ResponsibilityOther

var ResponsibilityOther;

var ResponsibilityOther_label;

var box_ResponsibilityOther;

var msg_ResponsibilityOther;



//OtherInterest

var OtherInterest;

var OtherInterest_label;

var box_OtherInterest;

var msg_OtherInterest;





function init_box_msg_fields()

{

	//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');





	//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');

	

	//ResponsibilityOther

	textfield7Drop = document.getElementById('textfield7Drop');

	ResponsibilityOther = document.getElementById('ResponsibilityOther');

	ResponsibilityOther_label = getLabelForId('ResponsibilityOther');

	box_ResponsibilityOther= document.getElementById('box_ResponsibilityOther');

	msg_ResponsibilityOther = document.getElementById('msg_ResponsibilityOther');		



	//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');



}



function trim(s)

{

  return s.replace(/^\s+|\s+$/, '');

} 



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 ="Välj land";

			return true;

		}
		
	else if (country.value =="Sweden" )

		{	

			document.getElementById('state1').disabled=true;

			document.getElementById('state1').value ="Sweden";
			state_label.className = 'completed';
			box_state.style.display     = 'none';
			document.getElementById('state1').style.border = "1px solid #7F9DB9"
			document.getElementById('removeState').style.display     = 'none'; //used to hide state field row
			return true;

		}	

		else

		{	

			if (statelen==0 )

			{

				document.getElementById('state1').disabled=false;

				document.getElementById('state1').value ="";
				state_label.className = 'required';
				document.getElementById('removeState').style.visibility     = 'visible'; //used to show state field row
				document.getElementById('removeState').style.display     = ''; //used to show state field row
			}

			else

			{

				document.getElementById('state1').disabled=true;

				document.getElementById('state1').value ="Välj land";
				state_label.className = 'required';
				document.getElementById('removeState').style.visibility     = 'visible'; //used to show state field row
				document.getElementById('removeState').style.display     = ''; //used to show state field row
				
			}

	}

	

}



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';

			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) {

		if (state.value.length == 0 || state.value == "Välj ett alternativ")

		{ 

			state.style.border='1px solid #c00';

			state_label.className = 'problem';

			box_state.style.display     = 'block';

			msg_state.innerHTML         = reg_error_state;

			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 == 'Välj land' &&  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 checkResponsibilityOther1() {

	

	var digitsResponsibilityOther = ResponsibilityOther.value.replace(/[^0-9]/ig, '');

	if (!ResponsibilityOther.disabled) {

		

		if (textfield7Drop.value == "Other" && trim(ResponsibilityOther.value).length == 0)

		{ 

		ResponsibilityOther.style.border='1px solid #c00';

		//ResponsibilityOther_label.className = 'problem';

		box_ResponsibilityOther.style.display     = 'block';

		msg_ResponsibilityOther.innerHTML         = reg_error_ResponsibilityOther;

		return false;

		}

		else if (digitsResponsibilityOther || ResponsibilityOther.value.match(specialCharsAll) || ResponsibilityOther.value.match(specialCharsBrack) || ResponsibilityOther.value.match(specialCharsBrackB) || ResponsibilityOther.value.match(specialCharsDash) || ResponsibilityOther.value.match(specialCharsDot) || ResponsibilityOther.value.match(specialCharsFslash) || ResponsibilityOther.value.match(specialCharsAnd))

	    { 

		ResponsibilityOther.style.border='1px solid #c00';

		//ResponsibilityOther_label.className = 'wrongFormat';

		box_ResponsibilityOther.style.display     = 'block';

		msg_ResponsibilityOther.innerHTML         = reg_error_ResponsibilityOther_error;

		return false;

	    }

		else{

		//ResponsibilityOther_label.className = 'completed';

		ResponsibilityOther.style.border='1px solid #0C0';

		box_ResponsibilityOther.style.display     = 'none';

		return true;

		}

	}else

	{

		return true;

		}

}



function checkResponsibilityOther(resValue) {

    if(resValue == "Other")

    {

		document.getElementById("ResponsibilityOther").style.display = "block";

		document.getElementById('ResponsibilityOther').disabled=false;

		document.getElementById("ResponsibilityOther").focus();

    }

    else

    {

		document.getElementById("ResponsibilityOther").style.display = "none";

		box_ResponsibilityOther.style.display     = 'none';

		document.getElementById("ResponsibilityOther").value = "";

		document.getElementById('ResponsibilityOther').disabled=true;

    }

}



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 (!checkCompany()) {

	company.focus();

	return false;

}else if (!checkStreetAddress1()) {

	address1.focus();

	return false;

}else if (!checkCountry()) {

	country.focus();

	return false;

}else if (!checkCity()) {

	city.focus();

	return false;	

}else if (!checkState()) {

	state.focus();

	return false;

}else if (!checkState1()) {

	state1.focus();

	return false;

}else if (!checkZip()) {

	zip.focus();

	return false;

}else if (!checkPhone()) {

	phone.focus();

	return false;

}else if (!checkEmail()) {

	email.focus();

	return false;

}else if (!checkDescribesOther1()) {

	DescribesOther.focus();

	return false;

}else if (!checkOtherIndustry1()) {

	OtherIndustry.focus();

	return false;

}else if (!checkOtherDepartment1()) {

	OtherDepartment.focus();

	return false;

}else if (!checkBusinessOther1()) {

	BusinessOther.focus();

	return false;

}else if (!checkResponsibilityOther1()) {

	ResponsibilityOther.focus();

	return false;

}else if (!checkOtherInterest1()) {

	OtherInterest.focus();

	return false;

}

else{

	

	var prod_Sol=document.getElementById("textfield10Drop");

	var i;

	i=0;

	document.getElementById("textfield10").value="";

		while (i<prod_Sol.length)

			{

				if(prod_Sol.options[i].selected)

				{

					var selected_text = prod_Sol.options[i].value;

					if (document.getElementById("textfield10").value!="")

					{

					document.getElementById("textfield10").value=document.getElementById("textfield10").value + ", " + selected_text

					}

					else

					{

					document.getElementById("textfield10").value=document.getElementById("textfield10").value + selected_text;

					}

				}

				i=i+1;

			}



			document.getElementById("textfield10").value=document.getElementById("textfield10").value +", "+ document.getElementById("OtherInterest").value;	

		



DescribesOtherData();

OtherIndustryData();

OtherDepartmentData();

ResponsibilityOtherData();

BusinessOtherData();



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 ResponsibilityOtherData()

{   if (!ResponsibilityOther.disabled){

		if (textfield7Drop.value == "Other")

		{

			document.getElementById("textfield7").value = document.getElementById("textfield7Drop").value + ": " + document.getElementById("ResponsibilityOther").value;

		//alert(document.getElementById("textfield7").value);

		}

}

		else

		{

			document.getElementById("textfield7").value = document.getElementById("textfield7Drop").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;

		}

	}

}









//* ======= Character counter for text area =======*/

function count(e, textarea, max, input) {

if (!e.which) keyCode = event.keyCode; // ie5+ op5+

else keyCode = e.which; // nn6+



if (textarea.value.length<max+1)

input.value =

max - textarea.value.length;



if (textarea.value.length>max-1)

{

document.getElementById("count").style.display = "none";

document.getElementById("countc").style.display = "none";

}



if (textarea.value.length<max+0)

{

document.getElementById("countc").style.display = "block";

document.getElementById("count").style.display = "none";

}



else {

textarea.value =

textarea.value.substring(0,max);

input.value = 0;

document.getElementById("count").style.display = "block";

return false;

}

}
