/*=============================================================================

			 	 TITLE:		NetMediaOne - Core Library
		  MODIFIED:		2008.04.09
		 AUTHOR(S): 	Graham Wheeler - NetMediaOne - www.netmediaone.com
		  REQUIRES:		jQuery 1.3.2

=============================================================================*/

/**
 *  corner() takes a single string argument:  $('#myDiv').corner("effect corners width")
 *
 *  effect:  name of the effect to apply, such as round, bevel, notch, bite, etc (default is round). 
 *  corners: one or more of: top, bottom, tr, tl, br, or bl. 
 *           by default, all four corners are adorned. 
 *  width:   width of the effect; in the case of rounded corners this is the radius. 
 *           specify this value using the px suffix such as 10px (and yes, it must be pixels).
 *
 * @author Dave Methvin (http://methvin.com/jquery/jq-corner.html)
 * @author Mike Alsup   (http://jquery.malsup.com/corner/)
 */
(function(e){var d=e.browser.mozilla&&/gecko/i.test(navigator.userAgent);var c=e.browser.safari&&e.browser.version>=3;var g=e.browser.msie&&(function(){var j=document.createElement("div");try{j.style.setExpression("width","0+0")}catch(i){return false}return true})();function f(i,j){return parseInt(e.css(i,j))||0}function b(i){var i=parseInt(i).toString(16);return(i.length<2)?"0"+i:i}function h(k){for(;k&&k.nodeName.toLowerCase()!="html";k=k.parentNode){var i=e.css(k,"backgroundColor");if(i=="rgba(0, 0, 0, 0)"){continue}if(i.indexOf("rgb")>=0){var j=i.match(/\d+/g);return"#"+b(j[0])+b(j[1])+b(j[2])}if(i&&i!="transparent"){return i}}return"#ffffff"}function a(l,j,k){switch(l){case"round":return Math.round(k*(1-Math.cos(Math.asin(j/k))));case"cool":return Math.round(k*(1+Math.cos(Math.asin(j/k))));case"sharp":return Math.round(k*(1-Math.cos(Math.acos(j/k))));case"bite":return Math.round(k*(Math.cos(Math.asin((k-j-1)/k))));case"slide":return Math.round(k*(Math.atan2(j,k/j)));case"jut":return Math.round(k*(Math.atan2(k,(k-j-1))));case"curl":return Math.round(k*(Math.atan(j)));case"tear":return Math.round(k*(Math.cos(j)));case"wicked":return Math.round(k*(Math.tan(j)));case"long":return Math.round(k*(Math.sqrt(j)));case"sculpt":return Math.round(k*(Math.log((k-j-1),k)));case"dog":return(j&1)?(j+1):k;case"dog2":return(j&2)?(j+1):k;case"dog3":return(j&3)?(j+1):k;case"fray":return(j%2)*k;case"notch":return k;case"bevel":return j+1}}e.fn.corner=function(i){if(this.length==0){if(!e.isReady&&this.selector){var j=this.selector,k=this.context;e(function(){e(j,k).corner(i)})}return this}return this.each(function(q){var p=e(this);var x=(i||p.attr(e.fn.corner.defaults.metaAttr)||"").toLowerCase();var E=/keep/.test(x);var v=((x.match(/cc:(#[0-9a-f]+)/)||[])[1]);var l=((x.match(/sc:(#[0-9a-f]+)/)||[])[1]);var A=parseInt((x.match(/(\d+)px/)||[])[1])||10;var y=/round|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dog/;var n=((x.match(y)||["round"])[0]);var m={T:0,B:1};var t={TL:/top|tl|left/.test(x),TR:/top|tr|right/.test(x),BL:/bottom|bl|left/.test(x),BR:/bottom|br|right/.test(x)};if(!t.TL&&!t.TR&&!t.BL&&!t.BR){t={TL:1,TR:1,BL:1,BR:1}}if(e.fn.corner.defaults.useNative&&n=="round"&&(d||c)&&!v&&!l){if(t.TL){p.css(d?"-moz-border-radius-topleft":"-webkit-border-top-left-radius",A+"px")}if(t.TR){p.css(d?"-moz-border-radius-topright":"-webkit-border-top-right-radius",A+"px")}if(t.BL){p.css(d?"-moz-border-radius-bottomleft":"-webkit-border-bottom-left-radius",A+"px")}if(t.BR){p.css(d?"-moz-border-radius-bottomright":"-webkit-border-bottom-right-radius",A+"px")}return}var B=document.createElement("div");B.style.overflow="hidden";B.style.height="1px";B.style.backgroundColor=l||"transparent";B.style.borderStyle="solid";var H={T:parseInt(e.css(this,"paddingTop"))||0,R:parseInt(e.css(this,"paddingRight"))||0,B:parseInt(e.css(this,"paddingBottom"))||0,L:parseInt(e.css(this,"paddingLeft"))||0};if(typeof this.style.zoom!=undefined){this.style.zoom=1}if(!E){this.style.border="none"}B.style.borderColor=v||h(this.parentNode);var z=e.curCSS(this,"height");for(var C in m){var s=m[C];if((s&&(t.BL||t.BR))||(!s&&(t.TL||t.TR))){B.style.borderStyle="none "+(t[C+"R"]?"solid":"none")+" none "+(t[C+"L"]?"solid":"none");var I=document.createElement("div");e(I).addClass("jquery-corner");var u=I.style;s?this.appendChild(I):this.insertBefore(I,this.firstChild);if(s&&z!="auto"){if(e.css(this,"position")=="static"){this.style.position="relative"}u.position="absolute";u.bottom=u.left=u.padding=u.margin="0";if(g){u.setExpression("width","this.parentNode.offsetWidth")}else{u.width="100%"}}else{if(!s&&e.browser.msie){if(e.css(this,"position")=="static"){this.style.position="relative"}u.position="absolute";u.top=u.left=u.right=u.padding=u.margin="0";if(g){var F=f(this,"borderLeftWidth")+f(this,"borderRightWidth");u.setExpression("width","this.parentNode.offsetWidth - "+F+'+ "px"')}else{u.width="100%"}}else{u.position="relative";u.margin=!s?"-"+H.T+"px -"+H.R+"px "+(H.T-A)+"px -"+H.L+"px":(H.B-A)+"px -"+H.R+"px -"+H.B+"px -"+H.L+"px"}}for(var D=0;D<A;D++){var r=Math.max(0,a(n,D,A));var G=B.cloneNode(false);G.style.borderWidth="0 "+(t[C+"R"]?r:0)+"px 0 "+(t[C+"L"]?r:0)+"px";s?I.appendChild(G):I.insertBefore(G,I.firstChild)}}}})};e.fn.uncorner=function(){if(d||c){this.css(d?"-moz-border-radius":"-webkit-border-radius",0)}e("div.jquery-corner",this).remove();return this};e.fn.corner.defaults={useNative:true,metaAttr:"data-corner"}})(jQuery);


var NMO = {
	
	version: "2.0",
	rootPath: "/",
	resizeTimer: null,
	mouse: { x: 0, y: 0 },

	init: function() {

		$("html").addClass("HasJS");

		$(document).mousemove( function(e) {
			NMO.mouse.x = e.pageX || e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
			NMO.mouse.y = e.pageY || e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
		} );
		
		$("h3.TableTitle span").corner("round top 3px");
		
		NMO.PageEnhancements.apply( [ "FirstLast", "EqualizeHeight", "ZebraStripes" ], document.body );

	}
	
};


$( function() { NMO.init(); } );

NMO.PageEnhancements = { 
	
	ruleSets: {}, 
	apply: function( rules, scope ) {		
		
		for ( var i = 0; i < rules.length; i++ ) {
			this.ruleSets[rules[i]](scope);
		}
		
	}		
									 
};

NMO.PageEnhancements.ruleSets.EqualizeHeight = function(scope) {
	
	$(".EqualHeightColumns").each( function() {
		var currentTallest = 0;
		$(this).children().each(function(i){
			if ($(this).height() > currentTallest) { currentTallest = $(this).height(); }
		});
		currentTallest += "px";
		// for ie6, set height since min-height isn't supported
		if ($.browser.msie && $.browser.version == 6.0) { $(this).children().css({'height': currentTallest}); }
		$(this).children().css({'min-height': currentTallest}); 
	});
	
};

NMO.PageEnhancements.ruleSets.FirstLast = function(scope) {
	$("*:first-child", scope ).addClass("FirstChild");
	$("*.CaptionedPhotoRight:first-child ~ *:header, *.Right:first-child ~ *:header", scope ).addClass("OffsetFirstChild");
	$("*:last-child", scope ).addClass("LastChild");
};

NMO.PageEnhancements.ruleSets.ZebraStripes = function(scope) {
	$( "table.Striped", scope ).each( function() {
		// Yeah, it's backwards. For whatever reason jQuery resolves the :odd selector to 
		// even-numbered items and vice-versa.
		$(this).find(" tbody > tr:visible:odd" ).addClass("Even").removeClass("Odd");
		$(this).find(" tbody > tr:visible:even" ).addClass("Odd").removeClass("Even");
	});
	$( "ul.Striped > li:visible:even", scope ).addClass("Even").removeClass("Odd");
	$( "ul.Striped > li:visible:odd", scope ).addClass("Odd").removeClass("Even");
};
