// JavaScript Document
function hide(lay) {
//alert("hide");
		parent.topFrame.document.getElementById("Layer31").style.visibility = "hidden";
		parent.topFrame.document.getElementById("Layer32").style.visibility = "hidden";
		parent.topFrame.document.getElementById("Layer33").style.visibility = "hidden";
		parent.topFrame.document.getElementById("Layer34").style.visibility = "hidden";
//		parent.topFrame.document.getElementById("Layer31").style.zIndex = "0";

}

function show(lay) {
//alert("show");
		parent.topFrame.document.getElementById(lay).style.visibility = "visible";
}

//var newWindow;

var newfileName;
var dept;
var pnum;
var qty;
var orderspecs  = "";
var orderspecs2 = "";
var newWindow;

function setvalue(form) {

	var name;
//	var orderspecs = "";
	
// alert("setvalue");

	 dept = "scanning";		// check which department is adding
	 

	 
	if (dept == "print") {									
	 
		 name = document.getElementById("substrate").value;		// print department
	 

		document.getElementsByName("qty")[0].value = parent.topFrame.document.getElementById("quantity").value;
		name = document.cartadd.color.options[0].value;
		document.getElementsByName("product_no")[0].value = parent.topFrame.document.getElementById("part_noId").value;

		pnum = document.getElementsByName("product_no")[0].value;

		// copy out substrate info     
		// contruct order specifications

		orderspecs += "Print Media: "  + document.getElementById("substrate").value;
 	   document.cartadd.size.options[0].text = orderspecs;				   // size option attribute
 	   document.cartadd.size.options[0].value = orderspecs;  

		document.cartadd.size.selectedIndex = 0;
		document.cartadd.size.length = 1;

		orderspecs = " " ;
		orderspecs += "SheetSize: " + document.getElementById("sizeId").value;
		orderspecs += ", ";
		orderspecs += "Image Size: " + document.getElementById("useSizeId").value;
		orderspecs += ", " ;
		//	orderspecs += " " + "|"  + " ";
		//orderspecs += "File Name: " + parent.topFrame.document.getElementById("filenameId").value;


		stripPath();			// strip path out
		orderspecs += "File Name: " + newfileName;


  	    document.cartadd.color.options[0].text = orderspecs;			   // color option attribute	
	    document.cartadd.color.options[0].value = orderspecs;  

		// make change visible
		document.cartadd.color.selectedIndex = 0;
		document.cartadd.color.length = 1;
//		document.cartadd.submit();
		return;
		}
		
		if (dept == "frame") {									

			name = document.getElementById("frameId").value;	// frame department
	 

			document.getElementsByName("qty")[0].value = 1;
			name = document.cartadd.color.options[0].value;
			document.getElementsByName("product_no")[0].value =  (document.getElementById("part_noId").value * 1) ;

			pnum = document.getElementsByName("product_no")[0].value;


			// contruct order specifications
			// copy out frame info   
	  
			orderspecs += "Frame Name: "  + document.getElementById("frameId").value;
			orderspecs += ", ";
			orderspecs +=   "Frame Size: " + document.getElementById("frameSizeId").value;
	  		document.cartadd.size.options[0].text = orderspecs;				   // size option attribute
		    document.cartadd.size.options[0].value = orderspecs;  

			document.cartadd.size.selectedIndex = 0;
			document.cartadd.size.length = 1;

			orderspecs = " " ;
			orderspecs += "Matte Size: Top [" + document.getElementById("mattetopId").value + "]";
			orderspecs += ", ";
			orderspecs += "Left ["    + document.getElementById("matteleftId").value   + "]";
			orderspecs += ", ";
			orderspecs += "Right ["   + document.getElementById("matterightId").value  + "]";
			orderspecs += ", " ;
			orderspecs += "Bottom ["  + document.getElementById("mattebottomId").value + "]";
			orderspecs += ", " ;


			stripPath();			// strip path out
			orderspecs += "Image File Name: " + newfileName;


		    document.cartadd.color.options[0].text = orderspecs;			   // color option attribute	
		    document.cartadd.color.options[0].value = orderspecs;  

			// make change visible
			document.cartadd.color.selectedIndex = 0;
			document.cartadd.color.length = 1;
//			document.cartadd.submit();	
			return;	
		}
		
		if (dept == "scanning") {	
		

		name = document.getElementById("substrate").value;		// print department
	 	qty = document.getElementById("quantity").value;
		pnum =( document.getElementById("part_noId").value *1);

//		document.getElementsByName("qty")[0].value = parent.topFrame.document.getElementById("quantity").value;
//		name = document.cartadd.color.options[0].value;
//		document.getElementsByName("product_no")[0].value = parent.topFrame.document.getElementById("part_noId").value;
//	document.getElementsByName("product_no")[0].value = 1;			//test register.com
//	pnum = document.getElementsByName("product_no")[0].value;

		// copy out substrate info     
		// contruct order specifications
		orderspecs   = "";						// initialize it to nul text
		orderspecs2  = "";						// initialize it to nul text

		orderspecs += "Scan Media: "  + document.getElementById("substrate").value;
// 		document.cartadd.size.options[0].text = orderspecs;				   // size option attribute
//	 	document.cartadd.size.options[0].value = orderspecs;  

//		document.cartadd.size.selectedIndex = 0;
//		document.cartadd.size.length = 1;

		orderspecs += " " ;
		orderspecs += "ScanSize: " + document.getElementById("sizeId").value;
		orderspecs2 += "";
	//	orderspecs += "Image Size: " + parent.topFrame.document.getElementById("useSizeId").value;
	//	orderspecs += ", " ;
		//	orderspecs += " " + "|"  + " ";
		//orderspecs += "File Name: " + parent.topFrame.document.getElementById("filenameId").value;


	//	stripPath();			// strip path out
		newfileName = document.getElementById("filenameId").value ;
		orderspecs2 += "Scan Media Identification Name/Title: " + newfileName;


//  	document.cartadd.color.options[0].text = orderspecs;			   // color option attribute	
//  	document.cartadd.color.options[0].value = orderspecs;  

		// make change visible
//		document.cartadd.color.selectedIndex = 0;
//		document.cartadd.color.length = 1;
//		document.cartadd.submit();
		return;
	
		}								

		
}


