function divLength(divId) {
 return document.getElementById(divId).innerHTML.length;
}
function hideEmptyDiv(divId, linkToSectionId, linkToTopId) {
	var sectionTextExist = 0;
	if (document.getElementById(divId)) {
		if (divLength(divId) <= 6) {
			document.getElementById(divId).style.display = 'none';
			if (document.getElementById(linkToSectionId)) document.getElementById(linkToSectionId).style.display = 'none';
			if (document.getElementById(linkToTopId)) document.getElementById(linkToTopId).style.display = 'none';
		} else {
			sectionTextExist = 1;
		}
	}
	return sectionTextExist;
}
function hideEmptySections() {
	var countOtherSections = 0;
	hideEmptyDiv('section1','a1', 'gotoTop1');
	countOtherSections += hideEmptyDiv('section2','a2', 'gotoTop2');
	countOtherSections += hideEmptyDiv('section3','a3', 'gotoTop3');
	countOtherSections += hideEmptyDiv('section4','a4', 'gotoTop4');
	countOtherSections += hideEmptyDiv('section5','a5', 'gotoTop5');
	//hide first link if there are no other sections except section1
	if (document.getElementById('subTourMenu')) {
		if (countOtherSections <= 0) document.getElementById('subTourMenu').style.display = 'none';
	}
}

jQuery.noConflict();
jQuery(document).ready(function() {
	
    if (jQuery('.slideshow')) {
		jQuery('.slideshow').cycle({
			fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
			speed:  2500, //number of milliseconds it will take to transition from one slide to the next
			random:  1 //causes the slides to be shown in random order, rather than sequential.
		});
	};
	
	// Online booking validation
	
	if (jQuery('#destination_id')) {
		if ( jQuery('#destination_id').val() && jQuery('#cost_id').val()) {
			jQuery("#bookTourEvent").show();
		} else {
			jQuery("#bookTourEvent").hide();
		};
	}

});

