// functions.inc ; Adebola Ajiboye; ASD. August 07, 2000

NS6=(document.getElementById&&!document.all)
IE=(document.all);IE4=(document.all&&!document.getElementById)
NS=(navigator.appName=="Netscape" && navigator.appVersion.charAt(0)=="4")
OP=(navigator.userAgent.indexOf('Opera')>-1)

function PageOnLoad()
{	local_PageOnLoad();			}

function PageOnUnLoad()
{	local_PageOnUnLoad();		}

function OpenNewPicture(new_pix)
{	winNewPix = window.open('/scripts/site/show.picture?pix=' + new_pix, 'winNewPix', 'width=400,height=400,scrollbars=0,status=0,resize=1'); winNewPix.focus(); return false;		}

// functions.inc ; Adebola Ajiboye; ASD. August 07, 2000
function MM_findObj(n, d) 
{	// v4.0
	var p, i, x;  
	
	if (!d) { d=document; }
	if((p = n.indexOf("?")) > 0 && parent.frames.length) 
	{	d = parent.frames[n.substring(p+1)].document; 
		n = n.substring(0,p);
	}
	if (!(x = d[n]) && d.all) { x=d.all[n]; 	}
	for (i = 0; !x && i < d.forms.length; i++) { x = d.forms[i][n];		}
	for (i = 0; !x && d.layers && i < d.layers.length; i++) { x = MM_findObj(n,d.layers[i].document);	}
	if (!x && document.getElementById) { x=document.getElementById(n); }
	return x;
}

var ar_OpenPopupMenus = new Array();

