function openDynamicImageWindow(file,w,h,typ,closeText) {
	if(typ == "dhtml") {
		if(document.all) {
			var windowWidth = self.document.body.clientWidth;
			var windowHeight = self.document.body.clientHeight;
			var scrolltop = document.body.scrollTop;
			var scrollleft = document.body.scrollLeft;
		} else {
			var windowWidth = self.innerWidth;
			var windowHeight = self.innerHeight;
			var scrolltop = document.documentElement.scrollTop;
			var scrollleft = document.documentElement.scrollLeft;
		}
		var postop =(windowHeight/2)-(h/ 2)+scrolltop+document.body.style.padding;
		var posleft =(windowWidth/2)-(w/ 2)+scrollleft+document.body.style.padding;
		var hh =(windowHeight)+500+scrolltop+document.body.style.padding;
		var ww =(windowWidth)+scrollleft+document.body.style.padding;
		//var hh='100%';
		//var ww = 1000;
		//alert(hh + "::" + ww);
		///// just testing:
		var arrayPageSize = getPageSize();
		var arrayPageScroll = getPageScroll();
			//// resizing ////
			var postop = arrayPageScroll[1] + (arrayPageSize[3] / 15);
			var hh = arrayPageSize[1];
			
		if(document.all) {
			if(postop >= 20) { postop = postop-20; }
		} else {
			if(postop >= 30) { postop = postop-30; }
		}
		var bodyObj = document.getElementsByTagName('BODY')[0];
		if(!document.getElementById("dynamicImageContainer")) {
			divObjContainer = document.createElement("div");
			divObjContainer.setAttribute("id", "dynamicImageContainer");
			bodyObj.appendChild(divObjContainer);
			//bodyObj.insertBefore(divObjContainer, bodyObj.firstChild);
		} else {
			divObjContainer = document.getElementById("dynamicImageContainer");
		}
		divObjContainer.style.display = "block";
		divObjContainer.innerHTML = "<div class=\"imageContainer\" style=\"top:"+postop+"px; left:"+posleft+"px; position: absolute; z-index:100000; display:block; \"><div class=\"imageBorder\" style=\"background-color: #fff; padding: 4px; border: solid 1px #ccc\"><img onclick=\"closeDynamicImageWindow();\" style=\"cursor:pointer;border: solid 1px #000\" src=\""+file+"\" alt=\""+closeText+"\" width=\""+w+"\" height=\""+h+"\"\/><\/div><\/div><div onclick=\"closeDynamicImageWindow();\" style=\"width:"+ ww + "px;height:"+ hh + "px;position: absolute; z-index:1000;filter:alpha(opacity=75);-moz-opacity: 0.75;opacity: 0.75;left:0px;top:0px;;background-color:#000000;\"><\/div>";
	} else if(typ == "javascript") {
		// center popup
		var postop =(screen.height /2)-(h/ 2);
		var posleft =(screen.width /2)-(w/ 2);
		window.open(file+'&closeText='+encodeURI(closeText)+'', '', 'dependent=yes,width='+w+',height='+h+',left='+posleft+',top='+postop+',scrollbars=no,resizable=no,menubar=no,location=no,status=no');
	}
}
function closeDynamicImageWindow() {
	document.getElementById("dynamicImageContainer").style.display = "none";
}

//
// getPageScroll()
// Returns array with x,y page scroll values.
// Core code from - quirksmode.org
//
function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}

// -----------------------------------------------------------------------------------

//
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		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
		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 = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

// -----------------------------------------------------------------------------------
