<!-- 
//////////  Window Seat JavaScript //////////////

//////////////////////  popUp   ////////////////////

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,location=0,scrollbars=1,statusbar=0,menubar=0,resizable=0,width=650,height=400,left = 100,top = 100');");
    return;
} // close popUP
// End popUp 


//////////////////////   isDigit       ////////////////////
// isDigit determine if an individual character is numeric,  called by isFloat
// isDigit determine if an individual character is numeric,  called by isFloat

function isDigit(test,s)
{
//DEBUG STATEMENT FOLLOWS	   
// window.alert("isDigit started with " + test);
//DEBUG STATEMENT ABOVE
    if (test.match(/[0-9]/))
        {
//DEBUG STATEMENT FOLLOWS	
// window.alert("Character is a Digit");
//DEBUG STATEMENT ABOVE
                        return true;
                }
    else
                {
//DEBUG STATEMENT FOLLOWS			
// window.alert("Character is NOT a Digit");
//DEBUG STATEMENT ABOVE
					   return false;
                }
    return true;
} // close isDigit


//////////////////////   isEmpty ////////////////////
// Check whether string s is empty. Called by isFloat
// If empty ... returns True
// If not empty ... returns False

function isEmpty(s)
{   
//DEBUG STATEMENT FOLLOWS	   
// window.alert("isEmpty started with: " + s);		
//DEBUG STATEMENT ABOVE
if ((s == null) || (s.length == 0))
	{
//DEBUG STATEMENT FOLLOWS	
		// window.alert("Dimension is empty");
		return false;
	}
//DEBUG STATEMENT FOLLOWS		
// window.alert("Dimension is NOT empty");

    return true;
} // close isEmpty


//////////////////////   isFloat    ////////////////////


// isFloat (STRING s , Dimension Label)
// 
// True if string s is an unsigned floating point (real) number. 
//
// Also returns true for unsigned integers. If you wish
// to distinguish between integers and floating point numbers,
// first call isInteger, then call isFloat.
//
// Does not accept exponential notation.
//
// For explanation of optional argument emptyOK,
// see comments of function isInteger.
function isFloat(s)
{
//		document.TestForm.number.value = s;
	   var i;
	   var seenDecimalPoint = false;
//DEBUG STATEMENT FOLLOWS	   
// window.alert("isFloat started with: " + s);		
//DEBUG STATEMENT ABOVE	   
  if (isEmpty(s)) 
    	{
//DEBUG STATEMENT FOLLOWS	
	//		window.alert("Dimension is blank");
			return false;
		}
		
  if (s == ".") 		
		{
//DEBUG STATEMENT FOLLOWS	
		 window.alert("Dimension is only a decimal point");
		 return false;
		 }
   // Search through string's characters one by one
    // until we find a non-numeric character.
    // When we do, return false; if we don't, return true.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);

		// Be sure only 1 period
       if ((c == ".") && !seenDecimalPoint) 
			{
			seenDecimalPoint = true;
			}
       else 
			{
//DEBUG STATEMENT FOLLOWS	   
// window.alert("i: " + i + " c: " + c);		
//DEBUG STATEMENT ABOVE	
			if (!isDigit(c))
				{
				 alert("Dimension contains invalid character '" + c + "'");
					 return false;
				 }
			}
    return true;
} // close isFloat
// All characters are numbers.
//	window.alert("Dimension is Valid");
    return true;
}


//////////////////////   getPriceFirst16    ////////////////////

function getPriceFirst16 (s)
{
    // start looking at character position 1 for the vertical bar | 
    // (i.e. second character, since fabric code must exist)
    var i = 1;

    // look for bar
	var bar_at = s.indexOf('|');

// DEBUG STATEMENT BELOW	
//	window.alert("values are s: " + s + "  bar_at: " + bar_at);
// DEBUG STATEMENT ABOVE

			var fabric_code = s.substring(0,bar_at)
			var fabric_price = s.substring(bar_at+1,s.length);

// DEBUG STATEMENT BELOW
//	window.alert("values are fabric_code: " + fabric_code + " (price: " + price + "  )<BR>");
// DEBUG STATEMENT ABOVE	

document.TestForm.First_16fabric_code.value = fabric_code;
document.TestForm.First_16fabric_price.value = fabric_price;

return true;
} // close getPrice


//////////////////////   getPriceSecond16    ////////////////////

function getPriceSecond16 (s)
{

    // start looking at character position 1 for the vertical bar | 
    // (i.e. second character, since fabric code must exist)
    var i = 1;

    // look for bar
	var bar_at = s.indexOf('|');

// DEBUG STATEMENT BELOW	
//	window.alert("values are s: " + s + "  bar_at: " + bar_at);
// DEBUG STATEMENT ABOVE

			var fabric_code = s.substring(0,bar_at)
			var fabric_price = s.substring(bar_at+1,s.length);

// DEBUG STATEMENT BELOW
//	window.alert("values are fabric_code: " + fabric_code + " (price: " + price + "  )<BR>");
// DEBUG STATEMENT ABOVE	

document.TestForm.Second_16fabric_code.value = fabric_code;
document.TestForm.Second_16fabric_price.value = fabric_price;
}

