function show(set,name ) 
{ 
  obj = document.getElementById(name);
  if (obj)
  {
    if (set == "display" ) 
    {
      obj.style.display = "block"; 
    } 
    else 
    {
      obj.style.display = "none";
    }
  }
}

function validateSelectOnSubmit(Form)
{
  if (Form.ProductWoodSelection.selectedIndex == 0)
  {
       alert("Please Make A Wood Selection Before Adding To Cart!");
       return false;
  }
return true;
}

function validateZipcodeOnSubmit(Form)
{
  var pattern = /\d+/;
  zipcodea = Form.ZipCode.value.split(" ");
  if (zipcodea[0].length == "0")
    zipcode = zipcodea[1];
  else
    zipcode = zipcodea[0];
  if (Form.ZipCode.value == "intl" ||
      Form.ZipCode.value == "Intl" ||
      Form.ZipCode.value == "local" ||
      Form.ZipCode.value == "Local")
  {
     return true;
  }
  if (zipcode.length == "5" && pattern.test(zipcode)) 
 
  {
     return true;
  }

  alert("Not a valid zipcode value"+" :"+zipcode+":");
  return false;

}

function submitDestinationType()
{
var destList = document.getElementById('DestinationType');
//   URL ="cart-action-6/destination-type-" + destList.value + "/";
    var loc = window.location.href.indexOf("cart");
    var URL = window.location.href.substr(0,loc) + "cart-details/cart-action-cart6/destination-type-" + destList.value + "/";
//    URL = "index.php?CartAction=6&DestinationType=" + destList.value;
   window.location.href = URL;  
}

function submitShippingRate()
{
var shipList = document.getElementById('ShippingRate');
    var loc = window.location.href.indexOf("cart");
    var URL = window.location.href.substr(0,loc) + "cart-details/cart-action-cart6/shipping-rate-" + shipList.value + "/rate-index-" + shipList.selectedIndex + "/";
//   URL ="index.php?CartAction=6&ShippingRate=" + shipList.value +"&RateIndex=" +shipList.selectedIndex;
   window.location.href = URL;  
}
//window.onload=function() { 
//document.forms[0][0].focus(); 
//} 

    var myWindow; 

function openCenteredWindow(url) 
{
    var width = 300; 
    var height = 600; 
    var left = parseInt((screen.availWidth/2) - (width/2));
    var left = 20; 
    var top = parseInt((screen.availHeight/2) - (height/2));
    var top = 165; 
    var windowFeatures = "width=" + width + ",height=" + height + 
        ",status,resizable,left=" + left + ",top=" + top + 
        ",screenX=" + left + ",screenY=" + top + ",scrollbars,dependent";
    if(!myWindow || myWindow.closed)
    {  
     myWindow = window.open(url, "subWind", windowFeatures);
    }
    else 
    {
      myWindow.focus();
    } 
} 

function displayURL(URL)
{
    var loc = window.location.href.indexOf("cart");
    var URL = window.location.href.substr(0,loc);
    alert(URL);
}
