/*	Creates scrolling message	*/
	window.status="THESE CLIPS ARE MADE IN THE U.S.A. - PATENT PENDING. WE'RE  KEEPING OUR JOBS IN OUR COUNTRY!!!                                                ";

var iID=window.setInterval("scrollStatus()",300);
	function scrollStatus(){
		switch(navigator.appName){
		case "Netscape":
		break;	

		case "Microsoft Internet Explorer":	
		var stuff=window.status;
		var firstChar=stuff.substr(0,1)
		var row=stuff.substr(1);

		stuff=row + firstChar;
		window.status=stuff;
		break;
		}
	}	

/*	Creates Last Modified Stamp for Documents	*/
var a;
    a=new Date(document.lastModified);
    lm_year=a.getYear();lm_year=((lm_year<1000)?((lm_year<70)?2000:1900):0)+lm_year;
    lm_month=a.getMonth()+1;lm_month=((lm_month<10)?'0':'')+lm_month;
    lm_day=a.getDate();lm_day=((lm_day<10)?'0':'')+lm_day;
 
    monthName = new Array(12)
    monthName[0] = 'January'
    monthName[1] = 'February'
    monthName[2] = 'March'
    monthName[3] = 'April'
    monthName[4] = 'May'
    monthName[5] = 'June'
    monthName[6] = 'July'
    monthName[7] = 'August'
    monthName[8] = 'September'
    monthName[9] = 'October'
    monthName[10] = 'November'
    monthName[11] = 'December'
	

/*	Creates Calendar and Clock */	
function todaysDate(){ 
 var months = new Array("January","February","March","April","May","June","July","August","September","October","November","December"); 
 var days = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"); 
 var now = new Date(); 
 var Today = days[now.getDay()] + ", &nbsp;" + months[now.getMonth()] + " " + now.getDate() + ", " + now.getFullYear(); 
 return Today; 
 } 


/*	Preloads Images	*/
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


/*	Swaps Images that are Hovered over	*/
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

 function MM_jumpMenu(targ,selObj,restore){ //v3.0 
   eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); 
   if (restore) selObj.selectedIndex=0; 
 } 

function MM_reloadPage(init) {  //reloads the window if Nav4 resized 
   if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) { 
     document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }} 
   else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload(); 
 } 

 
/*	Function for Lute Web Advertisement */
function adLute(){
	var newWin = window.open("../luteweb.html", "", "width=510,height=500,menubar=no,scrollbars");
	}
function adLuteMain(){
	var newWin = window.open("luteweb.html", "", "width=510,height=500,menubar=no,scrollbars");
	}
	  
/*	Inline Window Size	*/
heightPos = 0
	function windowSize(banner)	{
	if (screen.height < 601){
		heightPos = screen.height + 10}
	else{
		heightPos = screen.height - 170}
			document.writeln('<iframe marginwidth="0" marginheight="0" scrolling="auto" frameborder="0" width="100%" height="'+heightPos+'" name="righthere" src="'+ banner + '">');
	}

/*	Pop up Window Documents	*/
var popWin;	
	function OpenDoc(popdoc) {
	popWin=window.open(popdoc,"top","menubar=yes,toolbar=yes,location=yes,status=no,scrollbars=yes,width=800,resizable=yes");
	popWin.focus();
	}	
	
/*	Loads Review Gallery Animations	*/
var program;
var aniImage;
var galWin;
	function GalAni(program,aniImage) {	
	galWin=window.open("","","menubar=yes,toolbar=no,status=no,scrollbars=no,width=600,height=500,resizable=yes");
	galWin.document.writeln('<head><title>'+program+'</title><link href=\"../css/text_styles.css\" rel=\"stylesheet\" type=\"text/css\"></head><body bgcolor=white><p align="center" class="bluefont">'+program+'</p><p align="center"><img src="../images/'+aniImage+'.jpg" border="0" alt="'+program+'"></p></body></html>');

	}
	
	function GifAni(program,aniImage) {	
	galWin=window.open("","","menubar=yes,toolbar=no,status=no,scrollbars=no,width=600,height=500,resizable=yes");
	galWin.document.writeln('<head><title>'+program+'</title><link href=\"../css/text_styles.css\" rel=\"stylesheet\" type=\"text/css\"></head><body bgcolor=white><p align="center" class="bluefont">'+program+'</p><p align="center"><img src="../images/'+aniImage+'.gif" border="0" alt="'+program+'"></p></body></html>');

	}

