function gallCrDesc() {

de="<div id='ph' style='z-index:3;position:absolute;top:0px;visibility:hidden;"; /* Абсолютное позиционирование */
de+=" border: 0;"; /* Параметры рамки вокруг */
de+=" overflow: auto;"; /* Добавление полосы прокрутки */
de+="'></div>";
document.write(de);

};
function gallShow(imgp) {
	desc = document.getElementById("photocontent");
	img = new Image();
	img.src = imgp;
	w = img.width;
	h = img.height;

	if (document.documentElement && document.documentElement.scrollTop)
		theTop = document.documentElement.scrollTop;
	else if (document.body)
		theTop = document.body.scrollTop;

	img.onload = function () {
		w = this.width;
		h = this.height;

		if (document.documentElement && document.documentElement.scrollTop)
			theTop = document.documentElement.scrollTop;
		else if (document.body)
			theTop = document.body.scrollTop;

		if (w==0) {
		    desc.style.left=0;
		    desc.style.top = theTop;
		} else {
			desc.style.left =(winW-w)/2;
			desc.style.top = theTop+(winH-h)/2;
		}

		if (winH-h<0) {
			desc.style.top = document.body.scrollTop;
		}
	};

	winW = 1000;
	winH = 600;

	if (navigator.userAgent.indexOf("Opera")!=-1)
		is_opera = true;
	else
		is_opera = false;

	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {	 		winW = window.innerWidth;
	 		winH = window.innerHeight;
	 	}
	 	if (navigator.appName.indexOf("Microsoft")!=-1) {
	  		winW =  document.documentElement.clientWidth;

	  		winH =  document.documentElement.clientHeight;
	 	}
		if (is_opera==true) {
	 		winW = window.innerWidth;
	 		winH = window.innerHeight;
	 	}
	}
	if (!w) {
		w = 0;
		h = 0;
	}
	if (w==0) {
	    desc.style.left=0;
	    desc.style.top = document.body.scrollTop;
	} else {
		desc.style.left =(winW-w)/2+ "px";
		newTop = theTop+(winH-h)/2;
        if (newTop<0)
        	newTop = 0;


		desc.style.top = newTop+ "px";
		//desc.style.top = "145px";
	}


	//if (winH-h<0) {
	//	desc.style.top = document.body.scrollTop;
	//}
	desc.style.visibility = "visible";

	ih="<table border=0 cellspacing=1 cellpadding=1 bgcolor='#000'><tr><td bgcolor='#ffffff'>";
	ih+="<table border=0 bgcolor='#ffffff' cellspacing=0 cellpadding=1 width="+w+" height="+h+" ><tr><td height=13 align='right'>";
	ih+="<img style='cursor: hand' alt='close' src='/img/close.gif' border=0 onclick='gallHide();'>";
	ih+="</td></tr><tr><td><img id='descImg' style='cursor: hand' onclick='gallHide();'></td></tr></table>";
	ih+="</td></tr></table>";
	desc.innerHTML = ih;
	document.getElementById("descImg").src = img.src;
	//alert(winH+" "+ w);
};

function gallHide() {
	desc = document.getElementById("photocontent");
	desc.innerHTML="";
	desc.style.visibility = "hidden";
}
