function runonload()
{
	if(document.getElementById("ispriced") != "undefined" && document.getElementById("ispriced") != null && document.getElementById("ispriced").value == "Yes" )
	{
	
		if(document.getElementById("goptions") != "undefined" && document.getElementById("goptions") != null)
		{
		var option = document.getElementById("goptions").value}
		if(document.getElementById("item") != "undefined" && document.getElementById("item") != null)
		{var pid = document.getElementById("item").value}
		if(document.getElementById("goptions") != "undefined" && document.getElementById("item") != "undefined" && document.getElementById("goptions") != null && document.getElementById("item") != null)
		{	
			var pagereload = "yes";
			changedForm(option,pid,pagereload);
		}
	}
	else
	{
		if(document.getElementById("goptions") != "undefined" && document.getElementById("item") != "undefined" && document.getElementById("goptions") != null && document.getElementById("item") != null)
		{	
			var option = document.getElementById("goptions").value;
			var pid = document.getElementById("item").value;
			var pagereload = "yes";
			nonPricedChangedForm(option,pid,pagereload);
		}
	}

	if(document.getElementById("ttlWt") && document.getElementById("szip") && document.getElementById("ship_opt"))
	{$(document).ready(function(){
		var totalWeight = document.getElementById("ttlWt").value;
	 	var szip = document.getElementById("szip").value;
		var radio = 0;
		
	  if($(".ship_opt:checked"))
					{	
						var shipOptionInput = $(".ship_opt:checked");
						radio = $(".ship_opt:checked").val();
						
					}
											
							   
		if(totalWeight != "" && szip != "" && radio != "")
		getshippingrate("szip",radio,totalWeight,shipOptionInput)
		});
	}
	
}

runonload();


//function to navigate (according to the product selected) to estimate form or online order form
function clickedcontinue(url)
{
	var url = url;
	document.getquote.action = url;
	document.getquote.submit();
}
//function to check if the product is selected correctly
function validate_selection()
{

	if(document.getElementById("costofprod").value == "" || document.getElementById("costofprod").value == 0)
	{	
	if(document.getElementById("ispriced").value == 'Yes')
			{
				alert("Please select the options");
				return false;
			}
	}
	else
	return true;
}

//function thats take up the events for the non priced products locks/unlocks drop down
function nonPricedChangedForm(itemw,pid,pagereload)
{
		var data = new Array();
		var param = new Array();
		data = itemw.split(',');
		for(i=0; i< data.length-1; i++)
		{
			var ddl=document.getElementById(data[i]);
			if(ddl[ddl.selectedIndex])
			{
				param[i]=ddl[ddl.selectedIndex].value;
			}
			else
			{
				param[i]=ddl.value;
			}
		}
		var variableoptionurl = "variableoption.cfm?item=" + pid + "&";
		for(i=0;i<param.length;i++)
		{
			variableoptionurl = variableoptionurl + data[i] + "=" + param[i] + "&";
		} 
			
		dojo.xhrGet({
						url : variableoptionurl,
						content : {},
						
						load: function (data)
						{
						
							var opdata = data.replace(/^\s+|\s+$/g,"");
							var comment = '';
							if(opdata.indexOf('(*:::::*::*:::*:::::*') >= 0)
							{	
							
									while(opdata.indexOf('(*:::::*::*:::*:::::*') >= 0)
									{
										var startindex = opdata.indexOf('(*:::::*::*:::*:::::*');
										var endindex = opdata.indexOf('*:::::*:::*::*:::::*');
										var hiddingattribdiv = opdata.substring(0,startindex);
										var hiddingattribcomment = opdata.substring(startindex+21,endindex)
										var divid = hiddingattribdiv + "_Div";
										document.getElementById(hiddingattribdiv).selectedIndex = 0;
										document.getElementById(divid).style.display = "none";
										opdata = opdata.substring(endindex+20,opdata.length);
										comment = comment + "<br/>" + hiddingattribcomment;
										
									}
									$(document).ready(function(){
																	if(comment != '' && pagereload == 'no')
																		{
																			
																			$("<div id='comment' class='commentBox'></div>").insertAfter($("#comment_Preceeding"));
																			$('#comment').fadeIn(1000);
																			$('#comment').html("Important Note:" + comment);
																			$('#comment').fadeOut(9000);
																		}
																	else
																		{
																			$("#comment").css({'display':'none'});
																		}
																  });
							}
							else
							{
								$(document).ready(function(){
														   		$(".formdivs").css({'display':''});
																$("#comment").css({'display':'none'});
														   });
								
							}
																
							
						},
						error: function(data)
						{
							//alert(data+"           Inside error");
						}
					});
	
}


