function clear_field(field)
{
   if (field.value==field.defaultValue)
   {
       field.value=''
   }
}

function check_field(field)
{
   if (field.value=='' ||
   field.value==' ')
   {
       field.value=field.defaultValue
   }
}

  function Hlop() { 
    var trademark = "Выберите марку интересующего Вас производителя. Если выбор не будет сделан, Вы увидите товары всех производителей.";
    var typedress = "Выберите интересующий тип одежды. Если выбор не будет сделан, Вы увидите товары всех типов одежды.";
	var sex = "Выберите интересующую принадлежность товара по половому признаку. Если выбор не будет слен вы увидите товары всех полов.";
	
	if (document.getElementById('trademark').innerHTML == '') {
	  document.getElementById('trademark').innerHTML = trademark;
	  document.getElementById('typedress').innerHTML = typedress;
	  document.getElementById('sex').innerHTML = sex;
	} else {
	  document.getElementById('trademark').innerHTML = "";
	  document.getElementById('typedress').innerHTML = "";
	  document.getElementById('sex').innerHTML = "";	
	}
  }
  
  function RegClear() {
      document.regform.fio.defaultValue = "Фамилия Имя Отчество";
	  document.regform.fio.value = document.reg_form.fio.defaultValue;
      document.regform.contact_phone.defaultValue = "Контактный телефон";
	  document.regform.contact_phone.value = document.reg_form.contact_phone.defaultValue;
      document.regform.contact_email.defaultValue = "Контаткный email";
	  document.regform.contact_email.value = document.reg_form.contact_email.defaultValue;
      document.regform.contact_icq.defaultValue = "Контактный ICQ";
	  document.regform.contact_icq.value = document.reg_form.contact_icq.defaultValue;
      document.regform.firm.defaultValue = "Ваша фирма";
	  document.regform.firm.value = document.reg_form.firm.defaultValue;
      document.regform.login.value = "";
      document.regform.password.value = "";
      document.regform.repassword.value = "";   
  }
  

  function setCookie(name, value, expires, path, domain, secure) {
        var curCookie = name + "=" + escape(value) +
                ((expires) ? "; expires=" + expires.toGMTString() : "") +
                ((path) ? "; path=" + path : "") +
                ((domain) ? "; domain=" + domain : "") +
                ((secure) ? "; secure" : "")
        document.cookie = curCookie;
        alert("Товар в корзину добавлен!");              
  }

  
  function BuyItem(id_catalog) {

       var vol = document.getElementById("vol_"+id_catalog).value;
       var meas = document.getElementById("meas_"+id_catalog).value;
       if (isNaN(document.getElementById("vol_"+id_catalog).value)) {
	    alert("Не введено значение поля колличество!");
		return;
	  }
       var CookieValue = vol+";"+meas;
	   var endDate = new Date(); 
       endDate.setSeconds(36000); 

       setCookie("CAT:"+id_catalog, CookieValue, endDate, "/")
  }
  
  function OrderSubmit(subm) {
       document.orders.submitval.value = subm;
	   return document.orders.submit();
  }