// TurnPages functions
// (c) 2006, Forward Thinking BV
// www.turnpages.com
//
/////////////////////  FUNCTIONS
	function getQueryVariable(variable) {
  		var query = window.location.search.substring(1);
  		var vars = query.split("&");
  		for (var i=0;i<vars.length;i++) {
    		var pair = vars[i].split("=");
    		if (pair[0] == variable) {
      			return pair[1];
    		}
  		} 
	}
	
	function getPage() {
  		var pageAll = window.location.href;
  		var pageArray = pageAll.split("?");
  		
		return pageArray[0];
	}
	
	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]
	  }
	}

	function preloader_DoFSCommand(command, args) { 
		if (command == "gotoModule") { 
			var page = getPage();
			var URL = page + "?" + PageRequestString;
			document.location.replace(URL)
			//alert(URL);
  		} else {
			PageRequestString = PageRequestString + "&" + command + "=" + args;
		}
	}

	
	
	function loadPreloader(){
/////////////////////  DEFINITIONS

	  movieName = "weclome";
      flName = "preloader.swf";
      flColor = "#000000";
      flHeight = "570";
      flWidth = "970";
	  flId = movieName;
	  paramMoviePath = getQueryVariable("moviePath");
	  paramMovieSWF = getQueryVariable("movieSWF");
	  paramMenuXMLPath = getQueryVariable("menuXMLPath");
	  paramgPage = getQueryVariable("gPage");
	  FlRequestString = "?";
	  FlRequestString = FlRequestString + "&moviePath=" + paramMoviePath;
	  FlRequestString = FlRequestString + "&movieSWF=" + paramMovieSWF;
	  FlRequestString = FlRequestString + "&menuXMLPath=" + paramMenuXMLPath;
	  FlRequestString = FlRequestString + "&gPage=" + paramgPage;
	  PageRequestString = "";
	  
/////////////////////  HTML
	  FlObject = '<OBJECT '
      +  'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
      + ' codebase="http://download.macromedia.com/pub/shockwave/cabs/swflash.cab#version=6,0,0,0"'
	  + ' id="' + flId + '"'
      + ' WIDTH="' + flWidth + '"'
      + ' HEIGHT="' + flHeight + '">'
      + '<PARAM NAME="movie" VALUE="' + flName + FlRequestString + '">'
      + '<PARAM NAME="quality" VALUE="high">'
      + '<PARAM NAME="bgcolor" VALUE="' + flColor + '">'
	  // Embed
      + '<EMBED src="' + flName + FlRequestString + '"'
      + ' name="' +  flId + '"'
      + ' quality="high" bgcolor="' + flColor + '"'
      + ' WIDTH="' + flWidth + '"'
      + ' HEIGHT="' + flHeight + '"'
      + ' TYPE="application/x-shockwave-flash"'
      + ' PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"'
	  + ' swLiveConnect="true"'
      + '>'
      + '</EMBED></OBJECT>'
	  
	  // write to html
	document.write(FlObject)

}
//
// RESIZE AND CENTER BROWSER WINDOW
	if (document.all) {
		top.window.resizeTo(screen.availWidth,screen.availHeight);
	}
	else if (document.layers||document.getElementById) {
		if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
		top.window.outerHeight = screen.availHeight;
		top.window.outerWidth = screen.availWidth;
		}
	}

	var myScreenWidth = screen.availWidth;
	var myScreenHeight = screen.availHeight;
	var myX0 = (myScreenWidth/2) - 512;
	var myY0 = (myScreenHeight/2) - 384;
	if (myX0 < 0) {
		myX0 = 0;
	}
	if (myY0 < 0) {
		myY0 = 0;
	}	
	window.moveTo(myX0,myY0);
	
	var myWidth = 1024;
	var myHeight = 768;
	
	if (myWidth > myScreenWidth){
		myWidth = myScreenWidth
	}

	if (myHeight > myScreenHeight){
		myHeight = myScreenHeight
	}
	
	self.resizeTo(myWidth,myHeight);
	var win= null;
//// END