function makeNewWindow() {
	if (newWindow && !newWindow.closed) {
		newWindow.close();
	}

	newWindow = window.open("","", "status, height=600, width=800, menubar,scrollbars, toolbar, resizable");		// open new window
	setTimeout("subWrite()",200);
}

function subWrite() {
// alert("subWrite - newWindow: " + parent.topnavFrame.newWindow);
	// make new window if someone has closed it
	if (newWindow.closed) {
		makeNewWindow();
	}
	
	// bring window to front
	newWindow.focus();
	
	// assemble content for new window
	var newContent = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
	newContent += '<html xmlns="http://www.w3.org/1999/xhtml">';
	newContent += '<head>';
	newContent += '<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />';
	newContent += '<title>aaadd new window</title>';
	newContent += '</head>' ;

	
	newContent += '<body  bgcolor="#FFFFCC" text="#000000" onload = "document.cartadd.submit();">' ;
	newContent += "<form name='cartadd' method='POST' action='https://store.printallimages.com/servlet/Cart' target = '_self'>";
//	newContent += "<form name='cartadd' method='POST' action='http://storesense2.megawebservers.com/HS3314/Cart.bok' target = '_self'>";

	newContent += '<input type="hidden" name="smode" value="add">';
	newContent += '<input type="hidden" name="product_no" value="';
	newContent += pnum ;
// newContent += '1' ;
	newContent += '">';
	newContent += '<input type="hidden" name="basePrice" value="200">';

	newContent += '<table border="0" cellpadding="2" cellspacing="2">';
	newContent += '<tr>';

	newContent += '<td bgcolor="#999999">';
	newContent += '<div align= "center" >';
	newContent += 'ADDING YOUR ITEM TO SHOPPING CART -- PLEASE WAIT';
	newContent += '</div>';
	newContent += '</td>';


 	newContent += '</table>';

	newContent += '<p>';
	newContent += '<font face="Arial, Helvetica, sans-serif" color="black" size="2"><input type="hidden" name="qty" value="';
	newContent += qty;
	newContent += '" size="3"></font>';
	newContent += '</p>';

	newContent += '<p>';

	//		document.cartadd.size.selectedIndex = 0;
//		document.cartadd.size.length = 1;
	newContent += '<font face="Arial, Helvetica, sans-serif" color="black" size="2">';
	newContent += '<select name="color"  >';
		newContent += '<option id = "orderText" ';
		newContent += 'selected value="';
		newContent += orderspecs;
		newContent += '">';
		newContent += orderspecs;
		newContent += '</option>';
	newContent += '</select>';
	newContent += '</font>';
			newContent += '&nbsp;&nbsp;';
	
	
		newContent += '<font face="Arial, Helvetica, sans-serif" color="black" size="2">';
		newContent += '<select name="size">';

// alert("orderspecs2: " + orderspecs2);

			newContent += '<option value="Qty">Qty</option>';
			newContent += '<option  selected value="';
			newContent += orderspecs2;
			newContent += '">';
			newContent += orderspecs2;
			newContent += '</option>';
		newContent += '</select>';
		newContent += '</font>';
	
// alert("newContent: " + newContent);
	
	

		newContent += '</p>';

//		newContent += '<p><input type="submit"  border="0" alt="Buy It"></p>';
		newContent += '</form>';

		newContent += '</body>';
		newContent += '</html>';
		
		// write HTML to new window document
		newWindow.document.write(newContent);
		newWindow.document.close();						// close layout stream

}


