wW = 450;
wH = 550;
var nn4 = (document.layers) ? true:false;
var ie4 = (document.all) ? true:false;
function wopen(url) {
   if (nn4) {
       var wndTmp = window.open(url, "windowCldr","width=470,height=580,resizable=0,menubar=0,titlebar=0,toolbar=0,location=0,status=0,scrollbars=1");
   } else 
   if (false) {
       var strResult = window.showModalDialog(url,"","dialogWidth:470px; dialogHeight:580px; center:yes; status:no");
   } else {
       var wind = window.open(url, "newwindow", config="width=470, height=580, toolbar=0, location=0, directories=0, status=1, menubar=0, scrollbars=0, resizable=0"); 
   }
}
function wopen1(url) {
   if (nn4) {
       var wndTmp = window.open(url, "windowCldr","width=540,height=580,resizable=0,menubar=0,titlebar=0,toolbar=0,location=0,status=0,scrollbars=1");
   } else 
   if (false) {
       var strResult = window.showModalDialog(url,"","dialogWidth:540px; dialogHeight:580px; center:yes; status:no");
   } else {
       var wind = window.open(url, "newwindow", config="width=540, height=580, toolbar=0, location=0, directories=0, status=1, menubar=0, scrollbars=1, resizable=0"); 
   }
}

h=-1;
obh=Array();
ishshow=Array();
isplay=false;
function showHead(obj,ishsh) {
    if(h==-1) h = obh[obj];
    if(!obh[obj]) { 
        obh[obj] = getObjectHeight(obj);
        if(obh[obj]<10) obh[obj] = 250;
        h = 2;
    }
    if(!ishshow[obj]) {
        ishshow[obj] = ishsh;
    }    
    isplay=true;
    if(ishshow[obj]===0) {
         h+=Math.round((obh[obj]-h)/3)+1;
         if(h>=obh[obj]) {
             h = obh[obj];
             ishshow[obj] = 1;
             isplay = false;
             if(document.getElementById(obj + '_im')) document.getElementById(obj + '_im').src = '/img/w_minus.gif';
         }
         if(document.getElementById(obj)) document.getElementById(obj).style.height = h;   
         //alert(h);
    } else
    if(ishshow[obj]===1) {
         h-=Math.round(h/3)+1;
         if(h<=2) {
             h = 2;
             ishshow[obj] = 0;
             isplay = false;
             if(document.getElementById(obj + '_im')) document.getElementById(obj + '_im').src = '/img/w_plus.gif';
         }
         if(document.getElementById(obj)) document.getElementById(obj).style.height = h;
    }
    if (isplay) setTimeout('showHead("'+obj+'",'+ishsh+')',50);
}

sr_s = 1;
function sr_swap() {
     if(sr_s==1) {
     
         if(document.getElementById("sr_ttl1")) document.getElementById("sr_ttl1").innerHTML = '<font>Ïîèñê&nbsp;ïî&nbsp;ñàéòó</font>';
         if(document.getElementById("sr_ttl2")) document.getElementById("sr_ttl2").innerHTML = '<a href="#" onClick="sr_swap(); return false;">Îáúÿâëåíèÿ&nbsp;î&nbsp;ïðîäàæå</a>';
         if(document.getElementById("sr_body1")) document.getElementById("sr_body1").style.display = 'none';
         if(document.getElementById("sr_body2")) document.getElementById("sr_body2").style.display = 'block';
         sr_s=2;
         
     } else
     if(sr_s==2) {
     
         if(document.getElementById("sr_ttl1")) document.getElementById("sr_ttl1").innerHTML = '<font>Îáúÿâëåíèÿ&nbsp;î&nbsp;ïðîäàæå</font>';
         if(document.getElementById("sr_ttl2")) document.getElementById("sr_ttl2").innerHTML = '<a href="#" onClick="sr_swap(); return false;">Ïîèñê&nbsp;ïî&nbsp;ñàéòó</a>';
         if(document.getElementById("sr_body2")) document.getElementById("sr_body2").style.display = 'none';
         if(document.getElementById("sr_body1")) document.getElementById("sr_body1").style.display = 'block';
         sr_s=1;
         
     }
}


function StrDecode(str) {
    var ar1 = Array("à","á","â","ã","ä","å","¸","æ","ç","è","é","ê","ë","ì","í","î","ï","ð","ñ","ò","ó","ô","õ","ö","÷","ø","ù","ú","û","ü","ý","þ","ÿ","À","Á","Â","Ã","Ä","Å","¨","Æ","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×","Ø","Ù","Ú","Û","Ü","Ý","Þ","ß");
    var ar2 = Array("%E0","%E1","%E2","%E3","%E4","%E5","%B8","%E6","%E7","%E8","%E9","%EA","%EB","%EC","%ED","%EE","%EF","%F0","%F1","%F2","%F3","%F4","%F5","%F6","%F7","%F8","%F9","%FA","%FB","%FC","%FD","%FE","%FF","%C0","%C1","%C2","%C3","%C4","%C5","%A8","%C6","%C7","%C8","%C9","%CA","%CB","%CC","%CD","%CE","%CF","%D0","%D1","%D2","%D3","%D4","%D5","%D6","%D7","%D8","%D9","%DA","%DB","%DC","%DD","%DE","%DF");
 
    buf1 = str;
    for(var k=0; k<ar2.length; k++){
        var i = buf1.indexOf(ar2[k]);
        while(i>-1){
            buf1 = buf1.replace(ar2[k], ar1[k]);
            i = buf1.indexOf(ar2[k],i);
        }
    }    
    return buf1;
}

function getXmlHttpObject() {
    var XMLHttp = null;
    if(window.XMLHttpRequest) {
       try {
          XMLHttp = new XMLHttpRequest();
       } catch (e) {}
    } else if(window.ActiveXObject) {
       try {
          XMLHttp = new ActiveXObject("Msxml2.XMLHTTP");
       } catch (e) {
          try {
             XMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
          } catch (e) {}
       }
    }
    return XMLHttp;
}

function SearchW(obj,v,t) { 
    if(document.getElementById(obj) && v.length>0) {
    if(xmlhttpobj) xmlhttpobj.abort();  
    var xmlhttpobj = getXmlHttpObject();
    xmlhttpobj.open("GET","/mod/getmd.php?t=" + t + "&q=" + v);
    xmlhttpobj.onreadystatechange = function() {
       if(xmlhttpobj.readyState == 4) {
             var rtext = Array();
             rtext = StrDecode(xmlhttpobj.responseText).split("\n"); 
             obj = document.getElementById(obj);
             if(rtext.length > 0) {
                while (obj.childNodes.length) {
                    obj.removeChild(obj.firstChild);
                } 
                obj.options[0]= new Option('- Âñå ìîäåëè -','0');
                for(i=0;i<rtext.length-1;i++) {
                    rtext1 = rtext[i].split("#"); 
                    obj.options[i+1]= new Option(rtext1[1],rtext1[0]);
                }
             }
       }       
    }
    xmlhttpobj.send(null);    
    }
}



