$(function(){	$("ul.sf-menu").superfish({		pathClass: 'sf-path'	});		//Remove divider from last subnav item	$("ul.sf-menu ul li:last-child").addClass("nobg");	//set first child -- necessary for IE6	$("div.widget-innernav>ul>li:first-child").addClass("first-child");		$("img.moimage").hover(function(){		this.src = this.src.replace("_off", "_on");	}, function(){		this.src = this.src.replace("_on", "_off");	})		// nav bar.  handle overlapping dividers	var ooDiv = "/images/nav/divider_orangeorange.gif";	var bbDiv = "/images/nav/divider_blueblue.gif";	var boDiv = "/images/nav/divider_blueorange.gif";	var obDiv = "/images/nav/divider_orangeblue.gif";	$("li.navwithdivider").hover(function(){		var li = $(this);		var img = li.find("img.navimage");		var thisDiv = li.find("img.divider");		var prevDiv = li.prev().find("img.divider");		var nextDiv = li.next().find("img.divider");		img.each(function(){			this.src = this.src.replace("_off", "_on")		});		thisDiv.attr("src", nextDiv.hasClass("selectedon") ? bbDiv : boDiv);		prevDiv.attr("src", prevDiv.hasClass("selectedon") ? bbDiv : obDiv);	}, function(){		var li = $(this);		var img = li.find("img.navimage");		var thisDiv = li.find("img.divider");		var prevDiv = li.prev().find("img.divider");		var nextDiv = li.next().find("img.divider");		img.each(function(){			this.src = this.src.replace("_on", "_off")		});		thisDiv.attr("src", nextDiv.hasClass("selectedon") ? obDiv : thisDiv.hasClass("selectedon") ? boDiv : ooDiv);		prevDiv.attr("src", prevDiv.hasClass("selectedon") ? boDiv : thisDiv.hasClass("selectedon") ? obDiv : ooDiv);	})	//Adjust topnav height to handle a wrapping subnav	$("li.navwithdivider ul:visible").each(function(){		$("div.topnav").css("height", $(this).height() + 40);	})		// preload images	$.preLoadImages('/images/sitewide/becomemember_on.png', '/images/sitewide/printpage_on.png', '/images/sitewide/emailpage_on.png', "/images/nav/divider_blueorange.gif", "/images/nav/divider_orangeblue.gif", "/images/nav/divider_blueblue.gif", "/images/nav/public_policy_on.gif", "/images/nav/effectiveness_on.gif", "/images/nav/accountability_on.gif", "/images/nav/connecting_on.gif", "/images/nav/our_sector_on.gif")		if (!pageedit) {		$(".tweet").html("").tweet({			username: "IndSector",			avatar_size: 20,			count: 5,			loading_text: "loading tweets..."		});		$("div.ajaxSearchResults").each(function(){	        var div = $(this);	        var url = "/templates/SearchCustom.cfc?method=SearchResultsRemote";	        if (div.attr("s")) 	            url += "&s=" + div.attr("s");	        if (div.attr("topic")) 	            url += "&t=" + div.attr("topic");	        if (div.attr("category")) 	            url += "&c=" + div.attr("category");	        if (div.attr("tag")) 	            url += "&tag=" + div.attr("tag");	        if (div.attr("principle")) 	            url += "&p=" + div.attr("principle");	        if (div.attr("mediatype")) 	            url += "&mt=" + div.attr("mediatype");	        if (div.attr("maxrows")) 	            url += "&endrow=" + div.attr("maxrows");	        else 	            url += "&endrow=10";	        $.getJSON(url, {}, function(data){	            div.html(data.RESULTS);	        })	    })	}		var dialog;	$("a.videolink").click(function(){		dialog = $('<div style="display:none"></div>').appendTo('body');		dialog.load("/templates/Default.cfc?method=VideoDialog&video=" + this.href, {}, function(){			dialog.dialog({				dialogClass: "videodialog",				resizable: false,				modal: true,				height: 480,				width: 634			});		});		return false;	})	$(".closedialog").live("click", function(){		dialog.dialog("destroy");	})		if (!pageedit) {		$("a:not(.public)").live("click", function(){			var m = this.href.match(/https?:\/\/([^\/]+)(.+)/i);			if (m) {				var host = m[1];				var path = m[2];				if (host == location.hostname && path.indexOf("logout=Y") == -1 && this.target == "") {					//internal link					$.ajax({						type: "POST",						url: "/templates/Default.cfc?method=CheckAccess",						data: {							script_name: path,							registerRedirectUrl: location.pathname + location.search						},						success: function(data){							if (data.CANVIEW) {								window.location.href = path;							}							else {								dialog = $('<div style="display:none;margin:5px 0">' + data.MESSAGE + '</div>').appendTo('body');								dialog.dialog({									title: data.TITLE,									modal: true,									height: "auto",									width: 450,									dialogClass: "accessDialog",									buttons: {										"Cancel": function(){											$(this).dialog("close");										}									}								});							}						},						error: function(){							window.location.href = path;						},						dataType: "json"					});					return false;				}			}			return true;		})	}})
