// Some website functions for use in elearningcorner.com
//  JSLint directives
/*global $,document,window,escape,pageTracker */

$(document).ready( 
	function() { // Modify any anchor tag to open a new window with no menus when clicked
		function newWindow( sElements ) {
			function agreement () {
				var sUrl = '';
				try { // Issue a Gooble Tracker if this is a demo course
					sUrl = $(this).attr('title');
					if ( sUrl.length > 0 ) {
						pageTracker._trackPageview( '/' + sUrl + '/Player.html' );
					}
				} catch(e1) {}
				window.open( this.href,'','fullscreen=1,location=0,menubar=0,resizable=1,status=0,toobar=0');
				return false;
			}
			$( sElements ).click(agreement); // Modify all matching elements
		}		
		newWindow( 'a.external' );
	}
);

function setHref (xId, xText, xPre, xDom, xSub) {
/* Define email addresses at runtime to prevent harvesting by spam spiders */
/* xId element to modify, xText, replacement text, xPre email prefix, xDom email suffix, xSub email subject line */
	var sHref = 'm' + 'ailto:' + (xPre || "carol") + '@' + (xDom || 'carol-carter.com') +
		(xSub ? '?subject=' + escape(xSub) : '');
	var oObj = document.getElementById(xId);
	try {
		oObj.href = sHref;
		if(xText) {
			oObj.innerHTML = xText;
		}
	} catch(e) {}
	return;
}

