function ajaxFunction(ecat_id)
{
var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();    
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
      document.getElementById('ecategory-box-content-holder').innerHTML=xmlHttp.responseText;
      }      
    }
        
  smrnd = (Math.round((Math.random()*110000)+1));
  xmlHttp.open("GET","ecategory_box_content.php?ecat_id="+ecat_id+"&"+smrnd,true);
  xmlHttp.send(null);  
  }
  
  function loadEcatBoxContent(ecat_id){
	document.getElementById('ecategory-box-content-holder').innerHTML='<div style="padding: 65px; text-align: center; font-weight: bold"><img src="/images/_loading_x.gif"><br></div>';
	ajaxFunction(ecat_id);
  }
  
  
  
  
  function initEcatBox(){
  	var tabs=document.getElementById('tab-menu');
  	/**
  	* initial state - first item active 
  	*/
  	var firstmenuItem = tabs.getElementsByTagName('LI')[0];
  	firstmenuItem.className = 'active';  	
  	loadEcatBoxContent(firstmenuItem.id);

  	for(i=0;i<tabs.getElementsByTagName('LI').length;i++) {
  		curr_elem = tabs.getElementsByTagName('LI')[i];  		
  		curr_elem.onclick = function() { 
  			this.className = 'active';
  			loadEcatBoxContent(this.id);
  			document.getElementById('link-box-bottom').href="/offers/ecategory"+this.id;
  			for(j=0;j<tabs.getElementsByTagName('LI').length;j++) {
				curr_elem_in = tabs.getElementsByTagName('LI')[j];
				if (curr_elem_in.id!= this.id) {
				 	curr_elem_in.className = 'mouseout'; 			
  				}
  			}
  		}  		
  	}
  }
  
  
  
  

  
  
  
