<!--
if(typeof jsImageSrcPrepend=='undefined')
	var jsImageSrcPrepend = '';
if(typeof jsImageTagPrepend=='undefined')
	var jsImageTagPrepend = '';
//window.top.name="preview";
/*function CatchEmptySearch() {
	alert('Search is currently unavailable.\nPlease try back later.');
	return false;
}*/
function CatchEmptySearch() {
	var search = document.searchForm.query.value;
	var valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-.%_+ ";
	var temp = "";
	var invalidflag = 0;
	
	if (search == "") {
		alert('Please enter your search criteria\nthen click the Go button.');
		document.searchForm.query.focus();
		return false;
	}
	else if (search.substring(0,1) == " ") {
		alert('Please remove any leading spaces\nfrom your search criteria and try again.');
		document.searchForm.query.focus();
		return false;
	}
	else if (search == "-" || search == "." || search == "%" || search == "_" || search == "+" || search == " ") {
		alert('Your search criteria is too general.\nPlease add to it and try again.');
		document.searchForm.query.focus();
		return false;
	}
	else if ((search.indexOf("gift card")>-1)  || (search.indexOf("giftcard")>-1) || search == "gc")
	{
		// TODO: update the catId when gift card is broken out into two genders again, but still probably default to Women's
		window.location = "/" + jsContextRoot + "/browse/category.jsp?catId=cat80013";
		return false;
	}
	for (var i=0; i < search.length; i++)
	{
		temp="" + search.substring(i,i+1);
		if (valid.indexOf(temp)=="-1") {
			invalidflag = 1;
			break;
		}
	}
	if (invalidflag==1) {
		alert("Your search criteria contains an invalid character(s).\nValid characters are numbers, letters, spaces, and . - % _ +.\nPlease remove any invalid characters and try again.");
		document.searchForm.query.focus();
		return false;
	}
	else {
		return true;
	}
}
//Configurable Function for Popups
function ConfigurablePopup(url,w,h,winName,scroll,resiz,topPos,leftPos)
{
	var popup = window.open(url,winName,'toolbar=0,top='+topPos+',left='+leftPos+',width='+w+',height='+h+',location=0,directories=0,status=0,menubar=0,scrollbars='+scroll+',resizable='+resiz);
	popup.location=url;
	popup.opener=self;
	popup.focus();
}
//Generic Function for Popups
function popup(url,w,h) // calling with new name, see below.  only keeping this in case it works on some pages and other things rely on it
{
	return GenericPopup(url,w,h);
}
function GenericPopup(url,w,h,winName) // renamed because there are other things named popup on the page so the function wasn't working
{
	if (winName == null)
		winName = "MAO";
	var width = w;
	var height = h;
	var LeftPosition = (screen.width) ? (screen.width-width)/2 : 0;
	var TopPosition = (screen.height) ? (screen.height-height)/2 : 0;
	var popupURL = url;
	var popup = window.open(popupURL,winName,'toolbar=0,top='+TopPosition+',left='+LeftPosition+',width='+width+',height='+height+',location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1');
	popup.location=popupURL;
	popup.opener=self;
	popup.focus();
}
/*******************************************************************************************
 * Function	: scanKeypress
 * Parameters	: Key press event
 * This function submits the form when the user hits the enter key(IE and NN compatable )
 *******************************************************************************************/
var nav4=window.Event ? true : false;
if (document.layers) document.captureEvents(Event.KEYPRESS);

if (nav4 && document.layers)
 document.onkeypress=scanKeypress;
 
function scanKeypress(e)
{
    if (nav4)
   		var whichCode=e.which;
	else
    	if (e.type=="keypress")
      		var whichCode=e.keyCode;
    	else
      		var whichCode=e.button;
 	if (whichCode==13)
	{
		return false;
	}
	else return true;
}
function clearNameCookie(){
document.cookie="DYN_PROFILE_ID=;-1;path=/";
}
//-->

var navAnimationEnabled = false;
var lockNavAnimation = false;
var navAnimationDelay = .3; // seconds
var navRevertDelay = .8; // seconds

navAnimationDelay = navAnimationDelay * 1000; // convert to miliseconds
navRevertDelay = navRevertDelay * 1000; // convert to miliseconds

