if (window!=top) 
	top.location=window.location;
window.onload=loadDoc;
window.onresize=setHeight;
var tSet;
function loadDoc(){
	tSet = document.getElementById('docz');
	tSet.style.visibility="visible";
	//netscape 6.1
	tSet.style.display="inline";
	setHeight(1);
}

var tSetIsSet = false;
function toggleWidth(mod, hide){
	if (!tSet)
		tSet = document.getElementById('docz');
	if (!tSetIsSet){ 
		if (!mod)
			return;
		if (mod<=tSet.offsetWidth)
			return;
	}
	tSetIsSet = mod>0;
	if (domLib_isIE6){
		tSet.style.behavior = (mod) ? "none" : "url(styles/main/setframe.htc)";
		if (mod){
			mod += 10;
			tSet.runtimeStyle.width = mod +"px";
		}
		else
			tSet.fix();
	} else if (mod){
		tSet.className="panel";
		tSet.style.width = mod +"px";
	} else {
		tSet.style.width = "";
		tSet.className="panel zpanel";
	}
}


var ww,pp,dc,lc,rc;
function setHeight(nh){
	if (!tSet || !nh || typeof(nh)=='object')
		return;
	if (nh>470)
		tSet.style.height = nh + "px";
	else
		tSet.style.height = "470px";

	//  firefox <1.5
	if ((navigator.userAgent.indexOf("Gecko")>0)
			&& (navigator.userAgent.indexOf("Netscape6/6.1")<0)
			&& (navigator.productSub<'20051111')){
		var hh=document.body.scrollHeight;
		hh += 3;
		hh = (hh>470) ? hh + "px" : "470px";
		tSet.style.height = hh;
	}
	if (tSet.runtimeStyle)
		tSet.runtimeStyle.display="block";
	else
		tSet.style.display="block";
}

var myHost=null;
var _IS_IE = document.all && window.ActiveXObject 
		&& navigator.userAgent.toLowerCase().indexOf("msie") > -1  
		/*&& navigator.userAgent.toLowerCase().indexOf("opera") == -1*/;
var _INCNT=0;
function HooK_Receiver(sQry){
	if (myHost==null)
		myHost = extractHost(document.URL);
	if ((sQry.indexOf ('://')<0) || (extractHost(sQry) == myHost)){
		tSet.src = sQry;
	  	_INCNT = 0;
		return;
	}
	try{
   	var o_pener = window.open('about:blank','laissez_passer','',true);
   	if (!o_pener){
			alert(popupAllowMsg);
			return;
		}
   	o_pener.focus();
   	if (_IS_IE)
    	o_pener.location = sQry;
	   else
	  	window.open(sQry,'laissez_passer','',true);
	  _INCNT = 0;
  }catch(e){ // IE kukub vahest siia
   	_INCNT++;
   	setTimeout('HooK_Receiver("' + sQry + '")', 20*_INCNT);
  }
}

function extractHost(url){
	var s = url.indexOf ('://') + 3;
//	var e = url.indexOf (':', s);
//	if (e<0)
		e = url.indexOf ('/', s);
	return url.substring(s,e);
}


var opened = new Array();
function HooK_Sender(sURL,sName,sFeatures,sQry,sLst){
	var newW = null;
	var o = getWindow(sName);
	if (!o || !o[1] || !typeof(o[1].HooK_Receiver)){
		newW = window.open(sURL,sName,sFeatures,true);
		if (newW==null){
			alert(popupAllowMsg);
			return;
		}
		setWindow(sName, newW);
	} else {
		newW = o[1];
		try{
			newW.focus();
			newW.HooK_Receiver(sQry,sLst);
		} catch (e){
			setWindow(sName,null);
			return HooK_Sender(sURL,sName,sFeatures,sQry,sLst);
		}
	}
	newW.focus();
}
function getWindow(name){
	for(var i=0;i<opened.length;i++)
		if (opened[i][0]==name)
			return opened[i];
	return null;
}
function setWindow(name,newW){
	var o = getWindow(name);
	if (o==null)
		opened[opened.length] = new Array(name,newW);
	else
		o[1] = newW;
}

