document.writeln("<meta http-equiv=\"x-ua-compatible\" content=\"ie=7\" \/>")
function smanprepaiList(prepaiList,objInputId){
	this.style = "background:#E8F7EB;border: 1px solid #CCCCCC;font-size:12px;cursor: default;line-height:22px;padding-left:5px;width:270px;z-index:3;"
	if (prepaiList.constructor!=Array){
		alert('smanPromptList初始化失败:第一个参数非数组!');
		return ;
	}
	// onload 事件会在页面或图像加载完成后立即发生
	window.onload = function(){
	// sort() 方法用于对数组的元素进行排序
		prepaiList.sort(function(a,b){
			if(a.length > b.length)
				return 1;
			else if(a.length == b.length)
             	return a.localeCompare(b); // stringObject.localeCompare(target)用本地特定的顺序来比较两个字符串。
             else 
             	return -1;
		})
		
		var objproducttype = document.getElementById("producttype")      // 获取下拉框
		var objouter = document.getElementById("__smanDisp")             // 获取弹出的DIV
		var objInput = document.getElementById(objInputId);              // 获取文本框
		var selectedIndex = -1;
		var intTmp;
		// 未找到文本框
		if (objInput==null) {
			return;
		}
		// 当鼠标从文本框离开的时候就发生事件（文本框失去焦点）
		objInput.onblur=function(){
			objouter.style.display='none';
		}
		// 当鼠标点击的时候就发生事件（文本框失去焦点）
		window.onfocus=function(){
			objouter.style.display='none';
		}	
		//文本框按键抬起
		objInput.onkeyup=checkKeyCode;
		//文本框得到焦点
		objInput.onfocus=checkAndShow;
		
		function checkKeyCode(){
			var ie = (document.all)?true:false;
			if (ie){
				var keyCode=event.keyCode;
				// keyCode==40 上键，keyCode==38 下键
				if (keyCode==40||keyCode==38){
					var isUp=false;
					if(keyCode==40) 
						isUp=true;
					chageSelection(isUp);
				// keyCode==13 enter键
				}else if (keyCode==13){
					outSelection(selectedIndex);
				}else{
					  checkAndShow();
				}
			}else{
				checkAndShow();
			}
			divPosition();
		}
		function checkAndShow(){
			var producttype = objproducttype.value;
			var strInput = objInput.value;
			var typeList;
			if(strInput=="按[关键词]或[首拼音字母]检索" || strInput == ""){
				strInput = "";
				objouter.innerHTML ="";
			 	objouter.style.display='none';
			}
			if(strInput != "" && prepaiList.length > 0){
				objouter.innerHTML ="";
				divPosition();
				selectedIndex=-1;
				// 下拉框中未选择分类
				if("0" == producttype){
					for (intTmp=0;intTmp<prepaiList.length;intTmp++){
						if(strInput.length == 1){
							var arr = prepaiList[intTmp].split("&");
							if (arr[3].substr(0,1).toUpperCase() == strInput.toUpperCase() ||
								arr[4].substr(0,1).toUpperCase() == strInput.toUpperCase()){						
								addOption(arr[4],strInput,0);
							}
						}else{
							var arr = prepaiList[intTmp].split("&");
							if (arr[3].toUpperCase().indexOf(strInput.toUpperCase())>=0){
								addOption(arr[4],strInput,arr[3].toUpperCase().indexOf(strInput.toUpperCase()));
							}else if(arr[4].toUpperCase().indexOf(strInput.toUpperCase())>=0 ){
								addOption(arr[4],strInput,arr[4].toUpperCase().indexOf(strInput.toUpperCase()));
							}
						}
					}
				}else {
					// 游戏直充 00020001,00020002,00020003,00020004
					if("1" == producttype){
						if(strInput.length == 1){
							for (intTmp=0;intTmp<prepaiList.length;intTmp++){
								var ppList = prepaiList[intTmp].split("&");
								if(ppList[2].toUpperCase() == "00020001" ||
								   ppList[2].toUpperCase() == "00020002" ||
								   ppList[2].toUpperCase() == "00020003" ||
								   ppList[2].toUpperCase() == "00020004" ){
								   if (ppList[3].substr(0,1).toUpperCase() == strInput.toUpperCase() ||
										ppList[4].substr(0,1).toUpperCase() == strInput.toUpperCase()){
										addOption(ppList[4],strInput,0);
									}		
								}
							}
						}else{
								for (intTmp=0;intTmp<prepaiList.length;intTmp++){
								var ppList = prepaiList[intTmp].split("&");
								if(ppList[2].toUpperCase() == "00020001" ||
								   ppList[2].toUpperCase() == "00020002" ||
								   ppList[2].toUpperCase() == "00020003" ||
								   ppList[2].toUpperCase() == "00020004" ){
								   if (ppList[3].toUpperCase().indexOf(strInput.toUpperCase())>=0){
										addOption(ppList[4],strInput,ppList[3].toUpperCase().indexOf(strInput.toUpperCase()));
								   }else if(ppList[4].toUpperCase().indexOf(strInput.toUpperCase())>=0 ){
										addOption(ppList[4],strInput,ppList[4].toUpperCase().indexOf(strInput.toUpperCase()));
								   }
								}
							}
						}
					}
					// 游戏卡密 00020008
					else if("2" == producttype){
						if(strInput.length == 1){
							for (intTmp=0;intTmp<prepaiList.length;intTmp++){
								var ppList = prepaiList[intTmp].split("&");
								if(ppList[2].toUpperCase() == "00020008" ){
								   if (ppList[3].substr(0,1).toUpperCase() == strInput.toUpperCase() ||
										ppList[4].substr(0,1).toUpperCase() == strInput.toUpperCase()){
										addOption(ppList[4],strInput,0);
									}		
								}
							}
						}else{
								for (intTmp=0;intTmp<prepaiList.length;intTmp++){
								var ppList = prepaiList[intTmp].split("&");
								if(ppList[2].toUpperCase() == "00020008" ){
								   if (ppList[3].toUpperCase().indexOf(strInput.toUpperCase())>=0){
										addOption(ppList[4],strInput,ppList[3].toUpperCase().indexOf(strInput.toUpperCase()));
								   }else if(ppList[4].toUpperCase().indexOf(strInput.toUpperCase())>=0 ){
										addOption(ppList[4],strInput,ppList[4].toUpperCase().indexOf(strInput.toUpperCase()));
								   }
								}
							}
						}
					// 电子杂志 ppList[0]以 '37'开头， ppList[1] = 0005
					}else if("3" == producttype){
						if(strInput.length == 1){
							for (intTmp=0;intTmp<prepaiList.length;intTmp++){
								var ppList = prepaiList[intTmp].split("&");
								if("37" == ppList[0].toUpperCase().substring(0, 2)){
									if(ppList[1].toUpperCase() == "0005"){
										if (ppList[3].toUpperCase().indexOf(strInput.toUpperCase())>=0){
											addOption(ppList[4],strInput,ppList[3].toUpperCase().indexOf(strInput.toUpperCase()));
									    }else if(ppList[4].toUpperCase().indexOf(strInput.toUpperCase())>=0 ){
											addOption(ppList[4],strInput,ppList[4].toUpperCase().indexOf(strInput.toUpperCase()));
									    }
									}
								}
							}
						}else{
							for (intTmp=0;intTmp<prepaiList.length;intTmp++){
								var ppList = prepaiList[intTmp].split("&");
								if("37" == ppList[0].toUpperCase().substring(0, 2)){
									if(ppList[1].toUpperCase() == "0005"){
										if (ppList[3].toUpperCase().indexOf(strInput.toUpperCase())>=0){
											addOption(ppList[4],strInput,ppList[3].toUpperCase().indexOf(strInput.toUpperCase()));
								   		}else if(ppList[4].toUpperCase().indexOf(strInput.toUpperCase())>=0 ){
											addOption(ppList[4],strInput,ppList[4].toUpperCase().indexOf(strInput.toUpperCase()));
								   		}
									}
								}
							}
						}
					// 软件产品 ppList[0]不以 '37'开头， ppList[1] = 0005 
					}else if("4" == producttype){
						if(strInput.length == 1){
							for (intTmp=0;intTmp<prepaiList.length;intTmp++){
								var ppList = prepaiList[intTmp].split("&");
								if("37" != ppList[0].toUpperCase().substring(0, 2)){
									if(ppList[1].toUpperCase() == "0005"){
										if (ppList[3].toUpperCase().indexOf(strInput.toUpperCase())>=0){
											addOption(ppList[4],strInput,ppList[3].toUpperCase().indexOf(strInput.toUpperCase()));
									    }else if(ppList[4].toUpperCase().indexOf(strInput.toUpperCase())>=0 ){
											addOption(ppList[4],strInput,ppList[4].toUpperCase().indexOf(strInput.toUpperCase()));
									    }
									}
								}
							}
						}else{
							for (intTmp=0;intTmp<prepaiList.length;intTmp++){
								var ppList = prepaiList[intTmp].split("&");
								if("37" != ppList[0].toUpperCase().substring(0, 2)){
									if(ppList[1].toUpperCase() == "0005"){
										if (ppList[3].toUpperCase().indexOf(strInput.toUpperCase())>=0){
											addOption(ppList[4],strInput,ppList[3].toUpperCase().indexOf(strInput.toUpperCase()));
								   		}else if(ppList[4].toUpperCase().indexOf(strInput.toUpperCase())>=0 ){
											addOption(ppList[4],strInput,ppList[4].toUpperCase().indexOf(strInput.toUpperCase()));
								   		}
									}
								}
							}
						}
					}
					// 金币/彩票 00040005,00020005
					else if("5" == producttype){
						if(strInput.length == 1){
							for (intTmp=0;intTmp<prepaiList.length;intTmp++){
								var ppList = prepaiList[intTmp].split("&");
								if(ppList[2].toUpperCase() == "00040005" ||
								   ppList[2].toUpperCase() == "00020005" ){
								   if (ppList[3].substr(0,1).toUpperCase() == strInput.toUpperCase() ||
										ppList[4].substr(0,1).toUpperCase() == strInput.toUpperCase()){
										addOption(ppList[4],strInput,0);
									}		
								}
							}
						}else{
								for (intTmp=0;intTmp<prepaiList.length;intTmp++){
								var ppList = prepaiList[intTmp].split("&");
								if(ppList[2].toUpperCase() == "00040005" ||
								   ppList[2].toUpperCase() == "00020005" ){
								   if (ppList[3].toUpperCase().indexOf(strInput.toUpperCase())>=0){
										addOption(ppList[4],strInput,ppList[3].toUpperCase().indexOf(strInput.toUpperCase()));
								   }else if(ppList[4].toUpperCase().indexOf(strInput.toUpperCase())>=0 ){
										addOption(ppList[4],strInput,ppList[4].toUpperCase().indexOf(strInput.toUpperCase()));
								   }
								}
							}
						}
					}
					// 话费直充 00010001,00010002,00010003,00010004,00010005,00010006	
					else if("6" == producttype){
						if(strInput.length == 1){
							for (intTmp=0;intTmp<prepaiList.length;intTmp++){
								var ppList = prepaiList[intTmp].split("&");
								if(ppList[2].toUpperCase() == "00010001" ||
								   ppList[2].toUpperCase() == "00010002" ||
								   ppList[2].toUpperCase() == "00010003" ||
								   ppList[2].toUpperCase() == "00010004" ||
								   ppList[2].toUpperCase() == "00010005" ||
								   ppList[2].toUpperCase() == "00010006" ){
								   if (ppList[3].substr(0,1).toUpperCase() == strInput.toUpperCase() ||
										ppList[4].substr(0,1).toUpperCase() == strInput.toUpperCase()){
										addOption(ppList[4],strInput,0);
									}		
								}
							}
						}else{
								for (intTmp=0;intTmp<prepaiList.length;intTmp++){
								var ppList = prepaiList[intTmp].split("&");
								if(ppList[2].toUpperCase() == "00010001" ||
								   ppList[2].toUpperCase() == "00010002" ||
								   ppList[2].toUpperCase() == "00010003" ||
								   ppList[2].toUpperCase() == "00010004" ||
								   ppList[2].toUpperCase() == "00010005" ||
								   ppList[2].toUpperCase() == "00010006" ){
								   if (ppList[3].toUpperCase().indexOf(strInput.toUpperCase())>=0){
										addOption(ppList[4],strInput,ppList[3].toUpperCase().indexOf(strInput.toUpperCase()));
								   }else if(ppList[4].toUpperCase().indexOf(strInput.toUpperCase())>=0 ){
										addOption(ppList[4],strInput,ppList[4].toUpperCase().indexOf(strInput.toUpperCase()));
								   }
								}
							}
						}
					}
					// 话费卡密 00010007
					else if("7" == producttype){
						if(strInput.length == 1){
							for (intTmp=0;intTmp<prepaiList.length;intTmp++){
								var ppList = prepaiList[intTmp].split("&");
								if(ppList[2].toUpperCase() == "00010007" ){
								   if (ppList[3].substr(0,1).toUpperCase() == strInput.toUpperCase() ||
										ppList[4].substr(0,1).toUpperCase() == strInput.toUpperCase()){
										addOption(ppList[4],strInput,0);
									}		
								}
							}
						}else{
								for (intTmp=0;intTmp<prepaiList.length;intTmp++){
								var ppList = prepaiList[intTmp].split("&");
								if(ppList[2].toUpperCase() == "00010007" ){
								   if (ppList[3].toUpperCase().indexOf(strInput.toUpperCase())>=0){
										addOption(ppList[4],strInput,ppList[3].toUpperCase().indexOf(strInput.toUpperCase()));
								   }else if(ppList[4].toUpperCase().indexOf(strInput.toUpperCase())>=0 ){
										addOption(ppList[4],strInput,ppList[4].toUpperCase().indexOf(strInput.toUpperCase()));
								   }
								}
							}
						}
					}
					// 缴费支付 00040001,00040002,00040003,00040008,00030001,00030002,00030003,00030004
					else if("8" == producttype){
						if(strInput.length == 1){
							for (intTmp=0;intTmp<prepaiList.length;intTmp++){
								var ppList = prepaiList[intTmp].split("&");
								if(ppList[2].toUpperCase() == "00040001" ||
								   ppList[2].toUpperCase() == "00040002" ||
								   ppList[2].toUpperCase() == "00040003" ||
								   ppList[2].toUpperCase() == "00040008" ||
								   ppList[2].toUpperCase() == "00030001" ||
								   ppList[2].toUpperCase() == "00030002" ||
								   ppList[2].toUpperCase() == "00030003" ||
								   ppList[2].toUpperCase() == "00030004" ){
								   if (ppList[3].substr(0,1).toUpperCase() == strInput.toUpperCase() ||
										ppList[4].substr(0,1).toUpperCase() == strInput.toUpperCase()){
										addOption(ppList[4],strInput,0);
									}		
								}
							}
						}else{
								for (intTmp=0;intTmp<prepaiList.length;intTmp++){
								var ppList = prepaiList[intTmp].split("&");
								if(ppList[2].toUpperCase() == "00040001" ||
								   ppList[2].toUpperCase() == "00040002" ||
								   ppList[2].toUpperCase() == "00040003" ||
								   ppList[2].toUpperCase() == "00040008" ||
								   ppList[2].toUpperCase() == "00030001" ||
								   ppList[2].toUpperCase() == "00030002" ||
								   ppList[2].toUpperCase() == "00030003" ||
								   ppList[2].toUpperCase() == "00030004" ){
								   if (ppList[3].toUpperCase().indexOf(strInput.toUpperCase())>=0){
										addOption(ppList[4],strInput,ppList[3].toUpperCase().indexOf(strInput.toUpperCase()));
								   }else if(ppList[4].toUpperCase().indexOf(strInput.toUpperCase())>=0 ){
										addOption(ppList[4],strInput,ppList[4].toUpperCase().indexOf(strInput.toUpperCase()));
								   }
								}
							}
						}
					}
				}
				objouter.style.display='';
			}
			function addOption(value,keyw,index){
//				var maxlen = objouter.children.length-1;
				var maxlen = objouter.getElementsByTagName("div").length-1
				if(value.indexOf("nbsp")>=0){
					return;
				}
				if (maxlen>=0){
					for (var k=0;k<=maxlen;k++){
						var nowCard = objouter.getElementsByTagName("div")[k].innerHTML;
						nowCard = nowCard.replace("<b><font color=\"red\">","").replace("</font></b>","");
						nowCard = nowCard.replace("<B><FONT color=red>","").replace("</FONT></B>","");
						if (nowCard == value){						
						  return;
						}
					}
				}
				if(maxlen>30) return;
				var v=value.replace(value.substr(index, keyw.length),"<b><font color=red>"+value.substr(index, keyw.length)+"</font></b>");				
				objouter.innerHTML +="<div align=\"left\" onmouseover=\"this.className='sman_selectedStyle'\" onmouseout=\"this.className=''\" onmousedown=\"document.getElementById('"+objInputId+"').value='" + value + "';window.focus();\" value='"+value+"'>" + v + "</div>"; 
			}
		}
		function chageSelection(isUp){
		if (objouter.style.display=='none'){
			objouter.style.display='';
		}else{
			if (isUp)
			  selectedIndex++;
			else
			  selectedIndex--;
		}
			var maxIndex = objouter.children.length-1;
			if (selectedIndex<0) selectedIndex=0;
			if (selectedIndex>maxIndex) selectedIndex=maxIndex;
			for (intTmp=0;intTmp<=maxIndex;intTmp++){

				if (intTmp==selectedIndex){
				  objouter.children[intTmp].className="sman_selectedStyle";
				  objInput.value = objouter.children[intTmp].value;
				}else{
				  objouter.children[intTmp].className="";
				}
			}
		}

		function outSelection(Index){
			if(!objouter.children[Index])return;
			objInput.value = objouter.children[Index].innerText;
			objouter.style.display='none';
		}		
		function divPosition(){
			objouter.style.top =getAbsoluteHeight(objInput)+getAbsoluteTop(objInput);
			objouter.style.left =getAbsoluteLeft(objInput); 
			objouter.style.width=getAbsoluteWidth(objInput);
		}
		function outSelection(Index){
			if(!objouter.children[Index])return;
			objInput.value = objouter.children[Index].innerText;
			objouter.style.display='none';
		}
	}

document.writeln("<!--[if ie 8]><div id='__smanDisp' style='position:absolute;display:none;margin-top:3px;margin-left:3px;" + this.style + "' onbulr> </div><![endif]-->")

	document.write("<div id='__smanDisp' style='position:absolute;display:none;margin-top:86px;*margin-top:3px;_margin-top:3px;margin-left:750px;*margin-left:0;_margin-left:-10px;" + this.style + "' onbulr> </div>");
	document.write("<style>.sman_selectedStyle{background-Color:#102681;color:#FFFFFF;}</style>");
	function getAbsoluteHeight(ob){
		return ob.offsetHeight;
	}
	function getAbsoluteWidth(ob){
		return ob.offsetWidth;
	}
	function getAbsoluteLeft(ob){
		var s_el=0;el=ob;
		while(el){
			s_el=s_el+el.offsetLeft;
			el=el.offsetParent;
		}
		return s_el;
	}

	function getAbsoluteTop(ob){
		var s_el=0;el=ob;
		while(el){
			s_el=s_el+el.offsetTop;
			el=el.offsetParent;
		}
		return s_el;
	}
	
	function getAbsoluteTop(ob){
		var s_el=0;el=ob;
		while(el){
			s_el=s_el+el.offsetTop;
			el=el.offsetParent;
		}
		return s_el;
	}
}
smanprepaiList(prepaiList,"cardname");

