lb_objnum=0;mtn_loaded=0;
function find_object(id) {
    if (document.getElementById) { if (!(document.getElementById(id))) { return false; } return document.getElementById(id); } else return false; }
function find_handle(id) {
    if (document.getElementById) { if (!(document.getElementById(id))) { return false; } return document.getElementById(id).style; } else if (document.layers) return document.layers[id]; else if (document.all) return document.all[id].style; else return false; }
function mtn_ww() {
    return document.body.clientWidth; }
function mtn_dw() {
    if (plng=='lng'){return;}var dw=mtn_ww(); var b=find_handle('dw');
    if (b) { var cwd=b.width; if (dw<1000 && cwd!='100%') { b.width="100%"; } if (dw>=1000 && cwd=='100%') { b.width="1000px"; } } }

mtn_request=new Array();
mtn_request_c=0;
function xmlreq(url,fresp) { 
    r_c=mtn_request_c++; mtn_request[r_c] = new xmlhttp_request (url, fresp, r_c);return r_c; }
function xmlhttp_request (url, e, id) {
    this.target = document; this.url = url; this.id = id; this.event = e; this.xmlhttp = false; this.method = "GET"; this.doRequest(); }
xmlhttp_request.prototype.init_xmlhttp = function () {
    try { this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { this.xmlhttp = false; } } if (!this.xmlhttp && typeof XMLHttpRequest!='undefined') { this.xmlhttp = new XMLHttpRequest(); }
}
xmlhttp_request.prototype.doRequest = function () {
    if (!this.xmlhttp) { this.init_xmlhttp(); }
    //this.xmlhttp=false;
    var xworks=0;
    if (this.xmlhttp) {
        var o = this;
        xworks=1;
        try { o.xmlhttp.open(this.method, this.url, true); } catch(e) { xworks=0; }
        if (xworks==1) {
          o.xmlhttp.onreadystatechange = function() {
            if (o.xmlhttp.readyState==4) { 
              if (o.xmlhttp.status == 200) {
                o.response = o.xmlhttp.responseText; 
                if (o.response) { o.event(o.id,o); }
                else { var iid=(o.id && o.id=='sgy')?'sgy':o.id+1; lbf=find_object('lbf'); 
                       lbf.location=baseurl+o.url+'&iframe='+iid; }
                } } }
            o.xmlhttp.send(null);
        }
    }
    if (xworks==0) { var iid=(this.id && this.id=='sgy')?'sgy':this.id+1; lbf=find_object('lbf'); 
           lbf.location=baseurl+this.url+'&iframe='+iid; }
}

mtn_ehs=0;mtn_ehs2=0;mtn_ehsr=0;mtn_ehsr2=0;mtn_ehsch=0;hide_ehs=new Array("by","thssel","layt","layt2");hide_his=new Array();mtn_inres=false;

function mtn_ccbla() {
    var ds;if (mtn_ehs){var rz=find_handle('erz');var cl=find_handle('elayt');var e=find_object('epri');var f=document.sf; if(e&&cl&&f&&rz){ds=f.obj.value=='cd'?'none':'block'; cl.display=ds;rz.display=ds=='none'?'none':'inline';ds=find_object('epri'+f.obj.value);if(ds && ds.options.length!=e.options.length){for(var j=e.options.length;j>1;j--){e.remove(j);}for(j=1;j<=ds.options.length;j++){e.options[j]=new Option(ds.options[j-1].text,j);}}}}}

function mtn_ehsw2(sect) {
    if (mtn_ehsr2==1) { return; }
    if (mtn_ehs2==1 || mtn_ehsr2==2) {var l=find_handle('elayer2');if(mtn_ehs2){l.display='none';mtn_ehs2=0;}else{l.display='block';mtn_ehs2=1;mtn_ccbla();} return; }
    mtn_ehsr2=1;mtn_ehs2=1;var n=document.createElement("DIV");n.id="elayer2";n.innerHTML='loading'+"...";
    var trailer_id = sect;	
    var ib = find_object('wrapper'); if (ib) { 
    with(n.style){top=(sg_ofs(ib,"offsetTop")+20)+"px";left=(sg_ofs(ib,"offsetLeft")+205)+"px";position="absolute";zIndex="100";backgroundColor="#424242";padding="0 20px 20px 20px";}document.body.appendChild(n);xmlreq('trailer.php?id='+trailer_id,mtn_ehsx2); }}

function mtn_ehsx2(rid,o){
    var el=find_object('elayer2');if(el){el.innerHTML=decodeURIComponent(o.response);mtn_ehsr2=2;}}

function sg_ofs(r,attr) {
    var o=0; while(r) {o+=r[attr]; r=r.offsetParent; } return o;  }
