function getEl(el) {
 if(document.getElementById(el))
   return document.getElementById(el);
 else
   return false;
}


function isValidEmail (email) {
	return (/^([a-z0-9_\-]+\.)*[a-z0-9_\-]+@([a-z0-9][a-z0-9\-]*[a-z0-9]\.)+[a-z]{2,4}$/i).test(email);
}


function focusON (frm, thisname) { if ((frm.value == thisname) && (frm.defaultValue == thisname)) frm.value = ''; }
function focusOFF (frm, thisname) { if ((frm.value == '') && (frm.defaultValue == thisname)) frm.value = thisname; }

function pFocusON (obj) {
 obj.style.backgroundImage = '';
 obj.className = 'inputPasswordOn';
}

function pFocusOFF (obj) {
 obj.style.backgroundImage = 'url(\'/site/img/pss.gif\')';
 obj.style.backgroundRepeat = 'no-repeat';
}

function CheckForm()
{
  titles = ["Ваше имя", "Ваш e-mail", "Сообщение"];
  for(i=0; i<3; i++)
  {
   if((document.contacts.elements[i].value=="") && (titles[i] != "") )
    {
      alert("Вы не ввели "+titles[i]+"!");
      document.contacts.elements[i].focus();
      return false;
    }

  }
  document.contacts.submit();
}

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

sfHover = function() {
	var sfEls = document.getElementById("topmenu").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" hover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" hover"), "");
		}
	}
}

