var ie5=(document.getElementById && document.all);
var ns6=(document.getElementById && !document.all);

	// Dynamic Iframe loader
	function loadIframe(containerId, theURL) {
		document.getElementById(containerId).src=theURL;
	}
	
	function viewImage(imageURL, title, width, height){
		    alert(imageURL + ' ' + title + ' ' + width + ' ' + height);
	   	   	openNonModalWindow(imageURL, title, width, height);
			return false;
   }
	
	var nonModalWindow = new Object();

	function openNonModalWindow(url, windowName, width, height)
	{
	    alert(url + ' ' + windowName + ' ' + width + ' ' + height);
		// Center in screen.
		nonModalWindow.left = (screen.width - width) / 2;
		nonModalWindow.top = (screen.height - height) / 2;
		
		alert('we got here 1');
		
		var attr = "left=" + nonModalWindow.left
						   + ",top=" + nonModalWindow.top
						   + ",toolbar=false,menubar=false,status=off,resizable=yes,scrollbars=yes"
						   + ",width=" + width
						   + ",height=" + height;	
	
	    alert('we got here 2');
		
		nonModalWindow.win = window.open(url, windowName, attr);
		
		alert('we got here 3');
		nonModalWindow.win.focus();
		alert('we got here 4');
		return nonModalWindow;
	}
	
	
	var selectedMenuItemId = '';

    function highlight(imgId, isPermanent){
		if (isPermanent){
			if(document.getElementById){

				if (selectedMenuItemId != ''){
					unHighlight(selectedMenuItemId, true);
				}
				var imgObj = document.getElementById(imgId);
				selectedMenuItemId = imgId;

				setOpacity(imgObj, 1);
			}
		} else {
			if(document.getElementById){
				var imgObj = document.getElementById(imgId);
				setOpacity(imgObj, 1);
			}			
		}
	}
  
   function unHighlight(imgId, forceUnHighlight){
	   	   var imgObj = document.getElementById(imgId);
	  	   if (selectedMenuItemId != imgId || forceUnHighlight){
			    //alert('unHighlight - this is NOT the selected item');
				setOpacity(imgObj, 0.60);   
		   } else {
			   // alert('unHighlight - this is the selected item');
		   }
   }
  
	
	function setOpacity(imgObj, value){
   			if(ie5){
			    var op = 100 * value;
				imgObj.style.filter="alpha(opacity="+ op + ")";
				imgObj.filters.alpha.opacity = op;
			}
			if(ns6){
				imgObj.style.MozOpacity = value;
			}
   }
   
	function EmbedContent(DivID, WIDTH, HEIGHT, URL){
	  var d = document.getElementById(DivID);
	  d.innerHTML = 
		"<object data='" + URL + "' type='text/html'" +
		         "width='" + WIDTH + "' height='" + HEIGHT + "'/>";
	}
