	var detect = navigator.userAgent.toLowerCase(); 
	var browser,thestring; 
	var newWin;

	// return the browser
	function getBrowser() { 
		if (checkIt('msie') || checkIt('internet explorer')) browser = "IE"; 
		else if (!checkIt('compatible') || checkIt('firefox')) { 
			browser = "Mozilla"; 
			if(checkIt('firefox')) 
				browser="Firefox"; 
		} 
		else browser = "Unknown"; 
		return browser; 
	} 
	
	// check the browser
	function checkIt(string) { 
		place = detect.indexOf(string) + 1; 
		thestring = string; 
		return place; 
	} 
    
	// opens the why window 
	function openWhy(URL, imageID) {
		if(newWin!=null) newWin.close();
		//get target X & Y positions to move to 
		var coordinates = getAnchorWindowPosition(imageID);
		//var targetX=getImageXfromLeft(imageID); 
		//var targetY=getImageYfromTop(imageID); 
		var targetX=coordinates.x+47;
		var targetY=coordinates.y-10;
		var param2 = 'height=118,resizable=no,width=296,left='+targetX+',top='+targetY;
		newWin=window.open(URL, 'Gallery_Index', param2);
		newWin.focus();
	}
	
	// close the why window
	function closeWhy(){
		newWin.close();
	}

	function getImageXfromLeft(imgID) { 
	  //if not using IE 
	  if (getBrowser()!="IE") return document.getElementById(imgID).x; 
	  else return getRealLeft(imgID);//else, using Internet explorer 
	} 

	function getImageYfromTop(imgID) { 
	  if (getBrowser()!="IE") return document.getElementById(imgID).y; 
	  else return getRealTop(imgID); 
	} 

	// These below handle Internet explorer 
	function getRealLeft(imgElem) { 
		xPos = document.getElementById(imgElem).offsetLeft; 
		tempEl = document.getElementById(imgElem).offsetParent; 
		  while (tempEl != null) { 
			  xPos += tempEl.offsetLeft; 
			  tempEl = tempEl.offsetParent; 
		  } 
		return xPos; 
	} 

	function getRealTop(imgElem) {
		yPos = document.getElementById(imgElem).offsetTop; 
		tempEl = document.getElementById(imgElem).offsetParent; 
		while (tempEl != null) { 
			  yPos += tempEl.offsetTop; 
			  tempEl = tempEl.offsetParent; 
		  } 
		return yPos; 
	} 

	// getAnchorPosition(anchorname)
	//   This function returns an object having .x and .y properties which are the coordinates
	//   of the named anchor, relative to the page.
	function getAnchorPosition(anchorname) {
		var coordinates=new Object();
		coordinates.x=getImageXfromLeft(anchorname); ;
		coordinates.y=getImageYfromTop(anchorname);
		return coordinates;
	}

	// getAnchorWindowPosition(anchorname)
	//   This function returns an object having .x and .y properties which are the coordinates
	//   of the named anchor, relative to the window
	function getAnchorWindowPosition(anchorname) {
		var coordinates=getAnchorPosition(anchorname);
		var x=0;
		var y=0;
		if (document.getElementById) {
			if (isNaN(window.screenX)) {
				x=coordinates.x-document.body.scrollLeft+window.screenLeft;
				y=coordinates.y-document.body.scrollTop+window.screenTop;
				}
			else {
				x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
				y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
				}
			}
		else if (document.all) {
			x=coordinates.x-document.body.scrollLeft+window.screenLeft;
			y=coordinates.y-document.body.scrollTop+window.screenTop;
			}
		else if (document.layers) {
			x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
			y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
			}
		coordinates.x=x;
		coordinates.y=y;
		return coordinates;
		}
