// .-==================================================================
// .	FusionBB Version 2.0
// .
// .	Created August 20, 2003 by InteractivePHP
// .
// .	All scripts and files used by this program
// .	are copyright InteractivePHP, Inc
// .	For discussion, bug reports and updates
// .	visit http://www.InteractivePHP.com
// .
// .	You may not redistribute this program in any form, without
// .	express written permisson from InteractivePHP.
// .
// .	WARNING: If you modify any scripts within FusionBB
// .	you will be unable to obtain official support.
// .	Modify at your own risk!
// .
// .	FusionBB Copyright 2003-2007, InteractivePHP, Inc
// .-==================================================================
// .	$Date: 2006/10/05 10:37:01 $	$Author: dave $
// .	$RCSfile: fusionbb_main.js,v $	$Revision: 1.1 $
// .-==================================================================
// .	File Description:
// .		Main Javascript used by FusionBB 
// .-==================================================================

function breakFrame(){
	if (top.location != location) {
		top.location.href = document.location.href ;
	}
}

function loadShoutBox(url) {
	if (document.getElementById('shoutbox')) {
		document.getElementById('shoutbox').src=url;
	}
}

function setCookie(name, value) {
	var date = new Date();
	var expire = date.getTime();
	expire += 1000 * cookieexpire;
	date.setTime(expire);
	document.cookie = cookieprefix + name + "=" + escape(value) + "; expires=" + date.toGMTString() + "; path=" + cookiepath + "; domain=" + cookiedomain;
}

function toggleDisplay(id) {
	var cat = document.getElementById("cat-" + id);
	cname = 'cat-'+id;
	var name = 'img-' + id;
	if (cat.style.display != "") {
		cat.style.display="";
		document.images[name].src = collapse.src;
		setCookie(cname, 1);
	}
	else {
		cat.style.display = "none";
		document.images[name].src = expand.src;		
		setCookie(cname, 0);
	}
}

function toggleSection(id) {
	var cat = document.getElementById("section-" + id);
	cname = 'section-'+id;
	var name = 'img-' + id;
	if (cat.style.display != "") {
		cat.style.display="";
		document.images[name].src = collapse.src;
	}
	else {
		cat.style.display = "none";
		document.images[name].src = expand.src;		
	}
}


function QuickReply(id) {
	var cat = document.getElementById("section-1");
	var name = 'img-1';
	obj = document.post;
	obj.pid.value = document.getElementById('pid-' + id).innerHTML;

	if (cat.style.display != "") {
		cat.style.display="";
		document.images[name].src = collapse.src;
	}
}

function unread_pt(text,sess,fullurl) {
	if (confirm(text)) { // Take them to the Private Topic Page
		window.location=""+fullurl+"/listpt.php?"+sess;
	}
}

// *** this section added by justin from macromedia fireworks ***

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];}
}
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];}}
}

// and this next function also added by justin but not from fireworks
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			func();
		}
	}
}

addLoadEvent (MM_preloadImages('/wearegcn/wearegcn_f2.gif','/wearegcn/sponsor_f2.gif','/wearegcn/volunteer_f2.gif'));

// *** end justin's addition ***

var lastid = '';
var gotclick = 0;
function toggleClick() {
	if (gotclick == 1) {
		gotclick = 0;
	}
	else {
		gotclick = 1;
	}
}
function hideCheck() {
	if (lastid != '' && lastid != null && gotclick == 1) {
		document.getElementById(lastid).style.visibility = "hidden";
		lastid = '';
		gotclick = 0;
	}
}
function showCheck(id) {
	if (lastid != id && gotclick == 1) {
		document.getElementById(lastid).style.visibility = "hidden";
		lastid = id;
		document.getElementById(id).style.visibility = "visible";
	}
}
function showMenu(id) {
	if (lastid != id) {
		if (lastid != '' && lastid != null) {
			document.getElementById(lastid).style.visibility = "hidden";
		}
		lastid = id;
		gotclick = 1;
		document.getElementById(id).style.visibility = "visible";
	}
	else {
		lastid = '';
		gotclick = 0;
		document.getElementById(id).style.visibility = "hidden";
	}
}
function showHide(id) {
	var obj = document.getElementById(id);
	if (obj) {
		if (obj.style.display == "") {
			obj.style.display = "none";
			setCookie('sbar', 'none');
		}
		else {
			obj.style.display = "";
			setCookie('sbar', ';');
		}
	}
}
document.onmousedown = hideCheck;