	//Create a boolean variable to check for a valid Internet Explorer instance.
	var xmlhttp = false;
	
	//Check if we are using IE.
	try {
		//If the Javascript version is greater than 5.
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		//alert ("You are using Microsoft Internet Explorer.");
	} catch (e) {
		//If not, then use the older active x object.
		try {
			//If we are using Internet Explorer.
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			//alert ("You are using Microsoft Internet Explorder");
		} catch (E) {
			//Else we must be using a non-IE browser.
			xmlhttp = false;
		}
	}
	
	//If we are using a non-IE browser, create a javascript instance of the object.
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		xmlhttp = new XMLHttpRequest();
		//alert ("You are not using Microsoft Internet Explorer");
	}
	
	function makerequest(serverPage, objID, width) {
		
		var obj = document.getElementById(objID);
		
		xmlhttp.open("GET", serverPage);
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState < 4) {
				//document.getElementById("loadstyle").style.width = width + "px";
				obj.innerHTML = "<div class='loadstyle'><p class='loading-img'><img src='../images/ajax-loader-lines.gif' /></p><p class='animated-gif-style'>Loading</p></div>";
			}
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				obj.innerHTML = xmlhttp.responseText;
			}
		}
		xmlhttp.send(null);
	}

	function initImage(imageId) {
	  //imageId = 'thephoto';
	  //document.getElementById(placeHolder).style.width = width + "px";
	  
	  image = document.getElementById(imageId);
	  setOpacity(image, 0);
	  image.style.visibility = 'visible';
	  fadeIn(imageId,0);
	  
	  // to set the div height for the black overlay in the light box
	  //document.getElementById("fade").style.height = getheight() + "px";
	}
	
	function setOpacity(obj, opacity) {
	  opacity = (opacity == 100)?99.999:opacity;
	  
	  // IE/Win
	  obj.style.filter = "alpha(opacity:"+opacity+")";
	  
	  // Safari<1.2, Konqueror
	  obj.style.KHTMLOpacity = opacity/100;
	  
	  // Older Mozilla and Firefox
	  obj.style.MozOpacity = opacity/100;
	  
	  // Safari 1.2, newer Firefox and Mozilla, CSS3
	  obj.style.opacity = opacity/100;
	}
	
	function fadeIn(objId,opacity) {
	  if (document.getElementById) {
	    obj = document.getElementById(objId);
	    if (opacity <= 100) {
	      setOpacity(obj, opacity);
	      opacity += 10;
	      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 150);
	    }
	  }
	}
	
	function ShowLightBox(Id1, Id2, serverPage, objID, imageId, width, height)
	{	
		var lbWidth = parseInt(width) + 100;
		var lbHeight = parseInt(height) + 80;
		var imgHeight = parseInt(height) + 30;
		
		//variable to get half of the width and height of the picture to center the lightbox in browser
		var leftMargin = parseInt(lbWidth) / 2;
		var leftPos = Math.round(leftMargin);
				
		document.getElementById(Id1).style.display='block';
		document.getElementById(Id2).style.display='block';

	  	// to set the div height for the black overlay in the light box
	  	document.getElementById("fade").style.height = getheight() + "px";

		// set the left margin for the lightbox
		document.getElementById(Id1).style.marginLeft = "-" + leftPos + "px";
		
		// Resize the lightbox to the size of the image with padding around the image		 
		document.getElementById(Id1).style.width = lbWidth + "px";
		document.getElementById(Id1).style.height = lbHeight + "px";
		
		// Resize the DIV that holds the image
		//document.getElementById(load).style.width = width + "px";
		//document.getElementById(objID).style.height = imgHeight + "px";


		// for Internet explorer
		//document.getElementById(imageId).alt = tag;
		
		//Call the script to get the image
		makerequest(serverPage, objID, width);
		
	}
	
	function CloseLightBox(Id1, Id2, imageId)
	{
		document.getElementById(Id1).style.display='none';
		document.getElementById(Id2).style.display='none';
	
	}
	function getheight(){
		var d= document.documentElement;
		var b= document.body;
		var who= d.offsetHeight? d: b ;
		return Math.max(who.scrollHeight,who.offsetHeight);
	}

        function ShowcatTitle(title, catId) {
            document.getElementById(catId).innerHTML = title;
        }

        function hidecatTitle(catId) {
            document.getElementById(catId).innerHTML = '';
        }

