       var textG=""; 
       var t=0;
       function getAjax() {
            HttPRequest = false;
	  if (window.XMLHttpRequest) {
	          HttPRequest = new XMLHttpRequest();
		 if (HttPRequest.overrideMimeType) {
		        HttPRequest.overrideMimeType('text/html');
		  }
	   } else if (window.ActiveXObject) {
		  try {
		          HttPRequest = new ActiveXObject("Msxml2.XMLHTTP");
		  } catch (e) {
		         try {
			 HttPRequest = new ActiveXObject("Microsoft.XMLHTTP");
		         } catch (e) {}
		  }
	    }
		  if (!HttPRequest) {
		          alert('Cannot create XMLHTTP instance');
		          return false;
		  }
	     return HttPRequest;
        }
        function getText(url,back){
           var xmlHttp=getAjax();
             if(xmlHttp){
                xmlHttp.open("GET",url,true);
                xmlHttp.onreadystatechange=function(){
                   if(xmlHttp.readyState==4 && xmlHttp.status==200){
                       back(xmlHttp.responseText);
                       delete xmlHttp;
                       xmlHttp=null;
                   }
                }
                xmlHttp.send(null);
             }
        }
        function postText(url,data,back){
           var xmlHttp=getAjax();
             if(xmlHttp){
                xmlHttp.open("POST",url,true);
                xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
                xmlHttp.onreadystatechange=function(){
                   if(xmlHttp.readyState==4 && xmlHttp.status==200){
                       back(xmlHttp.responseText);
                       delete xmlHttp;
                       xmlHttp=null;

                   }
                }
                xmlHttp.send(data);
             }
        }
        function order(){
            var message=document.getElementById('message2');
            var m=message.value;
              if(m.length>150){
                alert('ข้อความยาวเกิน150พยางค์');
                die;
              }
              if(m.length==0){
                alert('ยังไม่ได้กรอกข้อความ');
                die;
              }
            message.value='';
            var Ms='myData='+ m;
            postText('addr.php',Ms,orderBack);
        }
        function orderBack(ms){;
          if(ms!=''){
            document.getElementById('order').innerHTML=ms;
          }
        }
        function start(){//---------------->Start here.
             var rnd=Math.random();
             url='read.php?rand='+rnd;
             getText(url,main);
        }
        function main(ms){
             textG=ms;
             style1(); 
             menue(); 
        }
        function menue(){
             getItem('b1','menue1'); 
             getItem('b2','menue2');
             getItem('b3','menue3'); 
             getItem('b4','menue4');
             getItem('ul2','menue5'); 
             getItem('b5','menue6');
             getItem('zone3','contact') 
             getItem('head','head')
        }
        function getItem(id,he){
            var n1=0;
            var str='';
            var sn=0;
            var ad=textG.split("\r\n");
            var n=ad.length;
            var bd=new Array();
               for(var i=0;i<n;i++){
                 if(ad[i]!=''){
                   if(sn==1&&ad[i].substr(0,1)!="#"){
                     str+=ad[i];
                     n1++;
                   }
                   if(ad[i].substr(0,1)=='#'){
                     if(he==ad[i].substr(1,he.length)){
                         sn=1;
                     }else{
                         sn=0;
                     }
                   }
                 }
               } 
               document.getElementById(id).innerHTML=str;
               if(n1>5 && id.substring(0,1)=='b'){
                  document.getElementById(id).style.height="80px";
                  document.getElementById(id).style.width="230px";
                  document.getElementById(id).style.overflow="auto";
               }
        }
        function download(url){
           window.open(url);
        }
        function style1(){
           if(navigator.appName=="Netscape"){
             document.getElementById('ul2').style.top="47px";
             document.getElementById('zone3').style.width="61%";
           }
        }



