/*
* Skeleton V1.1
* Copyright 2011, Dave Gamache
* www.getskeleton.com
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
* 8/17/2011
*/
function tabsfunc(tip){
	var tabs1 = $('ul.tabs.'+tip);

	tabs1.each(function(i) {

		//Get all tabs
		var tab1 = $(this).find('> li > a');
		tab1.click(function(e) {

			//Get Location of tab's content
			var contentLocation = $(this).attr('href')+"_"+tip;
			
			//Let go if not a hashed one
			if(contentLocation.charAt(0)=="#") {

				e.preventDefault();

				//Make Tab Active
				tab1.removeClass('active');
				$(this).addClass('active');
				
				//Show Tab Content & add active class
				$(contentLocation).show().addClass('active').siblings().hide().removeClass('active');

			}
		});
	});
}

$(document).ready(function() {

	/* Tabs Activiation
	================================================== */

	var tabs = $('ul.tabs');
	
	$('.tabs-content>li.active').siblings('li').hide();
	
	tabs.each(function(i) {

		//Get all tabs
		var tab = $(this).find('> li > a');
		tab.click(function(e) {

			//Get Location of tab's content
			var contentLocation = $(this).attr('href');

			//Let go if not a hashed one
			if(contentLocation.charAt(0)=="#") {

				e.preventDefault();

				//Make Tab Active
				tab.removeClass('active');
				$(this).addClass('active');

				//Show Tab Content & add active class
				$(contentLocation).show().addClass('active').siblings().hide().removeClass('active');

			}
		});
	});
	
	$('.next').live("click", function(e){
		afost = $('.cuprins').find('.active');
		vafi = afost.parent().next().find('a');
		if(vafi.length!=0){
			afost.removeClass("active");
			vafi.addClass("active");
			var contentLocation = vafi.attr('href');
			$(contentLocation).show().addClass('active').siblings().hide().removeClass('active');
		}
		
	});
	$('.prev').live("click", function(e){
		afost = $('.cuprins').find('.active');
		vafi = afost.parent().prev().find('a');
		if(vafi.length!=0){
			afost.removeClass("active");
			vafi.addClass("active");
			var contentLocation = vafi.attr('href');
			$(contentLocation).show().addClass('active').siblings().hide().removeClass('active');
		}
		
	});
	
	$('#proiect').live("change",function(){
		contentLocation='#'+$(this).val();
		$(contentLocation).show().addClass('active').siblings().hide().removeClass('active');
		$('.modify_project,.delete_project').attr('project', $(this).val());
		$('.delete_project').attr('project_name',$(this+'option:selected').text());
	});

});