//function thats take up the events for the priced products and submits the form
function changedForm(itemw,pid,pagereload)
{ 
	var data = new Array();
	var param = new Array();
	data = itemw.split(',');

	for(i=0; i< data.length-1; i++)
	{
		var ddl=document.getElementById(data[i]);
		if(ddl[ddl.selectedIndex])
		{
			param[i]=ddl[ddl.selectedIndex].value;
		}
		else
		{
			param[i]=ddl.value;;
		}
	}
	var url="calculate.cfm?item=" + pid + "&";
	var variableoptionurl = "variableoption.cfm?item=" + pid + "&";
	for(i=0;i<param.length;i++)
	{
		url=url + data[i] + "=" + param[i] + "&";
		variableoptionurl = variableoptionurl + data[i] + "=" + param[i] + "&";
	} 
	
		dojo.xhrGet({
						url : variableoptionurl,
						content : {},
						
						load: function (data)
						{
							var opdata = data.replace(/^\s+|\s+$/g,"");
							var comment = '';
							if(opdata.indexOf('(*:::::*::*:::*:::::*') >= 0)
							{	
							
									while(opdata.indexOf('(*:::::*::*:::*:::::*') >= 0)
									{
										var startindex = opdata.indexOf('(*:::::*::*:::*:::::*');
										var endindex = opdata.indexOf('*:::::*:::*::*:::::*');
										var hiddingattribdiv = opdata.substring(0,startindex);
										var hiddingattribcomment = opdata.substring(startindex+21,endindex)
										var divid = hiddingattribdiv + "_Div";
										document.getElementById(hiddingattribdiv).selectedIndex = 0;
										document.getElementById(divid).style.display = "none";
										opdata = opdata.substring(endindex+20,opdata.length);
										comment = comment + "<br/>" + hiddingattribcomment;
										
									}
									$(document).ready(function(){
																	if(comment != '' && pagereload == 'no')
																	{
																		$("<div id='comment' class='commentBox'></div>").insertBefore($("#response_div"));
																		$('#comment').fadeIn(1000);
																		$('#comment').html("Important Note:" + comment);
																		$('#comment').fadeOut(9000);
																	}
																	else
																	{
																		$("#comment").css({'display':'none'});
																	}
																  });
							}
							else
							{
								$(document).ready(function(){
														   		$(".formdivs").css({'display':''});
																$("#comment").css({'display':'none'});
														   });
								
							}
							
						},
						error: function(data)
						{
							//alert(data+"           Inside error");
						}
					});
	
	
	
	
	dojo.xhrGet({
					url : url,
					content : {},
					load: function (response_data)
					{
					
						dojo.byId('response_div').innerHTML = response_data;
						var startindex 	= response_data.indexOf('<input type="hidden" name="costofprod1" id="costofprod1" value="');
						var endindex 	= response_data.indexOf('" />');
						var hdvariablevalue	= response_data.substring(startindex+64,endindex);
						dojo.byId("costofprod").value = hdvariablevalue;
						
					},
					error: function(response_data)
					{
						//alert(response_data+"           Inside error");
					}
				});
	

}
//function thats take up the events for the priced products while editing the cart and submits the form
function editChangedForm(itemw,pid,pagereload)
{ 
	var data = new Array();
	var param = new Array();
	data = itemw.split(',');

	for(i=0; i< data.length-1; i++)
	{
		var ddl=document.getElementById(data[i]);
		if(ddl[ddl.selectedIndex])
		{
			param[i]=ddl[ddl.selectedIndex].value;
		}
		else
		{
			param[i]=ddl.value;;
		}
	}
	var url="calculate.cfm?item=" + pid + "&";
	var variableoptionurl = "variableoption.cfm?item=" + pid + "&";
	for(i=0;i<param.length;i++)
	{
		url=url + data[i] + "=" + param[i] + "&";
		variableoptionurl = variableoptionurl + data[i] + "=" + param[i] + "&";
	} 
	url=url + "toedit=yes";
		dojo.xhrGet({
						url : variableoptionurl,
						content : {},
						
						load: function (data)
						{
							var opdata = data.replace(/^\s+|\s+$/g,"");
							var comment = '';
							if(opdata.indexOf('(*:::::*::*:::*:::::*') >= 0)
							{	
							
									while(opdata.indexOf('(*:::::*::*:::*:::::*') >= 0)
									{
										var startindex = opdata.indexOf('(*:::::*::*:::*:::::*');
										var endindex = opdata.indexOf('*:::::*:::*::*:::::*');
										var hiddingattribdiv = opdata.substring(0,startindex);
										var hiddingattribcomment = opdata.substring(startindex+21,endindex)
										var divid = hiddingattribdiv + "_Div";
										document.getElementById(hiddingattribdiv).selectedIndex = 0;
										document.getElementById(divid).style.display = "none";
										opdata = opdata.substring(endindex+20,opdata.length);
										comment = comment + "<br/>" + hiddingattribcomment;
										
									}
									$(document).ready(function(){
																	
																	if(comment != '' && pagereload == 'no')
																	{
																		
																		$("<div id='comment' class='commentBox'></div>").insertAfter($(".comment_Preceeding"));
																		
																		$('#comment').fadeIn(1000);
																		$('#comment').html("Important Note:" + comment);
																		$('#comment').fadeOut(9000);
																	}
																	else
																	{
																		$("#comment").css({'display':'none'});
																	}
																  });
							}
							else
							{
								$(document).ready(function(){
														   		$(".formdivs").css({'display':''});
																$("#comment").css({'display':'none'});
														   });
								
							}
							
						},
						error: function(data)
						{
							alert(data+"           Inside error");
						}
					});
	
	dojo.xhrGet({
					url : url,
					content : {},
					load: function (response_data)
					{
						dojo.byId('response_div').innerHTML = response_data;
					},
					error: function(response_data)
					{
						//alert(response_data);
					}
				});
	

}
//function to trim leading and trailing space
function trim(s) {
	s = s.replace(/(^\s*)|(\s*$)/gi,"");
	s = s.replace(/[ ]{2,}/gi," ");
	s = s.replace(/\n /,"\n");
	return s;
}

