// JavaScript Document
	
	function swapImage(obj,str) {
		var newSrc = obj.src;
		var i = newSrc.indexOf("_");
		if (i > -1) {
			newSrc = newSrc.substring(0,i) + "_" + str + ".png";
			obj.src = newSrc;
		}
	}

	function vidMouseOver(p,l) {
		p.style.cursor='pointer';
		var k = document.getElementById(l);
		k.style.color='#6BB221';
	}
	function vidMouseOut(l) {
		var k = document.getElementById(l);
		k.style.color='#B5BEAD';
	}

//Video Stuff *********************************************************************************************
	//var vidW = 400;
	//var vidH = 335;
	function setFlashVideo(newSrc,vidW,vidH) {
		var flash='<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + vidW + '" height="' + vidH + '">';
		flash+='<param name="movie" value="'+newSrc+'">';
		flash+='<param name="quality" value="high">';
		flash+='<param name="wmode" value="opaque">';
		flash+='<param name="swfversion" value="6.0.65.0">';
		flash+='<param name="expressinstall" value="scripts/expressInstall.swf">';
		flash+='<object type="application/x-shockwave-flash" data="'+newSrc+'" width="' + vidW + '" height="' + vidH + '">';
		flash+='<param name="quality" value="high">';
		flash+='<param name="wmode" value="opaque">';
		flash+='<param name="swfversion" value="6.0.65.0">';
		flash+='<param name="expressinstall" value="scripts/expressInstall.swf">';
		flash+='<div>';
		flash+='<h4>Content on this page requires a newer version of Adobe Flash Player.</h4>';
		flash+='<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>';
		flash+='</div>';
		flash+='</object>';
		flash+='</object>';
		flash+='<br /><br />';
		flash+='<span style="background-color:white; color:black; font-weight:bold; width:90px; text-align:center; cursor:pointer;" onclick="javascript:hideVideo()">&nbsp;Close Video&nbsp;</span>';
		document.getElementById("lv").innerHTML=flash;
		//swfobject.registerObject("FlashID");
	}
	function setYouTubeVideo(newSrc,vidW,vidH) {
		var flash='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" height="' + vidH + '" width="' + vidW + '">';
		flash+='<param name="allowScriptAccess" value="never" />';
		flash+='<param name="allowNetworking" value="internal" />';
		flash+='<param name="movie" value="' + newSrc + '" />';
		flash+='<param name="wmode" value="transparent" />';
		flash+='<embed type="application/x-shockwave-flash" allowScriptAccess="never" allowNetworking="internal" src="' + newSrc + '" height="' + vidH + '" width="' + vidW + '" wmode="transparent" />';
		flash+='</object>';
		flash+='<br /><br />';
		flash+='<span style="background-color:white; color:black; font-weight:bold; width:90px; text-align:center; cursor:pointer;" onclick="javascript:hideVideo()">&nbsp;Close Video&nbsp;</span>';
		document.getElementById("lv").innerHTML=flash;
	}
	function loadMainVid(newSrc) {
		var flash='<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="290" height="217">';
		flash+='<param name="movie" value="' + newSrc + '">';
		flash+='<param name="quality" value="high">';
		flash+='<param name="wmode" value="opaque">';
		flash+='<param name="swfversion" value="6.0.65.0">';
		flash+='<!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don?t want users to see the prompt. -->';
		flash+='<param name="expressinstall" value="scripts/expressInstall.swf">';
		flash+='<!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->';
		flash+='<!--[if !IE]>-->';
		flash+='<object type="application/x-shockwave-flash" data="' + newSrc + '" width="290" height="217">';
		flash+='<!--<![endif]-->';
		flash+='<param name="quality" value="high">';
		flash+='<param name="wmode" value="opaque">';
		flash+='<param name="swfversion" value="6.0.65.0">';
		flash+='<param name="expressinstall" value="scripts/expressInstall.swf">';
		flash+='<!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->';
		flash+='<div>';
		flash+='<h4>Content on this page requires a newer version of Adobe Flash Player.</h4>';
		flash+='<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>';
		flash+='</div>';
		flash+='<!--[if !IE]>-->';
		flash+='</object>';
		flash+='<!--<![endif]-->';
		flash+='</object>';
		document.getElementById("lMainVid").innerHTML=flash;
	}
	
	function showVideo(src,w,h,t) {
		if (src.indexOf("youtube") > -1) {
			setYouTubeVideo(src,w,h);
		} else {
			setFlashVideo(src,w,h);
		}
		
		//if (src.indexOf("video/") > -1) {//Must be chronicles or photography
		if (t == 1) {//Must be chronicles or photography, t=type
			placeVideo(w,h);
		} else {
			placeVideoInTable(w,h);
		}
		
		document.documentElement.style.overflow = 'hidden';//Hide scrollbar in firefox
		document.body.scroll = "no";//Hide scrollbar in IE
		document.getElementById("lMask").style.visibility='visible';
		document.getElementById("lVideo").style.visibility='visible';
		shiftOpacity('lMask', 1000);
		if (document.getElementById("lMainVid") != null) {
			loadMainVid('');
		}
	}
	function placeVideoInTable(vidW,vidH)
	{
		var el1 = document.getElementById("lMask");
		var el2 = document.getElementById("lVideo");
		
		el1.style.top = document.body.scrollTop + "px";//"0px";
        el1.style.height = document.body.offsetHeight + "px";
        el1.style.left = document.body.scrollLeft + "px";//"0px";
        el1.style.width = document.body.offsetWidth + "px";
		
		var x1 = (document.body.offsetWidth / 2) - (vidW / 2) + document.body.scrollLeft;
        var y1 = (document.body.offsetHeight / 2) - (vidH / 2) + document.body.scrollTop;
        
        el2.style.left = x1 + "px";
		el2.style.top = y1 + "px";
        el2.style.width = vidW + "px";
		el2.style.height = vidH + "px";
	}
	function placeVideo(vidW,vidH)
	{
		var el1 = document.getElementById("lMask");
		var el2 = document.getElementById("lVideo");
		
		el1.style.top = document.documentElement.scrollTop + "px";//"0px";
        el1.style.height = document.documentElement.clientHeight + "px";
        el1.style.left = document.documentElement.scrollLeft + "px";//"0px";
        el1.style.width = document.documentElement.clientWidth + "px";
		
		var x1 = (document.documentElement.clientWidth / 2) - (vidW / 2) + document.documentElement.scrollLeft;
        var y1 = (document.documentElement.clientHeight / 2) - (vidH / 2) + document.documentElement.scrollTop;
        
        el2.style.left = x1 + "px";
		el2.style.top = y1 + "px";
        el2.style.width = vidW + "px";
		el2.style.height = vidH + "px";
	}
	function hideVideo() {
		setFlashVideo('xyz');//This stops the current video
		shiftOpacity('lMask', 1000);
		//document.getElementById("lMask").style.visibility='hidden';
		document.getElementById("lVideo").style.visibility='hidden';
		document.documentElement.style.overflow = 'visible';//Show scrollbar in firefox
		document.body.scroll = "yes";//Show scrollbar in IE
		if (document.getElementById("lMainVid") != null) {
			loadMainVid('corporatemovie/corporatemovie.swf');
		}
	}
	//Fade in/out functions *********************************************************************************************
	function shiftOpacity(id, millisec) {
		//if an element is invisible, make it visible, else make it ivisible
		if(document.getElementById(id).style.opacity == 0) {
			opacity(id, 1, 80, millisec);
		} else {
			opacity(id, 80, 0, millisec);
		}
	} 
	function opacity(id, opacStart, opacEnd, millisec) {
		//speed for each frame
		var speed = Math.round(millisec / 100);
		var timer = 0;
		//determine the direction for the blending, if start and end are the same nothing happens
		if(opacStart > opacEnd) {
			for(i = opacStart; i >= opacEnd; i--) {
				setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
				timer++;
			}
		} else if(opacStart < opacEnd) {
			for(i = opacStart; i <= opacEnd; i++)
				{
				setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
				timer++;
			}
		}
	}
	//change the opacity for different browsers
	function changeOpac(opacity, id) {
		var object = document.getElementById(id).style;
		object.opacity = (opacity / 100);
		object.MozOpacity = (opacity / 100);
		object.KhtmlOpacity = (opacity / 100);
		object.filter = "alpha(opacity=" + opacity + ")";
		if (opacity == 0) {
			document.getElementById(id).style.visibility='hidden';
		//} else {
		//	document.getElementById(id).style.visibility='visible';
		}
	}
//End Video Stuff *****************************************************************************************