/*
 * File........: liste.js
 * Created.....: 2005/05/30
 * Copyright...: (c) 2005 All Rights Reserved.
 */

function STD(i,v)
{ 
  document.p.ixList.value =i;
  document.p.v.value = v;
  document.p.act.value = "offer";
  document.p.submit();
}

function Sei(i)
{ 
  document.p.act.value = "list";
  document.p.page.value = i;
  document.p.submit();
}

function ResultSortL(sortBy,sortOrder,action)
{
  document.p.act.value = action;
  document.p.sortBy.value 	 = sortBy;
  document.p.sortOrder.value = sortOrder;
  document.p.submit();
}


function MZ(i,action,v)
{ // Merkzettel: Fzg. hinzufuegen / loeschen
  document.p.notepad.value = action;
  document.p.v.value = v;
  var cars="";
  if(action=="addList"||action=="removeList"){
    if(document.p.car)
    {
  	 if(i>1){
	  	for(var j=(i-1);j>=0;j--){
			if(document.p.car[j].checked)
				cars+="$"+ document.p.car[j].value;
	  	}
  	 }else{
		if(document.p.car.checked)
		 cars+="$"+ document.p.car.value;
  	 }
  	}
  	//if (cars=="")  //auch wenn kein Fzg. gewaehlt wurde, kommt eine Fehlermeldung
  	//  return; 
  	document.p.ixList.value =cars;
  }else{
	  document.p.ixList.value =i;
  }

  document.p.act.value = "notepad";
  document.p.action += "?show=";
  document.p.action += getViewStat();  
  document.p.submit();
    
}

function compare(i,action,v,current,max)
{
  document.p.compare.value = action;
  var cars="";
  current=0;
  if(action=="addList"||action=="removeList"){
    if(document.p.car)
    {
  	 if(i>1){
	  	  for(var j=0;j<i;j++){
			if(document.p.car[j].checked){
				cars+="$"+ document.p.car[j].value;
				current++;
			}
	  	}
  	 }else{
		if(document.p.car.checked)
		 cars+="$"+ document.p.car.value;
  	 }
  	}
  	//if (cars=="")   //auch wenn kein Fzg. gewaehlt wurde, kommt eine Fehlermeldung
  	//  return; 
  	document.p.ixList.value =cars;
  }else{
	  document.p.ixList.value =i;
  }


  document.p.act.value = "compare";
  document.p.v.value = v;  
  document.p.submit();
      	
}

function showCarDetail(i)
{
  //Fahrzeug: anzeigen
  document.p.act.value = "offer";
  document.p.cid.value = i;
  document.p.submit();
}

function showCarLead(i,bdsearch)
{
  //Anfrage zum Fahrzeug aus Vergleich
  document.p.act.value = "enquiry";
  document.p.cid.value = i;
  document.p.v.value = "0";
  document.p.bdsearch.value = bdsearch;
  document.p.submit();
}

function showCompBack()
{
  //zurueck zur letzten Aktion
  document.p.act.value = "compare";
  document.p.compare.value = "back";
  document.p.submit();
}

function showListBack()
{
  //zurueck zur letzten Aktion
  document.p.act.value = "list";
  document.p.selfAction.value = "back";
  document.p.submit();
}

// Fahrzeuganzahl der Ergebnisliste setzen
function setLines(sel)
{
  document.p.ixList.value = flagListe();
  document.p.lines.value = sel.value;
  document.p.act.value = "list";
  document.p.submit();
}

function flagListe()
{
  if(!document.p.car)
    return 0;
  var stat = 0;
  for (i=document.p.car.length-1;i>=0;i--)
  { stat <<= 1;
	if(document.p.car[i].checked)
	  stat |= 1;
  }
  return stat;
}

function checkItem(url)
{
  document.images.dummybild.src = url;
}

function mi(cell,color) { cell.bgColor = (color) ? color:'#D8D7DD'; }
function mo(cell,color) { cell.bgColor = (color) ? color:'#FFFFFF'; }

