

function onReturn(code) {
	if (code == 13) {
		if (onReturn.arguments[1] != 'undefined' && onReturn.arguments[1] != '-') {
			document.getElementById(onReturn.arguments[1]).focus();
			performsuggest(code, onReturn.arguments[2], onReturn.arguments[3]);
		}
		if (onReturn.arguments[2] != 'undefined'){
			// addon to hide
			hide('search_suggest_' + onReturn.arguments[2]);
		}
		return false;
	}
}

function checkform() {
	//alert('Länge der Argument: ' + checkform.arguments.length);
	for (i = 0; i < checkform.arguments.length; i++) {
		//alert('checke jetzt: '+checkform.arguments[i]+'\nLänge: '+document.getElementsByName(checkform.arguments[i])[0].value.length);
		if (document.getElementsByName(checkform.arguments[i])[0].value.length == 0) {
			alert('Bitte alle Pflichtfelder ausfüllen!');
			return false;
		}
	}
	return true;
}

/**
 * based on http://techpatterns.com/downloads/javascript_check_cookies.php
 */
 
function Set_Cookie( name, value, expires, path, domain, secure ) {
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires ) expires = expires * 1000 * 60 * 60 * 24;
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name + "=" +escape( value ) +
		( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
		( ( path ) ? ";path=" + path : "" ) + 
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
}
			
function Get_Cookie( check_name ) {
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f
	for ( i = 0; i < a_all_cookies.length; i++ ) {
		a_temp_cookie = a_all_cookies[i].split( '=' );
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
		if ( cookie_name == check_name ) {
			b_cookie_found = true;
			if ( a_temp_cookie.length > 1 ) {
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found ){
		return null;
	}
}


// this deletes the cookie when called
function Delete_Cookie( name, path, domain ) {
	if ( Get_Cookie( name ) ) 
		document.cookie = name + "=" +
		( ( path ) ? ";path=" + path : "") +
		( ( domain ) ? ";domain=" + domain : "" ) +
		";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function checkCookie(){
	Set_Cookie( 'test', 'none', '', '/', '', '' );
	if ( Get_Cookie( 'test' ) ) {
		document.write( 'cookies are currently enabled.' );
		cookie_set = true;
		Delete_Cookie('test', '/', '');
	} else {
		document.write( 'cookies are not currently enabled.' );
		cookie_set = false;
	}
}

function printCookieMsg(){
	if (!checkCookie()) { 
    	document.writeln('<div class="error">');
    	document.writeln('    <div class="topic">adsfasdf##NG_NO_COOKIE_TITLE##</div>');
    	document.writeln('    <div class="msg">asdafd##NG_NO_COOKIE_MSG##</div>');
    	document.writeln('</div>');
    } else {
    	document.writeln('<div class="notice">');
    	document.writeln('    <div class="topic">adsfasdf</div>');
    	document.writeln('    <div class="msg">asdafd</div>');
    	document.writeln('</div>');
    }
}