<!--
/**************************************************************************\
  GLOBAL VARIABLE DECLARATIONS
\**************************************************************************/
var ShippingCost = 7.95;
var CardType;
var CardMonth = 1;
var CardYear = 2004;

Bfly = new Image();
Bfly.src = "./images/butterfly.gif";
Butterflies = 12;

Ypos = new Array();
Xpos = new Array();
Speed = new Array();
Rate = new Array();
Grow = new Array();
Ystep = new Array();
Xstep = new Array();

var message = " Sorry that function is disabled          \n" +
              "_________________________\n"                  +
              "\n"                                           +
              "           Site design by:\n"                 +
              "      The CS62 Trio 2004\n"                   +
              "        All rights reserved.\n"               +
              "\n"                                           +
              "If you would like to use anything \n"         +
              "    from this site please ask us. \n"         +
              "\n"                                           +
              "  Thank you for your interest.\n"             +
              "_______________________\n"



function AddToCart()
{
  var item = document.getElementById("product").value;
  var qty = document.getElementById("quantity").value;
  var popup;
  
  if( !AllNumbers(qty) )  // Look for bogus characters
  {
    popup = "The quantity you entered is not a valid number.\n" +
            "Please enter an integer value."
    alert( popup );
    document.getElementById("quantity").value = "";
    document.getElementById("quantity").focus();
  }
  else if( (qty == "") || (qty == "0") )
  {
    popup = "You must enter a quantity before adding item to cart."
    alert( popup );
    document.getElementById("quantity").value = "";
    document.getElementById("quantity").focus();
  }
  else
  {
    // Add item to the cart
    window.top.cart.AddItemToCart( item, qty );
    document.location = "cart.html";
  }
}



function AllNumbers( string )
{
  var OK = "0123456789";
  var index = 0;
  
  // While index is indexing a character within "string" AND the current
  // character being indexed is inside the OK string THEN increment index
  while( (index < string.length) && (OK.indexOf(string.charAt(index)) != -1) )
  {
    index++;
  }
  
  // Did we make it through the entire string without finding bad characters?
  if( index == string.length )
  {
    return true;
  }
  
  // Bad characters were found!
  return false;
}




function BackToShopping()
{
  SideMenu( true );
  document.location = "cart.html";
}



function BuildPrice( price )
{
  var dot;
  
  price = "$" + price;
  dot = price.indexOf( "." );
  
  if( dot == -1 )      // No decimal point, so add ".00"
  {
    price += ".00";
  }
  else if( dot == (price.length-2) )    // Only one digit after decimal point
  {
    price += "0";
  }
  else                // Only allow 2 digits after the decimal point
  {
    price = price.substring( 0, dot+3 );
  }
  
  return( price );
}



function CatchClick()
{
  // Check for a right mouse click
  if( (event.button == 2) || (event.button == 3) )
  {
    alert( message );      // Right mouse was clicked so display the message
    return false;          // False prevents the regular browser menu from appearing
  }
}



