
function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function ltrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/,"");
}
function rtrim(stringToTrim) {
	return stringToTrim.replace(/\s+$/,"");
}

//array to store IDs of our tabs
var tabs = [];
//index for array
var ind = 0;
//store setInterval reference
var inter;

//change tab and highlight current tab title
function change(stringref){
	
	jQuery('.tab:not(#' + stringref + ')').hide(); //hide the other tabs	
	if (jQuery.browser.msie && jQuery.browser.version.substr(0,3) == "6.0")
		jQuery('.tab#' + stringref).show(); //show proper tab, catch IE6 bug
	else jQuery('.tab#' + stringref).fadeIn();
  
  
	jQuery('#tabs ul li a:not(#' + stringref + 't)').removeClass('active'); //clear highlight from previous tab title	
  jQuery('#tabs ul li a[href=#' + stringref + ']').addClass('active');//highlight currenttab title
}

function next(){
	
	change(tabs[ind++]); //call change to display next tab	
	if(ind >= tabs.length) ind = 0; //if it's the last tab, clear the index
}


jQuery(document).ready(function(){

	//store all tabs in array
	jQuery(".tab").map(function(){
		tabs[ind++] = jQuery(this).attr("id");
  })

	//set index to next element to fade
	ind = 1;
	

    change('praha');



	
  //handler for clicking on tabs
	jQuery("#tabs ul li a").click(function(){		
	
		clearInterval(inter); //if tab is clicked, stop rotating 		
		stringref = jQuery(this).attr("href").split('#')[1]; //store reference to clicked tab		
		change(stringref); //display referenced tab
		return false;
	});	
	
	jQuery(".mapka a").click(function(){		
	
		clearInterval(inter); //if tab is clicked, stop rotating 		
		stringref = jQuery(this).attr("href").split('#')[1]; //store reference to clicked tab		
		change(stringref); //display referenced tab
		return false;
	});	
});  

