$(function(){
	
	$('.showHide>a').click(function(){
	  var ql = $(this).toggleClass('hide').parent().next().find('.quickLinks');
	  
	  if($(this).hasClass('hide')){
		$(this).text('hide');
		if($('.wrapper').hasClass('lessCont')){
		  ql.slideDown(300);
		  return;
		}
		
		ql.show();		
		var destination = $('a[name="bottom"]').offset().top;
		$("html:not(:animated),body:not(:animated)").animate(
			{scrollTop: destination-1},
			{duration: 600,complete:function(){}}
		);		
	  }
	  else{
		  /*if($('.wrapper').hasClass('lessCont')){
			  $(".wrapper").animate({height:$(".wrapper").height()+$('.footer .qLinksCont ul').height()+50},350);
		  }*/
		  $(this).text('show').parent().next().find('.quickLinks').slideUp(300);
	  }
	});
	
	$('#mainMenu .menutitle').click(function(){if(!$(this).attr('rel')) return false;window.location.href=$(this).attr('rel')});
	
	adjustH();
	
});

function adjustH(){
	var fh = $('.footer .qLinksCont ul').height()+$('.footer .showHide').height()+60;
	var wh = $('.wrapper').height();
	var hh = $('body').parent().height();
	//console.log(fh+":+:"+wh+"<"+hh+":::"+(fh+wh<hh))
	if(fh+wh<hh){
		$('.wrapper').addClass('lessCont').css('height',hh-fh)
	}
	else{$('.wrapper').removeClass('lessCont')}
}




window.onresize = function(){$('.wrapper').css('height','auto');adjustH();}
