
jQuery.noConflict();
var $j = jQuery;


function CFsetSliders(id) {
	var topSpacer = 2;
	var bottomSpacer = (!document.all) ? 2 : ((navigator.appVersion.indexOf("MSIE 6.0") != -1) ? 6 : 2);
	$j('.slider-button').each(function (i) {
		if(i <= id) {
			$j(this).css('top', (topSpacer + 41 * i) + 'px');
			$j(this).css('bottom', 'auto');
		} else {
			$j(this).css('top', 'auto');
			$j(this).css('bottom', (bottomSpacer + 41 * (3 - id - (i - id))) + 'px');
		}
	});
	$j('#slider').css('top', (2 + 41 * (id + 1)) + 'px');
	
	// A compl�ter pour charger le contenu
}




$j(document).ready(function () {
	
	$j('input.input-text.input-preset').focus(
		function () {
			$j(this).attr('title', $j(this).val())
			$j(this).val('');
	});
	$j('input.input-text.input-preset').blur(
		function () {
			if($j(this).val() == '') {
				$j(this).val($j(this).attr('title'));
			}
	});
	
	// Correction incompatibilit� CSS3 IE6 HOVER
	$j('.thumb').hover(
		function() {
			$j(this).addClass('thumb-hover');
		},
		function() {
			$j(this).removeClass('thumb-hover');
	});
	

	
	$j('.rounded-select-list li').hover(
		function() {
			$j(this).addClass('rounded-select-list-hover');
		},
		function() {
			$j(this).removeClass('rounded-select-list-hover');
	});
	
	$j('.rounded-select').click(function() {
		if($j(this).next(".rounded-select-list:visible").length) {
			$j(this).next(".rounded-select-list").hide();
		} else {
			$j(this).next(".rounded-select-list").show();
		}
	});
	
	$j('.rounded-select-list li').click(function () {
		$j('#' + $j(this).attr('id').substring(0, 3) + '_value').val($j(this).attr('id').substring(3));
		$j('#' + $j(this).attr('id').substring(0, 3) + '_caption').html($j(this).html());
		$j(this).parent().parent().hide();
		// �ventuelles actions perso
		if ($j(this).attr('id').substring(0, 3) == 'cat')
			load(null,$('cat_value').value);
	});
	
	$j('.thumb-info').click(function () {
		window.location = "/place/show/"+$j(this).attr("id");
	});
	
	$j('.slider-button').each(function (i) {
		$j(this).click(function () {
			$j('.slider-button.slider-button-selected').removeClass('slider-button-selected');
			$j(this).addClass('slider-button-selected');
			CFsetSliders(i);
		});	
	});
	// Corrige le d�calage IE6/7
	CFsetSliders(0);
	
	$j('.stars-big').each(function () {
		$j(this).find(".stars-big-button").each(function (i) {
			$j(this).hover(
				function() {
					$j(this).parent().removeClass('big-rank' + $j('#stars-value-' + $j(this).parent().attr('id')).val());
					$j(this).parent().addClass('big-rank' + (i + 0));
				},
				function () {
				$j('#stars-value-' + $j(this).parent().attr('id')).val()
					$j(this).parent().removeClass('big-rank' + (i + 0));
					$j(this).parent().addClass('big-rank' + $j('#stars-value-' + $j(this).parent().attr('id')).val());
			});
			$j(this).click(function () {
				$j(this).parent().addClass('big-rank' + (i + 0));
				$j('#stars-value-' + $j(this).parent().attr('id')).val(i + 0);
				
				if($j(this).parent().hasClass('ajax-rank')) {
					// A compl�ter, requ�te ajax si besoin
					ratePlace(i);
				}
			});
		});
	});
	
	$j('#comment-post-submit').click(function() {
		$j('#comment-post-form').submit();
	});
	
	

	
});