var popup;
var zap = "2";
var gtype;
var gsubstrate ;
var gsize ;
var gpartNo;
var mname ;
var gsubinfo;
var gmaxImage;
var specs = 0;
var globform;

function showExplain(layerId) {
// alert("showExplain");
  document.getElementById(layerId).style.visibility = "visible";
//  document.getElementById(layerId).style.visibility = "visible";

}

function hideExplain(layerId) {
//alert("hideExplain");
  document.getElementById(layerId).style.visibility = "hidden";

}

function findPartNo(form)  {
alert("findPartNo");
}

function doSelection(fld)  {

	document.substrate_opt.quantity.focus();
	document.substrate_opt.quantity.select();
}

function getPopupField(form)  {
  document.getElementById("Layer1").style.visibility = "visible";
  var fld = "document." + form.name + ".laytext";
	setTimeout("doSelection(document." +form.name + "." + "laytext" + ")", 0);

		
}

function checkit(evt,form){

	evt = (evt) ? evt : event;
	var charCode = (evt.charCode) ? evt.charCode : ((evt.which) ? evt.which : evt.keyCode);
	if (charCode == 13) {
        loadField(form); 
	    return false;
	}
	    return true;
}

function loadField(form) {

	form.quantity.value = form.laytext.value;
	document.substrate_opt.quantity.blur();
    document.getElementById("Layer1").style.visibility = "hidden"; 
	checkcalculate(form);
}

function checkcalculate(form) {
    		    if(form.size.value != null && form.substrate.value != null){
                     if( form.size.value != " ") {                      
                         CalculatePrice(form)  ;
					 }  
			      }else{
 			        form.unitPrice.value = 0.0;
	       		    form.extendedPrice.value = 0;
                 }
}

