/** class change **/
function styleChange(objName,styleName){
	document.getElementById(objName).className=styleName;
}

/** layer show **/
submenu_arr = new Array();
submenu_arr[0] = false;

NS4 = (document.layers) ? 1 : 0; 
IE = (document.all) ? 1 : 0; 
DOM = (document.getElementById) ? 1 : 0; 
Opera = (navigator.userAgent.indexOf("Opera") != -1) ? 1 : 0; 

function submenu(cell){
	if(DOM) {
			if(submenu_arr[0]!=""){
				document.getElementById(submenu_arr[0]).style.display = 'none';
			}
		document.getElementById(cell).style.display = 'block';
		} 
	else if(IE) {
			if(submenu_arr[0]!=""){
				document.all[submenu_arr[0]].style.visibility = 'hidden';
			}
		document.all[cell].style.visibility = 'visible';
		}
	else if(NS4) {
			if(submenu_arr[0]!=""){
				document.layers[submenu_arr[0]].visibility = 'hide';
			}
		document.layers[cell].visibility = 'show';
		}
	submenu_arr[0] = cell;
}

function submenu_hide(){
if(submenu_arr[0]){
	if(DOM) {
		document.getElementById(submenu_arr[0]).style.display = 'none';
	} 
	else if(IE) {
		document.all[submenu_arr[0]].style.visibility = 'hidden';
	}
	else if(NS4) {
		document.layers[submenu_arr[0]].visibility = 'hide';
	}
	submenu_arr[0] = false;
}
}

function mouseMove(event){
	mouse_x=event.clientX
	mouse_y=event.clientY

	if(mouse_x<30 || mouse_x>430 || mouse_y<88 || mouse_y>250){
		submenu_hide();
	}
}

function location_Link(object){
	location_link = object.options[object.options.selectedIndex].value;
	window.location = "index.php" + location_link;
}

function alphaImages() {
	var els = document.getElementsByTagName("IMG");
	var s, w, h;
	for (var i=0; i<els.length; i++) {
		s = els[i].src;
		if (s.toLowerCase().indexOf(".png") != -1) {
			els[i].src = "design/index/x.gif";
			els[i].style.filter += "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + s + "', sizingMethod=image);";
		}
	}
}

function forumopen(topicid)
{
	window.open("forumpopup.php?topicid="+topicid,"forumpopup","top=10px,left=10px,width=400px,height=350px");
}
function forumprew(elozmenyid)
{
	window.open("forumprew.php?elozmenyid="+elozmenyid,"forumpopup","top=10px,left=10px,width=400px,height=350px");
}

function forumsend(szoveg)
{
	if(szoveg.value.length>0)
		return true;
	else
		return false;
}

function forumkeypress(obj)
{
	var areaszoveghossz = obj.value.length;
	var areaszoveg = obj.value;
	var max = 500;

	if ( areaszoveghossz > max ) 
		document.all['textarea'].value = areaszoveg.substr(0, max);
	else
		document.all['forumkarakter'].innerHTML = max-areaszoveghossz;
}

/* ************************************************************************************************** */
/* ********************************************* PREVIEW ******************************************** */
/* ************************************************************************************************** */

/*
Simple Image Trail script- By JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
This notice must stay intact
*/ 

var w=1
var h=1
function gettrailobj()
{
	return document.getElementById('previewlayerdiv').style;
}

function truebody()
{
	return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

function hide_pictures()
{
	document.onmousemove="";
	document.getElementById('previewimg').src='design/index/x.gif';
	document.getElementById('layerimg').style.display='none';

	gettrailobj().display="none";
	gettrailobj().left=-1000;
	gettrailobj().top=0;
}

function show_pictures(width,height,file)
{
	if(navigator.userAgent.toLowerCase().indexOf('opera') == -1)
	{
		
		w=width;
		h=height;
		
		document.getElementById('previewimg').width = w;
		document.getElementById('previewimg').src=file;
		document.getElementById('layerimg').style.display='block';

		document.onmousemove=followmouse;
		gettrailobj().display="block";
		gettrailobj().width=w+"px";
		gettrailobj().height=h+"px";
	}
}

function hide_text()
{
	document.onmousemove="";
	document.getElementById('layertext').innerHTML='';
	document.getElementById('layertext').style.display='none';

	gettrailobj().display="none";
	gettrailobj().left=-1000;
	gettrailobj().top=0;
}

function show_text(width,height,text)
{
	if(navigator.userAgent.toLowerCase().indexOf('opera') == -1)
	{
		w=width;
		h=height;
		
		document.getElementById('layertext').innerHTML=text;
		document.getElementById('layertext').style.display='block';

		document.onmousemove=followmouse;
		gettrailobj().display="block";
		gettrailobj().width=w+"px";
		gettrailobj().height=h+"px";
	}
}

function followmouse(e)
{
	if(navigator.userAgent.toLowerCase().indexOf('opera') == -1)
	{
		var xcoord=20;
		var ycoord=20;

		if (typeof e != "undefined")
		{
			xcoord+=e.pageX;
			ycoord+=e.pageY;
		}
		else if (typeof window.event !="undefined")
		{
			xcoord+=truebody().scrollLeft+event.clientX;
			ycoord+=truebody().scrollTop+event.clientY;
		}

		var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15;
		var docheight=document.all? Math.max(truebody().scrollHeight, truebody().clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight);

		if (xcoord+w+3>docwidth)
		xcoord=xcoord-w-(20*2);

		if (ycoord-truebody().scrollTop+h>truebody().clientHeight)
		ycoord=ycoord-h-20;

		gettrailobj().left=xcoord+"px";
		gettrailobj().top=ycoord+"px";
	}
}