jQuery(document).ready(function() {
	if (jQuery('a.destMap').length > 0) jQuery(this).attr('href', jQuery(this).attr('href')+ '&ajax=yes');

	// hide/show region content

	if (jQuery('.destinationModule').length > 0) {
		var content = jQuery('.contentpaneopencontentFloat').eq(1);

		jQuery('tbody tr td p', content).each(function(i) {
			if (i == 0) {
				jQuery(this).prepend('<a href="#" class="toggleContent">show</a>');
				jQuery('a.toggleContent').click(function() {
					if (jQuery(this).hasClass('toggleContentHide')) {
						jQuery('tbody tr td p', content).each(function(i) {
							if (i > 0) jQuery(this).hide();
						});
						//jQuery(this).css('background', '')
					}
					else {
						jQuery('tbody tr td p', content).show();
					}

					jQuery(this).toggleClass('toggleContentHide');

					return false;
				});
			}
			else {
				jQuery(this).hide();
			}
		});
	}

	// title on the search box
	if (jQuery('#mod_search_searchword').length > 0) showFieldTitle('#mod_search_searchword');
});

function showFieldTitle(fieldId)
{
	var title = jQuery(fieldId).attr('title');

	jQuery(fieldId).val(title);

	jQuery(fieldId).focus(function() {
		if (jQuery(fieldId).val() == title) {
			jQuery(fieldId).val('');
		}
	});

	jQuery(fieldId).blur(function() {
		if (jQuery(fieldId).val().length == 0) {
			jQuery(fieldId).val(title);
		}
	});
}