function Roll(img,oldstate,newstate)
{
	img.src = img.src.replace(oldstate,newstate);
}

function chkQty(q)
{
	if (q.value == "")
	{
		alert("Please enter a quantity");
		return false;
	}
	else
	{
		if (isNumeric(q.value))
			return true;
		else
		{
			alert("Please enter a valid quantity.");
			return false;
		}
	}
}

function openWindow(type)
{
	var newwin;
	switch(type)
	{
		case "shiprates":
			newwin = window.open("/help/shiprates.html","ShipRates","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=300,height=400,left=150,top=150,alwaysRaised=1");
			newwin.focus();
		break;
		
		case "shiptimes":
			newwin = window.open("/help/shiptimes.html","ShipTimes","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=300,height=400,left=150,top=150,alwaysRaised=1");
			newwin.focus();
		break;
		
		case "cvv":
			newwin = window.open("/help/cvv.html","CVV","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=300,height=400,left=150,top=150,alwaysRaised=1");
			newwin.focus();
		break;
	}
}

function isNumeric(strString)
{
	var strValidChars = "0123456789.-";
	var strChar;
	var blnResult = true;

	if (strString.length == 0) return false;

	//  test strString consists of valid characters listed above
	for (i = 0; i < strString.length && blnResult == true; i++)
	{
		strChar = strString.charAt(i);
		if (strValidChars.indexOf(strChar) == -1)
		{
			blnResult = false;
		}
	}
	return blnResult;
}

function viewLargerProduct(pid,wide)
{
	var newwin;
	if (wide == "1")
		newwin = window.open('/shop/pzoom.aspx?pid=' + pid,'productzoom','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=513,height=412,left=150,top=150,alwaysRaised=1');
	else
		newwin = window.open('/shop/pzoom.aspx?pid=' + pid,'productzoom','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=453,height=412,left=150,top=150,alwaysRaised=1');
	newwin.focus();

}

function viewLargerFittingRoom(id)
{
	var newwin;
	newwin = window.open('/images/sub/fittingroom/fitting_rooms_' + id + 'a.jpg','fittingroomlarge','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=460,height=350,left=150,top=150,alwaysRaised=1');
	newwin.focus();

}

function openRearStorage(type)
{
	var iWidth,iHeight;
	switch(type)
	{
		case "Extra_Vision":
			iHeight = 350;
			iWidth = 348;
		break;
		case "Full_Vision":
			iHeight = 635;
			iWidth = 368;
		break;
		case "One_Third_Vision":
			iHeight = 600;
			iWidth = 628;
		break;
		case "Half_Vision":
			iHeight = 600;
			iWidth = 628;
		break;
		case "Clip_Corner":
			iHeight = 350;
			iWidth = 356;
		break;
	}
	var newwin = window.open('/showcases/rearview.aspx?type=' + type,'rearview','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=' + iWidth + ',height=' + iHeight + ',left=150,top=150,alwaysRaised=1');
	newwin.focus();
}

function sendEmail(email)
{
	var ea = email.value;
	var m = "1100455313021";
	var p = "oi";
	var go = "Go";
	
	var newwin = window.open('http://ui.constantcontact.com/d.jsp?m=' + m + '&p=' + p + '&ea=' + ea + '&go=' + go,'nwin');
	newwin.focus();
}

function GenerateGetElement()
{
	if (document.getElementById) return function(id) { return document.getElementById(id); }
	else if (document.all) return function(id) { return document.all[id]; }
	else if (document.layers) return function(id) { document.layers[id]; }
}
var GetElement = GenerateGetElement();


function WebForm_FireDefaultButton(event, buttonName)
{
	if (event.keyCode == 13)
	{
		var defaultButton = GetElement(buttonName);
		if (defaultButton)
		{
			if (typeof(defaultButton.onclick) != "undefined") defaultButton.onclick();
			window.location = defaultButton.href;
			event.cancelBubble = true;
			if (event.stopPropagation) event.stopPropagation();
			return false;
		}
	}
	return true;
}