<!--
function DetailValidation(txtid)
{
            
        try
         {
       
        
         window.document.Form2.elements[txtid].title="Product Quantity";
         window.document.Form2.elements[txtid].number=true;
        
         }
         catch(e)
         {
       // alert(e)
         }
      
return ValidateForm(window.document.Form2)
}

//-->
//Tee 6/1/2007 added attribute check
function ValidateAttributes(){
var line;
var input;
var ddl = document.getElementsByTagName("Select");
for (i=0;i<ddl.length;i++){
	if (ddl[i].options[0].text == "Lines/Font Size"){
		line = ddl[i].selectedIndex;
	}
}
input = document.getElementsByTagName("Span");
for (j=0;j<input.length;j++){
	if (input[j].innerHTML == "Text Line 1"){
		var ns = input[j].nextSibling;
		for (k=0;k<20;k++){
			if (ns.nextSibling.id && ns.nextSibling.id.indexOf("txtCustom") != -1){
				if (ns.nextSibling.value == ""){
					alert("Please fill in Text Line 1.");
					return false;
				}
			}else{
				ns = ns.nextSibling;
			}
		}
	}
	if (input[j].innerHTML == "Requested Date"){
		var ns = input[j].nextSibling;
		for (k=0;k<20;k++){
			if (ns.nextSibling.id && ns.nextSibling.id.indexOf("txtCustom") != -1){
				if (ns.nextSibling.value == ""){
					alert("Please fill in Requested Date.");
					return false;
				}
				return ValidateDate(ns.nextSibling.value);
			}else{
				ns = ns.nextSibling;
			}
		}
	}
	if (line == 2 || line == 4 || line == 9){
		if (input[j].innerHTML == "Text Line 2"){
			var ns = input[j].nextSibling;
			for (k=0;k<20;k++){
				if (ns.nextSibling.id && ns.nextSibling.id.indexOf("txtCustom") != -1){
					if (ns.nextSibling.value == ""){
						alert("Please fill in Text Line 2.");
						return false;
					}
				}else{
					ns = ns.nextSibling;
				}
			}
		}
	}
}

return SetValidationSearchResults('');
}
//Tee 5/24/2007 added preview
function PreviewRibbon(){
var line;
var ribbonColor;
var txtColor;
var txtCase;
var txt1;
var txt2;
var ftSize;
var ddl = document.getElementsByTagName("Select");
for (i=0;i<ddl.length;i++){
	switch (ddl[i].options[0].text){
		case "Lines/Font Size":
			if (ddl[i].selectedIndex == 0){
				alert("Please select Lines/Font Size.");
				return false;
			}
			line = ddl[i].selectedIndex;
			ftSize = GetFtSize(line);
		case "Ribbon Color":
			if (ddl[i].selectedIndex == 0){
				alert("Please select Ribbon Color.");
				return false;
			}
			ribbonColor = GetColor(ddl[i].options[ddl[i].selectedIndex].text);
		case "Text Color":
			if (ddl[i].selectedIndex == 0){
				alert("Please select Text Color.");
				return false;
			}
			txtColor = GetColor(ddl[i].options[ddl[i].selectedIndex].text);
		case "Text Case":
			if (ddl[i].selectedIndex == 0){
				alert("Please select Text Case.");
				return false;
			}
			txtCase = ddl[i].options[ddl[i].selectedIndex].text;
	}
}
var input = document.getElementsByTagName("Span");
for (j=0;j<input.length;j++){
	if (input[j].innerHTML == "Text Line 1"){
		var ns = input[j].nextSibling;
		for (k=0;k<20;k++){
			if (ns.nextSibling.id && ns.nextSibling.id.indexOf("txtCustom") != -1){
				txt1 = ns.nextSibling.value;
				if (txt1 == ""){
					alert("Please fill in Text Line 1.");
					return false;
				}
				if (txt1.length > GetCharLimit(line)){
					alert("Please limit the number of characters in Text Line 1 to maximum of " + GetCharLimit(line) + " characters.");
					return false;
				}
				if (txtCase == "Upper Case"){
					txt1 = txt1.toUpperCase();
				}
				break;
			}else{
				ns = ns.nextSibling;
			}
		}
	}
}
if (line == 2 || line == 4 || line == 9){
	for (j=0;j<input.length;j++){
		if (input[j].innerHTML == "Text Line 2"){
			var ns = input[j].nextSibling;
			for (k=0;k<20;k++){
				if (ns.nextSibling.id && ns.nextSibling.id.indexOf("txtCustom") != -1){
					txt2 = ns.nextSibling.value;
					if (txt2 == ""){
						alert("Please fill in Text Line 2.");
						return false;
					}
					if (txt2.length > GetCharLimit(line)){
						alert("Please limit the number of characters in Text Line 2 to maximum of " + GetCharLimit(line) + " characters.");
						return false;
					}
					if (txtCase == "Upper Case"){
						txt2 = txt2.toUpperCase();
					}
					break;
				}else{
					ns = ns.nextSibling;
				}
			}
		}
	}
}

var imgPreview = document.getElementById("ProductDetail21_imgPreview");
var newUrl = imgPreview.src.replace(/&bgcolor=[a-zA-Z0-9]+&/, "&bgcolor=" + ribbonColor + "&");
newUrl = newUrl.replace(/&line=[0-9]+&/, "&line=" + line + "&");
newUrl = newUrl.replace(/&txt1=.*?&txt2=/, "&txt1=" + window.escape(txt1) + "&txt2=");
if (line == 2 || line == 4 || line == 9){
	newUrl = newUrl.replace(/&txt2=.*?&txtCase=/, "&txt2=" + window.escape(txt2) + "&txtCase=");
}else{
	newUrl = newUrl.replace(/&txt2=.*?&txtCase=/, "&txt2=TextLine&txtCase=");
}
newUrl = newUrl.replace(/&ftcolor=[a-zA-Z0-9]+&/, "&ftcolor=" + txtColor + "&");
newUrl = newUrl.replace(/&ftSize=[0-9]+/, "&ftSize=" + ftSize);
imgPreview.src = newUrl;
return false;
}

