
/*--- IE6 hover ---*/
function ieHover(h_list){
	if ($.browser.msie && $.browser.version < 7){
		$(h_list).hover(function(){
			$(this).addClass('hover');
		}, function(){
			$(this).removeClass('hover');
		});
	}
}
/*--- slide blocks ---*/
function slideBox(){
	$('div.plan-content').each(function(){
		var _hold = $(this);
		var _btn = _hold.children('a.open');
		var _box = _hold.children('div.plan-details'); 
		var _h = _box.height();
		if(_hold.hasClass('active')) _box.show();
		else _box.hide();
		_btn.click(function(){
			if(_hold.hasClass('active')){
				_hold.removeClass('active');
				_box.stop().animate({height: 0}, 400, function(){ $(this).css({display:'none', height:'auto'});});
			}
			else{
				_hold.addClass('active');
				if(_box.is(':hidden')){
					_box.show();
					_h = _box.height();
					_box.height(0);
				}
				_box.stop().animate({height: _h}, 400, function(){ $(this).height('auto');});
			}
			return false;
		});
	});
}

$(document).ready(function(){
	ieHover('#main-navigation li');
	slideBox();
	slideBoxShort();
	
	menuAdjust("#main-ul")
$("a[rel^='prettyPhoto']").prettyPhoto();

    //When user move mouse over menu
   

      //As images are loaded ul width increases,
      //so we recalculate it each time
      

});
try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(e) {}


function slideBoxShort(){
	$('div.plan-content_short').each(function(){
		var _hold = $(this);
		var _btn = _hold.children('a.open');
		var _box = _hold.children('div.plan-details_short'); 
		var _h = _box.height();
		if(_hold.hasClass('active')) _box.show();
		else _box.hide();
		_btn.click(function(){
			if(_hold.hasClass('active')){
				_hold.removeClass('active');
				_box.stop().animate({height: 0}, 400, function(){ $(this).css({display:'none', height:'auto'});});
			}
			else{
				_hold.addClass('active');
				if(_box.is(':hidden')){
					_box.show();
					_h = _box.height();
					_box.height(0);
				}
				_box.stop().animate({height: _h}, 400, function(){ $(this).height('auto');});
			}
			return false;
		});
	});
}


function menuAdjust(menuID){
	 var div = $(menuID);
       var last =  $(menuID).children(":last");          
                 
          var liwidths   = 0;     
div.children().each(function(index) {liwidths = liwidths + this.offsetWidth;});

liwidths = liwidths - last.outerWidth();
    
    var divWidth = div.innerWidth();
var lastItemWidth = divWidth - liwidths;
   last.width(lastItemWidth -2);
    
   last.children("ul").each(function () {$(this).width(lastItemWidth -18) });

   var test = "test"
}

