if(location.pathname!='' && location.pathname!='/' && location.pathname!='/login' && location.pathname!='/signin' && location.pathname!='/signup' && location.pathname!='/join' && location.pathname!='/forgot' && location.pathname!='/reset/' && location.pathname.indexOf("/signup/")==-1) {
	if(location.pathname.charAt(location.pathname.length-1) == '/') {
		window.location = '/#!'+location.pathname.substr(0,location.pathname.length-1);
	}
	else {
		window.location = '/#!'+location.pathname;
	}
}

function TimezoneDetect(){
	var dtDate = new Date('1/1/' + (new Date()).getUTCFullYear());
	var intOffset = 10000;
	var intMonth;
	var intHoursUtc;
	var intHours;
	var intDaysMultiplyBy;
	for(intMonth=0;intMonth < 12;intMonth++) {
		dtDate.setUTCMonth(dtDate.getUTCMonth() + 1);
		if(intOffset > (dtDate.getTimezoneOffset() * (-1))){
			intOffset = (dtDate.getTimezoneOffset() * (-1));
		}
	}
	return intOffset;
}

function popbox(title, text, footer) {
	if($('#popbox').length) {
		popbox_close();
	}
	footer = typeof(footer) != 'undefined' ? footer : '';
	var popbox_cls = $('<a href="#">close</a>').click(function() {
		popbox_close();
		return false;
	});
	var popbox = $('<div id="popbox" class="popbox"><div class="phead">'+title+'</div><div class="pbody">'+text+'</div><div class="pfoot"><hr />'+footer+'</div></div><div class="popbox-overlay"></div>').hide();
	$('body').append(popbox);
	if(footer == '') {
		$('#popbox .pfoot').append(popbox_cls);
	}
	$(popbox).show();
	$('body').css('overflow','hidden');
	/* $( document ).bind("mousedown",function() {
		popbox_close();
	});
	$("#popbox").bind("mousedown",function(event) {
		event.stopPropagation();
	}); */
}

function popbox_close() {
	$('#popbox').hide(function() {
		$(this).remove();
	});
	$(".popbox-overlay").remove();
	$('body').removeAttr('style');
}

$(function() {
	$('#signin input[class="tipsy-signin"]').tipsy({gravity: 'n',live: true, trigger:'focus'});
	$('#signin input[class="tipsy-signin"]').tipsy({gravity: 'n',live: true, trigger:'hover'});
	$('[class$="tipsy"]').tipsy({gravity: 's',live: true}).click(function() {
		$(this).mouseout();
	});
});