function CalculatePrice(form)   {

            var selText; 
			var selValue;
			var unitPrice;
			var sizePrice = 0.0;
			var substrateSurcharge = 0.0;
			var quantity;
			var extendedPrice;
			var partNo;
			var nerror =" "; //generate a blank
			
			unitPrice = getField("basePrice");					// get base price						
			if (isNaN(unitPrice)) {
				unitPrice = 0;	
			}
			unitPrice = parseFloat(unitPrice);  // convert unitPrice to integer

			if (isNaN(quantity)) {				// check for valid quantity number
				quantity = 0;					// invalid entry make it zero	
			}
			var  loopcnt = 4;
            quantity = parseInt(form.quantity.value,10);  // convert quantiy to integer
			for (i = 0; i < loopcnt ;  ++ i) {
			
				if (quantity == 0) {				// Quantity 0
					partNo = parseInt(gpartNo,10)
					document.getElementById("part_noId").value = "" + partNo ; 	// record it - force string conversion					  
					break;
				}
				if (quantity == 1) {				// Quantity 1
					partNo = parseInt(gpartNo,10)
					document.getElementById("part_noId").value = "" + partNo ; 	// record it - force string conversion					  
					break;
				}
				if (quantity < 6) {
	//				unitPrice = unitPrice * 0.98 ; 	// 2% discoint
					partNo = parseInt(gpartNo,10)
//					partNo = partNo  + 1;		// Bump part number to 2%
					document.getElementById("part_noId").value = "" + partNo ; 	// record it - force string conversion					  
					break;
				}
				if (quantity < 11) {
	//				unitPrice = unitPrice * 0.95 ; 	// 5% discoint
					partNo = parseInt(gpartNo,10)
//					partNo = partNo  + 2;		// Bump part number to 5%
					document.getElementById("part_noId").value = "" + partNo ; 	// record it - force string conversion					  
					break;
				}
				if (quantity > 10) {
	//				unitPrice = unitPrice * 0.90 ; 	// 10% discoint
					partNo = parseInt(gpartNo,10)
//					partNo = partNo  + 3;		// Bump part number to 10%
					document.getElementById("part_noId").value = "" + partNo ; 	// record it - force string conversion					  
					break;
				}
				break;
			}
 
 			form.unitPrice.value = format(unitPrice,2) ;

            extendedPrice =   unitPrice * quantity;      
			form.extendedPrice.value =format(extendedPrice,2);
	   }

 function inspect(form)  {
          
           alert(form.sel_substrate.options[form.sel_substrate.selectedIndex].text);
           alert(form.sel_substrate.options[form.sel_substrate.selectedIndex].value);
           
		   }                 

function SelectSubstrate(fld)  {

	document.substrate_opt.substrate.focus();
	document.substrate_opt.substrate.select();
	document.substrate_opt.substrate.blur();
}
function PickSubstrate (form){

            var selv; 
			var nerror = " ";
			var zerro; 
			globform = form;
			selv = form.sel_substrate.options[form.sel_substrate.selectedIndex].text; 	// pick up selected option
//			document.substrate_opt.substrate.focus();
			setTimeout("SelectSubstrate(document." + "substrate_opt" + "." + "substrate" + ")", 100);
//			document.substrate_opt.substrate.select();
			populateSize(selv);											// now we picked substrate - populate size options

			document.getElementById("unitPriceId").value = " ";			// blank out unitPrice    input field
			document.getElementById("extendedPriceId").value = " ";		// blank outextendedPrice input field
			

            gsubstrate  = selv ;				// record substrate for global
			gsubinfo = getField("smallImage");		// substrate info html
			gmaximage = getField("maxImageSize");				  		// get maximum image size
			document.getElementById("maxImageId").value = gmaximage;    // record it into input field for add to shop cart						   						
			partNo = getField("partNo");						 		// get part no
			gpartNo = partNo ; 		  							  		// record part no globbally
			partNo = parseInt(gpartNo,10)
			document.getElementById("part_noId").value = "" + partNo ; 	// record it - force string conversion					  
																  		// into hidden field foe add to shop cart						   						

// alert(gsubstrate + gsubinfo);
			form.substrate.value = selv;
			                                                       //check if all info in to calculate
            quantity = parseInt(form.quantity.value,10);  //convert quantiy to integer
 			nerror = "" +quantity;    //force string conversion

			if(nerror != "NaN" && form.size.value != null){
               if(form.size.value != " "){
                    zerro =  parseInt(form.quantity.value,10);
                    CalculatePrice(form)  ; 
					} 
			}else{
            }
     }

