
var BAD_STR_SEARCH  = "\\`~!@#$^&*()_+|{}[];=:'<>,./?" ;
var BAD_SEARCH  = 11 ;
var BAD_STR_URL = "`~^|{}'<>?;&+[!@#*=$%]\"" ;
var BAD_URL = 8 ;


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 search_submit (caller) {

	var sTemp = new String (document.forms["search"].keyword.value) ;
	var sRes = -1 ;
	if ((sTemp.length == 0) || (sTemp == " ") || (sTemp.substr(0, 1) == " ")) {
		alert ("The field `" + 'Search' + "` cannot be empty or contain the first symbol as a space.") ;
		sRes = 0 ;
	}		
	
	if (!is_symbols_correct (sTemp, BAD_SEARCH)) {
		alert ("The field `" + 'Search' + "` should not contain special symbols.") ;
		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";}
        }
}

function writeML(part1, part2, text, cssClass)
{
	if ( text == "")
	{
		text= part1 + "@" + part2;
	}
	if (cssClass != "")
	{
		cssClass = "class=\"" + cssClass + "\"";
	}
	document.write("<a href=\"mailto:" + part1 + "@" + part2 + "\""+ cssClass +">" + text + "</a>");
}




