// ActionScript Document
var addCharge = 0;
var sizeCharge = 0;
var shirtCharge = 0;
var originalAmt;
var originalItem;
var gDescription;
var gShirtNumber;
var gDesignLocation;
var gWineType;
var gOnBack;
var gPersonalTxt;
var gCrystal;
var gNameCrystal;
var gBackgroundCrystal;
var PromoFlag;
var FundFlag;
var gCustomTextFlag = false;
var gAddNameValue = 0;
var gAddPNameValue = 0;
var gAddPNumberValue = 0;
var gBackName = '';
var gBackNum = '';
var gFootballDesc = '';
var gAddBackValue = 0;
var gPromoText = '';
var gChainCost = 0;
var gChainLength = '';
var gFontStyle = '';
var gDiscount = '';
var gCustomTextLen = 0;


function right(e) {
	if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2))
		return false;
	else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
		alert('Sorry, you do not have permission to right click.');
		return false;
	}
	return true;
}

document.onmousedown=right;
document.onmouseup=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;

function onKeyPress () {
var keycode;
		if (window.event)
			 keycode = window.event.keyCode;
		else if (e) 
			keycode = e.which;
		else 
			return true;
		if (keycode == 13) {
			return false
		}
			return true 
}
document.onkeypress = onKeyPress;


  function checkCRU(evt) {

    var evt  = (evt) ? evt : ((event) ? event : null);

    if (evt.keyCode == 44)  {
		alert('Print screen is prohibited!'); 
//		while(true){
//	  		alert('Print screen is prohibited!'); }
	}
  }

  document.onkeyup = checkCRU;
  



function AddBackString(input, output){
var i, s;
	s = input.value;
	i = s.length - removeSpace(s);
	if (input.name == 'pName'){
			gAddPNameValue  = i * 6;
			gBackName = ' Back-Name: ' + input.value;
	}else{
		gAddPNumberValue = i * 18;
		gBackNum= ' Back#: ' + input.value;
	}
	updateItemName();
	document.Form1.amount.value = calculateAmount();
}

function AddString(input, output){
var i, s;
	// set the display for paypal.. item name - personalization
	gPersonalTxt =  ' Text: ' + input.value;
	updateItemName();
	s = input.value;
	i = s.length - removeSpace(s);
	gAddNameValue = 2 * i;
	//increase the value to include personalization
	document.Form1.amount.value = calculateAmount();
}


function calculateAmount(){
var i, amt, p, retVal, sDisc, iDisc;
	if(PromoFlag){
		i = originalAmt + shirtCharge + sizeCharge + gAddNameValue +gAddPNameValue + gAddPNumberValue + gAddBackValue + gChainCost + gCustomTextLen;
		p =  i * .9;
		amt = p.toString();
		retVal = amt.substring(0,5);
		iDisc =  i * .1;
		sDisc = iDisc.toString();
		gDiscount = ' (' + sDisc.substring(0,5) + ')';
	}else{
		retVal = originalAmt + shirtCharge + sizeCharge + gAddNameValue + gAddPNameValue + gAddPNumberValue + gAddBackValue + gChainCost + gCustomTextLen;
	}
	return(retVal);
}

function chgColorOff(){
	var e = window.event.srcElement;
		e.style.background = '#000000';
	    e.style.color = '#FFCCFF';
}


function chgColorOn(){
	var e = window.event.srcElement;
		e.style.background = '#FFCCFF';
	    e.style.color = '#000000';
}

