$(document).ready(function() 
{
	$('#panels > ul.tabs').tabs({ fxFade: true, fxSpeed: 'fast' });    
	$('#c_pages > ul.tabs').tabs({ fxFade: true, fxSpeed: 'fast' });
	$('#p_pages > ul.tabs').tabs({ fxFade: true, fxSpeed: 'fast' });
	
	$(".view_more").click(function() {
		if ($("#"+$(this).attr("rel")).css('display') == 'none')
		{
			$("#"+$(this).attr("rel")).slideDown();
			$(this).removeClass('expand');
			$(this).addClass('minimize');
		}
		else
		{
			$("#"+$(this).attr("rel")).slideUp();
			$(this).removeClass('minimize');
			$(this).addClass('expand');
		}
	});    
	
	$(".change_image").click(function() {
		$(".change_image").removeClass('active');
		$(".an_image").hide();
		
		$(this).addClass('active');  
		$("#"+$(this).attr("rel")).fadeIn();
	});
									 
	$("input:text, textarea, input:password").each(function(){
		if(this.value == '')
			this.value = this.title;
	});
	$("input:text, textarea, input:password").click(function(){
		if(this.value == this.title)
			this.value = '';
	});
	$("input:text, textarea, input:password").blur(function(){
		if(this.value == '')
			this.value = this.title;
	});
	$("input:image, input:button, button:submit").click(function(){
		$(this.form.elements).each(function(){
			if(this.type =='text' || this.type =='textarea' || this.type =='password'){
				if(this.value == this.title && this.title != ''){
					this.value='';
				}
			}
		});
	});
	
	$(".lightbox").lightbox();
	
	$('#rpp').change(function() {
		$.get("./_ui/js/options.ajax.php", { mode: "rpp", value: $(this).val() }, function(data)
		{
			//alert("Data Loaded: " + data);
			if ($('#leasing').val() == '1')
			{
				location.href='/index.php?c=all&p=0&l=1';
			}
			else
			{
				location.href='/index.php?c=all&p=0';
			}
		});
	});
	$('#price').change(function() {
		$.get("./_ui/js/options.ajax.php", { mode: "price", value: $(this).val() }, function(data)
		{
			//alert("Data Loaded: " + data);
			if ($('#leasing').val() == '1')
			{
				location.href='/index.php?c=all&p=0&l=1';
			}
			else
			{
				location.href='/index.php?c=all&p=0';
			}
		});
	});
	$('#make').change(function() 
	{
		$('.sub_cat_car').hide();
		$('.sub_cat_car').attr({ name: "" }); 
		$('.def_cat_car').hide();
		$('#'+$(this).val()).attr({ name: "model" });
		$('#'+$(this).val()).show();
	});
 });

function showInfo(id){
	if(document.getElementById(id).style.display == ""){
	document.getElementById(id).style.display = "none";
	}
	else
	{
		document.getElementById(id).style.display = "";
	}
}
