/* This function is used for greyed background and to show popup*/
function showImagePopUp(bid)
{ 
	var width = 300;
	var height = 500;
	
	/**************for popup on midddle***************/

		var DvMsgDescBx;		
		DvMsgDescBx=document.getElementById('DvImage'); //Popup		
		
		DvMsgBxW = width;
		DvMsgBxH =height;		

		/*For Height and width of greyed background*/
			if (window.innerHeight && window.scrollMaxY || window.innerWidth && window.scrollMaxX) 
			{	
				yScroll = window.innerHeight + window.scrollMaxY;
				xScroll = window.innerWidth + window.scrollMaxX;
				
				var deff = document.documentElement;
				var wff = (deff&&deff.clientWidth) || document.body.clientWidth || window.innerWidth || self.innerWidth;
				var hff = (deff&&deff.clientHeight) || document.body.clientHeight || window.innerHeight || self.innerHeight;
				xScroll -= (window.innerWidth - wff);
				yScroll -= (window.innerHeight - hff);
			}
			else if (document.body.scrollHeight > document.body.offsetHeight || document.body.scrollWidth > document.body.offsetWidth)
			{ // all but Explorer Mac
				yScroll = document.body.scrollHeight;
				xScroll = document.body.scrollWidth;
			} 
			else 
			 { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
					yScroll = document.body.offsetHeight;
					xScroll = document.body.offsetWidth;
			  }


		var arrayPageScroll=TB_getPageScrollTop();
		var pagesize = TB_getPageSize();	
		var arrayPageScroll = TB_getPageScrollTop();
		 
		//Styles for popup
		DvMsgDescBx.style.marginLeft = -(DvMsgBxW/2)+'px';
		DvMsgDescBx.style.top=(arrayPageScroll[1] + (pagesize[1]-DvMsgBxH)/2) + 'px';
		
		DvMsgDescBx.style.display='block';
		var url='search.php?oper=showLargimage&bid='+bid;

			document.getElementById("dvImageMain").innerHTML='';
			document.getElementById("dvImagIndicator").style.display='block';
			 if(window.XMLHttpRequest) {		 
				 reqDes = new XMLHttpRequest();
			} else if(window.ActiveXObject) {			 
			 reqDes = new ActiveXObject("Microsoft.XMLHTTP");
			 }
			 reqDes.open("GET", url, true);
			 reqDes.onreadystatechange = callbackImage;
			 reqDes.send(null);

}


	function callbackImage()
	{
		if(reqDes.readyState == 4) 
		{
		 if(reqDes.status == 200) 
		 {
			  responseDes = reqDes.responseText;
			  document.getElementById("dvImageMain").innerHTML =responseDes;
			  document.getElementById("dvImagIndicator").style.display='none';
		 } 
		 else 
		 {
			alert("There was a problem retrieving the data:\n" + req.statusText);
		 }
		 }
	}
/* end ajax for request*/



function TB_getPageSize(){
	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight
	arrayPageSize = new Array(w,h) 
	return arrayPageSize;
}

function TB_getPageScrollTop()
{
	var yScrolltop;
	var xScrollleft;
	if (self.pageYOffset || self.pageXOffset) 
	{
		yScrolltop = self.pageYOffset;
		xScrollleft = self.pageXOffset;
	}
	else if (document.documentElement && document.documentElement.scrollTop || document.documentElement.scrollLeft )
	{	 // Explorer 6 Strict
		yScrolltop = document.documentElement.scrollTop;
		xScrollleft = document.documentElement.scrollLeft;
	}
	else if (document.body)
	{// all other Explorers
		yScrolltop = document.body.scrollTop;
		xScrollleft = document.body.scrollLeft;
	}
	arrayPageScroll = new Array(xScrollleft,yScrolltop) 
	return arrayPageScroll;
}

//Close function for message div close
function DvImageClose(Dvname)
{
	var dvname=document.getElementById(Dvname);	
	dvname.style.display='none'
	

}

