﻿
$(document).ready( function() {
  
//  // bind change event to screens quantity box
//  $(".fn_txtNumScreens").change( function() {
//    // disable screen dimension input unless there is a value greater than 0
//    try
//    {
//      var numScreens = parseInt($(".fn_txtNumScreens").val());
//      
//      if (numScreens.toLowerCase != "nan")
//      {
//        if (numScreens > 0)
//        { $(".fn_ddlScreenSize").removeAttr("disabled"); }
//        else 
//        { $(".fn_ddlScreenSize").attr("disabled", "disabled"); }
//      }
//    }
//    catch (e)
//    {
//      // if an error occurs, just make sure that the screen size control is enabled
//      $(".fn_ddlScreenSize").removeAttr("disabled");
//    }
//  });

//  // raise change event on first load
//  $(".fn_txtNumScreens").change();
  
  // bind change event to colors dropdown
  $(".fn_ddlColor").change( function() {
    // disable 'other color' input unless appropriate item is selected from dropdown
    try
    {
      selectedText = $(".fn_ddlColor :selected").text();
      if (selectedText.toLowerCase().indexOf("other") > -1)
      { $(".fn_txtOtherColor").removeAttr("disabled"); }
      else 
      { 
        $(".fn_txtOtherColor").attr("disabled", "disabled"); 
        $(".fn_txtOtherColor").val("");
      }
    }
    catch (e)
    {
      // if an error occurs, just make sure that the 'other color' control is enabled
      $(".fn_txtOtherColor").removeAttr("disabled");
    }
  });

  // raise change event on first load
  $(".fn_ddlColor").change();
  
});

function BookmarkPage(title, url)
{
  if (window.sidebar)
  {
    window.sidebar.addPanel(title, url, "");
  }
  else if (window.opera && window.print)
  {
    var c = document.createElement('a');
    c.setAttribute('title',title);
    c.setAttribute('href',url);
    c.setAttribute('rel','sidebar');
    c.click();
  } 
  else if (document.all)
  {
    window.external.AddFavorite(url, title);
  }
}
