var AR = {
	TI: function(e) {
		var dcn = 'fr pl cp';
		var tcn = 'cp pb';
		var ddim = '180x180';
		var tdim = '640x480';
		e.className = e.className == dcn ? tcn : dcn;
		var i = e.getElementsByTagName('img')[0];
		var s = i.src;
		var rex = e.className == dcn ? new RegExp('-'+tdim+'.') : new RegExp('-'+ddim+'.');
		i.src = e.className == dcn ? s.replace(rex, '-'+ddim+'.') : s.replace(rex, '-'+tdim+'.');
	}
}

var CL = {
		L: function(id, p) {
			new Ajax.Request(
				'/req/content/load_comm.req.php', {
					method: 'post',
					postBody: 'id='+id+'&p='+p,
					onComplete: function(t) {
						$('commc').innerHTML = t.responseText;
					}
				}
			);
		}
	}

var UI = {
	bge: false, ce: false, ee: false,
	SW: function(html) {
		if (!this.bge) {
			this.bge = document.createElement('div');
			this.bge.className = 'opbg';
			document.body.appendChild(this.bge);
		}
		this.bge.style.display = 'block';
		
		if (!this.ce) {
			this.ce = document.createElement('div');
			this.ce.className = 'opc';
			document.body.appendChild(this.ce);
		}
		
		this.SO(false);
		this.ce.style.display = 'block';
		this.ce.innerHTML = html;
		this.PW();
	},
	PW: function() {
		var t = $('optbl');
		t.style.marginLeft =  (- Math.round(t.clientWidth / 2)) + 'px';
		if (navigator.userAgent.indexOf('MSIE 6.0') != -1) {
			t.style.top = (document.documentElement.scrollTop + 50) + 'px';
			this.bge.style.top = document.documentElement.scrollTop + 'px';
		}
	},
	CW: function() {
		if (this.bge)
			this.bge.style.display = 'none';
		if (this.ce)
			this.ce.style.display = 'none';
		this.SO(true);
	},
	ERR: function(e, t, foc, ev) {
		if (arguments.length == 4) {
			var ev = ev || window.event;
			if (typeof(ev) != 'undefined') {
				if (typeof(ev.cancelBubble) != 'undefined')
					ev.cancelBubble = true;
				else if (ev.stopPropagation)
					ev.stopPropagation();
			}
		}
		if (arguments.length == 2)
			var foc = true;
		if (!this.ee) {
			this.ee = document.createElement('div');
			this.ee.className = 'berr';
			document.body.appendChild(this.ee);
			document.body.onclick = function(e) { UI.ee.style.display = 'none'; }
		}
		if (foc) {
			try {
				if (e.focus)
					e.focus();
			} catch (ex) {};
		}
		this.ee.innerHTML = t;
		var x = findPosX(e);
		var y = findPosY(e)
		this.ee.style.left = x + 'px';
		this.ee.style.top = y + 'px';
		this.ee.style.display = 'block';
		this.ee.style.top = (y + e.clientHeight + 5) + 'px';
		this.ee.style.left = (x - this.ee.clientWidth + e.clientWidth) + 'px';
		return false;
	},
	SO: function(s) {
		var a = document.getElementsByTagName('iframe');
		for (var i = 0; i < a.length; i++)
			a[i].style.visibility = s ? 'visible' : 'hidden';
		var a = document.getElementsByTagName('object');
		for (var i = 0; i < a.length; i++)
			a[i].style.visibility = s ? 'visible' : 'hidden';
	}
}

window.onload = function() {
	var a = $('content').getElementsByTagName('a');
	var ll = [];
	for (var i = 0; i < a.length; i++)
		if (a[i].className == 'inlayer') {
			a[i].onclick = function() {
				var html = '<table border="0" cellpadding="0" cellspacing="0" class="optbl" id="optbl"><tr><td class="tl"></td><td class="tc"></td><td class="tr"></td></tr><tr><td class="ml"></td><td class="mm" valign="top"><div class="content"><button class="close" onclick="UI.CW();" id="opclsbtn"></button><h3>'+this.title+'</h3><img src="'+this.href+'" onclick="UI.CW();" onload="UI.PW();" /></div></td><td class="mr"></td></tr><tr><td class="bl"></td><td class="bc"></td><td class="br"></td></tr></table>';
				UI.SW(html);
				return false;
			}
		}
	
	if ($('calbum')) {
		var a = $('calbum').getElementsByTagName('a');
		var ll = [];
		for (var i = 0; i < a.length; i++)
			if (a[i].className == 'inlayer') {
				a[i].onclick = function() {
					var html = '<table border="0" cellpadding="0" cellspacing="0" class="optbl" id="optbl"><tr><td class="tl"></td><td class="tc"></td><td class="tr"></td></tr><tr><td class="ml"></td><td class="mm" valign="top"><div class="content"><button class="close" onclick="UI.CW();" id="opclsbtn"></button><h3>'+this.title+'</h3><img src="'+this.href+'" onclick="UI.CW();" onload="UI.PW();" /></div></td><td class="mr"></td></tr><tr><td class="bl"></td><td class="bc"></td><td class="br"></td></tr></table>';
					UI.SW(html);
					return false;
				}
			}
	}
	
}

