$(function(){
	$(".openmodal").each(function(d) {
		var tgt = $("#" + $(this).attr("target")) ;
		
		$(this).bind('click', function(){
			if (tgt.hasClass('hidden-xs')) {
				tgt.removeClass('hidden-sm').removeClass('hidden-xs') ;
				var h = tgt.height() ;
				var t = tgt.offset().top ;	
				$("#superwrapper").css({'height': (h+t) +'px', 'overflow':'hidden'}) ;
				console.log("H:" + h) ;
				$(this).html("<i class='fa fa-fw fa-times fa-2x'></i>") ;
			} else {
				tgt.addClass('hidden-sm').addClass('hidden-xs') ;
				$("#superwrapper").css({'height':'auto', 'overflow':'auto'}) ;
				$(this).html("<i class='fa fa-fw fa-bars fa-2x'></i>") ;
			}
			return false ;
		}) ;
	}) ;


}) ;