function open_email_form(id,name){
	$("fac_id").value =id;
	$("facility_name").innerHTML = "To:"+ unescape(name);
	$("email-contact-form").show();
	$("content").focus();
}

function open_email_reviewer_form(id){
	$("rev_id").value =id;
	$("email-contact-form-reviewer").show();
	$("content").focus();
	document.location.href="#email-contact-form-reviewer"
}

function get_url_param(name) {
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}    

function add_url_param(url, paramName, paramValue) {
    if (url.indexOf('?') == -1) {
        return url + "?" + paramName + "=" + paramValue;
    } else {
        return url + "&" + paramName + "=" + paramValue;
    }
}

function disableElement(elemid) {$(elemid).disabled = true;}

function $S(o) { return((typeof(o)=='object'?o:$(o)).style); }
function agent(v) { return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0)); }
function abPos(o) { var o=(typeof(o)=='object'?o:$(o)), z={X:0,Y:0}; while(o!=null) { z.X+=o.offsetLeft; z.Y+=o.offsetTop; o=o.offsetParent; }; return(z); }
function XY(e,v) { var o=agent('msie')?{'X':event.clientX+document.documentElement.scrollLeft,'Y':event.clientY+document.documentElement.scrollTop}:{'X':e.pageX,'Y':e.pageY}; return(v?o[v]:o); }

star={};
star.mouse=function(e,o) { if(star.stop || isNaN(star.stop)) { star.stop=0;
    document.onmousemove=function(e) { var n=star.num;
        var p=abPos($('star'+n)), x=XY(e), oX=x.X-p.X, oY=x.Y-p.Y; star.num=o.id.substr(4);
        if(oX<1 || oX>84 || oY<0 || oY>19) { star.stop=1; star.revert(); }
        else {
            if (oX < 9) {
                oX = 8;
            } else if (oX < 17) {
                oX = 17;
            } else if (oX < 26) {
                oX = 25;
            } else if (oX < 35) {
                oX = 34;
            } else if (oX < 43) {
                oX = 42;
            } else if (oX < 51) {
                oX = 50;
            } else if (oX < 60) {
                oX = 59;
            } else if (oX < 67) {
                oX = 67;
            } else if (oX < 77) {
                oX = 76;
            } else {
                oX = 84;
            }
            $S('starCur'+n).width=oX+'px';
            $S('starUser'+n).color='#111';
            $('starUser'+n).innerHTML=Math.round(oX/84*100)+'%';
        }
    };
} };
var star_update_element_mapping = new Array();
star.update=function(e,o) {
    var n=star.num, v=parseInt($('starUser'+n).innerHTML);
    n=o.id.substr(4); $('starCur'+n).title=v;
    $(star_update_element_mapping[n]).value = v;
};
star.revert=function() { var n=star.num, v=parseInt($('starCur'+n).title);
    $S('starCur'+n).width=star.get_star_rating_width(v);
    $('starUser'+n).innerHTML=(v>0?Math.round(v)+'%':'0%');
    $('starUser'+n).style.color='#888';
    document.onmousemove='';
};
star.get_star_rating_width=function(v) {
    return v > 0 ? Math.round(v*84/100)+ 'px' : '0px';
};
star.num=0