// Function for Moving Title
	var elLoc=0;
	var speed=2;
	var distance=0;
	var check=true

	function movetitle(){
		var el=document.getElementById("header");
		el.style.left=elLoc;
		(check==true)?(movefor()):(moveback()); //checks to determine direction of text



// once text reaches end, switches boolean statement		
		if (distance==-10){
			check=false;
		return
		}

		if (distance== 10){
			check=true;
		return	
		}

		function movefor(){
			elLoc+=speed;
			distance-= 10;
			window.setTimeout("movetitle()",400);	
		}

		function moveback(){
			elLoc-=speed;
			distance+= 10;
			window.setTimeout("movetitle()",400);	
		}		
	}

	
// Calculates Clip Cost
	var logoType;
	var customLogo;

function outputCalc (){

	var price;
	var tax;
	var cost;
	var shipping;

	var price_product_1 = 0;
	var price_product_2 = 0;
	var price_product_3 = 0;
	var price_product_4 = 0;
	var price_product_5 = 0;
	var price_product_6 = 0;
	
	var quant_total = 0;
	var quant_product_1 = 0;
	var quant_product_2 = 0;
	var quant_product_3 = 0;
	var quant_product_4 = 0;
	var quant_product_5 = 0;
	var quant_product_6 = 0;

// Checks to see if product has been selected	
	if (document.hat_clip.clip_type_1.value == ' ' && document.hat_clip.clip_type_2.value == ' ' && document.hat_clip.clip_type_3.value == ' ' && document.hat_clip.clip_type_4.value == ' ' && document.hat_clip.clip_type_5.value == ' ' && document.hat_clip.clip_type_6.value == ' '){
		alert ("You must choose a product");
		return;}
		
// Parameter for Product 1	
	if (document.hat_clip.clip_type_1.value != ' '){
		quant_product_1 = Math.round(document.hat_clip.quantity_1.value);
		
		if (document.hat_clip.quantity_1.value < 1){
		alert ("You must enter a quantity for "+ document.hat_clip.clip_type_1.value);
		return;}
		
		if (document.hat_clip.quantity_1.value > 249){
		alert ("You can still use this form to order over 249 items, but you must call for special pricing. The calculator will not be accurate.");
		}
		
		if (document.hat_clip.logo_type_1.value == ' '){
		alert ("You must choose a logo type for "+ document.hat_clip.clip_type_1.value);
		return;}
		
		if (document.hat_clip.clip_color_1.value == ' '){
		alert ("You must choose a color for "+ document.hat_clip.clip_type_1.value);
		return;}
		
/*		if (document.hat_clip.clip_color_1.value == 'yellow' || document.hat_clip.clip_color_1.value == 'orange' || document.hat_clip.clip_color_1.value == 'green' || document.hat_clip.clip_color_1.value == 'purple'){
			if (quant_product_1 < 1000){
			alert ("You must choose a least 1000 units for "+ document.hat_clip.clip_color_1.value + " clips");
			return;}
		}*/
		
		if (document.hat_clip.clip_type_1.value == 'regular_clip'){
		 if (document.hat_clip.logo_type_1.value != 'no_decal'){
			if (quant_product_1 < 50){
				price_product_1=(quant_product_1 * 1.15);
			}
			else if (quant_product_1 > 49 && quant_product_1 < 100){
				price_product_1=(quant_product_1 * 1.00);
			}
			else if (quant_product_1 > 99 && quant_product_1 < 250){
				price_product_1=(quant_product_1 * .90);
			}
		  }
		  if (document.hat_clip.logo_type_1.value == 'no_decal'){
			if (quant_product_1 < 50){
				price_product_1=(quant_product_1 * .99);
			}
			else if (quant_product_1 > 49 && quant_product_1 < 100){
				price_product_1=(quant_product_1 * .85);
			}
			else if (quant_product_1 > 99 && quant_product_1 < 250){
				price_product_1=(quant_product_1 * .75);
			}
		  }
		}
		if (document.hat_clip.clip_type_1.value == 'adhesive_clip'){
		  if (document.hat_clip.logo_type_1.value != 'no_decal'){
			if (quant_product_1 < 50){
				price_product_1=(quant_product_1 * 1.25);
			}
			else if (quant_product_1 > 49 && quant_product_1 < 100){
				price_product_1=(quant_product_1 * 1.10);
			}
			else if (quant_product_1 > 99 && quant_product_1 < 250){
				price_product_1=(quant_product_1 * 1.00);
			}
		  }
		  if (document.hat_clip.logo_type_1.value == 'no_decal'){
			if (quant_product_1 < 50){
				price_product_1=(quant_product_1 * 1.08);
			}
			else if (quant_product_1 > 49 && quant_product_1 < 100){
				price_product_1=(quant_product_1 * .95);
			}
			else if (quant_product_1 > 99 && quant_product_1 < 250){
				price_product_1=(quant_product_1 * .85);
			}
		  }
		}
		if (document.hat_clip.clip_type_1.value == 'clip_five_pack'){
			if (quant_product_1 < 50){
				price_product_1=(quant_product_1 * 6.25);
			}
			else if (quant_product_1 > 49 && quant_product_1 < 100){
				price_product_1=(quant_product_1 * 5.25);
			}
			else if (quant_product_1 > 99 && quant_product_1 < 250){
				price_product_1=(quant_product_1 * 4.99);
			}
		}
		price_product_1 = price_product_1 * Math.pow(10,2);
  		price_product_1 = Math.round(price_product_1);
  		price_product_1 = price_product_1 / Math.pow(10,2);
		product_1_cost=price_product_1;
		document.hat_clip.product_1_cost.value=product_1_cost;
	}
	
// Parameter for Product 2	
	if (document.hat_clip.clip_type_2.value != ' '){
		quant_product_2 = Math.round(document.hat_clip.quantity_2.value);
		
		if (document.hat_clip.quantity_2.value < 1){
		alert ("You must enter a quantity for "+ document.hat_clip.clip_type_2.value);
		return;}
		
		if (document.hat_clip.quantity_2.value > 249){
		alert ("You can still use this form to order over 249 items, but you must call for special pricing. The calculator will not be accurate.");
		}
		
		if (document.hat_clip.logo_type_2.value == ' '){
		alert ("You must choose a logo type for "+ document.hat_clip.clip_type_2.value);
		return;}
		
		if (document.hat_clip.clip_color_2.value == ' '){
		alert ("You must choose a color for "+ document.hat_clip.clip_type_2.value);
		return;}
		
/*		if (document.hat_clip.clip_color_2.value == 'yellow' || document.hat_clip.clip_color_2.value == 'orange' || document.hat_clip.clip_color_2.value == 'green' || document.hat_clip.clip_color_2.value == 'purple'){
			if (quant_product_2 < 1000){
			alert ("You must choose a least 1000 units for "+ document.hat_clip.clip_color_2.value + " clips");
			return;}
		}*/
		
		if (document.hat_clip.clip_type_2.value == 'regular_clip'){
		 if (document.hat_clip.logo_type_2.value != 'no_decal'){
			if (quant_product_2 < 50){
				price_product_2=(quant_product_2 * 1.15);
			}
			else if (quant_product_2 > 49 && quant_product_2 < 100){
				price_product_2=(quant_product_2 * 1.00);
			}
			else if (quant_product_2 > 99 && quant_product_2 < 250){
				price_product_2=(quant_product_2 * .90);
			}
		  }
		  if (document.hat_clip.logo_type_2.value == 'no_decal'){
			if (quant_product_2 < 50){
				price_product_2=(quant_product_2 * .99);
			}
			else if (quant_product_2 > 49 && quant_product_2 < 100){
				price_product_2=(quant_product_2 * .85);
			}
			else if (quant_product_2 > 99 && quant_product_2 < 250){
				price_product_2=(quant_product_2 * .75);
			}
		  }
		}
		if (document.hat_clip.clip_type_2.value == 'adhesive_clip'){
		  if (document.hat_clip.logo_type_2.value != 'no_decal'){
			if (quant_product_2 < 50){
				price_product_2=(quant_product_2 * 1.25);
			}
			else if (quant_product_2 > 49 && quant_product_2 < 100){
				price_product_2=(quant_product_2 * 1.10);
			}
			else if (quant_product_2 > 99 && quant_product_2 < 250){
				price_product_2=(quant_product_2 * 1.00);
			}
		  }
		  if (document.hat_clip.logo_type_2.value == 'no_decal'){
			if (quant_product_2 < 50){
				price_product_2=(quant_product_2 * 1.08);
			}
			else if (quant_product_2 > 49 && quant_product_2 < 100){
				price_product_2=(quant_product_2 * .95);
			}
			else if (quant_product_2 > 99 && quant_product_2 < 250){
				price_product_2=(quant_product_2 * .85);
			}
		  }
		}
		if (document.hat_clip.clip_type_2.value == 'clip_five_pack'){
			if (quant_product_2 < 50){
				price_product_2=(quant_product_2 * 6.25);
			}
			else if (quant_product_2 > 49 && quant_product_2 < 100){
				price_product_2=(quant_product_2 * 5.25);
			}
			else if (quant_product_2 > 99 && quant_product_2 < 250){
				price_product_2=(quant_product_2 * 4.99);
			}
		}
		price_product_2 = price_product_2 * Math.pow(10,2);
  		price_product_2 = Math.round(price_product_2);
  		price_product_2 = price_product_2 / Math.pow(10,2);
		product_2_cost=price_product_2;
		document.hat_clip.product_2_cost.value=product_2_cost;
	}
	
// Parameter for Product 3	
	if (document.hat_clip.clip_type_3.value != ' '){
		quant_product_3 = Math.round(document.hat_clip.quantity_3.value);
		
		if (document.hat_clip.quantity_3.value < 1){
		alert ("You must enter a quantity for "+ document.hat_clip.clip_type_3.value);
		return;}
		
		if (document.hat_clip.logo_type_3.value == ' '){
		alert ("You must choose a logo type for "+ document.hat_clip.clip_type_3.value);
		return;}
		
		if (document.hat_clip.quantity_3.value > 249){
		alert ("You can still use this form to order over 249 items, but you must call for special pricing. The calculator will not be accurate.");
		}
		
		if (document.hat_clip.clip_color_3.value == ' '){
		alert ("You must choose a color for "+ document.hat_clip.clip_type_3.value);
		return;}
		
/*		if (document.hat_clip.clip_color_3.value == 'yellow' || document.hat_clip.clip_color_3.value == 'orange' || document.hat_clip.clip_color_3.value == 'green' || document.hat_clip.clip_color_3.value == 'purple'){
			if (quant_product_3 < 1000){
			alert ("You must choose a least 1000 units for "+ document.hat_clip.clip_color_3.value + " clips");
			return;}
		}*/
		
		if (document.hat_clip.clip_type_3.value == 'regular_clip'){
		 if (document.hat_clip.logo_type_3.value != 'no_decal'){
			if (quant_product_3 < 50){
				price_product_3=(quant_product_3 * 1.15);
			}
			else if (quant_product_3 > 49 && quant_product_3 < 100){
				price_product_3=(quant_product_3 * 1.00);
			}
			else if (quant_product_3 > 99 && quant_product_3 < 250){
				price_product_3=(quant_product_3 * .90);
			}
		  }
		  if (document.hat_clip.logo_type_3.value == 'no_decal'){
			if (quant_product_3 < 50){
				price_product_3=(quant_product_3 * .99);
			}
			else if (quant_product_3 > 49 && quant_product_3 < 100){
				price_product_3=(quant_product_3 * .85);
			}
			else if (quant_product_3 > 99 && quant_product_3 < 250){
				price_product_3=(quant_product_3 * .75);
			}
		  }
		}
		if (document.hat_clip.clip_type_3.value == 'adhesive_clip'){
		  if (document.hat_clip.logo_type_3.value != 'no_decal'){
			if (quant_product_3 < 50){
				price_product_3=(quant_product_3 * 1.25);
			}
			else if (quant_product_3 > 49 && quant_product_3 < 100){
				price_product_3=(quant_product_3 * 1.10);
			}
			else if (quant_product_3 > 99 && quant_product_3 < 250){
				price_product_3=(quant_product_3 * 1.00);
			}
		  }
		  if (document.hat_clip.logo_type_3.value == 'no_decal'){
			if (quant_product_3 < 50){
				price_product_3=(quant_product_3 * 1.08);
			}
			else if (quant_product_3 > 49 && quant_product_3 < 100){
				price_product_3=(quant_product_3 * .95);
			}
			else if (quant_product_3 > 99 && quant_product_3 < 250){
				price_product_3=(quant_product_3 * .85);
			}
		  }
		}
		if (document.hat_clip.clip_type_3.value == 'clip_five_pack'){
			if (quant_product_3 < 50){
				price_product_3=(quant_product_3 * 6.25);
			}
			else if (quant_product_3 > 49 && quant_product_3 < 100){
				price_product_3=(quant_product_3 * 5.25);
			}
			else if (quant_product_3 > 99 && quant_product_3 < 250){
				price_product_3=(quant_product_3 * 4.99);
			}
		}
		price_product_3 = price_product_3 * Math.pow(10,2);
  		price_product_3 = Math.round(price_product_3);
  		price_product_3 = price_product_3 / Math.pow(10,2);
		product_3_cost=price_product_3;
		document.hat_clip.product_3_cost.value=product_3_cost;
	}
		
// Parameter for Product 4	
	if (document.hat_clip.clip_type_4.value != ' '){
		quant_product_4 = Math.round(document.hat_clip.quantity_4.value);
		
		if (document.hat_clip.quantity_4.value < 1){
		alert ("You must enter a quantity for "+ document.hat_clip.clip_type_4.value);
		return;}
		
		if (document.hat_clip.logo_type_4.value == ' '){
		alert ("You must choose a logo type for "+ document.hat_clip.clip_type_4.value);
		return;}
		
		if (document.hat_clip.quantity_4.value > 249){
		alert ("You can still use this form to order over 249 items, but you must call for special pricing. The calculator will not be accurate.");
		}
		
		if (document.hat_clip.clip_color_4.value == ' '){
		alert ("You must choose a color for "+ document.hat_clip.clip_type_4.value);
		return;}
		
/*		if (document.hat_clip.clip_color_4.value == 'yellow' || document.hat_clip.clip_color_4.value == 'orange' || document.hat_clip.clip_color_4.value == 'green' || document.hat_clip.clip_color_4.value == 'purple'){
			if (quant_product_4 < 1000){
			alert ("You must choose a least 1000 units for "+ document.hat_clip.clip_color_4.value + " clips");
			return;}
		}*/
		
		if (document.hat_clip.clip_type_4.value == 'golf_clip'){
		 if (document.hat_clip.logo_type_4.value != 'no_marker'){
			if (quant_product_4 < 50){
				price_product_4=(quant_product_4 * 4.25);
			}
			else if (quant_product_4 > 49 && quant_product_4 < 100){
				price_product_4=(quant_product_4 * 3.79);
			}
			else if (quant_product_4 > 99 && quant_product_4 < 250){
				price_product_4=(quant_product_4 * 2.99);
			}
		  }
		  if (document.hat_clip.logo_type_4.value == 'no_marker'){
			if (quant_product_4 < 50){
				price_product_4=(quant_product_4 * 1.35);
			}
			else if (quant_product_4 > 49 && quant_product_4 < 100){
				price_product_4=(quant_product_4 * 1.15);
			}
			else if (quant_product_4 > 99 && quant_product_4 < 250){
				price_product_4=(quant_product_4 * .95);
			}
		  }
		}
		price_product_4 = price_product_4 * Math.pow(10,2);
  		price_product_4 = Math.round(price_product_4);
  		price_product_4 = price_product_4 / Math.pow(10,2);
		product_4_cost=price_product_4;
		document.hat_clip.product_4_cost.value=product_4_cost;
	}
	
// Parameter for Product 5	
	if (document.hat_clip.clip_type_5.value != ' '){
		quant_product_5 = Math.round(document.hat_clip.quantity_5.value);
		
		if (document.hat_clip.quantity_5.value < 1){
		alert ("You must enter a quantity for "+ document.hat_clip.clip_type_5.value);
		return;}
		
		if (document.hat_clip.quantity_5.value > 249){
		alert ("You can still use this form to order over 249 items, but you must call for special pricing. The calculator will not be accurate.");
		}
		
		if (document.hat_clip.logo_type_5.value == ' '){
		alert ("You must choose a logo type for "+ document.hat_clip.clip_type_5.value);
		return;}
		
		if (document.hat_clip.clip_color_5.value == ' '){
		alert ("You must choose a color for "+ document.hat_clip.clip_type_5.value);
		return;}
		
/*		if (document.hat_clip.clip_color_5.value == 'yellow' || document.hat_clip.clip_color_5.value == 'orange' || document.hat_clip.clip_color_5.value == 'green' || document.hat_clip.clip_color_5.value == 'purple'){
			if (quant_product_5 < 1000){
			alert ("You must choose a least 1000 units for "+ document.hat_clip.clip_color_5.value + " clips");
			return;}
		}*/
		
		if (document.hat_clip.clip_type_5.value == 'golf_clip'){
		 if (document.hat_clip.logo_type_5.value != 'no_marker'){
			if (quant_product_5 < 50){
				price_product_5=(quant_product_5 * 4.25);
			}
			else if (quant_product_5 > 49 && quant_product_5 < 100){
				price_product_5=(quant_product_5 * 3.79);
			}
			else if (quant_product_5 > 99 && quant_product_5 < 250){
				price_product_5=(quant_product_5 * 2.99);
			}
		  }
		  if (document.hat_clip.logo_type_5.value == 'no_marker'){
			if (quant_product_5 < 50){
				price_product_5=(quant_product_5 * 1.35);
			}
			else if (quant_product_5 > 49 && quant_product_5 < 100){
				price_product_5=(quant_product_5 * 1.15);
			}
			else if (quant_product_5 > 99 && quant_product_5 < 250){
				price_product_5=(quant_product_5 * .95);
			}
		  }
		}
		price_product_5 = price_product_5 * Math.pow(10,2);
  		price_product_5 = Math.round(price_product_5);
  		price_product_5 = price_product_5 / Math.pow(10,2);
		product_5_cost=price_product_5;
		document.hat_clip.product_5_cost.value=product_5_cost;
	}
	
		
// Parameter for Product 2	
	if (document.hat_clip.clip_type_6.value != ' '){
		quant_product_6 = Math.round(document.hat_clip.quantity_6.value);
		
		if (document.hat_clip.quantity_6.value < 1){
		alert ("You must enter a quantity for "+ document.hat_clip.clip_type_6.value);
		return;}
		
		if (document.hat_clip.logo_type_6.value == ' '){
		alert ("You must choose a logo type for "+ document.hat_clip.clip_type_6.value);
		return;}
		
		if (document.hat_clip.quantity_6.value > 249){
		alert ("You can still use this form to order over 249 items, but you must call for special pricing. The calculator will not be accurate.");
		}
		
		if (document.hat_clip.clip_color_6.value == ' '){
		alert ("You must choose a color for "+ document.hat_clip.clip_type_6.value);
		return;}
		
/*		if (document.hat_clip.clip_color_6.value == 'yellow' || document.hat_clip.clip_color_6.value == 'orange' || document.hat_clip.clip_color_6.value == 'green' || document.hat_clip.clip_color_6.value == 'purple'){
			if (quant_product_6 < 1000){
			alert ("You must choose a least 1000 units for "+ document.hat_clip.clip_color_6.value + " clips");
			return;}
		}*/
		
		if (document.hat_clip.clip_type_6.value == 'golf_clip'){
		 if (document.hat_clip.logo_type_6.value != 'no_marker'){
			if (quant_product_6 < 50){
				price_product_6=(quant_product_6 * 4.25);
			}
			else if (quant_product_6 > 49 && quant_product_6 < 100){
				price_product_6=(quant_product_6 * 3.79);
			}
			else if (quant_product_6 > 99 && quant_product_6 < 250){
				price_product_6=(quant_product_6 * 2.99);
			}
		  }
		  if (document.hat_clip.logo_type_6.value == 'no_marker'){
			if (quant_product_6 < 50){
				price_product_6=(quant_product_6 * 1.35);
			}
			else if (quant_product_6 > 49 && quant_product_6 < 100){
				price_product_6=(quant_product_6 * 1.15);
			}
			else if (quant_product_6 > 99 && quant_product_6 < 250){
				price_product_6=(quant_product_6 * .95);
			}
		  }
		}
		price_product_6 = price_product_6 * Math.pow(10,2);
  		price_product_6 = Math.round(price_product_6);
  		price_product_6 = price_product_6 / Math.pow(10,2);
		product_6_cost=price_product_6;
		document.hat_clip.product_6_cost.value=product_6_cost;
	}
	
	
// Checks for orders over 1000  or zero & figures out shipping	
	quant_total = quant_product_1 + quant_product_2 + quant_product_3 + quant_product_4 + quant_product_5 + quant_product_6;

	if (quant_total > 1000) { 
		alert ("For orders over a 1000 units, the shipping price on the calculator  will not be accurate. Please call us for shipping cost or we will call you after receiving your online request, Thank you.");
		shipping = 0;
		document.hat_clip.shipping_cost.value=shipping;
	}
	else if (quant_total > 0 && quant_total < 6) { 
		shipping = 1.50;
		document.hat_clip.shipping_cost.value=shipping;
	}
	else if (quant_total > 5 && quant_total < 26) { 
		shipping = 3.00;
		document.hat_clip.shipping_cost.value=shipping;
	}
	else if (quant_total > 25 && quant_total < 51) { 
		shipping = 6.00;
		document.hat_clip.shipping_cost.value=shipping;
	}
	else if (quant_total > 50 && quant_total < 101) { 
		shipping = 7.50;
		document.hat_clip.shipping_cost.value=shipping;
	}
	else if (quant_total > 100 && quant_total < 501) { 
		shipping = 12.50;
		document.hat_clip.shipping_cost.value=shipping;
	}
	else if (quant_total > 500) { 
		shipping = 17.50;
		document.hat_clip.shipping_cost.value=shipping;
	}
	
// Does math for price calculation
	price = price_product_1 + price_product_2+ price_product_3 + price_product_4 + price_product_5 + price_product_6;
		price = price * Math.pow(10,2);
  		price = Math.round(price);
  		price = price / Math.pow(10,2);
	document.hat_clip.clip_price.value=price;
	tax=(price * .06);
		tax = tax * Math.pow(10,2);
  		tax = Math.round(tax);
  		tax = tax / Math.pow(10,2);
	document.hat_clip.clip_tax.value=tax;
	cost=(price + tax + shipping);
		cost = cost * Math.pow(10,2);
  		cost = Math.round(cost);
  		cost = cost / Math.pow(10,2);
		document.hat_clip.approx_cost.value=cost;
	
}


	
//Programs checks registration forms for completeness