function GetColor(colorName){
switch (colorName){
	case "Berry":
		return "9B1889";
	case "Black":
		return "000000";
	case "Blackgold":
		return "000000F7E847";
	case "Blue":
		return "373ED3"
	case "Bluegold":
		return "2F37D6F7E847";
	case "Brown":
		return "512A17";
	case "Canary":
		return "F8F78C";
	case "Caramel":
		return "A85A1E";
	case "Cornflwr":
		return "7F99CF";
	case "Copper":
		return "B2541A";
	case "Cream":
		return "FCF9D9";
	case "Dark Purple":
		return "722EA5";
	case "Forest":
		return "3B6E24";
	case "Gold":
		return "DECD6A";
	case "Gold(Athletic)":
		return "F7E847";
	case "Gray":
		return "D4D2B9";
	case "Green":
		return "79CA37";
	case "Gunmetal":
		return "83847A";
	case "Indigo":
		return "280091";
	case "Jade":
		return "31806C";
	case "Jewel":
		return "41E8EA";
	case "Lilac":
		return "F1C1EA";
	case "Ltblue":
		return "F3F5F9";
	case "Ltgreen":
		return "DAE58E";
	case "Maroon":
		return "963B59";
	case "Mocha":
		return "AB615E";
	case "Navy":
		return "10034A";
	case "Neon Yellow":
		return "FFFF00";
	case "Neon Cerise":
		return "EE4D9A";
	case "Neon Green":
		return "60FF00";
	case "Neon Orange":
		return "FF6D0D";
	case "Neon Pink":
		return "FF99CC";
	case "Orange":
		return "F06F30";
	case "Peach":
		return "FBD49D";
	case "Pink":
		return "FFDFFD";
	case "Prism":
		return "Rainbow";
	case "Purple":
		return "C3009E";
	case "Rainbow":
		return "000000";
	case "Red":
		return "E20C1B";
	case "Redgold":
		return "E20C1BF7E847";
	case "Rose":
		return "FFB7A8";
	case "Silver":
		return "E3E3E3";
	case "Tan":
		return "F0C391";
	case "Teal":
		return "045E54";
	case "Tomato":
		return "F06A56";
	case "Violet":
		return "8E66B3";
	case "White":
		return "FFFFFF";
	case "RedWhiteBlue":
		return "E20C1BFFFFFF2F37D6";
	default:
		return "bb1e3e";
}
}
function GetFtSize(line){
switch (line){
	case 1:
		return 26;
	case 2:
		return 26;
	case 3:
		return 33;
	case 4:
		return 33;
	case 5:
		return 40;
	case 6:
		return 48;
	case 7:
		return 54;
	case 8:
		return 18;
	case 9:
		return 18;
	default:
		return 26;
}
}
function GetCharLimit(line){
switch (line){
	case 1:
		return 16;
	case 2:
		return 16;
	case 3:
		return 11;
	case 4:
		return 11;
	case 5:
		return 9;
	case 6:
		return 7;
	case 7:
		return 7;
	case 8:
		return 22;
	case 9:
		return 22;
	default:
		return 16;
}
}
function ValidateDate(inDate){
var d = inDate;
/*
var m = /^(1[0-2]|[1-9]|0[1-9])\/(3[0-1]|2[0-9]|1[0-9]|0[1-9])\/2\d{3}$/.test(d);
*/
var m = /^(0[1-9]|1[012])[/-](0[1-9]|[12][0-9]|3[01])[/-](19|20)\d\d$/.test(d);
if (d.length == 0 || m == false){
	alert("Invalid Requested Date, please enter a valid date in MM/DD/YYYY or MM-DD-YYYY format.");
	return false;
}else{
	/*var userDate = new Date(d);
	var currDate = new Date();
	var nextMonthDate = new Date();
	nextMonthDate.setMonth(currDate.getMonth()+1);
	if (userDate > nextMonthDate){
		alert("Please enter a date that is within a month from today's date.");
		e.focus();
		return false;
	}else if (userDate < currDate){
		alert("Please enter a date later than today's date.");
		e.focus();
		return false;
	}*/
	$('hdRequestDate').value = inDate;
	return true;
}
}
//end Tee
