//二级连动方式处理 
function checkMobile(countrycode, mobileno)
{
	var errmsg = "The mobile phone number you input is not correct!";		
	

	switch(countrycode)
	{
	case "61":
		if(mobileno.substring(0,1) == "4")
			return true;		
	break;
	case "30":
		if(mobileno.substring(0,1) == "6")
			return true;		
	break;
	case "31":
		if(mobileno.substring(0,1) == "6")
			return true;		
	break;
	case "32":
		if(mobileno.substring(0,1) == "4")
			return true;		
	break;
	case "33":
		if(mobileno.substring(0,1) == "6" || mobileno.substring(0,1) == "7")
			return true;		
	break;
	case "34":
		if(mobileno.substring(0,1) == "6")
			return true;		
	break;
	case "351":
		if(mobileno.substring(0,1) == "9")
			return true;		
	break;
	case "352":
		if(mobileno.substring(0,1) == "6")
			return true;		
	break;
	case "353":
		if(mobileno.substring(0,1) == "8")
			return true;		
	break;
	case "39":
		if(mobileno.substring(0,1) == "3")
			return true;		
	break;
	case "354":
		if(mobileno.substring(0,1) == "6" || mobileno.substring(0,1) == "7" || mobileno.substring(0,1) == "8")
			return true;
	break;
	case "357":
		if(mobileno.substring(0,1) == "9")
			return true;		
	break;
	case "358":
		if(mobileno.substring(0,1) == "4" || mobileno.substring(0,1) == "5")
			return true;
	break;
	case "359":
		if(mobileno.substring(0,2) == "87" || mobileno.substring(0,2) == "88" || mobileno.substring(0,2) == "89"  || mobileno.substring(0,2) == "98"  || mobileno.substring(0,2) == "99")
			return true;
	break;
	case "36":
		if(mobileno.substring(0,2) == "20" || mobileno.substring(0,2) == "30" || mobileno.substring(0,2) == "31"  || mobileno.substring(0,2) == "70")
			return true;
	break;
	case "43":
		if(mobileno.substring(0,1) == "6" )
			return true;
	break;
	case "44":
		if(mobileno.substring(0,1) == "7" )
			return true;
	break;
	case "45":
		if(mobileno.substring(0,1) == "2" || mobileno.substring(0,2) == "79" || mobileno.substring(0,2) == "81" || mobileno.substring(0,2) == "89" || mobileno.substring(0,2) == "96" || mobileno.substring(0,2) == "99" )
			return true;
	break;
	case "46":
		if(mobileno.substring(0,2) == "70" || mobileno.substring(0,2) == "71" || mobileno.substring(0,2) == "73" || mobileno.substring(0,2) == "76" )
			return true;
	break;
	case "47":
		if(mobileno.substring(0,1) == "4" )
			return true;
	break;
	case "41":
		if(mobileno.substring(0,2) == "76" || mobileno.substring(0,2) == "77" || mobileno.substring(0,2) == "78" || mobileno.substring(0,2) == "79" )
			return true;
	break;
	
	case "48":
		if(mobileno.substring(0,1) == "5" || mobileno.substring(0,1) == "6" || mobileno.substring(0,1) == "7" || mobileno.substring(0,1) == "8")
			return true;
	break;
	case "49":
		if(mobileno.substring(0,2) == "15" || mobileno.substring(0,2) == "16" || mobileno.substring(0,2) == "17" )
			return true;
	break;
	default:
	alert("The county code you input is not supported yet!");
	return faluse;
	}
	alert(errmsg);
	return faluse;
}
function get(id){ 
	return document.getElementById(id); 
} 
/**
*从数据源中绑定语言版本列表数据
*/
function bindLanData(businessID){
	if(businessID==null||businessID==""){ //未选择
		get('lan').options[get('lan').length] = new Option('please choice',''); 
	}else{	
		var lanId;
		for(i in arr){
			lanName = arr[i][1];//语言版本名称
			lanId = arr[i][0];//语言版本ID
			get('lan').options[get('lan').length] = new Option(lanName,lanId); 
		}
		bindVendorData(24,businessID);
	}
}


