// --------------------------------------------------------------
// javascript funtions library - common to all pages


// --------------------------------------------------------------
// preload images for faster webpage viewing
function preloadImages() { 
	var d=document; 
	if(d.images){ 
		if(!d.MM_p) 
			d.MM_p=new Array();

	var i,j=d.MM_p.length,a=preloadImages.arguments; 
	
	for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ 
			d.MM_p[j]=new Image; 
			d.MM_p[j++].src=a[i];}
		}
}

// --------------------------------------------------------------
// dynamically load javascript or stylesheet files
function loadjscssfile(filename, filetype){
 if (filetype=="js"){ //if filename is a external JavaScript file
  var fileref=document.createElement('script')
  fileref.setAttribute("type","text/javascript")
  fileref.setAttribute("src", filename)
 }
 else if (filetype=="css"){ //if filename is an external CSS file
  var fileref=document.createElement("link")
  fileref.setAttribute("rel", "stylesheet")
  fileref.setAttribute("type", "text/css")
  fileref.setAttribute("href", filename)
 }
 if (typeof fileref!="undefined")
  document.getElementsByTagName("head")[0].appendChild(fileref)
}

// --------------------------------------------------------------
// dynamically show hide div blocks
 function viewMore(div) {
	obj = document.getElementById(div);
	col = document.getElementById("x" + div);
	
	if (obj.style.display == "none") {
		obj.style.display = "block";
		col.innerHTML = "< Less";
	} else {
		obj.style.display = "none";
		col.innerHTML = "Read More. >";
	}

	Nifty('div#block,div#block_right1','big');
}


// --------------------------------------------------------------
// dynamically show hide div blocks
  function showLoc(loc,domain) {
     newwindow=window.open('http://'+domain+ 'pages/misc/location_popup.php?id='+loc,'mywindow','width=675,height=520,toolbar=0,resizable=1,menubar=0' );
	 if (window.focus) {newwindow.focus();}
	 return false; 
   } 
