function isNumeric(elem){
	var numericExpression = /^[0-9]+$/;
	if(elem.match(numericExpression)){
		return true;
	}else{
		return false;
	}
}
function isText(elem){
	var textExpression = /^[a-zA-Z0-9\ \.\-]+$/;
	if(elem.match(textExpression)){
		return true;
	}else{
		return false;
	}
}
function isEmail(elem){
	var emailExpression = /^[a-zA-Z0-9_\.\-]+\@([a-zA-Z0-9\-]+\.)+[a-zA-Z0-9]{2,4}$/;
	if(elem.match(emailExpression)){
		return true;
	}else{
		return false;
	}
}

$(document).ready(function(){
  
  //search
  var searchBoxDefault = "Zadejte hledaný výraz ...";
  var searchBox = $("#search");
  
  searchBox.focus(function(){
		if($(this).attr("value") == searchBoxDefault) $(this).attr("value", "");
	});
	
	searchBox.blur(function(){
		if($(this).attr("value") == "") $(this).attr("value", searchBoxDefault);
	});
	
	//hledany vyraz
  var searchBoxCalDefault = "Zadejte hledaný výraz . . .";
  var searchBoxCal = $("#hledany_vyraz");

  searchBoxCal.focus(function(){
		if($(this).attr("value") == searchBoxCalDefault) $(this).attr("value", "");
	});

	searchBoxCal.blur(function(){
		if($(this).attr("value") == "") $(this).attr("value", searchBoxCalDefault);
	});
  
  //hover menu  
  $("#mainmenu ul li a").hover(
    function() {
      if ($(this).parent().prev().children("a").attr("class")!="active") { 
        $(this).parent().prev().children("a").attr("class","noseparator");
      }
     },
    function() {
      if ($(this).parent().prev().children("a").attr("class")!="active") { 
        if ($(this).attr("class")!="active") {
        $(this).parent().prev().children("a").attr("class","");
        }
      }
     }
    );
  
  //menu
  $("#mainmenu ul li a.active").each(function() {
     $(this).parent().prev().children("a").attr("class","noseparator");
      }
    );
  
  //externi odkazy
  $("a").each(function() {
  if ($(this).attr("href") != null ) {
    if ($(this).attr("href").substring(4,0)=="http")
    {
        if ($(this).attr("href").substring(24,0)!="http://www.czechtrade.cz") {
          $(this).attr("target","_blank");
        }
      }
    }
  });
});