
$(function()
{

   //css menu
   $('div.subnav').css({'opacity':0.88});

   $("ul#mainNav a.topLevelLinks").hover(
   function () {
     //remove all subnavs
     $("div.subnav").fadeOut(200);
     $(this).next().slideDown(500);

   },null);

   $("div#headerBlock").mouseleave(
   function () {
     $("div.subnav").slideUp(500);
   }
   );

   //Search box
   $('#searchTerm').click(function(){
      $(this).val("");
   });

  //Region/County Cascading Drop Downs

    $('#regionDropDown')
          .change(
             function()
             {
if($('#regionDropDown').val().length)
{
				//alert("true1");
                var regionValue = $('#regionDropDown').val();
                var dropdownSet = $('#countryDropDown');
                var otherdropdownSet = $('#destinationDropDown');
                  otherdropdownSet.attr("disabled",true);
                  otherdropdownSet.emptySelect();
                if (regionValue.length == 0)
                {
                alert("true2");
                  dropdownSet.attr("disabled",true);
                  dropdownSet.emptySelect();
                }
                else
                {
                  dropdownSet.attr("disabled",false);
				  //otherdropdownSet.attr("disabled",false);
                  $.getJSON(
                    '/select/ajexGetCountries.php',
                    {regionID:regionValue},
                    function(data){
                      dropdownSet.loadSelect(data);
                    }
                  );
                  //alert("true3");

               }
}
            }//end of change function
         )


    $('#countryDropDown')
          .change(
             function()
             {
             	//alert("true");
if($('#countryDropDown').val().length)
{
				//alert("true");
                var countryValue = $('#countryDropDown').val();
                var dropdownSet = $('#destinationDropDown');
                if (countryValue.length == 0)
                {
                  dropdownSet.attr("disabled",true);
                  dropdownSet.emptySelect();
                }
                else
                {
                  dropdownSet.attr("disabled",false);

                  var styleValue = 'text-style:bold;';
                  //adjustColorDropdown();

                  $.getJSON(
                    '/select/ajexGetDestinations.php',
                    {countryID:countryValue},
                    function(data){
                      dropdownSet.loadSelect(data);
                    }
                  );
               }
}
            }//end of change function
         )



         $(".tabs").tabs({selected:0});

});



