pWidgetsFOID = new Object();
pWidgetsFTID = new Object();

function pWidgets(object, destOp, rate, delta){
if (!document.all)
return
    if (object != "[object]"){
        setTimeout("pWidgets("+object+","+destOp+","+rate+","+delta+")",0);
        return;
    }
        
    clearTimeout(pWidgetsFTID[object.sourceIndex]);
    
    diff = destOp-object.filters.alpha.opacity;
    direction = 1;
    if (object.filters.alpha.opacity > destOp){
        direction = -1;
    }
    delta=Math.min(direction*diff,delta);
    object.filters.alpha.opacity+=direction*delta;

    if (object.filters.alpha.opacity != destOp){
        pWidgetsFOID[object.sourceIndex]=object;
        pWidgetsFTID[object.sourceIndex]=setTimeout("pWidgets(pWidgetsFOID["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
    }
}

nWin = null;
function OpenWindow(link, w, h){
	if(nWin && !nWin.closed) nWin.close();
	var url = link;

	//--------------
	
 	if (self.screen) { // for NN4 and IE4
		width = screen.width
		height = screen.height
	}else if (self.java){ // for NN3 with enabled Java
		var jkit = java.awt.Toolkit.getDefaultToolkit();
		var scrsize = jkit.getScreenSize();
		width = scrsize.width;
		height = scrsize.height;
	}
	//--------------
	
	var top = (height - h) / 2;
	var left = (width - w) / 2;
	
  nWin = window.open(url, "OpenWindow", "width="+ w+", height="+h+", location=no,status=no,resizable=no,toolbar=no,scrollbars=yes,menubar=no,top="+top+",left="+left+"");
  nWin.focus();	
}

pWin = null;
function PrintWindow(link, w, h){
	if(pWin && !pWin.closed) pWin.close();
	var url = link;

	//--------------
	
 	if (self.screen) { // for NN4 and IE4
		width = screen.width
		height = screen.height
	}else if (self.java){ // for NN3 with enabled Java
		var jkit = java.awt.Toolkit.getDefaultToolkit();
		var scrsize = jkit.getScreenSize();
		width = scrsize.width;
		height = scrsize.height;
	}
	//--------------
	
	var top = (height - h) / 2;
	var left = (width - w) / 2;
	
  pWin = window.open(url, "PrintWindow", "width="+ w+", height="+h+", location=no,status=no,resizable=yes,toolbar=yes,scrollbars=yes,menubar=yes,top="+top+",left="+left+"");
  pWin.focus();	
}

function alertSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  window.alert( 'Width = ' + myWidth );
  window.alert( 'Height = ' + myHeight );
}

oWin = null;
function open_image(pic, w, h){
	if(oWin && !oWin.closed) oWin.close();
		
	var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }	
	
	
  if ((w == '') || (h == "")){
    w = 300; h = 150;
  }
  if (pic == "") pic = "<b>Нет картинки</b>";
  else pic = '<img src="'+path + pic +'" onclick="self.close();" title="close">';
  oWin = window.open("", "PictureWindow", "width=" + w + ",height=" + h + ",resizable=no,status=no,toolbar=no,menubar=no,top="+((myHeight-h)/2)+",left="+((myWidth-w)/2));
  with(oWin.document){
    open();// Для порядку - сначала откроем документ на запись
    write('<html><body style="margin:0px;padding:0px">');
    write(pic + '</body></html>');
    close(); // Вы не закрываете документ -- поэтому в следующий раз
             // новое содержимое дописывается в конец
  }
  oWin.focus();
}   

function loadHTML(sURL){
  var request=null;
  if(!request)try{
    request=new ActiveXObject('Msxml2.XMLHTTP');
  }catch (e){}
  
  if(!request) try {
    request=new ActiveXObject('Microsoft.XMLHTTP');
  } catch (e){}
  
  if(!request) try {
    request=new XMLHttpRequest();
  } catch (e){}

  if(!request) return ""; 

  request.open('GET', sURL, false);
  request.send(null);
  return request.responseText;
}


cWin = null;
function print_layer(layer, w, h){
	if(cWin && !cWin.closed) cWin.close();
	
	var data = document.getElementById(layer).innerHTML;
	cWin = window.open("", "ImageWindow", "width="+ w+", height="+h+", location=no,status=no,resizable=no,toolbar=no,scrollbars=no,menubar=no,top=100,left=100");
  with(cWin.document){
    open();// Для порядку - сначала откроем документ на запись
    write('<html><head><title>PRINT</title><link rel="stylesheet" type="text/css" href="'+path+'style.css"></head><body style="margin:0px;padding:10px">');
    write(data+'</body></html>');
    close();
  }
  cWin.focus();
  self.setTimeout('cWin.print()', 500);
}


function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
} 

