// bookmark page
bookmarkurl=window.location.href;
bookmarktitle=document.title;

function bookmarksite(){
if (window.sidebar) // firefox
	window.sidebar.addPanel(bookmarktitle, bookmarkurl, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',bookmarkurl);
	elem.setAttribute('title',bookmarktitle);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(bookmarkurl, bookmarktitle);
}

// basic show hide for adv search
function showHide(el) {
	if (document.getElementById(el)){
		if (document.getElementById(el).style.display=="block"){
			document.getElementById(el).style.display="none"
		} else {
			document.getElementById(el).style.display="block"
		}
	}
}

// fix ie image label problem
window.onload = function(){
  if(document.all && navigator.appVersion.indexOf("MSIE")>-1 && navigator.appVersion.indexOf("Windows")>-1)
  {
    var a = document.getElementsByTagName("label");
    for(var i=0,j=a.length;i<j;i++){
      if(a[i].hasChildNodes && a[i].childNodes.item(0).tagName == "IMG")
      {
        a[i].childNodes.item(0).forid = a[i].htmlFor;
        a[i].childNodes.item(0).onclick = function(){
          var e = document.getElementById(this.forid);
          switch(e.type){
            case "radio": e.checked|=1;break;
            case "checkbox": e.checked=!e.checked;break;
            case "text": case "password": case "textarea": e.focus(); break;
          }
        }
      }
    }
  }
}

// scrolling checkbox lists
function addLoadEvent(func) {
	var oldonload = window.onload;
	
	if (typeof window.onload != "function") {
		window.onload = func;
	} else {
		window.onload = function () {
			oldonload();
			func();
		}
	}
}
	
addLoadEvent(function () {
	initChecklist();
});

function initChecklist() {
	if (document.all && document.getElementById) {
		// Get all unordered lists
		var lists = document.getElementsByTagName("ul");
		
		for (i = 0; i < lists.length; i++) {
			var theList = lists[i];
			
			// Only work with those having the class "checklist"
			if (theList.className.indexOf("checklist") > -1) {
				var labels = theList.getElementsByTagName("label");
				
				// Assign event handlers to labels within
				for (var j = 0; j < labels.length; j++) {
					var theLabel = labels[j];
					theLabel.onmouseover = function() { this.className += " hover"; };
					theLabel.onmouseout = function() { this.className = this.className.replace(" hover", ""); };
				}
			}
		}
	}
}