function check_mess(val) {
  if (val == "contacts") {    
// check form fields from file send-message.php in dental.bg/za_nas/
//================================
// Objects
	name = document.forms["f1"].elements["name"];
	email = document.forms["f1"].elements["email"];
	message = document.forms["f1"].elements["message"];
	
	// Proverka za validnost na email
	if (name.value == "") {
				alert("The name field is empty!");
				name.focus();
	            return false;
	}	
	if (email.value == "") {
				alert("The email field is empty!");
				email.focus();
	            return false;
	}
	if (message.value == "") {
				alert("The message field is empty!");
				email.focus();
	            return false;
	}		
	if (email.value != "") {
	          m = email.value;
	          atPos = m.indexOf("@",1);
	          if (atPos == -1) {
              	alert("You have specified a wrong email address.");
	              email.focus();
	              return false;
	             	}
	           if (m.indexOf("@",atPos+1) > -1) {
	              alert("You have specified a wrong email address.");
	              email.focus();
	              return false;
		           }
	          periodpos = m.indexOf(".", atPos);
         	          if (periodpos == -1) {
	          	alert("You have specified a wrong email address.");
              	email.focus();
	              return false;
	             }
	          if (periodpos+3 > m.length) {
              	alert("You have specified a wrong email address.");
	              email.focus();
	              return false;
             		}
       	}
// end of the check of fields from contacts	
}
return true;
}


function send_mess(val) {
                if (check_mess(val)) {
		document.forms["f1"].elements["send_it"].value = "ok";
		document.forms["f1"].submit();
                }
}


function showShopMess() {
  var wwidth = window.getScrollWidth();
  wwidth = (wwidth - 500) / 2;

  $('product-add-ok').setStyle('left', wwidth);
  $('product-add-ok').setStyle('background-color', '#ffffff');
  $('product-add-ok').setStyle('opacity', 0);
  $('product-add-ok').setStyle('display', 'block');
 
  effectOK.start(0, 1);
  //var t = setTimeout('hideShopMess();', 1500);
}

function hideShopMess() {
  effectOK.start(1,0);
}

var effectOK;
window.addEvent('domready', function(){
    effectOK = new Fx.Style($('product-add-ok'), 'opacity', {duration:700});
})