/* iperceptionsXXX.js
	This js file is included in the client homepage.
	It generates a random number. If the number is within
	the range specified, It loads the second js file 
	which then loads the invitation page, after passing
	the 3 tests.
*/

//Generate a random number between 0 and 9
var randomNumber;
randomNumber=Math.floor ((Math.random()*10));	

//If the randomNumber is less than 2 then load the script
if (randomNumber < 2) {	
   loadIPScript();
}

//This function loads the script on the client's homepage
//and it in turn generates the invitation page.
function loadIPScript() {
  //get the head tag and append the script to it
  var head = document.getElementsByTagName("head")[0];
  script = document.createElement('script');
  script.type = "text/javascript";
  script.src = "http://group11.iperceptions.com/Invitations/Javascripts/ip_Layer_Invitation_645_EconoLodge.js";
  head.appendChild(script)
}
