// JavaScript Document
function clok(){
	now = new Date();
	var minutes;
	if(now.getMinutes()<10){
		minutes="0"+now.getMinutes();
	} else {
		minutes=now.getMinutes();
	}
	Time_now=now.getHours()+":"+minutes;
	$('time_num').innerHTML=Time_now;
	setTimeout("clok()",100);
}
var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i
function trim(str)
{
   var re1 = /^\s*/;
   var re2 = /\s*$/;
   return str.replace(re1, "").replace(re2, "");
} 
function checkmail(e){
var returnval=emailfilter.test(e.value)
return returnval
}
function check_input(e) {
if (trim(e.myname.value)=="") {
    alert("Введите Ваше имя!")
    e.myname.select()
    return false;
}
if (!checkmail(e.myemail)) {
    alert("Введите верный e-mail!")
    e.myemail.select()
    return false;
}
if (trim(e.mytema.value)=="") {
    alert("Введите тему сообщения!")
    e.mytema.select()
    return false;
}
if (trim(e.textarea.value)=="") {
    alert("Введите текст!")
    e.textarea.select()
    return false;
}
return true;
}
var highlightcolor="lightyellow"
var ns6=document.getElementById&&!document.all
var previous=''
var eventobj
//Regular expression to highlight only form elements
var intended=/INPUT|TEXTAREA|SELECT|OPTION/
//Function to check whether element clicked is form element
function checkel(which){
if (which.style&&intended.test(which.tagName)){
if (ns6&&eventobj.nodeType==3)
eventobj=eventobj.parentNode.parentNode
return true
}
else
return false
}
//Function to highlight form element
function highlight(e){
eventobj=ns6? e.target : event.srcElement
if (previous!=''){
if (checkel(previous))
previous.style.backgroundColor=''
previous=eventobj
if (checkel(eventobj))
eventobj.style.backgroundColor=highlightcolor
}
else{
if (checkel(eventobj))
eventobj.style.backgroundColor=highlightcolor
previous=eventobj
}
}
