// JavaScript Document

var countries=new Array();

countries[0]=new Array();
countries[0]['country']='-----ALL-----';
countries[0]['cities']=['-----ALL-----'];
countries[1]=new Array();
countries[1]['country']='Explore';
countries[1]['cities']=['X2','X1'];
countries[2]=new Array();
countries[2]['country']='Basic';
countries[2]['cities']=['B3185','B3180','B3180N','B2148N','B2145N','B2143N','B3161','B3150','B2180N','B2186N','B2186','B2185N','B2185','B2188','B2150','B2165','B2165N','B2161N'];
countries[3]=new Array();
countries[3]['country']='Vivid';
countries[3]['cities']=['V3163','V3153','V1193','V1103','V3150','V3161','V1190','V1100','V2128','V2121','V2130','V2120'];
countries[4]=new Array();
countries[4]['country']='Elan';
countries[4]['cities']=['L3105','L3103','L3100','L3101','L2110','L2111'];
countries[5]=new Array();
countries[5]['country']='Tablet';
countries[5]['cities']=['T2100'];
// End -->



function initBoxes(box1,box2) {
var country=document.getElementById(box1);
var city=document.getElementById(box2);
for (i=0; i<countries.length; i++) {
  var x=document.createElement('option');
  var y=document.createTextNode(countries[i]['country']);
  if (window.attachEvent) { // for IE
  x.setAttribute('value',y.nodeValue);
  }
  x.appendChild(y);
  country.appendChild(x);
}

country.onchange=function() {
  if(this.value!="") {
   var list=document.getElementById(box2);
   while (list.childNodes[0]) {
    list.removeChild(list.childNodes[0])
   }
   fillBox2(city,this.value);
   }
  }

fillBox2(city,country.value);
}

function fillBox2(box2,country) {
for (i=0; i<countries.length; i++) {
  if (countries[i]['country']==country) {
   var cities=countries[i]['cities'];
  }
}
for (i=0; i<cities.length; i++) {
  var x=document.createElement('option');
  var y=document.createTextNode(cities[i]);
  x.appendChild(y);
  box2.appendChild(x);
  }
} 

window.onload=function() {initBoxes('country','city');}

//end

function getParams() {
var idx = document.URL.indexOf('?');
var params = new Array();
if (idx != -1) {
var pairs = document.URL.substring(idx+1, document.URL.length).split('&');
for (var i=0; i<pairs.length; i++) {
nameVal = pairs[i].split('=');
params[nameVal[0]] = nameVal[1];
   }
}
return params;
}
params = getParams();
//  End -->

/*function test(){
if ((document.ToolBox.country.value=='Explore') && (document.ToolBox.city.value=='X1')){
window.location.href = "default_mae.aspx";
}else {
alert('test');
return true;
}
}
*/
//function test(){
//switch(document.ToolBox.country.value){
//case "Explore": 
//switch(document.ToolBox.city.value){
//case "X1": 
//alert('test');
//break;
//}
//break;
//}
//}