function CheckPromotion(code, amount){
var  s1, s2;
	s1 = code.value;
	s2 = s1.toUpperCase();
	PromoFlag = false;
	FundFlag = false;
	if(s1.length > 0){
		if((s2.indexOf('BAH51',0) == 0) || (s2.indexOf('AU2007',0) == 0)){
			PromoFlag = true;
			FundFlag = false;
			document.all.ValidPromo.style.zindex = '10';
			document.all.ValidPromo.style.display = 'block';
 			document.all.InValidPromo.style.zindex = '-1';
			document.all.InValidPromo.style.display = 'none';
  			document.all.SchoolPromo.style.zindex = '-1';
			document.all.SchoolPromo.style.display = 'none';
			gPromoText = '- Promo Discount: ' + getPromoName(s2);
		}else{
   			document.all.SchoolPromo.style.zindex = '-1';
			document.all.SchoolPromo.style.display = 'none';
			document.all.InValidPromo.style.zindex = '10';
			document.all.InValidPromo.style.display = 'block';
  			document.all.ValidPromo.style.zindex = '-1';
			document.all.ValidPromo.style.display = 'none';
			gPromoText = '';
			amount.value = calculateAmount();
			promoFlag = false;
			FundFlag = false;
		}
		amount.value = calculateAmount();
		updateItemName();
		
	}
}

function updatePromoText(amt, type){
	if (type == 'P'){	
		gPromoText = gPromoText + ' You saved $' + convertAmt(amt);
	}else{
		gPromoText = gPromoText + ' You contributed $' + convertAmt(amt);
	}
}

function getPersonalTxt(input){
var i, s;
	// set the display for paypal.. item name - personalization
	gPersonalTxt =  ' Custom Text: ' + input.value + '-';
	updateItemName();
	s = input.value;
	i = s.length - removeSpace(s);
	gCustomTextLen = i;
	if ((i - 5) < 0 )
		i = 0;
	else
		i -= 5;
	//alert('letters charged: '+i);
	gAddNameValue = 2 * i;
	//increase the value to include personalization
	document.Form1.amount.value = calculateAmount();
}


function getCustomPersonalTxt(input){
var i, s;
	// set the display for paypal.. item name - personalization
	gPersonalTxt =  ' Custom Text: ' + input.value + '-';
	updateItemName();
	s = input.value;
	i = s.length - removeSpace(s);
	gCustomTextLen = i;
	if ((i - 5) < 0 )
		i = 0;
	else
		i -= 5;
	//alert('letters charged: '+i);
	gAddNameValue = 2 * i;
	//increase the value to include personalization
	document.Form1.amount.value = calculateAmount();
	gCustomTextFlag = true;
	
}


function getPromoName(pCode){
	if((pCode.indexOf('BAH51',0) == 0)){
		return('BAH');
	}
	else if((pCode.indexOf('CHSBC',0) == 0)){
		return('CHS');
	}
	else if((pCode.indexOf('AU2007',0) == 0)){
		return('Aug-07');
	}
	else if((pCode.indexOf('KN311',0) == 0)){
		return(' Pink Ribbon Runway');
	}
	else{
		return('unknown');
	}
	
}


function initElements(){
 var el = document.forms[0].elements;
 for(var i = 0 ; i < el.length ; ++i) {
 	if(el[i].type == "radio") {
  	 		var radiogroup = el[el[i].name]; // get the whole set of radio buttons.
   			for(var j = 0 ; j < radiogroup.length ; ++j) {
    			radiogroup[j].checked = false;
			} // end for j
	} //end if radio
	else if (el[i].type == 'text'){
  	 		if(el[i].name == 'PText'){ 
    			document.Form1.PText.value = '';
			} // end if ptext
  	 		else if(el[i].name == 'bName'){ 
				document.Form1.bName.value = '';
			} // end if bname
  	 		else if(el[i].name == 'pName'){ 
				document.Form1.pName.value = '';
			} // end if bname
  	 		else if(el[i].name == 'pNum'){ 
				document.Form1.pNum.value = '';
			} // end if bname
	}// if input
   }// end for i
   return;
}


function initVars(){
	originalAmt = parseFloat(document.Form1.dAmount.value);
	gDescription = '';
	gDesignLocation = '';
	gOnBack = '';
	gCrystal = '';
	gNameCrystal = '';
	gBackgroundCrystal = '';
	originalItem =  'Item: (' + document.Form1.dName.value + ')';
	gPersonalTxt = '';
	gBackName = '';
	gBackNum = '';
	gPromoText = '';
	gFontStyle = '';
	gWineType = '';
	PromoFlag = false;
 	FundFlag = false;
	gDiscount = '';
	gCustomTextLen = 0;

	initElements();
	document.Form1.code.value = '';
//	document.Form1.fballRequired.value = 'none';
//	document.Form1.os1.value = 'Black';
//	document.Form1.os0.value = 'small';

}