//function to get the shipping rate
function getshippingrate(txtbx,rad,totlwt,shipOptionInput)
{
	document.getElementById("shiprate").value = "";
	document.getElementById("shipCost").value = "Shipping Costs: Please Wait";
	if(document.getElementById("szip").value == "")
	{
		alert("Please Enter the zip code for the shipping information and reselect the type of service");
		document.getElementById("szip").focus();
		shipOptionInput.checked = "";
		return false;
	}
	
	if(document.getElementById("estimateNumber"))
	{
		var answerid = document.getElementById("estimateNumber").value;
	}
	else
	{
		var answerid = 0;
	}
	var data = new Array();
	var szip = document.getElementById("szip").value;
	var param = new Array();
	data = txtbx.split(',')
	for(i=0; i< data.length; i++)
	{
		var txtval = document.getElementById(data[i]);
				if(txtval.value != "")
		{
			param[i]=txtval.value;
		}
		else
		{
			param[i]="";
		}
		
	}
	var url="shippingrequest.cfm?";
	for(i=0;i<param.length-1;i++)
	{
		url=url + data[i] + "=" + param[i] + "&";
	} 
	url = url + "ship_opt" + "=" + rad;
	url = url + "&weight" + "=" + totlwt;
	url = url + "&szip" + "=" + szip;
	if(answerid != 0)
	 {
		 url = url + "&answerid=" + answerid;
		 
	 }
	dojo.xhrGet({
					
					url : url,
					content : {},
					load: function (response_data)
					{
						dojo.byId("shiprate").value = trim(response_data);
						var datum = response_data;
						var startIndex = datum.indexOf('Total Shipping Rate');
						var endIndex = datum.indexOf(':');
						var shipCost = datum.substr(endIndex+3,datum.length-startIndex);
						shipCost = shipCost.replace('<[^>]*>','');
						var shipCostInt = parseFloat(trim(shipCost));
						var printCost = dojo.byId("printCost").value;
						var printCostStartIndex = printCost.indexOf('Printing Costs :');
						var printCostEndIndex = printCost.indexOf(':');
						printCost = printCost.substr(printCostEndIndex+3,printCost.length-printCostStartIndex);
						var printCostInt = parseFloat(trim(printCost));
						if(shipCostInt == shipCostInt)
						{
							var totalCost = shipCostInt + printCostInt;
							dojo.byId("txtShippingCost").value = shipCostInt;
						}
						else
						{
							var totalCost = printCostInt;
							dojo.byId("txtShippingCost").value = 0;
						}
						datum = datum.substr(endIndex-1,datum.length-startIndex);
						datum = "Shipping Costs " + datum;
						dojo.byId("shipCost").value = trim(datum);
						
						if(trim(response_data) != '')
						{
							dojo.byId("totalCost").value = "Total : $ " + parseFloat(totalCost).toFixed(2);
						}
					},
					error: function(response_data)
					{
						alert(response_data);
					}
				});
}



