
function doSiteSearch() {
  // Called when site users clic the "GO" button/lin next to the search field above-right each page
  var frm = document.forms['frmTopSearch'];
  var s = frm.elements['query'];
  if (s.value=='') return false; 
  else frm.submit()
}

function hasValue(value) {
	if ((value != null) && (value != "") && !isblank(value))  return true;
	else return false;
}

function isblank(s){
	for (var i=0; i<s.length; i++) {
		var c = s.charAt(i);
		if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
	}
	return true;
}
  
function doBorder(img, bdrColor) {
 if (img.style) eval("img.style.borderColor = '" + bdrColor + "';")
} 

function loseBorder(img) {
 if (img.style) img.style.borderColor = 'white';
}

function doMsg() {
 alert("\nThis page will be available soon\n");
}
  
function openPlainWindow(url,width,height,winName) {
  var top = (screen.height - height)/2;
  var left = (screen.width - width)/2;
  var winProps = 'height='+height+',width='+width+',scrollbars=no,top='+top+',left='+left;
  window.open(url,winName,winProps);
}

function showMovie() {
  //openPlainWindow('http://www.mcri.edu.au/ironxs/video_youtube.html',430,355,'videoWindow')
  openPlainWindow('http://www.ironxs.com.au/video_silverlight.html',326,292,'videoWindow')
}

function parseQueryString (str) {
/*  Puts querystring arguments into a hash
	Usage:  
	var args = parseQueryString (); alert(qsArgs[varName]);   	// display single variable
	for (var arg in qsArgs) alert(arg + ' = ' + qsArgs[arg]);		// display all variables 	*/
  str = str ? str : location.search;
  var query = str.charAt(0) == '?' ? str.substring(1) : str;
  var args = new Object();
  if (query) {
    var fields = query.split('&');
    for (var f = 0; f < fields.length; f++) {
      var field = fields[f].split('=');
	  if (field[0] && field[1]) {
	      args[unescape(field[0].replace(/\+/g, ' '))] = unescape(field[1].replace(/\+/g, ' '));
	  }
    }
  }
  return args;
}

function highlightPageInLeftMenu(menuID) {
  /* Highlights the current page in the left hand-side menu. It first looks for the menu specified by the 'menuID' parameter. Then
   it gets all links contained within the menu and cycles through them, looking for a link that matches the current page URL.
   If it finds a match, it adds a class name of "selected-menu-item" to the matching link (which effectively highlights the
   current page within the left menu). */
  var thisPage = location.href.toLowerCase()
  if (document.getElementById) {
  // Is there a left menu?
    var leftMenu;
	eval('leftMenu = document.getElementById("'+menuID+'")')
	if ((typeof (leftMenu) != "undefined") && leftMenu) {
  	// Get all links in the left hand-side menu
	  var menuLinks = leftMenu.getElementsByTagName("A");
	  if (typeof menuLinks != "undefined") {
	    // cycle through the array of links
		for (var i=0; i<menuLinks.length; i++) {
			// highlight the link with the same HREF attribute as the current page
			var thisLink = menuLinks[i].href.toLowerCase();
			if (thisPage.indexOf(thisLink)>-1) menuLinks[i].className += " selected-menu-item";
		}
	  }
	}
  }
}

/*
function clearSearchText(e) {
 if (e.value == "Search this website") {
   e.value = "";
   if (e.style) e.style.color = "#5888A1";
 }
} 

function resetSearchText(e) {
 if (e.value == "") {
  e.value = "Search this website";
  if (e.style) e.style.color = "#A6C5E3";
 }
} 
*/ 