var cardTypeNumberHolder = "1";
var titleCP = [];
titleCP[1] = "<p><span class='learnAboutHeader'>Color:</span><br><span class='learnAboutText'><br>We print our cards using one or two of the following methods:<br>Method 1. CMYK aka 4 Color Process, CMYK stands for <b><font color='#00aeef'>Cyan</font></b>, </span><span class='style9'><b><font color='#ec008c'>Magenta</font></b></span><span class='learnAboutText'>, </span><span class='style9'><b><font color='#FFF200'>Yellow</font></b></span><span class='learnAboutText'> and </span><span class='style9'><b><font color='#000000'>Black</font></b></span><span class='learnAboutText'>. This method blends four colors to create almost any color combination. All pictures are printed using this method. Artwork designed in applications like Adobe PhotoShop will produce a CMYK image for printing (unless Black is the only color used).<br><br>Method 2. Spot Color aka Pantone Color uses specific inks that are premixed to print an exact  color. When exact solid colors, colors that can not be reproduced with a CMYK mix or metallic colors are required, or when there are only one to three exact colors in the artwork, the spot color system is used. To print spot colors the artwork must be created in a vector based application such as Adobe Illustrator. Black and white images can be colored (single or gradient) with spot colors when imported into a vector based application. When selecting spot colors use only Pantone Solid Coated colors.<br><br>A mix of CMYK and Spot colors is possible but requires additional print heads and will add to the cost of printing.:";
titleCP[2] = "<p><span class='learnAboutHeader'>Embossing</span><br><span class='learnAboutText'><br>Raised lettering and numbers on the front of the card tipped in Silver or Gold colors. Information can be variable (different on each card) or static.<br>The fonts used to create the embossing are OCR and Ariel. Font Sizes: OCR, 18 pt, Up to 19 characters per line (credit card numbers) <br>Ariel, 12 pt,Up to 28 characters per line (text) <br>Variable data (if used) must be submitted in an Excel or Text file.<br>Indicate text placement on artwork.<br>If design is done in Illustrator do not outline fonts.<br>In PhotoShop keep the embossing on a separate layer.<br>In Quark set the text like any other text (colored in Magenta).<br>Control (consecutive) numbering is required on all embossing prints.</span>";
titleCP[3] = "<p><span class='learnAboutHeader'>Mag Sripes</span><br><span class='learnAboutText'><br>Mag Stripes aka Magnetic Stripes are strips that store data on the back of a card. The data on the strips is readable when the card is passed through a reader like a POS terminal. The data can be encoded onto the card during the printing process or left blank to be encoded by the customer.<br>Two  types of Mag Stripes are available HiCo and LoCo. HiCo stands for High Coercivity (2700 upto 4000 Oe) and LoCo for Low Coercivity (300 Oe), indicating the density of the magnetic particles in the stripe. <br>Mag stripes of either type can be 1/2&quot; in height allowing for up to three tracks of data or 5/16&quot; in height allowing for up to two tracks of data. <br>When encoding is required a consecutive number is printed on each card that corresponds to the encoded data. All data files (encoding data and corresponding control numbers) are handled in a secure environment and on secure servers and computers.<br>The correct type and size of Mag Stripe is determined by the equipment you will be using to read the cards. </span>";
titleCP[4] = "<p><span class='learnAboutHeader'>Bar Codes</span><br><span class='learnAboutText'><br>A Bar Code is a graphic representation of a number and/or letters that is readable by a scanner, the actual numbering/letters are usually printed above or below the bar code. There are three common types of bar codes, Type 128, Type 39 and UPC. For variable data (every card has a unique bar code) 128 and 39 are most popular. UPC is usually used when all the cards have the same bar code, and in this case the bar code can be added as part of the artwork and doesn’t require additional pricing.<br>The actual bar code needed is determined by the scanner and application that will process the data. <br>To ensure 100% production and to be able to reprint cards, if some are damaged, a consecutive number is printed on each card that corresponds to the barcode numbers.</span>";
titleCP[5] = "<p><span class='learnAboutHeader'>Scratch-Offs</span><br><span class='learnAboutText'><br>Scratch-offs are areas on the back of the card that conceal readable information (PIN) until scratched off with a coin or fingernail. The information is usually variable (different on each card) and can be made up of numbers and/or letters that are ink jetted onto the card during the printing process. The scratch-off itself can be of one of two types, Label or Hot Stamp.  The difference is in the level of security each type offers, Labels are lower in security and are recommended for fund raisers, raffles, contests, marketing mailings etc., Hot Stamp is higher in security and is recommended for phone cards, pre-paid cards, lotteries etc. <br>To ensure 100% production and to be able to reprint cards if some are damaged a consecutive number is printed on each card that corresponds to the concealed numbers under the scratch-off. All data files (concealed numbers and corresponding control numbers) are handled in a secure environment and on secure servers and computers.</span>";
titleCP[6] = "<p><span class='learnAboutHeader'>Signature Panels</span><br><span class='learnAboutText'><br>A Signature Panel is an area or areas on the card that are writable with a ballpoint pen.   </span>";
titleCP[7] = "<p><span class='learnAboutHeader'>Materials</span><br><span class='learnAboutText'><br><b>PVC</b> is a durable plastic with a long life span (credit cards are PVC).<br><b>Composite, Laminated Plastic</b> is a synthetic core (Teslin) with thick plastic lamination on both sides. This creates the most durable plastic card available, it is scratch resistant without compromising image print quality. Embossing is not available on composite cards.<br /><b>Clear PVC</b> is a transparent version of PVC that is used to create cards with see through areas.</span>";