function MM_showHideLayers() 
{	//v3.0
	var i, p, v, obj, args = MM_showHideLayers.arguments;
	
	for (i = 0; i < (args.length-2); i += 5) 
	{	if ((obj = MM_findObj(args[i])) != null) 
		{	st_object_name = args[i+0];
			e = args[i+1];
			v = args[i+2];
			dx = args[i+3];
			dy = args[i+4];
			offsetLeft = args[i+5];
			offsetTop = args[i+6];
			if (obj.style) 
			{	obj = obj.style; 
				if (v == 'show')
				{	obj.left = offsetLeft + dx;
					obj.top = offsetTop + dy; 
					for (in_popup_menu = 1; in_popup_menu <= ar_OpenPopupMenus.length; in_popup_menu++) 		// clear all timeouts and also close open menus
					{	if (ar_OpenPopupMenus[in_popup_menu-1] != "Processed")
						{	popup_to_close = ar_OpenPopupMenus[in_popup_menu-1];
							popup_to_close.visibility = 'hidden';
							ar_OpenPopupMenus[in_popup_menu-1] = "Processed";	// mark element as processed
						}
					}
					ar_OpenPopupMenus[ar_OpenPopupMenus.length] = obj;
					setTimeout("document.all." + st_object_name + ".style.visibility = 'hidden';", 20000); 
				}
				v = ((v == 'show' || v == 'nochange')? 'visible' : (v == 'hide') ? 'hidden' : v ); 
			}
			obj.visibility = v; 
		}
	}
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function resize_browser_to_limits()
{	this.resizeTo(window.screen.availWidth, window.screen.availHeight);		}

function confirmMessageBox(st_message, st_name, st_url, st_next_page) 
{	switch(confirm(st_message + " '" + st_name + "'?"))
	{	case true:
			location.href = st_url;
			if (st_next_page == "undefined")
			{	st_connector = ((st_url.search("/?/i") > -1)? "?" : "&");
				location.href = (st_url + st_connector + "st_next_page=" + st_next_page);
			}
			break;
		case false:
			break;
	}
}

function confirmDelete(iname, delURL, referer) 
{	if (confirm("Are you sure you wish to delete '" + iname + "'?")) 
	{	location.href = (delURL + "&referer_page=" + referer);		}
}

//for popup windows e.g to display zipcodes
function PopUp(st_popupURL, st_name, in_width, in_height, bo_scroll) 
{	window.open(st_popupURL, st_name,'width=' + in_width + ',' + 'height=' + in_height + ',' + 'scrollbars=' + bo_scroll);		}

function PopUpPage(st_popupURL, st_name, st_parameters) 
{	window.open(st_popupURL, st_name, st_parameters);																			}

function openPage(pageURL)
{	location = pageURL;																											}

// will close the current window and reload the parent window
function reload_parent_form(in_index)
{	switch (in_index)
	{	case 0:									// open the formMemberProfile form 
			opener.formMemberProfile.submit();
			break;
		case 1:									// open the formMemberProfile form 
			opener.formProject.submit();
			break;
		default:
			self.opener.submit();
	}
	window.close();
}

function test()
{	alert('function test called');
}

function parent_redirect(url)
{	self.opener.location = url;
}

function refreshParent()
{	self.opener.location.reload();
	window.close();
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/*
Copyright © MaXimuS 2002, All Rights Reserved.
Site: http://maximus.ravecore.com
E-mail: maximusforever@hotmail.com
Script: Static Slide Menu
Version: 6.6 Build 34
*/

NS6=(document.getElementById&&!document.all)
IE=(document.all);IE4=(document.all&&!document.getElementById)
NS=(navigator.appName=="Netscape" && navigator.appVersion.charAt(0)=="4")
OP=(navigator.userAgent.indexOf('Opera')>-1)

tempBar='';barBuilt=0;lastY=0;lastX=0
//sI=new Array();
moving=setTimeout('null',1);

function moveOut() {
	if(parseInt(ssm.left)<0&&mPos||parseInt(ssm.left)>0&&!mPos){
		clearTimeout(moving);
		moving=setTimeout('moveOut()', slideXSpeed);
		slideMenu((!mPos)?"out":"out");
		}
	else {
		clearTimeout(moving);
		moving=setTimeout('null',1);
	}
}
function moveBack() {
	clearTimeout(moving);
	moving=setTimeout('moveBack1()',waitTime);
}
function moveBack1() {
	if(parseInt(ssm.left)>-(menuWidth+1)&&mPos||parseInt(ssm.left)<menuWidth+1&&!mPos) {
		clearTimeout(moving);
		moving=setTimeout('moveBack1()',slideXSpeed);
		slideMenu((!mPos)?"in":"in");
	}
	else{
		clearTimeout(moving);
		moving=setTimeout('null',1);
	}
}
function slideMenu(way){
	fHow=(NS6)?0.4:0.2;
	if(way=="out")flow=fHow*-(parseInt(ssm.left));
	if(way=="in"&&!mPos)flow=fHow* (menuWidth+1-parseInt(ssm.left));
	else if(way=="in")flow=fHow*-(menuWidth+1+parseInt(ssm.left));
	if(flow>0)flow=Math.ceil(flow);
	else flow=Math.floor(flow);
	if(IE||NS6){
		lastX+=flow;
		bssm.clip="rect(0 "+((!mPos)?(barWidth+menuWidth+3):(barWidth+2+lastX))+" "+(((IE4)?document.body.clientHeight:0)+tssm.offsetHeight)+" "+((!mPos)?(lastX+1):0)+")";
		}
	ssm.left=parseInt(ssm.left)+flow;
	if(NS){
		if(!mPos){
			bssm.clip.left+=flow;
			bssm2.clip.left+=flow;
		}
		else{
			bssm.clip.right+=flow;
			bssm2.clip.right+=flow;
		}
		if(bssm.left+bssm.clip.right>document.width)document.width+=flow;
	}
}

function makeStatic() {
	winY=(IE)?document.body.scrollTop:window.pageYOffset;
	sHow=(NS6)?0.4:0.2;
	if(winY!=lastY&&winY>YOffset-staticYOffset)smooth=sHow*(winY-lastY-YOffset+staticYOffset);
	else if(YOffset-staticYOffset+lastY>YOffset-staticYOffset&&winY<=YOffset-staticYOffset)smooth=sHow*(winY-lastY-(YOffset-(YOffset-winY)));
	else smooth=0;
	if(smooth>0)smooth=Math.ceil(smooth);
	else smooth=Math.floor(smooth);
	bssm.top=parseInt(bssm.top)+smooth;
	lastY=lastY+smooth;
	setTimeout('makeStatic()',slideYSpeed);
}

function menuClick(id) { 
	obj=(document.all)?document.all(id):document.getElementById(id);
	with(obj){
		if(event.srcElement.id!=id){
			if(target=="_top")top.location=href;
			else if(target=="_parent")parent.location=href;
			else if(target=="_blank")window.open(href);
			else if(target>""&&top.frames[target])top.frames[target].location=href;
			else if(target>"")eval('window.open("'+href+'","'+target+'")');
			else location=href;
		}
	}
}

function buildBar() {
	if(!barType)tempBar='<IMG SRC="'+barText+'" BORDER="0">';
	else{
		for(b=0;b<barText.length;b++)tempBar+=barText.charAt(b)+"<BR>"
	}
	ssmHTML+='<td align="center" rowspan="100" width="'+barWidth+'" bgcolor="'+barBGColor+'" valign="'+barVAlign+'" align="'+barAlign+'" class="ssmBar" NOWRAP>'+tempBar+'</td>';
}

function initSlide() {
	if (!mPos)lastX=menuWidth
	if ((NS6||IE)&&!OP||(operaFix!=2&&OP)){
		ssm=(NS6)?document.getElementById("thessm").style:document.all("thessm").style;
		tssm=(NS6)?document.getElementById("thessm"):document.all("thessm");
		bssm=(NS6)?document.getElementById("basessm").style:document.all("basessm").style;
		bssm.clip="rect(0 "+(barWidth+2+((!mPos)?menuWidth+1:0))+" "+(((IE4)?document.body.clientHeight:0)+tssm.offsetHeight)+" "+((!mPos)?(menuWidth+1):0)+")";
		if (OP&&operaFix==1)XOff=(!mPos)?document.body.clientWidth-barWidth-3:0;
		bssm.left=(!mPos)?XOff-menuWidth:XOff;
		if(OP)ssm.left=ssm.left;
		bssm.visibility="visible";
		if(NS6&&!OP){
			bssm.top=YOffset;
			if(menuOpacity!=100)ssm.MozOpacity=menuOpacity/100;
			slideIsGo=window.innerHeight>tssm.offsetHeight+staticYOffset;
		}
		else{
			if(menuOpacity!=100)ssm.filter="alpha(opacity="+menuOpacity+")";
			slideIsGo=((OP)?window.innerHeight:document.body.clientHeight)>parseInt(tssm.offsetHeight)+staticYOffset;
			}
		if(autoHideXOverflow&&((IE?document.body.clientWidth:window.innerWidth-16)<parseInt(bssm.left)+parseInt(ssm.left)+menuWidth+barWidth+3)){
			document.body.style.overflowX="hidden";
			document.body.style.overflowY="scroll";
		}
	}
	else if(NS){
		bssm=document.layers["basessm1"];
		bssm2=bssm.document.layers["basessm2"];
		ssm=bssm2.document.layers["thessm"];
		bssm.clip.left=(!mPos)?menuWidth+1:0;
		bssm.clip.right=(!mPos)?(menuWidth+barWidth+3):barWidth+2;
		bssm.left=(!mPos)?XOff-menuWidth:XOff;
		ssm.visibility="show";
		slideIsGo=window.innerHeight>ssm.clip.bottom+staticYOffset;
	}
	if(slideY&&(slideOnYOverflow||(!slideOnYOverflow&&slideIsGo)))makeStatic();
	if(!slideX)moveOut();
}

function getXOff() {
	return (((!XAlign)?((IE||OP)?document.body.clientWidth-barWidth-3:window.innerWidth-barWidth-3-17):(XAlign==1)?Math.floor(((IE||OP)?document.body.clientWidth/2-barWidth/2-1.5:window.innerWidth/2-barWidth/2-1.5)):0)+XOffset);
}

function buildMenu() {
	mPos=menuPosition;
	ssmHTML="";
	XOff=getXOff();
	if(IE||NS6)ssmHTML+='<DIV ID="basessm" style="visibility:hidden;Position : Absolute ;Top : '+YOffset+' ;Z-Index : 20;width:'+(barWidth+2)+';"><DIV ID="thessm" style="Position : Absolute ;Left : '+((!mPos)?menuWidth+1:-menuWidth-1)+' ;Top : 0px ;Z-Index : 30;'+((IE)?"width:1px":"")+'" '+((slideX)?'onmouseover="moveOut()" onmouseout="moveBack()")':'')+'>';
	if(NS)ssmHTML+='<LAYER name="basessm1" top="'+YOffset+'" visibility="show" onload="initSlide()"><ILAYER name="basessm2"><LAYER visibility="hide" name="thessm" bgcolor="'+menuBGColor+'" left="'+((!mPos)?menuWidth+1:-menuWidth-1)+'" '+((slideX)?'onmouseover="moveOut()" onmouseout="moveBack()")':'')+'>';
	if(NS6)ssmHTML+='<table border="0" cellpadding="0" cellspacing="0" width="'+(menuWidth+barWidth+3)+'"><TR><TD>';
	ssmHTML+='<table border="0" cellpadding="0" cellspacing="1" width="'+(menuWidth+barWidth+3)+'" bgcolor="'+((!NS)?menuBGColor:"")+'">';
	for(i=0;i<sI.length;i++){
		ssmHTML+='<TR>';
		if(barBuilt==0&&!mPos){
			buildBar();
			barBuilt=1
		}
		if(sI[i][3]>1)ssmHTML+='<TD BGCOLOR="'+hdrBGColor+'" ALIGN="'+hdrAlign+'" WIDTH="'+menuWidth+'"'+((NS6)?' style="padding:'+hdrPadding+'px"':'><TABLE CELLPADDING="'+hdrPadding+'" CELLSPACING="0" BORDER="0"><TR><TD')+' CLASS="ssmHdr" VALIGN="'+hdrVAlign+'">'+((sI[i][3]==3)?'<a HREF="'+((sI[i][1].indexOf("://")==-1&&sI[i][1].indexOf("../")==-1)?targetDomain:'')+sI[i][1]+'" target="'+sI[i][2]+'" class="ssmHdr">':'')+sI[i][0]+((sI[i][3]==3)?'</a>':'')+((NS6)?'':'</TD></TR></TABLE>')+'</TD>';
		else{
			if(!sI[i][2])sI[i][2]=targetFrame;
			ssmHTML+='<TD WIDTH="'+menuWidth+'"'+(NS&&!sI[i][3]?'':'BGCOLOR="'+linkBGColor+'"')+' '+((NS6)?'CLASS="ssmItem" style="padding:'+linkPadding+'px;" ALIGN="'+linkAlign+'"':'')+' '+((sI[i][3])?'>':'onmouseover="style.backgroundColor=\''+linkOverBGColor+'\'" onmouseout="style.backgroundColor=\''+linkBGColor+'\'" onclick="menuClick(\'item_'+i+'\');"'+(IE?' style="cursor:hand;"':'')+'><ILAYER><LAYER onmouseover="bgColor=\''+linkOverBGColor+'\'" onmouseout="bgColor=\''+linkBGColor+'\'" WIDTH="100%" ALIGN="'+linkAlign+'" bgcolor="'+linkBGColor+'">')+((NS6)?'':'<DIV ALIGN="'+linkAlign+'" CLASS="ssmItem"><TABLE CELLPADDING="'+linkPadding+'" CELLSPACING="0" BORDER="0"><TR><TD VALIGN="'+linkVAlign+'" CLASS="ssmItem">')+((sI[i][3])?'':'<A HREF="'+((sI[i][1].indexOf("://")==-1&&sI[i][1].indexOf("../")==-1)?targetDomain:'')+sI[i][1]+'" target="'+sI[i][2]+'" CLASS="ssmItem" id="item_'+i+'">')+sI[i][0]+''+((sI[i][3])?'':'</A>')+((NS6)?'':'</TD></TR></TABLE></DIV>')+((sI[i][3])?'':'</LAYER></ILAYER>')+'</TD>';
		}
		if(barBuilt==0&&mPos){
			buildBar();
			barBuilt=1;
		}
		ssmHTML+='</TR>';
	}
	ssmHTML+='</table>';
	if(NS6)ssmHTML+='</TD></TR></TABLE>';
	if(IE||NS6){
		ssmHTML+='</DIV></DIV>';
		setTimeout('initSlide();',1);
	}
	if(NS)ssmHTML+='</LAYER></ILAYER></LAYER>';
	document.write(ssmHTML);
}

function addHdr(text){sI[sI.length]=[text, '', '', 2]}
function addLink(text, link, target){if(!link)link="javascript://";sI[sI.length]=[text, link, target, 3]}
function addItem(text, link, target){if(!link)link="javascript://";sI[sI.length]=[text, link, target, 0]}
function addText(text){sI[sI.length]=[text, '', '', 1]}

//window.onresize=function(){setTimeout('alert(getOff());XOff=getXOff();bssm.left=(!mPos)?XOff-menuWidth:XOff;');}

if(location.href.search(/scripts\/admin/i) == -1){ 
	if(document.cookie.search(/session_administrator/i) != -1){
		buildMenu(); 
	}
}

function MakeIELinksBlink() 
{	if (!document.all) return;
	else 
	{	for(i=0;i<document.all.tags('blink').length;i++)
		{	s=document.all.tags('blink')[i];
			s.style.visibility=(s.style.visibility=='visible')  ?'hidden':'visible';
		}
	}
}

setInterval('MakeIELinksBlink()',1000);

function findInPage() 
{ 	if (parseFloat(navigator.appVersion) >= 4) 
	{ 	if (document.all) 
		{ 	st_text_to_find = window.prompt('Enter a search string', '');
			if (st_text_to_find == '') exit;
			var rng = document.body.createTextRange(); 
			var found = rng.findText(st_text_to_find); 
			if (found != false)
			{	rng.select(); 
				rng.scrollIntoView(); 
			}else { alert('Sorry, no matching information found.');	}
		} else {	window.find(); 	} 
	} 
}


/*********************************************** 
* IFRAME Scroller script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

// Specify speed of scroll. Larger=faster (ie: 5)
var scrollspeed=cache=2

// Specify intial delay before scroller starts scrolling (in miliseconds):
var initialdelay=500

function initializeScroller()
{	dataobj=document.all? document.all.datacontainer : document.getElementById("datacontainer")
	if (dataobj != null) 
	{	dataobj.style.top="5px"			
		setTimeout("getdataheight()", initialdelay) 
	}
}

function getdataheight()
{	thelength=dataobj.offsetHeight
	if (thelength==0) setTimeout("getdataheight()",10)
	else scrollDiv()
}

function scrollDiv()
{	dataobj.style.top=parseInt(dataobj.style.top)-scrollspeed+"px"
	if (parseInt(dataobj.style.top)<thelength*(-1)) dataobj.style.top="5px"
	setTimeout("scrollDiv()",40)
}

if (window.addEventListener) window.addEventListener("load", initializeScroller, false)
else if (window.attachEvent) window.attachEvent("onload", initializeScroller)
else window.onload=initializeScroller

// -- PUT THIS CODE AROUND THE CONTENT TO SCROLL IN AN HTML FILE LOADED IN AN IFRAME OBJECT
// <div id="datacontainer" style="position:absolute;left:1px;top:10px;width:100%" onMouseover="scrollspeed=0" onMouseout="scrollspeed=cache">
// </div>
// 
// -- SAMPLE IFRAME CODE THAT CAN BE USED
// <iframe src="url-to-page-to-load" name="frmEvents" id="frmEvents" width="100%" height="100" marginwidth="0" marginheight="0" frameborder="0" style="border: 0px solid groove;" border="0" scrolling="no"></iframe>

// *********************************************************************

function reformat_date(st_date)
{	ar_date = st_date.split("-");
	return ar_date[1] + "/" + ar_date[2] + "/" + ar_date[0];
}