var navAnimationTimeout = null;  // initialize these for later
var navRevertTimeout = null;
var currentCategory = null;
var navContentInitial = '';

// For IE6 to do the hover effect without flickering
var navIEHoverDelay = 10; // miliseconds
var navIEHoverTimeout = null;
var currentNavIEHoverElement = null;
var mainnav_sections = $(document);
var sectionsnavwrapper = $(document);

function initNavAnimation()
{
	mainnav_sections = $('#mainnav_sections');
	sectionsnavwrapper = $('#sectionsnavwrapper');
	navAnimationEnabled = true;
	navContentInitial = $('#onstatewrapper').html();
	if(navAnimationEnabled)
	{
		sectionsnavwrapper.bind('mouseover', function(e){
			clearRevertTimeout();  // make sure nav doesn't revert back
		});
		sectionsnavwrapper.bind('mouseout', function(e){
			setRevertTimeout(); // to revert back to this page's proper nav
		});
		
		// For IE6 to do the hover effect on the nav without flickering
		initNavAnimationForIE6();
	}
}
function initNavAnimationForIE6()
{
	// For IE6 to do the hover effect on the nav without flickering
	if(jQuery.browser.msie && getInternetExplorerVersion() < 7)
	{
		clearNavIEHoverTimeout();
		navIEHoverTimeout = currentNavIEHoverElement = null;
		$(".submenucontent").mouseout(function(){
			setNavIEHoverTimeout(this);
		}).mouseover(function(){
			onOverNavIEHover(this);
		});
	}else return;
}

function onOverNavIEHover(el)
{
	if(el != currentNavIEHoverElement && currentNavIEHoverElement != null) onOutNavIEHover();
	clearNavIEHoverTimeout();
	$(el).addClass('hover');
}
function onOutNavIEHover()
{
	if(currentNavIEHoverElement != null) $(currentNavIEHoverElement).removeClass('hover');
	currentNavIEHoverElement = null;
}
function setNavIEHoverTimeout(el)
{
	currentNavIEHoverElement = el;
	navIEHoverTimeout = window.setTimeout(onOutNavIEHover, navIEHoverDelay);
}
function clearNavIEHoverTimeout()
{
	clearTimeout(navIEHoverTimeout);
}
function setRevertTimeout()
{
	navRevertTimeout = window.setTimeout('startAnimateHeader("'+pageCategory+'")', navRevertDelay);
}
function clearRevertTimeout()
{
	clearTimeout(navRevertTimeout);
}
function animateHeader(category)
{
	if(navAnimationEnabled)
		navAnimationTimeout = window.setTimeout('startAnimateHeader("'+category+'")', navAnimationDelay);
}
function stopAnimateHeader()
{
	if(navAnimationEnabled)
	{
		if(!lockNavAnimation) // animation hasn't started
			clearTimeout(navAnimationTimeout);
		else
		{
			// stop running animations
			mainnav_sections.stop();
			sectionsnavwrapper.stop();
			// reset elements
			//mainnav_sections.css('float', 'none');
			mainnav_sections.css('height', '120px');
			//mainnav_sections.css('width', '803px');
			//sectionsnavwrapper.css('margin-left', '0');
			// unlock animation
			lockNavAnimation = false;
		}
		
		setRevertTimeout(); // to revert back to this page's proper nav
	}
}
function startAnimateHeader(category)
{
	if(!lockNavAnimation && category != currentCategory)
	{
		clearRevertTimeout();  // make sure nav doesn't revert back
		animateMainNavigation(category)
	} // if not lockNavAnimation
}
function animateMainNavigation(category)
{
	var blindDownTime = .3; // seconds
	var blindDownEasing = 'swing';
	
	blindDownTime = blindDownTime * 1000; // convert to miliseconds
	
	lockNavAnimation = true;
	
	//mainnav_sections.css('overflow', 'hidden');
	mainnav_sections.css('height', '0px');
	//mainnav_sections.css('width', '803px');
	
	swapNavContent(category);
	
	mainnav_sections.animate(
		{
			height:'120px'
		},
		blindDownTime, 
		blindDownEasing,
		function()
		{
			lockNavAnimation = false;
			//initNavAnimationForIE6();
		}
	);
}
function swapNavContent(category)
{
	//var newContent = category == '' ? '' : $('#'+category+'NavContent').html();
	var newContent = category == '' ? navContentInitial : $('#'+category+'NavContent').html();
	$('#onstatewrapper').html(newContent); // swap content
	currentCategory = category;
	$('#mainnav_categories > a').removeClass('current');
	$('#nav'+category+'link').addClass('current');	
}
/* Size Chart Scripts */
function hideSizeChart(popupId) {
	$("#"+popupId).hide();
}
/*
 * ShowSizeChart
 * 
 * @param category string that holds the category (eg 'mens')
 * @return hides all other popups and shows the correct size chart
 */
