function Showformimg(idgt){
        var nn4 = (document.layers)? true:false;
        var ie4 = true; //(document.all)? true:false;
        var strjmg = "loadimg.php?idload="+idgt;
    if (nn4) {
                var wndTmp = window.open(strjmg, "windowCldr","width=800,height=600,resizable=1,menubar=0,titlebar=0,toolbar=0,location=0,status=0,scrollbars=1");
        }
    else if (ie4) {
                var strResult = window.showModalDialog( strjmg ,"","dialogWidth:800px; dialogHeight:600px; center:yes; status:no; scrollbars:yes; resizable:yes");
                if (strResult==null) return;
                }
//                viewgtdimg=window.open('view_gtd_img.php?id='+id,'viewgtdimg','width=800,height=660,scrollbars=1,resizable=1');
}


function fncShowGtd(idgt){
        var nn4 = (document.layers)? true:false;
        var ie4 = true; //(document.all)? true:false;
        var strjmg = "loadimg.php?img="+idgt;

    if (nn4) {
                var wndTmp = window.open(strjmg, "windowCldr","width=800,height=600,resizable=1,menubar=0,titlebar=0,toolbar=1,location=0,status=0,scrollbars=1");
        }
    else if (ie4) {
                var strResult = window.open(strjmg, "", "status=no,location=no,toolbar=no,menubar=no,resizable=yes, scrollbars=yes,width=500,height=300"); 
                if (strResult==null) return;
                }
//                viewgtdimg=window.open('view_gtd_img.php?id='+id,'viewgtdimg','width=800,height=660,scrollbars=1,resizable=1');
}

function fncShowCalendardate_start( elname ){
        var nn4 = (document.layers)? true:false;
        var ie4 = true; //(document.all)? true:false;
        var curent_el;
    if (nn4) {
                var wndTmp = window.open("calendar.htm?field=date_from&form=FormOrder", "windowCldr","width=165,height=185,resizable=1,menubar=0,titlebar=0,toolbar=0,location=0,status=0,scrollbars=1");
        }
    else if (ie4) {
                var strResult = window.showModalDialog("calendar.htm","","dialogWidth:150px; dialogHeight:190px; center:yes; status:no");
                if (strResult==null) return;
                curent_el = self.document.getElementById(elname);
                curent_el.value = strResult;
                curent_el.focus();

                }
}


function showsels(){
        var s1, s2, s3, m;
        document.getElementById('sost').style.display='inline';
        document.getElementById('pls').style.display='inline';
        document.getElementById('mns').style.display='inline';
        m=document.saveform.n_max.value;
        for (i=0; i<m; i++){
                s1='sost'+i;
                s2='pls'+i;
                s3='mns'+i;
                document.getElementById(s1).style.display='inline';
                document.getElementById(s2).style.display='inline';
                document.getElementById(s3).style.display='inline';
        }
}

function hidesels(){
        var s1, s2, s3, m;
        document.getElementById('sost').style.display='none';
        document.getElementById('pls').style.display='none';
        document.getElementById('mns').style.display='none';
        m=document.saveform.n_max.value;
        for (i=0; i<m; i++){
                s1='sost'+i;
                s2='pls'+i;
                s3='mns'+i;
                document.getElementById(s1).style.display='none';
                document.getElementById(s2).style.display='none';
                document.getElementById(s3).style.display='none';
        }
}

function plusclick(){
        pl1=document.all.Layer1;
        pl1.style.visibility='visible';
        pl1.style.left=event.x+document.body.scrollLeft;
    pl1.style.top=event.y+document.body.scrollTop;
}

function plusclick1(){
        pl2=document.all.Layer2;
        pl2.style.visibility='visible';
        pl2.style.left=event.x+document.body.scrollLeft;
    pl2.style.top=event.y+document.body.scrollTop;
        hidesels();
}

function minusclick(el){
        pl1=document.all.Layer1d;
        pl1.style.visibility='visible';
        document.frmCond1.xflagd.value=document.getElementById(el).selectedIndex;
        pl1.style.left=event.x+document.body.scrollLeft;
    pl1.style.top=event.y+document.body.scrollTop;
}

