function radioBtnChecked(set) {
	var checkedOption = -1; 
	var btn=document.getElementsByName(set);
	
	for (var i=0; i < btn.length; i++) {
	   if (btn[i].checked) {
			checkedOption = i;
		}
	}

	if (checkedOption == -1) {
		return "";
	}else{
		return btn[checkedOption].value;
	}
}

function IsNumeric(val){
	return(parseFloat(val,10)==(val*1));
}

function checkemail(str){
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(str)){
		return true;
	}else{
		return false;
	}
}

function buildDate(dtName){
	m = document.getElementById(dtName + "M").value;
	d = document.getElementById(dtName + "D").value;
	y = document.getElementById(dtName + "Y").value;
	if (y != "" && IsNumeric(y)== false){
		alert ("Please enter a numeric values for Years (yyyy).");
		return false;
	}	
		
	if ((m != "")&&(d != "")&&(y != "")) {
		dtStr = m + "/" + d + "/" + y;
	}else{
		dtStr = "";
	}
	document.getElementById(dtName + "Date").value = dtStr;
	return true;
}

function setUpDate(dtName){
	
	dtStr = document.getElementById(dtName + "Date").value;
		
	if (dtStr != ""){
		document.getElementById(dtName + "M").value = dtStr.substring(0, dtStr.indexOf('/'));
		document.getElementById(dtName + "D").value = dtStr.substring(dtStr.indexOf('/')+1, dtStr.lastIndexOf('/'));
		document.getElementById(dtName + "Y").value = dtStr.substring(dtStr.lastIndexOf('/')+1);	
	}
}

function addToCartMsg(){
	if (document.form1.readyToAdd.value == "t"){
		var oPopup = window.createPopup();
		var oPopBody = oPopup.document.body;
		oPopBody.style.backgroundColor = "#EFE3B4";
		oPopBody.style.border = "solid white 1px";
		oPopBody.style.font = '10pt sans-serif';
		oPopBody.style.color = '#55460A';
		oPopBody.style.margin = 5;
		oPopBody.innerHTML = "<strong>You've completed all the design steps!</strong> <br> When you're ready, click the Add to Cart button at the bottom of the screen to complete your order.";
		oPopup.show(580, 420, 320, 60, document.body);
	}
}