function ChangeScreen( Dest )
{
  var LinkName = "";
  var Obj;
  var Html;
  var Link;
  
  for( Link = 1; Link <= 4; Link++ )
  {
    LinkName = "ProductClass" + Link;
    Obj = eval( "document.all." + LinkName );
    
    // Does Obj reference the link that was clicked?
    if( LinkName == Dest )  
    {
      Obj.className = "BunnyTopMenuCellOver";     // Change the class of the clicked link
      switch( LinkName )                          // Now modify the code inside the DOM
      {
        case "ProductClass1":
        {
          Obj.innerHTML = "Rabbit Care";          // Remove the link and add the text
          document.all.ScreenTitle.innerText = "Rabbit Care Products";
          document.all.Body.src = "store_products.html"
          break;
        }
        case "ProductClass2":
        {
          Obj.innerHTML = "Clothing";             // Remove the link and add the text
          document.all.ScreenTitle.innerText = "Clothing and Accessories";
          document.all.Body.src = "store_clothing.html"
          break;
        }
        case "ProductClass3":
        {
          Obj.innerHTML = "Home Decor";           // Remove the link and add the text
          document.all.ScreenTitle.innerText = "Home Decor";
          document.all.Body.src = "store_decor.html"
          break;
        }
        case "ProductClass4":
        {
          Obj.innerHTML = "Miscellaneous";        // Remove the link and add the text
          document.all.ScreenTitle.innerText = "Miscellaneous Products";
          document.all.Body.src = "store_misc.html"
          break;
        }
      }
    }
    else                                          // This was not the link that was clicked
    {
      Obj.className = "BunnyTopMenuCell";         // Change the class to a "link" class
      
      // The following code is constructing HTML inside a buffer.  This HTML code
      // will replace the code that's stored inside the DOM at the "node" that's
      // refered to by the Obj object reference.
      Html = '<a href="#" class="topLink" onClick="ChangeScreen(';
      Html += "'";
      Html += LinkName;
      Html += "'";
      Html += ')">';
      switch( LinkName )
      {
        case "ProductClass1":
        {
          Html += "Rabbit Care</a>";
          break;
        }
        case "ProductClass2":
        {
          Html += "Clothing</a>";
          break;
        }
        case "ProductClass3":
        {
          Html += "Home Decor</a>";
          break;
        }
        case "ProductClass4":
        {
          Html += "Miscellaneous</a>";
          break;
        }
      }
      Obj.innerHTML = Html;
    }
  }
}



function CheckOut( total )
{
  window.top.cart.productTotal = total;
  SideMenu( false );
  document.location = "CheckOut.html"
}



function CheckForm()
{
	var card_checked = false;
  var ok = true;

	if( (ok) && (document.CheckOut.Recipient.value == "") )
  {
    alert( "Please enter a shipping name." );
    document.CheckOut.Recipient.focus();
    ok = false;
  }
  
	if( (ok) && (document.CheckOut.Recipient_Street.value == "") )
  {
    alert( "Please enter a shipping street address." );
    document.CheckOut.Recipient_Street.focus();
    ok = false;
  }
  
	if( (ok) && (document.CheckOut.Recipient_City.value == "") )
  {
    alert( "Please enter the city to ship to." );
    document.CheckOut.Recipient_City.focus();
    ok = false;
  }
  
	if( (ok) && (document.CheckOut.Recipient_Zip.value == "") )
  {
    alert( "Please enter the shipping zip code." );
    document.CheckOut.Recipient_Zip.focus();
    ok = false;
  }
  
	if( (ok) && (document.CheckOut.Billing.value == "") )
  {
    alert( "Please enter a billing name." );
    document.CheckOut.Billing.focus();
    ok = false;
  }
  
	if( (ok) && (document.CheckOut.Billing_Street.value == "") )
  {
    alert( "Please enter a billing street address." );
    document.CheckOut.Billing_Street.focus();
    ok = false;
  }
  
	if( (ok) && (document.CheckOut.Billing_City.value == "") )
  {
    alert( "Please enter the billing city." );
    document.CheckOut.Billing_City.focus();
    ok = false;
  }
  
	if( (ok) && (document.CheckOut.Billing_Zip.value == "") )
  {
    alert( "Please enter the billing zip code." );
    document.CheckOut.Billing_Zip.focus();
    ok = false;
  }
  
	
	if( (ok) && (document.CheckOut.Credit_Card_Holder.value == "") )
  {
    alert( "Please enter the name as it appears on your credit card." );
    document.CheckOut.Credit_Card_Holder.focus();
    ok = false;
  }
  
	for( i = 0; i <= 5; i++ )
	{
		if( document.CheckOut.Card_Type[i].checked )
		{
			card_checked = true;
		}
	}
  if( (ok) && (card_checked == false) )
  {
    alert( "Please select a credit card type." );
    ok = false;
  }
	
	if( (ok) && (document.CheckOut.Card_Number.value == "") )
  {
    alert( "Please enter the credit card number." );
    document.CheckOut.Card_Number.focus();
    ok = false;
  }
  
  
	if( ok )
	{
		alert( "Your oder has been submitted." );
    return( true );
	}

	return( false );
}



