/*	

	Dusted Design Partners Limited

*/
var movieName = "soundPlayer";

function thisMovie(movieName) {
  // IE and Netscape refer to the movie object differently.
  // This function returns the appropriate syntax depending on the browser.
  if (navigator.appName.indexOf ("Microsoft") !=-1) {
    return window[movieName]
  } else {
    return document[movieName]
  }
}

// Checks if movie is completely loaded.
// Returns true if yes, false if no.
function movieIsLoaded (theMovie) {
  // First make sure the movie's defined.
  if (typeof(theMovie) != "undefined") {
    // If it is, check how much of it is loaded.
    return theMovie.PercentLoaded() == 100;
  } else {
    // If the movie isn't defined, it's not loaded.
    return false;
  }
}

function playSound() {
  if (movieIsLoaded(thisMovie(movieName))) {
    thisMovie(movieName).GotoFrame(2);
  }
}
function stopSound() {
  if (movieIsLoaded(thisMovie(movieName))) {
    thisMovie(movieName).GotoFrame(0);
  }
}

clickInit = function() {
	if (document.getElementById("header")) {
		var headLinks = document.getElementById("header").getElementsByTagName("a");
		for (var i=0; i<headLinks.length; i++) {
			headLinks[i].onmouseover=function() {
				playSound();
			}
			headLinks[i].onmouseoout=function() {
				stopSound();
			}
		}
	}
}

printLink = function() {
	if (document.getElementById("footer-print")) {
		var printBut = document.getElementById("footer-print");
		printBut.onclick=function() {
			if (window.print) {
				if (expanders) {
					mooFx("expandAll");
				}
				window.print();
			} else {
				alert("Unfortunately your browser doesn't support printing via Javascript.\nTo print this page please select \"File > Print...\" in your browser's menu.");
			}
			return false;
		}
	}
}

popupLauncher = function() {
	var tabEls = document.getElementsByTagName("a");
	for (var i=0; i<tabEls.length; i++) {
		if (tabEls[i].getAttribute("rel")) {
			var relIndex = tabEls[i].getAttribute("rel");
			var relSplit = relIndex.split("|");
			if (relSplit[0] == "external") {
				tabEls[i].onclick=function() {
					var relIndex = this.getAttribute("rel");
					var relSplit = relIndex.split("|");
					var windowName = relSplit[1];
					windowAttrib = "width=" + relSplit[2] + ",height=" + relSplit[3];
					window.open(this.href,windowName,windowAttrib);
					return false;
				}
			}
		}
	}
}


window.onload = function() {
	popupLauncher();
}