var indicator_img_path="http://pocket-games.ru/pg_external/ibox/indicator.gif";var indicator_img_html='<img name="ibox_indicator" src="'+indicator_img_path+'" alt="Loading..." style="width:128px;height:128px;"/>';function init_ibox(){var g="ibox";createIbox(document.getElementsByTagName("body")[0]);var c=document.getElementsByTagName("a");var f="rel";var d;for(var b=0;b<c.length-1;b++){d=c[b];if(d.getAttribute(f)){var a=d.getAttribute(f);if((a.indexOf("ibox")!=-1)||a.toLowerCase()=="ibox"){d.onclick=function(){var h=this.getAttribute(f);var j=parseQuery(h.substr(5,999));var e=this.href;if(this.target!=""){e=this.target}var i=this.title;showBG();showIbox(e,i,j);window.onscroll=maintPos;window.onresize=maintPos;return false}}}}}showBG=function(){var f=getElem("ibox_w");var d=8;f.style.opacity=0;f.style.filter="alpha(opacity=0)";setBGOpacity=setOpacity;for(var c=0;c<=d;c++){setTimeout("setIboxOpacity('ibox_w',"+c+")",70*c)}f.style.display="";var b=new getPageSize();var e=new getScrollPos();var a=navigator.userAgent;if(a.indexOf("MSIE ")!=-1){f.style.width=b.width+"px"}else{f.style.width=b.width-20+"px"}f.style.height=b.height+e.scrollY+"px";selectVisibility("hidden")};selectVisibility=function(b){var a=document.getElementsByTagName("select");for(var c=0;c<a.length;++c){a[c].style.visibility=b}};hideBG=function(){var a=getElem("ibox_w");a.style.display="none";selectVisibility("visible")};var loadCancelled=false;showIndicator=function(){var a=getElem("ibox_progress");a.style.display="";posToCenter(a);a.onclick=function(){hideIbox();hideIndicator();loadCancelled=true}};hideIndicator=function(){var a=getElem("ibox_progress");a.style.display="none";a.onclick=null};createIbox=function(c){var a='<div id="ibox_w" style="display:none;"></div>';a+='<div id="ibox_progress" style="display:none;">';a+=indicator_img_html;a+="</div>";a+='<div id="ibox_wrapper" style="display:none">';a+='<div id="ibox_content"></div>';a+='<div id="ibox_footer_wrapper"><div id="ibox_close" style="float:right;">';a+='<a id="ibox_close_a" href="javascript:void(null);" >Нажмите тут, что бы закрыть окно</a></div>';a+='<div id="ibox_footer">&nbsp;</div></div></div></div>';var b=document.getElementsByTagName("body")[0];var d=document.createElement("div");d.setAttribute("id","ibox");d.style.display="";d.innerHTML=a;c.appendChild(d)};var ibox_w_height=0;showIbox=function(b,m,e){var a=getElem("ibox_wrapper");var d=0;var h=getElem("ibox_footer");if(m!=""){h.innerHTML=m}else{h.innerHTML="&nbsp;"}b=b.toLowerCase();var f=/\.jpg|\.jpeg|\.png|\.gif|\.html|\.htm|\.php|\.cfm|\.asp|\.aspx|\.jsp|\.jst|\.rb|\.txt/g;var o=b.match(f);if(o==".jpg"||o==".jpeg"||o==".png"||o==".gif"){d=0;showIndicator();var k=new Image();k.onload=function(){k=resizeImageToScreen(k);hideIndicator();getElem("ibox_content").style.overflow="hidden";var i='<a href="javascript:void(null);"><img name="ibox_img" src="'+b+'" style="width:'+k.width+"px;height:"+k.height+'px;border:0;"/></a>';if(loadCancelled==false){a.style.height=k.height+"px";a.style.width=k.width+"px";a.style.display="";a.style.visibility="hidden";posToCenter(a);a.style.visibility="visible";setIBoxContent(i)}};loadCancelled=false;k.src=b}else{if(b.indexOf("#")>0){var j="";d=1;if(e.height){a.style.height=e.height+"px"}else{a.style.height="280px"}if(e.width){a.style.width=e.width+"px"}else{a.style.width="450px"}a.style.display="";a.style.visibility="hidden";posToCenter(a);a.style.visibility="visible";var c=b.substr(b.indexOf("#")+1,1000);var n=getElem(c);if(n){j=n.innerHTML}setIBoxContent(j)}else{if(o==".htm"||o==".html"||o==".php"||o==".asp"||o==".aspx"||o==".jsp"||o==".jst"||o==".rb"||o==".txt"||o==".cfm"){d=2;showIndicator();http.open("get",b,true);http.onreadystatechange=function(){if(http.readyState==4){hideIndicator();if(e.height){a.style.height=e.height+"px"}else{a.style.height="280px"}if(e.width){a.style.width=e.width+"px"}else{a.style.width="450px"}a.style.display="";a.style.visibility="hidden";posToCenter(a);a.style.visibility="visible";var i=http.responseText;setIBoxContent(i)}};http.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");http.send(null)}}}a.style.opacity=0;a.style.filter="alpha(opacity=0)";var l=10;setIboxOpacity=setOpacity;for(var g=0;g<=l;g++){setTimeout("setIboxOpacity('ibox_wrapper',"+g+")",30*g)}if(d==1||d==2){a.onclick=null;getElem("ibox_close_a").onclick=function(){hideIbox()}}else{a.onclick=hideIbox;getElem("ibox_close_a").onclick=null}};setOpacity=function(b,a){var c=getElem(b);c.style.opacity=a/10;c.style.filter="alpha(opacity="+a*10+")"};resizeImageToScreen=function(c){var b=new getPageSize();var a=b.width-100;var d=b.height-100;if(c.width>a){c.height=c.height*(a/c.width);c.width=a;if(c.height>d){c.width=c.width*(d/c.height);c.height=d}}else{if(c.height>d){c.width=c.width*(d/c.height);c.height=d;if(c.width>a){c.height=c.height*(a/c.width);c.width=a}}}return c};maintPos=function(){var d=getElem("ibox_wrapper");var c=getElem("ibox_w");var b=new getPageSize();var a=navigator.userAgent;if(a.indexOf("MSIE ")!=-1){c.style.width=b.width+"px"}else{c.style.width=b.width-20+"px"}if(a.indexOf("Opera/9")!=-1){c.style.height=document.body.scrollHeight+"px"}else{c.style.height=document.body.scrollHeight+50+"px"}posToCenter(d)};hideIbox=function(){hideBG();var a=getElem("ibox_wrapper");a.style.display="none";clearIboxContent();window.onscroll=null};posToCenter=function(d){var f=new getScrollPos();var b=new getPageSize();var c=new getElementSize(d);var a=Math.round(b.width/2)-(c.width/2)+f.scrollX;var e=Math.round(b.height/2)-(c.height/2)+f.scrollY;d.style.left=a+"px";d.style.top=e+"px"};getScrollPos=function(){var a=document.documentElement;this.scrollX=self.pageXOffset||(a&&a.scrollLeft)||document.body.scrollLeft;this.scrollY=self.pageYOffset||(a&&a.scrollTop)||document.body.scrollTop};getPageSize=function(){var a=document.documentElement;this.width=self.innerWidth||(a&&a.clientWidth)||document.body.clientWidth;this.height=self.innerHeight||(a&&a.clientHeight)||document.body.clientHeight};getElementSize=function(a){this.width=a.offsetWidth||a.style.pixelWidth;this.height=a.offsetHeight||a.style.pixelHeight};setIBoxContent=function(b){clearIboxContent();var a=getElem("ibox_content");a.innerHTML=b;a.style.overflow="auto"};clearIboxContent=function(){var a=getElem("ibox_content");a.innerHTML="";a.style.overflow="hidden"};getElem=function(a){return document.getElementById(a)};parseQuery=function(d){var e=new Object();if(!d){return e}var a=d.split(/[;&]/);for(var c=0;c<a.length;c++){var g=a[c].split("=");if(!g||g.length!=2){continue}var b=unescape(g[0]);var f=unescape(g[1]);f=f.replace(/\+/g," ");e[b]=f}return e};createRequestObject=function(){var xmlhttp;
/*@cc_on
	@if (@_jscript_version>= 5)
			try {xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
					try {xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");}
					catch (E) {xmlhttp = false;}
			}
	@else
		xmlhttp = false;
	@end @*/
if(!xmlhttp&&typeof XMLHttpRequest!="undefined"){try{xmlhttp=new XMLHttpRequest()}catch(e){xmlhttp=false}}return xmlhttp};var http=createRequestObject();function addEvent(d,c,a){if(d.addEventListener){d.addEventListener(c,a,false);return true}else{if(d.attachEvent){var b=d.attachEvent("on"+c,a);return b}else{return false}}}addEvent(window,"load",init_ibox);