
var image_over="images/left_menu_over.gif";
var image_norm="images/left_menu_normal.gif";

function get_win(cmd)
{
 window.open(cmd,'',config='status=0,scrollbars=1,location=0,resizable=1,width=350,height=383,left='+(screen.width-350)/2+',top='+(screen.height-350)/2);
}

function on_resize_evt()
{

 //left_margin = (document.body.clientWidth-760)/2;
 left_margin = 0;

 base_x=280;

 if(left_margin<0)
  x=base_x;
 else
  x=base_x+left_margin;

 newx=x+27;
 newx1=x+92;

 document.getElementById('SerContainer').style.left=newx+'px';
 document.getElementById('ProdContainer').style.left=newx1+'px';

}

function td_cell_over(cell_id) {
 eval('document.getElementById("'+cell_id+'").style.backgroundImage="url('+image_over+')"');
 eval('document.getElementById("'+cell_id+'").style.cursor="hand"');
}

function td_cell_out(cell_id) {
 eval('document.getElementById("'+cell_id+'").style.backgroundImage="url('+image_norm+')"');
 eval('document.getElementById("'+cell_id+'").style.cursor="normal"');
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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 MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function blinker(row_id,url) {
  blinker_sub1(row_id);
  window.setTimeout("blinker_sub2('"+row_id+"','"+url+"');",50);
}

function blinker_sub1(row_id) {
  document.getElementById(row_id).style.backgroundColor='#57A506'; document.getElementById(row_id).style.border='1px solid rgb(87,165,6)';
}

function blinker_sub2(row_id,url) {
  document.getElementById(row_id).style.backgroundColor='#355676'; document.getElementById(row_id).style.border='1px solid rgb(53,86,118)';
  window.setTimeout("blinker_sub1('"+row_id+"');",50);
  window.setTimeout("document.location='"+url+"'",150);
}

function layerd(layerName)
{
	//DOM1
  	if(document.getElementById) return document.getElementById(layerName)
 	//MSIE4
  	if(document.all) return document.all[layerName]
 	//Netscape 4
  	if(document.layers) return document.layers[layerName]
 	//неподдерживаемый браузер
  	return null
}

function AttentionSet(val)
{
	layerd(val).innerHTML = '<IMG src="/admin/images/AttentionSmall.jpg" alt="Не заполнено">';
}
	
function AttentionUnSet(val)
{
	layerd(val).innerHTML = '';
}

function GetRecursiveOffsetY(object, offset){ 
     
    if(object.parentNode){ 
         if((object.nodeName != "FORM") && (object.nodeName != "TR") && (object.nodeName != "THEAD") && (object.nodeName != "TBODY")){ 
             //a += object.nodeName+" -> "+object.offsetTop+"\n"; 
             offset += object.offsetTop  
         } 
         return GetRecursiveOffsetY(object.parentNode, offset); 
    } else { 
        //alert(a); 
        return offset;   
    } 
} 

function GetRecursiveOffsetX(object, offset){ 
     
    if(object.parentNode){ 
         if((object.nodeName != "FORM") && (object.nodeName != "TR") && (object.nodeName != "THEAD") && (object.nodeName != "TBODY")){ 
             //a += object.nodeName+" -> "+object.offsetLeft+"\n"; 
             offset += object.offsetLeft  
         } 
         return GetRecursiveOffsetX(object.parentNode, offset); 
    } else { 
        return offset;   
    } 
} 


