var ww;
function showWin(lnk, wdth, hgt, scrolls,sz){
	ww=window.open(lnk,'mm','top=100, left=100, menubar=0, toolbar=0, location=0, directories=0, status=0, scrollbars=' + scrolls + ', resizable=' + sz + ', width=' + wdth + ', height=' + hgt + ' ');
};

//open window
function showPic(lnk, wdth, hgt, sz){
	var w=window.open(lnk,'mm','top=100, left=100, menubar=0, toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=' + sz + ', width=' + wdth + ', height=' + hgt + ' ');
};

//open window for automated prints
var printed="";
function showPrint(id, wdth, hgt, sz){
	printed=document.getElementById(""+id).innerHTML;
	showPic('/js/print.html',wdth,hgt,sz);
};



// 2008 Kee warhuman[]mail.ru: FLV playing helper
// (c) sarafan-tv
//=========================================
var st=[];
st.holder={};
st.now='';

st.holder.init=function() {
	if(!this.obj || this.obj == 'undefined' || this.obj == null) 	this.obj = document.getElementById("flvmarker");	
	this.w = parseInt(this.obj.offsetWidth); 	
	this.t = parseInt(this.obj.offsetTop); 	//need absolute
	this.l = parseInt(this.obj.offsetLeft); 	
	this.abst = parseInt(posY(this.obj));
	this.absl = parseInt(posX(this.obj)); 	
};

st.holder.insize=function(h) {
	h = (h == '' || h == 'undefined' || h == null || h == 0)? 0 : parseInt(h);
	this.obj.innerHTML='<img src="/img/dot.gif" height="'+ h +'" border="0" style="border:none;width:0px;height:'+ h +'px;">';
};

st.getobj=function(id) {
	if(id=='') return;
	var p={};		
	if(!this[id] || this[id] == 'undefined' || this[id] == null)	{
		p.id = id;
		p.obj = document.getElementById(id);
		p._w = parseInt(p.obj.offsetWidth);
		p._h = parseInt(p.obj.offsetHeight);
		p._k = p._w/p._h;
		p._fired = false;
		p.fire=function() {
				//shifts(st.holder.obj.id);
				st.holder.insize(st.holder.w/this._k);
				this.obj.style.position = "ABSOLUTE";
				this.obj.style.top = st.holder.abst + 'px';
				this.obj.style.left = st.holder.absl + 5 + 'px';
				this.obj.style.width = st.holder.w - 10 +'px';
				this.obj.style.height = (st.holder.w - 100)/this._k +'px';
				this._fired = true;
				st.now=this.id;
		}
		p.fireoff=function() {
				this.obj.style.position = "RELATIVE";
				this.obj.style.top = this.obj.style.left = '0px';
				this.obj.style.width = this._w + 'px';
				this.obj.style.height = this._h + 'px';
				st.holder.insize(0);
				this._fired = false;
				st.now='';
		}
		this[id]=p;
	}else{
		p=this[id];
	}
	return p;
};


function test(id) {
	st.holder.init();
	var o = st.getobj(id);
	if(o._fired){
			o.fireoff();
	}else{
			//if fired other, first fireoff it;
			if(st.now != '') {var fo = st.getobj(st.now); if (!(!fo || fo == 'undefined' || fo == null)) fo.fireoff(); }
			o.fire();
	}
};


// 2008 Kee warhuman[]mail.ru: common helpers

//get absolute X position
function posX(ob){
var container=ob;	if(container.style.position.toUpperCase()=="ABSOLUTE") return container.style.left;
var parent=container;	var x=0; while(parent.tagName.toUpperCase()!="BODY"){x = x + parent.offsetLeft; parent=parent.offsetParent;}
return x;
};
//get absolute Y position
function posY(ob){
var container=ob;	if(container.style.position.toUpperCase()=="ABSOLUTE") return container.style.top;
var parent=container;	var y=0; while(parent.tagName.toUpperCase()!="BODY"){y = y + parent.offsetTop; parent=parent.offsetParent;}
return y;
};
//find parents (num: uplevel iterator)
function parent(elem,num) {
num=num||1;
for (var i=0;i<num;i++){
	if(elem!=null){elem = elem.parentNode;} return elem;
}};
//moving document to direct anchor position (anch: to-move element id)
function shifts(anch) {
	if (anch!='')  {
		var hrefstr=window.location.href.split('#');
		var hf=hrefstr[0];
			if (anch.substr(0,1)=="#") {hf+=anch;} else {hf+="#"+anch;}
		window.location.href=hf;
}};