function PopUpWindow(url,type) {
	if (type == 'shirt'){
    	newwindow = window.open(url, 'Detail', 'status=yes,location=no,scrollbars=yes,resizable=no,width=700,height=500');
	}else{
    	newwindow = window.open(url, 'Detail', 'status=yes,location=no,scrollbars=yes,resizable=no,width=600,height=600');
	}
    newwindow.focus()
	
  }

function removeSpace(t1){
var space = ' '; // character to remove from string
var i, spcount;

	for ( i = 0, spcount = 0; i<t1.length; i++){
			if( t1.charAt(i) == space){
				spcount+= 1;
			}
	}
	return(spcount);
}


function setCrystalColor(sColor){
	gCrystal = ' Crystal Color: ' + sColor.toUpperCase();
	updateItemName();
	return;
}

function setLeotardCrystalColor(sColor){
	gCrystal = ' Leotard  Color: ' + sColor.toUpperCase();
	updateItemName();
	return;
}


function setMirrorCrystalColor(sColor, sLoc){
	gCrystal = '';
	if (sLoc == 'Name'){
		gNameCrystal = ' Name color:' + sColor.toUpperCase();
	}
	else if (sLoc == 'Background'){
		gBackgroundCrystal = ' Background color:' + sColor.toUpperCase();
	}
	gCrystal = gNameCrystal + gBackgroundCrystal;
	updateItemName();
	return;
	
}
function setFontStyle(sFontStyle){
	gFontStyle = ' (' + sFontStyle + ')';
	if (sFontStyle == 'Script'){
		alert('There is an additional $'+ gCustomTextLen +'.00' + ' the script font.');
	}else{
		gCustomTextLen = 0;
		document.Form1.amount.value = calculateAmount();
	}
	updateItemName();
	return;

}

function updateItemName(){
	document.Form1.item_name.value = originalItem + gOnBack +  gPersonalTxt +  gFontStyle + gBackName + gBackNum +
									gCrystal + gDescription + gDesignLocation + gWineType +gPromoText  + gChainLength;
	return;
}

function updateBasePrice(nPrice){
	originalAmt = parseFloat(nPrice);
	return;
}

function hideAllSizeColor(){
	document.all.std.style.zindex = '-1';
	document.all.std.style.display = 'none';
	document.all.Gil1200.style.zindex = '-1';
	document.all.Gil1200.style.display = 'none';
	document.all.hanesS10C.style.zindex = '-1';
	document.all.hanesS10C.style.display = 'none';
	document.all.anvil1444.style.zindex = '-1';
	document.all.anvil1444.style.display = 'none';
	document.all.anvil1452.style.zindex = '-1';
	document.all.anvil1452.style.display = 'none';
	document.all.anvil1415.style.zindex = '-1';
	document.all.anvil1415.style.display = 'none';
	document.all.anvil1441.style.zindex = '-1';
	document.all.anvil1441.style.display = 'none';
	document.all.GR101.style.zindex = '-1';
	document.all.GR101.style.display = 'none';
	document.all.GR103.style.zindex = '-1';
	document.all.GR103.style.display = 'none';
	document.all.hanesS14C.style.zindex = '-1';
	document.all.hanesS14C.style.display = 'none';
	document.all.hanesS22C.style.zindex = '-1';
	document.all.hanesS22C.style.display = 'none';
	document.all.DT301.style.zindex = '-1';
	document.all.DT301.style.display = 'none';
	document.all.L290.style.zindex = '-1';
	document.all.L290.style.display = 'none';
	document.all.L340C.style.zindex = '-1';
	document.all.L340C.style.display = 'none';
	document.all.L341V.style.zindex = '-1';
	document.all.L341V.style.display = 'none';
	document.all.lat3642.style.zindex = '-1';
	document.all.lat3642.style.display = 'none';
	document.all.lat3633.style.zindex = '-1';
	document.all.lat3633.style.display = 'none';
	document.all.gildan2400.style.zindex = '-1';
	document.all.gildan2400.style.display = 'none';
	document.all.anvil479B.style.zindex = '-1';
	document.all.anvil479B.style.display = 'none';
	
}

