PositionX = 100;
PositionY = 100;
defaultWidth  = 800;
defaultHeight = 600;
var AutoClose = true;


if (parseInt(navigator.appVersion.charAt(0))>=4){
	var isNN=(navigator.appName=="Netscape")?1:0;
	var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;
}

var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;

function zoomWin(imageURL,imageTitle){
	if (isNN){
		imgWin=window.open('about:blank','',optNN);
	}
	if (isIE){
		imgWin=window.open('about:blank','',optIE);
	}
	
	with (imgWin.document){
		writeln('<html><head><title>Loading...</title><style>body{margin:0px;cursor:url("../cursor/cd.cur");}</style>');writeln('<sc'+'ript>');
		writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
		writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
		writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
		writeln('width=100-(document.body.clientWidth-document.images[0].width);');
		writeln('height=100-(document.body.clientHeight-document.images[0].height);');
		writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
		writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
		writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
		if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
		else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
		writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
		close();		
	}
}

function popLayer(content,title) {
	var pLayer = document.getElementById("popLayer");
	var pTitle = document.getElementById("popTitle");
	var pContent = document.getElementById("popContent");
	var newLeft = getOffSetLeft("container") + (getOffSetWidth("container") / 2) - (350 / 2);
							
	if (title!='') {
		pTitle.innerHTML = title;
		pTitle.style.display = "block"; 
	}
	else {
		pTitle.style.display = "none";
	}
	
	if (content!='') {
		pContent.innerHTML = content;
		pContent.style.display = "block"; 
	}
	else {
		pContent.style.display = "none";
	}
	
	if (pLayer.style.display == "block") {
		pLayer.style.display = "none";
		return false;
 	}
	
	
	pLayer.style.left = newLeft;
	pLayer.style.top = 150;		
	pLayer.style.display = "block";
}

function zoomImg(imgUrl,imgTitle) {
	var zImg = document.getElementById("zoomImg");
	var zLayer = document.getElementById("zoomLayer");
	var zTitle = document.getElementById("zoomLayerTitle");
	var newLeft = getOffSetLeft("container") + (getOffSetWidth("container") / 2) - (getImgWidth(imgUrl) / 2);
							
	if (imgTitle!='') {
		zTitle.innerHTML = imgTitle;
		zTitle.style.display = "block"; 
	}
	else {
		zTitle.style.display = "none";
	}
	
	if (zLayer.style.display == "block") {
		zLayer.style.display = "none";
		return false;
 	}
	
	zImg.src = imgUrl;
	zLayer.style.left = newLeft;
	zLayer.style.top = 150;		
	zLayer.style.display = "block";
}
	
function getOffSetWidth(id) {
	var width = document.getElementById(id).offsetWidth;
	return width;
}

function getOffSetHeight(id) {
	var height = document.getElementById(id).offsetWidth;
	return height;
}

function getOffSetLeft(id) {
	var left = document.getElementById(id).offsetLeft;
	return left;
}

function getOffSetTop(id) {
	var top = document.getElementById(id).offsetTop;
	return top;
}

function getImgWidth(path) {
	var newImg = new Image();
	newImg.src = path;
	return newImg.width;
}

function getImgHeight(path) {
	var newImg = new Image();
	newImg.src = path;
	return newImg.height;
}

function getScrollHeight()
{
   var h = window.pageYOffset ||
           document.body.scrollTop ||
           document.documentElement.scrollTop;
           
  return h ? h : 0;
}