function ContinueShopping()
{
  var category = 0;
  var obj;
  var id;
  
  do
  {
    category++;
    id = "ProductClass" + category;
    obj = window.top.body.document.getElementById( id );
  }
  while( (category <= 4) && (obj.className != "BunnyTopMenuCellOver") );
  
  switch( category )
  {
    case 1:
    {
      window.top.body.document.all.ScreenTitle.innerText = "Rabbit Care Products";
      document.location = "store_products.html";
      break;
    }
    case 2:
    {
      window.top.body.document.all.ScreenTitle.innerText = "Clothing and Accessories";
      document.location = "store_clothing.html";
      break;
    }
    case 3:
    {
      window.top.body.document.all.ScreenTitle.innerText = "Home Decor";
      document.location = "store_decor.html";
      break;
    }
    case 4:
    {
      window.top.body.document.all.ScreenTitle.innerText = "Miscellaneous Products";
      document.location = "store_misc.html";
      break;
    }
    default:
    {
      window.top.body.document.all.ScreenTitle.innerText = "Rabbit Care Products";
      document.location = "store_products.html";
      break;
    }
  }
}



function CopyShipping( obj )
{
	if( obj.checked )
	{
		document.CheckOut.Billing.value = document.CheckOut.Recipient.value;
		document.CheckOut.Billing_Street.value = document.CheckOut.Recipient_Street.value;
		document.CheckOut.Billing_City.value = document.CheckOut.Recipient_City.value;
		document.CheckOut.Billing_State.selectedIndex = document.CheckOut.Recipient_State.selectedIndex;
		document.CheckOut.Billing_Zip.value = document.CheckOut.Recipient_Zip.value;
	}
  else
  {
		document.CheckOut.Billing.value = "";
		document.CheckOut.Billing_Street.value = "";
		document.CheckOut.Billing_City.value = "";
		document.CheckOut.Billing_State.selectedIndex = "";
		document.CheckOut.Billing_Zip.value = "";
  }
}



function Click( id )
{
  var obj = document.getElementById( id );
  obj.click();
}



function FakeButtonOut( obj )
{
  obj.className = "BunnyCartButtonOut";
}



function FakeButtonOver( obj )
{
  obj.className = "BunnyCartButtonOver";
  obj.style.cursor = "hand";
}



function Focus( id )
{
  var obj = document.getElementById( id );
  obj.focus();
}



function GetMonth( obj )
{
  CardMonth = obj.selectedIndex + 1;
  alert( CardMonth );
}



function GetYear( obj )
{
  CardYear = obj.selectedIndex + 2004;
  alert( CardYear );
}



function Init( Butterfly )
{
  if( Init.length == 0 )    // If no parameters were passed in
  {
    Butterfly = 0;          // Then set the Butterfly parameter value to zero
  }

  switch( window.document.body.id )       // Determine which screen we're working with
  {
    case "SplashScreen":
    {
      PositionBunnies();
      PositionMenus();
      if( document.all.MainText )
      {
        PositionText();
      }
      break;
    }
    
    case "EventsScreen":
    {
      ScaleScreen();
      PositionBunnies();
      PositionMenus();
      PositionPatches();
      PositionLogo();
      break;
    }

    case "MainScreen":
    {
      ScaleScreen();
      PositionBunnies();
      PositionMenus();
      PositionPatches();
      PositionLogo();
      SideMenu( true );
      break;
    }
  }
  
  if( Butterfly )           // If Butterfly is "true" (non-zero)
  {
    WinHeight = window.document.body.clientHeight;
    WinWidth = window.document.body.clientWidth;
  
    // Select random positions, velocities
    for( i = 0; i < Butterflies; i++ )
    {
      Xpos[i] = Math.round( Math.random() * WinWidth );
      Ypos[i] = Math.round( Math.random() * WinHeight );
      Xstep[i] = 0;                              // Cos of this value will be the X velocity
      Ystep[i] = Math.random() * 0.1 + 0.05;     // Y velocity (some random constant rate: 0.05 to 0.15)
      Speed[i] = Math.random() * 4 + 4;          // Randomly select the butterflies velocity
      Grow[i] = 10;                              // Set the initial size
      Rate[i] = Math.random() * 0.2 + 0.3;       // Set the scale rate
    }
  }
}



