// SmartCV custom Scripts below

$(document).ready(function() {

	// Color switcher when you click an nav anchor
    $('ul li a').click(function(){
    	var anyActive = $(this).parent().parent().find('li a.active');
    	// checks to see if the anchor parent list has an active anchor setted
    		if(anyActive) { 
  		  		// remove the active class from the previous selected anchor
    			$(this).parent().parent().find('li a.active').removeClass('active');
    			// add active state to the anchor clicked
    			$(this).addClass('active');
    		}
			
    });
    $(window)._scrollable();
    $('li.sidebarLi a').bind("click", 
			function(e){
				var num = $(this).attr('id').replace('b','')*1;
				var dimH = 0;
				if(num){
					for(var i=1;i<=num;i++){
					dimH += $('#sidebarContent div.sidebarPanel:nth-child('+i+')').height()+25;
					}
				}
				$.scrollTo(dimH,500);
		});
    
		$('li.yearsLi a').bind("click", 
			function(e){
				var num = $(this).attr('id').replace('a','')*1;
				var dimH = 0;
				if(num){
					for(var i=1;i<=num;i++){
					dimH += $('#content div.yearPanel:nth-child('+i+')').height();
					}
				}
				$.scrollTo(dimH,800);
		});

		$('#more_API').dialog({autoOpen:false,modal:true,title:'APIs Integrated',resizable:'false'});
		$('#more_WS').dialog({autoOpen:false,modal:true,title:'Web Services',resizable:'false'});
		$('#more_data').dialog({autoOpen:false,modal:true,title:'Data Formats',resizable:'false'});
		$('#more_HTML').dialog({autoOpen:false,modal:true,title:'HTML &amp; CSS',resizable:'false'});
		$('#more_JS').dialog({autoOpen:false,modal:true,title:'JavaScript',resizable:'false'});
		$('#more_PHP').dialog({autoOpen:false,modal:true,title:'PHP',resizable:'false'});
		$('#more_Shell').dialog({autoOpen:false,modal:true,title:'Shell, Perl, *nix',resizable:'false'});
		$('#more_Software').dialog({autoOpen:false,modal:true,title:'Design Software',resizable:'false'});
//var slide = function(){$("#contactme").effect('slide',{percent:0},500)};
		setTimeout(function(){$("#contactme").effect('slide',{percent:0},1000)},1000);
/*
		var slide =  function(){$("#contactme").effect('slide',{percent:0},500,
						function(){$('#contactme_link').unbind('click',slide);})};

		$('#contactme_link').click(slide);
	*/	

});

