// Version check based upon the values entered above in "Globals"
var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

//var flashPage = "main-flash.html";
// Check to see if the version meets the requirements for playback

// Check the url, see if it contains a word, then grab the appropriate file names and sizes for it.
var strHref = window.location.href;
var whichSwf = "";
var whichImg = "";
var itemWidth = 960;
var itemHeight = 270;
var oeTags = "";

if(strHref.indexOf("completed") != -1) {
	whichSwf = "projects_completed.swf";
	whichImg = "header_completed.jpg";
} else if(strHref.indexOf("contact") != -1) {
	whichSwf = "contact.swf";
	whichImg = "header_contact.jpg";
} else if(strHref.indexOf("current") != -1) {
	whichSwf = "projects_current.swf";
	whichImg = "header_current.jpg";
} else if(strHref.indexOf("index.html") != -1) {
	itemHeight = 390;
	var randomImgs = ["header_cineplex.jpg","header_sobeys.jpg","header_westhills.jpg"];
	var ran_number=Math.floor(Math.random()*4); 
	whichSwf = "random.swf";
	whichImg = randomImgs[ran_number];
} else if(strHref.indexOf("upcoming") != -1) {
	whichSwf = "projects_upcoming.swf";
	whichImg = "header_upcoming.jpg";
} else if(strHref.indexOf("projectdetail") != -1) {
	itemHeight = 317;
	whichSwf = "temp_detail.swf";
	whichImg = "header_detail.jpg";
} else if(strHref.indexOf("about") != -1) {
	whichSwf = "about.swf";
	whichImg = "header_about.jpg";
} else {
	itemHeight = 390;
	var randomImgs = ["header_cineplex.jpg","header_sobeys.jpg","header_westhills.jpg"];
	var ran_number=Math.floor(Math.random()*4); 
	whichSwf = "random.swf";
	whichImg = randomImgs[ran_number];
}

if (hasReqestedVersion) {  // if we've detected an acceptable version
  oeTags = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+itemWidth+'" height="'+itemHeight+'" id="index" align="middle">'
  +'<param name="allowScriptAccess" value="sameDomain" />'
  +'<param name="movie" value="swf/'+whichSwf+'" /><param name="quality" value="high" /><param name="bgcolor" value="#405074" /><embed src="swf/'+whichSwf+'" quality="high" bgcolor="#405074" width="'+itemWidth+'" height="'+itemHeight+'" name="index" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'
  +'</object>';   
} else {  // flash is too old or we can't detect the plugin
  oeTags = '<img src="images/'+whichImg+'" width="'+itemWidth+'" height="'+itemHeight+'" alt="Rencor Developments" border="0">';
}

document.write(oeTags);