function bookmark()
{
	var url=document.location.href;
	var title=document.title;
	
	if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) 
	{
		window.external.AddFavorite(url,title);
	}
	else if (navigator.appName == "Netscape") 
	{
		window.sidebar.addPanel(title,url,"");
	}
	else 
	{
		alert("Verwenden Sie bitte die Bookmark Funktion Ihres Browsers.");
	}
}

// Show and hide content depending on selected option of drop down field
var $isShown = null;
function showMore($value)
{
	// Same element, nothing to do
	if ($isShown == document.getElementById('DropDown_' + $value)) {return;}
	// $currentlyShown could be null.
	// Reset to display = none
	if($isShown)
	{
		$isShown.style.display = 'none';
	}
	
	$isShown = document.getElementById('DropDown_' + $value);
	// Check for invalid selection or no available options.
	if($isShown)
	{
		$isShown.style.display = '';
	}
}

var $currentlyShown = null;
function showOptions($value, $aselectNew, $aselectField)
{
	for (j=0; j < $aselectField.length; j++) {
	    $selectLength = document.forms["ketroubletickets_ticketform"].elements["tx_ketroubletickets_pi1[" + $aselectField[j] + "]"].options.length;
	   for (i=$selectLength-1; i >=0; i--) {
		    document.forms["ketroubletickets_ticketform"].elements["tx_ketroubletickets_pi1[" + $aselectField[j] + "]"].options[i] = null;
	    }
	    // If no options are defined, set to default option array[0]
	    if (!$aselectNew[j][$value]) {
	      $value = 0;
	    }
	    // Build new select options
	    for (i=0; i < $aselectNew[j][$value].length; i++) {
			if ($aselectNew[j][$value][i][2] != '') selected = true;
			else selected = false;
		    document.forms["ketroubletickets_ticketform"].elements["tx_ketroubletickets_pi1[" + $aselectField[j] + "]"].options[i] = new Option ($aselectNew[j][$value][i][1], $aselectNew[j][$value][i][0], false, selected);
	    }
	}
}

function setCSS(css, attribute) {
    for (var c in css) {
	el = css[c]['field'];
	property = css[c]['css'];
	if (el && property && typeof property === 'object') {
	    if (typeof el === 'string') {
	    els = document.getElementById(el);
	    }
	    if (typeof el === 'object' && el.length && el.length > 0) {
		for (var i = 0; i < el.length; i++) {
		    els = document.getElementById(el[i]);
		    if (els) {
			for (var j in property) {
			    els.style[j] = property[j];
			}
		    }
		}
	    } else {
		for (var j in property) {
		    els.style[j] = property[j];
		}
	    }    
	}
    }
    for (var c in attribute) {
	el = attribute[c]['field'];
	property = attribute[c]['attribute'];
	if (el && property && typeof property === 'object') {
	    if (typeof el === 'object' && el.length && el.length > 0) {
		for (var i = 0; i < el.length; i++) {
		    els = document.getElementById(el[i]);
		    if (els) {
			for (var j in property) {
			    els.setAttribute(j, property[j]);
			}
		    }
		}
	    }    
	}
    }
}