//function that validats the billing information on clicking the radio button to copy billing info to shipping info
function validatebillinginfo()
{
	if(document.getElementById("bname").value == "")
	{
		alert("Please Enter the name for the billing information");
		document.getElementById("bname").focus();
		return false;
	}
	if(document.getElementById("bcname").value == "")
	{
		alert("Please Enter the Company Name for the billing information");
		document.getElementById("bcname").focus();
		return false;
	}
	if(document.getElementById("baddress1").value == "" && document.getElementById("baddress2").value == "")
	{
		alert("Please Enter the Address for the billing information");
		document.getElementById("baddress1").focus();
		return false;
	}
	if(document.getElementById("bcity").value == "")
	{
		alert("Please Enter the city for the billing information");
		document.getElementById("bcity").focus();
		return false;
	}
	if(document.getElementById("bstate").value == "")
	{
		alert("Please Enter the state for the billing information");
		document.getElementById("bstate").focus();
		return false;
	}
	if(document.getElementById("bzip").value == "")
	{
		alert("Please Enter the zip code for the billing information");
		document.getElementById("bzip").focus();
		return false;
	}
	if(document.getElementById("bzip").value != "")
	{
		var bzip = document.getElementById("bzip").value;
		if(num_check(bzip)== false)
		{
			alert("Enter the valid digits for the zip code");
			document.getElementById("bzip").focus();
			return false;
		}
	}
	if(document.getElementById("bemail").value == "")
	{
		alert("Please Enter the email for the billing information");
		document.getElementById("bemail").focus();
		return false;
	}
	if(document.getElementById("bemail").value != "")
	{
		var toaddress = document.getElementById('bemail').value;
		toArray=new Array(100);
		toArray = toaddress.split(",");
		for(var i=0 ; i< toArray.length;i++)
		{ 
			if(echeck(toArray[i])==false)
			{
				alert("Please enter valid email");
				document.getElementById('bemail').focus();
				return false;
			}
		}
	}
	if(document.getElementById("bphone").value == "")
	{
		alert("Please Enter the phone number for the billing information");
		document.getElementById("bphone").focus();
		return false;
	}
	if(document.getElementById("bphone").value != "")
	{
		var bphone = document.getElementById("bphone").value;
		if(num_check(bphone)== false)
		{
			alert("Enter the valid digits for the phone number");
			document.getElementById("bphone").focus();
			return false;
		}
	
	}
	if(document.getElementById("cardtype") && document.getElementById("cardtype").value == "")
	{
		alert("Please Enter the card type for the billing information");
		document.getElementById("cardtype").focus();
		return false;
	}
	if(document.getElementById("cardnumber") && document.getElementById("cardnumber").value == "")
	{
		alert("Please Enter the credit card number for the billing information");
		document.getElementById("cardnumber").focus();
		return false;
	}
	if(document.getElementById("cardnumber") && document.getElementById("cardnumber").value != "")
	{
		var cardnumber = document.getElementById("cardnumber").value;
		if(num_check(cardnumber)== false)
		{
			alert("Enter the valid digits for the card number");
			document.getElementById("cardnumber").focus();
			return false;
		}
	}
	if(document.getElementById("expmon") && document.getElementById("expmon").value == "")
	{
		alert("Please Enter the credit card expiry month for the billing information");
		document.getElementById("expmon").focus();
		return false;
	}
	if(document.getElementById("expyear") && document.getElementById("expyear").value == "")
	{
		alert("Please Enter the credit card expiry year for the billing information");
		document.getElementById("expyear").focus();
		return false;
	}
	if(document.getElementById("cardvar") && document.getElementById("cardvar").value == "")
	{
		alert("Please Enter the credit card verification code for the billing information");
		document.getElementById("cardvar").focus();
		return false;
	}
	if(document.getElementById("cardvar") && document.getElementById("cardvar").value != "")
	{
		var cardvar = document.getElementById("cardvar").value;
		if(num_check(cardvar)== false)
		{
			alert("Enter the valid digits for the card verification code");
			document.getElementById("cardvar").focus();
			return false;
		}
	}
	return true;
}


