
//40, 52, 53, 54, 55, 56);

var current_typ;
var pf_xpos = new Array();
pf_xpos[40] = 82;
pf_xpos[52] = 238;
pf_xpos[53] = 393;
pf_xpos[54] = 546;
pf_xpos[55] = 699;
pf_xpos[56] = 850;



function loadArticle(aid, lang){
	jQuery(function(){
        rand = Math.random(9999);
        url = "index.php?article_id="+aid+"&clang="+lang+"&cache="+rand;
		$("#article_container").load(url);
        updatePfeilX(aid);
	});
}

function updatePfeilX(k){
    x = pf_xpos[k];
    $('.content-p1').animate({backgroundPosition: x+'px 12px'});
}

function loadSelect(val, aid, p, d){
    hideDIV(d);
    div = "#f"+d;
    rand = Math.random(9999);
    
    url = "index.php?article_id="+aid+"&clang="+lang+"&"+p+"="+val+"&cache="+rand;
    $(div+' .bx3').load(url);
}

function hideDIV(id){
    for  (var i = id; i<6; i++) { 
        $("#f" + i).hide(); 
    }
}

function sel_marke() {
   var selection = document.finder.pmarke.selectedIndex;   
   var val = document.finder.pmarke[selection].value;
   if (current_typ > 1) loadSelect(val, 60, "marke", 5);
   else loadSelect(val, 58, "marke", 3);
}
function sel_modell() {
   var selection = document.finder.pmodell.selectedIndex;   
   var val = document.finder.pmodell[selection].value;
   loadSelect(val, 59, "modell", 4);
}
function sel_baujahr() {
   var selection = document.finder.pbaujahr.selectedIndex;   
   var val = document.finder.pbaujahr[selection].value;
   loadSelect(val, 60, "baujahr", 5);
}

$(document).ready(function() {

    $('.select-typ').change(function() {
        val = $(this).val();
        current_typ = val;
        loadSelect(val, 57, "typ", 2);
    });
  
});

