var Expiration = 365*24*60*60*1000   // 365*24*60*60*1000 = expire in 1 year
function SelectSize(index) {
	window.status = pricelist[document.frmDetails.size.options.selectedIndex];
	document.frmDetails.cost.value = convdec(pricelist[document.frmDetails.size.options.selectedIndex]);
	document.frmDetails.itemid.value = items[document.frmDetails.size.options.selectedIndex];
	document.frmDetails.sizename.value = document.frmDetails.size.options[document.frmDetails.size.options.selectedIndex].text;
	return true;
}

function sendForm(mode)	{
	if (mode == 'save') document.frmCartDetail.mode.value = 'savedetail';
	if (mode == 'cancel') document.frmCartDetail.mode.value = 'canceldetail';


//	for (var c = 0; c < CurrentForm.color.length; c++) {
//		if (CurrentForm.color[c].checked) {
//      	SelectedColor = CurrentForm.color[c].value
//			FoundColor = true;
//			break;
//		}



	document.frmCartDetail.submit();
}

function SelectColor(frmName, objName, objIndex) {
	if (frmName.totalcolors.value > 1) {
		objName[objIndex].checked=1;
	} else {
		objName.checked=1;
	}
}

function HelpColor(color)	{
	window.status='Click here to select ' + color + ' color';
	return true;
}

function setCurrState(CookieName, Setting, Expiration) {	// 7*24*60*60*1000 = expire in 1 week
	var label = CookieName + "="; var expire = new Date();
	expire.setTime(expire.getTime() + Expiration);
	document.cookie = label + escape(Setting) + "; expires=" +
	expire.toGMTString();
}

function OpenConfirm(Param) {
	var uid = '<% =uid %>';
	WinConfirm = window.open("/clothing/est2.asp?uid=" + uid + Param, "confirm","height=155,width=300");
}

function ValidateForm(CurrentForm, mode) {
/*
	var FoundColor = false;

	for (var c = 0; c < CurrentForm.color.length; c++) {
		if (CurrentForm.color[c].checked) {
      	SelectedColor = CurrentForm.color[c].value
			FoundColor = true;
			break;
		}
	}

	if (FoundColor == false) {
		if (CurrentForm.color.length == null) {
///			if (RadioIndex != 0) document.forms[FormIndex + 4].color.checked = 1;
		alert(document.CurrentForm.color.checked )
			document.CurrentForm.color.checked = 1;
		} else {
			alert('Please select a color of your choice for the current item.\n' + CurrentForm.color.length);
		}
		return false;
	} else {

	if (mode == 'b') {
		CurrentForm.mode.value = 'addnew';
		CurrentForm.action = 'additem.asp';
	}
*/
	if (mode == 'q') {
///		CurrentForm.mode.value = 'quote';
		CurrentForm.action = 'quote.asp';
	}

	CurrentForm.submit();
	return false;
//	}
}

function AddItem(CurrentForm, mode) {
//		today = new Date()
//		var ID = today.getTime()

	var uid = '<% =uid %>';
	var Basket = ' ';
	var Param = ' ';
	var SelectedColor = 0;
	var FoundColor = false;
	var txt = 'This is the results of your form:\n\n';

	for (var c = 0; c < CurrentForm.color.length; c++) {
		if (CurrentForm.color[c].checked) {
      	SelectedColor = CurrentForm.color[c].value
			FoundColor = true;
			break;
		}
	}
	Param = "&item=" + CurrentForm.ItemNumber.value + "&color=" + SelectedColor;
	txt = txt + 'Total buttons in the form: ' + CurrentForm.color.length + '\n';
	txt = txt + 'Selected item is: ' + CurrentForm.ItemNumber.value + '\n';
	txt = txt + 'Selected color is: ' + SelectedColor + '\n';

	if (FoundColor == false) {
		alert('Please select a color of your choice for the current item.');
		return false;
	} else {
//			alert(Basket);
			Basket = mode + '_i-' + CurrentForm.ItemNumber.value + '_c-' + CurrentForm.color[c].value;
//			setCurrState('qt', Basket, Expiration);
			document.location = "/clothing/est2.asp?uid=" + uid + Param;
			return true;
//			OpenConfirm(Param);
	}
}

// setCurrState(this.form.cookname.value, this.form.cookvalue.value, (60*60*1000))
