var previouslink = '';

function LinkConvert(element,action,button)
{
	if (action != '')
		{
			script = 'javascript:ActionSubmit(\'' + action + '\')'; 
		}
	else
		{
			script = 'FormSubmit()'; 
		}
	if (document.forms[0].k.value < 16 || document.forms[0].k.value > 17) 
		{
		if ((button < 2 && navigator.userAgent.toLowerCase().indexOf('msie')!=-1) || (button < 1 && navigator.userAgent.toLowerCase().indexOf('msie')==-1))
			{
			document.forms[0].action = element.href;
			element.href='javascript:' + script;
			window.status= element;
			}
		}
}
function linkclear(element) {
	window.status='';
	element.href = previouslink;
	document.forms[0].action = requesthandler;
}
function LinkSet(element) {
	previouslink = element.href;
}

function tabbar(action,hl) {
document.form.jsaction.value = action;
document.form.newhl.value = hl;
document.form.submit();
}

function highlight(field) {
        field.focus();
        field.select();
}
function closemessage() {
		new Effect.SwitchOff('shortmessagediv');
	}

function formchanged ()
	{
	document.form.form_changed.value = 'yes';
	}


// Set Focus on the first field that contains an error
function errfocus (fieldname)
		{
		document.forms[0].elements[fieldname].focus();
		}

// Rückfrage (Ja,Nein) auslösen, Aktion zwischenspeichern

var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=10}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
win=window.open(mypage,myname,settings);}

function help(destination,win_name,win_dim) 
	{
			window.open (baseurl + '/' + destination ,win_name,win_dim + ',' + 'resizable=yes,scrollbars=yes,toolbar=no,Left=250,Top=250,status=no,directories=no,menubar=no,location=tabelle');
 	}
function SetChecked(name) 
{
	dml=document.forms[0];
	len = dml.elements.length;
	var i=0;
	for( i=0 ; i<len ; i++) 
	{
		if (dml.elements[i].name == name) 
		{
			dml.elements[i].checked=dml.checkall.checked;
		}
	}
}
	
function ConfirmSubmit(action,message) 
{
	if (confirm(message) == true)
	  {
	  ActionSubmit(action);
	  }
}
function ParameterSubmit(action) 
{
	var crit = event.srcElement.options[event.srcElement.selectedIndex].value;
	document.forms[0].action = document.forms[0].action + '?crit=' + crit + "&" + parameter;
	ActionSubmit(action);
}

function CategorySelect(fieldname)
	{
		var categoryID = document.forms[0].elements[fieldname].options[document.forms[0].elements[fieldname].selectedIndex].value;
		action = 'act_albums_list_categories:categoryID=' + categoryID;
		document.forms[0].action = 'kategorie.cfm?categoryID=' + categoryID;
		ActionSubmit(action);
}
function CategorySelectGroup(fieldname)
	{
		var categoryID = document.forms[0].elements[fieldname].options[document.forms[0].elements[fieldname].selectedIndex].value;
		action = 'act_albums_listgroup_categories:categoryID=' + categoryID;
		document.forms[0].action = 'kategorie.cfm?categoryID=' + categoryID;
		ActionSubmit(action);
}
function CategorySelect2(fieldname)
	{
		var categoryID = document.forms[0].elements[fieldname].options[document.forms[0].elements[fieldname].selectedIndex].value;
		action = 'act_shared_none:categoryID=' + categoryID;
		document.forms[0].action = 'myalbums.cfm?categoryID=' + categoryID;
		ActionSubmit(action);
}


function linkclear() {
		window.status='';
		document.forms[0].action = requesthandler;
		}
		
// Aktion über URL-Variable verschicken.
function ActionSubmit(action) {
	document.forms[0].jsaction.value = action;
	document.forms[0].submit();
	}
function FormSubmit(action) {
		document.forms[0].submit();
	}

function formsubmit(action,message) {
	if (message != '')
		{if (confirm (message) == true)
			{
			document.forms[0].action = document.forms[0].action + "?action=" + action;
			document.forms[0].submit();
			}
		}
	else
		{
		document.forms[0].action = document.forms[0].action + "?action=" + action;
		document.forms[0].submit();
		}
}

	<!-- begin to hide script contents from old browsers
	function checksearch()
	  {
		var searchlen = document.forms[0].searchterm.value;
		if(searchlen == "")
			{
			alert("Bitte geben Sie einen Suchbegriff ein!");
			}
		else {
				ActionSubmit('act_products_search');
			 }
	  }
	// end hiding script from old browsers -->



	function popitup(destination,win_name,win_dim) 
	{
			window.open (baseurl + '/' + destination ,win_name,win_dim + ',' + 'resizable=yes,scrollbars=yes,toolbar=no,Left=250,Top=250,status=no,directories=no,menubar=no,location=tabelle');
 	}



	if (document.layers) document.captureEvents(Event.KEYPRESS); 
	// needed if you wish to cancel the key

	function kexhandler(e) {
	    if (document.layers)
	        Key = e.which;
	    else
	        Key = window.event.keyCode;
			
//        alert("Key pressed! ASCII-value: " + Key);

	    if (Key == 13){
			var searchlen = document.forms[0].searchterm.value;
			if(searchlen == "")
				{
				alert("Bitte geben Sie einen Suchbegriff ein!");
			    if (document.layers)
					return false;
		    	else
					window.event.returnValue = false;
				}
			else {
					ActionSubmit('act_auctions_search');
				 }
			}
	}
