function px(n){ return n+'px'; }

function GetWindowSize(){
	var width = 0, height = 0, xoffset = 0, yoffset = 0;
	if(typeof(window.innerWidth)=='number'){
		width = window.innerWidth;
		height = window.innerHeight;
	}else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)){
		width = document.documentElement.clientWidth;
		height = document.documentElement.clientHeight;
	}else if( document.body && (document.body.clientWidth || document.body.clientHeight)){
		width = document.body.clientWidth;
		height = document.body.clientHeight;
	}
	if(window.pageYOffset){
		yoffset = window.pageYOffset;
		xoffset = window.pageXOffset;
	}else if(document.documentElement && document.documentElement.scrollTop){
		yoffset = document.documentElement.scrollTop;
		xoffset = document.documentElement.scrollLeft;
	}else if(document.body){
		yoffset = document.body.scrollTop;
		xoffset = document.body.scrollLeft;
	}
	return {width : width, height : height, xoffset : xoffset, yoffset : yoffset};
}

var popupWindow = {
	width : 618,
	height : 500,
	parent : {},
	obj : {},
	hidden : true,
	InitPopup : function(pic,picw,pich,pict){
		if(this.hidden){

		if (picw=="") { picw=640; }
		if (pich=="") { pich=480; }

			this.parent = document.body;
			var div = document.createElement('div');
			div.style.position = 'absolute';
			div.style.display = '';
			div.style.zIndex = '100';
			this.window = div;
			this.parent.appendChild(this.window);

this.window.innerHTML='<table width=100% cellpadding=0 cellspacing=0 border=0>'+
'<tr><td><img src=/images/standart/01.png></td><td style="background-image:url(/images/standart/05.png);">'+pict+'</td><td style="background-image:url(/images/standart/03.png);"><a href="javascript:void(0);"  onclick="popupWindow.Hide()"><img src=/images/standart/close.png border=0 align=absmiddle hspace=11></a></td></tr>'+
'<tr><td align=center colspan=3 style="background-image:url(/images/standart/05.png); padding:6px 15px 0px 15px;"><a href="javascript:void(0);" onclick="popupWindow.Hide()"><img  src=/pic/' + pic +' width='+picw+' height='+pich+' border=0></a></td></tr>'+
'<tr><td width=20px><img src=/images/standart/08.png></td><td style="background-image:url(/images/standart/05.png); width:'+picw+'px;"></td><td width=39px><img src=/images/standart/06.png></td></tr>'+
'</table>';


			picw=picw-(-30); pich=pich-(-60);
			this.hidden = false;
			this.SetPosition(picw, pich);
			}
		
	},
	SetPosition : function(picw, pich){
		var size = GetWindowSize();
		this.window.style.left = px((size.width - picw) / 2 + size.xoffset);
		this.window.style.top = px((size.height - pich) / 2 + size.yoffset + 50);
		this.window.style.width = px(picw);
		this.window.style.height = px(pich);
	},
	Show : function(){
		this.window.style.display = '';
		this.hidden = false;
	},
	Hide : function(categ,s,id){
     	this.window.style.display = 'none';
	this.hidden = true;
	}
};
