//(function($){
	
  $(document).ready(function(){
    $("ul.dropdown li").hover(function(){
        $(this).addClass("hover");
        $('div:first',this).css('visibility', 'visible');
        $('div:first',this).css('display', 'block');        
    }, function(){
        $(this).removeClass("hover");
        $('div:first',this).css('visibility', 'hidden');
        $('div:first',this).css('display', 'none');
    });
    
    
    var pop_cookie = GetCookie('css_pop');
	  if(!pop_cookie) {
	  	/*
		if(dialog_width > 0) {
		
		  //show the overlay
	      var left_adjust = parseFloat((parseFloat(dialog_width)/parseFloat(2)))*-1;
		  $('#global-overlay').show();
		  $('#dialog-modal').show();
		  $('#dialog-modal').width(dialog_width);
		  $('#dialog-modal').css('marginLeft', left_adjust);
		  
		  var exp_date = new Date();
		  exp_date.setDate(exp_date.getDate()+1);
				
		  SetCookie2('css_pop', 1, exp_date.toUTCString());
		}*/
	  }
    
  });
//})(jQuery);

function close_css_pop() { 
	(function($){
		$('#global-overlay').hide();
		$('#dialog-modal').hide();
	})(jQuery);
}

function SetCookie2 (name, value, exp) {      
    document.cookie = name + "=" + escape (value) + "; expires=" + exp + "; path=/";
}

function GetCookie (name) {  
    var arg = name + "=";  
    var alen = arg.length;  
    var clen = document.cookie.length;  
    var i = 0;  
    while (i < clen) {    
    var j = i + alen;    
    if (document.cookie.substring(i, j) == arg)      
      return getCookieVal (j);    
      i = document.cookie.indexOf(" ", i) + 1;    
      if (i == 0) break;   
    }  
    return null;
}
  
function SetCookie (name, value) {  
    var argv = SetCookie.arguments;  
    var argc = SetCookie.arguments.length;  
    var expires = (argc > 2) ? argv[2] : null;  
    var path = "/";//(argc > 3) ? argv[3] : null;  
    var domain = (argc > 4) ? argv[4] : null;  
    var secure = (argc > 5) ? argv[5] : false;  
    document.cookie = name + "=" + escape (value) + 
    ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
    ((path == null) ? "" : ("; path=" + path)) +  
    ((domain == null) ? "" : ("; domain=" + domain)) +    
    ((secure == true) ? "; secure" : "");
  }

function getCookieVal(offset) {
    var endstr = document.cookie.indexOf (";", offset);
    if (endstr == -1)
      endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
}

function ta_load_ad(id, ad_url, width, height) {  
  var url = '/iframe.php?url='+ad_url;
    
  var iframe = document.getElementById('frame'+id);
  if(iframe !== null)
  {
      if(iframe.src){
        iframe.src = url; 
      }
      else if(iframe.contentWindow !== null && iframe.contentWindow.location !== null){
        iframe.contentWindow.location = url;        
      }
      else{ 
    	  iframe.setAttribute('src', url); 
      }
  }	 
}

function checkCount(nl_promo_html) {
    var count = GetCookie("nl_promo");
    if (count == null) {
      count=1;
      SetCookie("nl_promo", count, exp);
      document.write(nl_promo_html);
      jQuery(document).ready(function() {
	    jQuery("#lightboxAutoModal").dialog({
	      bgiframe: false, autoOpen: true, height: 352, width:690, modal: true, draggable: false, resizable: false, closeText: '', buttons: '', dialogClass: ''
	       
	      });
	  });

    } else {
      count++;
      SetCookie("nl_promo", count, exp);
    }
}

function toggle_checkbox(passed_checkbox)
{
  (function($){	
	if ($('#cb_lbl_' + passed_checkbox).hasClass('checkbox_default'))
	{
		$('#cb_lbl_' + passed_checkbox).removeClass('checkbox_default');
		$('#cb_lbl_' + passed_checkbox).addClass('checkbox_selected');
		$('#cb_hdn_' + passed_checkbox).val(1);
	}
	else
	{
		$('#cb_lbl_' + passed_checkbox).removeClass('checkbox_selected');
		$('#cb_lbl_' + passed_checkbox).addClass('checkbox_default');
		$('#cb_hdn_' + passed_checkbox).val(0);
	}
  })(jQuery);
}

function recordOutboundLink(link, category, action) {
    _gat._getTrackerByName()._trackEvent(category, action);
    setTimeout('document.location = "' + link.href + '"', 100);
}

function emptyLabel(obj, str) { if(obj.value== str) obj.value=''; }
function restoreLabel(obj, str) { if(obj.value=='') obj.value = str; }
