function concierge() {

	var self = this;
	
	this.alert_switch = 0;
	this.lightbox_switch = 0;
	this.popup_switch = 0;
	this.signin_switch = 0;

	this.alert = function(message,color,icon) {
		if(!color) { color = 'green';}
		
		var bubble = '<div id="concierge_speech_bubble_targ" class="clearfix"><div id="concierge_speech_bubble" class="' + color + '"><p class="';
		if(icon) { bubble += icon;}else{ bubble += 'text';}
		bubble+= '">' + message + '</p><div id="concierge_speech_bubble_tail" class="' + color + '">&nbsp;</div><div id="concierge_speech_bubble_close" class="' + color + '">close</div></div></div>'
		
		if(self.alert_switch == 0) {
			$('#content').prepend(bubble);
			
			if(!jQuery.browser['chrome'] && !jQuery.browser['msie']) {
				$("#concierge_speech_bubble").corners("6px");
			}
		
			$('#concierge_speech_bubble_targ').css({
					'top'  : '-30px',
					'opacity'  : '0',
					'MozOpacity' : '0',
					'filter'   : 'alpha(opacity=0)',
					'display'  : 'block'
				});
		
			$("#concierge_speech_bubble_targ").animate({ 
					'top'  :  '0',
					'opacity'  :  '1',
					'MozOpacity' : '1',
					'filter'   : 'alpha(opacity=100)'
				},500,'linear', function() { 
				$("#concierge_speech_bubble_close").click( function() { 
					$("#concierge_speech_bubble").fadeOut("slow");
					$("#concierge_speech_bubble_targ").hide("slow", function() { 
						$("#concierge_speech_bubble_targ").remove();
						self.alert_switch = 0;
					});
				});
			});
		
			self.alert_switch = 1;
		}
	}
	
	this.lightbox = function(src,callback) {
		
		if(self.lightbox_switch == 0) {
			var img = new Image();
			img.src = src;
			img.onload = function() {
				var w = img.width;
				var h = img.height;
				var win_w = document.documentElement.clientWidth;
				var win_h = document.documentElement.clientHeight;
				var left = win_w/2 - w/2;
				var top = win_h/2 - h/2;
		
				// all other types require fading in, etc
				$('body').append('<div id="concierge_lightbox_bg"></div>');
				$('body').append('<div id="concierge_lightbox_targ"></div>');
				$('#concierge_lightbox_targ').append('<div id="concierge_lightbox_close"></div>');
				$('#concierge_lightbox_bg').css('opacity','0.4');
				$('#concierge_lightbox_targ').css('width',w);
				$('#concierge_lightbox_targ').css('height',h);
				$('#concierge_lightbox_targ').css('left',left);
				$('#concierge_lightbox_targ').css('top',top);
		
				$('#concierge_lightbox_targ').append('<img src="' + img.src + '" border="0" />');
		
				$('#concierge_lightbox_bg').fadeIn('slow');
				$('#concierge_lightbox_targ').fadeIn('slow');
		
				// setup fade out
				$('#concierge_lightbox_close').click( function() {
					$('#concierge_lightbox_bg').fadeOut('slow',function() { $('#concierge_lightbox_bg').remove();});
					$('#concierge_lightbox_targ').fadeOut('slow',function() { $('#concierge_lightbox_targ').remove();});
					self.lightbox_switch = 0;
				});
				$('#concierge_lightbox_bg').click( function() {
					$('#concierge_lightbox_bg').fadeOut('slow',function() { $('#concierge_lightbox_bg').remove();});
					$('#concierge_lightbox_targ').fadeOut('slow',function() { $('#concierge_lightbox_targ').remove();});
					self.lightbox_switch = 0;
				});
		
				// optional callback
				if(callback) { callback();}
			}
			
			self.lightbox_switch = 1;
		}
	}
	
	this.loading = function(h2,msg,w,h,callback) {
		
		if(!h2) { var h2 = "Loading...";}
		if(!msg) { var msg = "One moment please, while we are cranking away on your request!";}
		if(!w) { var w = 300;}
		if(!h) { var h = 100;}
	
		var win_w = document.documentElement.clientWidth;
		var win_h = document.documentElement.clientHeight;
		var left = win_w/2 - w/2;
		var top = win_h/2 - h/2;

		document.title = h2 + " | DiggersList";
		// get to loading the new elements and whatnot
		$('body').append('<div id="concierge_loading_bg"></div><div id="concierge_loading_targ"><div id="concierge_loading_msg"><h2>' + h2 + '</h2><p>' + msg + '</p></div><div id="concierge_loading_progress"><img src="http://www.digdogger.com/css/images/progress_bar.gif" /></div></div>');
		$('#concierge_loading_bg').css('opacity','0.4');
		$('#concierge_loading_targ').css('width',w);
		$('#concierge_loading_targ').css('height',h);
		$('#concierge_loading_targ').css('left',left);
		$('#concierge_loading_targ').css('top',top);

		$('#concierge_loading_bg').fadeIn('slow');
		$('#concierge_loading_targ').fadeIn('slow');

		//no fade out allowed because we can't stop the browser

		// optional callback
		if(callback) { callback();}
	}
	
	this.popup = function(type,url,w,h,callback) {
		
		if(self.popup_switch == 0) {
			if(!type) { var type = 'iframe';}
			if(!w) { var w = 400;}
			if(!h) { var h = 300;}
			var win_w = document.documentElement.clientWidth;
			var win_h = document.documentElement.clientHeight;
			var left = win_w/2 - w/2;
			var top = win_h/2 - h/2;
		
			// if this is a popup, we can just get it out of the way
			if(type == 'popup') {
				window.open(url,'concierge_popup', 'height='+h+',width='+w+',left='+left+',top='+top+',resizable=no,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no, status=yes');
				return true;
			}
		
			// all other types require fading in, etc
			$('body').append('<div id="concierge_popup_bg"></div>');
			$('body').append('<div id="concierge_popup_targ"></div>');
			$('#concierge_popup_targ').append('<div id="concierge_popup_close"></div>');
			$('#concierge_popup_bg').css('opacity','0.4');
			$('#concierge_popup_targ').css('width',w);
			$('#concierge_popup_targ').css('height',h);
			$('#concierge_popup_targ').css('left',left);
			$('#concierge_popup_targ').css('top',top);
		
			if(type == 'iframe') {
				$('#concierge_popup_targ').append('<iframe id="concierge_popup_iframe" src="'+url+'" width="100%" height="100%" scrolling="no"></iframe>');
			}else if(type == 'ajax') {
				$('#concierge_popup_targ').load(url);
			}
		
			$('#concierge_popup_bg').fadeIn('slow');
			$('#concierge_popup_targ').fadeIn('slow');
		
			// setup fade out
			$('#concierge_popup_close').click( function() {
				$('#concierge_popup_bg').fadeOut('slow',function() { $('#concierge_popup_bg').remove();});
				$('#concierge_popup_targ').fadeOut('slow',function() { $('#concierge_popup_targ').remove();});
				self.popup_switch = 0;
			});
			$('#concierge_popup_bg').click( function() {
				$('#concierge_popup_bg').fadeOut('slow',function() { $('#concierge_popup_bg').remove();});
				$('#concierge_popup_targ').fadeOut('slow',function() { $('#concierge_popup_targ').remove();});
				self.popup_switch = 0;
			});
		
			// optional callback
			if(callback) { callback();}
			
			self.popup_switch = 1;
		}
	}

	this.resize_popup = function(w,h) {
		var par_targ = $("#concierge_popup_targ", parent.document.body);
		
		if(w) { 
			var win_w = parent.document.documentElement.clientWidth;
			var left = win_w/2 - w/2;
			$(par_targ).css('width',w).css('left',left);
		}
		
		if(h) {
			var win_h = parent.document.documentElement.clientHeight;
			var top = win_h/2 - h/2;
			$(par_targ).css('height',h).css('top',top);
		}
	}

	this.signin = function(callback) {
		
		if(self.signin_switch == 0) {
		
			// build html
			$('body').prepend('<div id="concierge_signin_bg"></div><div id="concierge_signin_targ"></div>');
			
			var w = 700;
			var h = 350;
			var win_w = document.documentElement.clientWidth;
			var win_h = document.documentElement.clientHeight;
			var top = win_h/2 - h/2;
			var left = win_w/2 - w/2;
			
			// set up bg
			$('#concierge_signin_bg').css('opacity','0.4');
			
			// set up targ
		    $("#concierge_signin_targ").corners("10px");
			$('#concierge_signin_targ').css('left',left);
			$('#concierge_signin_targ').css('top',top);
			
			$("head").append("<link type=\"text/css\" rel=\"stylesheet\" href=\"/css/auth.css\" />");
			$("#concierge_signin_targ").load('/auth/signin/ #signin',null,function() {
				$("#concierge_signin_targ").prepend('<div id="concierge_signin_close"></div>');
				
			
			
				// catch sign in form before submitted and check vars
				$('form[name=signin]').submit( function() { 
					var form_email = $('form[name=signin] input[name=email]').val();
					var form_password = $('form[name=signin] input[name=password]').val();
				
					$('#concierge_signin_error').hide('slow',function() {

						$.post(
							'/auth/ping/in/',
							{email: form_email, password: form_password},
							function(data) {
								if(data.auth.loggedin == 1) {
									location.reload(true);
								}else{
									$('#concierge_signin_error').html(data.auth.message).show('slow');
								}
							},
							'json'
						);
				
					});
				
					return false;
				});
			
				$("input[name=password]").focus( function() {
					if($(this).attr("type") == "text") {
						$(this).replaceWith("<input type='password' name='password' class='text' value='' />");
						$("input[name=password]").focus();
					}
				});
				
				$("input.defaulted").focus( function() {
					if(this.value == this.defaultValue) {
						this.value = '';
					}
				});
			
				$('#concierge_signin_bg').fadeIn('slow');
				$('#concierge_signin_targ').fadeIn('slow');
		
				// setup fade out
				$('#concierge_signin_close').click( function() {
					$('#concierge_signin_bg').fadeOut('slow',function() { $('#concierge_signin_bg').remove();});
					$('#concierge_signin_targ').fadeOut('slow',function() { $('#concierge_signin_targ').remove();});
					self.signin_switch = 0;
				});
				$('#concierge_signin_bg').click( function() {
					$('#concierge_signin_bg').fadeOut('slow',function() { $('#concierge_signin_bg').remove();});
					$('#concierge_signin_targ').fadeOut('slow',function() { $('#concierge_signin_targ').remove();});
					self.signin_switch = 0;
				});
		
				// optional callback
				if(callback) { callback();}
			
				self.signin_switch = 1;
			});
		}
	}
}