// JavaScript Document
var movieName = "mideastmap";

function thisMovie(movieName) {
  // IE and Netscape refer to the movie object differently.
  // This function returns the appropriate syntax depending on the browser.
  if (navigator.appName.indexOf("Microsoft") !=-1) {
       //return window[movieName]
       return document[movieName]
     }	else {
    return document[movieName]
    }
}

// Checks if movie is completely loaded.
// Returns true if yes, false if no.
function movieIsLoaded (theMovie) {
//alert(theMovie);
  if (typeof(theMovie) != "undefined") {
    return theMovie.PercentLoaded() == 100;
  } else {
    return false;
  }
}

function golabel(val) {
  if (movieIsLoaded(thisMovie(movieName))) {
	thisMovie(movieName).SetVariable("dropActive","true");
	thisMovie(movieName).TGotoLabel("_root","begin");
	thisMovie(movieName).TGotoLabel("_level0/"+val,"begin");
	
  }
}

//Javascript to Flash
function getSelectedIndexVal() {

	var myIndex = document.dealer_selector.country_list.selectedIndex;
	switch(myIndex)
	{
	case 1:
	  golabel("hover_bahrain_mc");
	  break  
	    
	case 2:
	  golabel("amman_hover_mc");
	  break
	  
	 case 3:
	  golabel("kuwait_hover_mc");
	  break
	  
	 case 4:
	  golabel("beirut_hover_mc");
	  break
	 
	 case 5:
	  golabel("muscat_hover_mc");
	  break
	 
 	 case 6:
	  golabel("doha_hover_mc");
	  break
	 
	 case 7:
	  golabel("riyadh_hover_mc");
	  break
	  
	 case 8:
	  golabel("abudhabi_hover_mc");
	  break
	  
	 case 9:
	  golabel("nEmirates_hover_mc");
	  break

	default:
	  golabel();
	} 
}

//#######################################################################################

