// loadCSS() - writes code to load either IE or non-IE style sheets.
//
function loadCSS(p_real, p_ie, p_height)
{
  document.writeln("<style type=\"text/css\">");
  document.writeln("@import \"css/" + p_real + "\";");
  if (isIE()) {
    document.writeln("@import \"css/" + p_ie + "\";");
  }
  else if (isIE7()) {
    document.writeln("@import \"css/styleIE7.css\";");
  }
  if (typeof p_height != undefined) {
    document.writeln(".contentHeight { height: " + p_height + "px; }")
  }
  document.writeln("</style>");
}

// isIE() - determines if MS browser
//
function isIE()
{
  var l_agent = navigator.userAgent.toLowerCase(); 
  return (l_agent.indexOf("msie") != -1 && l_agent.indexOf("7.0") < 0);
}
function isIE7()
{
  var l_agent = navigator.userAgent.toLowerCase(); 
  return (l_agent.indexOf("msie") != -1 && l_agent.indexOf("7.0") != -1);
}

function gallery(p_model)
{
  var l_url = "gallery\/template1.htm?model=" + p_model;
  var l_win = window.open(l_url, "Gallery", "width=617,height=557,status=0,scrollbars=auto");
  l_win.moveTo(50,50);
  l_win.focus();
}

function printMailLink(p_name, p_domain, p_text, p_subject)
{
   document.write("<a href=\"mailto:" + p_name + "@" + p_domain);
   if (p_subject != null) {
      document.write("?Subject=" + p_subject);
   }
   document.write("\"><b>");
   if (p_text != null) {
      document.write(p_text);
   }
   else {
      document.write(p_name + "@" + p_domain);
   }
   document.writeln("</b></a>");
}

function printCopyright(p_majDev)
{
    document.writeln("Some images displayed on this page may include optional accessories.");
    document.writeln("<br />");
    document.writeln("&copy; 2006-2007 1st Cooling, Inc. &nbsp; All Rights Reserved.");
    document.writeln("<br />");
    if (typeof p_majDev != 'undefined' && p_majDev == true)
    {
        document.writeln("<a href=\"http://majestydev.com\" target=\"_blank\">Majesty Development, Inc.</a>");
    }
    document.writeln("<br />&nbsp;");
}

function submitSearch()
{
  //var sText = document.getElementById("searchText");
  //alert("Search for: " + sText.value);

  NotReady();
  return false;
}

function printDate()
{
   // document.writeln((new Date()).toString());
   var monthname = new Array ("January","February","March",
                              "April","May","June","July",
                              "August","September","October","November","December");
   var now = new Date();
   var year = now.getFullYear();
   var month = now.getMonth();
   var date = now.getDate();
   document.write(monthname[(month)] + " " + date + ", " + year); 
}
function moveBox()
{
  var numberProducts = 14;
  var l_noProduct = Math.ceil(Math.random() * numberProducts);
  
  var l_productOver  = document.getElementById("productOverlay");
  var l_centerBox    = document.getElementById("centerBox");

  var l_productLeft = Math.round((document.body.clientWidth - 784)/2) + 140;
  var l_top         = l_centerBox.offsetTop + 40;

  l_productOver.style.cssText += (" left: " + l_productLeft + "px; top: " + l_top +  "px; background-image: url(images/product_" + l_noProduct + ".gif)");
  //l_productOver.style.cssText += (" left: " + l_productLeft + "px; top: " + l_top +  "px;)");
}