function showSizeChart(category, popup) {
	var popupId;
	
	popupId = category + "SizeChart";
	
	if (popup == 1)
	{
		// Show External Popup on pages like Bundle pages
		var width = 435;
		var height = 497;

		var LeftPosition = (screen.width) ? (screen.width-width)/2 : 0;
		var TopPosition = (screen.height) ? (screen.height-height)/2 : 0;
		var popupURL = '/web/popups/sizeChart_popupWindow.jsp?cat='+category;
		
		popupURL = popupURL;
		
		var popupWindow = window.open(popupURL,'sizeChart','toolbar=0,top='+TopPosition+',left='+LeftPosition+',width='+width+',height='+height+',location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0');
		popupWindow.location=popupURL;
		popupWindow.opener=self;
		popupWindow.focus();
	}
	else
	{
		// Show Internal Popup on PDP
		hideSizeChart(popupId);
		
		$("#"+popupId).show();
	}
}
function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
  var rv = -1; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}
// to limit characters in a textarea or text input field
// limitField : ID of form element to limit (string)
// limitCount : ID of element to place characters remaining count (string)
// limitNum : the maximum number of characters to allow in field (int)
function limitChars(limitField, limitCount, limitNum) {
	limitField = $('#'+limitField);
	limitCount = $('#'+limitCount);
	if (limitField.val().length > limitNum) {
		limitField.val(limitField.val().substring(0, limitNum));
		limitCount.html('0');
	} else {
		var count = limitNum - limitField.val().length;
		count = count === 0 ? '0' : count; // jQuery won't put the number value of 0 in the element using html(), so make a string
		limitCount.html(count);
	}
}
function freeshipping(promoName) {
	if (promoName != null && promoName.length > 0)
	{
		promoName = '?name='+promoName;
	}
	else
	{
		var promoName = '?name=freeshipping';
	}
	GenericPopup('/web/popups/freeShipping_popup.jsp'+promoName,700,400,'ShippingReturn');
}
function gwp() {
	GenericPopup('/web/popups/gwp_popup.jsp',479,620,'gwp');
}
function freeExpShipping() {
	GenericPopup('/web/popups/expeditedShipping_popup.jsp',480,325,'ShippingReturn');
}
// Create generic function for popups and webtrends
function holidayShipping() {
	GenericPopup('/web/popups/holidayShipping_popup.jsp',490,660,'HolidayShipping');
}

function holidayPopups(name)
{
	switch (name)
	{
		case "giftsOnTime":
			GenericPopup('/web/popups/gifting_popup.jsp?gifttype=giftsontime',738,499,'GiftsOnTime');	
			break;
		case "giftWrap":
			GenericPopup('/web/popups/gifting_popup.jsp?gifttype=giftwrap',738,499,'GiftWrap');
			break;
		default:
			GenericPopup('/web/popups/gifting_popup.jsp?gifttype=giftsontime',738,499,'GiftsOnTime');
			break;
	}
}
// Create generic function for popups and webtrends
function promoDetails(promoName, width, height) {
	if (promoName != null && promoName.length > 0)
	{
		promoName = "?name="+promoName;
	}
	else
	{
		var promoName = '';
	}
	
	if ( width === undefined ) {
      	width = 580;
   	}
	
	if ( height === undefined ) {
      	height = 300;
   	}

	GenericPopup('/web/popups/promoDetails_popup.jsp'+promoName,width,height,'PromoDetails');
}
//used in Cart.jsp to apply the promotion during proceed to checkout 
function scanProcessCheckout(e)
{
    if (nav4)
   		var whichCode=e.which;
	else
    	if (e.type=="keypress")
      		var whichCode=e.keyCode;
    	else
      		var whichCode=e.button;
 	if (whichCode==13)
	{
		return false;
	}
	else{ 
		document.addToCart.fCouponCode.value=document.addToCart.CouponCode.value;
		return true;
	}
}
function trim(str){
	while(''+str.charAt(0)==' ')
	str=str.substring(1,str.length);
	while(''+str.charAt(str.length-1)==' ')
	str=str.substring(0,str.length-1);
	return str;
}

