var strSiteRoot='http://www.robin.com/';

var MapControl = Class.create({

	initialize: function(){
		
		this.strPremiumSms='psms';
		this.strBulkSms='bulk';
		this.strIVR='ivr';
		this.strNumberLookup='numberlookup';
		this.strDirectBilling='directbilling';
		
		this.strPageSeperator='#!/';
		
		this.strCurrentMap=this.strPremiumSms;
	},
	
	updateMap: function(strOption){
	
		$('map').src='http://www.txtnation.com/maps/map.php?coords=20,30&zoom=1&type='+strOption;
		
		this.strCurrentMap=strOption;
		
		window.location.hash=this.strPageSeperator+strOption;
	}
});

document.observe("dom:loaded", function() {

	if(undefined!=$('radio-psms')){
	
		var objControl=new MapControl();
	
		if(undefined!=$('radio-psms')) $('radio-psms').observe('click',function() {objControl.updateMap(objControl.strPremiumSms)});
		if(undefined!=$('radio-bulk')) $('radio-bulk').observe('click',function() {objControl.updateMap(objControl.strBulkSms)});
		if(undefined!=$('radio-ivr')) $('radio-ivr').observe('click',function() {objControl.updateMap(objControl.strIVR)});
		if(undefined!=$('radio-numberlookup')) $('radio-numberlookup').observe('click',function() {objControl.updateMap(objControl.strNumberLookup)});
		if(undefined!=$('radio-directbilling')) $('radio-directbilling').observe('click',function() {objControl.updateMap(objControl.strDirectBilling)});
		
		var strUrl=window.location.href;
		
		if('-1'!=strUrl.indexOf(objControl.strPageSeperator)){
			
			var strPage=strUrl.slice((strUrl.indexOf(objControl.strPageSeperator)+objControl.strPageSeperator.length));
			
			objControl.updateMap(strPage);
			
			$('radio-'+objControl.strCurrentMap).checked='checked';
		}
	}
});
