JJ.imgCache=[];
JJ.imgLoad=function(){var i,j=JJ.imgCache.length;for(i=0;i<arguments.length;i++){JJ.imgCache[j]=new Image();JJ.imgCache[j++].src="/images/"+arguments[i];}}
JJ.imgLoad("jj-close-icon_hover.gif", "jj-loading.gif");
JJ.addElement=function(tag,att,o){var i,node=d.createElement(tag);if(att){for(i=0;i<att.length;i++){node.setAttribute(att[i][0],att[i][1]);}}if(o){o.appendChild(node);}else{d.body.appendChild(node);}return node;}
JJ.cancelEvent=function(e){if(e)e.preventDefault();else return false;}
JJ.getCoords=function(o){var x,y,par;if(typeof(o)=="string")o=g(o);x=o.offsetLeft;y=o.offsetTop;par=o.offsetParent;while(par){x+=par.offsetLeft;y+=par.offsetTop;par=par.offsetParent;}return {"x":x,"y":y};}
JJ.imgEnlarger = {
"container":{},"img":{},"statusImg":{},
"appendStatus":function(o){var coords=JJ.getCoords(o);with(this.statusImg.style){left=coords.x+"px";top=coords.y+"px";visibility="visible";}},
"showImg":function(){var x,y,wd=JJ.getWinDim();x=Math.floor((wd.width-JJ.imgEnlarger.img.width-2)/2);y=Math.floor((wd.height-JJ.imgEnlarger.img.height-2)/2);x=(x<5?5:x);y=(y<5?5:y);if(JJ.ua=="ie6"){x+=JJ.doc.scrollLeft;y+=JJ.doc.scrollTop;}with(JJ.imgEnlarger.container.style){left=x+"px";top=y+"px";width=JJ.imgEnlarger.img.offsetWidth+"px";height=JJ.imgEnlarger.img.offsetHeight+"px";visibility="visible";}JJ.imgEnlarger.statusImg.style.visibility="hidden";},
"drag":function(e){var wd=JJ.getWinDim(),evt=e||event,x=evt.clientX,y=evt.clientY,o=JJ.imgEnlarger.container;if((e?evt.button:evt.button-1)!=0){JJ.imgEnlarger.stopDrag();return;}if(x<0||y<0||x>wd.width||y>wd.height)return;o.style.left=(x-o.dx)+"px";o.style.top=(y-o.dy)+"px";try{d.selection.empty();}catch(err) {o.focus();}},
"stopDrag":function(){JJ.removeEvent([d],"mousemove",JJ.imgEnlarger.drag);JJ.removeEvent([d],"mouseup",JJ.imgEnlarger.stopDrag);JJ.imgEnlarger.container.style.cursor="default";},
"load":function(o, url){if(this.img.src.indexOf(url)!=-1){this.showImg();}else{this.container.style.visibility="hidden";this.appendStatus((typeof(o)=="string"?g(o):o));this.img.src=url;}},
"init":function(){var i,c,arr;this.container=c=JJ.addElement("div");c.innerHTML='<div></div><img src="" alt="" /><div><img src="/images/jj-icon-bg.png" alt="" /></div><img src="/images/jj-close-icon_up.gif" alt="" />';with(c.style){visibility="hidden";position=(JJ.ua=="ie6"?"absolute":"fixed");zIndex=10}with(c.firstChild.style){position="absolute";left=top="3px";width=height="100%";backgroundColor="#000";filter="alpha(opacity=30)";opacity=0.3;}this.img=c.childNodes[1];with(this.img.style){position="absolute";display="block";borderStyle="solid";borderWidth="1px 2px 2px 1px";borderColor="#fc6 #960 #960 #fc6";}JJ.addEvent([this.img],"load",this.showImg);with(c.childNodes[2].style){position="absolute";width="68px";height="30px";right="2px";top="1px";}if(JJ.ua=="ie6"){c.childNodes[2].style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="/images/jj-icon-bg.png",sizingMethod="scale")';c.childNodes[2].firstChild.style.visibility="hidden";}with(c.childNodes[3].style){position="absolute";width=height="20px";top=right="5px";cursor="pointer";}JJ.addEvent([c.childNodes[3]],["mouseover","mouseout","click"],[function(){this.src="/images/jj-close-icon_hover.gif";},function(){this.src="/images/jj-close-icon_up.gif";},function(){this.parentNode.style.visibility="hidden";}]);this.statusImg=JJ.addElement("img",[["src","/images/jj-loading.gif"],["alt",""]]);with (this.statusImg.style){visibility="hidden";position="absolute";}JJ.addEvent([this.container],"mousedown",function(e){var evt=e||event,p=JJ.getCoords(this);if((e?evt.button:evt.button-1)!=0)return;this.dx=evt.clientX-p.x;this.dy=evt.clientY-p.y;this.style.cursor="move";JJ.addEvent([d],"mousemove",JJ.imgEnlarger.drag);JJ.addEvent([d],"mouseup",JJ.imgEnlarger.stopDrag);return JJ.cancelEvent(e);});JJ.addEvent([this.container],"drag",JJ.cancelEvent);}
};

JJ.removeEvent([window], "load", init);

JJ.addEvent([window], "load", function() {
	var arr, i, fn, id, o;
	init();
	arr = gt(g("article"), "div");
	for (i=0;i<arr.length;i++) {
		if (arr[i].id.indexOf("pic_") == 0) {
			fn = arr[i].id.split("_");
			if (JJ.flash >= 6) {
				id = fn[1].replace(/-/g, "_");
				arr[i].innerHTML = '<embed id="' + id + '" name="' + id + '" src="/flash/' + fn[1] + '.swf" menu="false" quality="best" wmode="transparent" bgcolor="#5b240f" width="' + fn[2] + '" height="' + fn[3] + '" swliveconnect="true" type="application/x-shockwave-flash" />';
				if (JJ.ua.indexOf("ie") == 0) {
					o = d.createElement("script");
					o.setAttribute("type", "text/javascript");
					o.event = "fscommand(id, url)";
					o.htmlFor = id;
					o.text = "JJ.imgEnlarger.load(id, url)";
					gt(d, "head")[0].appendChild(o);
				}
				else {
					this[id + "_DoFSCommand"] = function(id, url) { JJ.imgEnlarger.load(id, url) }
				}
			}
			else {
				arr[i].innerHTML = '<a href="/images/' + fn[1] + '.jpg" target="_blank"><img class="photo" src="/images/thumb_' + fn[1] + '.jpg" alt="" title="Click to see enlargement" /></a>';
				o = gt(arr[i], "img")[0];
				JJ.addEvent([o.parentNode], ["click", "focus"], [JJ.cancelEvent, function() { this.blur() }]);
				JJ.addEvent([o], "click", function() { JJ.imgEnlarger.load(this, this.src.replace(/thumb_/, "")) });
			}
		}
	}
	JJ.imgEnlarger.init();
});