// JavaScript Document
function createCookie(name,value,hours) {
	if (hours) {
		var date = new Date();
		date.setTime(date.getTime()+(hours*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function testCookies()
{
	createCookie('test', '/', '')
	if (readCookie('test'))
	{
		//Cookies are Enabled
		eraseCookie('test')
	}
	else
	{
		//Cookies are Disabled
		alert( 'The site has detected that your browser does not currently have cookies enabled! Cookies need to be enabled in order for the Cart to operate correctly.')
	}
}

function leadingZeros(num, totalChars, padWith)
{
	num = num + "";
	padWith = (padWith) ? padWith : "0";
	if (num.length < totalChars)
	{
		while (num.length < totalChars)
		{
			num = padWith + num;
		}
	}
}