//a MUST before : <script language='JavaScript' src='/cookies.js'></script>

//-------------------------

//<p><a href="javascript:E_Me('a','s','k','','','','','','','Ask');"><img src="./images/mail_ask.gif" /></a></p>
function E_Me(c1,c2,c3,c4,c5,c6,c7,c8,c9,subj) 	
{
	strAdds = new Array(c1,c2,c3,c4,c5,c6,c7,c8,c9);
	strUser = "";
	strMailTo = "";
	for (x=0;x<strAdds.length;x++) {
		if (strAdds[x]!=null)
			strUser += strAdds[x];
	}
	//alert("mai"+"lto:"+strUser+"@"+"inbox"+"."+ "ru");
	strMailTo = "mai"+"lto:"+strUser+"@"+"inbox"+"."+ "ru?subject=" + subj;
	document.location = strMailTo;
}

function popup(wndName, url, width, height) 
{
// <a href="javascript:popup('','/demo/flash_demo.html','770','580');" >On-line демо ролик (flash)</a>
   var position='left='+(window.screen.availWidth-width)/2+',top='+(window.screen.availHeight-height)/2+',width='+width+',height='+height;
   var thewnd=window.open(url,'',position + ',resizable=1,scrollbars=1,status=1');
   thewnd.focus();
}


function RecallSearch()
{
//alert(GetCookieValueByName(document.forms[0].elements['productname'].value));

if (CookieValueByNameExists("productname")) { 
//  alert(GetCookieValueByName("productname"));
  document.forms['search'].elements['productname'].value=decodeURI(GetCookieValueByName("productname"));
}
if (CookieValueByNameExists("country")) { 
  document.forms['search'].elements['country'].value=GetCookieValueByName("country");
}
if (CookieValueByNameExists("metro")) { 
  document.forms['search'].elements['metro'].value=GetCookieValueByName("metro");
}
if (CookieValueByNameExists("district")) { 
  document.forms['search'].elements['district'].value=GetCookieValueByName("district");
}

  document.forms['search'].elements['productname'].focus();

}

// --- ---

function MetroKeyPress()
{
if (window.event.keyCode==27)
  document.forms['search'].elements['metro'].value=0;
}
function Set_metro(value)
{
if (value!=0) 
   document.forms['search'].elements['district'].value=0;
}
function Set_district(value)
{
if (value!='0') 
  document.forms['search'].elements['metro'].value=0;
}
function Submit()
{
if (document.forms['search'].elements['productname'].value.length<3)
{
  alert("Поле ввода 'Названия' должно иметь не менее 3-х символов !");
  document.forms['search'].elements['productname'].focus();  
  return false; 
}                                               
if (document.forms['search'].elements['country'].value.length>0 &&
    document.forms['search'].elements['country'].value.length<3)
{
    alert("Поле ввода 'Страны' должно иметь не менее 3-х символов или быть пустым !");
    document.forms['search'].elements['country'].focus();
    return false;                                                       
}
return true;
}

// ---  ---


