/* dropdown obj for schedule links */

function dropdown_obj(){
	this.neighborhoods = new Object();
	this.channelAry = new Array();
	this.channelCollection = new Object();
}

dropdown_obj.prototype.addChannel = function(chName,chKey,chNumber,currArtist,currSong,nHood,nHoodKey,chLink,schedURL,logo,desc){
	if(typeof this.channelCollection[chNumber] == "undefined"){
		this.channelCollection[chNumber] = new XMChannel(chName,chKey,chNumber,currArtist,currSong,nHood,nHoodKey,chLink,schedURL,logo,desc);
		if(!this.neighborhoods[nHoodKey]){
			this.neighborhoods[nHoodKey] = new XM_neighborhood(nHoodKey,nHood);
		}
		this.neighborhoods[nHoodKey].addChannel(chNumber,this.channelCollection[chNumber]);
	}
}

dropdown_obj.prototype.write_nHoodDropdown = function(){
	nHoodDrop = document.getElementById("neighborhoodSelect");
	nHoodDrop.options.length = 0;
	for(prop in this.neighborhoods){
		nHoodDrop.options.length = new Option(this.neighborhoods[prop].name,this.neighborhoods[prop].key);
	}
}

dropdown_obj.prototype.write_channelDropdown = function(nHoodKey){
	channelDrop = document.getElementById("channelSelect");
	channelDrop.options.length = 0;
	channelDrop.options[0] = new Option("No Schedules Available","");
	idx = 0;
	for(channelProp in this.neighborhoods[nHoodKey].channelCollection){
		channelDrop.options[idx] = new Option(this.neighborhoods[nHoodKey].channelCollection[channelProp].channelName,this.neighborhoods[nHoodKey].channelCollection[channelProp].channelLink);
		idx++;
	}	
}

dropdown_obj.prototype.gotoTarget = function(){
	channelDrop = document.getElementById("channelSelect");
	if(channelDrop.options[channelDrop.selectedIndex].value != ""){
		//var earl = "http://www.xmradio.com" + channelDrop.options[channelDrop.selectedIndex].value
		//alert("channelDrop.options[channelDrop.selectedIndex].value= " + channelDrop.options[channelDrop.selectedIndex].value + "\nearl= " + earl);
		window.location.href = channelDrop.options[channelDrop.selectedIndex].value;
	}
}
