function noSpam( user, domain ) {
		document.location = 'mailto:' + user + '@' + domain;
	} 
	
	
var tenb = new Object();
tenb = {
	room: 0,
	ready: function() {
		//what to do on ready

		app.resize();
		app.ieStuff();

		app.ajaxHash.ready();

		app.removeDraggables();
	},
	ieStuff: function() {
		if ($.browser.msie) {
			curvyCorners.init();
		}
	},
	removeDraggables: function() {
		$('.not-draggable').mousedown(function(e){
			e.preventDefault();
		});
	},
	resize: function() {
		app.moveFooter();
	},
	moveFooter: function() {
		var h = $(window).height();
		var footer_offset = $('.footer').offset();

		$('.footer').removeClass('absolute');

		if (h>$('body').height()) {
			$('.footer').addClass('absolute');
		}
	},
	homepage: {
		ready: function() {
			tenb.homepage.initSlider();
			tenb.homepage.flashChange();
		},
		initSlider: function() {
			var element = $('.slider');
			if (element.size()>0) {
				element.nivoSlider({
					manualAdvance: false,
					directionNav: false,
					effect: 'fade',
					animSpeed: 300,
					pauseTime: 5000
				});
			}
		},
		flashChange: function() {
			var element = $('.content .head-slideshow.homepage .lay-over a');
			if (element.size()>0) {
				element.click(function(e){
					e.preventDefault();
					element.removeClass('selected');

					$(this).addClass('selected');
					var href = $(this).attr('href');

					$('.content .head-slideshow ul.flashes li').hide();
					$('.content .head-slideshow ul.flashes li.flash-'+href).show();
				});
			}
		}
	},
	project: {
		ready: function() {
			tenb.project.initSlider();
		},
		initSlider: function() {
			$('.slider').nivoSlider({
				manualAdvance: false,
				directionNav: false,
				effect: 'fade',
				controlNav: false,
				animSpeed: 300
			});
		}
	},
	gallery: {
		ready: function() {
			$('.content .gallery-categories ul li a').click(function(e){
				e.preventDefault();

				$('.content .gallery-categories ul li a').removeClass('selected');
				$(this).addClass('selected');

				$('.categories').hide();
				$('.category-'+$(this).attr('rel')).show();
			});

			tenb.gallery.initSlider();
		},
		initSlider: function() {
			$('.slider').each(function(){
				var _this = this;
				$(_this).nivoSlider({
					manualAdvance: true,
					effect: 'fade',
					controlNav: false,
					directionNav: $(_this).children('img').size()>1,
					directionNavHide: false,
					animSpeed: 300,
					prevText: '',
					nextText: ''
				});
			});
		}
	},
	ajaxHash: {
		ready: function() {
			$.history.init(app.ajaxHash.load);
		},
		load: function(hash) {
			hash = app.ajaxHash.removeTrailingCharacter(hash);
			if (hash != "") {
				$('.img-container').html('<img src="img/loader.gif" alt="" />');
				$.ajax({
					url: 'rooms/get_room_type/'+app.room+'/'+hash+'.json',
					dataType: 'json',
					success: function(resp){
						$('.content .sub-content.room .right h2 span').html(resp.RoomType.title);
						$('.img-container').html('<img src="'+resp.RoomType.image+'" alt="" />');
						$.scrollTo('#photo-start','slow');
					},
					error: function(object,status,error) {
						alert(status+': '+error);
					}
				});

			} else {
				//$('#hash-content').load('/');
			}
		},
		removeTrailingCharacter: function(hash) {
			if (hash[0]=='!') {
				hash=hash.substr(1);
			}
			return hash;
		}
	}
}
var app = tenb;
$(document).ready(app.ready);
$(window).resize(app.resize);
