////////////////////////////////////////////////////////////
	
function its_empty (str_value){
	return (str_value == "" || str_value == null)
}

////////////////////////////////////////////////////////////
	
function invalid_email(email_address){
	if (email_address.length < 5)
		return true
	
	at_location  = email_address.indexOf("@");
	dot_location = email_address.lastIndexOf(".");
	
	if((at_location == 0)||(dot_location - at_location < 2)||(email_address.length - dot_location < 2))
		return true
	

	return false
}

////////////////////////////////////////////////////////////
	
function check_form(fb_form,lang) {
 var message = "";
 var return_code = true;
 	 
 if(its_empty(fb_form.regards.value) || its_empty(fb_form.fullname.value)){
 	 return_code = false;
 	 switch(lang){
 	 	 case "en": message += "Not all required fields filled out\n";break;
         case "ua": message += "Не заповнені обов'язкові поля форми!\n";break;
 	 	 case "ru": message += "Не заполнены обязательные поля формы!\n";break;	 	 	 
 	 }
 }	
 
 if(invalid_email(fb_form.email.value)){
 	 return_code = false;
 	 switch(lang){
 	 	 case "en": message += "Incorrect e-mail address!\n";break;
         case "ua": message += "Невірна адреса електронної пошти!\n";break;
 	 	 case "ru": message += "Неверный адрес электронной почты!\n";break; 	 	 	 
 	 }
 }	
 
 if(!return_code)
 	 alert(message);
 
 return return_code	 
}

////////////////////////////////////////////////////////////
	
function goto_pr() {
  select_box = document.pform.prlist;
  eval("parent.location='"+select_box.options[select_box.selectedIndex].value+"'");
  return false;
}

////////////////////////////////////////////////////////////

function im(path,tit){
 window.open('/handler/image.php?path='+path+'&ab='+tit,'','width=100, height=100, scrollbars=no');
}

////////////////////////////////////////////////////////////

function showHideLayers(pn)
{
  for(var i=1; i<=9; i++){
    d = document.getElementById('country'+i);
    if(d)
      d.style.visibility = 'hidden';
  }

   d = document.getElementById(pn);
   var d = document.getElementById(pn)

   if(d)
     d.style.visibility = 'visible';
}
