var switcher={
settingcaches: {},
setopacity:function(setting, value){ //Sets the opacity of targetobject based on the passed in value setting (0 to 1 and in between)
	var targetobject=$(switcher.MAIN_ID);
	if (targetobject.filters && targetobject.filters[0]){ //IE syntax
		if (typeof targetobject.filters[0].opacity=="number") //IE6
			targetobject.filters[0].opacity=value*100
		else //IE 5.5
			targetobject.style.filter="alpha(opacity="+value*100+")"
	}
	else if (typeof targetobject.style.MozOpacity!="undefined") //Old Mozilla syntax
		targetobject.style.MozOpacity=value
	else if (typeof targetobject.style.opacity!="undefined") //Standard opacity syntax
		targetobject.style.opacity=value
	setting.curopacity=value
},
fadeup:function(setting){
	if (setting.curopacity<1){
		this.setopacity(setting, setting.curopacity+setting.enablefade[1])
		window[setting.id]=setTimeout(function(){switcher.fadeup(setting)}, 50)
	}
	else{ 
            setting.curopacity=0;
	}
},
autorotate:function(setting){
    setInterval( "dispatch()", setting.autorotate[1] );
},
init:function(setting){
	this.settingcaches[setting.id]=setting //cache "setting" object
        this.MAIN_ID = setting.id;
        this.STOP = false;
	setting.curopacity=0
        if(setting.autorotate[0])
            this.autorotate(setting);
}
}
function dispatch()
{
    setting = switcher.settingcaches[switcher.MAIN_ID];
    if( setting.autorotate[0] && !switcher.STOP )
    {
        switcher.setopacity( setting , 0);
        if( $(setting.loadingIconID) )
          $(setting.loadingIconID).style.display='';
        doEventDispatch( setting.trigger, true);
    }
    else
    {
        switcher.setopacity( setting , 1 );
    }
}