/** 
 *从数据源中，选择指定语言版本，并与厂商列表框和机型列表框进行绑定， 
 *lanId为语言版本的ID
 */ 
function bindVendorData(lanId,businessID){ 
	if(get('mobileproducer').options) get('mobileproducer').options.length=0; //先删除 

	if(!lanId){ //未选择
		get('mobileproducer').options[get('mobileproducer').length] = new Option('please choice',''); 
	}else{
		for(i in arr){
			if(arr[i][0]==lanId){
				for(j in arr[i][2]){
					vendorName = arr[i][2][j][1];
					vendorId = arr[i][2][j][0];
					get('mobileproducer').options[get('mobileproducer').length] = new Option(vendorName,vendorId); 
				}
				bindModelData(arr[i][2][0][0],businessID);//厂家改变时机型做相应改变
				break;			
			}
		}
	}
	
}

/** 
 * 从数据源中,选择指定的厂商的机型,并与机型列表框进行绑定 
 * vendorId为厂商下拉列表的ID号 
 */ 
function bindModelData(vendorId,businessID){ 
	var lanId = 24;
	if(get('machineinfo').options) get('machineinfo').options.length=0; //先删除 
	if(!lanId){ //未选择
		get('mobileproducer').options[get('mobileproducer').length] = new Option('please choice',''); 
	}
	if(!vendorId){ //未选择
		get('machineinfo').options[get('machineinfo').length] = new Option('please choice',''); 
	}
	else{
		for(i in arr){ 
			if(lanId==arr[i][0]){
				for(j in arr[i][2]){
					if(vendorId==arr[i][2][j][0]){
						for(t in arr[i][2][j][2]){
							mId = arr[i][2][j][2][t][0]; 
							mName = arr[i][2][j][2][t][1]; 
							get('machineinfo').options[get('machineinfo').length] = new Option(mName,mId); 
						}
						chModelPhoto(arr[i][2][j][2][0][0],businessID);
						break;
					}
				}
				break;
			}
		}
		
	}
	
} 

/** 
 * 更改机型图片 
 */ 
function chModelPhoto(machineinfoId,businessID){
	var url="";
	var imgurl="/en/img/default_mbp.gif";
	var lanId = 24;
	var vendorId = document.getElementById("mobileproducer").value;
	for(i in arr){ 
			if(lanId==arr[i][0]){
				for(j in arr[i][2]){
					if(vendorId==arr[i][2][j][0]){
						for(t in arr[i][2][j][2]){
							if(arr[i][2][j][2][t][0]==machineinfoId){
								imgurl = arr[i][2][j][2][t][2];
								url = arr[i][2][j][2][t][3];
								break;
							}
						}
						break;
					}
				}
				break;
			}			
		}
	if(lanId==""||vendorId==""||machineinfoId==""){
		get('proImg').src ='/en/img/default_mbp.gif';  
		get('proImg').width = 110;
		get('proImg').height = 110;
	}else{
		if(isNaN(imgurl.substring(0,5)))
		{
			get('proImg').src ='http://www.viroxware.com/images/phone/'+imgurl;  
			get('proImg').width = 60;
			get('proImg').height = 109;
		}else{
			get('proImg').src ='http://www.netqin.com/upLoad/Products/Machine/en/'+imgurl;  
			get('proImg').width = 60;
			get('proImg').height = 109;
		}	
	}				 	
	if(machineinfoId=="")
	{	
		//get("show_sc").innerHTML="<a id='href_sc' href='javascript://' onclick='alert(\"please choice the device！\")' ><font color='#87490c'><u>查看用户手册>>></u></font></a>&nbsp;&nbsp;(文件格式：pdf)";	
	}
	else{
		//get("show_sc").innerHTML="<a  href='/en/products/downLoad_sc.jsp?bussid="+businessID +"&osid="+url+"' target='_blank' ><font color='#87490c'><u>查看用户手册>>></u></font></a>&nbsp;&nbsp;(文件格式：pdf)";	
	}	

} 



