/*
private String convertStrToUnicode(String value) {
  short valueAsShort = Short.parseShort(value.trim(),16);
  return String.valueOf((char)valueAsShort);
}
  */
 
 function nl2br_10(str) {
   if(typeof(str)=="string") return str.replace(/(\r\n)|(\n\r)|\r|\n/g,"<br>");
   else return str;
} 

function findAmp(s) {
  s+="";
  r=""; c="";
  while(s.length) {
  if(s.substr(0,1)=="&") 
     r+="och";
 // else if(s.substr(0,1)=="\r") if(c!="\n") r+="&ltBR>";
  else r+=s.substr(0,1);
  c=s.substr(0,1);
   s=s.substr(1,s.length-1);
}
return r;
}

function nl2br_12(s) {
  s+="";
  r=""; c="";
  while(s.length) {
  if(s.substr(0,1)=="\n") if(c!="\r") r+="<br />";
 // else if(s.substr(0,1)=="\r") if(c!="\n") r+="&ltBR>";
  else r+=s.substr(0,1);
  c=s.substr(0,1);
   s=s.substr(1,s.length-1);
}
return r;
}
  
  function affectDiv(phpFunction,targetDiv,site,item1){

      new Ajax.Updater(targetDiv, "functions/php_functions.php?function="+phpFunction+"&site="+site+"&item1="+item1, { method:'get',evalScripts: true});
  
	}


  function uppdateDiv(phpFunction,targetDiv,site,item1){
    var item2 = document.textForm.textarea.value;
    item2 = findAmp(nl2br_10(item2));
     //alert(item1);
    new Ajax.Updater(targetDiv, "functions/php_functions.php?function="+phpFunction+"&site="+site+"&item1="+item1+"&item2="+item2, { method:'get',evalScripts: true});
	}

  function confirmAlert(item1,item2){
    //alert(item1);
    
    if (confirm("Om du trycker ok kommer denna " + item2 + " tas bort!"))
    {
      document.location = item1;
    }
    else
    {
      //var newUrl = document.location.href + url ;
  		document.location = document.location.href;
    }
    
  }
  function buttonToggle(item1){
  //
    new Ajax.Updater("buttonDiv", "user.php?command=buttonToggle&searchQuery="+item1, { method:'get',evalScripts: true});
  }
 