/*

function dropdownlist(listindex,strval) {
	document.frm_selector.dealer_list.options.length = 0;
	
	switch (listindex)
	{
	case "0" :
	document.frm_selector.dealer_list.options[0]=new Option("-- Choose showroom --","0");
	break;
	
	case "Bahrain" :
	document.frm_selector.dealer_list.options[0]=new Option("Al Haddad Motors","1");
	break;
	
	case "Jordan" :
			document.frm_selector.dealer_list.options[0]=new Option("T. Gargour & Fils. Co., PSC","2");
	break;
	
	case "Kuwait" :
		document.frm_selector.dealer_list.options[0]=new Option("Albisher & Alkazemi Co.","3");
	break;
	
	case "Lebanon" :
		document.frm_selector.dealer_list.options[0]=new Option("T. Gargour & Fils SAL","4");
	break;
	
	case "Oman" :
	document.frm_selector.dealer_list.options[0]=new Option("-- Choose showroom --","0");
	document.frm_selector.dealer_list.options[1]=new Option("Muscat - Zawawi Trading Co. L.L.C.","5");
	document.frm_selector.dealer_list.options[2]=new Option("Salalah - Zawawi Trading Co. L.L.C.","6");
	if(strval=="5"){
		document.frm_selector.dealer_list.options[1].selected = true;
	}
	if(strval=="6"){
		document.frm_selector.dealer_list.options[2].selected = true;
	}
	break;
	
	case "Pakistan" :
	document.frm_selector.dealer_list.options[0]=new Option("-- Choose showroom --","0");
	document.frm_selector.dealer_list.options[1]=new Option("Shahnawaz Private Limited.","d1");
	break;
	
	case "Qatar" :
	document.frm_selector.dealer_list.options[0]=new Option("Nasser Bin Khaled Automobiles","7");
	break;
	
	case "KSA" :
	document.frm_selector.dealer_list.options[0]=new Option("-- Choose showroom --","0");
	document.frm_selector.dealer_list.options[1]=new Option("Jeddah - E.A. Juffali Automotive Co.","8");
	document.frm_selector.dealer_list.options[2]=new Option("Riyadh - E.A. Juffali Automotive Co.","9");
	document.frm_selector.dealer_list.options[3]=new Option("Dammam - E.A. Juffali Automotive Co.","10");
	if(strval=="8"){
		document.frm_selector.dealer_list.options[1].selected = true;
	}
	if(strval=="9"){
		document.frm_selector.dealer_list.options[2].selected = true;
	}
	if(strval=="10"){
		document.frm_selector.dealer_list.options[3].selected = true;
	}
	break;
	
	case "Syria" :
	document.frm_selector.dealer_list.options[0]=new Option("Oman Sankar's Sons Co.","d1");
	break;
	
	
	case "Abudhabi" :
	document.frm_selector.dealer_list.options[0]=new Option("-- Choose showroom --","0");
	document.frm_selector.dealer_list.options[1]=new Option("Old Airport road - Emirates Motor Co.","11");
	document.frm_selector.dealer_list.options[2]=new Option("Marina Mall - Emirates Motor Co.","12");
	
	if(strval=="11"){
		document.frm_selector.dealer_list.options[1].selected = true;
	}
	if(strval=="12"){
		document.frm_selector.dealer_list.options[2].selected = true;
	}
	
	break;
	
	case "Dubai" :
	document.frm_selector.dealer_list.options[0]=new Option("-- Choose showroom --","0");
	document.frm_selector.dealer_list.options[1]=new Option("Deira - Gargash Enterprises","13");
	document.frm_selector.dealer_list.options[2]=new Option("Shk. Zayed Road - Gargash Enterprises","14");
	document.frm_selector.dealer_list.options[3]=new Option("Burjuman Center - Gargash Enterprises","15");
	document.frm_selector.dealer_list.options[4]=new Option("Sharjah - Gargash Enterprises","16");
	document.frm_selector.dealer_list.options[5]=new Option("Fujairah - Gargash Enterprises","17");
	document.frm_selector.dealer_list.options[6]=new Option("Ras Al Khaimah - Gargash Enterprises","18");
	
	if(strval=="13"){
		document.frm_selector.dealer_list.options[1].selected = true;
	}
	if(strval=="14"){
		document.frm_selector.dealer_list.options[2].selected = true;
	}
	if(strval=="15"){
		document.frm_selector.dealer_list.options[3].selected = true;
	}
	if(strval=="16"){
		document.frm_selector.dealer_list.options[4].selected = true;
	}
	if(strval=="17"){
		document.frm_selector.dealer_list.options[5].selected = true;
	}
	if(strval=="18"){
		document.frm_selector.dealer_list.options[6].selected = true;
	}
	break;
	
	case "Yemen" :
	document.frm_selector.dealer_list.options[0]=new Option("United Engineering Automobile","d1");
	break;
	}
	return true;
}
*/
//#######################################################################################


//Flash to Javascript

var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;

function mideastmap_DoFSCommand(command, args) {
//function testcommand(command, args) {
	var mideastmapObj = isInternetExplorer ? document.all.mideastmap : document.mideastmap;
	if (command == "togglecountry") { 
		//alert (args);
		switch (args)
		{
		case "" :
		document.frm_seledropdownlist();
		break;
		
		case "Bahrain" :
		document.frm_selector.country_list.options[1].selected = true;
		dropdownlist (args);
		break;
		
		case "Jordan" :
		document.frm_selector.country_list.options[2].selected = true;
		dropdownlist (args);
		break;
		
		case "Kuwait" :
		document.frm_selector.country_list.options[3].selected = true;
		dropdownlist (args);
		break;
		
		case "Lebanon" :
		document.frm_selector.country_list.options[4].selected = true;
		dropdownlist (args);
		break;
		
		case "Oman" :
		document.frm_selector.country_list.options[5].selected = true;
		dropdownlist (args);
		break;
		
		case "Qatar" :
		document.frm_selector.country_list.options[6].selected = true;
		dropdownlist (args);
		break;
		
		case "KSA" :
		document.frm_selector.country_list.options[7].selected = true;
		dropdownlist (args);
		break;
		
		case "Abudhabi" :
		document.frm_selector.country_list.options[8].selected = true;
		dropdownlist (args);
		break;
		
		case "Dubai" :
		document.frm_selector.country_list.options[9].selected = true;
		dropdownlist (args);
		break;
		
		}
		return true;
	}
}
// Hook for Internet Explorer.
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<script language=\"VBScript\"\>\n');
	document.write('On Error Resume Next\n');
	document.write('Sub mideastmap_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call mideastmap_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</script\>\n');
}
