isDOM=document.getElementById //DOM1 browser (MSIE 5+, Netscape 6, Opera 5+)
isOpera=isOpera5=window.opera && isDOM //Opera 5+
isOpera6=isOpera && window.print //Opera 6+
isOpera7=isOpera && document.readyState //Opera 7+
isMSIE=document.all && document.all.item && !isOpera //Microsoft Internet Explorer 4+
isMSIE5=isDOM && isMSIE //MSIE 5+
isNetscape4=document.layers //Netscape 4.*
isMozilla=isDOM && navigator.appName=="Netscape" //Mozilla или Netscape 6.*


var oldUrl = false;

function IE5opener(url,w,h){
	//w = Math.abs(w)+7; h = Math.abs(h)+27;
	
	scrollYes = ( w > screen.availWidth || h > screen.availHeight ) ? 1 : 0;
	addScrollbarWidth = (scrollYes) ? 17 : 0;
	w = (w > screen.availWidth) ? screen.availWidth - 40 : w + addScrollbarWidth;
	h = (h > screen.availHeight) ? screen.availHeight - 40 : h + addScrollbarWidth;
var ver =navigator.appVersion;
ver = ver.substring(ver.indexOf("MSIE")+5, ver.length);
ver = parseFloat(ver.substring(0, ver.indexOf(";")));
if(ver >=5){
	if((url != oldUrl)||(WinObj.closed)){
	WinObj = showModelessDialog(url, window, "help: no; status: no; scroll:"+
	scrollYes+"; resizable: on; dialogWidth:"+w+"px; dialogHeight:"+h+"px; margin: 0");
		oldUrl = url;
		}else{
		if(!WinObj.closed){WinObj.focus();}
		}
	}else{
	OtherOpener(url,w,h);
	}
}

function OtherOpener(url,w,h){
	w = w+18; h = h +26;
	d = new Date(); t = d.getTime();
	WinObj = window.open(url, t,"width="+w+",height="+h+",location=yes,status=yes,menubar=yes,toolbar=no,resizable=yes");
	return (WinObj!==null) ? false: true;
	}

function PopUp(url,w,h){
if( document.all ){
	IE5opener(url,w,h);
		}else{
		if(document.images){	OtherOpener(url,w,h);	}
		}
return false;
} 

var popupWin = null
function openImg(iURL,iW,iH,iTitle){
	if (popupWin && !popupWin.closed) {
		popupWin.close();
	}
	popupWin = open("", "PopupWin", "width=" + iW + ",height=" + iH);
	popupWin.document.write("<html><body bgcolor='#003399' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0' onClick=window.close();>");
 	popupWin.document.write("<img src='http://irk.sibirtelecom.sibnet.ru/img/" + iURL + "' border='0' vspace='0' hspace='0'></body></html>");
 	popupWin.document.close();
	popupWin.document.title = (iTitle == null) ? "" : iTitle;
}

function fullScreenOpen(url) {
 var Width = "";
 var Height = "";
 if (document.all) {
 Width = screen.availWidth; Height = screen.availHeight;
 var oWin = window.open("","fullwindow","left=0,top=0,width="+Width+",height="+Height+",scrollbars=auto,fullscreen=yes");
 oWin.location = url;
 } else {
 window.open(url,'fullwindow','menubar=no,status=no,location=no,scrollbars=auto,directories=no,resizable=yes,fullscreen=yes,alwaysRaised,dependent');
 }
 return false;
}

 function compareWin(elm){
 if(document.childNodes&&document.all){
 	WinObj = window.open(elm.href=elm.href+"&noframe=true","_search");
 	WinObj.offscreenBuffering=false;
 	return false;
 	}
 if(document.images){
 WinObj = window.open(elm.href=elm.href+"&self=close",null, "height=400,width=180,status=yes,toolbar=no,menubar=no,location=no,resizable=yes");
 	return false;
 	}
 return true;
 }

function doc(elm){
	if(document.getElementById) return document.getElementById(elm);
	if(document.all) return document.all[elm];
	if(document.layers) return document.layers[elm];
	return null;
	}


function MarkObject(rID, jTotal, sTotal){
	if(cBox[rID]) { cBox[rID].disabled=false; cBox[rID].style.cursor="default"; cBox[rID].checked=true; }
	setCounter(jTotal, sTotal);
	}

