

function in_array(needle, haystack){
	var found = false;
	var i = 0;
	while (i<haystack.length)
	{
		if (needle == haystack[i]) {found=true;}
		i++;
	}
	return found;
}

function adindex_tower(sectionbase,city_id,serverd)
{

    //dynamic_towers = new Array("nvs","law","ocw","nyv","sew");

    if(city_id == 'law')
    {
        if(this_internal)
        {
            path = 'http://adindex.laweekly.com/tower/get_tower2.php';
        }
        else
        {
            path = 'http://www.laweekly.com/adindex/ai_prox.php';
        }

        //clubs_sections  = new Array("LA Vida","Music","Promotions","Adindex");
        //dining_sections = new Array("Art/Books","Eat/Drink","Film/TV","Stage");
        //clubs_sections = new Array();
        //dining_sections = new Array();
    }
    else if(city_id == 'ocw')
    {
        if(this_internal)
        {
            path = 'http://adindex.ocweekly.com/tower/get_tower2.php';
        }
        else
        {
            path = 'http://www.ocweekly.com/adindex/ai_prox.php';
        }

        //clubs_sections  = new Array("Culture","Music","Adindex");
        //dining_sections = new Array("Film","Food");

        //clubs_sections = new Array();
        //dining_sections = new Array();
    }
    else if(city_id == 'sew')
    {
        if(serverd == 'adindex.seattleweekly.com')
        {
            path = 'http://adindex.seattleweekly.com/tower/get_tower2.php';
        }
        else
        {
            path = '/generic/ai_prox.php';
            //document.write(path);
            //path = 'http://dev.seattleweekly.com/generic/ai_prox.php';
        }

        //clubs_sections  = new Array("diversions","music","adindex");
        //dining_sections = new Array("film","food","arts");
                //clubs_sections = new Array();
        //dining_sections = new Array();
    }
    else if(city_id == 'nyv')
    {
        if(this_internal)
        {
            path = 'http://adindex.villagevoice.com/tower/get_tower2.php';
        }
        else
        {
            path = 'http://www.villagevoice.com/generic/ai_prox.php';
        }


        //clubs_sections  = new Array("nyclife","music","people");
        //dining_sections = new Array("film","adindex","arts");
        //clubs_sections = new Array();
        //dining_sections = new Array();
    }
    else if(city_id == 'nvs')
    {
        if(this_internal)
        {
            path = 'http://adindex.nashvillescene.com/tower/get_tower2.php';
        }
        else
        {
            path = 'http://www.nashvillescene.com/HTML_Libraries/ai_prox.php';
           //path = 'http://development.nashvillescene.com:8080/HTML_Libraries/ai_prox.php';
        }


        //clubs_sections  = new Array( "arts","music","adindex","culture","promotions","search");
        //dining_sections = new Array( "dining","adindex","movies","news","home","bestof" );
        //clubs_sections = new Array();
        //dining_sections = new Array();


    }
    else
    {
        return;
    }


/*	if( in_array(sectionbase,clubs_sections) )
	{
		section = 'clubs';
	}
	else if( in_array(sectionbase,dining_sections) )
	{
		section = 'dining';
	}
	else
	{
	   if( in_array(city_id,dynamic_towers) )
	   {
	       section = sectionbase;
	   }
	   else
	   {
		  //document.write('no section');
		  return;
	   }
	}*/

    var Towerxhr = new TowerXHR( path, "POST", 30 );

	onTowerXHRRecv = function () {

		document.getElementById("towerspot").innerHTML=Towerxhr.getResponseText();
	}

	Towerxhr.sendAndLoad("sectionbase=" + sectionbase + "&city_id=" + city_id);

}




