
 function show_large_quantities(){
          if (document.getElementById('div_turnaround_table_large').style.display == "none"){
						 document.getElementById('div_turnaround_table_large').style.display = "block";
						// document.getElementById('div_turnaround_table_large').style.display = "none";
					} else {
						 //document.getElementById('div_turnaround_table_small').style.display = "none";
						 document.getElementById('div_turnaround_table_large').style.display = "none";
					}
	 }

var submit_step = 0;
var alert_message = "";
var submit_now = true;	
	
function makeRequest(url_string){


    
	var xmlHttp=null;
	try {
		xmlHttp = new XMLHttpRequest(); 
	} catch (e) {
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}

	xmlHttp.onreadystatechange = function() {
		if (xmlHttp.readyState == 4)
			try {
				if (xmlHttp.status == 200) {
				    //document.getElementById(output_div).innerHTML  = xmlHttp.responseText;
				    try {
						//alert(xmlHttp.responseText);
						eval(xmlHttp.responseText);
						}  catch (e) {
						alert("Sorry, we are unable to modify your product at this time\n");
					}
					
					try {
					 tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
					 imgLoader = new Image();// preload image
					 imgLoader.src = tb_pathToImage;
					}  catch (e) {
            		 		}
					
						//submit_step = submit_step + 1;
				    //if( submit_step < 4){
				    // submit_it();
				    //} else {
				    // submit_step =0;
				   // }
					return true;
				}
			} catch (e) {
					try {
						//alert("Error: " + e.description);
					}  catch (e) {

					}
				return false;
			}
	}
	xmlHttp.open("get",url_string); // .open(RequestType, Source);
	xmlHttp.send(null); // Since there is no supplied form, null takes its place
}




   function alertContents() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);
            result = http_request.responseText;
            document.getElementById('myspan').innerHTML = result;            
         } else {
            alert('There was a problem with the request.');
         }
      }
   }
   
	 
	 
   
   
	function submit_it() {
	  var url_string = return_variables();
		url_string = "../../includes2/ajax_shop3.php?ms="+new Date().getTime() + "&action=price_update" +  url_string;
		makeRequest(url_string);
		return true;
	}

	
		// CHeck Final Submit -- Used for PMS and Custom Cuts etc.  
	function submit_it_check() {
	  alert_message = "";
		submit_now = true;
	  var url_string = return_variables();
		
		if (submit_now == false){
		  alert(alert_message);
		  return false;
		} else {
			return true;
		}
	}
   
   
   
   function refresh_page(){
     var url_string = "&";
	 
	    obj = document.getElementById('shop_form');
		  try {
            var sel = obj.category_id ;
						category_id= sel.options[sel.selectedIndex].value;
            url_string += "category_id=" + category_id + "&";
         } catch (e) {
           
       }
		
				
					url_string = "/index.php?page=shop&ms="+new Date().getTime()  +  url_string;
       window.location=url_string;
   
   
   }
   
   
   
   
   
  function return_variables(){
   var url_string = "&";
   var sel = "";
    
   obj = document.getElementById('shop_form');
		
			
			
// Category ID
			try {
            var sel = obj.category_id ;
						category_id= sel.options[sel.selectedIndex].value;
            url_string += "category_id=" + category_id + "&";
         } catch (e) {
           
       }
			
			// SIZE ID
			try {
            var sel = obj.size_id ;
						size_id= sel.options[sel.selectedIndex].value;
            url_string += "size_id=" + size_id + "&";
         } catch (e) {
           
       }
				// STOCK ID
			try {
            var sel = obj.stock_id ;
						stock_id= sel.options[sel.selectedIndex].value;
            url_string += "stock_id=" + stock_id + "&";
         } catch (e) {
           
        }
							// COLOR ID
			try {
            var sel = obj.color_id ;
						color_id= sel.options[sel.selectedIndex].value;
            url_string += "color_id=" + color_id + "&";
         } catch (e) {
           
        }

				
										// TURNAROUND QUANTITY
			try {
						len = obj.turnaround_quantity.length;
						
						 for (i = 0; i <len; i++) {
						 		 if (obj.turnaround_quantity[i].checked) {
 								 		url_string += "turnaround_quantity=" +  obj.turnaround_quantity[i].value + "&";
										}
									}
						
						
         } catch (e) {
           
        }


								
							// MULTI PRODUCT
	   try {
						len = obj.multi_product_id.length;
						
						 for (i = 0; i <len; i++) {
						 		 if (obj.multi_product_id[i].checked) {
 								 		url_string += "multi_product_id=" +  obj.multi_product_id[i].value + "&";
										}
									}
						
						
         } catch (e) {
           
        }

				
	
	 for (i = 0; i < 40; i++) {
	  try {
		        var select_type = eval("obj.option_select_" + i) ;
						select_value = select_type.options[select_type.selectedIndex].value;
						select_name = select_type.name;
            url_string += select_name + "=" +  select_value + "&";
	      } catch (e) {
           
        }
	 }
	 
	 try {
				var custom_cut_select = obj.option_select_10 ;
				var custom_out = custom_cut_select.options[custom_cut_select.selectedIndex].value;

	 			custom_cutting_width = obj.custom_cutting_width.value;
				custom_cutting_length = obj.custom_cutting_length.value;
				 url_string += "&custom_out=" +custom_out;
				 url_string += "&custom_cutting_width=" +custom_cutting_width;
				 url_string += "&custom_cutting_length=" +custom_cutting_length;
				 
				  if (custom_out > 0){
				 
			
				   if(custom_cutting_width.length == 0){
				 	   alert_message = "Please privde Custom Cut dimensions.";
				 		 submit_now = false;
						}
						if(custom_cutting_width.length == 0){
				 	   alert_message = "Please privde Custom Cut dimensions.";
						 submit_now = false;
				 		}
						
					}	
				 
				 
    } catch (e) {
           
        }
        
        
        //PMS COLOR
        try{
			if (document.getElementsByName("pms_color_1").length)
			{
                pms_color_1 = obj.pms_color_1.value;
				 url_string += "&pms_color_1=" +pms_color_1;
				 
				   if(obj.pms_color_1.value.length == 0){
					   alert_message = "You must supply PMS Colors.";
				 		 obj.pms_color_1.focus(); // set the focus to this input
						 submit_now = false;
					 }
			}
				 
	    } catch(e){
        
        }
         
        //PMS COLOR
        try{
			if (document.getElementsByName("pms_color_2").length)
			{
                pms_color_2 = obj.pms_color_2.value;
				 url_string += "&pms_color_2=" +pms_color_2;
				 
				 if(obj.pms_color_2.value.length == 0){
				 	    alert_message = "You must supply PMS Colors.";
				 		  obj.pms_color_1.focus(); // set the focus to this input
						   submit_now = false;
						}
			}
	    } catch(e){
        
        }


// if (submit_step == 0){
		// Output Div
		    try {
		       var output_div= obj.div_product.value;
					 url_string += "&div_product=" +output_div;
		     } catch (e) {
		   }
	//   }
	
	
	 //  if (submit_step == 1){
		// Output Div
		    try {
		       var output_div= obj.div_turnaround.value;
					 url_string += "&div_turnaround=" +output_div;
		     } catch (e) {
		   }
	  // }
	 //  if (submit_step == 2){
		// Output Div
		    try {
		       var output_div= obj.div_options.value;
					 url_string += "&div_options=" +output_div;
		     } catch (e) {
		   }
	 //  }
	 //  if (submit_step == 3){
		// Output Div
		    try {
		       var output_div= obj.div_overview.value;
					 url_string += "&div_overview=" +output_div;
		     } catch (e) {
		   }
	 //  }
		     /** BEGIN Mailing addition 20091005 **/
			  try {
					 var h = obj.mailing_option_quantity;
					 url_string += "&mailing_option_quantity="+h.value;
				 } catch (e) {
			}
		// Mailing Token
				try {
					var mail_opt_count = parseInt(obj.mailing_option_count.value);
					url_string += "&mailing_option_count="+mail_opt_count.toString();
					for (var i = 0; i < mail_opt_count; i++)
					{
						var h = obj["mailing_option_type_"+i.toString()];
						if (h.value=="" || h.value=="later") continue;
						url_string += "&"+h.name+"="+h.value;
						h = obj["mailing_option_token_id_"+i.toString()];
						if (h.value != "") url_string += "&"+h.name+"="+h.value;
						h = obj["mailing_option_upload_id_"+i.toString()];
						if (h.value != "") url_string += "&"+h.name+"="+h.value;
						h = obj["mailing_option_filename_"+i.toString()];
						if (h.value != "") url_string += "&"+h.name+"="+h.value;
						h = obj["mailing_option_token_"+i.toString()];
						if (h.value != "") url_string += "&"+h.name+"="+h.value;
						h = obj["mailing_option_quantity_"+i.toString()];
						if (h.value != "") url_string += "&"+h.name+"="+h.value;
						h = obj["mailing_option_cost_"+i.toString()];
						if (h.value != "") url_string += "&"+h.name+"="+h.value;
						h = obj["mailing_option_cost_per_"+i.toString()];
						if (h.value != "") url_string += "&"+h.name+"="+h.value;
						h = obj["mailing_option_quantity_"+i.toString()];
						if (h.value != "") url_string += "&"+h.name+"="+h.value;
						h = obj["mailing_option_name_"+i.toString()];
						if (h.value != "") url_string += "&"+h.name+"="+h.value;
					}
				} catch (e) {
			}
/** END Mailing addition 20091005 **/
				
return url_string;				
   }