//maked all added functions work onload. at the end of each function you want to work onload add addLoadEvent(function); to the end of the function.
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}

// The following two functions make it possible to have web standard popups
window.onload = function() {
  if (!document.getElementsByTagName) return false;
  var lnks = document.getElementsByTagName("a");
  for (var i=0; i<lnks.length; i++) {
    if (lnks[i].className == "popup") {
      lnks[i].onclick = function() {
        popUp(this.getAttribute("href"));
        return false;
      }
    }
  }
}

function popUp(winURL) {
  window.open(winURL,"popup");
}

//-- Create a :Hover psuedo attribute for IE for header -- //
hdrHover = function() {
	if (document.getElementById('headerNav') != null) {
		if((document.all)&&(document.getElementById)) {
			var hdrCat = document.getElementById("headerNav").getElementsByTagName("li");
			for (var i=0; i<hdrCat.length; i++) {
				hdrCat[i].onmouseover=function() {
					this.className+=" hdrhover";
				}
				hdrCat[i].onmouseout=function() {
					this.className=this.className.replace(new RegExp(" hdrhover\\b"), "");
				}
			}
		}	
	}
}
addLoadEvent(hdrHover);


//*****Load all functions**************************************************//
if (typeof jQuery != 'undefined') {
  $(document).ready(function(){
    $('a[rel^="prettyPhoto"]').prettyPhoto();
  });
}