function setShirtStyle(s, output){
var sName, sdesc;
//alert(s);
		//eval to see if addtional charge will be added  "hanes-S10C" 
		hideAllSizeColor();
		document.Form1.os1.value = 'none selected';
		document.Form1.os0.value = 'none selected';
		if(s == 'anvil-1444'){
			document.all.anvil1444.style.zindex = '10';
			document.all.anvil1444.style.display = 'block';
			sdesc = ' Long sleeve ';
			shirtCharge =  2.00;
			sName = ' for the long sleeve shirt.';
		}else if(s == 'GR101'){
			sdesc = ' Spandex Jersey ';
			document.all.GR101.style.zindex = '10';
			document.all.GR101.style.display = 'block';
			shirtCharge =  4.00;
			sName = ' for the Spandex Jersey shirt.';
		}else if(s == 'GR103'){
			document.all.GR103.style.zindex = '10';
			document.all.GR103.style.display = 'block';
			sdesc = ' Spandex Cami ';
			shirtCharge =  2.00;
			sName = ' for the Spandex cami shelf-bra.';
		}else if(s == 'hanes-S10C'){
			shirtCharge =  0;
			document.all.hanesS10C.style.zindex = '10';
			document.all.hanesS10C.style.display = 'block';
			sdesc = ' Scoop-Neck Loose Fit ';
		}else if(s == 'dt-301'){
			shirtCharge =  24.00;
			document.all.DT301.style.zindex = '10';
			document.all.DT301.style.display = 'block';
			sdesc = ' cotten/Spandex Sport Shirt ';
			sName = ' for the cotten/Spandex Sport Shirt.';
		}else if(s == 'L290'){
			shirtCharge =  40.00;
			document.all.L290.style.zindex = '10';
			document.all.L290.style.display = 'block';
			sdesc = ' Sueded Fleece ';
			sName = ' for the Sueded Finish Fleece.';
		}else if(s == 'L340C'){
			shirtCharge =  27.00;
			document.all.L340C.style.zindex = '10';
			document.all.L340C.style.display = 'block';
			sdesc = ' Scoop Neck Spandex Long Sleeve  ';
			sName = ' for the Cotton/Spandex Long Sleeve Shirt.';
		}else if(s == 'L341V'){
			shirtCharge =  28.00;
			document.all.L341V.style.zindex = '10';
			document.all.L341V.style.display = 'block';
			sdesc = ' Spandex V-Neck 3/4 Sleeve ';
			sName = ' for the Cotton/Spandex V-Neck 3/4 Sleeve Shirt.';
		}else if(s == 'L485'){
			shirtCharge =  28.00;
			document.all.L485.style.zindex = '10';
			document.all.L485.style.display = 'block';
			sdesc = ' Spandex Scoop Neck 3/4 Sleeve ';
			sName = ' for the Cotton/Spandex 3/4 Sleeve Shirt.';
		}else if(s == 'hanes-S14C'){
			shirtCharge =  0;
			document.all.hanesS14C.style.zindex = '10';
			document.all.hanesS14C.style.display = 'block';
			sdesc = ' Tank Top ';
		}else if(s == 'hanes-S22C'){
			shirtCharge =  0;
			document.all.hanesS22C.style.zindex = '10';
			document.all.hanesS22C.style.display = 'block';
			sdesc = ' V-Neck Loose Fit ';
		}else if(s == 'gil-1200'){
			shirtCharge =  5.00;
			document.all.Gil1200.style.zindex = '10';
			document.all.Gil1200.style.display = 'block';
			sdesc = 'Fleece Sweatshirt ';
			sName = ' for the Fleece Sweatshirt.';
		}
		else if(s == 'anvil-1452'){
			shirtCharge =  0;
			document.all.anvil1452.style.zindex = '10';
			document.all.anvil1452.style.display = 'block';
			sdesc = ' V-Neck Fitted' ;
		}
		else if(s == 'anvil-1415'){
			shirtCharge =  0;
			document.all.anvil1415.style.zindex = '10';
			document.all.anvil1415.style.display = 'block';
			sdesc = ' Tank Top Fitted' ;
		}
		else if(s == 'anvil-479B'){
			shirtCharge =  0;
			document.all.anvil479B.style.zindex = '10';
			document.all.anvil479B.style.display = 'block';
			sdesc = ' Youth Long Sleeve ' ;
		}
		else if(s == 'gildan-2400'){
			shirtCharge =  0;
			document.all.gildan2400.style.zindex = '10';
			document.all.gildan2400.style.display = 'block';
			sdesc = ' Youth Long Sleeve ' ;
		}
		else if(s == 'anvil-1441'){
			shirtCharge =  0;
			document.all.anvil1441.style.zindex = '10';
			document.all.anvil1441.style.display = 'block';
			sdesc = ' Scoop Neck Fitted' ;
		}
		else if(s == 'lat-3642'){
			shirtCharge =  0;
			document.all.lat3642.style.zindex = '10';
			document.all.lat3642.style.display = 'block';
		}
		else if(s == 'lat-3633'){
			shirtCharge =  0;
			document.all.lat3633.style.zindex = '10';
			document.all.lat3633.style.display = 'block';
		}
		else{
			shirtCharge =  0;
			document.all.std.style.zindex = '10';
			document.all.std.style.display = 'block';
		}
		//inform user and update amount
		
		if(shirtCharge != 0){
			alert('There is an additional $'+ shirtCharge+'.00' + sName);
		}
		gDescription = ' - Shirt # ' + s + sdesc +'-  ';
		// set the value that will be passed to paypal
		updateItemName();
		document.Form1.amount.value = calculateAmount();
}

