function intRandom() {
   return parseInt( ( Math.random() * 1000000 + 1 ) );
} // End function intRandom

loadCounter = 0;

// Определяет координату по оси X элемента
function getPosX( obj, relative ) {
   var currentX = obj.offsetLeft;
   while( (obj.offsetParent != null) ) {
      obj = obj.offsetParent;
      currentX += obj.offsetLeft;
   }
   return currentX;
}

// Определяет координату по оси Y элемента
function getPosY( obj, relative ) {
   var currentY = obj.offsetTop;
   while( (obj.offsetParent != null) && (obj.offsetParent != relative) ) {
      obj = obj.offsetParent;
      currentY += obj.offsetTop;
   }
   return currentY;
}

function OpenWin(pageUrl,nameWin,widthWin,heightWin,sbar) {
hScreen=screen.availHeight; wScreen=screen.availWidth;
if (widthWin||heightWin) { (widthWin>wScreen)?widthWin=wScreen-200:null; (heightWin>hScreen)?heightWin=hScreen-100:null; }
if (nameWin=="modal") {
	(widthWin)?null:widthWin=wScreen-200; (heightWin)?null:heightWin=hScreen-100;
	pWin="dialogWidth:"+widthWin+"px; "+"dialogHeight:"+heightWin+"px; center:1;help:0;"
	window.showModalDialog(pageUrl,"",pWin);
} else {
	(widthWin)?null:widthWin=wScreen-160; (heightWin)?null:heightWin=hScreen-200;
	xPos=(wScreen-widthWin)/2; yPos=(hScreen-heightWin)/2;
	(sbar)?null:sbar=1; (nameWin)?null:nameWin="wintxt";
	pWin="left="+xPos+",top="+yPos+",width="+widthWin+",height="+heightWin+",scrollbars="+sbar;
	window.open(pageUrl,nameWin,pWin); 
} 
}



function replace_specialchars(str) {
   str = str.replace(/&/g, '&amp;');
   str = str.replace(/"/g, '&quot;');
   str = str.replace(/'/g, '&#039;');
   str = str.replace(/</g, '&lt;');
   str = str.replace(/>/g, '&gt;');
   return str;
}


