$(document).ready(function(){ 

    
/**
* Global Ajax configuration    
*/
$.ajaxSetup({
     type: "POST",
     async: true, /* Blocks the browser while the requests is active */
     cache: false,
     dataType: 'json'
});     
  
    
/**
*  Top Navigation    
*/
$('div#topMenu ul li').bind("mouseenter",function(){
      $("a:first", this).addClass('active'); 
      $("ul:first", this).show();
}).bind("mouseleave",function(){
      $("a:first",this).removeClass('active');
      $("ul:first", this).hide();
});
//el_topmenu2.mouseleave(function() { 
//    el_topmenu2.hide(); 
//});



$('a.showPopupForm[href!=""]').bind("click", function() {
    $.fn.colorbox({iframe:true, scrolling: false, innerWidth: 425, innerHeight: 220, href:$(this).attr('href') }); 
    return false;
});


$('input.hoverEffect').focus( function() {
  if ($(this).val() == $(this).attr('alt')) {
      $(this).val('');
  }
}).blur(function() {
  if ($(this).val() == '') {
      $(this).val($(this).attr('alt'));
  }
});


$('span.timeCountdown["title"]').each(function(index) {
    var liftoffTime = $(this).attr('title');
    if (liftoffTime > 0) $(this).countdown({until: liftoffTime, compact: true, description: ''});
});



/**
* Search field
*/
$('input[name="keywords"]').mouseenter(function() {
    $('div#topMenu ul li ul').hide();
}).focus(function () {
  if (typeof def_keywords!='undefined') {
    if ($(this).val()==def_keywords) $(this).val('');
  }else{
    $(this).val('');
  }
}); 
// blur
  
  

/**
* Header Navigation   
*/ 
//el_headermenu_uls = $('div#headerMenu ul li ul');

$('div#headerMenu > ul > li').bind("mouseenter",function(){
      $("a:first", this).addClass('active'); 
      $("ul:first", this).show();
}).bind("mouseleave",function(){
      $("a:first-child",this).removeClass('active');
      $("ul:first", this).hide();
});
  
  
}); 


function alignHeight(el, margins) {
  var celHeight = 0;
  var celName = $(el);

  if (!celName) return false;

  celName.each( function() {
    if ($(this).height() > celHeight ) celHeight = $(this).height();
  });
  
  if (celHeight > 0) celName.height(celHeight + (margins > 0 ? margins : 0)*1);
}

