//position of the page for reading the page content
var pageContentY = 200;
//position of the page for viewing the gallery
var pageGalleryY = 445;

/**********************************************************************
 common SWFObjects
 **********************************************************************/
function insertGallery(){
	var flashvars = {};
	var specificImg = getQueryVar("i");
	if (specificImg != 0) {
		flashvars.specificImg = specificImg;
	}
	var ySt = (currentPage != "index.php") ? pageContentY-50 : pageGalleryY-50;
	flashvars.yStart = ySt;
	
	var params = {
	  allowscriptaccess: "always",
	  scale: "noscale",
	  salign: "TL",
	  wmode: "transparent"
	};
	var attributes = {
	  id: "mtGallery",
	  name: "mtGallery"
	};
	swfobject.embedSWF("flash/gallery.swf", "galleryDiv", "920", "445", "8.0.0", "expressInstall.swf", flashvars, params, attributes);
}
function moveNav(newY) {
    thisMovie("mtGallery").moveGalNav(newY);
}
function fadeGalNavIn() {
    thisMovie("mtGallery").fadeGalNavIn();
}

function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName]
    }
    else {
        return document[movieName]
    }
}
/**********************************************************************
 query var function
 **********************************************************************/
 function getQueryVar(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]; 
		} 
	} 
	//alert('query error'); 
	return "0";
}
/**********************************************************************
 popup window function
 **********************************************************************/
function openPopup(name, windowLoc, height, width, scroll){
	var winl = (screen.width - width) / 2;
	var wint = (screen.height - height) / 2;
	if(!scroll){
		scrollbar='yes';
	}else{
		scrollbar='no';
	}
	var winProps = 'toolbar=no,statusbar=no,location=no,scrollbars='+scrollbar+',resizable=yes,width='+width+',height='+height+',top='+wint+',left='+winl;
	window.open(windowLoc, name, winProps);
}

function returnDocument() {
	var file_name = document.location.href;
	var end = (file_name.indexOf("?") == -1) ? file_name.length : file_name.indexOf("?");
	return file_name.substring(file_name.lastIndexOf("/")+1, end);
}
var currentPage = returnDocument();
// if currentPage = nothing then it equals index.php
currentPage = (currentPage=="") ? "index.php" : currentPage;

//this is the object that rewrites history for AJAX pgae loads
var historyApp;

pageTitleKey = new Array();
pageTitleKey.push(["index.php", "Home"]);
pageTitleKey.push(["products.php", "Products"]);
pageTitleKey.push(["structure.php", "Structure"]);
pageTitleKey.push(["application-color.php", "Application/Color"]);
pageTitleKey.push(["advantage.php", "Advantage"]);
pageTitleKey.push(["contact.php", "Contact"]);
pageTitleKey.push(["technical-whitepapers.php", "Technical/Whitepapers"]);
pageTitleKey.push(["csi-specifications.php", "CSI Specifications"]);
pageTitleKey.push(["installation-videos.php", "Installation Videos"]);
pageTitleKey.push(["links.php", "Links"]);
pageTitleKey.push(["sitemap.php", "Sitemap"]);
pageTitleKeyLen = pageTitleKey.length;

