function pop(picture)
{
	window.open('./pop.php?picture=' + picture, 'dummy', ',type=fullWindow,fullscreen,scrollbars=yes');
	return false;
}

function collapseCategorySection(id) {
	try {
		var obj = document.getElementById(id);
		obj.style.position = 'absolute';
		obj.style.visibility = 'hidden';
		try {obj.style.filters.alpha.opacity=0;} catch(e) {};
		try {obj.style.opacity=0;} catch(e) {};
		var btn = document.getElementById('button_' + id);
		btn.innerHTML = '<a href="javascript:expandCategorySection(\'' + id + '\');"><img src="./pics/expand.gif" border="0" width="10px" height="9px" alt=""/></a>';
		makeVoidGetRequest('./ajax/forum_class.php?action=session&index=' + id + '&value=0');
	} catch(e) {}
}

function expandCategorySection(id) {
	try {
		var obj = document.getElementById(id);
		obj.style.position = 'static';
		obj.style.visibility = 'visible';
		try {obj.style.filters.alpha.opacity=100;} catch(e) {};
		try {obj.style.opacity=1;} catch(e) {};
		var btn = document.getElementById('button_' + id);
		btn.innerHTML = '<a href="javascript:collapseCategorySection(\'' + id + '\');"><img src="./pics/collapse.gif" border="0" width="10px" height="9px" alt=""/></a>';
		makeVoidGetRequest('./ajax/forum_class.php?action=session&index=' + id + '&value=1');
	} catch(e) {}
}

function darkenPage() {
	var obj = document.getElementById('darkener');
	var pageWidth = null;
	var pageHeight = null;
	try {
		if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
	        pageWidth = document.body.scrollWidth+'px';
	        pageHeight = document.body.scrollHeight+'px';
	    } else if( document.body.offsetWidth ) {
	      pageWidth = document.body.offsetWidth+'px';
	      pageHeight = document.body.offsetHeight+'px';
	    } else {
	      pageWidth='100%';
	      pageHeight='100%';
	    }
		obj.style.width = pageWidth;
		obj.style.height = pageHeight;
	} catch(e) {};
	obj.style.visibility = 'visible';
	try {
		document.getElementById('filter_delay').style.visibility = 'hidden';
	} catch(e) {};
	try {
		document.getElementById('point_selector').style.visibility = 'hidden';
	} catch(e) {};
}

function lightenPage() {
	document.getElementById('darkener').style.visibility = 'hidden';
	try {
		document.getElementById('filter_delay').style.visibility = 'visible';
	} catch(e) {};
	try {
		document.getElementById('point_selector').style.visibility = 'visible';
	} catch(e) {};
}

function ajaxPopOn(action, w, h, id) {
	darkenPage();
	id = (id == null) ? 0 : id;
	obj = document.getElementById('ajaxpop');
	obj.style.left		= parseInt((screen.width - w) / 2) + 'px';
	obj.style.top		= parseInt((screen.height - h) / 2) + 'px';
	obj.style.width		= w + 'px';
	obj.style.height	= h + 'px';
	obj.style.visibility = 'visible';
	document.body.style.overflow = 'hidden';
	if (id == 0) makeGetRequest('./ajax/pm_class.php?action=' + action + '&div=ajaxpop', 'ajaxpop');
	else makeGetRequest('./ajax/pm_class.php?action=' + action + '&subaction=new&memberid=' + id + '&div=ajaxpop', 'ajaxpop');
}

function ajaxPopOff() {
	lightenPage();
	obj = document.getElementById('ajaxpop');
	document.body.style.overflow = 'auto';
	obj.style.visibility = 'hidden';
}

var delayPm = null;

function delayAjaxPm() {
	try {clearTimeout(delayPm);} catch(e){};
	delayPm = setTimeout('runDelayedAjaxPm()', 500);
}

function runDelayedAjaxPm() {
	if (document.getElementById('memberSearchBoxPm').value.length > 0) {
		makeGetRequest('./ajax/pm_class.php?action=outbox&subaction=search&string=' + escape(encodeURI(document.getElementById('memberSearchBoxPm').value)) + '&div=memberSearchPm', 'memberSearchPm');
		document.getElementById('memberIdPm').value=0;
	} else {
		document.getElementById('memberSearchPm').innerHTML='';
		document.getElementById('memberIdPm').value=0;
	}
}

function insertPm() {
	try {
		var uid = document.getElementById('memberIdPm').value;
		var title = escape(encodeURI(document.getElementById('titlePm').value));
		var content = escape(encodeURI(document.getElementById('contentPm').value));
		if ((parseInt(uid) > 0) && (title != '') && (content != '')) {
			makeGetRequest('./ajax/pm_class.php?action=outbox&subaction=insert&uid=' + uid + '&title=' + title + '&content=' + content + '&div=pmviewbox', 'pmviewbox');
			var delayedPm = setTimeout("makeGetRequest('./ajax/pm_class.php?action=outbox&div=ajaxpop', 'ajaxpop')", 2000);
			return true;
		}
		else {
			return false;
		}
	} catch(e) {
		return false;
	}
}

function deletePm(box, pm) {
	makeGetRequest('./ajax/pm_class.php?action=' + box + '&subaction=destroy&pmid=' + pm + '&div=pmviewbox', 'pmviewbox');
	var delayedPm = setTimeout("makeGetRequest('./ajax/pm_class.php?action=" + box + "&div=ajaxpop', 'ajaxpop')", 1000);
}

var diggerTimer = null;

function showDiggerDiv(id) {
	var obj = document.getElementById('linkbacktools_menu_' + id);
	obj.style.visibility = (obj.style.visibility == 'visible') ? 'hidden' : 'visible';
}

function popCalendarDetails(i, j, d) {
	obj = document.getElementById('calendarBubble');
	obj.style.left = (20*i+8) + 'px';
	obj.style.top = (22*(j-1)-132) + 'px';
	obj.style.visibility = 'visible';
	makeGetRequest('./ajax/calendar_class.php?action=load_bubble&div=calendarBubbleInner&day=' + d, 'calendarBubbleInner');
}

function hideCalendarDetails() {
	obj = document.getElementById('calendarBubble');
	obj.style.visibility = 'hidden';
}