var BAD_STR_SEARCH  = "\\`~!@^*_{}[]=<>" ;
var BAD_SEARCH  = 11 ;

function is_symbols_correct (str, what_case) {
	var BAD = "" ;
	
	if (what_case == BAD_SEARCH) {
		BAD = BAD_STR_SEARCH ;
	}	
	var symbol ;
	var l = str.length ;
	for (var i = 0 ; i < l ; i++) {
		symbol = str.substr(0, 1) ;
		if (BAD.indexOf (symbol) > 0) return false ;
		if ((escape (symbol) == "%5C") && (BAD != BAD_STR_URL)) return false ;
		str = str.substr (1) ;
	}
	return true;
}

function trim_value(value) 
{
	return value.replace(/^\s*/,'').replace(/\s*$/,'');
}

function search_submit (caller) {
	
	var sTemp = new String (document.forms["search"].keyword.value);
	sTemp = trim_value(sTemp);
	var sRes = -1 ;
	if ((sTemp.length == 0) || (sTemp == " ") || (sTemp.substr(0, 1) == " ")) {
		alert ("Das Feld 'Suche' muss angegeben werden!") ;
		sRes = 0 ;
	}		
	
	if (!is_symbols_correct (sTemp, BAD_SEARCH)) {
		alert ("Bitte keine Sonderzeichen im Feld  `" + 'Suche' + "` .") ;
		sRes = 0 ;
	}		

	if (sRes == 0) {
		document.forms ["search"].keyword.focus () ;
		if (caller != "button")	return false ;
	}
	else {
		document.forms ["search"].submit () ;
	}
	return void (false) ;
}


function SetStyles()
{
   // alert(window.navigator.userAgent);
    
    var agent = window.navigator.userAgent;
    
    if (agent.indexOf("Opera 8.") != -1)
        {
            var el = document.getElementById("keyword");                 
            if (el != null) el.style.height = 20;
        }
        
    if (agent.indexOf("Opera 7.") != -1)
        {
            var el = document.getElementById("keyword");                 
            if (el != null) el.style.height = 18;
        }
    
    if (agent.indexOf("MSIE 5.") != -1)
        {
            var el = document.getElementById("keyword");                 
            if (el != null) el.style.height = 20;
        }
        
    if (agent.indexOf("MSIE 5.01") != -1)
        {            
            var el = document.getElementById("results_content_right_text");                 
            if (el != null){el.style.overflow = "hidden";}
        }
}