function getText(selection) {
    if (titleCP[selection].indexOf('<br>') >= 0)
        return titleCP[selection].substring(titleCP[selection].indexOf('</span><br>')+11);
    else
        return titleCP[selection];
}

function learnText(selection){
	document.getElementById("learn").innerHTML= titleCP[selection];
}
// This function checks the form fields for errors and missing information (Advanced Options)
function checkForm(formObj) {
	var formOK = true;
    if (formObj.material.value == "0") {
       	window.alert("Please select a material.");
       	formObj.material.focus();
       	formOK = false;
	   	return;
     	}
    if (formObj.quant.value == "0") {
       window.alert("Please select a quantity.");
       formObj.quant.focus();
       formOK = false;
	   return;
	   }
	if (formObj.stockThick.value == "0") {
       window.alert("Please select a thickness.\nA Refreshed page needs to be reset, please reselect Material and Thickness.");
	   formObj.material.selectedIndex = 0;
       formObj.material.focus();
       formOK = false;
	   return;
	   }
	   
	if (formObj.magType.selectedIndex != 0) {
		formObj.cardTypeNumber.value = "2";
		cardTypeNumberHolder = "1";
		formObj.cardtype.value = "Standard Credit Card Size with Mag Stripe";
		}else{
			formObj.cardtype.value = "Standard Credit Card Size";
			formObj.cardTypeNumber.value = cardTypeNumberHolder;
		}
	if(formObj.encode[0].checked && formObj.magType.selectedIndex == 0){
   		alert ("Encoding is done on a Mag Stripe, please select Mag Stripe type.");
		formObj.magType.focus();
		return;
   		}
	if(formObj.encode[0].checked && formObj.consec[1].checked){
   		formObj.consec[0].checked = true;
   		alert ("Encoding requires consecutive numbering. Next item is changed to Inkjet Concecutive Numbering.");
		document.numbering.src = imageList[11].src;
		return;
   		}		
	if(formObj.embos.selectedIndex > 0 && formObj.consec[1].checked){
   		formObj.consec[0].checked = true;
   		alert ("Embossing requires consecutive numbering. Inkjet Concecutive Numbering is activated.");
		document.numbering.src = imageList[11].src;
   		return;
   		}
	if (formObj.embos.selectedIndex > 0 && formObj.material.selectedIndex != 2){
	  	document.form1.material.selectedIndex = 2;
		formObj.consec[0].checked = true;
		window.alert("Embossing is available on White PVC material ONLY. Material has been changes to White PVC");
		formOK = false;
	  	return;
	  	}

	 if(formObj.lugtag[0].checked){
		   cardTypeNumberHolder = "1";
	   }
	 if(formObj.scrch.selectedIndex != 0){
		   cardTypeNumberHolder = "1";
	   }
	 if( formObj.Country.selectedIndex == 0){ // Check US Zip Code 
     	reZip = new RegExp(/(^\d{5}$)|(^\d{5}-\d{4}$)/);
		 if (!reZip.test(formObj.shipToZip.value)) {
			 alert("Zip Code Is Not Valid.");	
		   	 formObj.shipToZip.focus();
			 formOK = false;
			 return;
		 }
	 }else{ //Check Canadian Postal Code
		 reg_exp_pcode = new RegExp(/(^s*([a-z](\s)?\d(\s)?){3}$)s*/i);
		 if(!reg_exp_pcode.test(formObj.shipToZip.value)){
			 alert("Postal Code Is Not Valid");
			 formObj.shipToZip.focus();
			 formOK = false;
			 return;
		 	 }
	  }
		 
	 if (formOK){formObj.submit();}
}
// This function checks the form fields for errors and missing information (Basic Options)
function checkFormBasic(formObj) {
	var formOK = true;
    if (formObj.material.value == "0") {
       	window.alert("Please select a material.");
       	formObj.material.focus();
       	formOK = false;
	   	return;
     	}
    if (formObj.quant.value == "0") {
       window.alert("Please select a quantity.");
       formObj.quant.focus();
       formOK = false;
	   return;
	   }		
	if (formObj.magType.selectedIndex != 0) {
		formObj.cardTypeNumber.value = "2";
		cardTypeNumberHolder = "1";
		formObj.cardtype.value = "Standard Credit Card Size with Mag Stripe";
		}else{
			formObj.cardtype.value = "Standard Credit Card Size";
			formObj.cardTypeNumber.value = cardTypeNumberHolder;
		}
	if(formObj.encode[0].checked && formObj.magType.selectedIndex == 0){
   		alert ("Encoding is done on a Mag Stripe, please select Mag Stripe type.");
		formObj.magType.focus();
		return;
   		}
	if(formObj.encode[0].checked && formObj.consec[1].checked){
   		formObj.consec[0].checked = true;
   		alert ("Encoding requires consecutive numbering. Next item is changed to Inkjet Concecutive Numbering.");
		document.numbering.src = imageList[11].src;
		return;
   		}		
	   
     if( formObj.Country.selectedIndex == 0){ // Check US Zip Code 
	 	if(formObj.basic.value == "1"){ // Only on Basic fix shipping Method hidden
			 	formObj.shippingMethod.value = "03";
			 }
     	reZip = new RegExp(/(^\d{5}$)|(^\d{5}-\d{4}$)/);
		 if (!reZip.test(formObj.shipToZip.value)) {
			 alert("Zip Code Is Not Valid.");
			 
			 formObj.shipToZip.focus();
			 formOK = false;
			 return;
		 }
	 }else{ //Check Canadian Postal Code
	 	if(formObj.basic.value == "1"){
			 	formObj.shippingMethod.value = "11";
			 }
		 reg_exp_pcode = new RegExp(/(^s*([a-z](\s)?\d(\s)?){3}$)s*/i);
		 if(!reg_exp_pcode.test(formObj.shipToZip.value)){
			 alert("Postal Code Is Not Valid");
			 formObj.shipToZip.focus();
			 formOK = false;
			 return;
		 	 }
	  }
		 
	 if (formOK){formObj.submit();}
}
function colorList1(list) {
         list.length = 4;
         list.options[0].text = "4 Color Process/1 (Black)";
         list.options[0].value = "2";
         list.options[1].text = "4 Color Process/0";
         list.options[1].value = "1";
         list.options[2].text = "4 Color Process/2";
         list.options[2].value = "3";
		 list.options[3].text = "4 Color Process/4 Color Process";
         list.options[3].value = "4";
      }
