/*
	Copyright: 	Hybrid Forge 2010. All Rights Reserved.
	Authors: 	Rod Miles (www.HybridForge.com)
	Date:		September 2010
	
	Info:		Customizations and styling. jQuery in no-conflict mode so that
				it won't interfere with native ISE javascript. Some 
				customizations are due to some HTML being in .cs files 
				instead of .aspx or xml packages
=============================================================================*/


function getParameterByName( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return decodeURIComponent(results[1].replace(/\+/g, " "));
}

var flashMCtimeout;
function flashMC() {
  if (getParameterByName('sdr') == 'crt') {
    $("#miniCart").fadeIn();
	window.flashMCtimeout = setTimeout("$('#miniCart').fadeOut();",10000);
  }
}

jQuery.noConflict();
jQuery(document).ready(function($) {

	/* Mini-cart
	-------------------------------------------------------------------------*/	
	
	// Show
	$("#miniCartLink").mouseenter(function() {	// when mouse enters the space
		$("#miniCart").fadeIn();
		return false;
	});
	
	// cancel fade
	$("#miniCart").mouseenter(function() {		// when mouse exits the space
		clearTimeout(window.flashMCtimeout);
	});
	
	// Hide
	$("#miniCart").mouseleave(function() {		// when mouse exits the space
		$("#miniCart").fadeOut();
	});
	
	
	// remove double breaks and replace with separator div	
	$("#miniCart table table br + br").replaceWith("<div class='separator'></div>");
	
	// Remove inline centering
	$("#miniCart table td").attr("align","left");
	
	// Correct the table width
	$("#miniCart table table").attr("width","185");
	
	// Remove last link as it's duplicate
	$("#miniCart table table td a:last").remove();
	
	// Default Text
	if ( $.trim( $('#miniCart .mcBody').text() ) == "" ) {
		$('#miniCart .mcBody').text("Oops! Your bag is empty.")
	}
	setTimeout("flashMC()",500);
});

	