function PickSize (form){
            var selv;
			var partNo ; 			  
			var zerro; 
			 
			globform = form;

			selv = form.sizeTable.options[form.sizeTable.selectedIndex].text;
			form.size.value = selv;
 			gsize  = selv ;										   // recod size for globbaly
																   // get base price
																   
  			                                                    		//check if all info in to calculate
			partNo = getField("partNo");						 		// get part no
			gpartNo = partNo ; 		  							  		// record part no globbally
			document.getElementById("part_noId").value = partNo;  		// record it into hidden field foe add to shop cart						   						

			gmaximage = getField("maxImageSize");				  		// get maximum image size
			document.getElementById("maxImageId").value = gmaximage;    // record it into hidden field foe add to shop cart						   						

            CalculatePrice(form)  ;

     }
	 
function populateLists() {
	populateType();
	populateSubstrate();
}

function populateSubstrate() {
		var listObject = document.substrate_opt.sel_substrate;
		var asearch;
		var found;
		var count = 0;
		
		alength = substrateArray.length;
		document.substrate_opt.sel_substrate.options.length = 1;
		
		for (var i = 0; i < alength; i++) {
			asearch = listObject.options.length;							// set searchcount
			found = 0;								// found flag
			for(var z = 0; z < asearch; z++) {
 	 			if (listObject.options[z].text == substrateArray[i].substrate) {
					found = 1;							// same found duplicate
				}else {
					found = 0;
				}
			}
			if (found == 0)  {
 				listObject.options[count] = new Option(substrateArray[i].substrate);	// record new substrate
				count += 1;
				found = 0;
			}
		}
}

function populateSize(subSel) {
		var listObject = document.substrate_opt.sizeTable;
		var asearch;
		var found;
		var count = 0;
		var atleastone = 0;
		
		alength = substrateArray.length;
		document.substrate_opt.sizeTable.options.length = 1;					// force no match
		document.substrate_opt.sizeTable.options[0].text = "               " 	// force no match
		
		for (var i = 0; i < alength; i++) {
			asearch = listObject.options.length;							// set search count
			found = 0;								// found flag

			if (subSel == substrateArray[i].substrate) {			// pick only selected substrate

				for(var z = 0; z < asearch; z++) {
 	 				if (listObject.options[z].text == substrateArray[i].size) {
						found = 1;							// same found duplicate
					}else {
						found = 0;
					}
				}
					if (found == 0)  {
						listObject.options[count] = new Option(substrateArray[i].size);	// record new size option
						count += 1;
						found = 0;
						atleastone = 1 ;
					}else {
					}
			}else{
			}
		}
		if (atleastone == 1) {
			document.getElementById("sizeId").value = listObject.options[0].text;			// set size input field to first option 
 			gsize  = listObject.options[0].text; ;										    // recod size for globbaly
			gpartNo = 63;																    // base partnumber for Archival Fine Art Prin

		}
}

function getField(fieldName)  {
	var alength;
	var subin;
	var sizein;
	var ss;
	var tt;
	var ff
	 
	alength = substrateArray.length;
	subin = gsubstrate ;										// substrate global value
	sizein = gsize ;											// size      global value
	ss = subin + sizein;

	for(var i = 0; i < alength; i++) {
		tt = substrateArray[i].substrate;
		tt += checkForEmptyStr(substrateArray[i].size)

		if (ss == tt) {
			return doField(fieldName,i) ;			
		}
	}
}

function doField(field,i) {
		var ff;
		
		 if (field == "substrate")  {
			ff = substrateArray[i].partNo ;
		 }
		 if (field == "size")  {
			ff = substrateArray[i].size ;
		 }
		 if (field == "type")  {
			ff = substrateArray[i].type ;
		 }
		 if (field == "maxImageSize")  {
			ff = substrateArray[i].maxImageSize ;
		 }
		 if (field == "useImageSize")  {
			ff = substrateArray[i].useImageSize ;
		 }
		 if (field == "smallImage")  {
			ff = substrateArray[i].smallImage ;
		 }
		 if (field == "largeImage")  {
			ff = substrateArray[i].largeImagee ;
		 }
		 if (field == "upFile")  {
			ff = substrateArray[i].upFile ;
		 }
		 if (field == "CdDvd")  {
			ff = substrateArray[i].CdDvd ;
		 }
		 if (field == "basePrice")  {
			ff = substrateArray[i].basePrice ;
		 }
		 if (field == "partNo")  {
			ff = substrateArray[i].partNo ;
		 }

		 return ff ;
}





