function ieHover(h_list){
	if ($.browser.msie && $.browser.version < 7){
		$(h_list).mouseover(function(){
			$(this).addClass('hover');
		}).mouseout(function(){
			$(this).removeClass('hover');
		});
	}
}

$(function(){
	ieHover(".gallery .info li");
});

$(function() 
{
 if (jQuery.browser.msie){
  $("ul li:first-child").addClass("firstChild");
  $("ul li:last-child").addClass("lastChild");
 }
});


$(function() 
{
 $('ul.hint li:odd').addClass('noPadding');
});


$(document).ready(function()
{
  if (window.location.href.toLowerCase().indexOf("cmspagemode=edit")>0){  // exiting if in the sitefinity edit mode
  return false;
  }
 if (window.location.href.toLowerCase().indexOf("/ar/")>0)
 {
  $('#nav li').each(function(){
   $(this).mouseenter(function(){
   if(typeof(document.body.style.maxHeight) == 'undefined') $(this).addClass('hover');
   }).mouseleave(function(){
   if(typeof(document.body.style.maxHeight) == 'undefined') $(this).removeClass('hover');
   setTimeout(function(){
   },10)
   })
  });
 }
  else
  {
   initCufon();
    $('#nav li').each(function(){
    $(this).mouseenter(function(){
    if(typeof(document.body.style.maxHeight) == 'undefined') $(this).addClass('hover');
    Cufon.replace('#nav li a', { fontFamily: 'KozB', hover: true });
    Cufon.replace('#nav li li a', { fontFamily: 'KozL', hover: true });
    }).mouseleave(function(){
    if(typeof(document.body.style.maxHeight) == 'undefined') $(this).removeClass('hover');
    setTimeout(function()
   {
    Cufon.replace('#nav li a', { fontFamily: 'KozB', hover: true });
    Cufon.replace('#nav li li a', { fontFamily: 'KozL', hover: true });
   },10)
   })
   });
  }
});

$(function(){
 var $news = $('ul li.news a');
 var $blog = $('ul li.blog a');
 var news= $('#news');
 var blog= $('#blog');
 
 $news.addClass('active');
 blog.hide();
 
 $news.click(function(){
  blog.hide();
  news.show();
  $blog.removeClass('active');
  $news.addClass('active');
  return false;
 });
 
 $blog.click(function(){
  blog.show();
  news.hide();
  $blog.addClass('active');
  $news.removeClass('active');
  return false;
 });
});


function lightBox1() {
 $('a.openLightbox').lightBox();
}

$(function(){
 $('div.event-box ul li:odd').addClass('alt');
 $('div.event-block ul li:odd').addClass('noMargin');
});

$(function(){
 $("a[rel='external']").attr("target","_blank");
 $("a[href='#']").click(function(){
  return false;
 });
});


(function ($) {

$.fn.hint = function (blurClass) {
  if (!blurClass) { 
    blurClass = 'blur';
  }
    
  return this.each(function () {
    // get jQuery version of 'this'
    var $input = $(this),
    
    // capture the rest of the variable to allow for reuse
      title = $input.attr('title'),
      $form = $(this.form),
      $win = $(window);

    function remove() {
      if ($input.val() === title && $input.hasClass(blurClass)) {
        $input.val('').removeClass(blurClass);
      }
    }

    // only apply logic if the element has the attribute
    if (title) { 
      // on blur, set value to title attr if text is blank
      $input.blur(function () {
        if (this.value === '') {
          $input.val(title).addClass(blurClass);
        }
      }).focus(remove).blur(); // now change all inputs to title
      
      // clear the pre-defined text when form is submitted
      $form.submit(remove);
      $win.unload(remove); // handles Firefox's autocomplete
    }
  });
};

})(jQuery);

$(function(){ 
 // find all the input elements with title attributes
 $('input[title!=""]').hint();
 
});

function tabing() {
	$("ul.tabs").tabs("div.panes > div", {effect: 'fade', fadeOutSpeed: 400});
}

function pager() {
	$("ul.ImageCategory li").quickpaginate({ perpage: 18, showcounter: true, pager : $("#shopping_list_counter") });
	
	
}



