$('.hidden').hide();

/*
function setPos() {
	if ($(window).height()>=$(document).height()) {
		$('#footer').css({
			'position': 'absolute',
			'bottom': '0'
		});
		alert('x');
	}
	else {
		$('#footer').css({
			'position': 'relative'
		});
		alert('stop');
	}
}

$(document).ready(setPos());

$(window).resize(setPos());
*/

$('.mail').each(function(i) {
	/* <![CDATA[ */
	var mail = ($(this).text());
	mail = mail.replace(' [dot] ', '.');
	mail = mail.replace(' [at] ', '@');
	
	var result = '<a href="mailto:'+mail+'">'+mail+'</a>';
	// x = result.replace(' [dot] ', '.');
	
	$(this).html(result);
	/* ]]> */
});

$('a').each(function() {
	var a = new RegExp('/' + window.location.host + '/');
	if(!a.test(this.href)) {
		$(this).click(function(event) {
			event.preventDefault();
			event.stopPropagation();
			window.open(this.href, '_blank');
		});
	}
});

$('a#clients').click(function() {
	var loginBox = $('#clientLoginDiv');
	
	if ($(loginBox).is(':hidden')) {
		$(loginBox).show();
	}
	
});


var mouse_is_inside = false;

$(document).ready(function() {
    $('#clientLoginDiv').hover(function(){ 
        mouse_is_inside=true; 
    }, function(){ 
        mouse_is_inside=false; 
    });

    $(body).mouseup(function(){ 
        if(! mouse_is_inside) $('#clientLoginDiv').hide();
    });
});
