
font_cho = Array('¤¡', '¤¢', '¤¤', '¤§', '¤¨', '¤©', '¤±', '¤²', '¤³', '¤µ', '¤¶', '¤·', '¤¸', '¤¹', '¤º', '¤»', '¤¼', '¤½', '¤¾' );
font_jung = Array('¤¿', '¤À', '¤Á', '¤Â', '¤Ã', '¤Ä', '¤Å', '¤Æ', '¤Ç', '¤È', '¤É','¤Ê', '¤Ë', '¤Ì', '¤Í', '¤Î', '¤Ï','¤Ð', '¤Ñ', '¤Ò', '¤Ó' );
font_jong = Array('', '¤¡', '¤¢', '¤£', '¤¤', '¤¥', '¤¦', '¤§', '¤©','¤ª', '¤«', '¤¬', '¤­', '¤®', '¤¯', '¤°', '¤±','¤²', '¤´', '¤µ', '¤¶', '¤·', '¤¸', '¤º', '¤»', '¤¼', '¤½', '¤¾' );
function hangul_seperate(word){
    CompleteCode = word.charCodeAt(0);
    UniValue = CompleteCode - 0xAC00;

    Jong = UniValue % 28;
    Jung = ( ( UniValue - Jong ) / 28 ) % 21;
    Cho = parseInt (( ( UniValue - Jong ) / 28 ) / 21);

    alert( font_cho[Cho] );
    alert( font_jung[Jung] );
    alert( font_jong[Jong] );

}

function getById(id, where) {
        if (where == null)
            return document.getElementById(id);
        else{
            return eval(where + ".document.getElementById('"+id+"')");}
    }
function getClientType() {
    if (navigator.appName.indexOf("Microsoft")!=-1) return "IE";
    else if (navigator.appName.indexOf("Netscape")!=-1) return "MOZ";
    else return 0;

}
var sMenuColor = "#FFFFFF";
var sMenuColorSelected = "#e0e8f5";
var isTiming=false;
var ajax = new Object();
ajax.Event = new Object();
 
 //url : ¼­¹ö ½ºÅ©¸³Æ® ÆÄÀÏ ÁÖ¼Ò
 //in
 //out

ajax.AutoComplete = function(url,inBox,outBox){
		this.useSuggestFunction = 1;
		var TextBox=document.getElementById(inBox);
		var _oj = this;
		_oj.bDebugMode = 0;
		_oj.useSuggestFunction = 1;
		_oj.url=url;
		_oj.inBox = document.getElementById(inBox);
		_oj.outBox = document.getElementById(outBox);
		_oj.oLayerSuggest = document.getElementById(outBox);
		_oj.GuideLayer = document.getElementById('guideList');
		_oj.SearchMode=0;
		_oj.userText="";
		_oj.nCurMenu=0;
		_oj.suggestList = [];
		_oj.nMenuLength=0;
		_oj.sSentQuery ="";
		// ajax.Event.addListener(TextBox,"select",selectOn);
		ajax.Event.addListener(TextBox,"keydown",this.onKeyDownTextBox,_oj);
		ajax.Event.addListener(TextBox,"mousedown",this.onMouseDownTextBox,_oj);
}


