function showhide ( id ) {

	el = document.getElementById(id)

	if (! el ) {
		return;
	}

	if( el.style.display == 'none' ) {
		el.style.display = 'block';
	} else {
		el.style.display = 'none';
	}

	return false; //don't jump on hrefs...
}

function show( id ) {
	el = document.getElementById(id)

	if (! el ) {
		return;
	}

	el.style.display = 'block';
}

function hide( id ) {
	el = document.getElementById(id)

	if (! el ) {
		return;
	}

	el.style.display = 'none';
}

/* Prevent the Evil IE flickr
	**************************************     */
try {
	document.execCommand( "BackgroundImageCache", false, true );
}
catch( e ) { };




/* Unobtrusive Methods
	of adding onclicks to our pages
	**************************************     */

function addFav() {
  if (!document.getElementsByTagName) return false;
  var links = document.getElementsByTagName("a");
  for (var i=0; i < links.length; i++) {
	if (links[i].className.match(yourClassNameHere)) {
	  links[i].onclick = function() {
		window.external.AddFavorite(location.href, yourUrlHere)
		return false;
	  }
	}
  }
}


// Mutiple onload events - this BB is a little gem :)
// http://www.sitepoint.com/blogs/2004/05/26/closures-and-executing-javascript-on-page-load/

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
	window.onload = func;
  } else {
	window.onload = function() {
	  if (oldonload) {
		oldonload();
	  }
	  func();
	}
  }
}

//addLoadEvent(nameOfSomeFunctionToRunOnPageLoad);
//addLoadEvent(function() {
  /* more code to run on page load */
//})

/* add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}

/* add some aliases for ease of use/backwards compatibility */
var getQueryParamValue = deconcept.util.getRequestParameter;
var FlashObject = deconcept.SWFObject; // for legacy support
var SWFObject = deconcept.SWFObject;

function show_report_box(comment_id,username,type) {

	// make this center the box on the screen and display it with the fade

	var box = document.getElementById('report_comment_box');
	var pos = getDeadCentre(300,184);

	box.style.top = pos[1] + 'px';
	document.getElementById('report_username').innerHTML = username;
	document.getElementById('report_comment_id').value = comment_id;
	document.getElementById('report_type').value = type;

	// restet the form
	$('#frmReport').show();
	$('#reportDone').hide();

	$('#report_comment_box').fadeIn('slow');

}

function make_report(rootURL) {

	var commentId = document.getElementById('report_comment_id').value;
	var commentType = document.getElementById('report_type').value;
	var reportReason = document.getElementById('report_reason').value;

	$.post(rootURL + 'lib/ajax/make_report.php',
		   { comment_id: commentId, type: commentType, report_reason: reportReason },
		   function(data) {
				if ( data.error == 0 ) {
					$('#frmReport').hide();
					$('#reportDone').show();
					$('#report_comment_box').fadeOut(2500);
				}
			},
			'json'
		  );

	return false;

}

function getDeadCentre(Xwidth,Yheight) {
	// First, determine how much the visitor has scrolled

	var scrolledX, scrolledY;
	if( self.pageYOffset ) {
		scrolledX = self.pageXOffset;
		scrolledY = self.pageYOffset;
	} else if( document.documentElement && document.documentElement.scrollTop ) {
		scrolledX = document.documentElement.scrollLeft;
		scrolledY = document.documentElement.scrollTop;
	} else if( document.body ) {
		scrolledX = document.body.scrollLeft;
		scrolledY = document.body.scrollTop;
	}

	// Next, determine the coordinates of the center of browser's window

	var centerX, centerY;
	if( self.innerHeight ) {
		centerX = self.innerWidth;
		centerY = self.innerHeight;
	} else if( document.documentElement && document.documentElement.clientHeight ) {
		centerX = document.documentElement.clientWidth;
		centerY = document.documentElement.clientHeight;
	} else if( document.body ) {
		centerX = document.body.clientWidth;
		centerY = document.body.clientHeight;
	}

	// Xwidth is the width of the div, Yheight is the height of the
	// div passed as arguments to the function:
	var leftOffset = scrolledX + (centerX - Xwidth) / 2;
	var topOffset = scrolledY + (centerY - Yheight) / 2;
	// The initial width and height of the div can be set in the
	// style sheet with display:none; divid is passed as an argument to // the function

	var output = [];
	output[0] = leftOffset;
	output[1] = topOffset;

	return output;

}