/* namespace: app */
var app = {
		
	config : {
		uformID : '#userdata',
		pformID : '#passchange',
		fformID : '#forgotpass',
		lformID :  '#loginform',
		mformID : '#updatedata',
		pageID : '#page',
		extraID : '#extra',
		opps_boxID : '#opps_box',
		
		full_sizeID : '#full_size',
		
		mainID : '#main',
		extraID : '#extra',
		notesID : '#note_list',
		
		naviID : '#navigation',
		captcha_imgID : '#captcha_img',
		
		uploadID : '#avatar_upload',
		progressID : '#percent_complete',
		
		avatarlistID : '#radiolist_avatar',
				
		remailID : '#remail_form',
		remail_dsiplayID : '#remail_display',
		issueID : '#issues_form',	
		other_display : '#other_display',
		
		defaultParenNodeId : 'body'
		
	},
	
	approot : 'http://myroswell.muj',
	
	configSB : function(){
		//ajax configuration
		sb.ajax.defaultFormat  = 'json';
		sb.ajax.defaultMethod  = 'get';
		sb.ajax.defaultURL  = '../data/process.php';
	}, 
	
	debug : true, 
	
	events : [],

	errobj : {},
	
	times : 0, 
	
	getRefs : function(args){
		for(var i in this.config){
			if($(this.config[i])){
				this[i.replace(/ID/, '')] = s$(args[i]);
			}else{
				this[i] = this.config[i];
			}
		}		
	},
	
	init : function(){	
		
		//get dom refrences
		this.getRefs(this.config);
		
		//surbert configuration
		this.configSB();
		
		//run sub-object vars
		for(var i in this){		
			if(typeof(this[i].init) == 'function'){
				this[i].init(this.config[i]);				
			}
		}	

		//server return error display & reset
		for(var i in this.errobj){						
			app.errlog.add({
				targ : s$('#' + i),
				id : i + '_err',
				message: this.errobj[i]
			});			
		}		
		this.errobj = {};
	},
	
	warn : function(str){
		alert(str);
	}
}

	
/* autostart */
sb.events.add(window, 'load', function(){app.init();});