var oldselection;

function highlight(obj){
     if (obj != oldselection){
	 obj.style.backgroundColor  = "#89BBE9";
	 obj.style.color = "#FFFFFF";
	 obj.style.cursor = "hand";
     }
}
	
function resetstyle(obj){
	 if (obj != oldselection){
		 obj.style.backgroundColor  = "" ;
		 obj.style.color = "";
		 obj.style.cursor = "";
	 }
}

function select(obj){
	if (oldselection != null){
		 oldselection.style.backgroundColor  = "" ;
		 oldselection.style.color = "";
		 oldselection.style.cursor = "";
	}
    obj.style.backgroundColor  = "#89BBE9" ;
	//obj.style.color = "#ffffff";
	oldselection = obj
	document.forms[0].key.value=obj.key;
	return obj.key;
}

function LTrim(str){
	    var whitespace = new String(" \t\n\r");
	    var s = new String(str);
	    if (whitespace.indexOf(s.charAt(0)) != -1) {
		// We have a string with leading blank(s)...
		var j=0, i = s.length;
		// Iterate from the far left of string until we
		// don't have any more whitespace...
		while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
			 j++;
			// Get the substring from the first non-whitespace
			// character to the end of the string...
			s = s.substring(j, i);
		}
		return s;
}

function trim(str)
{
   return str.replace(/^\s*|\s*$/g,"");
}

function NewWindow(Pagina,Nome,w,h,scroll){
      var win = null;
      LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
      TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
      settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable=false';
      //alert("settings : "+settings);
      win = window.open(Pagina,Nome,settings);
      if (win.window.focus){
            win.window.focus();
      }
}
function NewWindow2(Pagina,Nome,w,h,scroll){
	 document.location.href= Pagina;
}

function exitLocal() {
  document.location.href="/notificare/index.jsp";
}