/*-----------------------------------------------Northpoint Church- - - - - - - - - - - - - - - - - - - - - - - -Description:	Generic scrips and functionsFilename:		northpoint.jsLib.jsDate:			5 March 2007Updated:		5 March 2007----------------------------------------------- *//*	-------------------------------------------------------------	function getBrowserWidth()	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	Description:	As odd as it may seem, this function returns					the browser's width in pixels.	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	Credits:		Script found on Particle Tree					http://www.particletree.com	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	*/			<!--		function getBrowserWidth(){			if (window.innerWidth){				return window.innerWidth;}				else if (document.documentElement && document.documentElement.clientWidth != 0){				return document.documentElement.clientWidth;	}			else if (document.body){return document.body.clientWidth;}						return 0;		}		//-->/*	-------------------------------------------------------------	function determineStyle()	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	Description:	With this here function we can swap styles.	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	Credits:		Script found on A List Apart					http://www.alistapart.com	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	*/			<!--		function determineStyle(){						var browserWidth = getBrowserWidth();							var i, a, main;						if (browserWidth <= 965){				for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {					if(a.getAttribute("rel").indexOf("style") != -1					&& a.getAttribute("title")) {						a.disabled = true;						if(a.getAttribute("title") == "narrow") a.disabled = false;					}				}			}						if (browserWidth > 965){				for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {					if(a.getAttribute("rel").indexOf("style") != -1					&& a.getAttribute("title")) {						a.disabled = true;						if(a.getAttribute("title") == "wide") a.disabled = false;					}				}			}		}		//-->/*	-------------------------------------------------------------	function setLinkAttributes()	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	Description:	setLinkAttributes finds ALL anchor links and					can set new attributes. The following script					specifically finds anchor links labeled as					external, and add a terget="_blank". We do					in order to validate in XHTML 1.1 Strict.	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	Credits:		Script found on Site Point (I think)					http://www.sitepoint.com	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	*/			<!--		function setLinkAttributes(switchLinks) {			if (switchLinks == "true") {				if (!document.getElementsByTagName) return;				var anchors = document.getElementsByTagName("a");					for (var i=0; i<anchors.length; i++) {					var anchor = anchors[i];										//if (anchor.getAttribute("href") && ( anchor.getAttribute("rel") == "external" || anchor.getAttribute("rel") == "nofollow" ) ) {					//	anchor.target = "_blank";					//}										if (anchor.getAttribute("href") && ( anchor.getAttribute("rel") == "external" ) ) {						anchor.target = "_blank";					}				}			} else {				if (!document.getElementsByTagName) return;				var anchors = document.getElementsByTagName("a");					for (var i=0; i<anchors.length; i++) {					var anchor = anchors[i];										if (anchor.getAttribute("href") && ( anchor.getAttribute("rel") == "external" || anchor.getAttribute("rel") == "nofollow" ) ) {						anchor.target = "_self";					}				}			}		}				function toggleLinkAttributes() {			var ExpireLongTerm = new Date();			var ExpireLongTermValue = new Date(ExpireLongTerm.getTime()+(1000 * 60 * 60 * 360000));						if ( getCookie("externalLinks") == "true" ) {				setLinkAttributes("false");				setCookie("externalLinks","false",ExpireLongTermValue);			} else if (getCookie("externalLinks") == "false") {				setLinkAttributes("true");				setCookie("externalLinks","true",ExpireLongTermValue);			} else if ( !getCookie("externalLinks") ) {				setLinkAttributes("true");				setCookie("externalLinks","true",ExpireLongTermValue);			}		}		//-->		/*	-------------------------------------------------------------	function toTop()	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	Description:	This little functions performs a smooth					scroll from the bottom to the top of the					page.	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	*/				<!--		var g_USER_AGENT = getAgent();				// return NN4, NN5(Netscape 6+, Mozilla 1+?), IE4, IE5(IE5+), Unknown		function getAgent(){		  var userAgent = navigator.userAgent;		  var charIndex;		  var majorVersion;				  charIndex = userAgent.indexOf("MSIE");		  if(charIndex){			majorVersion = userAgent.charAt(charIndex + 4 + 1);			if(majorVersion > 4){			  return("IE5");			}			else if(majorVersion == 4){			  return("IE4");			}		  }				  charIndex = userAgent.indexOf("Mozilla");		  majorVersion = userAgent.charAt(charIndex + 7 + 1);		  if(majorVersion > 4){			return("NN5");		  }		  else if(majorVersion == 4){			return("NN4");		  }				  return("Unknown");		}		/* USER_AGENT check end -------------------------------------------------- */				function getWindowYOffset(){		  if(g_USER_AGENT == "IE5" || g_USER_AGENT == "IE4"){			return document.body.scrollTop;		  }else if(g_USER_AGENT == "NN5" || g_USER_AGENT == "NN4"){			return window.pageYOffset;		  }else{			return 0;		  }		}				var waitTimer;		function jumpTo(dstY, srcY, scrollRate, waitMillSec) {		  if(waitTimer){			clearTimeout(waitTimer);		  }		  if( ! dstY || dstY < 0 ){			dstY = 0;		  }		  if( ! srcY ){			srcY = 0 + getWindowYOffset();		  }		  if( ! scrollRate ){			scrollRate = 5;		  }		  if( ! waitMillSec ){			waitMillSec = 20;		  }				  srcY += (dstY - getWindowYOffset()) / scrollRate;		  if(srcY < 0){			srcY = 0;		  }		  posY = Math.floor(srcY);		  window.scrollTo(0, posY);				  if(posY != dstY){			waitTimer = setTimeout("jumpTo("+ dstY +", "+ srcY +", "+ scrollRate +", "+ waitMillSec +")", waitMillSec);		  }		  else if(posY == dstY){			clearTimeout(waitTimer);		  }		  else if(posY < 1){			window.scroll(0, 0);		  }		}				function toTop(){		  jumpTo(0, 0, 7, 14);		}		//-->	<!-- 		function doOnResize () {			determineStyle();			setTall();		}				function doOnLoad () {			determineStyle();			//if ( getCookie("externalLinks") ) {			//	setLinkAttributes( getCookie("externalLinks") );			//}			setTall();			setLinkAttributes("true");		}				//-->		function toggleDisplay(elem){		el = document.getElementById(elem);		if (el.style.display == 'block'){			el.style.display = 'none';		} else {			el.style.display = 'block';		}	}/*	-------------------------------------------------------------	function tabcontentIDs()	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	Description:	This script is handles the tabbed divs	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	Credits:		Script found on Dynamic Drive DHTML					http://www.dynamicdrive.com					Last updated: Nov 8th, 06	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	*/	var enabletabpersistence=1 //enable tab persistence via session only cookies, so selected tab is remembered?		////NO NEED TO EDIT BELOW////////////////////////	var tabcontentIDs=new Object()		function expandcontent(linkobj){	var ulid=linkobj.parentNode.parentNode.id //id of UL element	var ullist=document.getElementById(ulid).getElementsByTagName("li") //get list of LIs corresponding to the tab contents	for (var i=0; i<ullist.length; i++){	ullist[i].className=""  //deselect all tabs	if (typeof tabcontentIDs[ulid][i]!="undefined") //if tab content within this array index exists (exception: More tabs than there are tab contents)	document.getElementById(tabcontentIDs[ulid][i]).style.display="none" //hide all tab contents	}	linkobj.parentNode.className="selected"  //highlight currently clicked on tab	var divToShow = document.getElementById(linkobj.getAttribute("rel"));	divToShow.style.display = "block" //expand corresponding tab content	///	alert( divToShow.getElementsByTagName( "div" )[0].style.display );//.display="block";		saveselectedtabcontentid(ulid, linkobj.getAttribute("rel"))	}		function expandtab(tabcontentid, tabnumber){ //interface for selecting a tab (plus expand corresponding content)	var thetab=document.getElementById(tabcontentid).getElementsByTagName("a")[tabnumber]	if (thetab.getAttribute("rel"))	expandcontent(thetab)	}		function savetabcontentids(ulid, relattribute){// save ids of tab content divs	if (typeof tabcontentIDs[ulid]=="undefined") //if this array doesn't exist yet	tabcontentIDs[ulid]=new Array()	tabcontentIDs[ulid][tabcontentIDs[ulid].length]=relattribute	}		function saveselectedtabcontentid(ulid, selectedtabid){ //set id of clicked on tab as selected tab id & enter into cookie	if (enabletabpersistence==1) //if persistence feature turned on	setCookie(ulid, selectedtabid)	}		function getullistlinkbyId(ulid, tabcontentid){ //returns a tab link based on the ID of the associated tab content	var ullist=document.getElementById(ulid).getElementsByTagName("li")	for (var i=0; i<ullist.length; i++){	if (ullist[i].getElementsByTagName("a")[0].getAttribute("rel")==tabcontentid){	return ullist[i].getElementsByTagName("a")[0]	break	}	}	}		function initializetabcontent(){	for (var i=0; i<arguments.length; i++){ //loop through passed UL ids	if (enabletabpersistence==0 && getCookie(arguments[i])!="") //clean up cookie if persist=off	setCookie(arguments[i], "")	var clickedontab=getCookie(arguments[i]) //retrieve ID of last clicked on tab from cookie, if any	var ulobj=document.getElementById(arguments[i])	var ulist=ulobj.getElementsByTagName("li") //array containing the LI elements within UL	for (var x=0; x<ulist.length; x++){ //loop through each LI element	var ulistlink=ulist[x].getElementsByTagName("a")[0]	if (ulistlink.getAttribute("rel")){	savetabcontentids(arguments[i], ulistlink.getAttribute("rel")) //save id of each tab content as loop runs	ulistlink.onclick=function(){	expandcontent(this)	return false	}	if (ulist[x].className=="selected" && clickedontab=="") //if a tab is set to be selected by default	expandcontent(ulistlink) //auto load currenly selected tab content	}	} //end inner for loop	if (clickedontab!=""){ //if a tab has been previously clicked on per the cookie value	var culistlink=getullistlinkbyId(arguments[i], clickedontab)	if (typeof culistlink!="undefined") //if match found between tabcontent id and rel attribute value	expandcontent(culistlink) //auto load currenly selected tab content	else //else if no match found between tabcontent id and rel attribute value (cookie mis-association)	expandcontent(ulist[0].getElementsByTagName("a")[0]) //just auto load first tab instead	}	} //end outer for loop	}			function getCookie(Name){ 	var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair	if (document.cookie.match(re)) //if cookie found	return document.cookie.match(re)[0].split("=")[1] //return its value	return ""	}		function setCookie(name, value){	document.cookie = name+"="+value //cookie value is domain wide (path=/)	}//// SHOW A HIDDEN LAYER ////function toggleLayer(theshown,thehidden,thehidden2,signup,thestyle){	var d = document;	if (!thestyle)	{		thestyle = 'block';	}		if (theshown!='')	{		if (d.getElementById(theshown).style.display=='none' || (d.getElementById(theshown).style.display == '' && thestyle != 'table-row'))		{			if (thestyle == 'table-row')			{                d.getElementById(theshown).style.display = '';			    			}			else			{                d.getElementById(theshown).style.display = thestyle;   			}		}		else		{			if (!signup)			{				d.getElementById(theshown).style.display = 'none';			}		}	}		if (thehidden)	{		d.getElementById(thehidden).style.display = 'none';	}		return false;	if (thehidden2)	{		d.getElementById(thehidden2).style.display = 'none';	}}function toggleLayerSimple (element, style){    var e = document.getElementById(element);        if( !style )    {        style = '';    }        if( e )    {        if( e.style.display == 'none' )             e.style.display = style;        else            e.style.display = 'none';    }}