$(document).ready(function(){
	
	/* AJAX HISTORY REWRITER FOR BACK BUTTON */ ////////////////////////////////////////////////////////////////////////////////
	
	function rewriteHistory() {
		// some application vars
		var stateVar = "nothin";
		
		// the sole public method to manipulate this application
		this.setPage = function(label) {
			// Set the new history hash. This value must be a string, so serializtion is up to you.
			// JSON works nicely, if you need something quick: http://www.json.org
			// When a new entry is made, unFocus.History will notify the historyListener 
			// method of the change, even on the first call. For this demo app we can 
			// rely on the historyListener method to update the state, and view.
			unFocus.History.addHistory(label);
		};
		// This is the method that will recieve notifications from the History Keeper,
		// which will then update the state of the app.
		// :NOTE: This will be called when a new entry is added.
		// :NOTE: This will be called if another app on the page sets a history,
		//        so you will need to watch out for this, if you have more than
		//        one script using the history keeper, by doing some kind of 
		//        check to make sure that the new hash belongs to this app.
		//        I wouldn't expect this to be a problem all that frequently.
		this.historyListener = function(historyHash) {
			if(historyHash!=""){
				// update the stateVar
				stateVar = historyHash;
				// turn any instance of %20 into a space
				historyHash = cleanSpacesAndVars(historyHash);
				// update document title
				document.title = "Millennium Tiles - " + covertToTitle(historyHash);
				loadAJAXPage(historyHash)
			}
		};
		// subscribe to unFocus.History
		unFocus.History.addEventListener('historyChange', this.historyListener);
		// Check for an initial value (deep link).
		this.historyListener(unFocus.History.getCurrent());
	};
	
	function covertToTitle(hash){
		for (var i = 0 ; i<pageTitleKeyLen; i++){
			if(pageTitleKey[i][0]==hash) return pageTitleKey[i][1];
		}
		//if the hash wasn't found in the key just return the hash
		return hash;
	}
	
	function loadAJAXPage(pageFileName) {
		currentPage = pageFileName;
		//turns the href string into an ajax load string
		var ajaxHREF = pageFileName + " #ajaxContent";
		//load content from the target page's #ajaxContent
		//and reruns the doc ready when new content loads
		$("#ajaxContent").load(ajaxHREF, null , function(){setDocReady()});
	}
	
	function hashTitle(){
		var hashT = cleanSpacesAndVars(location.hash);
		return hashT.slice(1, hashT.length);
	}
	function cleanSpacesAndVars(input){
		var endSlice = (input.indexOf("?")==-1) ? input.length : input.indexOf("?");
		var output = input.slice(0, endSlice);
		var tempArr = output.split("%20");
		output = tempArr.join(" ");
		return output;
	}
	
	//initiate history object for AJAX pgae loads
	historyApp = new rewriteHistory();
	
	/* SLIDE PAGE UP AND DOWN */ ////////////////////////////////////////////////////////////////////////////////////////////
	
    function movePage(newY){
		var pY = $('#page').css("top");
		if(pY != newY+"px"){
			moveNav(newY-50);
			$("#page").animate({ top: newY+"px" }, 500, function(){fadeGalNavIn()});
		}
	}
    function movePageDown(){
		if(movePageDownInitialized){
			movePage(pageGalleryY);
		}else{
			movePageDownInitialized=true;
		}
	}
	var movePageDownInitialized = false;
	window.movePageDown = movePageDown;

	/* HIDDEN DIV ROLLOVERS */ ////////////////////////////////////////////////////////////////////////////////////////////////
		
	function showHeadOv(obj){
		var imgsrc = $(obj).children("img:first").attr("src");
		// do the rollover if its an image
		if (typeof(imgsrc) != 'undefined') {
			var imgsrcON = imgsrc.replace('_gray', '_blue');
			$(obj).children("img:first").attr("src", imgsrcON);
		}
	}
	function showHeadUp(obj){
		var imgsrc = $(obj).children("img:first").attr("src");
		// do the rollover if its an image and not selected
		if (typeof(imgsrc) != 'undefined' && !$(obj).hasClass("selected")) {
			var imgsrcON = imgsrc.replace('_blue', '_gray');
			$(obj).children("img:first").attr("src", imgsrcON);
		}
	}
	//flip the arrow up or down
	function showHeadArrow(obj, dir){
		var imgsrc = $(obj).children("img:last").attr("src");
		// flip if its an image
		if (typeof(imgsrc) != 'undefined') {
			var imgsrcON
			if(dir == "up"){
				imgsrcON = imgsrc.replace('Down', 'Up');
			}else{
				imgsrcON = imgsrc.replace('Up', 'Down');
			}
			$(obj).children("img:last").attr("src", imgsrcON);
		}
	}
	function toggleHiddenDiv(divNum){
		$("div.showHead").each(function(){
			var tempDivNum = $(this).attr("id").slice(1,4);
			//if this is the hidden div to toggle
			if(tempDivNum == divNum){
				//alert($(this).hasClass("selected"));
				//if it is visible already close it
				if($(this).hasClass("selected")){
					hideDiv(tempDivNum);
				//else open it
				}else{
					showDiv(tempDivNum);
				}
			//else close it
			}else{
				//alert($(this).hasClass("selected"));
				hideDiv(tempDivNum);
			}
		});
	}
	function toggleHiddenDiv2(divNum){
		$("div.showHead2").each(function(){
			var tempDivNum = $(this).attr("id").slice(1,9);
			//if this is the hidden div to toggle
			if(tempDivNum == divNum){
				//alert($(this).hasClass("selected"));
				//if it is visible already close it
				if($(this).hasClass("selected")){
					hideDiv(tempDivNum);
				//else open it
				}else{
					showDiv(tempDivNum);
				}
			//else close it
			}else{
				//alert($(this).hasClass("selected"));
				hideDiv(tempDivNum);
			}
		});
	}
	function showDiv(divNum){
		var sDiv = $("#s"+divNum);
		var hDiv = $("#h"+divNum);
		sDiv.addClass("selected");
		hDiv.slideDown("normal");
		showHeadOv(sDiv);
		showHeadArrow(sDiv, "up");
	}
	function hideDiv(divNum){
		var sDiv = $("#s"+divNum);
		var hDiv = $("#h"+divNum);
		sDiv.removeClass("selected");
		hDiv.slideUp("normal");
		showHeadUp(sDiv);
		showHeadArrow(sDiv, "down");
	}
		
	function setDocReady(){
		
		//if the page isn't the homepage start it up in the content viewing position
		if(currentPage != "index.php"){
			$("#page").css({ top: pageContentY+"px" });
		}
	
		/* MAKE LINKS LOAD CONTENT VIA AJAX */ //////////////////////////////////////////////////////////////////////////////////
	
		$("a").click(function(event){
			//check link tupe
			var className =  $(this).attr("class");
			if(className == "navlink"){
				//makes the link no longer function
				event.preventDefault();
				//slide the page up if it isn't
				movePage(pageContentY);
				//finds the href string
				var idString = $(this).attr("href");
				//make new history state
				historyApp.setPage(idString);
				//load content from the target page's #ajaxContent
				loadAJAXPage(idString);
			}
		});
		
		/* NAVIGATION ROLLOVERS */ ///////////////////////////////////////////////////////////////////////////////////////////////
	
		// Preload all rollovers
		$("#nav img").each(function() {
			// Set the original src
			rollsrc = $(this).attr("src");
			rollON = rollsrc.replace('_up', '_ov');
			newImg = new Image(); // create new image obj
			$(newImg).attr("src", rollON); // set new obj's src
			/*if(rollsrc.indexOf("home_")!=-1){
				$(this).addClass("selected");
			}*/
		});

		// select active nav
		$("#nav a").each(function() {
			if(currentPage == $(this).attr("href")){
				$(this).addClass("selected");
				navOv(this);
			}
		});
		
		// Navigation rollovers
		$("#nav a").mouseover(function(){
			navOv(this);
		});
		function navOv(obj){
			imgsrc = $(obj).children("img").attr("src");
			// do the rollover if its an image
			if (typeof(imgsrc) != 'undefined') {
				imgsrcON = imgsrc.replace('_up', '_ov');
				$(obj).children("img").attr("src", imgsrcON);
			}
		}
		
		// Handle mouseout
		$("#nav a").mouseout(function(){
			// do the rollover if its an image and not selected
			if (typeof(imgsrc) != 'undefined' && !$(this).hasClass("selected")) {
				$(this).children("img").attr("src", imgsrc);
			}
		});
		
		/* HIDDEN DIV ROLLOVERS */ /////////////////////////////////////////////////////////////////////////////////////////////
		
		// Navigation rollovers
		$("div.showHead").mouseover(function(){
			showHeadOv(this);
		});
		// Handle mouseout
		$("div.showHead").mouseout(function(){
			showHeadUp(this);
		});
		
		$("div.hidden").hide();
		
		// on click show hidden div
		$("div.showHead").click(function(){
			var idNum = $(this).attr("id").slice(1,4);
			toggleHiddenDiv(idNum)
		});
		
		
		/* SUB HIDDEN DIV ROLLOVERS */ /////////////////////////////////////////////////////////////////////////////////////////////
		
		// Navigation rollovers
		$("div.showHead2").mouseover(function(){
			showHeadOv(this);
		});
		// Handle mouseout
		$("div.showHead2").mouseout(function(){
			showHeadUp(this);
		});
		
		$("div.hidden2").hide();
		
		// on click show hidden div
		$("div.showHead2").click(function(){
			var idNum = $(this).attr("id").slice(1,9);
			toggleHiddenDiv2(idNum)
		});
		
		/* REGULAR SUBHEAD ROLLOVERS */ /////////////////////////////////////////////////////////////////////////////////////////////
		
		// Navigation rollovers
		$("a.subHeadRollover").mouseover(function(){
			showHeadOv(this);
		});
		// Handle mouseout
		$("a.subHeadRollover").mouseout(function(){
			showHeadUp(this);
		});
		
		/* VIDEO THUMB ROLLOVERS */ /////////////////////////////////////////////////////////////////////////////////////////////
		
		// on click show hidden div
		$(".videoThumb").click(function(){
			//this opens the video section
			showDiv(1);
			//this hides the other sections (will manually need to add more if more are added to the page)
			hideDiv(2);
			hideDiv(3);
			//this opens the specific video
			var idNum = $(this).attr("id").slice(1,9);
			toggleHiddenDiv2(idNum);
		});
		$("#videoThumbHeadPopup").hide();
		$(".videoThumb").mouseover(function(){
			//show the video thumb title in a popup
			var imgsrc = $(this).attr("src");
			//alert(imgsrc);
			//find position of the thumb to position popup
			var offset = $(this).offset();
			//if the page has topspace to fit the popup position it else set it at zero
			var topPos = (offset.top>12) ? offset.top-11 : 0;
			var leftPos = offset.left;
			if (typeof(imgsrc) != 'undefined') {
				imgsrc2 = imgsrc.replace('videoThumb', 'subheads_gray');
				//imgsrc2 = imgsrc.replace('videoThumb', 'subheads_blue');
				imgsrc2 = imgsrc2.replace('jpg', 'gif');
				$("#videoThumbHeadPopup").children("img").attr("src", imgsrc2);
				$("#videoThumbHeadPopup").css({left : leftPos+"px", top : topPos+"px"} 	);
			}
			$("#videoThumbHeadPopup").show();
			//highlight the first head
			/* i had to disable this feature because the section head was dropping bedhind the flash
			$("div.showHead").each(function(){
				if($(this).attr("id").slice(1,4) == 1){
					showHeadOv($(this));
				}
			});*/
		});
		// Handle mouseout
		$(".videoThumb").mouseout(function(){
			//hide the video thumb title
			$("#videoThumbHeadPopup").hide();
			//unhighlight the first head
			/* i had to disable this feature because the section head was dropping bedhind the flash
			$("div.showHead").each(function(){
				if($(this).attr("id").slice(1,4) == 1){
					//showHeadUp($(this));
				}
			});*/
		});
		
		/* THUMB ROLLOVERS */ ///////////////////////////////////////////////////////////////////////////////////////////////
		
		
		/* Regular Thumbs */ //////////////////////////
		$("#photoPopup").hide();
		
		$("div.thumb").mouseover(function(){
			var imgsrc = $(this).children("img").attr("src");
			//find position of first thumb to position popup
			var offset = $(this).parent().offset();
			//if the page has topspace to fit the popup position it else set it at zero
			var topPos = (offset.top>275) ? offset.top-275 : 0;
			var leftPos = offset.left-10;
			if (typeof(imgsrc) != 'undefined') {
				imgsrc2 = imgsrc.replace('photoThumb', 'photoPopup');
				$("#photoPopup").children("img").attr("src", imgsrc2);
				$("#photoPopup").css({left : leftPos+"px", top : topPos+"px"} 	);
			}
			$("#photoPopup").show();

		});
		
		$("div.thumb").mouseout(function(){
			$("#photoPopup").hide();
		})
		
		/* Tiles Thumbs */ //////////////////////////
		$("#photoTilePopup").hide();
		
		$("div.thumbTile").mouseover(function(){
			var imgsrc = $(this).children("img").attr("src");
			//find position of first thumb to position popup
			var offset = $(this).parent().offset();
			//if the page has topspace to fit the popup position it else set it at zero
			var topPos = (offset.top>226) ? offset.top-226 : 0;
			var leftPos = offset.left+146;
			if (typeof(imgsrc) != 'undefined') {
				imgsrc2 = imgsrc.replace('photoThumb', 'photoPopup');
				$("#photoTilePopup").children("img").attr("src", imgsrc2);
				$("#photoTilePopup").css({left : leftPos+"px", top : topPos+"px"} 	);
			}
			$("#photoTilePopup").show();

		});
		$("div.thumbTile").mouseout(function(){
			$("#photoTilePopup").hide();
		})
		
	}
	setDocReady();
	
  });

