var activeTab ='autopozicovna';
var isToggling = false;
function toggleTabs(startTab)
{
	if (startTab != activeTab || isToggling) return;
	isToggling = true;
	
	activeTab = (activeTab == 'autopozicovna') ? 'transport' : 'autopozicovna';
	
	new Effect.toggle(startTab,'appear',{duration:0.3,afterFinish: onFinishHideTab});
	new Effect.toggle(startTab+'_manufacturers','appear',{duration:0.3});
	
	$('transport_tab').toggleClassName('active'); 
	$('autopozicovna_tab').toggleClassName('active');
	
	if (startTab == 'autopozicovna')
	{
		$('title_orange').update('transport');
	}
	else
	{
		$('title_orange').update('autopožičovňa');
	}
}

function onFinishHideTab(obj){
  
  if (obj.element.id == 'transport')
  {
  		new Effect.toggle('autopozicovna','appear',{duration:0.3,afterFinish: onFinishToogleTabs});
		new Effect.toggle('autopozicovna_manufacturers','slide',{duration:0.3});
	}
	else
	{
		new Effect.toggle('transport','appear',{duration:0.3,afterFinish: onFinishToogleTabs});
		new Effect.toggle('transport_manufacturers','slide',{duration:0.3});
	}

}

function onFinishToogleTabs(obj){
 isToggling = false;
}

var activePriceList ='osobne';
var newPriceList ='osobne';
var isPriceListToggling = false;

function tooglePriceList(startPriceList)
{
	/*if (startPriceList != activePriceList || isPriceListToggling) return;
	isPriceListToggling = true;*/
	newPriceList = startPriceList;
//	new Effect.toggle(activePriceList+'_content','blind',{duration:0.4,afterFinish: onFinisheHidePriceList});
	$(activePriceList+'_content').toggle();
	$(newPriceList+'_content').toggle();
	$(activePriceList+'_tab').toggleClassName('active'); 
	$(newPriceList+'_tab').toggleClassName('active');
	activePriceList = newPriceList;
	
	
}

function onFinisheHidePriceList(obj)
{
	new Effect.toggle(newPriceList+'_content','blind',{duration:0.4,afterFinish: onFinisheTooglePriceList});
}

function onFinisheTooglePriceList(obj){
 isPriceListToggling = false;
 activePriceList = newPriceList;
}

function overPriceListRow(row)
{
	row.style.backgroundColor="#fffbd4";
	row.style.color="#ff6633";
}

function outPriceListRow(row)
{
	row.style.backgroundColor="#ffffff";
	row.style.color="#4c4c4c";
}


function overImage(image)
{
  var image_src = image.src;
  var extension_index = image_src.lastIndexOf('.');
  image.src = image_src.substring(0,extension_index) + '-over' + image_src.substring(extension_index);

}

function outImage(image)
{
	var image_src = image.src;
  	var extension_index = image_src.lastIndexOf('.');
  	image.src = image_src.replace('-over\.','\.');

}

function overImageById(id)
{
  var image = document.getElementById(id);
  var image_src = image.src;
  var extension_index = image_src.lastIndexOf('.');
  image.src = image_src.substring(0,extension_index) + '-over' + image_src.substring(extension_index);

}

function outImageById(id)
{
	var image = document.getElementById(id);
	var image_src = image.src;
  	var extension_index = image_src.lastIndexOf('.');
  	image.src = image_src.replace('-over\.','\.');

}

