$(document).ready(function(){

//Add new news icon
$("#mmi7").css("position","relative").append('<img src="assets/images/file_icons/star.png" width="9" height="9" id="newnews">');

$(".rollover, .pageresourcelist > li, .project, .pageresources > li").hover(
		function(){
			$(this).addClass("rolled")
		},
		function(){
			$(this).removeClass("rolled")}
		).click(function(){
			if($(this).find("a").length>0||$(this).attr("href")){
			var a=$(this).attr("href")?$(this).attr("href"):$(this).find("a").eq(0).attr("href");
			if(typeof a!="undefined"&&a!="") window.location=a
			}
			return false
		});

$(".person").each(function(){
	$(this).find(".innards:not(:first, .personintro)").hide()
	});

$(".person").hover(
	function(){
		$(this).addClass("rolled")
	},
	function(){
		$(this).removeClass("rolled")
	}
	).click(function(a){
		a=$(a.target);
		if(a[0].tagName=="A"&&!a.hasClass("hoverinfo"))return true;
		else {
			a=false;
			var b=$(this).find(".innards:not(:first, .personintro)").eq(0);
            var c=b.parent();
            c.toggleClass('personvisible');
			if(b.hasClass("detailsvisible")) a=true;
			$(".person").each(function(){
                var p = $(this);
				p.find(".innards:not(:first, .personintro)").removeClass("detailsvisible").slideUp('normal',function() {
                  if($.browser.msie && $.browser.version == '7.0' ){
                    p.animate({width: 554},'fast');
                  }
                });
				p.find(".hoverinfo").html("Read more <span></span>")
			});

            if(b.hasClass("detailsvisible")){
				b.removeClass("detailsvisible").slideUp('normal',function() {
                  if($.browser.msie && $.browser.version == '7.0' ){
                    p.animate({width: 554},'fast');
                  }
                });
				c.find(".hoverinfo").html("Read more <span></span>")
			}
			else if(a==false){
				b.addClass("detailsvisible").slideDown();
				c.find(".hoverinfo").html("Hide details <span class='hidedetails'></span>")
			}
			return false
		}
	});

$(".twitters").length>0&&$(".twitters").tweet({username:"housingvision",join_text:"auto",count:3,auto_join_text_default:"we said:",auto_join_text_ed:"we",auto_join_text_ing:"we were",auto_join_text_reply:"we replied to",auto_join_text_url:"we were checking out",loading_text:"loading tweets..."})});
