// JavaScript Document
$(function(){ 
	$("a[rel='external']").attr("target","_blank");
}); 

//add dropdown code for IE
$(function(){
	$("#navMain li").hover(function(){
		$(this).find("ul").slideDown('fast');							   
	},
	function(){
		$(this).find("ul").slideUp('fast');							   
	});
});

$(function(){
	if(loggedin != ''){
		//redirect to home page after logout
		$("#loginInfo a").attr('href','/LogOutProcess.aspx?PageID=/');
		//Change login to 'Projects' when logged in
		$("#nav_463050 li a").each(function(){
			if($(this).html() == "Login"){
				$(this).html("Projects").attr('href', '/member/projects');
			}
		});
		$("#navText").css({width:'485px', left:'475px'});
	}else{
		//remove 'No-one logged in' message
		$("#loginInfo").css('display','none');
	}
});
$(function(){
	//change fileboxes to textboxes if they have a value (project edit)
	$.each($(".edit_filebox"), function(i, val){
		if($(this).val() == ''){
			var htm = $(this).parent().html();
			htm = htm.replace("type=\"text\"", "type='file'");
			$(this).parent().html(htm);
		}else{
			var value = $(this).val().replace('/member/files/', '');
			$(this).attr('readonly', true).val(value);	
		}
	});
});
