var divname = "download";

//选择手机平台
function on_platform_change(_divname,productid,platformid){
	divname = _divname;
	if(platformid == "noSelect")
		platformid = "0";
	PpsManagerService.listDownlistById(productid,platformid,showUainfo);
}
//显示相应手机平台下的机型
function showUainfo(data){
	if(divname == "download"){
		DWRUtil.removeAllOptions("type");
		var ele = document.getElementById("type");
		opt = new Option("-Please choose-","noSelect");
	    ele.options.add(opt);
		for (var i = 0; i < data.length; i++){
			  opt = new Option(data[i].uaname,data[i].recid);
			  ele.options.add(opt);
		}
	}else if(divname == "buy"){
		DWRUtil.removeAllOptions("buydiv_type");
		var ele = document.getElementById("buydiv_type");
		opt = new Option("-Please choose-","noSelect");
	    ele.options.add(opt);
		for (var i = 0; i < data.length; i++){
			  opt = new Option(data[i].uaname,data[i].recid);
			  ele.options.add(opt);
		}
	}
}
//点击下载按钮，下载软件
function on_download_click(){
	var id = document.getElementById("type").value;
	if(id != "noSelect"){
		var url = 'download/attachment.jsp?type=1&id=' + id;
		window.location = url;
	}else
		alert("Please select the type!");
}
//点击下载用户使用说明书
function download_menu(){
	var id = document.getElementById("type").value;
	if(id != "noSelect"){
		var url = 'download/attachment.jsp?type=2&id=' + id;
		window.location = url;
	}else
		alert("Please select the type!");
}

//选择购买层的机型将
function buydiv_type_change(value,productid){
	document.getElementById("downlistid_" + productid).value = value;
}

//点击购买按钮
function on_buy_click(){
	var id = document.getElementById("buydiv_type").value;
	if(id != "noSelect"){
		document.getElementById("buyForm").submit();
	}else
		alert("Please select the type!");
}

