function showhide(id2)
{
	obj1 = document.getElementById(id2+"-head");
	if( obj1.className =="title" )
		obj1.className="title_active";
	else
		obj1.className="title";
	
	obj = document.getElementById(id2);
	if( obj.style.display == "block" )
		obj.style.display = "none";
	else
		obj.style.display = "block";
		
	return false;
}



{

function enlevespace(champ)
{
if (champ.charAt(0) == " ")
	{
	do {champ=champ.substr(1)}
	while (champ.charAt(0) == " ")
	}
return champ;
}



function dilerform(theForm)
{

	theForm.company.value = enlevespace(theForm.company.value);
	if (theForm.company.value == "") 
	{	alert("Пожалуйста введите название Организации.");
		theForm.company.focus();
		return (false);
	}
	
	theForm.city.value = enlevespace(theForm.city.value);
	if (theForm.city.value == "") 
	{	alert("Пожалуйста введите название города в котором находится Ваша Организация.");
		theForm.city.focus();
		return (false);
	}
	
	theForm.phone_fax.value = enlevespace(theForm.phone_fax.value);
	if (theForm.phone_fax.value == "") 
	{	alert("Пожалуйста введите номер офисного телефона/факса.");
		theForm.phone_fax.focus();
		return (false);
	}
	
	theForm.person.value = enlevespace(theForm.person.value);
	if (theForm.person.value == "") 
	{	alert("Пожалуйста введите номер офисного телефона/факса.");
		theForm.person.focus();
		return (false);
	}
	
	theForm.person_phone.value = enlevespace(theForm.person_phone.value);
	if (theForm.person_phone.value == "") 
	{	alert("Пожалуйста введите Имя контактного лица.");
		theForm.person_phone.focus();
		return (false);
	}
	
	theForm.person_phone.value = enlevespace(theForm.person_phone.value);
	if (theForm.person_phone.value == "") 
	{	alert("Пожалуйста введите Имя контактного лица.");
		theForm.person_phone.focus();
		return (false);
	}
	
	theForm.email.value = enlevespace(theForm.email.value);
	if (theForm.email.value == "") {alert("Пожалуйста введите email"); theForm.email.focus(); return (false); }
	else {
		var str=theForm.email.value
 		var expregmail=/^.+@.+\..{2,3}$/
 		if (expregmail.test(str))
 		{}
 		else { alert("email не соответствует формату.");	theForm.email.focus(); return false;}
 		if (theForm.email.value.indexOf("'") !== -1) { alert("Пожалуйста не пишите посторонние символы в поле \"электронная почта\"."); theForm.email.focus(); return (false); }
	}

	theForm.focus();
	return(true);
}



function usedaddform(theForm)
{

theForm.name.style.backgroundColor='#fff';
theForm.desc.style.backgroundColor='#fff';
theForm.price.style.backgroundColor='#fff';
theForm.firm.style.backgroundColor='#fff';
theForm.person.style.backgroundColor='#fff';
theForm.phone.style.backgroundColor='#fff';
theForm.email.style.backgroundColor='#fff';
theForm.city.style.backgroundColor='#fff';
theForm.code.style.backgroundColor='#fff';

	theForm.name.value = enlevespace(theForm.name.value);
	if (theForm.name.value == "") 
	{	alert("Пожалуйста введите полное наименование оборудования.");
        theForm.name.style.backgroundColor='#ffcccc';
		theForm.name.focus();
		return (false);
	}

	theForm.desc.value = enlevespace(theForm.desc.value);
	if (theForm.desc.value == "") 
	{	alert("Пожалуйста введите описание оборудования.");
        theForm.desc.style.backgroundColor='#ffcccc';
		theForm.desc.focus();
		return (false);
	}

	theForm.price.value = enlevespace(theForm.price.value);
	if (theForm.price.value == "") 
	{	alert("Пожалуйста введите Вашу цену.");
        theForm.price.style.backgroundColor='#ffcccc';
		theForm.price.focus();
		return (false);
	}

	theForm.firm.value = enlevespace(theForm.firm.value);
	if (theForm.firm.value == "") 
	{	alert("Пожалуйста введите название Вашей организации.");
        theForm.firm.style.backgroundColor='#ffcccc';
		theForm.firm.focus();
		return (false);
	}
	
	theForm.person.value = enlevespace(theForm.person.value);
	if (theForm.person.value == "") 
	{	alert("Пожалуйста введите имя контактного лица.");
        theForm.person.style.backgroundColor='#ffcccc';
		theForm.person.focus();
		return (false);
	}

	theForm.phone.value = enlevespace(theForm.phone.value);
	if (theForm.phone.value == "") 
	{	alert("Пожалуйста введите номер телефона для связи с Вами.");
        theForm.phone.style.backgroundColor='#ffcccc';
		theForm.phone.focus();
		return (false);
	}

	
	theForm.email.value = enlevespace(theForm.email.value);
	if (theForm.email.value == "") {alert("Пожалуйста введите email"); theForm.email.style.backgroundColor='#ffcccc'; theForm.email.focus(); return (false); }
	else {
		var str=theForm.email.value
 		var expregmail=/^.+@.+\..{2,3}$/
 		if (expregmail.test(str))
 		{}
 		else { alert("email не соответствует формату."); theForm.email.style.backgroundColor='#ffcccc'; theForm.email.focus(); return false;}
 		if (theForm.email.value.indexOf("'") !== -1) { alert("Пожалуйста не пишите посторонние символы в поле \"электронная почта\"."); theForm.email.style.backgroundColor='#ffcccc'; theForm.email.focus(); return (false); }
	}


	theForm.city.value = enlevespace(theForm.city.value);
	if (theForm.city.value == "") 
	{	alert("Пожалуйста введите название города в котором находится Ваша Организация.");
        theForm.city.style.backgroundColor='#ffcccc';
		theForm.city.focus();
		return (false);
	}


	theForm.code.value = enlevespace(theForm.code.value);
	if (theForm.code.value == "") 
	{	alert("Пожалуйста введите защитный код, проверьте на соответствие введенного кода и кода на картинке.");
        theForm.code.style.backgroundColor='#ffcccc';
		theForm.code.focus();
		return (false);
	}

	theForm.focus();
	return(true);
}

}