﻿//
// Namespace
//
var Master = new Object();

//
// Init
//
jQuery(document).ready(function ()
{
   Master.DropDownList();

   jQuery("#header-understanding-link").click(function ()
   {
      // Set the dialog HTML and show it (HTML comes from an ajax call)

      jQuery.ajax(
      {
         type: "GET",
         url: "/Home/UnderstandingOffers",
         data: null,
         dataType: "json",
         "success": function (json)
         {
            jQuery("#master-understanding").html(json.HTML);
            jQuery("#master-understanding").dialog(
            {
               modal: true,
               title: "iTravex - Understanding &quot;Ready! Offer&quot;, &quot;Likely&quot; &amp; &quot;Ask&quot;",
               width: 600,
               buttons:
               {
                  Close: function ()
                  {
                     jQuery(this).dialog("close");
                  }
               }
            });
         },
         "error": function (xhr, status)
         {
            iTravex.Message("Unknown error - please contact customer service if this problem continues.");
         },
         "complete": function (xhr, status)
         {
            // need not do anything
         }
      });

      return false;
   });
});

// Init drop down lists for browsers not supporting DHTML
Master.DropDownList = function ()
{
   var td = document.getElementById('header_tabs').getElementsByTagName('td');
   for (var x = 0; x < td.length; x++)
   {
      td[x].onmouseover = function ()
      {
         this.className += ' hover';
      }
      td[x].onmouseout = function ()
      {
         var cn = this.className;
         this.className = cn.replace(' hover', '');
      }
   }
}



