
var bIsIE = false;
var bIsIE5 = false;
var bIsIE6 = false;
var bIsIE7 = false;
var bIsIE8 = false;
var bIsFF1 = false;
var bIsFF2 = false;
var bIsSafari = false;
var bIsSafari3 = false;

try {
	if (navigator.userAgent.search("MSIE") != -1) {
		bIsIE = true;
	}
	if (navigator.userAgent.search("MSIE 5.") != -1) {
		bIsIE5 = true;
	}
	if (navigator.userAgent.search("MSIE 6.") != -1) {
		bIsIE6 = true;
	}
	if (navigator.userAgent.search("MSIE 7.") != -1) {
		bIsIE7 = true;
	}
	if (navigator.userAgent.search("MSIE 8.") != -1) {
		bIsIE8 = true;
	}
	if (navigator.userAgent.search("Firefox/1.") != -1) {
		bIsFF1 = true;
	}
	if (navigator.userAgent.search("Firefox/2.") != -1) {
		bIsFF2 = true;
	}
	if (navigator.userAgent.search("Safari") != -1) {
		bIsSafari = true;
	}
	if (navigator.userAgent.search("3.0 Safari") != -1) {
		bIsSafari3 = true;
	}
}
catch (e) { }

function ClearSearchBox() {
	oSearchBox = document.getElementById("q");
	if (oSearchBox.getAttribute("value") == "Search site...") {
		oSearchBox.setAttribute("value", "");
	}
}

function SetSearchBox() {
	oSearchBox = document.getElementById("q");
	if (oSearchBox.getAttribute("value") == "") {
		oSearchBox.setAttribute("value", "Search site...");
	}
}

function ChangeImageSource(oImage, sImageFile) {
	oImage.setAttribute("src","/images/" + sImageFile);
}

function PrintPage() {
	print();
}

function EmailPage() {
	var sURL = document.location.href;
	var sTitle = document.title;
	window.open("mailto:?subject=" + sTitle + "&body=Here is a link for the " + sTitle + " page on the Photon Group web site: \n\n" + sURL);
}

function ChooseShareGraphPeriod(sPeriod) {
	var o1Month = document.getElementById("1m");
	var o3Months = document.getElementById("3m");
	var o1Year = document.getElementById("1y");
	var o3Years = document.getElementById("3y");
	var oGraph = document.getElementById("pricegraph");
	 o1Month.setAttribute("src","/images/share_price_tab_1m.gif");
	 o3Months.setAttribute("src","/images/share_price_tab_3m.gif");
	 o1Year.setAttribute("src","/images/share_price_tab_1y.gif");
	 o3Years.setAttribute("src","/images/share_price_tab_3y.gif");
	switch (sPeriod) {
	case "1m":
		o1Month.setAttribute("src","/images/share_price_tab_1m_selected.gif");
		oGraph.setAttribute("src","/images/share_price_graph.gif");
		break;
	case "3m":
		o3Months.setAttribute("src","/images/share_price_tab_3m_selected.gif");
		oGraph.setAttribute("src","/images/share_price_graph.gif");
		break;
	case "1y":
		o1Year.setAttribute("src","/images/share_price_tab_1y_selected.gif");
		oGraph.setAttribute("src","/images/share_price_graph.gif");
		break;
	case "3y":
		o3Years.setAttribute("src","/images/share_price_tab_3y_selected.gif");
		oGraph.setAttribute("src","/images/share_price_graph.gif");
		break;
	}
}
function ToggleDivision(iDivisionID) {
	var oDivision = document.getElementById("div_" + iDivisionID);
	var oImage = document.getElementById("img_" + iDivisionID);
	if (oDivision.getAttribute("class") == "divisionshown" || oDivision.getAttribute("className") == "divisionshown") {
		oDivision.setAttribute("className", "divisionhidden");
		oDivision.setAttribute("class", "divisionhidden");
		oImage.setAttribute("src", "/images/arrowrt.gif");
	}
	else {
		oDivision.setAttribute("className", "divisionshown");
		oDivision.setAttribute("class", "divisionshown");
		oImage.setAttribute("src", "/images/arrowdn.gif");
	}
}

