/* 
 * WRESTLINGGAMES.DE JAVASCRIPT FUNCTION LIBRARY
 * COPYRIGHT 2005 - WRESTLINGGAMES.DE
 * AUTHOR: Marcel Schaefers
 */

var active_tab = 'appearance';

/* 
 * void screenshot(int id, int width, int height)
 * Opens a new browser window with specified dimensions containing screenshot id.
 */

function show_screenshot(sid, width, height)
{

height = height+80;
width = width+60;

window.open('/index.php?module=screenshots&act=showscreen&sid='+sid,'','width='+width+',height='+height+',toolbar=no,menubar=no,resizeable=yes,status=no,scrollbars=no');		

}

/*
 * void confirm_deletion( void )
 * Opens confirm dialogue and voids action if necessary.
 */
 
function confirm_deletion()
{
    choice = confirm("Diese Seite wirklich löschen?\n\nACHTUNG: Dieser Vorgang kann nicht rückgängig gemacht werden!");
    
    if (!choice)
    {
        return false;
    }
}

/* 
 * obj get_element(string id)
 * Use several methods to select element by id.
 */

function get_element(id)
{
	if (document.getElementById)
	{
		obj = document.getElementById(id);
	}
	else if (document.all)
	{
		obj = document.all[id];
	}
	else if (document.layers)
	{
		obj = document.layers[id];
	}

	return obj;
}

/* 
 * void toggle_visibility(string id)
 * Toggles 'display' value of element with ID id.
 */

function toggle_visibility(element_id)
{
	obj = get_element(element_id);
	
	if (obj.style.display == "none")
	{
		obj.style.display = "";
	}
	else if (obj.style.display == "")
	{
		obj.style.display = "none";
	}
}

/* 
 * void toggle_image(string url)
 * Toggles source to image in screen layer and opens layer if invisible.
 */

function screenshot_viewer(url)
{
	obj = get_element("screenlayer");
	
	if (obj.style.display == "none")
	{
		obj.style.display = "";
	}

	screenshot = get_element("screen");
	screenshot.src = "img/wg_logo.gif";
	screenshot.src = url;
}

/* void focus_tab(id string)
 * Focuses specified tab and shows corresponding textarea.
 */

function focus_tab(id)
{
	tab = get_element("tab_"+active_tab);
	tab.className = '';

	obj = get_element(active_tab);
	obj.style.display = 'none';
 
	tab = get_element("tab_"+id);
	tab.className = 'tab_active';
                obj = get_element(id);
	obj.style.display = '';

	active_tab = id;
}