jQuery.fn.delay = function(time,func){
	this.each(function(){
		setTimeout(func,time);
	});
	
	return this;
};



gridExpander = function(path, titleBar){
	//path = '../../includes/thickboxes/alerter_pos.php';
	if(browser=navigator.appName != "Opera"){
		var ww = $(window).width();
		var wh = $(window).height();
	} else {
		var ww = $(document).width();
		var wh = $(document).height();
	}
	
	var theWidth = parseInt(ww - 100);
	var theHeight = parseInt(wh - 100);
	title = "";
	//alert(titleBar);
	var teeber = '&tbar=' + titleBar;
	
	tb_show(title, path + '?width=' + theWidth + '&height=' + theHeight + '&modal=true', '');
	
};


alerter_ifr = function(type, header, msg, size, delayTime, callback){
	if(type == 'pos'){
		path = '../../includes/thickboxes/alerter_pos.php';
	} else if(type == 'neg'){
		path = '../../includes/thickboxes/alerter_neg.php';
	} else if(type == 'login'){
		path = '../../includes/thickboxes/alerter_login.php';
	}
	theDims = size.split("x");
	title = "";
	tb_show(title, path + '?width=' + theDims[0] + '&height=' + theDims[1] + '&modal=true', '');
	if(delayTime){
		$(this).delay(delayTime,function(){
			tb_remove();
			$(this).delay(200,function(){
				eval(callback);						
			});
		});
	}
};

alerter_modal = function(path, size, delayTime, callback){
	
	theDims = size.split("x");
	title = "";
	tb_show(title, path + '?width=' + theDims[0] + '&height=' + theDims[1] + '&modal=true', '');
	if(delayTime){
		$(this).delay(delayTime,function(){
			tb_remove();
			$(this).delay(200,function(){
				eval(callback);						
			});
		});
	}
};

alerter_modal_id = function(path, size, delayTime, callback, theId){
	
	theDims = size.split("x");
	title = "";
	tb_show(title, path + '?width=' + theDims[0] + '&height=' + theDims[1] + '&modal=true' + '&id=' + theId, '');
	if(delayTime){
		$(this).delay(delayTime,function(){
			tb_remove();
			$(this).delay(200,function(){
				eval(callback);						
			});
		});
	}
};

alerter_flup = function(path, size, delayTime, callback, userId, divss){
	//path = '../../includes/thickboxes/alerter_pos.php';
	//alert(size);
	theDims = size.split("x");
	var theDivvies = divss.split("------");
	title = "";
	var divId = theDivvies[0];
	var imgDiv = theDivvies[1];
	tb_show(title, path + '?width=' + theDims[0] + '&height=' + theDims[1] + '&modal=true' + '&uid=' + userId + '&did=' + divId + '&imgid=' + imgDiv, '');
	if(delayTime){
		$(this).delay(delayTime,function(){
			tb_remove();
			$(this).delay(200,function(){
				eval(callback);						
			});
		});
	}
};






alerter_inl = function(type, header, msg, size, delayTime, callback){
	
	if(type == 'pos'){
		bdcol = '#32b70e';
		hclass = 'tbHead_pos';
		pclass = 'tbMsg_pos';
		bgcol = '#FAFFF9';
	} else if(type == 'neg'){
		bdcol = '#b70e0e';
		hclass = 'tbHead_neg';
		pclass = 'tbMsg_neg';
		bgcol = '#fffafa';
	}
	
	var theBody = '';
	theBody += '<div style="text-align:center; margin-bottom:1em;"><span class="' + hclass + '">' + header + '</span></div>';
	theBody += '<p class = "' + pclass + '">' + msg + '</p>';
	
	
	$("#ftdmp").html(theBody);
	theDims = size.split("x");
	title = "";
	tb_show(title, '#TB_inline?width=' + theDims[0] + '&height=' + theDims[1] + '&inlineId=ftdmp' + '&modal=true', '');
	$("#ftdmp").html(theBody);
	$("#TB_window").css({'border-color' : bdcol, 'background-color' : bgcol});
	
	$(this).delay(delayTime,function(){
		tb_remove();
		$(this).delay(750,function(){
			if(callback){
				eval(callback);
			}
		});
	});
};


function navDirect(page){
	window.location = page;
}


function leadingZero(x){
   return (x>9)?x:'0'+x;
}