function minusclick1(el){
        pl2=document.all.Layer2d;
        pl2.style.visibility='visible';
        document.frmGoods1.xflag1d.value=document.getElementById(el).selectedIndex;
        status=document.frmGoods1.xflag1d.value;
        pl2.style.left=event.x+document.body.scrollLeft;
    pl2.style.top=event.y+document.body.scrollTop;
        hidesels();
}

function showrows() {
        var s2, m;
        m=document.saveform.n_max.value;
        for (i=0; i<m; i++){
                s2='idrow['+i+']';
                document.getElementById(s2).style.display='inline';
        }
}

function hiderows() {
        var s1, s2, m;
        m=document.saveform.n_max.value;
        for (i=0; i<m; i++){
                s1='checkarh['+i+']';
                s2='idrow['+i+']';
                if (document.saveform.elements[s1].checked) document.getElementById(s2).style.display='none';
        }
}


function subformel(elcode,dcode) {
  var werq;
  werq=document.saveform.saveall_;
  werq.value=elcode;
  wrq=document.saveform.order;
  wrq.value=dcode;
  window.saveform.submit();
}

function update_current_addr() {
  n=window.fmail.elements['to[]'].selectedIndex;
  t=window.fmail.elements['to[]'][n].text;
  window.f1.elements['addr'].value=t;

}

function openlink(link){
 var w=500;
 var h=650;
 var l=(screen.width/2)-w/2;
 var t=(screen.height/2)-h/2;
 window.open(link, '', 'dependent=no, screenx='+l+',screeny='+t+', left='+l+',top='+t+', width='+w+', height='+h+' resizable=yes, scrollbars=yes, menubar=no, location=no, toolbar=no, status=no, titlebar=no', false);
}

function openlinkA(link){
 var w=600;
 var h=400;
 var l=(screen.width/2)-w/2;
 var t=(screen.height/2)-h/2;
 window.open(link, '', 'dependent=no, screenx='+l+',screeny='+t+', left='+l+',top='+t+', width='+w+', height='+h+' resizable=yes, scrollbars=yes, menubar=no, location=no, toolbar=no, status=no, titlebar=no', false);
}

function opennatb(){
 var w=450;
 var h=630;
 var l=(screen.width/2)-w/2;
 var t=(screen.height/2)-h/2;
 window.open('images/natb.jpg', '', 'dependent=no, screenx='+l+',screeny='+t+', left='+l+',top='+t+', width='+w+', height='+h+' resizable=yes, scrollbars=yes, menubar=no, location=no, toolbar=no, status=no, titlebar=no', false);
}

function subform(x) {
  window.saveform.act.value=x;
  window.saveform.submit();
}

function linksdet(x){
var lns, el, m, s, n;
lns=document.links.length;
for (i=0; i<lns; i++){
  el=document.links[i];
  s=el.href;
  if ((s!='')&&(el.id!='idan1')&&(el.id!='idan2')&&(el.id!='new2')&&(el.id!='new4')&&(el.id!='new5')&&(el.id!='new6')){
    m=s.indexOf('&det='); n=s.length;
    if (n>3) el.href=s.substring(0, m)+'&det='+x+s.substring(m+6, n);
  }
}
lns=document.forms.length;
for (i=0; i<lns; i++){
  el=document.forms[i];
  s=el.action;
  if (s!='' && s!='index.php'){
    m=s.indexOf('&det='); n=s.length;
    if (n>3) el.action=s.substring(0, m)+'&det='+x+s.substring(m+6, n);
  }
}
}

function detail(x) {
var el, i, j, k;
if (document.selform.chkdetail.checked){
  j="inline"; k=1;
  } else {
  j="none"; k=0;
  }
el=document.getElementById('id_pp_');
el.style.display=j;

for (i=0; i<x; i++){
  el=document.getElementById('id_pp['+i+']');
  el.style.display=j;
  }
el=document.getElementById('id_ppk');
el.style.display=j;
linksdet(k);
}

function detailA(x) {
var el, i, j, k;
if (document.selform.chkdetail.checked){
  j="inline"; k=1;
  } else {
  j="none"; k=0;
  }
el=document.getElementById('id_pp_');
el.style.display=j;
el=document.getElementById('id_pp_1');
el.style.display=j;
for (i=0; i<x; i++){
  el=document.getElementById('id_pp['+i+']');
  el.style.display=j;
  }
el=document.getElementById('id_ppk');
el.style.display=j;
linksdet(k);
}



