// TurnPages functions
// (c) 2007, Forward Thinking BV
// www.turnpages.com
//
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];
    		}
  		} 
	}
//
//////////// MAKE SESSION ////////////////
function makeSessionID(){
	var mySession = "pl_";
	for (var i = 0; i<32; i++) {
		//mySession = mySession+chr(Math.round(25*Math.random()+65);
		mySession = mySession+chr(Math.round(25*Math.random()+65));
	}
	return mySession;
}
//
function chr(CHARACTER_CODE){
	return String.fromCharCode(CHARACTER_CODE);
}
//
function loadPreloader(){
/////////////////////  DEFINITIONS
	  movieName = "preloader";
      flName = "preloader.swf";
      flColor = "#FFFFFF";
	  flWidth = "970";
      flHeight = "570";
	  flId = "turnpages";
	  FlRequestString = "?gPage=" + top.getQueryVariable("openPage");		
	  FlRequestString = FlRequestString + "&gSession=" + gSession;	 	    
	  FlRequestString = FlRequestString + "&gCall=" + top.getQueryVariable("call");	 
/////////////////////  HTML
	  FlObject = '<OBJECT '
	  +  'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'	  
      + ' WIDTH="' + flWidth + '"'
      + ' HEIGHT="' + flHeight + '"'
	  + ' id="' + flId + '">'
      + '<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 + '"'
      + '>'
      + '</EMBED></OBJECT>'
	document.write(FlObject);
}
//
//
