function popup(uri, pars){	if(typeof pars == 'undefined')		pars = {};	pars['ref'] = document.location.href;		var mp = new MaluzenPopup();	mp.load(uri, pars);		var tagnames = new Array();//	if(navigator.userAgent.indexOf("Win") != -1 && Prototype.Browser.IE )		tagnames = new Array('select', 'object', 'embed');//	if(navigator.userAgent.indexOf("Mac") != -1 && Prototype.Browser.Gecko)//		tagnames = new Array('object', 'embed');		for(var ti=0;ti<tagnames.length;ti++)	{		var tags = document.getElementsByTagName(tagnames[ti]);				for(var ii=0;ii<tags.length;ii++)		{			var it = tags[ii];			if(it.style && typeof it.style.visibility != 'undefined')			{				if(typeof it.selvis == 'undefined' || it.selvis == null)					it.selvis = it.style.visibility;				it.style.visibility = 'hidden';			}		}	}		return false;}function popclose(){	var backPanel = $('Popup_Backpanel');	backPanel.parentNode.removeChild(backPanel);	var tagnames = new Array();//	if(navigator.userAgent.indexOf("Win") != -1 && Prototype.Browser.IE )		tagnames = new Array('select', 'object', 'embed');//	if(navigator.userAgent.indexOf("Mac") != -1 && Prototype.Browser.Gecko)//		tagnames = new Array('object', 'embed');		for(var ti=0;ti<tagnames.length;ti++)	{		var tags = document.getElementsByTagName(tagnames[ti]);				for(var ii=0;ii<tags.length;ii++)		{			var it = tags[ii];			if(it.style && typeof it.style.visibility != 'undefined' && typeof it.selvis != 'undefined')			{				it.style.visibility = it.selvis;				it.selvis = null;			}		}	}		return false;}if(typeof MaluzenPopup == 'undefined')MaluzenPopup = Class.create();Object.extend(MaluzenPopup.prototype, {	initialize: function()	{		this.uri = '';		this.mw = 0;		this.mh = 0;		this.startw = 300;		this.starth = 200;	},		load: function(uri, pars)	{		this.uri = uri;		var inPanel = $('Popup_Inpanel');		if(!inPanel)		{			this.make();			inPanel = $('Popup_Inpanel');		}				inPanel.hide();				var framePanel = $('Popup_Framepanel');		framePanel.style.backgroundColor = '#FFFFFF';				var aj = new Ajax.Updater('Popup_Inpanel', this.uri, {'method':'post', 'parameters': pars, 'evalScripts':true,'onComplete':this.goEndAuto.bind(this)});	},		make: function()	{		var bd_size = this.windowSize();//		var bd_in_size = Element.getDimensions(document.body);		var backPanel = document.createElement('div');		backPanel.id = 'Popup_Backpanel';		backPanel.style.position = 'absolute';		backPanel.style.zIndex = 10000;		backPanel.style.backgroundColor = 'transparent';		backPanel.style.width = bd_size['scrollwidth'] + "px";		backPanel.style.height = bd_size['scrollheight'] + "px";		backPanel.style.left = '0px';		backPanel.style.top = '0px';		backPanel.style.textAlign = 'center';		backPanel.style.verticalAlign = 'middle';		backPanel.style.border = '0px none';		backPanel.style.margin = 'auto';				var backColor = document.createElement('div');		backColor.style.position = 'absolute';		backColor.style.zIndex = 10;		backColor.style.left = '0px';		backColor.style.top = '0px';		backColor.style.margin = '0px';		backColor.style.padding = '0px';		backColor.style.width = bd_size['scrollwidth'] + "px";		backColor.style.height = bd_size['scrollheight'] + "px";		backColor.style.backgroundColor = '#000000'		backColor.style.border = '0px none';		setStyle(backColor, 'opacity', 60);		backPanel.appendChild(backColor);				var middlePanel = document.createElement('div');		middlePanel.style.position = 'absolute';		middlePanel.style.zIndex = 20;		middlePanel.style.backgroundColor = 'transparent';		middlePanel.style.margin = '0px';		middlePanel.style.padding = '0px';		middlePanel.style.top = bd_size['scrolltop'] + 'px';		middlePanel.style.left = bd_size['scrollleft'] + 'px';		middlePanel.style.width = bd_size['clientwidth'] + "px";		middlePanel.style.height = bd_size['clientheight'] + "px";		backPanel.appendChild(middlePanel);				var framePanel = document.createElement('div');		framePanel.id = 'Popup_Framepanel';		framePanel.style.position = 'absolute';		framePanel.style.zIndex = 20;		framePanel.style.textAlign = 'left';		framePanel.style.backgroundColor = '#FFFFFF';		framePanel.style.margin = '0px';		framePanel.style.padding = '0px';		framePanel.style.overflow = 'hidden';		framePanel.style.border = '0px none';		framePanel.style.top = '50%';		framePanel.style.left = '50%';		framePanel.style.marginLeft = '-'+parseInt(this.startw/2)+'px';		framePanel.style.marginTop = '-'+parseInt(this.starth/2)+'px';		framePanel.style.width = parseInt(this.startw)+'px';		framePanel.style.height = parseInt(this.starth)+'px';		middlePanel.appendChild(framePanel);				var inPanel = document.createElement('div');		inPanel.id = 'Popup_Inpanel';		inPanel.style.margin = '0px';		inPanel.style.padding = '0px';//		inPanel.style.width = '100%';//		inPanel.style.height = '100%';		framePanel.appendChild(inPanel);				document.body.appendChild(backPanel);	},		goEndAuto: function()	{		var inPanel = $('Popup_Inpanel');		var imgs = inPanel.getElementsByTagName('img');		if(Prototype.Browser.Opera)		{			setTimeout(this.goEndAutoStep.bind(this), 500);		}		else if(imgs.length == 0)		{			setTimeout(this.goEndAutoStep.bind(this), 1);		}		else		{			if(imgs[imgs.length-1].complete)				setTimeout(this.goEndAutoStep.bind(this), 1);			else				Event.observe(imgs[imgs.length-1], 'load', this.stepImgLoaded.bind(this));		}	},		stepImgLoaded: function()	{		setTimeout(this.goEndAutoStep.bind(this), 1);	},		goEndAutoStep: function()	{		this.goEnd();	},		goEnd: function()	{		this.anim();		if(typeof init_colortextbox != 'undefined')			init_colortextbox();	},		anim: function()	{		var inPanel = $('Popup_Inpanel');		if(!inPanel)			return;		var in_size = inPanel.getDimensions();		this.mw = in_size.width;		this.mh = in_size.height;				var framePanel = $('Popup_Framepanel');		if(!framePanel)			return;		var in_size = framePanel.getDimensions();				var dh = (this.mh - in_size.height) / 3;		var dw = (this.mw - in_size.width) / 3;		if(Math.abs(dh) < 1 && dh != 0)			dh = (dh<0?-1:1);		if(Math.abs(dw) < 1 && dw != 0)			dw = (dw<0?-1:1);				var nh = in_size.height + dh;		var nw = in_size.width + dw;						framePanel.style.marginLeft = '-'+parseInt(nw/2)+'px';		framePanel.style.marginTop = '-'+parseInt(nh/2)+'px';		framePanel.style.width = parseInt(nw)+'px';		framePanel.style.height = parseInt(nh)+'px';	    var pos = framePanel.cumulativeOffset();	    if(pos.top < 0)			framePanel.style.marginTop = '-'+(parseInt(nh/2) + pos.top)+'px';				if(this.mh == in_size.height && this.mw == in_size.width)		{			// end.			var inPanel = $('Popup_Inpanel');			inPanel.show();			framePanel.style.backgroundColor = 'transparent';		}		else		{			//next.			setTimeout(this.anim.bind(this), 50);		}	},	windowSize: function()	{		var doc = document;				if(doc.body.clientHeight > 0 && (doc.documentElement.clientHeight == 0 ||  doc.documentElement.clientHeight > doc.body.clientHeight))	//	if(doc.documentElement.clientHeight == 0 && doc.body.clientHeight > 0)		{			scrolltop = doc.body.scrollTop || doc.documentElement.scrollTop;			scrollheight = doc.body.scrollHeight || doc.documentElement.scrollHeight;			clientheight = doc.body.clientHeight || doc.documentElement.clientHeight;			scrollleft = doc.body.scrollLeft || doc.documentElement.scrollLeft;			scrollwidth = doc.body.scrollWidth || doc.documentElement.scrollWidth;			clientwidth = doc.body.clientWidth || doc.documentElement.clientWidth;		}		else		{			var scrolltop = doc.documentElement.scrollTop || doc.body.scrollTop;			var scrollheight = doc.documentElement.scrollHeight || doc.body.scrollHeight;			var clientheight = doc.documentElement.clientHeight || doc.body.clientHeight;			var scrollleft = doc.documentElement.scrollLeft || doc.body.scrollLeft;			var scrollwidth = doc.documentElement.scrollWidth || doc.body.scrollWidth;			var clientwidth = doc.documentElement.clientWidth || doc.body.clientWidth;		}		if(window.innerHeight && window.innerHeight < clientheight)			clientheight = window.innerHeight;		if(window.innerWidth && window.innerWidth < clientwidth)			clientwidth = window.innerWidth;				var body_px = new Array(scrolltop, scrollheight, clientheight);		body_px['scrolltop'] = scrolltop;		body_px['scrollheight'] = scrollheight;		body_px['clientheight'] = clientheight;		body_px['scrollleft'] = scrollleft;		body_px['scrollwidth'] = scrollwidth;		body_px['clientwidth'] = clientwidth;				return body_px;	},	getPageSize: function() 	{		var xScroll, yScroll;				if (window.innerHeight && window.scrollMaxY) {				xScroll = window.innerWidth + window.scrollMaxX;			yScroll = window.innerHeight + window.scrollMaxY;		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac			xScroll = document.body.scrollWidth;			yScroll = document.body.scrollHeight;		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari			xScroll = document.body.offsetWidth;			yScroll = document.body.offsetHeight;		}				var windowWidth, windowHeight;				if (self.innerHeight) {	// all except Explorer			if(document.documentElement.clientWidth){				windowWidth = document.documentElement.clientWidth; 			} else {				windowWidth = self.innerWidth;			}			windowHeight = self.innerHeight;		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode			windowWidth = document.documentElement.clientWidth;			windowHeight = document.documentElement.clientHeight;		} else if (document.body) { // other Explorers			windowWidth = document.body.clientWidth;			windowHeight = document.body.clientHeight;		}					// for small pages with total height less then height of the viewport		if(yScroll < windowHeight){			pageHeight = windowHeight;		} else { 			pageHeight = yScroll;		}			// for small pages with total width less then width of the viewport		if(xScroll < windowWidth){				pageWidth = xScroll;				} else {			pageWidth = windowWidth;		}		return [pageWidth,pageHeight];	}	});function setStyle(obj, stylename, stylevalue){	switch(stylename)	{		case 'opacity':			var opacity = stylevalue;			if(typeof obj.style.opacity != 'undefined')				obj.style.opacity = opacity/100;			else if(typeof obj.style.mozOpacity != 'undefined')				obj.style.mozOpacity = opacity/100;			else if(typeof obj.style.filter != 'undefined')				obj.style.filter = 'alpha(opacity='+opacity+')';			break;		default:			if(obj.style && typeof obj.style[stylename] != 'undefined')				obj.style[stylename] = stylevalue;			break;	}}