$(document).ready(function() {

						   
// Run urlDetect if this is the MyOrderDesk frameset
var framesetId = $('frameset').attr('id');
if (framesetId == 'modFrameset') urlDetect();


// Unscramble e-mail addresses client-side
if ($('a.email').length > 0) {
	$('a.email').nospam({ replaceText: true });
	$('a.emailnoreplace').nospam({ replaceText: false });
}


// Fade in the news flash box
$('#eFlashContainer').fadeIn(700);


// Cycle the articles in the news flash box
// Uses the jQuery Cycle Lite plugin
if ($('#eFlashContent').length > 0) {
	$('#eFlashContent').cycle({
		sync: 		false,
		timeout:	5000,
		speed:		700,
		pause:		1
	});
}


// End $(document).ready(function()
});


// Function checks for MyOrderDesk arguments in the URL
function skinDetect() {
	var skinService = new cSkinService();
	var url = skinService.GetTargetURL();
	// alert('DBG redirect url ' + url);
	if (url) window.location = '/order/?url=' + escape(url);
}


// Function processes MyOrderDesk arguments in the URL
function urlDetect() {
	var url;
	var QS = location.search.substring(1, location.search.length);
	if (QS) {
		var params = new Object();
		QS = QS.replace(/\\+/g, ' ');
		// parse for name/value pairs separated via &
		var args = QS.split('&');
		// split out each name/value pair
		for (var i = 0; i < args.length; i++) {
			var value;
			var pair = args[i].split('=');
			var name = unescape(pair[0]);
			value = (pair.length == 2) ? unescape(pair[1]) : name;
			params[name] = value;
		}
		url = (params['url']) ? unescape(params['url']) : '';
	}
	// alert('DBG redirect url ' + url);
	if (url) top.frames['modFrame'].location = url;
}