function MoveButterflies()
{
  for( i = 0; i < Butterflies; i++ )            // Move all the butterflies
  {
    Dx = Speed[i] * Math.cos( Xstep[i] );       // Adjust the cos wave amplitude
    Dy = Speed[i] * -0.7;                       // Set the Y velocity
    Xpos[i] += Dx;                              // Adjust the X position of this butterfly
    Ypos[i] += Dy;                              // Adjust the Y position of this butterfly
    Xstep[i] += Ystep[i];                       // Increase the cos input value (X motion)
    
    if( Ypos[i] < -50 )                         // Is the butterfly above the top of the screen?
    {
      Xpos[i] = Math.round( Math.random() * WinWidth );   // Pick location along bottom of screen
      Ypos[i] = WinHeight + 50;                           // Below the bottom edge
      Speed[i] = Math.random() * 4 + 6;                   // Pick a new velocity  (6 to 10)
      Grow[i] = 2;                                        // Set the initial size
      Rate[i] = Math.random() * 0.2 + 0.3;                // Set the size scale rate  (0.3 to 0.5)
    }
    
    // Position the butterfly
    Butterfly[i].style.pixelLeft = Xpos[i];               // Move the butterfly
    Butterfly[i].style.pixelTop = Ypos[i];
    
    // Scale the butterfly
    Grow[i] += Rate[i];                                   // Step the butterflies scale
    Butterfly[i].style.width = Grow[i];                   // Scale this butterflies image
    Butterfly[i].style.height = Grow[i];                  // On the X and Y axis
    
    if( Rate[i] < 0 )                                     // If the butterfly is getting smaller
    {
      if( Grow[i] < 15 )                                  // Test for the butterflies scale "floor"
      {
        Rate[i] = -Rate[i];                               // Reverse the scaling rate
      }
    }
    
    if( Grow[i] > 25 )                                    // Test for the butterflies scale "ceiling"
    {
      Grow[i] = 25;                                       // Set the butterflies scale
      if( i % 2 )                                         // Every other butterfly goes up AND down
      {
        Rate[i] = -Rate[i];                               // Reverse the scale rate
      }
    }
  }
  setTimeout( 'MoveButterflies()', 50 );                  // In 50 miliseconds move the butterflies again
}



function PositionBunnies()
{
  var WinWidth = window.document.body.clientWidth;
  var WinHeight = window.document.body.clientHeight;
  
  switch( window.document.body.id )                       // Determine which screen we're working with
  {
    case "SplashScreen":                                  // User is looking at the splash screen
    {
      if( WinWidth < 650 )                                // Has user reduced the browser width
      {
        document.all.BunnyTop.style.left = 540;           // Lock the top bunny into position
        document.all.BunnySit.style.left = 53;            // Lock the bottom bunny into position
      }
      else                    // Browser is full screen.  Position bunnies based on screen resolution
      {
        document.all.BunnyTop.style.left = (WinWidth / 2) + 215;
        document.all.BunnySit.style.left = (WinWidth / 2) - 272;
      }
      break;
    }
    
    case "EventsScreen":                                  // User is looking at the events screen
    {
      // Position the top bunny
      if( WinWidth < 261 )
      {
        document.all.BunnyTop.style.left = 190;
      }
      else
      {
        document.all.BunnyTop.style.left = WinWidth - 70;
      }
      document.all.BunnyTop.style.top = 63;

      // Position the bottom bunny
      if( WinHeight < 222 )
      {
        document.all.BunnySit.style.top = 107;
      }
      else
      {
        document.all.BunnySit.style.top = WinHeight - 115;
      }
      document.all.BunnySit.style.left = 3;
      break;
    }
    
    case "MainScreen":                                  // User is looking at the store screen
    {
      // Position the top bunny
      if( WinWidth < 261 )
      {
        document.all.BunnyTop.style.left = 190;
      }
      else
      {
        document.all.BunnyTop.style.left = WinWidth - 70;
      }
      document.all.BunnyTop.style.top = 63;

      // Position the bottom bunny
      if( WinHeight < 431 )
      {
        document.all.BunnySit.style.top = 316;
      }
      else
      {
        document.all.BunnySit.style.top = WinHeight - 115;
      }
      document.all.BunnySit.style.left = 3;
      break;
    }
  }
  document.all.BunnyTop.style.visibility = "visible";
  document.all.BunnySit.style.visibility = "visible";
}