/*	SWFObject v2.0 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject=function(){var Z="undefined",P="object",B="Shockwave Flash",h="ShockwaveFlash.ShockwaveFlash",W="application/x-shockwave-flash",K="SWFObjectExprInst",G=window,g=document,N=navigator,f=[],H=[],Q=null,L=null,T=null,S=false,C=false;var a=function(){var l=typeof g.getElementById!=Z&&typeof g.getElementsByTagName!=Z&&typeof g.createElement!=Z&&typeof g.appendChild!=Z&&typeof g.replaceChild!=Z&&typeof g.removeChild!=Z&&typeof g.cloneNode!=Z,t=[0,0,0],n=null;if(typeof N.plugins!=Z&&typeof N.plugins[B]==P){n=N.plugins[B].description;if(n){n=n.replace(/^.*\s+(\S+\s+\S+$)/,"$1");t[0]=parseInt(n.replace(/^(.*)\..*$/,"$1"),10);t[1]=parseInt(n.replace(/^.*\.(.*)\s.*$/,"$1"),10);t[2]=/r/.test(n)?parseInt(n.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof G.ActiveXObject!=Z){var o=null,s=false;try{o=new ActiveXObject(h+".7")}catch(k){try{o=new ActiveXObject(h+".6");t=[6,0,21];o.AllowScriptAccess="always"}catch(k){if(t[0]==6){s=true}}if(!s){try{o=new ActiveXObject(h)}catch(k){}}}if(!s&&o){try{n=o.GetVariable("$version");if(n){n=n.split(" ")[1].split(",");t=[parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10)]}}catch(k){}}}}var v=N.userAgent.toLowerCase(),j=N.platform.toLowerCase(),r=/webkit/.test(v)?parseFloat(v.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,i=false,q=j?/win/.test(j):/win/.test(v),m=j?/mac/.test(j):/mac/.test(v);/*@cc_on i=true;@if(@_win32)q=true;@elif(@_mac)m=true;@end@*/return{w3cdom:l,pv:t,webkit:r,ie:i,win:q,mac:m}}();var e=function(){if(!a.w3cdom){return }J(I);if(a.ie&&a.win){try{g.write("<script id=__ie_ondomload defer=true src=//:><\/script>");var i=c("__ie_ondomload");if(i){i.onreadystatechange=function(){if(this.readyState=="complete"){this.parentNode.removeChild(this);V()}}}}catch(j){}}if(a.webkit&&typeof g.readyState!=Z){Q=setInterval(function(){if(/loaded|complete/.test(g.readyState)){V()}},10)}if(typeof g.addEventListener!=Z){g.addEventListener("DOMContentLoaded",V,null)}M(V)}();function V(){if(S){return }if(a.ie&&a.win){var m=Y("span");try{var l=g.getElementsByTagName("body")[0].appendChild(m);l.parentNode.removeChild(l)}catch(n){return }}S=true;if(Q){clearInterval(Q);Q=null}var j=f.length;for(var k=0;k<j;k++){f[k]()}}function J(i){if(S){i()}else{f[f.length]=i}}function M(j){if(typeof G.addEventListener!=Z){G.addEventListener("load",j,false)}else{if(typeof g.addEventListener!=Z){g.addEventListener("load",j,false)}else{if(typeof G.attachEvent!=Z){G.attachEvent("onload",j)}else{if(typeof G.onload=="function"){var i=G.onload;G.onload=function(){i();j()}}else{G.onload=j}}}}}function I(){var l=H.length;for(var j=0;j<l;j++){var m=H[j].id;if(a.pv[0]>0){var k=c(m);if(k){H[j].width=k.getAttribute("width")?k.getAttribute("width"):"0";H[j].height=k.getAttribute("height")?k.getAttribute("height"):"0";if(O(H[j].swfVersion)){if(a.webkit&&a.webkit<312){U(k)}X(m,true)}else{if(H[j].expressInstall&&!C&&O("6.0.65")&&(a.win||a.mac)){D(H[j])}else{d(k)}}}}else{X(m,true)}}}function U(m){var k=m.getElementsByTagName(P)[0];if(k){var p=Y("embed"),r=k.attributes;if(r){var o=r.length;for(var n=0;n<o;n++){if(r[n].nodeName.toLowerCase()=="data"){p.setAttribute("src",r[n].nodeValue)}else{p.setAttribute(r[n].nodeName,r[n].nodeValue)}}}var q=k.childNodes;if(q){var s=q.length;for(var l=0;l<s;l++){if(q[l].nodeType==1&&q[l].nodeName.toLowerCase()=="param"){p.setAttribute(q[l].getAttribute("name"),q[l].getAttribute("value"))}}}m.parentNode.replaceChild(p,m)}}function F(i){if(a.ie&&a.win&&O("8.0.0")){G.attachEvent("onunload",function(){var k=c(i);if(k){for(var j in k){if(typeof k[j]=="function"){k[j]=function(){}}}k.parentNode.removeChild(k)}})}}function D(j){C=true;var o=c(j.id);if(o){if(j.altContentId){var l=c(j.altContentId);if(l){L=l;T=j.altContentId}}else{L=b(o)}if(!(/%$/.test(j.width))&&parseInt(j.width,10)<310){j.width="310"}if(!(/%$/.test(j.height))&&parseInt(j.height,10)<137){j.height="137"}g.title=g.title.slice(0,47)+" - Flash Player Installation";var n=a.ie&&a.win?"ActiveX":"PlugIn",k=g.title,m="MMredirectURL="+G.location+"&MMplayerType="+n+"&MMdoctitle="+k,p=j.id;if(a.ie&&a.win&&o.readyState!=4){var i=Y("div");p+="SWFObjectNew";i.setAttribute("id",p);o.parentNode.insertBefore(i,o);o.style.display="none";G.attachEvent("onload",function(){o.parentNode.removeChild(o)})}R({data:j.expressInstall,id:K,width:j.width,height:j.height},{flashvars:m},p)}}function d(j){if(a.ie&&a.win&&j.readyState!=4){var i=Y("div");j.parentNode.insertBefore(i,j);i.parentNode.replaceChild(b(j),i);j.style.display="none";G.attachEvent("onload",function(){j.parentNode.removeChild(j)})}else{j.parentNode.replaceChild(b(j),j)}}function b(n){var m=Y("div");if(a.win&&a.ie){m.innerHTML=n.innerHTML}else{var k=n.getElementsByTagName(P)[0];if(k){var o=k.childNodes;if(o){var j=o.length;for(var l=0;l<j;l++){if(!(o[l].nodeType==1&&o[l].nodeName.toLowerCase()=="param")&&!(o[l].nodeType==8)){m.appendChild(o[l].cloneNode(true))}}}}}return m}function R(AE,AC,q){var p,t=c(q);if(typeof AE.id==Z){AE.id=q}if(a.ie&&a.win){var AD="";for(var z in AE){if(AE[z]!=Object.prototype[z]){if(z=="data"){AC.movie=AE[z]}else{if(z.toLowerCase()=="styleclass"){AD+=' class="'+AE[z]+'"'}else{if(z!="classid"){AD+=" "+z+'="'+AE[z]+'"'}}}}}var AB="";for(var y in AC){if(AC[y]!=Object.prototype[y]){AB+='<param name="'+y+'" value="'+AC[y]+'" />'}}t.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AD+">"+AB+"</object>";F(AE.id);p=c(AE.id)}else{if(a.webkit&&a.webkit<312){var AA=Y("embed");AA.setAttribute("type",W);for(var x in AE){if(AE[x]!=Object.prototype[x]){if(x=="data"){AA.setAttribute("src",AE[x])}else{if(x.toLowerCase()=="styleclass"){AA.setAttribute("class",AE[x])}else{if(x!="classid"){AA.setAttribute(x,AE[x])}}}}}for(var w in AC){if(AC[w]!=Object.prototype[w]){if(w!="movie"){AA.setAttribute(w,AC[w])}}}t.parentNode.replaceChild(AA,t);p=AA}else{var s=Y(P);s.setAttribute("type",W);for(var v in AE){if(AE[v]!=Object.prototype[v]){if(v.toLowerCase()=="styleclass"){s.setAttribute("class",AE[v])}else{if(v!="classid"){s.setAttribute(v,AE[v])}}}}for(var u in AC){if(AC[u]!=Object.prototype[u]&&u!="movie"){E(s,u,AC[u])}}t.parentNode.replaceChild(s,t);p=s}}return p}function E(k,i,j){var l=Y("param");l.setAttribute("name",i);l.setAttribute("value",j);k.appendChild(l)}function c(i){return g.getElementById(i)}function Y(i){return g.createElement(i)}function O(k){var j=a.pv,i=k.split(".");i[0]=parseInt(i[0],10);i[1]=parseInt(i[1],10);i[2]=parseInt(i[2],10);return(j[0]>i[0]||(j[0]==i[0]&&j[1]>i[1])||(j[0]==i[0]&&j[1]==i[1]&&j[2]>=i[2]))?true:false}function A(m,j){if(a.ie&&a.mac){return }var l=g.getElementsByTagName("head")[0],k=Y("style");k.setAttribute("type","text/css");k.setAttribute("media","screen");if(!(a.ie&&a.win)&&typeof g.createTextNode!=Z){k.appendChild(g.createTextNode(m+" {"+j+"}"))}l.appendChild(k);if(a.ie&&a.win&&typeof g.styleSheets!=Z&&g.styleSheets.length>0){var i=g.styleSheets[g.styleSheets.length-1];if(typeof i.addRule==P){i.addRule(m,j)}}}function X(k,i){var j=i?"visible":"hidden";if(S){c(k).style.visibility=j}else{A("#"+k,"visibility:"+j)}}return{registerObject:function(l,i,k){if(!a.w3cdom||!l||!i){return }var j={};j.id=l;j.swfVersion=i;j.expressInstall=k?k:false;H[H.length]=j;X(l,false)},getObjectById:function(l){var i=null;if(a.w3cdom&&S){var j=c(l);if(j){var k=j.getElementsByTagName(P)[0];if(!k||(k&&typeof j.SetVariable!=Z)){i=j}else{if(typeof k.SetVariable!=Z){i=k}}}}return i},embedSWF:function(n,u,r,t,j,m,k,p,s){if(!a.w3cdom||!n||!u||!r||!t||!j){return }r+="";t+="";if(O(j)){X(u,false);var q=(typeof s==P)?s:{};q.data=n;q.width=r;q.height=t;var o=(typeof p==P)?p:{};if(typeof k==P){for(var l in k){if(k[l]!=Object.prototype[l]){if(typeof o.flashvars!=Z){o.flashvars+="&"+l+"="+k[l]}else{o.flashvars=l+"="+k[l]}}}}J(function(){R(q,o,u);if(q.id==u){X(u,true)}})}else{if(m&&!C&&O("6.0.65")&&(a.win||a.mac)){X(u,false);J(function(){var i={};i.id=i.altContentId=u;i.width=r;i.height=t;i.expressInstall=m;D(i)})}}},getFlashPlayerVersion:function(){return{major:a.pv[0],minor:a.pv[1],release:a.pv[2]}},hasFlashPlayerVersion:O,createSWF:function(k,j,i){if(a.w3cdom&&S){return R(k,j,i)}else{return undefined}},createCSS:function(j,i){if(a.w3cdom){A(j,i)}},addDomLoadEvent:J,addLoadEvent:M,getQueryParamValue:function(m){var l=g.location.search||g.location.hash;if(m==null){return l}if(l){var k=l.substring(1).split("&");for(var j=0;j<k.length;j++){if(k[j].substring(0,k[j].indexOf("="))==m){return k[j].substring((k[j].indexOf("=")+1))}}}return""},expressInstallCallback:function(){if(C&&L){var i=c(K);if(i){i.parentNode.replaceChild(L,i);if(T){X(T,true);if(a.ie&&a.win){L.style.display="block"}}L=null;T=null;C=false}}}}}();
