/**
* Window popup
*/
function popup(url, options, name)
{
	if (!name)
	{
		name = '_popup';
	}
	if (!options)
	{
		// 'height=' + height + ',resizable=yes,scrollbars=yes, width=' + width
		options = 'resizable=yes,scrollbars=yes';
	}
	window.open(url.replace(/&amp;/g, '&'), name, options);
	return false;
}

/**
* Close the damned window!
*/
function closeit() {
	opener=self;
	self.close();
	return false;
}
/**
* select image
*/
function selectimage(app_url, ref, img_id) {
	document.getElementById('photolink').onclick = function () { window.open(app_url + "imgpop.php?ref=" + ref + "&id_image=" + img_id, 'zoom', 'width=100%,height=100%'); return false; };
} 
/**
* Back to main page from popup
*/
function back_to(url)
{
	opener.document.location.href = url.replace(/&amp;/g, '&');
	window.close();
}
/**
* Resize viewable area for attached image or topic review panel (possibly others to come)
* e = element
*/
function viewableArea(e, itself)
{
	if (!e) return;
	if (!itself)
	{
		e = e.parentNode;
	}
	
	if (!e.vaHeight)
	{
		// Store viewable area height before changing style to auto
		e.vaHeight = e.offsetHeight;
		e.vaMaxHeight = e.style.maxHeight;
		e.style.height = 'auto';
		e.style.maxHeight = 'none';
		e.style.overflow = 'visible';
	}
	else
	{
		// Restore viewable area height to the default
		e.style.height = e.vaHeight + 'px';
		e.style.overflow = 'auto';
		e.style.maxHeight = e.vaMaxHeight;
		e.vaHeight = false;
	}
}

/**
* Set display of page element
* s[-1,0,1] = hide,toggle display,show
*/
function dE(n, s)
{
	var e = document.getElementById(n);
	if (!e) {
		return false;
	}

	if (!s)
	{
		s = (e.style.display == '' || e.style.display == 'block') ? -1 : 1;
	}
	e.style.display = (s == 1) ? 'block' : 'none';
}
function TimeddE(n, s, millisec)
{
	var t=setTimeout("dE('" + n + "', " + s + ")", millisec);
}
function highlightcat(id, over)
{
	var idmen = 'mfx' + id;
	var idimg = 'ifx' + id;
	var me = document.getElementById(idmen);
	var ie = document.getElementById(idimg);
	if (!ie || !me) {
		return false;
	}
	if (over) {
		me.style.color = "#fff";
		me.style.background = "#CBD49E";
		ie.width = ie.width - 4;
		ie.height = ie.height - 4;
		ie.style.border = "2px solid #77512F";
	} else {
		me.style.color = "#77512F";
		me.style.background = "transparent";
		ie.style.border = "none";
		ie.width = ie.width + 4;
		ie.height = ie.height + 4;
	}
}
function Timedhighlightcat(id, over, millisec)
{
	var t=setTimeout("highlightcat('" + id + "', " + over + ")", millisec);
}
function doprodselect(id)
{
	var me = document.getElementById('sprd' + id);
	if (me) {
		me.selected = "selected";
	}
}
/**
* Show/hide groups of blocks
* c = CSS style name
* e = checkbox element
* t = toggle dispay state (used to show 'grip-show' image in the profile block when hiding the profiles) 
*/
function displayBlocks(c, e, t)
{
	var s = (e.checked == true) ?  1 : -1;

	if (t)
	{
		s *= -1;
	}

	var divs = document.getElementsByTagName("DIV");

	for (var d = 0; d < divs.length; d++)
	{
		if (divs[d].className.indexOf(c) == 0)
		{
			divs[d].style.display = (s == 1) ? 'none' : 'block';
		}
	}
}
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
// Open external links in new window in a XHTML 1.x compliant way.
function nw_external() {
	var current_domain = document.domain;
	if (!current_domain || !document.getElementsByTagName) return;
	var hrefels = new Array;
	var hrefelslen = 0;
	hrefels = document.getElementsByTagName("a");
	hrefelslen = hrefels.length;
	for (var i = 0; i < hrefelslen; i++) {
		var el = hrefels[i];
		var hrefinner = el.innerHTML.toLowerCase();
		if ( (el.href == '') || (el.href.indexOf('javascript') >=0 ) || (el.href.indexOf('mailto') >=0 ) || (hrefinner.indexOf('<a') >= 0) || (hrefels[i].href.indexOf(current_domain) >= 0) ) {
			continue;
		}
		hrefels[i].onclick = function () { window.open(this.href); return false; };
	}
}
onload_functions.push('nw_external()');
// www.phpBB-SEO.com SEO TOOLKIT END