function colorList2(list) {
         list.length = 3;
         list.options[0].text = "4 Color Process/1 (Black)";
         list.options[0].value = "2";
         list.options[1].text = "4 Color Process/0";
         list.options[1].value = "1";
		 list.options[2].text = "4 Color Process/4 Color Process";
         list.options[2].value = "4";
      }
function scratchList1(list) {
         list.length = 3;
         list.options[0].text = "None";
         list.options[0].value = "0";
         list.options[1].text = "PIN & Control w/Scratch Off label";
         list.options[1].value = "scrch1";
         list.options[2].text = "PIN & Control w/Hot Stamp Scratch Off";
         list.options[2].value = "scrch2";
      }
function scratchList2(list) {
         list.length = 2;
		 list.options[0].text = "None";
         list.options[0].value = "0";
         list.options[1].text = "PIN & Control w/Scratch Off label";
         list.options[1].value = "scrch1";
      }
function thickList1(list) { // for PVC white
         list.length = 4;
         list.options[0].text = ".030\"";
		 list.options[0].value = "1";
         list.options[1].text = ".024\"";
		 list.options[1].value = "2";
		 list.options[2].text = ".020\"";
		 list.options[2].value = "3";
		 list.options[3].text = ".015\"";
		 list.options[3].value = "4";
}
function thickList2(list) { // for Teslin
         list.length = 2;
         list.options[0].text = ".030\"";
		 list.options[0].value = "5";
		 list.options[1].text = ".020\"";
		 list.options[1].value = "6";
}
function UPS_US(list) { // UPS options for USA
         list.length = 4;
         list.options[0].text = "UPS - Next Day Air";
		 list.options[0].value = "01";
         list.options[1].text = "UPS - Second Day Air";
		 list.options[1].value = "02";
		 list.options[2].text = "UPS - 3 Day Select";
		 list.options[2].value = "12";
		 list.options[3].text = "UPS - Ground (4-5 Days) ";
		 list.options[3].value = "3";
}
function UPS_CA(list) { // UPS options for Canada
         list.length = 3;
         list.options[0].text = "Standard (6 Days Max)";
		 list.options[0].value = "11";
		 list.options[1].text = "Worldwide Express (Next Day 12:00 pm)";
		 list.options[1].value = "07";
		 list.options[2].text = "Worldwide Expedited (2 Days)";
		 list.options[2].value = "08";
}
// General Function to set all form fields to correct input variables (Advanced Options)
function setfields(thisForm){
	
	if (thisForm.material.selectedIndex == 2){ // PVC
		thickList1(thisForm.stockThick); // Thickness options for PVC (15, 20, 24, 30)
		colorList1(thisForm.color);     // Color options for PVC with 2 pantone back
		if(thisForm.stockThick.selectedIndex == 0){ // 30 mil only
			thisForm.embos.disabled=false; //embossing is enabled
		}else{
			thisForm.embos.disabled=true;  // embossing is disabled
		}
		if(thisForm.stockThick.selectedIndex < 2){ // 30 & 24 mil only
			scratchList1(thisForm.scrch);  // Scratch-off list with hot stamping
			thisForm.varni[0].disabled=false; // Enable varnish on PVC
			thisForm.varni[1].disabled=false; // Enable varnish on PVC
		}else{
			scratchList2(thisForm.scrch);  // Scratch-off list without hot stamping
			thisForm.varni[0].disabled=true; // No varnish on 15 & 20
			thisForm.varni[1].disabled=true; // No varnish on 15 & 20
		}
	}else if(thisForm.material.selectedIndex == 1){  // TESLIN
		thickList2(thisForm.stockThick); // Thickness options for teslin (20, 30)
		colorList2(thisForm.color);     // Color options for teslin no pantones
		thisForm.embos.disabled=true;  // embossing is disabled
		scratchList2(thisForm.scrch);  // Scratch-off list without hot stamping
		thisForm.varni[0].disabled=true; // No varnish on Teslin
		thisForm.varni[1].disabled=true; // No varnish on Teslin
		newImage = "url(images/Cr80-plain-front.jpg)"; // plain frint image
    	document.getElementById('tablefront').style.backgroundImage = newImage;
	}else if(thisForm.material.selectedIndex == 4){ // Paper Cards go to paper page
			window.location="CR80-paper-scratch-cards.html";
	}else if(thisForm.material.selectedIndex == 3){ // PVC Clear go to the clear card page
			window.location="clear-card-printing.html";
	}
	if (thisForm.Country.selectedIndex == 0){ // USA
		UPS_US(thisForm.shippingMethod);
	}else{
		UPS_CA(thisForm.shippingMethod);
	}
}