function checkForEmptyStr(string) {				// test if string is all blanks

	var slength = string.length;

	for (var i = 0; i < slength; i++) {
		if (string[i] == " ") {									// check if character is blank		
			if (i == slength-1) {
				return null;					//  string contains all blanks
			}
		}else {
//	    	return string.substr(i,slength-1)	//  characteris not a blank - returns  string minus leading blanks 
	    	return string.substr(i,slength)	//  characteris not a blank - returns  string minus leading blanks 
		}			
		}	// end of for
} 
function format(expr,decplaces) {			
											// convert number to tring 
											// add decimal point
											// x number of zero after decimal point
											// raise incoming value by power of 10 times the
											// number of decimal places; round to an integer; convert to string

	var str = "" + Math.round(eval(expr) * Math.pow(10,decplaces));
											// pad small value strings with zeros to the left  of rounded number
	while (str.length <= decplaces) {
		str = "0" + str;
	}										
											// establish location of decimal point
	var decpoint = str.length - decplaces;
											// assemble final result from: 
											// (a) the string up to the position of the decimal point;
											// (b) the decimal point;
											// (c) the balance of the string;
											// return finished product
	return str.substring(0,decpoint) + "." + str.substring(decpoint,str.length);																					
}
function populateType()  {
		var alength;
//		var listObject = document.TypeForm.selectType;
		 
		document.getElementById("type1").value = typeArray[0];
		document.getElementById("type2").value = typeArray[1];
		document.getElementById("type3").value = typeArray[2];
//		document.substrate_opt.type3.focus();
//		document.substrate_opt.type3.select();
		document.getElementById("type4").value = typeArray[3];
//		document.substrate_opt.type4.focus();
//		document.substrate_opt.type4.select();
		document.getElementById("type5").value = typeArray[4];
		document.getElementById("type6").value = typeArray[5];
//		document.substrate_opt.type6.focus();
//		document.substrate_opt.type6.select();
//		document.substrate_opt.type6.blur();
		document.getElementById("type6").style.color = "red";
		document.getElementById("type7").value = typeArray[6];
		document.getElementById("type8").value = typeArray[7];
		document.getElementById("type9").value = typeArray[8];
		document.getElementById("type10").value = typeArray[9];
		document.getElementById("type11").value = typeArray[10];

}
function loadSubstrate(form,typeIn)  {

	var searchtype;
	var subfound;
	var listObject = document.substrate_opt.sel_substrate;
	var asearch;
	var found;
	var count = 0;
	var selv ;

	searchtype = document.getElementById(typeIn).value ;
																// collect all substrate with current type value
																// loaded them into substrate selection option array
	alength = substrateArray.length ;							// set loop count for substrate array
	cleanTypeTag();												// set all value field text to black
	
	document.getElementById(typeIn).style.color = "blue";

	document.substrate_opt.sel_substrate.options.length = 1;
	document.substrate_opt.sel_substrate.options[0].text = "                                       ";

	for (var i = 0; i < alength; i++) {
		if (searchtype == substrateArray[i].type) {
			subfound = substrateArray[i].substrate;
			asearch = listObject.options.length;							// set searchcount
			found = 0;								// found flag
			for(var z = 0; z < asearch; z++) {
		 		if (listObject.options[z].text == substrateArray[i].substrate) {
					found = 1;							// same found duplicate
				}else {
					found = 0;
				}
			}
			if (found == 0)  {
 				listObject.options[count] = new Option(substrateArray[i].substrate);	// record new substrate
				count += 1;
				found = 0;
			}
		}else{
		}
	}
																	// populate size selection options
	selv = document.substrate_opt.sel_substrate.options[0].text; 	// pick up selected option
    gsubstrate  = selv ;					 						// record substrate for global
	document.getElementById("substrate").value = selv;
	
	populateSize(selv);											// now we picked substrate - populate size options

	selv = document.substrate_opt.sizeTable.options[0].text ;


	document.getElementById("sizeId").value = selv;
 	gsize  = selv ;											   // recod size for globbaly
//    gsubstrate  = selv ;					// record substrate for global
	gsubinfo = getField("smallImage");		// substrate info html

	gmaximage = getField("maxImageSize");				  		// get maximum image size
	document.getElementById("maxImageId").value = gmaximage;    // record it into hidden field foe add to shop cart	
	  			                                                    		//check if all info in to calculate
	partNo = getField("partNo");						 		// get part no
	gpartNo = partNo ; 		  							  		// record part no globbally
	document.getElementById("part_noId").value = partNo;  		// record it into hidden field foe add to shop cart	
	globform =	document.getElementById("configure");	

	CalculatePrice(globform)  ;
					   						

	
	return false;
}

