function BrowserCheck()
 {
	var b = navigator.appName;
	if (b=="Netscape") this.b = "ns";
	else if (b=="Microsoft Internet Explorer") this.b = "ie";
	else this.b = b;
	this.version = navigator.appVersion;
	this.v = parseInt(this.version);
	this.ns = (this.b=="ns" && this.v>=4);
	this.ns4 = (this.b=="ns" && this.v==4);
	this.ns5 = (this.b=="ns" && this.v==5);
	this.ie = (this.b=="ie" && this.v>=4)
	this.ie4 = (this.version.indexOf('MSIE 4')>0);
	this.ie5 = (this.version.indexOf('MSIE 5')>0);
	this.min = (this.ns||this.ie);
	this.pc = (this.version.indexOf('Win')>0);
	this.mac = (this.version.indexOf('PPC')>0);
	this.ns408=(parseFloat(this.version)==4.08);
}

var is = new BrowserCheck();

if (navigator.appName=="Netscape" && parseInt(navigator.appVersion)==4) {
	widthCheck = window.innerWidth;
	heightCheck = window.innerHeight;
	window.onResize = resizeFix;
}

function rollOver(imgname)
	{
		document.images[imgname].src = "images/" + imgname + "-on.jpg";
	}
function rollOut(imgname)
	{
		if (document.images[imgname].selected != true)
			{
				document.images[imgname].src = "images/" + imgname + "-off.jpg";
			}
	}


function hide ( name ) {
	NS4 = (document.layers) ? 1 : 0;
	IE4 = (document.all) ? 1 : 0;
	W3C = (document.getElementById) ? 1 : 0;        
	if (W3C) {
		document.getElementById(name).style.display = "none";
	} else if (NS4) {
		document.layers[name].visibility = "none";
	} else {
		document.all[name].style.display = "none";
	}
}

function show (name ) {
	var ele;                //points to the popup element

	NS4 = (document.layers) ? 1 : 0;
	IE4 = (document.all) ? 1 : 0;
	W3C = (document.getElementById) ? 1 : 0;

	if ( W3C ) {
		ele = document.getElementById(name);
	} else if ( NS4 ) {
		ele = document.layers[name];
	} else {        // meant for IE4
		ele = window.opener.document.all[name];
	}

	if ( NS4 ) {
		ele.visibility.display = "block";
	} else {  // IE4 & W3C
		ele.style.display = "block";
	}
}

function checkOS() {
	if((navigator.userAgent.indexOf('Win') != -1) &&
		(navigator.userAgent.indexOf('95') != -1))
		{ var OpSys = "windows"; 
		}
	else if(navigator.userAgent.indexOf('Win') != -1)
		{ var OpSys = "windows";
		}
	else if(navigator.userAgent.indexOf('Mac') != -1)
		{ var OpSys = "mac"; 
		}
	else
		{ var OpSys = "windows"; 
		}
	return OpSys;
}

function openParent(urlVal, windowName)
	{
	if (window.opener && !window.opener.closed)
		{
		window.opener.document.location = urlVal;
		}
	else
		{
		window.open(urlVal, windowName);
		}
	}

function setHighlight(num, imgPrefix)
	{
		if (num != picNum) {
			var nLastNum	= picNum;
		
			// set the new picNum to the currently selected image
			picNum	= num;
			
			// Turn on clicked image thumbnail
			oImg				= document.images[imgPrefix + picNum];
			
			// Set image's expando-property "selected" to true
			// Set image state to on
			oImg.selected	 = true;
			oImg.src			= 'images/' + imgPrefix + picNum + '-on.jpg';
			
			// load large image
			document.images.largeimage.src = 'images/' + imgPrefix + picNum + '-large.jpg';
			
			// Turn off selected image
			var oImg				= document.images[imgPrefix + nLastNum];
			if (oImg) {
				oImg.src			= 'images/' + imgPrefix + nLastNum + '-off.jpg';
				document.images[imgPrefix + nLastNum].selected	 = false;
			}
		}
	}
	
	function navGo(sDirection, imgPrefix) {
		var nPreviousSelected	= picNum;
		var nNextSelected	= picNum;
		switch (sDirection)
		{
			case ('previous') : {
				nNextSelected--;
				if (nNextSelected < startNum) nNextSelected = maxNum;
				break;
			}
			case ('next') : {
				nNextSelected++
				if (nNextSelected > maxNum) nNextSelected = startNum;
				break;
			}
			default : {
				break;
			}
		}
		setHighlight(nNextSelected, imgPrefix);
		return false;
	}