/* *************************************************************
* set some global variables that will be checked later         *
***************************************************************/
var msg = "";                 	// an output message
var missing = "";             	// for missing required fields
var invNum = "";              	// for invalid numeric fields
var invZIP = "";              	// for invalid zip codes
var invPhone = "";            	// for invalid phone numbers
var invState = "";            	// for invalid state fields
var invFirst4 = "";            	// for invalid First 4 credit card numbers
var invSecond4 = "";            // for invalid Second 4 credit card numbers
var invThird4 = "";            	// for invalid Third 4 credit card numbers
var invLast4 = "";            	// for invalid Last 4 credit card numbers
var invBack3 = "";         		// for invalid Back 3 credit card numbers
var invExpire = "";            	// for invalid Credit Card Expiration fields

/* *************************************************************
* The main validation function, calls other sub-functions      *
***************************************************************/
function validate(frm)
  {
  for(i=0; i<frm.elements.length; i++)            // loop through form elements
    {
    var el = frm.elements[i];
    if(el.required)                               // if element has required property
      {                                           // test to see if field is empty
      if(isEmpty(el))
        {
        missing += "\n   - " + el.name + " is a required field";
        }
      }
	  
    if(el.numeric)
      {
      if(!isNumeric(el))
        {
        invNum += "\n   - " + el.value + " is not a number";
        }
      }
	  
    if(el.zip && el.value.length !=0)
      {
      if(invalidZIP(el))
        {
        invZIP += "\n  - " + el.value + " is an invalid ZIP code";
        }
      }
	  
    if(el.phone && el.value.length !=0)
      {
      if(invalidPhone(el))
        {
        invPhone += "\n  - " + el.value + " is not a valid phone number";
        }
      }
	  
if (document.hat_clip.card_type.value == ''){
document.hat_clip.billing_address.required=false; document.hat_clip.billing_city.required=false; document.hat_clip.billing_state.required=false; document.hat_clip.billing_zip.required=false; document.hat_clip.billing_zip.zip=false; document.hat_clip.billing_state.state=false; document.hat_clip.name_on_card.required=false; document.hat_clip.card_type.required=false; document.hat_clip.first4_numbers.required=false; document.hat_clip.second4_numbers.required=false; document.hat_clip.third4_numbers.required=false; document.hat_clip.last4_numbers.required=false; document.hat_clip.cvv_code.required=false;}
if (document.hat_clip.card_type.value != ''){
document.hat_clip.name_on_card.required=true; document.hat_clip.card_type.required=true; document.hat_clip.first4_numbers.required=true; document.hat_clip.second4_numbers.required=true; document.hat_clip.third4_numbers.required=true; document.hat_clip.last4_numbers.required=true; document.hat_clip.cvv_code.required=true;
	if (document.hat_clip.billing_address_is_same.value == ''){
		document.hat_clip.billing_address.required=true; document.hat_clip.billing_city.required=true; document.hat_clip.billing_state.required=true; document.hat_clip.billing_zip.required=true;document.hat_clip.billing_zip.zip=true; document.hat_clip.billing_state.state=true;}
	else{document.hat_clip.billing_address.required=false; document.hat_clip.billing_city.required=false; document.hat_clip.billing_state.required=false; document.hat_clip.billing_zip.required=false;document.hat_clip.billing_zip.zip=false; document.hat_clip.billing_state.state=false;}
	  
	if(el.first_num && el.value.length !=0)
      {
      if(invalidFirst4(el))
        {
        invFirst4 += "\n  - " + el.value + " is not 4 valid numbers";
        }
      }

	if(el.second_num && el.value.length !=0)
      {
      if(invalidSecond4(el))
        {
        invSecond4 += "\n  - " + el.value + " is not 4 valid numbers";
        }
      }

	if(el.third_num && el.value.length !=0)
      {
      if(invalidThird4(el))
        {
        invThird4 += "\n  - " + el.value + " is not 4 valid numbers";
        }
      }

	if(el.last_num && el.value.length !=0)
      {
      if(invalidLast4(el))
        {
        invLast4 += "\n  - " + el.value + " is not a valid number";
        }
      }
  	if(el.back_3_num && el.value.length !=0)
      {
      if(invalidBack3(el))
        {
        invBack3 += "\n  - " + el.value + " is not 3 valid numbers";
        }
      }
	if(el.exp_date && el.value.length !=0)
      {
      if(invalidExpire(el))
        {
        invExpire += "\n  - " + el.value + " is not a valid expiration date";
        }
      }
} 
    }
  
  // build output message
  if(missing.length !=0 || invNum.length != 0 || invZIP.length != 0 || invPhone.length != 0 || invState.length != 0 || invFirst4.length != 0 || invSecond4.length != 0 || invThird4.length != 0 || invLast4.length != 0 || invBack3.length != 0 || invExpire.length != 0)
    {
    if(missing.length !=0)
      {
      msg += "\n\nThe following required fields are missing:";
      msg += missing;
      }
    if(invNum.length !=0)
      {
      msg += "\n\nYou entered incorrect numeric data in this field:";
      msg += invNum;
      }
    if(invZIP.length !=0)
      {
      msg += "\n\nYou entered an incorrect ZIP code in this field:";
      msg += invZIP;
      }
    if(invPhone.length !=0)
      {
      msg += "\n\nYou entered an incorrect phone number in this field:";
      msg += invPhone;
      }
    if(invState.length !=0)
      {
      msg += "\n\nYou entered an incorrect state abbreviation";
      msg += invState;
      }
	if(invFirst4.length !=0)
      {
      msg += "\n\nYou entered incorrectly the first four credit card numbers in this field:";
      msg += invFirst4;
      }
	if(invSecond4.length !=0)
      {
      msg += "\n\nYou entered incorrectly the second four credit card numbers in this field:";
      msg += invSecond4;
      }
	if(invThird4.length !=0)
      {
      msg += "\n\nYou entered incorrectly the third four credit card numbers in this field:";
      msg += invThird4;
      }
	if(invLast4.length !=0)
      {
      msg += "\n\nYou entered incorrectly the last digits of your credit card in this field:";
      msg += invLast4;
      }
	if(invBack3.length !=0)
      {
      msg += "\n\nYou entered incorrectly the CVV Code on the back of your credit card in this field:";
      msg += invBack3;
      }
	if(invExpire.length !=0)
      {
      msg += "\n\nYou entered an incorrect credit card expiration date in this field:";
      msg += invExpire;
      }
	  
    errMsg(msg);           // call the output function
    msg = "";
	missing = ""; 
	invNum = ""; 
	invZIP = ""; 
	invPhone = ""; 
	invState = "" ;    
	invFirst4 = ""; 
	invSecond4 = ""; 
	invThird4 = ""; 
	invLast4 = ""; 
	invBack3 = "";
	invExpire = ""; // reset all our variables
    return false;
    }
  else
    {
    return true;
    }
  }