////////////////////////////////////////////////
function PositionLogo()
{
  var WinWidth = window.document.body.clientWidth;
  var WinHeight = window.document.body.clientHeight;
  var Left;
  
  switch( window.document.body.id )                       // Determine which screen we're working with
  {
    case "MainScreen":
    case "EventsScreen":
    default:
    {
      document.all.Logo12pt.style.top = 36;                 // Lock the logo into position
      document.all.Logo12pt.style.left = 10;                // Lock the logo menu into position
      break;
    }
  }
  document.all.Logo12pt.style.visibility = "visible";
}
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\



function PositionMenus()
{
  var WinWidth = window.document.body.clientWidth;
  var WinHeight = window.document.body.clientHeight;
  var Left;
  
  switch( window.document.body.id )                       // Determine which screen we're working with
  {
    case "SplashScreen":
    {
      if( window.document.body.clientWidth < 650 )        // Has user reduced the browser width
      {
        document.all.TopMenu.style.left = 50;             // Lock the top menu into position
      }
      else                    // Browser is full screen.  Position menu based on screen resolution
      {
        document.all.TopMenu.style.left = (window.document.body.clientWidth / 2) - 275;
      }
      break;
    }
    
    default:
    {
      if( WinWidth < 638 )                                // If menu is touching right screen edge
      {
        Left = WinWidth - 482;                            // Right screen edge pushes menu left
      }
      else                                                // Otherwise...
      {
        Left = ((WinWidth - 154) / 2) - 86;               // Center the menu over the "main" region
      }
      
      if( Left < 3 )                                      // If left screen edge is touching menu
      {
        Left = 3;                                         // Left edge holds menu in place
      }
      document.all.TopMenu.style.top = 8;                 // Lock the top menu into position
      document.all.TopMenu.style.left = Left;             // Lock the top menu into position
      break;
    }
  }
  document.all.TopMenu.style.visibility = "visible";
}



// On the main screen there are two bunnies that sit on a blue line.  This
// line touches the blue border that surrounds the screen in two places.
// In each of those places it would look nicer if the blue line actually
// "merged" with the primary blue screen border.  To create this effect I
// dynamically place a graphic over each of the portions of the dark blue
// outer screen line that touches the blue menu line.
function PositionPatches()
{
  var WinWidth = window.document.body.clientWidth;
  var WinHeight = window.document.body.clientHeight;
  var Left;
  var Top;
  
  switch( window.document.body.id )
  {
    case "EventsScreen":
    {
      // Position the right patch
      if( WinWidth > 239 )
      {
        document.all.Patch01.style.top = 69;
        document.all.Patch01.style.left = WinWidth - 4;
      }
      else
      {
        document.all.Patch01.style.top = 69;
        document.all.Patch01.style.left = 235;
      }
      
      // Position the left patch
      if( WinHeight < 222 )
      {
        document.all.Patch02.style.top = 139;
        document.all.Patch02.style.left = 3;
      }
      else
      {
        document.all.Patch02.style.top = WinHeight - 83;
        document.all.Patch02.style.left = 3;
      }
      break;
    }
    
    case "MainScreen":
    {
      // Position the right patch
      if( WinWidth > 196 )
      {
        document.all.Patch01.style.top = 69;
        document.all.Patch01.style.left = WinWidth - 4;
      }
      else
      {
        document.all.Patch01.style.top = 69;
        document.all.Patch01.style.left = 191;
      }
      
      // Position the left patch
      if( WinHeight < 431 )
      {
        document.all.Patch02.style.top = 348;
        document.all.Patch02.style.left = 3;
      }
      else
      {
        document.all.Patch02.style.top = WinHeight - 83;
        document.all.Patch02.style.left = 3;
      }
    }
  }
}



