function $(obj){return document.getElementById(obj);}
window.onresize=res;

var ua = navigator.userAgent.toLowerCase();
isIE = (ua.indexOf("msie") != -1 && ua.indexOf("opera") == -1);
isOpera = (ua.indexOf("opera") != -1);
isGecko = (ua.indexOf("gecko") != -1);
isSafari = (ua.indexOf("safari") != -1);
isKonqueror = (ua.indexOf("konqueror") != -1);

//SCREEN RESOLUTION
function res(){
if($('left')){h=$('left').offsetHeight;

h1=h-215;
h2=h-20;
}
else {h=screen.height;
h1=h-420;
h2=h-215;
}
if(h>0){
if(h<567){$('left').style.height=567;h=567;
h1=h-215;
h2=h-20;}
if(a!=1)w=678;
else w=440;
$('main').style.width=w;
$('main_title').style.width=w;

width=screen.width;
$('top').style.width=width-22;
if($('top').offsetWidth<200)$('top').style.width=990;

if(isIE)h1+=20;
$('main').style.height=h1;
$('main').style.minHeight=h1;

$('foother').style.top=h2;
}
ttt=setTimeout("res()",10);

}

function send(){
if($('u_name').value==''){$('u_namex').style.display='inline'; return false;}
mailch = $('u_mail').value.split("@");
mailch=mailch.length;
mailch1=$('u_mail').value.split(".");
mailch1=mailch1.length;
if(mailch!=2 || mailch1<2){$('u_mailx').style.display='inline'; return false;}
if($('u_text').value==''){$('u_textx').style.display='inline'; return false;}
temp=$('mail_main').innerHTML;
u_name=$('u_name').value;
u_mail=$('u_mail').value;
u_text=$('u_text').value;
$('mail_main').innerHTML="<div class='h100px'></div><div class='msg_tit'>ՈՒՂԱՐԿԵԼ ՀԱՂՈՐԴԱԳՐՈՒԹՅՈՒՆ</div><div id='mail_temp'><BR>ՈՒՂՂԱՐԿՎՈՒՄ Է...</div>";
JsHttpRequest.query(
      'mailsend.php?x='+Math.random(), 
      {
       'u_name': u_name,
       'u_mail': u_mail,
       'u_text': u_text
	   },
 
     function(result, errors) {
    if(result=='Ok'){$('mail_temp').innerHTML="<BR>Ձեր հաղորդագրությունը բարեհաջող ուղղարկված է:";}
	else {$('mail_temp').innerHTML="<BR>Ձեր հաղորդագրությունը ուղղարկված <b>չէ</b>, խնդրում ենք <a href='#' onclick='return_mail_form(); return false;' class='error'>վերադառնալ է փորձել կրկին:</a>";}
	}
    );

}
function return_mail_form(){
$('mail_main').innerHTML=temp;
}
function hiderr(id){
id1=id+'x';
$(id1).style.display='none';
$(id).focus();
}
function clear_mail(){
$('u_name').value='';$('u_mail').value='';$('u_text').value='';
}
function getposOffset(what, offsettype){
totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}