/* *************************************************************
* Sub-functions follow from here to end of file                *
* All sub-functions return true if field is of invalid         *
* format and false if they are valid entries                   *
***************************************************************/
function isEmpty(field)
  {
  str = field.value;
  if(str == "") 
    {
    return true;
    }
  else
    {
    for(j=0; j<str.length; j++)
      {
      if(str.charAt(j) != " ") return false;
      }
    }
  return true;
  }

function isNumeric(field)
  {
  var errCount = 0;
  var numdecs = 0;              // number of decimal points
  var nummins = 0;              // number of minus signs
  for(j=0;j<field.value.length;j++)
    {
    c = field.value.charAt(j);        // short hand notation for character at position j
    if((c >= 0 && c <= 9) || (c=="." || c=="-"))
      {
      if(c==".") numdecs++;     // count the number of decimal points
      if(c=="-") nummins++;     // count the number of minus signs
      }
    else
      {
      errCount++;               // if it's none of those, increment error counter
      }
    }
  // error if count is non-zero or there are more than one decimal point or minus sign
  if(errCount > 0 || numdecs > 1 || nummins > 1)
    {
    return false;
    }
  return true;
  }

function stripNonDigits(str)
  {
  newStr = "";
  for(j=0; j<str.length; j++)
    {
    c = str.charAt(j);
    if(c >= "0" && c <= "9")
      {
      newStr += c;
      }
    }
  return newStr;
  }

