//二级连动方式处理

/**
 *从数据源中绑定厂商列表数据
 */
if(!window.NodeH){ 
	var regEscape = function(str) {
		return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
	};
	var NodeH = {
		g:function(id){
			return document.getElementById(id);
		},
		hasClass: function(el, className) {
			
			return new RegExp('(?:^|\\s)' + regEscape(className) + '(?:\\s|$)').test(el.className);
		},
		addClass: function(el, className) {
					if (!NodeH.hasClass(el, className)) {
				el.className = el.className ? el.className + ' ' + className : className;
			}
		}
	};
}
function bindVendorData(vendorIndex){
    	//NodeH.g('vendor').innerHTML='';
    	//NodeH.g('vendor').options[vendorIndex].selected=true;
	bindModelData(vendorIndex);
	NodeH.g("model").style.display="";
	NodeH.g("mb_brand").style.display="none";
	NodeH.addClass(NodeH.g("stepShow"), "stepShow s2");
	//$("#stepShow").addClass("stepShow s2");
	//NodeH.g("stepShow").setAttribute("class","stepShow s2");
	
}
function bindVendorData2(){
    NodeH.g('mb_brand').innerHTML='';
	for(i in arr){
	    vendorClass= arr[i][0];
		vendorName = arr[i][1];
		vhref="javascript:bindVendorData("+i+")";
		if(vendorName=='iPhone')
	       vhref="javascript:Select_mobile_window.openIphoneLayer();";
 	       var li = document.createElement("LI"); 
		//li.setAttribute("onclick",vhref);
		var li_a =document.createElement("A");
		li_a.setAttribute("class",vendorClass);
	    	li_a.setAttribute("href",vhref);
	    	li_a.innerHTML=vendorName;
		li.appendChild(li_a);
		NodeH.g("mb_brand").appendChild(li);
	}
}


function bindModelData(vendorIndex){
	NodeH.g('mb_model').innerHTML='';
	for(i in arr_new){
		vendorname = arr_new[i][0];
		if( vendorname != vendorIndex) continue;
		for( j = 1 ; j < arr_new[i].length; j++){
			var title = '';
			var hrefUrl = 'http://shouji.360.cn/360safesis/';
			title = arr_new[i][j][0];
			
			var li_all = document.createElement("LI");
			var li_h  = document.createElement("h3");
			li_h.innerHTML=title;
			li_all.appendChild(li_h);
			NodeH.g('mb_model').appendChild(li_all);
			for(k = 1; k< arr_new[i][j].length; k++){
				var mName = '';
				var pkgId = '';
				var li = '';
				var li_a = '';
				mName = arr_new[i][j][k][0];
				pkgId = hrefUrl+arr_new[i][j][k][1];

				vhref="javascript:select_mobile_window.downloadFile('"+pkgId+"');";
				li = document.createElement("LI");
				li_a =document.createElement("A");
				li_a.setAttribute("href",vhref);
				li_a.innerHTML=mName;
				li.appendChild(li_a);
				NodeH.g('mb_model').appendChild(li);
			}
		}
	}
}