var sname = "";
var scname = "";
var saddress1 = "";
var saddress2 = "";
var scity = "";
var sstate = "";
var szip = "";
var sphone = "";
var sfax = "";
var semail = "";


function InitSaveVariables(form)
{
	sname = form.sname.value;
	scname = form.scname.value;
	saddress1 = form.saddress1.value;
	saddress2 = form.saddress2.value;
	scity = form.scity.value;
	szip = form.szip.value;
	sstate = form.sstate.value;
	semail = form.semail.value;
	sphone = form.sphone.value;
	sfax = form.sfax.value;
}
//function that copy billing info to shipping info on clicking the radio button  
function ShipToBillPerson(form) 
{
	if (form.sameshipping.checked)
	{
		if(validatebillinginfo()==true)
		{
			InitSaveVariables(form);
			form.sname.value = form.bname.value;
			form.scname.value = form.bcname.value;
			form.saddress1.value = form.baddress1.value;
			form.saddress2.value = form.baddress2.value;
			form.scity.value = form.bcity.value;
			form.szip.value = form.bzip.value;
			form.sstate.value = form.bstate.value;
			form.semail.value = form.bemail.value;
			form.sphone.value = form.bphone.value;
			form.sfax.value = form.bfax.value;
		}
		else
		{
			document.getElementById('sameshipping').checked=false; 

		}
	}
	else 
	{
		form.sname.value = sname;
		form.scname.value = scname;
		form.saddress1.value = saddress1;
		form.saddress2.value = saddress2;
		form.scity.value = scity;
		form.szip.value = szip;       
		form.sstate.value = sstate;
		form.semail.value = semail;
		form.sphone.value = sphone;
		form.sfax.value = sfax;
	}
}
//function to confirm the skip upload and to validate billing info
function confirmskipupload()
{
	var answer=confirm("Are you sure you would like upload files later?");
	if(answer == false)
	{
		return false;
	}
	
	else
	{
		if(validatebillinginfo())
		return true;
		else
		return false;
	}
		
}
//added for checking previous upload
function confirmpreviousupload()
{
	var answer=confirm("Are you sure you would like to use the previously uploaded files");
	if(answer == false)
	{
		return false;
	}
	
	else
	{
		if(validatebillinginfo())
		return true;
		else
		return false;
	}
		
}

//function that gives a popup window to edit the details of a product
function popUp(URL) 
{
	
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=400,left = 440,top = 312');");
}
//function that is called by update button when editing the product
function updateShoppingCart(pid,items)
{
	document.getElementById("updatetheprod").value = "yes";
	document.onlineform.action="onlineordering_step1.cfm?pid="+ pid +"&item=" + items;
	document.onlineform.submit();

}
// validation function that check if anything else is entered in some fields, other than numbers, space, - and .
function num_check(fieldvalue)
{
	
	var check = true;
	var value = fieldvalue;
	for(var i=0;i < fieldvalue.length; i++)
	{
		var new_key = value.charAt(i); //cycle through characters
		if((((new_key >= "0") && (new_key <= "9")) || (new_key == " ") || (new_key == ".") || (new_key == "-") || (new_key == "(") || (new_key == ")") ) && 
			!(new_key == ""))
		{
			check = true;
		}
		else
		{
			check = false;
			break;
		}
	}
	if(!check)
	{
		return false;
	}
	else
	{
		return true;
	}
}
// validation function that check if the email address entered is correct or not
function echeck(str)
{
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2,4})$/.test(str))
	{
		return (true)
	}
	return (false)
} 
//function that validates the billing and shipping information 
function validateinfo()
{
	
	if(document.getElementById("sname").value == "")
	{
		alert("Please Enter the name for the shipping information");
		document.getElementById("sname").focus();
		return false;
	}
	if(document.getElementById("scname").value == "")
	{
		alert("Please Enter the company name for the shipping information");
		document.getElementById("scname").focus();
		return false;
	}
	if(document.getElementById("saddress1").value == "" && document.getElementById("saddress2").value == "")
	{
		alert("Please Enter the address for the shipping information");
		document.getElementById("saddress1").focus();
		return false;
	}
	
	if(document.getElementById("scity").value == "")
	{
		alert("Please Enter the city for the shipping information");
		document.getElementById("scity").focus();
		return false;
	}
	
	if(document.getElementById("sstate").value == "")
	{
		alert("Please Enter the state for the shipping information");
		document.getElementById("sstate").focus();
		return false;
	}
	if(document.getElementById("szip").value == "")
	{
		alert("Please Enter the zip code for the shipping information");
		document.getElementById("szip").focus();
		return false;
	}
	if(document.getElementById("szip").value != "")
	{
		var szip = document.getElementById("szip").value;
		if(num_check(szip)== false)
		{
			alert("Enter the valid digits for the zip code");
			document.getElementById("szip").focus();
			return false;
		}
	}
	if(document.getElementById("semail").value == "")
	{
		alert("Please Enter the email for the shipping information");
		document.getElementById("semail").focus();
		return false;
	}
	if(document.getElementById("semail").value != "")
	{
		var toaddress = document.getElementById('semail').value;
		toArray=new Array(100);
		toArray = toaddress.split(",");
		for(var i=0 ; i< toArray.length;i++)
		{ 
			if(echeck(toArray[i])==false)
			{
				alert("Please enter valid email");
				document.getElementById('semail').focus();
				return false;
			}
		}
	}
	if(document.getElementById("sphone").value == "")
	{
		alert("Please Enter the phone for the shipping information");
		document.getElementById("sphone").focus();
		return false;
	}
	if(document.getElementById("sphone").value != "")
	{
		var sphone = document.getElementById("sphone").value;
		if(num_check(sphone)== false)
		{
			alert("Enter the valid digits for the phone number");
			document.getElementById("sphone").focus();
			return false;
		}
	}
	
	if(document.getElementById("shiprate") && document.getElementById("shiprate").value == "")
	{
		alert("Please wait few mins to show the rates after selecting a shipping option");
			return false;
	}
}
//function that confirms if  a product has to be deleted from the cart or not
function confirmDeleteProd()
{
	var answer=confirm("Are you sure you would like to remove this product from the cart");
	if(answer == false)
	{
		return false;
	}
	
	else
		return true;
}

