// .-==================================================================
// .	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;
	}
}


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;