//////////////////////   getPriceFirst18    ////////////////////

function getPriceFirst18 (s)
{

    // start looking at character position 1 for the vertical bar | 
    // (i.e. second character, since fabric code must exist)
    var i = 1;

    // look for bar
	var bar_at = s.indexOf('|');

// DEBUG STATEMENT BELOW	
//	window.alert("values are s: " + s + "  bar_at: " + bar_at);
// DEBUG STATEMENT ABOVE

			var fabric_code = s.substring(0,bar_at)
			var fabric_price = s.substring(bar_at+1,s.length);

// DEBUG STATEMENT BELOW
//	window.alert("values are fabric_code: " + fabric_code + " (price: " + price + "  )<BR>");
// DEBUG STATEMENT ABOVE	

document.TestForm.First_18fabric_code.value = fabric_code;
document.TestForm.First_18fabric_price.value = fabric_price;
}

//////////////////////   getPriceSecond18    ////////////////////

function getPriceSecond18 (s)
{

    // start looking at character position 1 for the vertical bar | 
    // (i.e. second character, since fabric code must exist)
    var i = 1;

    // look for bar
	var bar_at = s.indexOf('|');

// DEBUG STATEMENT BELOW	
// window.alert("values are s: " + s + "  bar_at: " + bar_at);
// DEBUG STATEMENT ABOVE

			var fabric_code = s.substring(0,bar_at)
			var fabric_price = s.substring(bar_at+1,s.length);

// DEBUG STATEMENT BELOW
//	window.alert("values are fabric_code: " + fabric_code + " (price: " + fabric_price + "  )<BR>");
// DEBUG STATEMENT ABOVE	
document.TestForm.Second_18fabric_code.value = fabric_code;
document.TestForm.Second_18fabric_price.value = fabric_price;
}

//////////////////////   calcPrice for Pillows  ////////////////////

function calcPrice ()
{
// Calc Price for Pillows

var qty16_1 = eval(document.TestForm.qty_First_16inchPillow.value);
var qty16_2 = eval(document.TestForm.qty_Second_16inchPillow.value);
var qty18_1 = eval(document.TestForm.qty_First_18inchPillow.value);
var qty18_2 = eval(document.TestForm.qty_Second_18inchPillow.value);

var price16_1 = eval(document.TestForm.First_16fabric_price.value);
var price16_2 = eval(document.TestForm.Second_16fabric_price.value);
var price18_1 = eval(document.TestForm.First_18fabric_price.value);
var price18_2 = eval(document.TestForm.Second_18fabric_price.value);

var pillowFabricYds = 1;
var pillowLabor = 35;
var pillowFoam = 6;
var pillowShipping = 6;

First16PillowPrice = (price16_1 * pillowFabricYds) + pillowLabor + pillowFoam + pillowShipping;
Second16PillowPrice = (price16_2 * pillowFabricYds) + pillowLabor + pillowFoam + pillowShipping;
First18PillowPrice = (price18_1 * pillowFabricYds) + pillowLabor + pillowFoam + pillowShipping;
Second18PillowPrice = (price18_2 * pillowFabricYds) + pillowLabor + pillowFoam + pillowShipping;

First16PillowPrice = First16PillowPrice * qty16_1;
Second16PillowPrice = Second16PillowPrice * qty16_2;
First18PillowPrice = First18PillowPrice * qty18_1;
Second18PillowPrice = Second18PillowPrice * qty18_2;

PillowPriceTotal = 0;

// DEBUG STATEMENT BELOW
//window.alert("1st 16: " + First16PillowPrice + " 2nd 16: " + Second16PillowPrice + "1st 18: " + First18PillowPrice + " 2nd 18: " + Second18PillowPrice);
// DEBUG STATEMENT ABOVE	

if (First16PillowPrice > 0)
	PillowPriceTotal = First16PillowPrice;

if (Second16PillowPrice > 0)
	PillowPriceTotal = PillowPriceTotal + Second16PillowPrice;

if (First18PillowPrice > 0)
	PillowPriceTotal = PillowPriceTotal + First18PillowPrice;

if (Second18PillowPrice > 0)
	PillowPriceTotal = PillowPriceTotal + Second18PillowPrice ;
	
document.TestForm.pillow_price_total.value = PillowPriceTotal;

qtyTotal = qty16_1 + qty16_2 + qty18_1 + qty18_2;
PillowFoamTotal = pillowFoam * qtyTotal;
document.TestForm.PillowFoamTotal.value = PillowFoamTotal;

PillowShippingTotal = pillowShipping * qtyTotal;
document.TestForm.PillowShippingTotal.value = PillowShippingTotal;

PillowFabricTotal = PillowPriceTotal - PillowFoamTotal - PillowShippingTotal;
document.TestForm.PillowFabricTotal.value = PillowFabricTotal;

return true;

} // close Calc Price


//////////////////////   Validate for Pillows  ////////////////////

function ValidatePillow ()
{

		
var f_price = eval(document.TestForm.pillow_price_total.value);
if ((f_price == null) || (f_price.length == 0))
	{
		window.alert("None Specified");
		document.TestForm.qty_First_16inchPillow.focus();
		return false;
	}
// calcPrice();	
return true;
} // close Validate

-->

