$(document).ready(function () {
	var userAgent = navigator.userAgent.toLowerCase();
	jQuery.browser = {
		version: (userAgent.match( /.+(?:rv|it|ra|ie|me)[\/: ]([\d.]+)/ ) || [])[1],
		chrome: /chrome/.test( userAgent ),
		safari: /webkit/.test( userAgent ) && !/chrome/.test( userAgent ),
		opera: /opera/.test( userAgent ),
		msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
		mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
	};
	
	if($.browser.safari || $.browser.chrome || $.browser.mozilla)
	{
		$('#header,#subnavi,#links,#info li').corner('bottom 5px');
		$('#navi li:first-child').corner('tl 5px');
		$('#navi,#profile,.footer-content').corner('top 5px');
		$('#stats,#radio,#loginbar div, .ad-box').corner('5px');
		$('.sideboxheader, .contentboxheader, .bigboxheader').corner('4px');
		$('#habbo-info').corner('tl bl 5px');
		$('.social-container .social-left').corner('tl bl 5px');
		$('.social-container .social-right').corner('tr br 5px');
		$('#kb-sidebar .title').corner('4px top');
		$('#kb-sidebar .content').corner('4px bottom');
		$('#kb-content-box .title').corner('4px top');
		$('#kb-content-box .content').corner('4px bottom');
		$('#content-box-white').corner('4px');
	}
	else if($.browser.msie)
	{
		window.alert($.browser.version);
	$.reject({
			 reject: { 
			 			all:true
					 },
			 closeCookie: true,
			 close:false,
			 display: ['firefox','chrome','safari','gcf'], 
			 header: 'Your browser is not supported officially by HabboFS!',
			 paragraph1: 'As far as we know, the browser you\'re using does not allow you to experience HabboFS at it\'s best.',
			 paragraph2: 'Clicking any of the icons below will bring you to the respective browser vendor\'s page to download that browser <b>optionally</b>.<br /><br />We apologise, but IE is a browser that we cannot support until further notice. Please do take this opportunity to switch to <b>better, faster and more secured browsers</b>.', 
			 closeMessage: 'By ignoring this helpful screen, you agree to view HabboFS at its unoptimal state, and be forever using browsers that are not widely supported.',
			 closeLink: 'Close & Acknowledge',
			 imagePath: 'http://phobos.habbofs.com/WebObjects.woa/site/browsers/'
		});
	}
	else if($.browser.opera)
	{
		$.reject({
			 reject: { 
			 			all:true
					 },
			 closeCookie: true,
			 display: ['firefox','chrome','safari','gcf'], 
			 header: 'Your browser is not supported officially by HabboFS!',
			 paragraph1: 'As far as we know, the browser you\'re using does not allow you to experience HabboFS at it\'s best.',
			 paragraph2: 'Clicking any of the icons below will bring you to the respective browser vendor\'s page to download that browser <b>optionally</b>.', 
			 closeMessage: 'By ignoring this helpful screen, you agree to view HabboFS at its unoptimal state, and be forever using browsers that are not widely supported.',
			 closeLink: 'Close & Acknowledge',
			 imagePath: 'http://phobos.habbofs.com/WebObjects.woa/site/browsers/'
		});
	}
	else
	{
		$.reject({
			 reject: { 
			 			all:true
					 },
			 closeCookie: true,
			 display: ['firefox','chrome','safari','gcf'], 
			 header: 'Your browser is not supported officially by HabboFS!',
			 paragraph1: 'As far as we know, the browser you\'re using does not allow you to experience HabboFS at it\'s best.',
			 paragraph2: 'Clicking any of the icons below will bring you to the respective browser vendor\'s page to download that browser <b>optionally</b>.', 
			 closeMessage: 'By ignoring this helpful screen, you agree to view HabboFS at its unoptimal state, and be forever using browsers that are not widely supported.',
			 closeLink: 'Close & Acknowledge',
			 imagePath: 'http://phobos.habbofs.com/WebObjects.woa/site/browsers/'
		});
	}

	$('.social-menu ul li a').click(function () {
		$('.social-ajaxticker').fadeIn();
		$('.social-content').fadeOut();
		$('.social-menu ul li a').parent().removeClass('selected');
		var href = $(this).attr('href');
		$.get(href, function (data) {
			$('.social-content').html(data);
			$('.social-content').fadeIn();
			$('.social-ajaxticker').fadeOut();
		});
		$(this).parent().addClass('selected');
		return false;
	}).filter(":first").click();

	$(".tweet").tweet({
		username: "habbofs",
		join_text: "auto",
		count: 3,
		auto_join_text_default: "we said,",
		auto_join_text_ed: "we",
		auto_join_text_ing: "we were",
		auto_join_text_reply: "we replied to",
		auto_join_text_url: "we were checking out",
		loading_text: "loading tweets..."
	});
	
	Shadowbox.init({players:["img","html","iframe"]});
	
	/*$('#habboview').crossSlide({
		sleep: 10,
		fade: 1,
		shuffle:true
	},
	[
		{	src: fs.hotel_views+'au.gif'},
		{	src: fs.hotel_views+'br.gif'},
		{	src: fs.hotel_views+'ca.gif'},
		{	src: fs.hotel_views+'ch.gif'},
		{	src: fs.hotel_views+'cn1.gif'},
		{	src: fs.hotel_views+'cn2.gif'},
		{	src: fs.hotel_views+'cn3.gif'},
		{	src: fs.hotel_views+'de.gif'},
		{	src: fs.hotel_views+'dk.gif'},
		{	src: fs.hotel_views+'es.gif'},
		{	src: fs.hotel_views+'fi.gif'},
		{	src: fs.hotel_views+'fr.gif'},
		{	src: fs.hotel_views+'it.gif'},
		{	src: fs.hotel_views+'jp.gif'},
		{	src: fs.hotel_views+'nl.gif'},
		{	src: fs.hotel_views+'no.gif'},
		{	src: fs.hotel_views+'ru.gif'},
		{	src: fs.hotel_views+'se.gif'},
		{	src: fs.hotel_views+'sg.gif'},
		{	src: fs.hotel_views+'uk.gif'},
		{	src: fs.hotel_views+'us.gif'}
	]);*/
});

var fs = {
	hotel_views: "http://phobos.habbofs.com/WebObjects.woa/site/hotelviews/",
	radio_status_placeholder: "#radio-status",
	radio_status_backbone: function()
	{
		$.get('social/dj/status/info', function(data){
												$('#radio-status').html(data);
												});
	},
	radio_status: function()
	{
		this.radio_status_backbone();
		window.setInterval('fs.radio_status_backbone()', 20000);
	},
	song_history_backbone: function()
	{
		$.get('social/dj/status/song_history', function(data){
														$('#song-history').html(data);
														});
	},
	song_history: function()
	{
		this.song_history_backbone();
		window.setInterval('fs.song_history_backbone()', 20000);	
	},
	
	location_kisses: "http://deimos.habbofs.com/AvatarImaging.woa/kiss/",
	generate_kiss: function(a,b,c,d,e)
	{
		if(b != "")
		{
			fs.location_kisses =+ b+"/"+c;
		}
		
		if(d != "")
		{
			fs.location_kisses =+ d+"/"+e;
		}
		
		$(e).html('<img src="'+fs.location_kisses+'" />');
	}
};