function PositionText()
{
  var WinWidth = window.document.body.clientWidth;
  var ObjWidth = document.all.MainText.width;
  var Left = (WinWidth - ObjWidth) / 2;
  
  if( WinWidth < 650 )
  {
    Left = 53;
  }
  
  document.all.MainText.style.left = Left;
  document.all.MainText.style.visibility = "visible";
}



function RemoveFromCart( item )
{
  var count = window.top.cart.RemoveItemFromCart( item );

  document.location = "cart.html";
}



function ResetContactForm()
{
  var obj = document.getElementById( "Contact" );
  obj.reset();
}



function ScaleScreen()
{
  var WinWidth = window.document.body.clientWidth;
  var WinHeight = window.document.body.clientHeight;
  
  switch( window.document.body.id )
  {
    case "EventsScreen":
    {
      // Scale the screen border
      document.all.MainRing1.width = WinWidth;
      document.all.MainRing1.height = WinHeight;
      
      document.all.MainRing2.width = WinWidth-2;
      document.all.MainRing2.height = WinHeight-2;
      
      document.all.MainRing3.width = WinWidth-6;
      document.all.MainRing3.height = WinHeight-6;
      
      // Scale the left menu
      document.all.VerticalBar.height = WinHeight - 187;

      if( document.all.VerticalBar.height < 35 )
      {
        document.all.VerticalBar.height = 35;
      }
      
      // Scale the main windows width
      document.all.BodyWidth.width = WinWidth - 173;
      
      // Scale the iframe to fit the main window
      document.all.Body.width = WinWidth - 174;
      document.all.Body.height = WinHeight - 104;
      break;
    }
    
    case "MainScreen":
    {
      // Scale the screen border
      document.all.MainRing1.width = WinWidth;
      document.all.MainRing1.height = WinHeight;
      
      document.all.MainRing2.width = WinWidth-2;
      document.all.MainRing2.height = WinHeight-2;
      
      document.all.MainRing3.width = WinWidth-6;
      document.all.MainRing3.height = WinHeight-6;
      

      // Scale the left menu
    //  alert( document.all.VerticalBar.height );
      
      document.all.VerticalBar.height = WinHeight - 187;
      if( document.all.VerticalBar.height < 244 )
      {
        document.all.VerticalBar.height = 244;
      }
      
      // Scale the main windows width
      document.all.BodyWidth.width = WinWidth - 173;
      
      // Scale the iframe to fit the main window
      document.all.Body.width = WinWidth - 174;
      document.all.Body.height = WinHeight - 104;
      break;
    }
  }
}



function SetCreditCard( card )
{
  CardType = card;
}



function SetCursor( obj, cursor )
{
  obj.style.cursor = cursor;
}



function SetShipping( value )
{
  var obj;
  var total;
  
  // Get the shipping cost
  obj = document.getElementById( "sub3" );
  obj.value = BuildPrice( value );
  ShippingCost = value;
  
  // Calculate the bottom line
  total = window.top.cart.productTotal + (window.top.cart.productTotal * 0.0725) + ShippingCost;
  
  // Assign the bottom line to the "total" form element
  obj = document.getElementById( "total" );
  obj.value = BuildPrice( total  );
}



function ShowCart()
{
  document.all.Body.src = "cart.html"
}



function SideMenu( show )
{
  var obj = window.top.body.document.getElementById( "SideMenu" );
  
  if( (show != false) && (window.top.body.document.all.ScreenTitle.innerText != "Check Out") )
  {
    obj.style.visibility = "visible";
  }
  else
  {
    obj.style.visibility = "hidden";
  }
}