function WriteCodeBlock(sCodeBlock) {
	document.write(sCodeBlock);
}

function LoadHomePageFlash() {
	document.write("<div class='flash'><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='100%' height='315' id='photon_concept_19' align='middle'><param name='allowScriptAccess' value='sameDomain' /><param name='movie' value='/images/flash/photon_53.swf' /><param name='quality' value='high' /><param name='bgcolor' value='#000000' /><embed src='/images/flash/photon_53.swf' quality='high' bgcolor='#000000' width='100%' height='315' name='photon_concept_19' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object></div>");
}
function Open2008AnnualReview() {
	var sURL = "/investors/annualreport2008/";
	var iHeight = Math.round(screen.availHeight * 0.85);
	var iWidth = 980;
	var iTop = Math.round((screen.availHeight - iHeight) / 2) - 30;
	var iLeft = Math.round((screen.availWidth - iWidth) / 2);
	var oWindow = window.open(sURL, "_annualreview2008", "height=" + iHeight + ", width=" + iWidth + ", left=" + iLeft + ", top=" + iTop + ", channelmode=no, directories=no, fullscreen=no, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, titlebar=no, toolbar=no");
	oWindow.focus();
}
function Open2009AnnualReport() {
	var sURL = "/investors/ar2009/";
	var iHeight = Math.round(screen.availHeight * 0.90) - 50;
	var iWidth = Math.round(screen.availWidth * 0.95);
	var iTop = Math.round((screen.availHeight - iHeight) / 2) - 50;
	var iLeft = Math.round((screen.availWidth - iWidth) / 2);
	var oWindow = window.open(sURL, "_annualreport2009", "height=" + iHeight + ", width=" + iWidth + ", left=" + iLeft + ", top=" + iTop + ", channelmode=no, directories=no, fullscreen=no, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, titlebar=no, toolbar=no");
	//var oWindow = window.open(sURL, "_annualreport2009");
	oWindow.focus();
}
function OpenAnnualReport(sDoc) {
	var sURL = "http://photon.republicast.com/" + sDoc + "/";
	var iHeight = Math.round(screen.availHeight * 0.85);
	var iWidth = 800;
	var iTop = Math.round((screen.availHeight - iHeight) / 2) - 20;
	var iLeft = Math.round((screen.availWidth - iWidth) / 2);
	var oWindow = window.open(sURL, "_" + sDoc, "height=" + iHeight + ", width=" + iWidth + ", left=" + iLeft + ", top=" + iTop + ", channelmode=no, directories=no, fullscreen=no, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, titlebar=no, toolbar=no");
	oWindow.focus();
}
function OpenArticle(sURL) {
	var iHeight = Math.round(screen.availHeight * 0.85);
	var iWidth = 740;
	var iTop = Math.round((screen.availHeight - iHeight) / 2) - 20;
	var iLeft = Math.round((screen.availWidth - iWidth) / 2);
	var oWindow = window.open(sURL, "_article", "height=" + iHeight + ", width=" + iWidth + ", left=" + iLeft + ", top=" + iTop + ", channelmode=no, directories=no, fullscreen=no, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, titlebar=no, toolbar=no");
	oWindow.focus();
	return false;
}
function showLargePhoto(sID) {
	var oPhoto = document.getElementById(sID);
	var iLeft = 0;
	if (bIsIE7 || bIsIE8) {
		iLeft = Math.round((document.body.clientWidth - 842) / 2) + 95;
		oPhoto.style.left = iLeft + "px";
	}
	oPhoto.style.display = "block";
}
function hideLargePhoto(sID) {
	try {
		var oPhoto = document.getElementById(sID);
		oPhoto.style.display = "none";
	} catch(e) { }
}

function hideAllLargePhotos(sID) {
	var oPhoto = document.getElementById(sID);
	for (var i = 1; i<20; i++) {
		hideLargePhoto(sID + i);
	}
}