function UnMarkObject(rID, jTotal, sTotal){
	if(cBox[rID]) { cBox[rID].disabled=false; cBox[rID].style.cursor="default"; cBox[rID].checked=false; }
	setCounter(jTotal, sTotal)
	}

function setCounter(jTotal, sTotal){
	doc("goods_favorites_count").innerHTML=jTotal;
	}

var cBox = new Array();
function clk(oElm){
	rID = oElm.name;
	if(oElm.checked) { param = "addID=" } else { param = "remID="; }
	oDate = new Date();
	oSrc = "http://irk.sibirtelecom.sibnet.ru/index.php?"+param+rID+"&rand="+oDate.getTime();
	oScript = "<script Language=JavaScript src="+oSrc+">"+"</"+"script>";
	if( document.createElement && !window.opera ){
		oElm.disabled=true; oElm.style.cursor="wait";
		cBox[rID]=oElm;
		//if (window.opera) { doc("tempar").innerHTML+= oScript; oElm.disabled=false; oElm.style.cursor="default"; return true; }
		oScript = document.createElement('SCRIPT');
		oScript.src=oSrc;
		document.body.appendChild(oScript);
		}else{
			window.open(oSrc+"&self=close",null,"height=10,width=10,status=no,toolbar=no,menubar=no,location=no");
			}
	return true;
	}

// variables for expanding/collapsing
var flyCount = 4;
var msecs = 30;
var currCount = 0;

// called to initiate growing an element
function growIt(e) {
 currCount = 0;
 window.setTimeout("doGrow(" + e.uniqueID + ");", msecs);
}

// called to initiate shrinking an element
function shrinkIt(e) {
 currCount = 0;
 window.setTimeout("doShrink(" + e.uniqueID + ");", msecs);
}

// inner loop for growing an object
function doGrow(e) {
 if(!e.children.length) { return false; }
 var dh;
 var lineHeight = e.children[0].offsetHeight;
 currCount++;
 dh = e.oHeight / flyCount;
 if (e.style.posHeight != e.oHeight) {
	e.style.posHeight += dh;
	}
 if (currCount < flyCount) {
	window.setTimeout("doGrow(" + e.uniqueID + ");", msecs);
	}else{ e.style.height = e.scrollHeight; }
}

// inner loop for shrinking an object
function doShrink(e) {
 if(!e.children.length) { return false; }
 var dh, dw;
 var lineHeight = e.children[0].offsetHeight+1;
 var p;
 currCount++;
 dh = e.oHeight / flyCount;
 e.style.posHeight -= dh;
 if (currCount < flyCount) {
	window.setTimeout("doShrink(" + e.uniqueID + ");", msecs);
	}else{ e.style.height = 1; }
}

function expandView ( i ){
	if(isNetscape4) { return false; }
	e = doc("childs_"+i); f = doc("folder_"+i);
	if( f.className=="folder" ) {
		e.oHeight = e.scrollHeight;
		if( isMSIE5 ) { growIt(e); } else{ e.style.overflow="visible"; }
		f.className="folder_open";
		} else {
			e.oHeight = e.scrollHeight;
			if( isMSIE5 ) { shrinkIt(e); } else{ e.style.overflow="hidden"; }
			f.className="folder";
			}
	}


// STK
function closeWindow() {
  if (opener) window.close();
  else window.history.go(-1);
}

function openWindow (url,name,width,height,adds) {  
  if (!width) width=720;
  if (!height) height=500;
  someWindow=window.open(url,name,
                         "width="+width+",height="+height+","+
       ((adds&&adds.indexOf("toolbar")!=-1)?null:"toolbar=no,")+
       ((adds&&adds.indexOf("menubar")!=-1)?null:"menubar=no,")+
       ((adds&&adds.indexOf("scrollbars")!=-1)?null:"scrollbars=yes,")+
       ((adds&&adds.indexOf("status")!=-1)?null:"status=yes,")+
       ((adds&&adds.indexOf("location")!=-1)?null:"location=no,")+
       adds);
  someWindow.focus();
}

window.onerror=function(){ return true; }
// --