///* auto image sizer */

function ELIB_init_images()
{
	var ELIB_request;
	var ELIB_image_sizes;
	var ELIB_popup_window;
	
	function xmlh()
	{
		var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
		if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
			xmlhttp = new XMLHttpRequest();
		}
		return xmlhttp;
	}


	
	function ELIB_remake_images()
	{
		try {
			if (ELIB_request.readyState != 4) return;
			eval(ELIB_request.responseText);
			var lista=document.body.getElementsByTagName('a');
			for (i=0;i<lista.length;i++) {
				if (!lista[i].onclick && lista[i].href.match(/\.(jpe?g|png|gif)$/i)) {
					if (ELIB_image_sizes[lista[i].href]) lista[i].onclick=ELIB_click;
				}
			}
			lista=document.body.getElementsByTagName('area');
			for (i=0;i<lista.length;i++) {
				if (!lista[i].onclick && lista[i].href.match(/\.(jpe?g|png|gif)$/i)) {
					if (ELIB_image_sizes[lista[i].href]) lista[i].onclick=ELIB_click;
				}
			}
		}
		catch(e) { 
		}
	}
	
	function ELIB_click()
	{
		try {
			var w=0,h=0;
			var s=ELIB_image_sizes[this.href];
			if (s) {
				w=s.w+30;
				h=s.h+30;
			}
			if (ELIB_popup_window && ELIB_popup_window.close && !ELIB_popup_window.closed) {
				ELIB_popup_window.close();
			}
			
			var misio=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
	misio=true;
@end @*/
			var str="dependent=yes,toolbar=no,resizable=yes";
			if (w && h) {
				var sb=0;
				if (w>screen.availWidth) {w=screen.availWidth;sb=1;}
				if (h>screen.availHeight) {h=screen.availHeight;sb=1;}
				str+=",width="+w+",height="+h;
				if (sb) str+=",scrollbars=yes";
				var x,y;
				x=Math.floor((screen.availWidth-w)/2);
				y=Math.floor((screen.availHeight-h)/2);
				if (x>20) {
					str+=(misio?',left=':',screenX=')+x;
				}
				if (y>20) {
					str+=(misio?',top=':',screenY=')+y;
				}
			}
			ELIB_popup_window=window.open(this.href,"_blank",str);
			if (!ELIB_popup_window) return true;
			var doc=ELIB_popup_window.document;
			doc.open();
			var alt="",title="";
			if (this.alt) alt=this.alt;
			if (this.title) alt=this.title;
			doc.write(
	  			'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">' +
				'<html id="popup">' +
				'<head><head><title>' + title + '</title>' +
				'<meta http-equiv="Content-Type" content="text/html; charset=utf-8">' +
				'<style type="text/css">' +
				'body,html {margin:0px;padding:0px}\n'+
				'p {text-align:center;margin:0px;padding:15px 0 0 0}\n'+
				'img {display:inline}\n'+
				'</style>'+
				'</head><body><p><img src="'+this.href+'" alt="'+alt+'"></p>' +
				'<script type="text/javascript"> document.body.onmouseup = function(e) {var ev = e||event; if ((ev.button||ev.which) < 2) self.close();} ' +
				'</script></body></html>'
				);
			doc.close();
			if (misio) event.returnValue=false;
			return false;
		}
		catch(e) {
			return true;
		}
	}
	try {
		var arr=new Array();
		var i,j,str;
		if (!document.body.getElementsByTagName) return;
		var lista=document.body.getElementsByTagName('a');
		for (i=0;i<lista.length;i++) {
			if (!lista[i].onclick && lista[i].href.match(/\.(jpe?g|png|gif)/i)) {
				for (j=0;j<arr.length;j++) if (arr[j]==lista[i].href) break;
				if (j>=arr.length) arr[j]=lista[i].href;
			}
		}
		lista=document.body.getElementsByTagName('area');
		for (i=0;i<lista.length;i++) {
			if (!lista[i].onclick && lista[i].href.match(/\.(jpe?g|png|gif)/i)) {
				for (j=0;j<arr.length;j++) if (arr[j]==lista[i].href) break;
				if (j>=arr.length) arr[j]=lista[i].href;
			}
		}
		if (!arr.length) return;
		if (!(ELIB_request=xmlh())) return;
		for (i=0;i<arr.length;i++) {
			if (i) str+='&url=';else str='url=';
			try {
				str+=encodeURIComponent(arr[i]);
			}
			catch(e) {
				str+=escape(arr[i]);
			}
		}
		ELIB_request.open("POST","/imgsizer");
		ELIB_request.onreadystatechange=ELIB_remake_images;
		ELIB_request.send(str);
	}
	catch(e) {
	}
}


		
function pager_remake()
{
	ELIB_init_images();
}

function init()
{
    
    if (!document.getElementById) return;
      pager_remake();
      return;
}

(function()
{
	var wonlo=window.onload;
	window.onload=function() {
		init();
		if (wonlo) wonlo();
	}
})();

function replace_flash()
{
	var misio=false;	
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
	misio=true;
@end @*/
	function getPlayerVersion (){
		var flash,e;
		if(navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length){
			var x=navigator.plugins["Shockwave Flash"];
			if(x&&x.description){
				return x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split('.')[0];
			}
			return 0;
		}
		for (flash=10;flash>=4;flash--) {
			try {
				var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+flash);
				if (axo) return flash;
			} catch(e) {};
		}
		return 0;
	}

function insert_flash(objid,src,w,h)
{
	function apar(name,value)
	{
		var param=document.createElement('param');
		param.setAttribute('name',name);
		param.setAttribute('value',value);
		object.appendChild(param);
	}
	
	function visualise_inner(el)
	{
		if (el.className && el.className.indexOf('innerflash')>=0) el.className=el.className.replace(/innerflash/g,'');
		for (el=el.firstChild;el;el=el.nextSibling) visualise_inner(el);
	}
	
	if (!document.getElementById || !document.createElement) return;
	var div=document.getElementById(objid);
	if (!div) return;
	if (!getPlayerVersion()) {
		visualise_inner(div);
		return;
	}
	var object=document.createElement('object');
	var el;
	var post=!misio && (!window.netscape || window.opera);
	
	
	if (!misio) while(div.firstChild) object.appendChild(div.firstChild);
	else while (div.firstChild) div.removeChild(div.firstChild);
	if (!post) div.appendChild(object);
	object.width = w;
	object.height = h;
	if (misio) {
		object.classid= "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"; 
		object.movie = src;
	}
	else {
		object.type="application/x-shockwave-flash";
		object.data=src;
	}
	var i;
	for (i=4;i<arguments.length-1;i+=2) apar(arguments[i],arguments[i+1]);
	if (post) div.appendChild(object);
	
}

	insert_flash(arguments[0],"/gfx/rachflash.swf",872,507);
}