function cleanTypeTag()  {

		document.getElementById("type1").style.color = "black";
		document.getElementById("type2").style.color = "black";
		document.getElementById("type3").style.color = "black";
		document.getElementById("type4").style.color = "black";
		document.getElementById("type5").style.color = "black";
		document.getElementById("type6").style.color = "black";
		document.getElementById("type7").style.color = "black";
		document.getElementById("type8").style.color = "black";
		document.getElementById("type9").style.color = "black";
		document.getElementById("type10").style.color = "black";
		document.getElementById("type11").style.color = "black";

}

function showSpecs(form) {

//alert("mname: " + mname);

//alert("showSpecs(form)"+ gsubinfo);
	if (!gsubinfo) {
										// substrate info not defined
	}else {
	 	if(!mname || mname.closed) {
			mname = window.open(gsubinfo , "def", "height=300,width=600,resizable,dependent,scrollbars");
			specs= 1;
			
//alert("just opened new window" + mname);

		}else {
			// bring subwindow to the front
				mname.location.replace(gsubinfo);
				mname.focus();
		} 
//alert("just opened new window 2");

	}
}

function browse() {		// strip out path info
	var fileName;
	
alert("browse");
	fileName = document.getElementById("imageId").value ;

alert(fileName);
	var alength = fileName.length;
	var found = 0;
	
alert(alength);	
	found = fileName.lastIndexOf(":") ;									// search string for ":"
																		// if none job is done
	if (found == -1) {
alert("no : ");
		return;						// no ":" job is done
	}
										// if some strip out file name start from the back
	var newfileName = fileName.slice(found + 1);										
//	for (i=0; i< alength; ++i) {
//		if (fileName[i] == ":") {
//
//		}
//	}
alert(newfileName);
document.getElementById("imageId").value  = newfileName;
}

function setblack() {				// set image file prompt text to black
		document.getElementById("fileImage").style.color = "black";  
}

function checkform() {											// check for required infos

																// enter image size
																// substrate
																// sheet size 

																// image file name

	var fileName;
	fileName = document.getElementById("filenameId").value;
	if (fileName == "") {
		alert("Please enter an identificaton Name/Title of the material you  want to scan");
		document.getElementById("fileImage").style.color = "red"; 
		return false; 
	}																
																// quantity
	var quantity;
	quantity = document.getElementById("quantity").value;
	if (isNaN(quantity) || checkForEmptyStr(quantity) == null || quantity < 1) {									// check for valid quantity number
		alert('Please enter a valid value for "QUANTITY" ');		// invalid entry make it zero
		document.substrate_opt.quantity.focus();

//		setTimeount("doSelection(document." + "substrate_opt" + "." + "quantity" + ")", 100);
		
		document.substrate_opt.quantity.focus();

		document.substrate_opt.quantity.select();
		

		return false; 
	}																

//		parent.mainFrame.location.href = "add_cart_attr_qty.html";		// all info present go add to shopping cart
//		parent.mainFrame.location.href = "aaad_new_window.html";		// all info present go add to shopping cart
		setvalue(this.form); 

		makeNewWindow(); 
//		subWrite();
}

function printLabel() {


	 	if(!mname || mname.closed) {
			mname = window.open("shipping_label.html" , "def", "height=300,width=500,resizable,dependent,scrollbars");
		}else {
			// bring subwindow to the front
				mname.location.replace(gsubinfo);
				mname.focus();
		}
}

function unloadCheck() {

alert("unload" + specs);

}

function doNothing() {


}

function emulate()  {

}