var J = jQuery.noConflict();

J(document).ready(function(){
	
	J('#tabs').tabs({
	    select: function(event, ui) {
	        var url = J.data(ui.tab, 'load.tabs');
	        if( url ) {
	            location.href = url;
	            return false;
	        }        
	        // Hide the validation error message, if switching to another tab
	        J('.error').css('visibility','hidden');
	                
	        return true;                
	    }      
	});
	
			
	/// Get URL Parameter  
	function get_url_param( name )
	{
		name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	
		var regexS = "[\\?&]"+name+"=([^&#]*)";
		var regex = new RegExp( regexS );
		var results = regex.exec( window.location.href );
	
		if ( results == null )
			return "";
		else
			return results[1];
	}
   
   /// Select the according tab, depending on the URL Params
	tabparameter = get_url_param('starttab');
	
	if (tabparameter == 2) {
		J('#tabs').tabs('select', 1);		
	};	
	if (tabparameter == 3) {
		J('#tabs').tabs('select', 2);		
	};	
	if (tabparameter == 4) {
		J('#tabs').tabs('select', 3);		
	};	
	if (tabparameter == 5) {
		J('#tabs').tabs('select', 4);		
	};	
	if (tabparameter == 6) {
		J('#tabs').tabs('select', 5);		
	};		 
	if (tabparameter == 7) {
		J('#tabs').tabs('select', 6);		
	};	
	if (tabparameter == 8) {
		J('#tabs').tabs('select', 7);		
	};
	  	  
	  
});