// General Function to set all form fields to correct input variables (Basic Options)
function setfieldsBasic(thisForm){
	
	if (thisForm.material.selectedIndex == 2){ // PVC
		thickList1(thisForm.stockThick); // Thickness options for PVC (15, 20, 24, 30)
		colorList1(thisForm.color);     // Color options for PVC with 2 pantone back
		//if(thisForm.stockThick.selectedIndex == 0){ // 30 mil only
			//thisForm.embos.disabled=false; //embossing is enabled
		//}else{
			//thisForm.embos.disabled=true;  // embossing is disabled
		//}
		//if(thisForm.stockThick.selectedIndex < 2){ // 30 & 24 mil only
		//	scratchList1(thisForm.scrch);  // Scratch-off list with hot stamping
		//	thisForm.varni[0].disabled=false; // Enable varnish on PVC
		//	thisForm.varni[1].disabled=false; // Enable varnish on PVC
		//}else{
		//	scratchList2(thisForm.scrch);  // Scratch-off list without hot stamping
		//	thisForm.varni[0].disabled=true; // No varnish on 15 & 20
		//	thisForm.varni[1].disabled=true; // No varnish on 15 & 20
		//}
	}else if(thisForm.material.selectedIndex == 1){  // TESLIN
		thickList2(thisForm.stockThick); // Thickness options for teslin (20, 30)
		colorList2(thisForm.color);     // Color options for teslin no pantones
		//thisForm.embos.disabled=true;  // embossing is disabled
		//scratchList2(thisForm.scrch);  // Scratch-off list without hot stamping
		//thisForm.varni[0].disabled=true; // No varnish on Teslin
		//thisForm.varni[1].disabled=true; // No varnish on Teslin
		newImage = "url(images/Cr80-plain-front.jpg)"; // plain frint image
    	document.getElementById('tablefront').style.backgroundImage = newImage;
	}else if(thisForm.material.selectedIndex == 4){ // Paper Cards go to paper page
			window.location="CR80-paper-scratch-cards.html";
	}else if(thisForm.material.selectedIndex == 3){ // PVC Clear go to the clear card page
			window.location="clear-card-printing.html";
	}
}
var imageList = new Array;
imageList[0] = new Image;
imageList[0].src = "images/Cr80-magstripe-blank.gif";
imageList[1] = new Image;
imageList[1].src = "images/Cr80-magstripe.gif";
imageList[2] = new Image;
imageList[2].src = "images/Cr80-sig-panel-blank.gif";
imageList[3] = new Image;
imageList[3].src = "images/Cr80-sig-panel.gif";
imageList[4] = new Image;
imageList[4].src = "images/Cr80-scratchoff-blank.gif";
imageList[5] = new Image;
imageList[5].src = "images/Cr80-scratchoff.gif";
imageList[6] = new Image;
imageList[6].src = "images/Cr80-barcode-blank.gif";
imageList[7] = new Image;
imageList[7].src = "images/Cr80-barcode.gif";
imageList[8] = new Image;
imageList[8].src = "images/Cr80-lugtag-blank.gif";
imageList[9] = new Image;
imageList[9].src = "images/Cr80-lugtag.gif";
imageList[10] = new Image;
imageList[10].src = "images/Cr80-serial-num-blank.gif";
imageList[11] = new Image;
imageList[11].src = "images/Cr80-serial-num.gif";
imageList[12] = new Image;
imageList[12].src = "images/Cr80-plain-front.jpg";
imageList[13] = new Image;
imageList[13].src = "images/Cr80-embs-front.jpg";
imageList[14] = new Image;
imageList[14].src = "images/Cr80-front-lug-blank.gif";
imageList[15] = new Image;
imageList[15].src = "images/Cr80-lug-front.gif";
imageList[16] = new Image;
imageList[16].src = "images/Cr80-colored-back.jpg";
imageList[17] = new Image;
imageList[17].src = "images/Cr80-white-back.jpg";

