//<![CDATA[

// show/hide Box with image button
function shBoxWIB(id_btn, id_box) {

	x = document.getElementById(id_btn);

	if (document.getElementById(id_box).style.display != 'none') {
		Effect.BlindUp(id_box);
	}
	else {
		Effect.BlindDown(id_box);
	}
	//Effect.toggle(id_box,'blind');
}

function hideWIB(id_btn, id_box) {


	x = document.getElementById(id_btn);

	if (document.getElementById(id_box).style.display != 'none') {
		Effect.BlindUp(id_box,{duration: 0.0});
	}
	
	//Effect.toggle(id_box,'blind');
}

function showSearch(id_box,page) {
	if (document.getElementById('hideform')) Effect.Fade('hideform',{duration: 0.0});
	Effect.Appear(page, {from:0, to:0.6, duration: 0.5});
	Effect.Appear(id_box, {duration: 0.5});
}

function hideSearch(id_box,page) {
	if (document.getElementById('hideform')) Effect.Appear('hideform',{duration: 0.0});
	Effect.Fade(page, {duration: 0.0});
	Effect.Fade(id_box, {duration: 0.0});
}

function swapimg(id, img) { id.src = img; return false; }

function updateModel(src,dst)
{
	var myAjax = new Ajax.Request(	
		'/include/get_model.php',
		{
			method: 'post',
			parameters: 'make=' + $F(src),
			onComplete: function (r, j) {
				var out = '';
				j.each(function(x) { out += '<option>' + x + '</option>' });
				$(dst).innerHTML = '<select name="model"><option value="" selected="selected">all models</option>'+out+'</select>';
			}
		}
	);
}

function changeFromTo(sFrom, sTo) {
	var a = $(sFrom).selectedIndex;
	var b = $(sTo).selectedIndex;
	if ((b == 0) || (b < a))
		$(sTo).selectedIndex = a;
}

function changeFromToDesc(sFrom, sTo) {
	var a = $(sFrom).selectedIndex;
	var b = $(sTo).selectedIndex;
	if ((b == 0) || (b > a))
		$(sTo).selectedIndex = a;
}

function checkclear(what){ 
	if(!what._haschanged) what.value='';
	what._haschanged = true;
	what.style.color = 'black';
}

function searchCheck(f){ 
	if(!f._haschanged) f.value='';
}



function display_ex(id, idx) {
	  j = 0;
	 if(document.getElementById(id + idx).style.display == 'none') {
	 
		while (document.getElementById(id + j)) {
			if(document.getElementById(id+j).style.display != 'none')
			Effect.BlindUp(id+j, {duration: 0.3}); 
			//document.getElementById(id+j).style.display = 'none';	
			j++;
		  }
		  //document.getElementById(id + idx).style.display = 'block';
		 Effect.BlindDown(id+idx, {queue:'end', duration: 0.5});
	}
	else Effect.BlindUp(id+idx, {duration: 0.3});
}


function selectTabCont(tabs, item) {
	var tab = document.getElementById(tabs).getElementsByTagName('li');
	var i = new Number();
	for (i = 0; i < tab.length; i++)
	{
		document.getElementById(tabs+i).style.display = "none";
		tab[i].className = "";
		tab[i].getElementsByTagName("a")[0].className = "";
	}
	tab[item].className = "tm";
	tab[item].getElementsByTagName("a")[0].className = "tma";
	document.getElementById(tabs+item).style.display = "block";
} 

//]]>