/*
Useful JavaScript tools
*/
//----------------------------------------------------------------------------------
try {
	// fix Internet Explorer 6 bug with background image flicker
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}
//----------------------------------------------------------------------------------

function highlight(idName) {
	document.getElementById(idName).style.backgroundColor = "#fb6";
	document.getElementById(idName).style.color = "#00c";
	//document.getElementById(idName).style.borderBottomColor = "#fb6";
}

//----------------------------------------------------------------------------------
function mail(recipient,email,name) {
	/*
		Purpose:
			This function generates a mailto:user@domain string 
			- an "anti-email-harvesting" trick
			usage example: mail('DServranckx', 'admaris.com','Daniel Servranckx at Admaris Inc.')
					will produce the mailto tag for DServranckx @ admaris.com
		Created by:
		 	Dan Servranckx on 4 Nov 2006
	*/
	var mailto = '<a href="mailto:';
	var atsign = "@";
	document.write(mailto + recipient + atsign + email + 
			'" title="Click to open an email window">' + name + '<\/a>');
	return true;
}
//----------------------------------------------------------------------------------

function date_modified() {
	/*
		Purpose:
			This function picks up and displays the date from the dc.date.modired meta data
		Created by:
		 	Dan Servranckx on 4 Nov 2006
	*/
	meta = document.getElementsByName("dc.date.modified");
	if (meta.length == 1) {
		document.write(meta[0].content);
	}
	return true;
}
//----------------------------------------------------------------------------------

function change_image(idName,picture) {
	/*
		Purpose:
			This function replaces an image source based on its id name
		Created by:
		 	Dan Servranckx on 8 Nov 2006
	*/
	document.getElementById(idName).src = picture;
	return true;
}
//----------------------------------------------------------------------------------

function pop_up_window(url, width, height) {
	/*
		Purpose:
			Use this function to pop up a non-navigational window containing page "url" 
			of specific size width and height in pixels. 
		Created by:
		 	Dan Servranckx on 14 May 2006
	*/

  //define browser window characteristics//
  charac = 	"height=" + height + ",width=" + width + ",top=200,left=200,toolbar=1," +
						"location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0";
	// Open a new window  named information for the URL, with above 
	//	characteristics, and give it focus to pop it on top. 
  var w = window.open(url,'Information',charac);
  w.focus();
}
//----------------------------------------------------------------------------------

function target(url) {
  /*
		Purpose:
			Use this function to pop up a new window named _New with URL "url".
			Replaces the deprecated anchor "target" tag.
		Created by:
			Dan Servranckx on 11 Nov 2006.
		Usage: instead of
				<a href="http://admaris.com" target="_New">Admaris.com</a>
			use
				<a href="javascript:target('http://admaris.com')">Admaris.com</a>
	*/
  var w = window.open(url,'_New');
  w.focus(); // make sure new window gets focus
}
//----------------------------------------------------------------------------------