function setShirtSize(sName){
var s;
	// get the size selected for that shirttype
	if(sName == 'hanes-S10C'){
		s = document.Form1.selsizeHanesS10C.value;
	}
	else if(sName == 'hanes-S14C'){
		s = document.Form1.selsizeHanesS14C.value;
	}
	else if(sName == 'hanes-S22C'){
		s = document.Form1.selsizeHanesS22C.value;
	}
	else if(sName == 'gil-1200'){
		s = document.Form1.selsizeGil1200.value;
	}
	else if(sName == 'dt-301'){
		s = document.Form1.selsizeDT301.value;
	}
	else if(sName == 'L290'){
		s = document.Form1.selsizeL290.value;
	}
	else if(sName == 'L340C'){
		s = document.Form1.selsizeL340C.value;
	}
	else if(sName == 'L341V'){
		s = document.Form1.selsizeL341V.value;
	}
	else if(sName == 'L485'){
		s = document.Form1.selsizeL485.value;
	}
	else if(sName == 'anvil-1444'){
		s = document.Form1.selsizeAnvil1444.value;
	}
	else if(sName == 'anvil-1441'){
		s = document.Form1.selsizeAnvil1441.value;
	}
	else if(sName == 'anvil-1452'){
		s = document.Form1.selsizeAnvil1452.value;
	}
	else if(sName == 'anvil-1415'){
		s = document.Form1.selsizeAnvil1415.value;
	}
	else if(sName == 'anvil-479B'){
		s = document.Form1.selsizeAnvil479B.value;
	}
	else if(sName == 'gildan-2400'){
		s = document.Form1.selsizegildan2400.value;
	}
	else if(sName == 'GR101'){
		s = document.Form1.selsizeGR101.value;
	}
	else if(sName == 'GR103'){
		s = document.Form1.selsizeGR103.value;
	}
	else if(sName == 'lat3642'){
		s = document.Form1.selsizeLat3642.value;
	}
	else if(sName == 'lat3633'){
		s = document.Form1.selsizeLat3633.value;
	}
	else{
		s = document.Form1.selsizestd.value;
	}
	// if additional charge, indicate to user
	if (s == '2XL' || s == '3XL'){
		sizeCharge = 5.00;
	}
	else{
		sizeCharge = 0;
	}
	if(sizeCharge != 0){
		alert('There is an additional charge of $5.00 for this size shirt.')
	}
	// set the hidden value to be sent to Paypal
	document.Form1.os0.value = s;
	document.Form1.amount.value = calculateAmount();
}

