String.prototype.startsWith = function(t, i) { if (i==false) { return	(t == this.substring(0, t.length)); } else { return (t.toLowerCase() == this.substring(0, t.length).toLowerCase()); } }
String.prototype.endsWith = function(t, i) { if (i==false) { return (t == this.substring(this.length - t.length)); } else { return (t.toLowerCase() == this.substring(this.length -	t.length).toLowerCase()); } }

$.fn.outerHTML = function(s) {return (s)? this.before(s).remove()	: jQuery("<p>").append(this.eq(0).clone()).html();}
$.fn.tagName = function() {if(1 === this.length){return this[0].tagName.toLowerCase();} else{var tagNames = []; this.each(function(i, el){tagNames[i] = el.tagName.toLowerCase();}); return tagNames;}}

$(document).ready(function(){

});

$(window).load(function(){

	$('a[icon]').each(function(i, o){
		$(this).addClass('icon').css('backgroundImage', 'url(images/'+$(this).attr('icon')+')');
	});

	$('.box .menu li').each(function(i, o){
		$(this).addClass(i==0?'menu':'menu-inactive').append($('<div>').addClass('vee')).bind('click', function(event){
			$('.box .menu li').addClass('menu-inactive').removeClass('menu');
			$(this).addClass('menu').removeClass('menu-inactive');
			var div = $(this).parent().parent().parent();
			$(div).find('.subcontent > div').hide();
			$(div).find('.subcontent #' + $(this).attr('id') + '_content').show();
		});
	});

	$('.box .menu li:first').click();

	DD_roundies.addRule('.roundies', '7px', true);
	$('input#username').placeholder();
	$('.login .placeholder-text').css('left','100%').css('margin-left', '-135px').css('margin-top', '3px').css('color', '#444444');

	$(window).resize(function(e){	PositionFooter();	});

	PositionFooter();

});

function trace(s){
	if(window.console) console.log(s);
}
function PositionFooter(){
	var v1 = $(window).scrollTop();
	var v2 = $('#content').height() + parseInt($('#nav').height());
	var v3 = $(window).height();
	var v4 = $('.footer').height();


	if($('div.results').length > 0) v2 += 45;
	if($('div#banner').length > 0) v2 += 300;

	var v5 = (v2 > (v3 - v4 - v1 - 20))? 'bottom':'dock';
	var v6 = (v5=='dock')?(v3-v4):(v2+20);
	$('.footer').css('top', v6 + 'px');
}
function FloatFooter(){
	if(fintid == null) fintid = setInterval("PositionFooter()", 100);
}
function LockFooter(){
	if(fintid != null){
		setTimeout('clearTimeout('+fintid+')', 1500);
		fintid = null;
	}
}



