function layerSetClip() {	
	if (x1>x2) {
		zright=x1;
		zleft=x2;
	} else {
		zleft=x1;
		zright=x2;
	}
	if (y1>y2) {
		zbottom=y1;
		ztop=y2;
	} else {
		ztop=y1;
		zbottom=y2;
	}
	if ((x1 != x2) && (y1 != y2)) {
		layerClip("zoomBoxTop",zleft,ztop,zright,ztop+BoxSize);
		layerClip("zoomBoxLeft",zleft,ztop,zleft+BoxSize,zbottom);
		layerClip("zoomBoxRight",zright-BoxSize,ztop,zright,zbottom);
		layerClip("zoomBoxBottom",zleft,zbottom-BoxSize,zright,zbottom);
//		alert(document.getElementById('zoomBoxInside').filters.alpha.opacity);
		layerClip("zoomBoxInside",zleft + 2,ztop +2, zright - 2,zbottom - 2);
	}
}

// Create a DHTML layer
function layerCreate(name, ileft, itop, iwidth, iheight, visible, content) {
	  var layer;
	if (top.isNav4) {
		document.writeln('<layer name="' + name + '" left=' + ileft + ' top=' + itop + ' width=' + iwidth + ' height=' + iheight +  ' visibility=' + (visible ? '"show"' : '"hide"') +  '>');
		document.writeln(content);
		document.writeln('</layer>');
	} else {
		document.writeln('<div id="' + name + '" style="position:absolute; overflow:none; left:' + ileft + 'px; top:' + itop + 'px; width:' + iwidth + 'px; height:' + iheight + 'px;' + ' visibility:' + (visible ? 'visible;' : 'hidden;') +  '">');
		document.writeln(content);
		document.writeln('</div>');
	}
	  layerClip(name, 0, 0, iwidth, iheight);
}

// get the layer object called "name"
function layerGet(name) {
	if (top.isNav4) {
		return(document.layers[name]);
	} else if (top.isIE) {
		layer = eval('document.all.' + name + '.style');
		return(layer);
	} else if ((top.isNav) || (top.isNav6) ){
		var theElements = document.getElementsByTagName("div");
		var theObj;
		var j = -1;
		for (i=0;i<theElements.length;i++) {
			if (theElements[i].id==name) theObj = theElements[i].style;
		}
		return theObj;
	} else {
		return(null);
	}
}


// move layer to x,y
function layerMove(name, x, y) {
	var layer = layerGet(name);
	if (top.isNav4) {
		layer.moveTo(x,y);
	} else {
		layer.left = x;
		layer.top  = y;
		
	}
}

//function layerSetTransparency(name, trans) 
//	{		


//		document.getElementById('zoomBoxInside').filters.alpha.opacity
//var layer = layerGet(name);
//alert(layer);
//layer.filters.alpha.opacity = 2;
//	if (top.isNav4) {
//		layer.bgColor = color;
//	} else {
//		layer.backgroundColor = color;	
//	}
//}


// set layer background color
function layerSetBackgroundColor(name, color) {		
	var layer = layerGet(name);
	if (top.isNav4) {
		layer.bgColor = color;
	} else {
		layer.backgroundColor = color;
	
	}
}

// toggle layer to invisible
function layerHide(name) {		
	var layer = layerGet(name);
	if (top.isNav4) {
		layer.visibility = "hide";
	} else {
		layer.visibility = "hidden";
	}
}

// toggle layer to visible
function layerShow(name) {		
	var layer = layerGet(name);
	if (top.isNav4) {
		layer.visibility = "show";
	} else {
		layer.visibility = "visible";
	}
}


// clip layer display to clipleft, cliptip, clipright, clipbottom
function layerClip(name, clipleft, cliptop, clipright, clipbottom) {		
	var layer = layerGet(name);
	if (top.isNav4) {
		layer.clip.top    = cliptop;
		layer.clip.left   = clipleft;
		layer.clip.right  = clipright;
		layer.clip.bottom = clipbottom;
	} else {
		layer.clip = 'rect(' + cliptop + ' ' +  clipright + ' ' + clipbottom + ' ' + clipleft +')';
	}
}

// replace layer's content with new content
function layerReplaceContent(name, content) {

	if (top.isNav4) {
		var layer = layerGet(name);
		layer.document.open();
		layer.document.writeln(content);
		layer.document.close();
	} else if (top.isIE) {
		var str = "document.all." + name + ".innerHTML = '" + content + "'";
		eval(str);
	}
	else if (top.isNav6)
	{
		document.getElementById(name).innerHTML = content;
	}
}