function setShirtColor(sName){
var s;
	// get the size selected for that shirttype
	if(sName == 'hanes-S10C'){
		s = document.Form1.selcolorHanesS10C.value;
	}
	else if(sName == 'hanes-S14C'){
		s = document.Form1.selcolorHanesS14C.value;
	}
	else if(sName == 'dt-301'){
		s = document.Form1.selcolorDT301.value;
	}
	else if(sName == 'L290'){
		s = document.Form1.selcolorL290.value;
	}
	else if(sName == 'L340C'){
		s = document.Form1.selcolorL340C.value;
	}
	else if(sName == 'L341V'){
		s = document.Form1.selcolorL341V.value;
	}
	else if(sName == 'L485'){
		s = document.Form1.selcolorL485.value;
	}
	else if(sName == 'hanes-S22C'){
		s = document.Form1.selcolorHanesS22C.value;
	}
	else if(sName == 'gil-1200'){
		s = document.Form1.selcolorGil1200.value;
	}
	else if(sName == 'anvil-1444'){
		s = document.Form1.selcolorAnvil1444.value;
	}
	else if(sName == 'anvil-1415'){
		s = document.Form1.selcolorAnvil1415.value;
	}
	else if(sName == 'anvil-1452'){
		if ((document.Form1.selsizeAnvil1452.value == 'XLarge') && (document.Form1.selcolorAnvil1452.value == 'Red')){
			alert('The color Red for this style shirt is NOT available in XLarge');
			document.Form1.selsizeAnvil1452.focus();
		}else{
			s = document.Form1.selcolorAnvil1452.value;
		}
	}
	else if(sName == 'anvil-1441'){
		if (((document.Form1.selsizeAnvil1441.value == '2XL') || (document.Form1.selsizeAnvil1441.value == '3XL'))&& 
		    ((document.Form1.selcolorAnvil1441.value != 'Black') && (document.Form1.selcolorAnvil1441.value != 'White') && (document.Form1.selcolorAnvil1441.value != 'Grey'))){
				alert('That size is only available in Black, White, or Grey for this style shirt.');
			document.Form1.selsizeAnvil1441.focus();
		}else{
			s = document.Form1.selcolorAnvil1441.value;
		}
	}
	else if(sName == 'GR101'){
		s = document.Form1.selcolorGR101.value;
	}
	else if(sName == 'GR103'){
		s = document.Form1.selcolorGR103.value;
	}
	else if(sName == 'lat3642'){
		s = document.Form1.selcolorLat3642.value;
	}
	else if(sName == 'lat3633'){
		s = document.Form1.selcolorLat3633.value;
	}
		else if(sName == 'anvil-479B'){
		s = document.Form1.selcolorAnvil479B.value;
	}
	else if(sName == 'gildan-2400'){
		s = document.Form1.selcolorgildan2400.value;
	}

	else{
		s = document.Form1.selcolorstd.value;
	}
	// set the hidden value to be sent to Paypal
	document.Form1.os1.value = s;


}


function setDesignLoc(s, output){
	gDesignLocation = '\nDesign Loc: '+s;
	updateItemName();
	return;
}
function setWineType(s, output){
	gWineType = '\nType of Wine: '+s;
	updateItemName();
	return;
}

// This function used for Longhorn back text
function setBackText(s, output){
	if (s != ''){
		gAddBackValue = 25;
		gOnBack =  ' ' +s;
		updateItemName();
		document.Form1.amount.value = calculateAmount();
	}else{
		gAddBackValue = 0;
		gOnBack = s;
		updateItemName();
		document.Form1.amount.value = calculateAmount();
	}
	return;
}