function SubmitCheckOutForm()
{
  var obj;
  var cart = window.top.cart;
  
  if( CheckForm() )
  {
  /*
    obj = document.getElementById( "Date" );
    cart.Date = obj.value;
    
    cart.ShippingCost = ShippingCost;
    
    obj = document.getElementById( "ProductCost" );
    cart.ProductCost = obj.value;
    
    obj = document.getElementById( "Tax" );
    cart.Tax = obj.value;
    
    obj = document.getElementById( "total" );
    cart.TotalCost = obj.value;
    
    obj = document.getElementById( "Recipient" );
    cart.Recipient = obj.value;
    
    obj = document.getElementById( "RecipientCity" );
    cart.RecipientCity = obj.value;
    
    obj = document.getElementById( "RecipientState" );
    cart.RecipientState = obj.value;
    
    obj = document.getElementById( "RecipientZip" );
    cart.RecipientZip = obj.value;
    
    obj = document.getElementById( "Billing" );
    cart.Billing = obj.value;
    
    obj = document.getElementById( "BillingCity" );
    cart.BillingCity = obj.value;
    
    obj = document.getElementById( "BillingState" );
    cart.BillingState = obj.value;
    
    obj = document.getElementById( "BillingZip" );
    cart.BillingZip = obj.value;
    
    obj = document.getElementById( "CreditCardHolder" );
    cart.CreditCardHolder = obj.value;
    
    cart.CardType = CardType;
    cart.ExpirationMonth = CardMonth;
    cart.ExpirationYear = CardYear;
    */
    
    obj = document.getElementById( "SubmitMyOrder" );
    obj.submit();
  }
  return false;
}



function SubmitContactForm()
{
  var obj;
  
  obj = document.getElementById( "Contact" );
  obj.submit();
}



function TransferValues()
{
  var obj;
  var cart = window.top.cart;
  
  obj = document.getElementById( "Date" );
  obj.value = cart.Date;
  
  obj = document.getElementById( "ShippingCost" );
  obj.value = BuildPrice( cart.ShippingCost );
  
  obj = document.getElementById( "ProductCost" );
  obj.value = cart.ProductCost;
  
  obj = document.getElementById( "Tax" );
  obj.value = cart.Tax;
  
  obj = document.getElementById( "TotalCost" );
  obj.value = cart.TotalCost;
  
  obj = document.getElementById( "Recipient" );
  obj.value = cart.Recipient;
  
  obj = document.getElementById( "RecipientCity" );
  obj.value = cart.RecipientCity;
  
  obj = document.getElementById( "RecipientState" );
  obj.value = cart.RecipientState;
  
  obj = document.getElementById( "RecipientZip" );
  obj.value = cart.RecipientZip;
  
  obj = document.getElementById( "Billing" );
  obj.value = cart.Billing;
  
  obj = document.getElementById( "BillingCity" );
  obj.value = cart.BillingCity;
  
  obj = document.getElementById( "BillingState" );
  obj.value = cart.BillingState;
  
  obj = document.getElementById( "BillingZip" );
  obj.value = cart.BillingZip;
  
  obj = document.getElementById( "CreditCardHolder" );
  obj.value = cart.CreditCardHolder;
  
  obj = document.getElementById( "CardType" );
  obj.value = CardType;
  
  obj = document.getElementById( "ExpirationMonth" );
  obj.value = cart.ExpirationMonth;
  
  obj = document.getElementById( "ExpirationYear" );
  obj.value = cart.ExpirationYear;
  
  obj = document.getElementById( "SendOrder" );
  obj.submit();
}



function UpdateQty( item )
{
  var lineObj;
  var qtyObj;
  var totalObj
  var id;
  var startLine;
  var total = 0;
  var cart = window.top.cart.cart;
  var products = window.top.cart.products;
  
  id = item + "Qty";
  qtyObj = document.getElementById( id );
  
  if( AllNumbers(qtyObj.value) )
  {
    cart[item] = qtyObj.value;      // update the quantity in the shopping cart
    id = item + "Line";
    lineObj = document.getElementById( id );
    lineObj.value = BuildPrice( qtyObj.value * products[item][1] );
    totalObj = document.getElementById( "total" );
    
    for( item in cart )
    {
      total += (cart[item] * products[item][1]);
    }
    totalObj.value = BuildPrice( total );
  }
}



function ValidateQty( item )
{
  var message;
  var obj;
  var id = item + "Qty";
  
  obj = document.getElementById( id );
  
  if( !AllNumbers(obj.value) )
  {
    message = "Invalid Quantity Entered\n\n" +
              "Each quantity must be an integer value."
    alert( message );
    obj.focus();
    obj.select();
  }
}


// document.onmousedown = CatchClick;      // Hook into our right-click detection function
//-->