var ie6SelectFix = (function() {
    if ($.browser.msie && ($.browser.version < 7)) {
    	$(document).ready(function() {
	        $(document.body).append('<style type="text/css">select.selectHide{visibility: hidden !important;}</style>');
	    });
        return function( toggle, scope ) {
            var bod = $(document.body);
            if (toggle == 'hide') {
                bod.find('select').addClass('selectHide');
            } else {
                if (!scope) {
                    scope = bod;
                }
                scope.find('select').removeClass('selectHide');
            }
        };
    } else {
        return function(){};
    }
})();
function parseQueryString( queryVal ) {
	/*
		parseQueryString - Extracts a query (key - value set) from the href of the current page; the href can also be overridden by passing a queryStr as the first parameter
		PARAMETERS:	queryVal - the href string to test; if none is supplied window.location.search is used
		RETURN:	a javascript object containing the query data
	*/
	queryVal = queryVal || window.location.search;
	if (queryVal) {
		var queryStart = queryVal.indexOf('?');
		if (queryStart !== -1) {
			queryVal = queryVal.substr(queryStart + 1);
			if (!queryVal) {
				return null;
			}
		} else {
			return null;
		}
		var data = {}, sets = queryVal.split('&');
		for (var i = 0, j = sets.length; i < j; i++) {
			var set = sets[i].split('=');
			if (set) {
				data[decodeURIComponent(set[0])] = (set[1])? decodeURIComponent(set[1]) : '';
			}
			set = null;
		}
		sets = null;
		return data;
	}
	queryVal = null;
	return null;
	
}
function generateQueryString( queryVal, locationVal ) {
	/*
		generateQueryString - Generates a query string from a set of data and a location
		PARAMETERS:	queryVal - the query data as a javascript object; the data can also be passed as a string
					locationVal - the href as a string; if empty, window.location.href is used and the new query is appended to any previously existing query
		RETURN:	the href including the query set as a string
	*/
	if (!locationVal) {
		locationVal = window.location.href;
	}
	if (queryVal) {
		var queryStart = locationVal.indexOf('?'), prevQuery = '';
		if (queryStart !== -1) {
			prevQuery = locationVal.substr(queryStart + 1);
			if (prevQuery && (prevQuery.charAt(prevQuery.length - 1) !== '&')) {
				locationVal += '&';
			}
		} else {
			locationVal += '?';
		}
		queryStart = prevQuery = null;
		var queryType = typeof queryVal;
		if (queryType == 'string') {
			locationVal += encodeURI(queryVal);
		} else if (queryType == 'object') {
			for (var i in queryVal) {
				locationVal += encodeURIComponent(i) + '=' + encodeURIComponent(queryVal[i]) + '&';
			}
			locationVal = stripLast(locationVal, '&');
		}
		queryType = null;
		locationVal = stripLast(locationVal, '?');
	}
	return locationVal;
}

