function calculateOrderPrice(disk_count, product_code, OffsiteBackup)
{
	var price = 0.0;
	return calculateOrderPrice2(disk_count, product_code, OffsiteBackup, price);
}

function calculateOrderPrice2(disk_count, product_code, OffsiteBackup, HardDrivePrice)
{
	var price = 0.0;
//alert('dc =' + disk_count + ' pc = ' + product_code + ' p ' + HardDrivePrice);

	if (disk_count == null || disk_count == '')	
	{
		alert('Please enter a cd quantity.');		
	}
	else
	{
		var unitprice = 0.0;

		//alert('cost ' + (1 * discount * 100) / 100);
		//alert('cost round' + (Math.round(1 * discount * 100) / 100));
		if (disk_count <= 100)
			unitprice =  (1.75);
		else 
			unitprice =  (1.5);

		if (OffsiteBackup == true)
		{
			if (disk_count > 800)
				price = (disk_count * .25) + 99;
			else
				price = 299;
		}	
		
		if (product_code != 'OTHER')
		{
			if (disk_count * unitprice < 100)
				price = price + 100;
			else
				price = price + (disk_count * unitprice);			
		}
		else
			price = "0";
			
		//alert(' p ' + price);		
		price = price + HardDrivePrice;
	}
	var curr = new String(price);
	if (curr.indexOf(".") == -1)
	{
		curr = curr + ".00";
	}
	else 
	{		
		var cents = curr.substring(curr.indexOf("."), curr.length);		
		//alert(cents.length);
		if (cents.length == 3)
		{
		 //alert("nothing");
		}
		else if (cents.length > 3)
		{ 
		  //alert ("too big");
		  //alert("cur " + curr.substring(0, curr.indexOf(".")));
		  //alert("cent " + cents.substring(0, 3));
		  curr = curr.substring(0, curr.indexOf(".")) + cents.substring(0, 3);
		  
		}
		else
		{
			curr = curr + "0";
		}
	}
	
	return curr;
}

function calculateArchiveRipOrderPrice(disk_count, packageType, CDMAG, CDOPTICAL, COURIERSERVICE, VAULT, HardDrivePrice)
{
	if (isNaN(HardDrivePrice) == true)
		HardDrivePrice = 0;
		
	var price = 0.0;
	
	if (disk_count == null || disk_count == '')	
	{
		alert('Please enter a CD quantity.');		
	}
	else
	{
		var unitprice = 0.0;
		
		if (packageType == 'bronze')
			unitprice =  3.0;
		else if (packageType == 'silver')
		{
			unitprice =  4.0;
			COURIERSERVICE = true;
		}
		else if (packageType == 'gold')
		{
			unitprice =  4.0;
			COURIERSERVICE = true;
			VAULT = true;
		}
			
		if (CDMAG == true)
			unitprice = unitprice + .5;
		if (CDOPTICAL == true)
			unitprice = unitprice + .5;
		if (COURIERSERVICE == true)
			price = price + 25.0;
		if (VAULT == true)
		{
			if (disk_count > 800)
			{
				unitprice = unitprice + .25;				
				price = price + 99.0;
			}
			else
				price = price + 299.0;			
		}
		
		price = price + parseInt(HardDrivePrice);	
		//alert('uprice' + unitprice);
						
		price = price + (disk_count * unitprice);

		

	}
	
	var curr = new String(price);
	if (curr.indexOf(".") == -1)
	{
		curr = curr + ".00";
	}
	else 
	{		
		var cents = curr.substring(curr.indexOf("."), curr.length);		
		//alert(cents.length);
		if (cents.length == 3)
		{
		 //alert("nothing");
		}
		else if (cents.length > 3)
		{ 
		  //alert ("too big");
		  //alert("cur " + curr.substring(0, curr.indexOf(".")));
		  //alert("cent " + cents.substring(0, 3));
		  curr = curr.substring(0, curr.indexOf(".")) + cents.substring(0, 3);
		  
		}
		else
		{
			curr = curr + "0";
		}
	}
	
	return curr;
}

function calculateVinylPrice(disk_count, product_code, harddrive, shipkit)
{
	var price = 0.0;
//alert('dc =' + disk_count + ' pc = ' + product_code + ' sonic = ' + sonic + ' ship = ' + shipkit);

	if (disk_count == null || disk_count == '')	
	{
		alert('Please enter a record quantity.');		
	}
	else
	{
		var unitprice = 0.0;

		//alert('cost ' + (1 * discount * 100) / 100);
		//alert('cost round' + (Math.round(1 * discount * 100) / 100));
		
		if (product_code == 'vMP3')
			unitprice =  14;
		else if (product_code == 'vDUAL')
			unitprice =  17;
		else if (product_code == 'vARCHIVE')
			unitprice =  22;
			
//alert('price = ' + unitprice);
		if (shipkit == 'true')
			unitprice = unitprice + 2;		
			
		if (disk_count > 1000)
			unitprice =  unitprice*.80;
		else if (disk_count > 500)
			unitprice =  unitprice*.85;
		else if (disk_count > 250)
			unitprice =  unitprice*.90;
		else if (disk_count > 100)
			unitprice =  unitprice*.95;
	
//alert('price = ' + unitprice);
				
		price = disk_count * unitprice;
		
		//alert(' p ' + price);		
		if (price < 500)
			price = 500;
			
		if (harddrive == 'usb500')
			price = price + 125;
		else if (harddrive == 'usb750')
			price = price + 150;
		else if (harddrive == 'usb1000')
			price = price + 200;
	}
	var curr = new String(price);
	if (curr.indexOf(".") == -1)
	{
		curr = curr + ".00";
	}
	else 
	{		
		var cents = curr.substring(curr.indexOf("."), curr.length);		
		//alert(cents.length);
		if (cents.length == 3)
		{
		 //alert("nothing");
		}
		else if (cents.length > 3)
		{ 
		  //alert ("too big");
		  //alert("cur " + curr.substring(0, curr.indexOf(".")));
		  //alert("cent " + cents.substring(0, 3));
		  curr = curr.substring(0, curr.indexOf(".")) + cents.substring(0, 3);
		  
		}
		else
		{
			curr = curr + "0";
		}
	}
	
	return curr;
}
