//Function for Brand and model Car dynamic selection.
var Series = new Array();
Series[0] = "1,155,156,164,2000,GTV,GIULIETTA,Other"; //Alfa Romeo
Series[1] = "2,100,80,A3,A4,A6,A8,S4,S6,TT,Other"; //Audi
Series[2] = "3,Classic-Car,Series 3,Series 4,Series 5,Series 7,Series 8,X5,Z3,Z4,Other"; //BMW
Series[3] = "37,Astro,Aveo,Belair,Camaro,Chevy Van,Corolado,Corvette,Express,Lumina,Optra,Suburban,Tahoe,Zafira,Other"; //Chevloret
Series[4] = "5,PT CRUISER,VOYAGER,Neon,Other";   //Chryler
Series[5] = "6,AX,BX,BX19,C5,CX,CX20,EVASION,XANTIA,XM,X-SARA,ZX,Other"; //Cetreon
Series[6] = "10,100EC,Astina,Capri,Cougor,Escape,Escort,Everest,Explorer,Fairlanse,Falcon,Festiva,Granada,Laser,Marathon,Mercury,Mondeo,Mustang,Orion,Ranger,Sierra,Telstar,Telstra,Other";//Ford
Series[7] = "11,600,Accord,Adancier,Ascot,City,Civic,CR-V,CRX,Domani,Dunk,HR-V,Inspire,Integra,Jazz,Legend,NSX,Odyssey,Stream,Vigor,Other"; //Honda
Series[8] = "13,Buddy,CAMEO,D-MAX,Dragon Eye,Dragon EYE,Gemini,MU,MU-7,TFR,TROOPER,V-Cross,VERTEX,Other"; //Isuzu
Series[9] = "41,CARENS,CARNIVAL,Grand Sportage,PREGIO,SEPHIA,SORENTO,SPORTAGE,Other"; //KIA
Series[10] = "15,ALTEZZA,ARISTO,ES 300,GS 300,GS 400,IS 200,LS 400,LS430,LX 470 Cygnus,RX300,RX330,Other"; //Lexus
Series[11] = "17,323,626,929,Astina,B2000,B2500,Familia,Fighter,Lantis,Mazda 3,Mazda 6,MX-5,Protege,RX-7,RX-8,Spark,Thunder,Tribute,Other"; //Mazda
Series[12] = "18,C-CLASS,CL-CLASS,CLK-CLASS,E-CLASS,G-CLASS,M-CLASS,S-CLASS,SL-CLASS,SLK-CLASS,SLR-CLASS,V-CLASS,Other";  //Benz
Series[13] = "20,300 GTO,Airtrex,Astron,Champ,Colt,Cedia,Cyclone,Evolution,FTO,G Wagon,Galant,Grandis,Lancer,Pajero,Strada,Triton,Ultima,Other"; //Mitsubishi
Series[14] = "21,180 SX,200 SX,300 ZX,350Z,Big M,Cefiro,Frontier,Maxima,NV,Presea,President,Primera,Pulsar,SD,Sentra,Serena,Skyline,Sunny,Super Saloon,Teana,Terrano,Tiida,Urvan,Vanette,Other";//Nissan
Series[15] = "31,Avanza,Altis,Camry,Carina,Celica,Colona,Corolla,Crown,Estima,Exsior,Fortunner,Innova,Hilux Tiger,Hilux Vigo,Landcruiser,Mighty-X,MR2,MR-S,Previa,Prius,Supra,Soluna,Sport Rider,Vios,Wish,Yaris,Other";//Toyota
Series[16] = "32,Beetle,Caravelle,Golf,Karmann Ghia,Passat,Scirocco,Sharan,Swagen,Transporter,Variant,Varient,Vento,Other";//Volkwagen
Series[17] = "33,144,240,244,264,440,460,740,760,850,940,940 GL,960,C70,Classic Car,S40,S60,S70,S80,S90,V40,V70,XC90,Other";//Volvo

function UpdateSeriesData() {
   document.SearchCar.Series.options.length = 1;

   for (i=0; i<Series.length; i++) {
      if (Series[i].indexOf(",") > -1) {
         SeriesData = Series[i].split(",");
         if (SeriesData[0] == document.SearchCar.BrandID.options[document.SearchCar.BrandID.selectedIndex].value) {

            document.SearchCar.Series.options.length = SeriesData.length;
            for (i=1; i<SeriesData.length; i++) {
               document.SearchCar.Series.options[i].text = SeriesData[i];
               document.SearchCar.Series.options[i].value = "" + SeriesData[i] + "";
            }
            return 0;
         }
      }
   }
   return 0;
}



function UpdateSeries0Data() {
   document.SearchCar0.list0.options.length = 1;
   for (i=0; i<list0.length; i++) {
      if (list0[i].indexOf(",") > -1) {
         Series0Data = list0[i].split(",");
         if (Series0Data[0] == document.SearchCar0.BrandID0.options[document.SearchCar0.BrandID0.selectedIndex].value) {

            document.SearchCar0.list0.options.length = Series0Data.length;
            for (i=1; i<Series0Data.length; i++) {
               document.SearchCar0.Series0.options[i].text = list0Data[i];
               document.SearchCar0.Series0.options[i].value = "" + list0Data[i] + "";
            }
            return 0;
         }
      }
   }
   return 0;
}

//Java popup for show image
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_openBrWindow2(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//For other function
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function Scroller()
{
    window.status = scrollText.substring(scrollCounter++,
                        scrollText.length);
    if (scrollCounter == scrollText.length)
        scrollCounter = 0;
    setTimeout("Scroller()", scrollDelay);
}

function emoticon(what)
{
        document.addboard.detail.value = document.addboard.elements.detail.value+" "+what;
        document.addboard.detail.focus();
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
var ShowImageWin;
features += "dependent=yes,directories=no,location=no,menubar=no,resizable=yes,personalbar=no,scrollbars=no,titlebar=no,toolbar=no,screenX=0,screenY=0,top=120, left=120";
  ShowImageWin = window.open(theURL,"ShowImages",features);
  ShowImageWin.focus();
}

function MM_openBrWindow2(theURL,winName,features) { //v2.0
var ShowImageWin;
features += "dependent=yes,directories=no,location=no,menubar=no,resizable=yes,personalbar=no,scrollbars=no,titlebar=no,toolbar=no,screenX=0,screenY=0,top=0, left=400";
  ShowImageWin = window.open(theURL,"ShowImages2",features);
  ShowImageWin.focus();
}

function ShowImage(strImagePath, intImageWidth, intImageHeight)
{
	var ShowImageWin;
	var strName =  "ShowImages"
	var strFeatures;

	strFeatures = "dependent=yes,directories=no,location=no,menubar=no,resizable=yes,personalbar=no,scrollbars=no,titlebar=no,toolbar=no,screenX=0,screenY=0,top=0, left=0, width=" + intImageWidth.toString() + ", height=" + intImageHeight.toString()
	ShowImageWin = window.open(strImagePath, strName, strFeatures);
	ShowImageWin.focus();

	return false;
}