// Function called on clicking edit button for products in cart
function editProduct(pid,vx)
 {
	document.getElementById("edittheprod").value = "yes"; 
	document.onlineform.action = "onlineordering_step1.cfm?pid="+pid+"&item="+vx;
	document.onlineform.submit();
		
 }
//Function to make the "edit" div visible.
function ShowMenu() {
	document.getElementById("edit_div").style.visibility = "visible";
	document.getElementById("prod_edit_div").style.visibility = "visible";
	document.getElementById("frTest").style.display = "inline";
}
//Function to hide the "edit" div .
//function HideMenu() {
//document.getElementById("frTest").style.display = "none";
//}
//Function called on clicking remove button
function removeProduct(vx)
{
	if(confirmDeleteProd())
	{
		document.getElementById("removetheprod").value = "yes";
		document.onlineform.action = "onlineordering_step1.cfm?item="+vx;
		document.onlineform.submit();
	}
	else
	return false;
	
}
// Function called after removing the uploaded files in the second step of online ordering system
function removedFile(reqid)
{
	
		document.uploadform.action = "onlineordering_step2.cfm?reqid=" + reqid + "&removedfiles=yes";
		document.uploadform.submit();
}
// Function called after removing the last of the uploaded files in the second step of online ordering system
function removedLastFile(reqid)
{
	
		document.uploadform.action = "onlineordering_step2.cfm?reqid=" + reqid;
		document.uploadform.submit();
}
// Function called while clicking the remove button near uploaded files in the second step of online ordering system
function rmvbtnclick(reqid,id,thisdir)
{
	
	document.getElementById("removethefile").value = "yes";
	document.uploadform.action = "onlineordering_step2.cfm?reqid=" + reqid + "&fileid="+id+"&thisdir=" + thisdir + "&online=yes&removedfiles=yes";
		document.uploadform.submit();
}
// Function called while clicking the remove button near uploaded files in the second step of online ordering system, when only one file remains
function rmvbtnlastclick(reqid,id,thisdir)
{
	document.getElementById("removethefile").value = "yes";
	document.uploadform.action = "onlineordering_step2.cfm?reqid=" + reqid + "&fileid="+id+"&thisdir=" + thisdir + "&online=yes";
		document.uploadform.submit();
}
function canceleditingcart()
{
	/*document.getElementById("edit_div").style.visibility = "hidden";
	document.getElementById("prod_edit_div").style.display = "none";
	document.getElementById("frTest").style.display = "none";*/
	document.onlineform.action = "onlineordering_step1.cfm";
		document.onlineform.submit();
}
function gotoMain()
{
	document.onlineform.action = "";
	document.onlineform.submit();
}