function changeBackImage(thisform){
	if(thisform.color.selectedIndex == 1){
		newImage = "url(images/Cr80-white-back.jpg)";
		document.getElementById('tableback').style.backgroundImage = newImage;
        document.getElementById('scratchoff').src="images/spacer.gif";
		if(thisform.magType.selectedIndex == 0){
			document.mag.src = imageList[0].src;
			}
		if(thisform.sig[1].checked){
			document.signature.src = imageList[2].src;
			}
		if(thisform.bar[1].checked){
			document.barcode.src = imageList[6].src;
			}
		if(thisform.scrch.selectedIndex == 0){
			document.scratchoff.src = imageList[4].src;
			}
		}
	if(thisform.color.selectedIndex == 0){
	   document.getElementById('scratchoff').src="images/Cr80-scratchoff-text.gif";
		newImage1 = "url(images/Cr80-bw-back.jpg)";
		document.getElementById('tableback').style.backgroundImage = newImage1;
		}
	if(thisform.color.selectedIndex == 3){
	   document.getElementById('scratchoff').src="images/Cr80-scratchoff-text.gif";
		newImage2 = "url(images/Cr80-colored-back.jpg)";
		document.getElementById('tableback').style.backgroundImage = newImage2;
		}
	if(thisform.color.selectedIndex == 2){
	   document.getElementById('scratchoff').src="images/Cr80-scratchoff-text.gif";
		newImage3 = "url(images/Cr80-white-back.jpg)";
		document.getElementById('tableback').style.backgroundImage = newImage3;
		}		
}
function changeFrontImage(thisform){
	if(thisform.embos.selectedIndex == 0){
		newImage = "url(images/Cr80-plain-front.jpg)";
		document.getElementById('tablefront').style.backgroundImage = newImage;
		}
	if(thisform.embos.selectedIndex == 1){
		newImage = "url(images/Cr80-embs-silv-front.gif)";
		document.getElementById('tablefront').style.backgroundImage = newImage;
		}

	if(thisform.embos.selectedIndex == 2){
		newImage1 = "url(images/Cr80-embs-gol-front.gif)";
		document.getElementById('tablefront').style.backgroundImage = newImage1;
		}
}
function changeLuggage(thisform){
	if(thisform.lugtag[0].checked){
		document.lug.src = imageList[15].src;
		document.hole.src = imageList[9].src;
		formObj.cardTypeNumber.value = "4";
		cardTypeNumberHolder = "4";
		}
	if(thisform.lugtag[1].checked){
		document.lug.src = imageList[14].src;
		document.hole.src = imageList[8].src;
		formObj.cardTypeNumber.value = cardTypeNumberHolder;
		}
}
function changeMagImage(thisform){
	if(thisform.magType.selectedIndex == 0){
		document.mag.src = imageList[0].src;
		}
	if(thisform.magType.selectedIndex != 0){
		document.mag.src = imageList[1].src;
		}
}
function changeSigImage(thisform){
	if(thisform.sig[0].checked){
		document.signature.src = imageList[3].src;
		}
	if(thisform.sig[1].checked){
		document.signature.src = imageList[2].src;
		}
}
function changeScratchoffImage(thisform){
 	if(thisform.scrch.selectedIndex == 0){
 		document.scratchoff.src = imageList[4].src;
		}
	if(thisform.scrch.selectedIndex != 0){
		document.scratchoff.src = imageList[5].src;
		document.consec[1].checked = true;
   		alert ("Scratch Off includes numbering. Inkjet Concecutive Numbering is deactivated.");
		document.cardTypeNumber.value = "3";
		}
}
function changeBarImage(thisform){
	if(thisform.bar[0].checked){
		document.barcode.src = imageList[7].src;
		}
	if(thisform.bar[1].checked){
		document.barcode.src = imageList[6].src;
		}
}
function changeConsecImage(thisform){
	if(thisform.consec[0].checked){
		document.numbering.src = imageList[11].src;
		}
	if(thisform.consec[1].checked){
		document.numbering.src = imageList[10].src;
		}
}
function doNothing(){
 return false;
 }
 
