function ajaxCall(url, w, h) {
		
	var xmlHttp;
	try {  // Firefox, Opera 8.0+, Safari  
		xmlHttp=new XMLHttpRequest();  
	}
	catch (e) {  
		// Internet Explorer  
		try {    
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    
		}
		catch (e) {    
			try
			{      
	 			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
			}
			catch (e) {      
				alert("Your browser does not support AJAX!");      
				return false;      
			}    
		}  	
	}
	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4) {
			document.getElementById("ajaxContent").innerHTML=xmlHttp.responseText;
			//document.getElementById("template").height;
			displayLightbox(w, h);

	 	}
	}
		xmlHttp.open("GET",url,true);
		
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
		xmlHttp.setRequestHeader("Content-Type", "text/xml; charset=iso-8859-9");
		
		xmlHttp.send(null); 
}

function displayLightbox(w, h) {
	
	var newLeft = getOffSetLeft("container") + (getOffSetWidth("container") / 2) - w / 2;	
	var arrayPageSize = getPageSize();
	var imgHeight;
	var imgWidth;
	
	document.getElementById('txtDataContainer').style.width = w + 'px';
	document.getElementById('txtDetails').style.width = w-40 + 'px';
	//document.getElementById('txtDataContainer').style.height = h + 'px';
	//document.getElementById('txtDataContainer').style.height = 'auto';
	//document.getElementById('txtData').style.width = w + 'px';
		
	document.getElementById('txtoverlay').style.height = arrayPageSize[1] + 'px';
	//document.getElementById('txtlightbox').style.left = newLeft + 'px';
	document.getElementById('txtlightbox').style.width = '100%';
	document.getElementById('txtlightbox').style.top = 75 + getScrollHeight() + 'px';
	
	document.getElementById('txtoverlay').style.display = 'block';
	document.getElementById('txtlightbox').style.display = 'block';
	//imgWidth = document.getElementById("templateImg").width;
	//imgHeight = document.getElementById("templateImg").height;
	//document.getElementById("templateImg").width = imgWidth;
	//document.getElementById("templateImg").height = imgHeight;
	
	//setStyle({ position: 'fixed', left: '0px', top: '0px', right: '0px', bottom: '0px', height: arrayPageSize[1] + 'px' });

}
	
function closeLightbox() {
	document.getElementById('txtoverlay').style.display = 'none';
	document.getElementById('txtlightbox').style.display = 'none';


}
	
function getPageSize() {
    			    
  var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	
	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}

	return [pageWidth,pageHeight];
}

