
var rslt= navigator.appVersion.match(/MSIE (\d+\.\d+)/, ''); 
function Is() {
    var agent = navigator.userAgent.toLowerCase();
    this.ie   = (agent.indexOf("msie") != -1 && (agent.indexOf("opera") == -1));
    this.iemac=this.ie && agent.indexOf("mac")!=-1;
    this.opera=(agent.indexOf("opera") == -1);
    this.iewin=this.ie && !this.iemac;
    this.gecko=(navigator.product == "Gecko");
    this.ie6=(this.ie && rslt[1]<7); 
	this.ie7=(this.ie &&  rslt[1]>6 && rslt[1]<8);
}
var is = new Is();     
var bcolor='#4E9597';
var fcolor='#fff';
var urlbase=window.location.href;urlbase=urlbase.replace('acces/','');
urlbase=urlbase.substr(0,urlbase.lastIndexOf('/')+1);
function getAjax(url,parms,typ,dv,func,zonepatient) {

  if(zonepatient!=null) { zonepatient=document.getElement('div[id'+zonepatient+']');
  var keepcontent=zonepatient.innerHTML;
 setElHtml(zonepatient,'Patienter ...');};
 url=urlbase+url.replace(urlbase,'')+parms;
 var goback=function() {setElHtml(zonepatient,keepcontent);}
 var gobackerror=function() {window.location.href=url.replace('&popup=1','');};

var ajaxOptions = {
			method: 		typ,
			update: 		$(dv),
			evalScripts : true,
			onSuccess :  func ,
			onCancel : goback,
			onFailure: 	    gobackerror
			};
			   var ajax=new Ajax(url, ajaxOptions).request();

 };

function setElHtml(el,val)
{  if(document.all) {el.innerHTML=val;} else  if(el!=undefined && el!=null) {el.innerHTML=val;}; 
};


 function inidiv(divname,divp,decalx,decaly)
{
    doc=document.getElementById(divname);
    pos = document.getElementById(divp);
        DivLeft=parseInt(getLeft(pos))+decalx;

         DivTop=parseInt(getTop(pos))+decaly;

              doc.style.top = DivTop+"px";

        doc.style.left = DivLeft+"px";


};
function getLeft(MyObject)
    {
    if (MyObject.offsetParent)

        return (MyObject.offsetLeft + getLeft(MyObject.offsetParent));
    else

        return (MyObject.offsetLeft);
    }
function getTop(MyObject)
    {
    if (MyObject.offsetParent)
        return (MyObject.offsetTop + getTop(MyObject.offsetParent));
    else
        return (MyObject.offsetTop);
    }

function maketext(tx)
{
tx=tx.replace(/(<([^>]+)>)/ig,"");
return tx;
};

function init_tooltips()
{
         var as = [];
	$$('a').each(function(a){if (a.getAttribute('title')) as.push(a);});	
	new Tips(as, {maxOpacity: 0.9, maxTitleChars: 25});

};