function translateQueryString() {
	var sQS	= unescape(location.search).substr(1);
	var oQS	= {};
	if (sQS.length) {
		var aQS_items	= sQS.split('&'), nQS_items = aQS_items.length, nQS_itemsIdx, aQS_keyValue, nQS_keyValue, nQS_keyValueIdx;
		for (nQS_itemsIdx = 0; nQS_itemsIdx < nQS_items; nQS_itemsIdx++) {
			aQS_keyValue	= aQS_items[nQS_itemsIdx].split('='), nQS_keyValue = aQS_keyValue.length;
			for (nQS_keyValueIdx = 0; nQS_keyValueIdx < nQS_keyValue; nQS_keyValueIdx++) oQS[aQS_keyValue[0]] = aQS_keyValue[1];
		}
	}
	return oQS;
}
var QueryString	= translateQueryString();

function setWallpaper(num, size)
	{
			// set the new picNum to the currently selected image
			picNum	= num;
			var nLastNum	= picNum;
			
			// Turn on clicked image thumbnail
			oImg				= document.images['wallpaper_' + size];

			// Set image's expando-property "selected" to true
			// Set image state to on
			oImg.selected	 = true;
			oImg.src			= 'images/wallpaper_' + size + '-on.jpg';
			
			// load large image
			document.images.wallpaper.src = 'images/downloads/wallpapers/wallpaper' + picNum + '_' + size + '.jpg';
			
			// Turn off selected image
			var oImg				= document.images['wallpaper_' + nLastNum];
			if (oImg) {
				oImg.src			= 'images/wallpaper_' + size + '-off.jpg';
				document.images['wallpaper_' + nLastNum].selected	 = false;
			}
	}

function popWindow(urlVal,windowName,widthVal,heightVal,centerType) {
	var paraString;
	var wt;
	var ht;
	var width = screen.width;
	var height = screen.height;
	var winWidth;
	var winHeight;
	
	if(urlVal=='bloom2006.pdf')
		urlVal = "/minisites/bloom/bloom2006.pdf";
	else if (urlVal=='spring2006.pdf')
	  	urlVal = "/minisites/harmony/harmony2006.pdf";
  	else if (urlVal=='')
	  	urlVal = "/minisites/citylights/citylights_sheet.pdf";
	else
	    urlVal = urlVal;
	      	

//	if (is.pc){height = height - 25};
	var curLeft;
	var curTop;
	
	if (navigator.appName == "Netscape") {
		curLeft = self.screenX;
		curTop = self.screenY;
	  	winWidth = window.innerWidth;
		winHeight = window.innerHeight;
	}
	else {
		curLeft = self.screenLeft;
		curTop = self.screenTop;
		winWidth = document.documentElement.offsetWidth;
		winHeight = document.documentElement.offsetHeight;
	}
	
	// Bug fix: we are now blanking the windowName variable
	windowName == "";
	wt = widthVal;
	ht = heightVal;

	if (centerType == "screen")
	{
		var winl = (screen.width - wt) / 2;
		var wint = (screen.height - ht) / 2;
		if (is.pc){wint = wint - 25};
	}
	else if (centerType == "window")
	{
		
		var winl = curLeft + ((winWidth - wt) / 2);
		var wint = curTop + ((winHeight - ht) / 2);
		if (is.pc){wint = wint - 25};
	}
	paraString = "width=" + wt + ",height=" + ht + ",top=" + wint + ",left=" + winl;

	paraString = paraString + ",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0";

	if(is.ie && is.pc) {
		if(typeof(poppedWindow) == "object") {
			poppedWindow.close();
			if(is.ie4) {
				poppedWindow = window.open(urlVal,windowName,paraString);
			}
		}
	}
	poppedWindow = window.open(urlVal,windowName,paraString);
	poppedWindow.focus();
}

function rollOver(imgname)
	{
		document.images[imgname].src = "images/" + imgname + "-on.jpg";
	}
function rollOut(imgname)
	{
		document.images[imgname].src = "images/" + imgname + "-off.jpg";
	}

function openURL(URL, closeWin, focusWin)	{
alert(URL);
		if (window.opener && !window.opener.closed)	{
			if (focusWin != 'self')	{
				window.opener.focus();
			}
			window.opener.location=URL;
			if (closeWin == 'close')	{
			close();
			}
		}
		else	{
			document.location=URL;
		}
	}

