function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function FP_swapImg() {
 var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length;
 n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm;
 elm.$src=elm.src; elm.src=args[n+1]; } }
}

function FP_getObjectByID(id,o) {
 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
 else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
 if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
 for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }
 f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
 for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
 return null;
}

function PreloadImages(){
 MM_preloadImages('images/meniu_juost_pamirs_over.jpg', 'images/meniu_juost_reg_over.jpg', 'images/meniu_langelis_over.jpg');
}

function page(object) {
 var ob=object.options[object.selectedIndex].value;
 if(ob) {
  location.href=ob
 }
 return false;
}

function trim(str) {
 return str.replace(/^\s+|\s+$/g,'');
}

function valid_simbols(str) {
 var regexp = /[\`\~\!\@\#\$\%\^\&\*\(\)\-\_\+\=\\\|\[\]\{\}\;\:\'\"\/\?\.\>\<\[\]]/;
 if(!str.match(regexp)){
  return true;
 }else{
   return false;
 }
}

function valid_comment(str) {
 var regexp = /[\'\"\\]/;
 if(!str.match(regexp)){
  return true;
 }else{
   return false;
 }
}

function valid_email(str) {
 var regexp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
 if(str.match(regexp)){
  return true;
 }else{
  return false;
 }
}

function check_radio()
{
    var seksualumas = false;
    var foto_originalumas = false;
    var draugiskumas = false;

    for (i = 0; i < document.ivertink.seksualumas.length; i++)
    {
        if (document.ivertink.seksualumas[i].checked)
        seksualumas = true; 
    }

    for (i = 0; i < document.ivertink.foto_originalumas.length; i++)
    {
        if (document.ivertink.foto_originalumas[i].checked)
        foto_originalumas = true; 
    }

    for (i = 0; i < document.ivertink.draugiskumas.length; i++)
    {
        if (document.ivertink.draugiskumas[i].checked)
        draugiskumas = true; 
    }

    if ((!seksualumas) && (!foto_originalumas) &&  (!draugiskumas))
    {
        alert('Nepaþymëjai nei vieno laukelio!');
        return false;
    }
    return true;
}

function newwindow(url, plotis, aukstis){
 leftas=(screen.width)?(screen.width-plotis)/2:100;
 topas=(screen.height)?(screen.height-aukstis)/2:100;
 w = window.open(url, "", "toolbar=no, status=no, location=no, scrollbars=no, resizable=no, width="+plotis+", height="+aukstis+", top="+topas+", left="+leftas+"");
}

function hotchat(url, plotis, aukstis){
 leftas=(screen.width)?(screen.width-plotis)/2:100;
 topas=(screen.height)?(screen.height-aukstis)/2:100;
 w = window.open(url, "", "toolbar=no, status=no, location=no, scrollbars=yes, resizable=yes, width="+plotis+", height="+aukstis+", top="+topas+", left="+leftas+"");
}

// BEGIN popup zinutes ir draugavimo

var defaultMenuWidth="110px"
var ie5=document.all && !window.opera
var ns6=document.getElementById

if (ie5||ns6)
document.write('<div id="popitmenu" onMouseover="clearhidemenu();" onMouseout="dynamichide(event)"></div>')

function iecompattest(){
  return (document.compatMode && document.compatMode.indexOf("CSS")!=-1)? document.documentElement : document.body
}

function showmenu(e, which, sms, friend, optWidth){
  if(sms == false)
    return false
  if (!document.all&&!document.getElementById)
    return clearhidemenu()
  menuobj=ie5? document.all.popitmenu : document.getElementById("popitmenu")
  url1 = 'quick_message.php?whose='+which
  menuobj.innerHTML='<a href="javascript:newwindow(url1, 480, 150);">Siųsti greitąją žinutę</a>'
  if(friend == true){ 
    url2= 'add_friend.php?who='+which; 
    menuobj.innerHTML+='<a href="javascript:newwindow(url2, 480, 140);">Kviesti draugauti</a>'; 
  }
  menuobj.style.width=(typeof optWidth!="undefined")? optWidth : defaultMenuWidth
  menuobj.contentwidth=menuobj.offsetWidth
  menuobj.contentheight=menuobj.offsetHeight
  eventX=ie5? event.clientX : e.clientX
  eventY=ie5? event.clientY : e.clientY
  var rightedge=ie5? iecompattest().clientWidth-eventX : window.innerWidth-eventX
  var bottomedge=ie5? iecompattest().clientHeight-eventY : window.innerHeight-eventY
  if (rightedge<menuobj.contentwidth)
    menuobj.style.left=ie5? iecompattest().scrollLeft+eventX-menuobj.contentwidth+"px" : window.pageXOffset+eventX-menuobj.contentwidth+"px"
  else
    menuobj.style.left=ie5? iecompattest().scrollLeft+eventX+"px" : window.pageXOffset+eventX+"px"
  if (bottomedge<menuobj.contentheight)
    menuobj.style.top=ie5? iecompattest().scrollTop+eventY-menuobj.contentheight+"px" : window.pageYOffset+eventY-menuobj.contentheight+"px"
  else
    menuobj.style.top=ie5? iecompattest().scrollTop+event.clientY+"px" : window.pageYOffset+eventY+"px"
  delayshowmenu()
  return false
}

function contains_ns6(a, b){
  while (b.parentNode)
  if ((b = b.parentNode) == a)
    return true;
  return false;
}

function hidemenu(){
  if (window.menuobj)
    menuobj.style.visibility="hidden"
}

function show(){
  if (window.menuobj)
    menuobj.style.visibility="visible"
}

function dynamichide(e){
  if (ie5&&!menuobj.contains(e.toElement))
    delayhidemenu()
  else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
    delayhidemenu()
}

function delayhidemenu(){
  delayhide=setTimeout("hidemenu()",500)
}

function delayshowmenu(){
  delayshow1=setTimeout("show()",1000)
  document.onmouseout = clearhidemenu1
}

function clearhidemenu1(){
  if (window.delayshow1)
    clearTimeout(delayshow1)
}

function clearhidemenu(){
  if (window.delayhide)
    clearTimeout(delayhide)
}

if (ie5||ns6)
  document.onclick=hidemenu
  
// END
  
  