// thoughtcrimeink scripts, collected

$().ready(function() {
	$('#logindialog').jqm();
});

$(document).keydown( function( e ) {
	if( e.which == 27) { // escape, close box
		$(".jqmWindow").jqmHide();
	}
});

function shipPopUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=469,height=500');");
}

/*
 * jqModal - Minimalist Modaling with jQuery
 *   (http://dev.iceburg.net/jquery/jqModal/)
 *
 * Copyright (c) 2007,2008 Brice Burgess <bhb@iceburg.net>
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 * 
 * $Version: 03/01/2009 +r14
 */
(function(a){a.fn.jqm=function(d){var e={overlay:50,overlayClass:"jqmOverlay",closeClass:"jqmClose",trigger:".jqModal",ajax:f,ajaxText:"",target:f,modal:f,toTop:f,onShow:f,onHide:f,onLoad:f};return this.each(function(){if(this._jqm)return c[this._jqm].c=a.extend({},c[this._jqm].c,d);b++;this._jqm=b;c[b]={c:a.extend(e,a.jqm.params,d),a:f,w:a(this).addClass("jqmID"+b),s:b};if(e.trigger)a(this).jqmAddTrigger(e.trigger)})};a.fn.jqmAddClose=function(a){return l(this,a,"jqmHide")};a.fn.jqmAddTrigger=function(a){return l(this,a,"jqmShow")};a.fn.jqmShow=function(b){return this.each(function(){b=b||window.event;a.jqm.open(this._jqm,b)})};a.fn.jqmHide=function(b){return this.each(function(){b=b||window.event;a.jqm.close(this._jqm,b)})};a.jqm={hash:{},open:function(b,g){var i=c[b],k=i.c,l="."+k.closeClass,m=parseInt(i.w.css("z-index")),m=m>0?m:3e3,n=a("<div></div>").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":m-1,opacity:k.overlay/100});if(i.a)return f;i.t=g;i.a=true;i.w.css("z-index",m);if(k.modal){if(!d[0])j("bind");d.push(b)}else if(k.overlay>0)i.w.jqmAddClose(n);else n=f;i.o=n?n.addClass(k.overlayClass).prependTo("body"):f;if(e){a("html,body").css({height:"100%",width:"100%"});if(n){n=n.css({position:"absolute"})[0];for(var o in{Top:1,Left:1})n.style.setExpression(o.toLowerCase(),"(_=(document.documentElement.scroll"+o+" || document.body.scroll"+o+"))+'px'")}}if(k.ajax){var p=k.target||i.w,q=k.ajax,p=typeof p=="string"?a(p,i.w):a(p),q=q.substr(0,1)=="@"?a(g).attr(q.substring(1)):q;p.html(k.ajaxText).load(q,function(){if(k.onLoad)k.onLoad.call(this,i);if(l)i.w.jqmAddClose(a(l,i.w));h(i)})}else if(l)i.w.jqmAddClose(a(l,i.w));if(k.toTop&&i.o)i.w.before('<span id="jqmP'+i.w[0]._jqm+'"></span>').insertAfter(i.o);k.onShow?k.onShow(i):i.w.show();h(i);return f},close:function(b){var e=c[b];if(!e.a)return f;e.a=f;if(d[0]){d.pop();if(!d[0])j("unbind")}if(e.c.toTop&&e.o)a("#jqmP"+e.w[0]._jqm).after(e.w).remove();if(e.c.onHide)e.c.onHide(e);else{e.w.hide();if(e.o)e.o.remove()}return f},params:{}};var b=0,c=a.jqm.hash,d=[],e=a.browser.msie&&a.browser.version=="6.0",f=false,g=a('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),h=function(b){if(e)if(b.o)b.o.html('<p style="width:100%;height:100%"/>').prepend(g);else if(!a("iframe.jqm",b.w)[0])b.w.prepend(g);i(b)},i=function(b){try{a(":input:visible",b.w)[0].focus()}catch(c){}},j=function(b){a()[b]("keypress",k)[b]("keydown",k)[b]("mousedown",k)},k=function(b){var e=c[d[d.length-1]],f=!a(b.target).parents(".jqmID"+e.s)[0];if(f)i(e);return!f},l=function(b,d,e){return b.each(function(){var b=this._jqm;a(d).each(function(){if(!this[e]){this[e]=[];a(this).click(function(){for(var a in{jqmShow:1,jqmHide:1})for(var b in this[a])if(c[this[a][b]])c[this[a][b]].w[a](this);return f})}this[e].push(b)})})}})(jQuery)

/* --- BoxOver ---
/* --- v 2.1 17th June 2006
By Oliver Bryant with help of Matthew Tagg
http://boxover.swazz.org */
function P7_writeStyles(a,b){if(a==0||document.getElementById){var c="<sty"+'le type="text/css">';c+=b+"<"+"/sty"+"le>";document.write(c);document.close()}}function MM_showHideLayers(){var a,b,c,d,e=MM_showHideLayers.arguments;for(a=0;a<e.length-2;a+=3)if((d=MM_findObj(e[a]))!=null){c=e[a+2];if(d.style){d=d.style;c=c=="show"?"visible":c=="hide"?"hidden":c}d.visibility=c}}function MM_findObj(a,b){var c,d,e;if(!b)b=document;if((c=a.indexOf("?"))>0&&parent.frames.length){b=parent.frames[a.substring(c+1)].document;a=a.substring(0,c)}if(!(e=b[a])&&b.all)e=b.all[a];for(d=0;!e&&d<b.forms.length;d++)e=b.forms[d][a];for(d=0;!e&&b.layers&&d<b.layers.length;d++)e=MM_findObj(a,b.layers[d].document);if(!e&&b.getElementById)e=b.getElementById(a);return e}function hideSelects(){var a=document.getElementsByTagName("select");for(i=0;i<a.length;i++){a[i].style.visibility="hidden"}}function showSelects(){var a=document.getElementsByTagName("select");for(i=0;i<a.length;i++){a[i].style.visibility="visible"}}function checkMove(a){a?evt=a:evt=event;cSrc=evt.target?evt.target:evt.srcElement;if(!boxMove&&!isChild(cSrc,oDv)){fadeOut();if(CBE&&CBE.IEbugfix){showSelects()}boxMove=true;CBE=null}}function isChild(a,b){while(a){if(a==b)return true;a=a.parentNode}return false}function fadeOut(){oDv.style.visibility="hidden"}function fadeIn2(a){COL=COL+a;COL=COL>1?1:COL;oDv.style.filter="alpha(opacity="+parseInt(100*COL)+")";oDv.style.opacity=COL;if(COL<1)setTimeout("fadeIn2("+a+")",20)}function fadeIn(a){ID=null;COL=0;oDv.style.visibility="visible";fadeIn2(a)}function hideBox(a){oDv.style.visibility="hidden"}function showHideBox(a){oDv.style.visibility=oDv.style.visibility!="visible"?"visible":"hidden"}function pauseBox(a){a?evt=a:evt=event;boxMove=false;evt.cancelBubble=true}function doCheck(){if(mouseX<boxLeft||mouseX>boxRight||mouseY<boxTop||mouseY>boxBottom){if(!CBE.requireclick)fadeOut();if(CBE.IEbugfix){showSelects()}CBE=null}}function moveMouse(a){a?evt=a:evt=event;CSE=evt.target?evt.target:evt.srcElement;if(!CSE.hasbox){iElem=CSE;while(iElem.parentNode&&!iElem.hasbox){scanBO(iElem);iElem=iElem.parentNode}}if(CSE!=LSE&&!isChild(CSE,dvHdr)&&!isChild(CSE,dvBdy)){if(!CSE.boxItem){iterElem=CSE;while(iterElem.hasbox==2&&iterElem.parentNode)iterElem=iterElem.parentNode;CSE.boxItem=iterElem}iterElem=CSE.boxItem;if(CSE.boxItem&&CSE.boxItem.hasbox==1){LBE=CBE;CBE=iterElem;if(CBE!=LBE){applyStyles();if(!CBE.requireclick)if(CBE.fade){if(ID!=null)clearTimeout(ID);ID=setTimeout("fadeIn("+CBE.fadespeed+")",CBE.delay)}else{if(ID!=null)clearTimeout(ID);COL=1;ID=setTimeout("oDv.style.visibility='visible';ID=null;",CBE.delay)}if(CBE.IEbugfix){hideSelects()}fixposx=!isNaN(CBE.fixX)?Left(CBE)+CBE.fixX:CBE.absX;fixposy=!isNaN(CBE.fixY)?Top(CBE)+CBE.fixY:CBE.absY;lockX=0;lockY=0;boxMove=true;ox=CBE.offX?CBE.offX:10;oy=CBE.offY?CBE.offY:10}}else if(!isChild(CSE,dvHdr)&&!isChild(CSE,dvBdy)&&boxMove){if(!isChild(CBE,CSE)||CSE.tagName!="TABLE"){CBE=null;if(ID!=null)clearTimeout(ID);fadeOut();showSelects()}}LSE=CSE}else if((isChild(CSE,dvHdr)||isChild(CSE,dvBdy))&&boxMove){totalScrollLeft=0;totalScrollTop=0;iterElem=CSE;while(iterElem){if(!isNaN(parseInt(iterElem.scrollTop)))totalScrollTop+=parseInt(iterElem.scrollTop);if(!isNaN(parseInt(iterElem.scrollLeft)))totalScrollLeft+=parseInt(iterElem.scrollLeft);iterElem=iterElem.parentNode}if(CBE!=null){boxLeft=Left(CBE)-totalScrollLeft;boxRight=parseInt(Left(CBE)+CBE.offsetWidth)-totalScrollLeft;boxTop=Top(CBE)-totalScrollTop;boxBottom=parseInt(Top(CBE)+CBE.offsetHeight)-totalScrollTop;doCheck()}}if(boxMove&&CBE){bodyScrollTop=document.documentElement&&document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;bodyScrollLet=document.documentElement&&document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft;mouseX=evt.pageX?evt.pageX-bodyScrollLet:evt.clientX-document.body.clientLeft;mouseY=evt.pageY?evt.pageY-bodyScrollTop:evt.clientY-document.body.clientTop;if(CBE&&CBE.windowLock){mouseY<-oy?lockY=-mouseY-oy:lockY=0;mouseX<-ox?lockX=-mouseX-ox:lockX=0;mouseY>SHW()[1]-oDv.offsetHeight-oy?lockY=-mouseY+SHW()[1]-oDv.offsetHeight-oy:lockY=lockY;mouseX>SHW()[0]-dvBdy.offsetWidth-ox?lockX=-mouseX-ox+SHW()[0]-dvBdy.offsetWidth:lockX=lockX}oDv.style.left=fixposx||fixposx==0?fixposx:bodyScrollLet+mouseX+ox+lockX+"px";oDv.style.top=fixposy||fixposy==0?fixposy:bodyScrollTop+mouseY+oy+lockY+"px"}}function SHW(){if(document.body&&document.body.clientWidth!=0){width=document.body.clientWidth;height=document.body.clientHeight}if(document.documentElement&&document.documentElement.clientWidth!=0&&document.body.clientWidth+20>=document.documentElement.clientWidth){width=document.documentElement.clientWidth;height=document.documentElement.clientHeight}return[width,height]}function applyStyles(){if(ab)oDv.removeChild(dvBdy);if(ah)oDv.removeChild(dvHdr);dvHdr=document.createElement("div");dvBdy=document.createElement("div");CBE.boCSSBDY?dvBdy.className=CBE.boCSSBDY:defBdyStyle();CBE.boCSSHDR?dvHdr.className=CBE.boCSSHDR:defHdrStyle();dvHdr.innerHTML=CBE.boHDR;dvBdy.innerHTML=CBE.boBDY;ah=false;ab=false;if(CBE.boHDR!=""){oDv.appendChild(dvHdr);ah=true}if(CBE.boBDY!=""){oDv.appendChild(dvBdy);ab=true}}function Top(a){var b=0;if(a.calcTop)return a.calcTop;var c=a;while(a){if(a.currentStyle&&!isNaN(parseInt(a.currentStyle.borderTopWidth))&&b!=0)b+=parseInt(a.currentStyle.borderTopWidth);b+=a.offsetTop;a=a.offsetParent}c.calcTop=b;return b}function Left(a){var b=0;if(a.calcLeft)return a.calcLeft;var c=a;while(a){if(a.currentStyle&&!isNaN(parseInt(a.currentStyle.borderLeftWidth))&&b!=0)b+=parseInt(a.currentStyle.borderLeftWidth);b+=a.offsetLeft;a=a.offsetParent}c.calcLeft=b;return b}function getParam(a,b){var c=new RegExp("([^a-zA-Z]"+a+"|^"+a+")\\s*=\\s*\\[\\s*(((\\[\\[)|(\\]\\])|([^\\]\\[]))*)\\s*\\]");var d=c.exec(b);var e;if(d)return d[2].replace("[[","[").replace("]]","]");else return""}function scanBO(a){if(checkElemBO(a.title)){a.boHDR=getParam("header",a.title);a.boBDY=getParam("body",a.title);a.boCSSBDY=getParam("cssbody",a.title);a.boCSSHDR=getParam("cssheader",a.title);a.IEbugfix=getParam("hideselects",a.title)=="on"?true:false;a.fixX=parseInt(getParam("fixedrelx",a.title));a.fixY=parseInt(getParam("fixedrely",a.title));a.absX=parseInt(getParam("fixedabsx",a.title));a.absY=parseInt(getParam("fixedabsy",a.title));a.offY=getParam("offsety",a.title)!=""?parseInt(getParam("offsety",a.title)):10;a.offX=getParam("offsetx",a.title)!=""?parseInt(getParam("offsetx",a.title)):10;a.fade=getParam("fade",a.title)=="on"?true:false;a.fadespeed=getParam("fadespeed",a.title)!=""?getParam("fadespeed",a.title):.04;a.delay=getParam("delay",a.title)!=""?parseInt(getParam("delay",a.title)):0;if(getParam("requireclick",a.title)=="on"){a.requireclick=true;document.all?a.attachEvent("onclick",showHideBox):a.addEventListener("click",showHideBox,false);document.all?a.attachEvent("onmouseover",hideBox):a.addEventListener("mouseover",hideBox,false)}else{if(getParam("doubleclickstop",a.title)!="off"){document.all?a.attachEvent("ondblclick",pauseBox):a.addEventListener("dblclick",pauseBox,false)}if(getParam("singleclickstop",a.title)=="on"){document.all?a.attachEvent("onclick",pauseBox):a.addEventListener("click",pauseBox,false)}}a.windowLock=getParam("windowlock",a.title).toLowerCase()=="off"?false:true;a.title="";a.hasbox=1}else a.hasbox=2}function checkElemBO(a){if(!a||typeof a!="string")return false;if(a.indexOf("header")>-1&&a.indexOf("body")>-1&&a.indexOf("[")>-1&&a.indexOf("[")>-1)return true;else return false}function defBdyStyle(){dvBdy.style.borderBottom="1px solid #A5CFE9";dvBdy.style.borderLeft="1px solid #A5CFE9";dvBdy.style.borderRight="1px solid #A5CFE9";dvBdy.style.width="150px";dvBdy.style.fontFamily="arial";dvBdy.style.fontSize="11";dvBdy.style.padding="3";dvBdy.style.color="#1B4966";dvBdy.style.background="#FFFFFF";dvBdy.style.filter="alpha(opacity=85)";dvBdy.style.opacity="0.85"}function defHdrStyle(){dvHdr.innerHTML='<img  style="vertical-align:middle"  src="info.gif">��'+dvHdr.innerHTML;dvHdr.style.fontWeight="bold";dvHdr.style.width="150px";dvHdr.style.fontFamily="arial";dvHdr.style.border="1px solid #A5CFE9";dvHdr.style.padding="3";dvHdr.style.fontSize="11";dvHdr.style.color="#4B7A98";dvHdr.style.background="#D5EBF9";dvHdr.style.filter="alpha(opacity=85)";dvHdr.style.opacity="0.85"}function init(){oDv.appendChild(dvHdr);oDv.appendChild(dvBdy);oDv.style.position="absolute";oDv.style.visibility="hidden";document.body.appendChild(oDv)}if(typeof document.attachEvent!="undefined"){window.attachEvent("onload",init);document.attachEvent("onmousemove",moveMouse);document.attachEvent("onclick",checkMove)}else{window.addEventListener("load",init,false);document.addEventListener("mousemove",moveMouse,false);document.addEventListener("click",checkMove,false)}var oDv=document.createElement("div");var dvHdr=document.createElement("div");var dvBdy=document.createElement("div");var windowlock,boxMove,fixposx,fixposy,lockX,lockY,fixx,fixy,ox,oy,boxLeft,boxRight,boxTop,boxBottom,evt,mouseX,mouseY,boxOpen,totalScrollTop,totalScrollLeft;boxOpen=false;ox=10;oy=10;lockX=0;lockY=0;var ah,ab;var CSE,iterElem,LSE,CBE,LBE,totalScrollLeft,totalScrollTop,width,height;var ini=false;var ID=null;var COL=0;var stopfade=false;var cSrc;P7_writeStyles(0,"/*----------------------------------------------------- =popup layers (about) ------ */ #aboutlayer { text-align: left; padding:6px; background-color:#cc9; color: #333; position:absolute; /* not relative */ left:470px; top:0px; width:305px; height:160px; z-index:1; overflow:hidden; visibility: hidden;}.hidestuff {display: block;}#aboutlayer h6 {font-size: small; font-weight: bold; margin: 0px; padding: 0px 0px 5px 0px; line-height: 1.3em; }#aboutlayer p {font-size: x-small; margin: 0px; padding: 0px 0px 5px 0px; line-height: 1.3em; }")

/*
 * Superfish v1.4.1 - jQuery menu widget
 * Copyright (c) 2008 Joel Birch
 *
 * Dual licensed under the MIT and GPL licenses:
 * 	http://www.opensource.org/licenses/mit-license.php
 * 	http://www.gnu.org/licenses/gpl.html
 *
 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
 */
 
(function(a){a.superfish={};a.superfish.o=[];a.superfish.op={};a.superfish.defaults={hoverClass:"sfHover",pathClass:"overideThisToUse",delay:800,animation:{opacity:"show"},speed:"normal",oldJquery:false,disableHI:false,onInit:function(){},onBeforeShow:function(){},onShow:function(){},onHide:function(){}};a.fn.superfish=function(b){var c="sfbreadcrumb",d=function(){var b=a(this),c=f(b);g(c,true);clearTimeout(c.sfTimer);b.showSuperfishUl().siblings().hideSuperfishUl()},e=function(){var b=a(this),e=f(b);var h=g(e,true);clearTimeout(e.sfTimer);if(!b.is("."+c)){e.sfTimer=setTimeout(function(){b.hideSuperfishUl();if(h.$path.length){d.call(h.$path)}},h.delay)}},f=function(a){return a.parents("ul.superfish:first")[0]},g=function(b,c){b=c?b:f(b);return a.superfish.op=a.superfish.o[b.serial]},h=function(){return a.superfish.op.oldJquery?"li[ul]":"li:has(ul)"};return this.each(function(){var f=this.serial=a.superfish.o.length;var g=a.extend({},a.superfish.defaults,b);g.$path=a("li."+g.pathClass,this).each(function(){a(this).addClass(g.hoverClass+" "+c).filter(h()).removeClass(g.pathClass)});a.superfish.o[f]=a.superfish.op=g;a(h(),this)[a.fn.hoverIntent&&!g.disableHI?"hoverIntent":"hover"](d,e).not("."+c).hideSuperfishUl();var i=a("a",this);i.each(function(a){var b=i.eq(a).parents("li");i.eq(a).focus(function(){d.call(b)}).blur(function(){e.call(b)})});g.onInit.call(this)}).addClass("superfish")};a.fn.extend({hideSuperfishUl:function(){var b=a.superfish.op,c=a("li."+b.hoverClass,this).add(this).removeClass(b.hoverClass).find(">ul").hide().css("visibility","hidden");b.onHide.call(c);return this},showSuperfishUl:function(){var b=a.superfish.op,c=this.addClass(b.hoverClass).find(">ul:hidden").css("visibility","visible");b.onBeforeShow.call(c);c.animate(b.animation,b.speed,function(){b.onShow.call(this)});return this}});a(window).unload(function(){a("ul.superfish").each(function(){a("li",this).unbind("mouseover","mouseout","mouseenter","mouseleave")})})})(jQuery)

//bgiframe

(function(a){a.fn.bgIframe=a.fn.bgiframe=function(b){if(a.browser.msie&&/6.0/.test(navigator.userAgent)){b=a.extend({top:"auto",left:"auto",width:"auto",height:"auto",opacity:true,src:"javascript:false;"},b||{});var c=function(a){return a&&a.constructor==Number?a+"px":a},d='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+b.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(b.opacity!==false?"filter:Alpha(Opacity='0');":"")+"top:"+(b.top=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+'px')":c(b.top))+";"+"left:"+(b.left=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+'px')":c(b.left))+";"+"width:"+(b.width=="auto"?"expression(this.parentNode.offsetWidth+'px')":c(b.width))+";"+"height:"+(b.height=="auto"?"expression(this.parentNode.offsetHeight+'px')":c(b.height))+";"+'"/>';return this.each(function(){if(a("> iframe.bgiframe",this).length==0)this.insertBefore(document.createElement(d),this.firstChild)})}return this}})(jQuery)


$(document).ready(function(){
			$("ul.jnav2")
			.superfish({
				animation : { opacity:"show",height:"show"}
			})
			.find(">li:has(ul)")
				.mouseover(function(){
					$("ul", this).bgIframe({opacity:false});
				})
				.find("a")
					.focus(function(){
						$("ul", $(".jnav2>li:has(ul)")).bgIframe({opacity:false});
					});
});