////////FRAMEWORK FUNCTIONS ... EXTENDING JQUERY ////////
(function($) {
	
	$.fn.useAjax = function( ajaxOpts ) {
		var instance = this;
		
		var useOverlay = !!ajaxOpts.useOverlay;
		delete ajaxOpts.useOverlay;
		if (useOverlay) {
			(new Image()).src = jsImageSrcPrepend + '/Images/captainCheckout/checkout_step_loader.gif';
			$(document).ready(function() {
				if (!$('#ajaxOverlay').length) {
					if (!!$('#ajaxIconOverlay').length) {
						$('#ajaxIconOverlay').remove();
					}
					var overlayIconStyles = {
						position: 'absolute',
						zIndex: 90001
					},
					overlayStyles = {
						position: 'absolute',
						zIndex: 90000
					},
					overlayIconObj = $('<img id="ajaxIconOverlay" src="' + jsImageSrcPrepend + '/Images/captainCheckout/checkout_step_loader.gif" alt="loading..."/>').appendTo(document.body).hide(),
					overlayObj = $('<div id="ajaxOverlay"></div>').appendTo(document.body).hide();
					overlayIconObj.css(overlayIconStyles);
					overlayObj.css(overlayStyles);
					
					$(window).resize(function() {
						overlayIconObj.centerObj();
						overlayObj.stretchObj();
					});
				}
			});
			
			var successFunc = ajaxOpts.success,
			errorFunc = ajaxOpts.error || function() { window.location.href = '/' + jsContextRoot + '/global/unknownError.jsp'; };
			ajaxOpts.success = function() {
				$('#ajaxOverlay').hide();
				$('#ajaxIconOverlay').hide();
				successFunc.apply(instance, Array.prototype.slice.call(arguments));
			};
			ajaxOpts.error = function() {
				$('#ajaxOverlay').hide();
				$('#ajaxIconOverlay').hide();
				errorFunc.apply(instance, Array.prototype.slice.call(arguments));
			};
		}
		
		function AjaxOpts() {}
		AjaxOpts.prototype = ajaxOpts;
		
		return instance.each(function( i, formEl ) {
			var jQformEl = $(formEl);
			
			$('input:submit,input:image,button:submit', jQformEl).each(function( j, submitEl ) {
				var jQsubmitEl = $(submitEl);
				jQsubmitEl.unbind('click.ajax'); // just in case we are trying to bind the event to this more than once (could result in double submit)
				if (submitEl.type == 'image') {
					jQsubmitEl.bind('click.ajax', function( evt ) {
						formEl.submitData = {};
						formEl.submitData[submitEl.name] = submitEl.value;
						formEl.submitData[submitEl.name + '.x'] = 0;  // I mean really??? are these even necessary? answer according to atg... "yes"
						formEl.submitData[submitEl.name + '.y'] = 0;
					});
				} else {
					jQsubmitEl.bind('click.ajax', function( evt ) {
						formEl.submitData = {};
						formEl.submitData[submitEl.name] = submitEl.value;
					});
				}
			});
			jQformEl.unbind('submit.ajax'); // just in case we are trying to bind the event to this more than once (could result in double submit)
			jQformEl.bind('submit.ajax', function( evt ) {
				evt.preventDefault();
				
				if (useOverlay) {
					$('#ajaxOverlay').show().stretchObj();
					$('#ajaxIconOverlay').show().centerObj();
				}
				
				var ajaxOpts = new AjaxOpts(),
				fieldOpts = {},
				additionalOpts = ajaxOpts.data || {},
				submitOpts = formEl.submitData || {};
				
				$.each(jQformEl.serializeArray(), function( i, elData ) {
					fieldOpts[elData.name] = elData.value;
				});
				
				//  Validation form selector
				//  Don't like this existing here... but I don't know where else to put it.
				var uniqueIdVal = jQformEl.attr('id');
				if (!uniqueIdVal) {
					// Generate random id on the form
					while (!!$('#' + (uniqueIdVal = 'validationForm' + Math.round(Math.random() * 100000))).length) {}
					jQformEl.attr('id', uniqueIdVal);
				}
				submitOpts.validationFormSelector = '#' + uniqueIdVal;
				
				ajaxOpts.url = ajaxOpts.url || fieldOpts.ajaxSuccess || jQformEl.attr('action') || window.location.href;
				
				ajaxOpts.data = $.extend(fieldOpts, submitOpts, additionalOpts);
				
				$.ajax(ajaxOpts);
				
				setTimeout(function() {
					formEl.submitData = null;  // should be "delete formEl.submitData;", but IE doesn't like this for some reason... maybe because it is a DOM element.
				}, 0);
			});
		});
	};

	$.getViewSize = function() {
		/*
			getViewSize - Gets the current document view height and width
			PARAMETERS:	none
			RETURN:	an object containing the height and width of the current view
		*/
		
		function ViewSize() {
			/*
				ViewSize - The class used to define an object containing the current height and width of the document view (cross-browser compatible)
			*/
			var dDe = document.documentElement, dB = document.body, viewW = 0, viewH = 0;
			if (self.innerHeight) {
				viewW = self.innerWidth;
				viewH = self.innerHeight;
			} else if (dDe && dDe.clientHeight) {
				viewW = dDe.clientWidth;
				viewH = dDe.clientHeight;
			} else if (dB) {
				viewW = dB.clientWidth;
				viewH = dB.clientHeight;
			}
			this.x = this.X = this.w = this.W = viewW;
			this.y = this.Y = this.h = this.H = viewH;
		}
		
		return new ViewSize();
	};
	
	$.getPageSize = function() {
		/*
			getPageSize - Gets the current document body height and width
			PARAMETERS:	none
			RETURN:	an object containing the height and width of the current document
		*/
		
		function PageSize() {
			/*
				PageSize - The class used to define an object containing the current height and width of the document body (cross-browser compatible)
			*/
			var dB = document.body, pageW = 0, pageH = 0;
			if (dB.scrollHeight > dB.offsetHeight) {
				pageW = dB.scrollWidth;
				pageH = dB.scrollHeight;
			} else {
				pageW = dB.offsetWidth;
				pageH = dB.offsetHeight;
			}
			this.x = this.X = this.w = this.W = pageW;
			this.y = this.Y = this.h = this.H = pageH;
		}
		
		return new PageSize();
	};
	
	$.getPageOffset = function() {
		/*
			getPageOffset - Gets the current page offset height and width
			PARAMETERS:	none
			RETURN:	an object containing the y and x of the current page offset
		*/
		
		function PageOffset() {
			/*
				PageOffset - The class used to define an object containing the current height and width of the page offset (cross-browser compatible)
			*/
			var dDe = document.documentElement, dB = document.body, scrollW, scrollH;
			if (self.pageYOffset) {
				scrollW = self.pageXOffset;
				scrollH = self.pageYOffset;
			} else if (dDe && dDe.scrollTop) {
				scrollW = dDe.scrollLeft;
				scrollH = dDe.scrollTop;
			} else if (dB) {
				scrollW = dB.scrollLeft;
				scrollH = dB.scrollTop;
			}
			this.x = this.X = this.w = this.W = scrollW;
			this.y = this.Y = this.h = this.H = scrollH;
		}
		
		return new PageOffset();
	};
	
	$.fn.centerObj = function( pad, isFixed ) {
		/*
			centerObj - Centers a specific HTML element in the document view
			PARAMETERS:	pad - the minimum distance between an edge and the centered HTML element as an integer (of pixels)
						isFixed - whether or not an HTML element has position: fixed as a boolean
			RETURN:	none
		*/
		pad = $.forceInt(pad);
		var obj = $(this), suffix = 'px', sizes = $.getViewSize(), offsets = $.getPageOffset(),
		yVal = Math.round((sizes.h / 2) - (obj.outerHeight() / 2) + (isFixed ? 0 : offsets.h)),
		xVal = Math.round((sizes.w / 2) - (obj.outerWidth() / 2) + (isFixed ? 0 : offsets.w));
		
		obj.css({
			top: (((yVal > pad) || (pad < 0))? yVal : pad) + suffix,
			left: (((xVal > pad) || (pad < 0))? xVal : pad) + suffix
		});
	};
	
	$.fn.stretchObj = function( pad, isFixed ) {
		/*
			stretchObj - Stretches a specific HTML element across the document view
			PARAMETERS:	pad - the distance from an edge that the HTML element should stretch to as an integer (of pixels)
						isFixed - whether or not an HTML element has position: fixed as a boolean
			RETURN:	none
		*/
		var obj = $(this), suffix = 'px', pSizes = $.getPageSize(), vSizes = $.getViewSize(),
		hVal = (!isFixed && (pSizes.h > vSizes.h))? pSizes.h : vSizes.h,
		wVal = (!isFixed)? pSizes.w : vSizes.h;
		pad = $.forceInt(pad);
		
		obj.css({
			top: pad + suffix,
			left: pad + suffix,
			height: (hVal - (pad * 2)) + suffix,
			width: (wVal - (pad * 2)) + suffix
		});
	};
	
	$.toPrice = function( num, currency ) {
		/*
			toPrice - Converts a number value into a formatted price string; commas are added at thousand mark, decimals are forced to 2 digits, and the currency is added to the front of the string.
			PARAMETERS:	num - the price as a number
						currency - the currency as a string
			RETURN:	the price with a specific currency as a string
		*/
		if (num) {
			num = $.forceFloat(num).toFixed(2).toString();
			var intEnd = num.indexOf('.') - 3;
			for (var i = intEnd, j = 0; i > j; i -= 3) {
				num = num.substring(0, i) + ',' + num.substring(i, num.length);
			}
			num = num;
		} else {
			num = '0.00';
		}
		if (!currency || (typeof currency != 'string')) {
			currency = '$';
		}
		return currency + num;
	};
	
	$.forceInt = function( num ) {
		/*
			forceInt - Forces data of an undefined type into an integer value
			PARAMETERS:	num - should be an integer value, but may be of a different type
			RETURN:	an integer value
		*/
		return (isNaN(num = parseInt((typeof num == 'string')? num.replace(/\,/g,'').replace(/^.*?([\+\-]?[\d\.]+).*?$/, '$1') : num)))? 0 : num;
	};
	
	$.forceFloat = function( num ) {
		/*
			forceFloat - Forces data of an undefined type into an floating point value
			PARAMETERS:	num - should be an floating point value, but may be of a different type
			RETURN:	an floating point value
		*/
		return (isNaN(num = parseFloat((typeof num == 'string')? num.replace(/\,/g,'').replace(/^.*?([\+\-]?[\d\.]+).*?$/, '$1') : num)))? 0.0 : num;
	};
	
	$.setCookie = function( cookieOpts ) {
		/*
			setCookie - Sets a browser cookie
			PARAMETERS:	cookieOpts - the object containing the information to be set regarding the cookie
							ex: {
								name: [the name of the cookie as a string],
								val: [the value of the cookie as a string],
								path: [the path of the cookie as a string],
								domain: [the domain of the cookie as a string],
								expireDays: [the amount of days before the cookie expires as an integer or the amount of time as a date object],
								expireMins: [the amount of minutes before the cookie expires as an integer or the amount of time as a date object]
							}
			RETURN:	none
		*/
		if (!cookieOpts.val) {
			cookieOpts.val = '';
			cookieOpts.expireDays = 0;
		}
		var fullVal = '';
		if (!!cookieOpts.name) {
			fullVal = cookieOpts.name + '=' + cookieOpts.val;
			if (!!cookieOpts.path) {
				fullVal += ';path=' + cookieOpts.path;
			}
			if (!!cookieOpts.domain) {
				fullVal += ';domain=' + cookieOpts.domain;
			}
			if (!!cookieOpts.expireDays) {
				var expDate = new Date();
				expDate.setDate(expDate.getDate() + cookieOpts.expireDays);
				fullVal += ';' + expDate.toGMTString();
			} else if (!!cookieOpts.expireMins || !cookieOpts.val) {
				var expDate = new Date();
				expDate.setTime(expDate.getTime() + (cookieOpts.expireMins * 60000));
				fullVal += ';' + expDate.toGMTString();
			}
		}
		
		if (!!fullVal) {
			document.cookie = fullVal;
		}
	};
	
	$.getCookie = function( cookieName ) {
		/*
			getCookie - Gets the value of a specific cookie
			PARAMETERS:	cookieName - the name of the cookie as a string
			RETURN:	the cookie value as a string
		*/
		var dCookie = document.cookie;
		if ((dCookie.length > 0) && cookieName){
			var cBegin = dCookie.indexOf(cookieName += '=');
			if (cBegin != -1){
				cBegin = cBegin + cookieName.length;
				var cEnd = dCookie.indexOf(';', cBegin);
				if (cEnd == -1) cEnd = dCookie.length;
				return dCookie.substring(cBegin, cEnd);
			}
		}
		return '';
	};
	
})(jQuery);