function setChainLength(){
var s;
	s = document.Form1.os0.value;
		if(s == '18 inches'){
				gChainCost = 6.00;
				gChainLength = '18 inch Sterling Silver Chain';
		}else if(s == '20 inches'){
				gChainCost = 10.00;
				gChainLength = '20 inch Sterling Silver Chain';
		}else{
				gChainCost = 0;
				gChainLength = '16 inch Sterling Silver Chain';
		}
		updateItemName();
		document.Form1.amount.value = calculateAmount();
}

function setCrystalCombo(){
		gCrystal = ' Crystal Color: ' + document.Form1.os0.value;
		updateItemName();
}

function selectCrystalColor(){
	gCrystal = ' Crystal Color: ' + document.Form1.sTextColor.value;
	updateItemName();
	return;
}

function setShippingValue(s){
	if(s == 'Yes'){
      document.Form1.no_shipping.value = '2';
	  document.Form1.shipping.value = '7.50'
	}else{
      document.Form1.no_shipping.value = '1';
	  document.Form1.shipping.value = '0.00'
	}

}
function checkRadios() {
 var el = document.forms[0].elements;
 for(var i = 0 ; i < el.length ; ++i) {
  		if(el[i].type == "radio") {
   			var radiogroup = el[el[i].name]; // get the whole set of radio buttons.
   			var itemchecked = false;
   			for(var j = 0 ; j < radiogroup.length ; ++j) {
				if(radiogroup[j].checked) {
					itemchecked = true;
	 			 	if(radiogroup[j].value == 'anvil-1452'){
				 		if ((document.Form1.selsizeAnvil1452.value == 'XLarge') && (document.Form1.selcolorAnvil1452.value == 'Red')){
							alert('The color Red for this style shirt is NOT available in XLarge');
							return(false);
						} // XLarge
	 				}//  end anvil 1452
					if(radiogroup[j].value == 'anvil-1441'){
						if (((document.Form1.selsizeAnvil1441.value == '2XL') || (document.Form1.selsizeAnvil1441.value == '3XL'))&& 
		  	   				  ((document.Form1.selcolorAnvil1441.value != 'Black') && (document.Form1.selcolorAnvil1441.value != 'White') &&(document.Form1.selcolorAnvil1441.value != 'Grey'))){
									alert('That size is only available in Black, Grey or White for this style shirt.');
									return(false);
						} // end if 2XL
	 				}// end if anvil 1441
	 				break;
				}// end if checked	
		 }// end for j
  		 if(!itemchecked) { 
		  		alert("Please select a "+el[i].name+".");
		 		document.all.InValidPromo.style.zindex = '-1';
				document.all.InValidPromo.style.display = 'none';
				document.all.ValidPromo.style.zindex = '-1';
				document.all.ValidPromo.style.display = 'none';
			    if(el[i].focus)
 		 		   el[i].focus();
				return false;
 		 } // end if not item checked
  } // end if radio group
  else if (el[i].type == 'hidden'){
  	 		if(el[i].name == 'pRequired'){ 
				if (document.Form1.PText.value == '')
				{
 	    			alert('Please enter your personal text.');
					return(false);
				} // end if no value in text
			} // end if required
			else   if((el[i].name == 'fballRequired') && (el[i].value == 'Yes')){ 
				if ((document.Form1.pName.value == '') && (document.Form1.pNum.value == ''))
				{
 	    			alert('Please enter a Name  and/or Number for the back of your shirt.');
					return(false);
				} // end if no value in text
			} // end if required

	}// if hidden
  else if (el[i].type == 'text'){
  	 		if(el[i].name == 'bName'){ 
				if ((document.Form1.bName.value != '') && (gPersonalTxt.length == 0))
				{
 	   				 getPersonalTxt(document.Form1.bName)
				} // end if no value in text
			} // end if required
	}// if hidden

 } // end for i
   if(document.Form1.os1.value == 'none selected'){
 	    			alert('Please select a color for your shirt style.');
					return(false);
   }
   if(document.Form1.os0.value == 'none selected'){
 	    			alert('Please select a size for your shirt style.');
					return(false);
  }
   if(document.Form1.os0.value == 'no crystal selected'){
 	    			alert('Please select a crystal color.');
					return(false);
  }
 return true;
} 