function producttypes(producttype){
	var typeList = new Array();
	if(prepaiList.length > 0){
		for (intTmp=0;intTmp<prepaiList.length;intTmp++){
			var ppList = prepaiList[intTmp].split("&");
			// 游戏直充 00020001,00020002,00020003,00020004
			if("1" == producttype){
				if(ppList[2].toUpperCase() == "00020001" ||
				   ppList[2].toUpperCase() == "00020002" ||
				   ppList[2].toUpperCase() == "00020003" ||
				   ppList[2].toUpperCase() == "00020004" ){
				   // typeList.push(ppList[3]+"&"+ppList[4]+";");
				   typeList[intTmp++] = ppList[3]+"&"+ppList[4]+";";
				}
			// 游戏卡密 00020008
			}else if("2" == producttype){
				if(ppList[2].toUpperCase() == "00020008" ){
				   typeList = ppList[3]+"&"+ppList[4];
				}
			}else if("3" == producttype){
				
			}else if("4" == producttype){
				
			// 金币/彩票 00040005,00020005
			}else if("5" == producttype){
				if(ppList[2].toUpperCase() == "00040005" ||
				   ppList[2].toUpperCase() == "00020005" ){
				   typeList = ppList[3]+"&"+ppList[4];
				}
			// 话费直充 00010001,00010002,00010003,00010004,00010005,00010006	
			}else if("6" == producttype){
				if(ppList[2].toUpperCase() == "00010001" ||
				   ppList[2].toUpperCase() == "00010002" ||
				   ppList[2].toUpperCase() == "00010003" ||
				   ppList[2].toUpperCase() == "00010004" ||
				   ppList[2].toUpperCase() == "00010005" ||
				   ppList[2].toUpperCase() == "00010006" ){
				   typeList = ppList[3]+"&"+ppList[4];
				}
			// 话费卡密 00010007	
			}else if("7" == producttype){
				if(ppList[2].toUpperCase() == "00010007" ){
				   typeList = ppList[3]+"&"+ppList[4];
				}
			// 缴费支付 00040001,00040002,00040003,00040008,00030001,00030002,00030003,00030004	
			}else if("8" == producttype){
				if(ppList[2].toUpperCase() == "00040001" ||
				   ppList[2].toUpperCase() == "00040002" ||
				   ppList[2].toUpperCase() == "00040003" ||
				   ppList[2].toUpperCase() == "00040008" ||
				   ppList[2].toUpperCase() == "00030001" ||
				   ppList[2].toUpperCase() == "00030002" ||
				   ppList[2].toUpperCase() == "00030003" ||
				   ppList[2].toUpperCase() == "00030004" ){
				   typeList = ppList[3]+"&"+ppList[4];
				}
			}else {
				alert(producttype);
			}
		}
	}
	
			
	return(typeList);
	
}