function invalidZIP(field)
  {
  newStr = stripNonDigits(field.value);
  if(newStr.length == 5 || newStr.length== 9)
    {
    return false;
    }
  return true;
  }

function invalidPhone(field)
  {
  newStr = stripNonDigits(field.value);
  if(newStr.length == 10)
    {
    return false;
    }
  return true;
  }

function invalidFirst4(field)
  {
  newStr = stripNonDigits(field.value);
  if(newStr.length == 4)
    {
    return false;
    }
  return true;
  }

function invalidSecond4(field)
  {
  newStr = stripNonDigits(field.value);
  if(newStr.length == 4)
    {
    return false;
    }
  return true;
  }
  
function invalidThird4(field)
  {
  newStr = stripNonDigits(field.value);
  if(newStr.length == 4)
    {
    return false;
    }
  return true;
  }
  
function invalidLast4(field)
  {
  newStr = stripNonDigits(field.value);
  if (document.hat_clip.card_type.value == 'American_Express' && newStr.length == 3){
  	return false;}
	if (document.hat_clip.card_type.value == 'American_Express' && newStr.length != 3){
  return true;}
  if(newStr.length == 4)
    {
    return false;
    }
  return true;
  }

function invalidBack3(field)
  {
  newStr = stripNonDigits(field.value);
  if(newStr.length == 3 || newStr.length == 4)
    {
    return false;
    }
  return true;
  }
  
function invalidExpire(field)
  {
  newStr = stripNonDigits(field.value);
  if(newStr.length == 6 || newStr.length== 4)
    {
    return false;
    }
  return true;
  }
  
function errMsg(msg)
  {
  var theMsg = "You entered some incorrect values into the form. ";
  theMsg += "Please correct your entries then re-submit the form.\n";
  theMsg += "____________________________________________________________________";
  theMsg += msg;
  theMsg += "\n____________________________________________________________________\n";
  alert(theMsg);
  }