

if(navigator.appVersion.indexOf("MSIE 6")!=-1)
	window.onscroll=function (){
		document.getElementById("footer").style.top=Number(document.documentElement.scrollTop+document.documentElement.clientHeight-document.getElementById("footer").clientHeight)+"px";
	}

function _(_id){
	if(document.getElementById && document.getElementById(_id)) return document.getElementById(_id);
	else return null;
}


function addEvent(parent, ev, func){
	if (parent.attachEvent) parent.attachEvent('on'+ev, func);
	else parent.addEventListener(ev, func, true);
}


function init_mail(id){
	var mail=_(id).title+"@"+_(id).lang;
	_(id).href="mailto:"+mail;
	_(id).innerHTML=mail;
	_(id).title="";
}


var email_pattern=/^([A-Za-z0-9\-._]+)@([A-Za-z0-9\-._]+)\.([A-Za-z0-9]{2,3})$/;

function check_form(form){
	req=form.getElementsByTagName("*");
	for(i=0;i<req.length;i++){
		if(req[i].lang!="require") continue;
		req[i].focus();
		if(req[i].value=="" || req[i].value==req[i].def_value){
			alert("Mandatory fields are empty!");
			return false;
		}
		if(req[i].name=="email" && !email_pattern.test(req[i].value)){
			alert("Email is not valid!");
			return false;
		}
	}
	form.submit();
	return false;
}

function inpclear(obj){
	if(!obj.def_value){
		obj.def_value=obj.value;
		obj.onblur=function(){this.value=this.value || this.def_value}
	}
	if(obj.def_value==obj.value) obj.value="";
}

