function go(url,f_new_win){
if(!f_new_win) document.location=url;
else window.open(url);
}

function click()
{
fileObjectName = new File("testfile.txt");
result = fileObjectName.open("r+");  alert (result);
fileObjectName.close();
}

function addBookmark(url, title)
{
  if (!url) url = location.href;
  title ="Ежемесячный журнал о складе,погрузчиках,штабелерах,стеллажах,упаковке,...";

  //Gecko
  if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) window.sidebar.addPanel (title, url, "");
  //IE4+
  else if (typeof window.external == "object") window.external.AddFavorite(url, title);
  //Opera7+
  else if (window.opera && document.createElement)
  {
    alert('Чтобы добавить страницу в закладки нажмите CTRL+D');
/*    var a = document.createElement('A');
    if (!a) return false; //IF Opera 6
    a.setAttribute('href',url);
    a.setAttribute('title',title);
    a.setAttribute('rel','sidebar');
    a.click();*/
  }
  else return false;

  return true;
}

function change_value(){

//el =text1.s.value;if (el.indexOf("<",0)!=-1)
//{text1.s.value='спам';search_form1.action="/spam.php";search_form2.action="/spam.php";}
search_form1.s.value=text1.s.value;
search_form2.s.value=text1.s.value;
}

function CSFE(n,ly)
{
var curDoc = ly ? ly.document : document; var elem = curDoc[n];
if (!elem) { for (var i=0;i<curDoc.layers.length;i++) {
elem = CSFE(n,curDoc.layers[i]); if (elem) return elem; }}
return elem;
}

function CSURLPS(formName, popupName, target)
{
var form  = CSFE(formName);
var popup = form.elements[popupName];
window.open(popup.options[popup.selectedIndex].value, target);
popup.selectedIndex = 0;
}


function go(url){
//document.location=url;
window.open(url);
}
//***************************************************************
function ImageExpander(oThumb, sImgSrc)
{
		oThumb1=oThumb;
      var x = y = 0;
      while(oThumb1) {
            x += oThumb1.offsetLeft;
            y += oThumb1.offsetTop;
            oThumb1 = oThumb1.offsetParent;
      }

	this.oThumb = oThumb; 	// store thumbnail image and overwrite its onclick handler.
	this.smallWidth = oThumb.offsetWidth;	// record original size
	this.smallHeight = oThumb.offsetHeight;	
		this.tx = x;
		this.ty = y;
//		this.tx = oThumb.offsetLeft;
//		this.ty = oThumb.offsetTop;

// create the full sized image.
	this.oImg = new Image();
	this.oImg.expander = this;
	this.oImg.onload = function(){this.expander.onload();}
	this.oImg.src = sImgSrc;
}

ImageExpander.prototype.onload = function()
{
	this.oDiv = document.createElement("div");
	document.body.appendChild(this.oDiv);
	this.oDiv.appendChild(this.oImg);
	this.oDiv.style.position = "absolute";
	this.oDiv.expander = this;
	this.oDiv.onclick = function() {this.expander.toggle();};
	this.oImg.title = "Нажми чтобы восстановить";
	this.bigWidth = this.oImg.width;
	this.bigHeight = this.oImg.height;
	this.expand();
}

ImageExpander.prototype.toggle = function()
{
	this.bExpand = !this.bExpand;
	     for ( var i in window.aImageExpanders )
	         if ( window.aImageExpanders[i] !== this )	window.aImageExpanders[i].reduce();
}

ImageExpander.prototype.expand = function()
{
	this.bExpand = true;	// set direction of expansion.
// set all other images to reduce
	    for ( var i in window.aImageExpanders )
	        if ( window.aImageExpanders[i] !== this )	window.aImageExpanders[i].reduce();

	this.oThumb.style.visibility = "hidden";		// hide the thumbnail
// calculate initial dimensions
	this.x = this.tx;
	this.y = this.ty;
	this.w = this.oThumb.clientWidth;
	this.h = this.oThumb.clientHeight;
	
	this.oDiv.style.left = this.x + "px";
	this.oDiv.style.top = this.y + "px";
	this.oImg.style.width = this.w + "px";
	this.oImg.style.height = this.h + "px";
	this.oDiv.style.visibility = "visible";
	this.oImg.style.visibility = "visible";
	
// start the animation engine.
		this.bTicks = true;
		var pThis = this;
		window.setTimeout(function(){pThis.tick();},25);	
}

ImageExpander.prototype.tick = function()
{
// calculate screen dimensions

var cw = window.opera ? innerWidth : document.body.clientWidth;
var ch = window.opera ? innerHeight : document.body.clientHeight;
//	var cw = 'CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
//	var cw = document.body.clientWidth;
//	var ch = 'CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
//	var ch = document.body.clientHeight;
	var cx = document.documentElement.scrollLeft + cw / 2;
//	var cx = document.body.scrollLeft + cw / 2;
	var cy = document.documentElement.scrollTop + ch / 2;
//	var cy = document.body.scrollTop + ch / 2;
// calculate target
	var tw,th,tx,ty;
	if ( this.bExpand )	
	{
		tw = this.bigWidth; 
		th = this.bigHeight;
		if ( tw > cw ) { th *= cw / tw;	tw = cw;	}	
		if ( th > ch )  { tw *= ch / th;	th = ch;	}
		tx = cx - tw / 2;
		ty = cy - th / 2; 
	}
	else
	{
		tw = this.smallWidth;
		th = this.smallHeight;
		tx = this.tx;
		ty = this.ty;
	}	
// move 5% closer to target
	var nHit = 0;
	var fMove = function(n,tn) 
	{
		var dn = tn - n;
		if ( Math.abs(dn) < 0.5 ) { nHit++; return tn; }
		else return n + dn / 7;
	}
	this.x = fMove(this.x, tx);
	this.y = fMove(this.y, ty);
	this.w = fMove(this.w, tw);
	this.h = fMove(this.h, th);
	
	this.oDiv.style.left = this.x + "px";
	this.oDiv.style.top = this.y + "px";
	this.oImg.style.width = this.w + "px";
	this.oImg.style.height = this.h + "px";
// if reducing and size/position is a match, stop the tick	
	if ( !this.bExpand && (nHit == 4) )
	{
		this.oImg.style.visibility = "hidden";
		this.oDiv.style.visibility = "hidden";
		this.oThumb.style.visibility = "visible";

		this.bTicks = false;
	}
	if ( this.bTicks )
	{
		var pThis = this;
		window.setTimeout(function(){pThis.tick();},20);
	}
}
