// Alhamdullilah
// Masukree Tayakareng
// 2008-07-10
r=new recur();
r.element = new  Array("columnhit","event","top5","jobs","cityzone","varietyzone","spicy","gallery","entertainmentzone","webboard","post","link");
r.show_div();


function  recur()  // Class recur
	{	
	
	this._length=0;
	this._param="";
	this.ajaxdir="";
	this.prefix="div_";
	this.element="";
	this.x=0;
	this.time=0;
	
	this.show_div=function()
	{
	  if(this.x<this.element.length){
		if(this.time){clearTimeout(this.time)};  	
		this.addvar("mode",this.element[this.x]);
		this.process("ajax_operation.php",this.prefix+this.element[this.x]);
		this.x++;		
	  }	
	}
	
	this.addvar=function(name,value)
	{	
		if (this._length==0){
			this._param+="?";
		}else{
			this._param+="&";
		}
		this._param+=name;
		this._param+="=";
		this._param+=value;
		this._length=this._length+1;	
	}  // end   addvar	
	
	this.getstring=function()
	{
		return this._param;
	}	 // end  getstring	
	
	this.process=function(url,place)
	{  
		var  AjaxDir=(this.ajaxdir)?this.ajaxdir:'cvlibs/ajax/';
		var  Text;	
		this.addvar("temp",Math.random());
		
		xmlhttp=this.newXmlHttp();

		xmlhttp.onreadystatechange = function(){
			if(xmlhttp.readyState==4){
				 var Text=xmlhttp.responseText;
				 document.getElementById(place).innerHTML = Text;
				 var r=new recur();
				 r.time=setTimeout("r.show_div()",10);
			}else{
				 document.getElementById(place).innerHTML = "<center><img src='"+AjaxDir+"loading.gif'> Please wait...</center>";
			}
		}		
		xmlhttp.open("GET", url+this.getstring(), true);
		xmlhttp.send(null);	
		
		
	}	// end processajax
		
 this.newXmlHttp=function(){	
	try{
		 return  new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				return new ActiveXObject("Microsoft.XMLHTTP");
			}catch(e){
				return new XMLHttpRequest();
			}
		}

 } // end  newXmlHttp	
		
} //end class	