function changepage(p_formname, p_elementname)
{
	var popup = document[p_formname].elements[p_elementname];
	window.open(popup.options[popup.selectedIndex].value, '_top');
}

function cp2(p_formname, p_elementname)
{
	var action = document[p_formname].action;
	var script = document[p_formname].elements[p_elementname];
	window.open(action + '&' + p_elementname + '=' + script.options[script.selectedIndex].value, '_top');
}

function cp3(p_formname, p_elementname, p_path)
{
	var path = document[p_formname].elements[p_path].value;
	var tick = document[p_formname].elements[p_elementname];
	var page = tick.options[tick.selectedIndex].value;
	window.open(path + '?' + page, '_top');
}

function changepic(elementid, highlighted)
{
	element = document.getElementById(elementid);

	if(highlighted != false)	element.src = "/images/mainpix/bullet_glow.gif";
	else				element.src = "/images/mainpix/bullet.gif";
}

function cbc(element, normal)
{
	if(normal == 0)	element.style.background='transparent';
	else		element.style.background='#547454';
}

function cbc2(element, normal)
{
	if(normal == 0)	element.style.background='#383F38';
	else		element.style.background='#547454';
}

function cp(file)
{
	location.href = "?m=" + file;
}

function GfxPopup(gfx,name,w,h)
{
   	var windowHeight = h
	var windowWidth = w
   	var leftX = (screen.availWidth / 2)  - (windowWidth / 2);
   	var topY = (screen.availHeight / 2) - (windowHeight / 2);

	if(name == "Image")
	{
		win = window.open('/images/showimage.php?image='+gfx + '&amp;w=' + w + '&amp;h=' + h, name, 
                	     	"left=" + leftX +
                     		",top=" + topY +
	                     	",height=" + windowHeight +
        	             	",width=" + windowWidth +
                	     	",locationbar=no,menubar=no,resizable=yes,status=no,scrollbars=no");
	}
	else if(name == "Chat")
	{
		win = window.open('/images/chat/chat.php', name, 
                	     	"left=" + leftX +
                     		",top=" + topY +
	                     	",height=" + windowHeight +
        	             	",width=" + windowWidth +
                	     	",locationbar=no,menubar=no,resizable=yes,status=no,scrollbars=yes");
	}
	else if(name == "rlpics")
	{
		win = window.open('/images/rlpics.php?rlpic=' + gfx, name, 
                	     	"left=" + leftX +
                     		",top=" + topY +
	                     	",height=" + windowHeight +
        	             	",width=" + windowWidth +
                	     	",locationbar=no,menubar=no,resizable=no,status=yes,scrollbars=no");
	}
	win.window.focus()
}

function PageScripts()
{
	var file = document.location.pathname;
	switch(file)
	{
		case "/de/library/serversaves.wot":
		case "/en/library/serversaves.wot":
			StartCounter();
			break;
		default:
			break;
	}
}