ajax.AutoComplete.prototype = {
	onKeyDownTextBox:function(e){	
		var event = window.event || e;
    	var nKeyCode=event.keyCode;
    	this.SearchMode=0;
		//alert(nKeyCode+'+');
		if(this.bDebugMode)
			this.debugBox.innerHTML +='onKeyDownTextBox:[nKeyCode]   '+nKeyCode+'<br>';
		if(this.useSuggestFunction){
			var self=this;
			setTimeout(function(){self.submitSearchKwd(nKeyCode);},100);
        	this.setKeyEvent(event);
			
    	}
    	else{

        	if(nKeyCode==13) {
            	ajax.setKeyEvent(event);
        	}
    	}
	},
	onMouseDownTextBox:function(e){
    var event = window.event || e;
    var oP = this.inBox;
	var oPLayerSuggest = this.outBox;
	var SearchMode = this.SearchMode;
	
    if(this.GuideLayer.style.display!='none'){
        this.GuideLayer.style.display='none';}
    if(this.useSuggestFunction){
        if(oP.value == this.userText){
          //  alert('mouse'+oPLayerSuggest.style.display);
            if(oPLayerSuggest.style.display=='none'){
                if(this.userText=='')
                this.SuggestDisplayOff();//oPLayerSuggest.style.display=='none'
                else{
                var str=oPLayerSuggest.innerHTML; 
                if(str=="" && (SearchMode==0 ||SearchMode==1||SearchMode==2))//»óÇÏÀ§¾î°Ë»ö
                    oPLayerSuggest.innerHTML='ÇØ´ç ´Ü¾î·Î ½ÃÀÛÇÏ´Â °Ë»ö¾î°¡ ¾ø½À´Ï´Ù.';
                oPLayerSuggest.style.display='block';
                }
            }
            else if(oPLayerSuggest.style.display=='block')
                this.SuggestDisplayOff();//oPLayerSuggest.style.display='none';
        }
        else{
			this.userText = oP.value;
        	sendRequest(this,this.suggestResult_proc,'&q='+encodeURIComponent(oP.value)+'&d='+ this.SearchMode,'GET',this.url,true,true);
             
		}

    }

	},

	submitSearchKwd:function(nKeyCode){
		var oP = getById('suggestKeyword');
    	var oLayerSuggest = getById('lSuggestResult');
    	var oPLayerSuggest = getById('lSuggestResult');
    	if(this.ignoreKey(nKeyCode))
        	return 1;
		if(this.bDebugMode)
            this.debugBox.innerHTML +="submitSearchKwd:[keycode]"+nKeyCode+'<br>';
    	switch (nKeyCode) {
        case 229: // ÇÑ±ÛÀÏ °æ¿ì
            if (getClientType() == "IE") {
                if(this.bDebugMode)
                    this.debugBox.innerHTML += nKeyCode + "[IE]<br>";
				
                  //this.bAutoRequest = true;
				  //var _self=this;
                  //setTimeout(function(){_self.sendRequestForMoz();}, 100);
            }
            else if(getClientType() == "MOZ"){
                if(this.bDebugMode)
                    this.debugBox.innerHTML += nKeyCode + "[MOZ]<br>";
                this.bAutoRequest = true;
					var _self=this;
                  setTimeout(function(){_self.sendRequestForMoz();}, 100);

                break;
            }
            else
                return 0;
			
        default:
            this.bAutoRequest = false;
            try {
                //          if(userText!=oP.value){ //aa
                if(oP.value!='' && this.userText!=oP.value){
                    if(this.bDebugMode)
                        this.debugBox.innerHTML += "[request]"+escape(oP.value)+"<br>";	
                    sendRequest(this,this.suggestResult_proc,'&q='+encodeURIComponent(oP.value)+'&d='+ this.SearchMode,'GET',this.url,true,true)
                    this.userText=oP.value;
                    
				}
                //              }   //aa
                else {
                    //ÇöÀç ÀÔ·ÂÁúÀÇ°¡ ¿¹Àü ÁúÀÇ¶û °°À» °æ¿ì ¾ÆÀÛ½º Åë½ÅÀº ÀÏ¾î³ªÁö ¾Ê´Â´Ù.
                    if(this.bDebugMode)
                        this.debugBox.innerHTML +="[prev_q]"+this.userText+"[cur_q]"+oP.value+"<br>";
                    if(oP.value==''){
                        this.SuggestDisplayOff();//oPLayerSuggest.style.display='none';//¾Æ¹«°Íµµ ¾Èº¸¿©ÁÜ
                        this.outBox.innerHTML = "";
                        }
                    this.nCurMenu=0;
                    this.userText=oP.value;
                    //sLastReceived="";//value°¡ ³ÎÀÌ¸é °á°úµµ ³ÎÀÌ¾î¾ßÇÔ.
                }
            } catch (e) {
                return 0;
            }
    }

	},
	sendRequestForMoz:function(){
		oP = this.inBox;
		if (this.sSentQuery != oP.value && this.bAutoRequest) {
        this.sSentQuery = oP.value;
        //debugLayer.innerHTML += "[::requestMoz]"+"start"+"<br>";
        try {
            if(oP.value!=''){
                if(this.bDebugMode)
                    this.debugBox.innerHTML += "[requestMoz]"+oP.value+"<br>";
                sendRequest(this.suggestResult_proc,'&q='+encodeURIComponent(oP.value)+'&d='+ this.SearchMode,'GET',this.url,true,true);
            }
        } catch (e) {
            if (this.bAutoRequest)
            	var _self=this;
                setTimeout(function(){_self.sendRequestForMoz();}, 100);

			return 0;
        }
    }
    if (this.bAutoRequest){
        setTimeout(function(){_self.sendRequestForMoz();}, 100);
    }

	},
	setKeyEvent:function(e){
		bAutoRequest = false;
		var oP=this.inBox;
		var oPLayerSuggest = this.outBox;
		var nHeightPerLine = 14;
		//var nCurMenu = this.nCurMenu;
		var nMenuLength = this.nMenuLength;
		var nKeyCode=e.keyCode;
		var oLayerSuggest =this.oLayerSuggest;
		if(oP.value==""){
			return;
		}
		
		switch(nKeyCode){
        case 13:                 //enter
            if(this.nCurMenu>0){
                oP.value = this.suggestList[this.nCurMenu];
                this.on_sel(this.nCurMenu);
            }
            else if(this.nCurMenu==0){
                this.SuggestDisplayOff();
		//		alert('°Ë»ö°á°úÀü¼Û¿¬°á');
                // top.indexFrame.topFrame.ok();//on_search();
               // top.indexframe.location.href = "http://www.nenter.com&q='+decodeURIComponent(oP.value)+'&d="; 
            }
            this.SuggestDisplayOff();//oPLayerSuggest.style.display='none';
            //alert(oP.value);
           //   alert('°Ë»ö°á°ú: ÀÌµ¿');
           go_url = "http://search.nenter.com/all.php";
           go_url = go_url + "?s=A&q="+decodeURIComponent(oP.value)+"&Page=";
           parent.location.href = go_url;
           // top.indexFrame.location = url;

            if(this.nCurMenu>0)
                getById('menu'+(this.nCurMenu)).style.background = sMenuColor;//¸¶Áö¸· Å°ÀÌº¥Æ®¿¡ ´ëÇÑ »öÄ¥À» ¾ø¾Ø´Ù.
            nCurMenu = 0;
            //nMenuLength=0;
            this.cancelEvent(e);
        //    oP.blur();
            break;

        case 38:                //up
            if (nMenuLength > 0 ) {
                if (this.nCurMenu > 1){
                    getById('menu'+(this.nCurMenu)).style.background = sMenuColor;
                    this.nCurMenu--;
                    oP.value = this.suggestList[this.nCurMenu];
                    getById('menu'+this.nCurMenu).style.background = sMenuColorSelected;
                    getById('menu'+this.nCurMenu).focus();

                    if (!(oLayerSuggest.scrollTop > ((this.nCurMenu-8) * nHeightPerLine)
                                &&
                                oLayerSuggest.scrollTop < ((this.nCurMenu-8) * nHeightPerLine)+( nHeightPerLine * 7)
                         )) {
                        if ( (oLayerSuggest.scrollTop + nHeightPerLine) == ((this.nCurMenu-8) * nHeightPerLine))
                            oLayerSuggest.scrollTop = oLayerSuggest.scrollTop - nHeightPerLine;
                        else
                            oLayerSuggest.scrollTop = (this.nCurMenu-7) * nHeightPerLine;
                    }
                    //alert(oLayerSuggest.scrollTop);
                }
                else {
                    this.nCurMenu = 0;
                    oP.value=this.suggestList[this.nCurMenu];
                    this.SuggestDisplayOff();//oPLayerSuggest.style.display='none';
                }
            }
         //    oP.focus();
            this.cancelEvent(e);
            break;
	 case 40:            //down
            if (nMenuLength > 0 ) {
                if(oPLayerSuggest.style.display=='none')
                    oPLayerSuggest.style.display='block';
                if(this.bDebugMode){
                    this.debugBox.innerHTML +="case 40:nCurMenu"+this.nCurMenu+"<br>";
                }
                if (this.nCurMenu <nMenuLength){
                    if(this.nCurMenu>0)
                        getById('menu'+(this.nCurMenu)).style.background = sMenuColor;
                    this.nCurMenu++;
                    //if (nCurMenu >= nMenuLength)
                    //   nCurMenu = nMenuLength-1;   
                    oP.value = this.suggestList[this.nCurMenu];
                    getById('menu'+this.nCurMenu).style.background = sMenuColorSelected;
                    getById('menu'+this.nCurMenu).focus();
                    //nCurMenu++;
                    if (!(oLayerSuggest.scrollTop > ((this.nCurMenu-8) * nHeightPerLine) && oLayerSuggest.scrollTop < ((this.nCurMenu-8) * nHeightPerLine)+( nHeightPerLine * 7))) {
                        if ( (oLayerSuggest.scrollTop + nHeightPerLine) == ((this.nCurMenu-8) * nHeightPerLine))
                            oLayerSuggest.scrollTop = oLayerSuggest.scrollTop - nHeightPerLine;
                        else
                            oLayerSuggest.scrollTop = (this.nCurMenu-7) * nHeightPerLine;
                    }
                }
                else {
                    this.nCurMenu = nMenuLength;
                    //alert(nCurMenu);
                    //if(nCurMenu>=nMenuLength){

                    //nCurMenu=0;
                    //alert(oP.value);
                    //sendRequest(suggestResult_proc,'&q='+encodeURIComponent(oP.value),'GET','search.php',true,true);  
                    //}
                }
            }
        //    oP.focus();
            this.cancelEvent(e);
            break;
        default:
            break;
		}
	},
	suggestResult_proc:function(oj,self){
		var str;
        var inx=0;
        var tag_str;
		var sList="";
	
        //GuideLayerOff();
        if(oj.readyState!=4)
            return ;
		if (oj.readyState==4 ||oj.status==200){
			str = oj.responseText;
			//self.debugBox.innerHTML =str;
			var cur_q = self.inBox.value;
			var rMenu = str.split("=||=");
			if(self.bDebugMode)
            	self.debugBox.innerHTML += "["+str+"]" + "[response]<br>";
			if (str != "" && rMenu.length>1) {
			
			self.nMenuLength = rMenu.length-1;
						self.nCurMenu = 0;
						sList+=  '  <table width="100%" height="110" cellpadding="0" cellspacing="0">  <tr>';
                        sList+=  ' <td height="110" bgcolor="#EBEBFA" valign="top">';
                        sList+=  ' <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">';
/*
                        sList+=  ' <tr>';
                        sList+=  ' <td align="right"  class="small style11"><a href="javascript:mySuggest.SelSearchMode(2);">ÇÏÀ§¾î</a>';
                        if(self.SearchMode==0){
                            sList+='<span id="rightbtn"><img src="./ajax_search/img/text_02_ov.gif" onclick="mySuggest.SelSearchMode(0)"></img></span>';
                            sList+='<span id="leftbtn"><img src="./ajax_search/img/text_01.gif" onclick="mySuggest.SelSearchMode(1)"></img></span>';
                        }
                        else {
                            sList+='<span id="right"><img src="./ajax_search/img/text_02.gif" onclick="mySuggest.SelSearchMode(0)"></img></span>';
                            sList+='<span id="left"><img src="./ajax_search/img/text_01_ov.gif" onclick="mySuggest.SelSearchMode(1)"></img></span>';
                        }
                        sList+='</td>';
                        sList+=  ' </tr>';
*/
                        sList+=  ' <tr>';
                        sList+=  ' <td class="small style11">';
                        sList += "<div id='la1' style='border:1px solid #C3C3C3; width:100%; height:100px; background: #ffffff; scrollbar-face-color:#F5F5F5; scrollbar-highlight-color:#f2f7f9; scrollbar-shadow-color:#C3cee1; scrollbar-3dlight-color:#c3cee1; scrollbar-arrow-color:#81a0c1; scrollbar-track-color:#F2f7f9; scrollbar-darkshadow-color:#f3f5fa; scrollbar-base-color:#Ffffff; overflow:scroll;overflow-x:hidden;'><table width='100%'>";
						
						self.suggestList[inx]=self.inBox.value;//getById('suggestKeyword',ParentObj2).value;
						inx++;
						var temp="";
                        for (var i=1; i <= rMenu.length-1; i++) {
                                self.suggestList[inx] = rMenu[i-1];
                                if(self.SearchMode!=2){
                                    //tag_str=rMenu[i-1];
									tag_str = self.ChangeFontColor(rMenu[i-1], cur_q);
								}
                                else 
									tag_str = rMenu[i-1];
							    //temp = eval(self);
								//fn = function(){ self.on_sel() };
                                sList += "<tr><td id='menu" +i+"'"+"onmousedown=mySuggest.on_sel("+i+") onmouseover=this.style.backgroundColor=sMenuColorSelected onmouseout=this.style.backgroundColor=sMenuColor>" + tag_str + "</td></tr>";
                                inx++;
								
                        }
						sList += "</table></div>";
                        sList += '</td>';
                        sList += '</tr>';
                        sList += ' <tr>';
                        sList += '<td height="10" class="small style11">';
                        sList += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
                        sList += '<tr>';
                        sList += '<td width="2%"><img src="./ajax_search/img/searchword_bg01.gif" width="6" height="19" /></td>';
                        sList += '<td width="93%" background="./ajax_search/img/searchword_bg02.gif" class="small" valign="bottom">';
                        sList += ' <table width="100%" border="0" cellpadding="0" cellspacing="0">';
                        sList += '<tr>';
                        sList += '<td width="45%" class="style12 small"><span class="style12"><strong>°Ë»ö¾îÀÔ·Âµµ¿ì¹Ì</strong></span></td>';
                        sList += '<td width="15%">&nbsp;</td>';
                        sList += '<td width="40%" class="small style11"><a href="javascript:mySuggest.init_suggest(0);">±â´É²ô±â</a></td>';
                        sList += '</tr>';
                        sList += '</table>';
                        sList+=  ' </td>';
                        sList+=  ' <td width="3%"><img src="./ajax_search/img/searchword_bg03.gif" width="7" height="19" /></td>';
                        sList+=  ' </tr>';
                        sList+=  ' </table>';
                        sList+=  ' </td>';
                        sList+=  ' </tr>';
                        sList+=  ' </table>';
                        self.outBox.innerHTML=sList;//getById('lSuggestResult',ParentObj2).innerHTML = sList;
						self.outBox.style.display='block';

                }
			else { //°á°ú°ªÀÌ ¾øÀ» °æ¿ì 
                        //this.nMenuLength=0;
						//this.nCurMenu = 0;
                        if(self.SearchMode==0||self.SearchMode==1||self.SearchMode==2){//»óÇÏÀ§¾î°Ë»ö
							self.outBox.style.height=50;
							sList+=  '  <table width="100%" height="100%" cellpadding="0" cellspacing="0">  <tr>';
                        sList+=  ' <td height="100%" bgcolor="#EBEBFA" valign="top">';
                        sList+=  ' <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">';
/*
                        sList+=  ' <tr>';
                        sList+=  ' <td align="right"  class="small style11"><a href="javascript:mySuggest.SelSearchMode(2);">ÇÏÀ§¾î</a>';
                        if(self.SearchMode==0){
                            sList+='<span id="rightbtn"><img src="./ajax_search/img/text_02_ov.gif" onclick="mySuggest.SelSearchMode(0)"></img></span>';
                            sList+='<span id="leftbtn"><img src="./ajax_search/img/text_01.gif" onclick="mySuggest.SelSearchMode(1)"></img></span>';
                        }
                        else {
                            sList+='<span id="right"><img src="./ajax_search/img/text_02.gif" onclick="mySuggest.SelSearchMode(0)"></img></span>';
                            sList+='<span id="left"><img src="./ajax_search/img/text_01_ov.gif" onclick="mySuggest.SelSearchMode(1)"></img></span>';
                        }
                        sList+='</td>';
                        sList+=  ' </tr>';
*/
                        sList+=  ' <tr>';
                        sList+=  ' <td class="small style11">';
                        sList += "<div id='la1' style='border:1px solid #C3C3C3; width:100%; height:20px; background: #ffffff; scrollbar-face-color:#F5F5F5; scrollbar-highlight-color:#f2f7f9; scrollbar-shadow-color:#C3cee1; scrollbar-3dlight-color:#c3cee1; scrollbar-arrow-color:#81a0c1; scrollbar-track-color:#F2f7f9; scrollbar-darkshadow-color:#f3f5fa; scrollbar-base-color:#Ffffff; overflow:scroll;overflow-x:hidden;'><table width='100%'>";
						sList += "<tr><td>";
						sList += 'ÇØ´ç ´Ü¾î·Î ½ÃÀÛÇÏ´Â °Ë»ö¾î°¡ ¾ø½À´Ï´Ù.';
						sList += "</td></tr>";
						sList += "</table></div>";
                        sList += '</td>';
                        sList += '</tr>';

                        sList += ' <tr>';
                        sList += '<td height="10" class="small style11">';
                        sList += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
                        sList += '<tr>';
                        sList += '<td width="2%"><img src="./ajax_search/img/searchword_bg01.gif" width="6" height="19" /></td>';
                        sList += '<td width="93%" background="./ajax_search/img/searchword_bg02.gif" class="small" valign="bottom">';
                        sList += ' <table width="100%" border="0" cellpadding="0" cellspacing="0">';
                        sList += '<tr>';
                        sList += '<td width="45%" class="style12 small"><span class="style12"><strong></strong></span></td>';
                        sList += '<td width="15%">&nbsp;</td>';
                        sList += '<td width="40%" class="small style11">µµ¿ò¸»£ü<a href="javascript:init_suggest(0);">±â´É²ô±â</a></td>';
                        sList += '</tr>';
                        sList += '</table>';
                        sList+=  ' </td>';
                        sList+=  ' <td width="3%"><img src="./ajax_search/img/searchword_bg03.gif" width="7" height="19" /></td>';
                        sList+=  ' </tr>';
                        sList+=  ' </table>';
                        sList+=  ' </td>';
                        sList+=  ' </tr>';

                        sList+=  ' </table>';
                        self.outBox.innerHTML=sList;
						self.outBox.style.display = "block";
						}
                        else{
							self.outBox.innerHTML='';
							self.outBox.style.display = "none";	
						}
						self.clearList();
           }

		}
		
	},
	ignoreKey:function(nKey){
		if ((nKey == 9) || (nKey == 13)  || // tab, enter
            (nKey == 16) || (nKey == 17) || // shift, ctl
            (nKey >= 18 && nKey <= 20) || // alt,pause/break,caps lock
            (nKey == 27) || // esc
            (nKey >= 33 && nKey <= 35) || // page up,page down,end
            (nKey >= 36 && nKey <= 39) || // home,left,up
            (nKey == 40) || // down
            (nKey >= 44 && nKey <= 45)) { // print screen,insert
        return true;
	    }
    return false;
	},
	ChangeFontColor:function(str,chk_str){
	var chk_strL = chk_str.length;
    var starti,end;
    if(this.SearchMode==1){//ÁÂÀý´Ü
        start = str.lastIndexOf(chk_str);   
        front_str =str.slice(0,start);
        end_str = chk_str;
    }
    else {
        start = str.indexOf(chk_str,0);
        end = start + chk_strL;  
        front_str = chk_str;
        end_str = str.slice(end);
        }

    var chg_str ="";
    if(start != -1){
        if(this.SearchMode==1)//ÁÂÀý´Ü
            chg_str= front_str+"<font color = '"+"blue"+"'>" +end_str+"</font>" ;
        else //¿ìÀý´Ü
            chg_str = "<font color = '"+"blue"+"'>" + front_str + "</font>" + end_str;
    }
    else
        chg_str = str;
    //getById("debug", ParentObj2).innerHTML += "["+chk_str+"]" + "[FontColor]<br>";
    
	return chg_str;
},
/****************************************************************************************
*
*****************************************************************************************/
on_sel:function(id){
	var str="";
	for(var i=0;i<this.nMenuLength; i++){
        str +='suggestList'+i+':'+this.suggestList[i]+'<br>';
    }
//	this.debugBox.innerHTML=str;
	this.inBox.value=this.suggestList[id];
	this.SuggestDisplayOff();
	this.clearList();
},
clearList:function(){
	this.nCurMenu=0;
	this.nMenuLength=0;
},

cancelEvent:function(e){
	e.returnValue=false;
    if (e && e.preventDefault)
        e.preventDefault();
},
SuggestDisplayOff:function(){
    this.outBox.style.display='none';
    this.EraseTimeout();
},
SelSearchMode:function(flag){
	var oP=this.inBox;
     if(this.SearchMode!=flag){  
         this.SearchMode=flag;
         sendRequest(this,this.suggestResult_proc,'&q='+encodeURIComponent(oP.value)+'&d='+ this.SearchMode,'GET',this.url,true,true);      
    }
    oP.focus();
},
init_suggest:function(flag){
	if(flag==0){
        this.useSuggestFunction=false;
        this.SuggestDisplayOff();
    //  alert('ÀÚµ¿¿Ï¼º²ô±â');
    }
    else if (flag==1){
        this.useSuggestFunction=true;
        //this.GuideLayerOff();
        //alert('ÀÚµ¿¿Ï¼ºÄÑ±â');
    }

},
EraseTimeout:function(){
	clearTimeout(isTiming);
    isTiming=false;
}
	
};
ajax.AutoComplete.prototype.log = function (str1,str2,_self){
    _self.debugBox.innerHTML = "["+str1+"]"+str2+"<br>";
};  
ajax.Event.addListener = function(element, name, observer, scope, useCapture) {
	useCapture = useCapture || false;
	var fn =function(e){
		observer.call(scope);
	}
	//this.getEvent();
	if (element.addEventListener) {
        element.addEventListener(name, observer, useCapture);
    } else if (element.attachEvent) {
        //element.attachEvent('on' + name, observer);
		 element.attachEvent('on' + name,fn);
    }
};
