var lightDocScrollTop=0;
var lightBodyScrollTop=0;
function lightbox(path)
	{
		//document scroll
		lightDocScrollTop=document.documentElement.scrollTop;
		lightBodyScrollTop=document.body.scrollTop;		
		//----
		var div=document.createElement("div");
		div.style.zIndex='1001';
		div.className="lightbox_fill";
		
		document.documentElement.style.overflow="hidden";
		document.body.style.overflow="hidden";
		
		var docSize=getDocSize();
		var scroll=getScroll();
		
		div.style.width=(docSize[0]+scroll[0])+"px";
		div.style.height=(docSize[1]+scroll[1])+"px";
		
		div.onclick=function(){
			this.parentNode.removeChild(this);
			document.documentElement.style.overflow="auto";
			document.body.style.overflow="auto";
			document.body.scrollTop=lightBodyScrollTop;
			document.documentElement.scrollTop=lightDocScrollTop;
			}
		
		document.body.appendChild(div);
		
		var img=document.createElement("img");
		img.className="lightbox_obj";
		img.src=path;
		img.style.visibility="hidden";
		div.appendChild(img);
		
		if(/*@cc_on!@*/false)
		{ //fuck ie
		img.style.top=(docSize[1]-img.offsetHeight)/2 + scroll[1] + "px";
		img.style.left=(docSize[0]-img.offsetWidth)/2 + scroll[0] + "px";
		img.style.visibility="visible";
		}else
			{
				img.onload=function ()
					{
						this.style.top=(docSize[1]-img.offsetHeight)/2 + scroll[1] + "px";
						this.style.left=(docSize[0]-img.offsetWidth)/2 + scroll[0] + "px";
						this.style.visibility="visible";
					}
			}
		
		
	}
	
function getDocSize() {

 var viewportwidth;
 var viewportheight;
 
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 if (typeof window.innerWidth != 'undefined')
 {
      viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
 }
 
 // older versions of IE
 
 else
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }


	return [parseInt(viewportwidth), parseInt(viewportheight)];
 }

function getScroll() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ parseInt(scrOfX), parseInt(scrOfY) ];
}
