// <!--
function resolveObject (object) {
	if (typeof object == "string") {
		if (document.getElementById) return document.getElementById (object)
		// Internet Explorer 4 or Opera with IE user agent
		else if (document.all) return document.all[object]
		// Navigator 4
		else if (document.layers) return document.layers[object];
	}
	else return object;
}

function setOpacity (object, degree){
	if (object.filters && object.filters[0]) {
		// If IE6+
		if (typeof object.filters[0].opacity == "number") object.filters.alpha.opacity =degree
		// If IE5.5-
		else object.style.filter="alpha(opacity="+degree+")"
	}
	else if (object.style.opacity) object.style.opacity=degree/101
	else if (object.style.MozOpacity) object.style.MozOpacity=degree/101
	else if (object.style.KhtmlOpacity) object.style.KhtmlOpacity=degree/100
	//object.filters.alpha.opacity=degree
}

function getOpacityModel (object) {
	if (object.filters) {return "IE"}
	else return "Other"
}

function getOpacity (object) {
	object = resolveObject (object);
	if (!object.opacityModel) {object.opacityModel = getOpacityModel (object)}
	if (object) {
		switch (object.opacityModel) {
			case "IE":	
			case "IE":	return object.filters.alpha.opacity; break;
			default:
			if (object.style) {
				var style = object.style;
				if (style.opacity) return style.opacity =="" ? 0 :Math.round (parseFloat (style.opacity) *100);
				if (style.MozOpacity) return style.MozOpacity =="" ? 0 :Math.round (parseFloat (style.MozOpacity) *100);
				if (style.KhtmlOpacity) return style.KhtmlOpacity =="" ? 0 :Math.round (parseFloat (style.KhtmlOpacity) *100);
				return 0;
			}
		}
	}
	if (object.Interval) clearInterval (object.Interval)
	alert ("Opacity not found");
}

function setOpacity (object, target, step, interval) {
	object = resolveObject (object);
	if (!step) {
		if (!object.opacityModel) {object.opacityModel = getOpacityModel (object)}
		switch (object.opacityModel) {
			case "IE":		object.filters.alpha.opacity = target; break;
			default:
			if (object.style) {
				var style = object.style;
				target = target/100;
				style.KhtmlOpacity = target;
				target = Math.min (target, .9999);
				target = Math.max (target, .0001);
				style.opacity = target;
				style.MozOpacity = target;
			}
		}
	} else if (!interval) {
		var opacity = getOpacity (object);
		if (opacity <target) {setOpacity (object, opacity +=step)}
		else if (opacity >target) {setOpacity (object, opacity -=step)}
		else if (object.Interval) {clearInterval (object.Interval)}
	} else {
		if (object.Interval) clearInterval (object.Interval)
		if (!object.id) object.id = "rotation" +Math.random();
		object.Interval=setInterval("setOpacity ('"+object.id +"'," +target +"," +step +")", interval);
	}
}

function showStep (objectID, step) {
	if (!step) step =2;
	var object = document.getElementById (objectID);
	if (browserdetect=="mozilla" && object.style.MozOpacity <1)
		object.style.MozOpacity=Math.min(parseFloat (object.style.MozOpacity) +(step/100), 0.99);
	else if (browserdetect=="ie" && object.filters.alpha.opacity <100)
		object.filters.alpha.opacity +=step;
	else if (object.showTimer) clearInterval (object.showTimer)
}

function show (object, interval, step){
	if (!interval) interval =50;
	if (object.hideTimer) clearInterval (object.hideTimer)
	browserdetect=object.filters? "ie" : typeof object.style.MozOpacity=="string"? "mozilla" : ""
	if (object.style.MozOpacity =="") object.style.MozOpacity = 0;
	//setOpacity (object, 0)
	object.showTimer=setInterval("showStep ('" +object.id +(step ? ("',"+step) : "'") +")", interval)
}

function hideStep (objectID, step) {
	if (!step) step =2;
	var object = document.getElementById (objectID);
	if (browserdetect=="mozilla" && object.style.MozOpacity >0)
		object.style.MozOpacity=Math.max(parseFloat (object.style.MozOpacity) -(step/100), 0.01);
	else if (browserdetect=="ie" && object.filters.alpha.opacity >0)
		object.filters.alpha.opacity -=step;
	else if (object.hideTimer) clearInterval (object.hideTimer)
}

function hide (object, interval, step) {
	if (!interval) interval =50;
	if (object.showTimer) clearInterval (object.showTimer);
	browserdetect=object.filters? "ie" : typeof object.style.MozOpacity=="string"? "mozilla" : ""
	object.hideTimer=setInterval ("hideStep ('" +object.id +(step ? ("',"+step) : "'") +")", interval)
	//setOpacity (object, 0)
}

function showPopup (object) {
	var ContentDiv = document.getElementById ("Content");
	var PopupDiv = document.getElementById ("Popup");
	var ImageID = "Image" +object.src.replace (/.*Thmb-/i, "").replace (/.jpg/, "");
	var PopupImage = document.getElementById (ImageID);
	setOpacity (PopupImage, 0);
	ContentDiv.style.display = "none";
	PopupDiv.style.display = "block";
	PopupImage.style.display = "block";
//	show (PopupImage, false, 4);
	setOpacity (PopupImage, 100, 4, 50) 
}
function hidePopup (object) {
	setOpacity (object, 0);
	object.style.display = "none";
	var ContentDiv = document.getElementById ("Content");
	var PopupDiv = document.getElementById ("Popup");
	PopupDiv.style.display = "none";
	ContentDiv.style.display = "block";
}

function offsite (url, windowName) {
	var height = this.screen.availHeight;
	windowName = !windowName ?url :windowName;
	if (!height) {height = 500}
	else {height = height -100}
	self.name = "parent";
	remote = open(url, "Tile" , "directories=0,location=0,menubar=0,resizable=yes,scrollbars=1,status=0,toolbar=1,width=700,height="+height+",left=50,top=20");
	if (remote) remote.focus ();
}
// -->