$(document).ready(function(){

	//Open all links with rel="external" in new window
	$('a[rel="external"]').click( function() {
			window.open( $(this).attr('href') );
			return false;
    });
	
	
	//Clear value in search input box
	$(function() {
		swapValues = [];
		$(".s_input").each(function(i){
			swapValues[i] = $(this).val();
			$(this).focus(function(){
				if ($(this).val() == swapValues[i]) {
					$(this).val("");
				}
			}).blur(function(){
				if ($.trim($(this).val()) == "") {
					$(this).val(swapValues[i]);
				}
			});
		});
	});
	
	
	//disable text selection
	$('.basic a').addClass('noSelect');
	
	
	//Clickable table row
	$('#projectsTable tbody tr').hover(function() {
		$(this).addClass('over');
	}, function() {
		$(this).removeClass('over');
	});
	
	$('#projectsTable tbody tr').click(function(){
    	window.location=$(this).find("a").attr("href");
		return false;
	});


	$(function(){
	$.extend($.fn.disableTextSelect = function() {
		return this.each(function(){
			if($.browser.mozilla){//Firefox
				$(this).css('MozUserSelect','none');
			}else if($.browser.msie){//IE
				$(this).bind('selectstart',function(){return false;});
			}else{//Opera, etc.
				$(this).mousedown(function(){return false;});
			}
		});
	});
	$('.noSelect').disableTextSelect();//No text selection on elements with a class of 'noSelect'
	});
	
	
	if($("#list1b").length != 0) {
		$('#list1b').accordion({
			autoheight: false
		});
	}
	
	
	//show hide timeline
	$('#showhide').hide();

	
	//Toggle
	$('.timeline-btn').toggle(
		function() {
			$(this).toggleClass('close').blur();
			$('#showhide').slideDown(1000);
		},
		function() {
			$(this).toggleClass('close').blur();
			$('#showhide').slideUp(1000);
		}
	);

	
	
});
