function isDateValid(date)
{
	//re = /\d{4}\/\d{2}\/\d{2}/g
	//return re.test(date);
	return true; 
}

function modalBoxAlert(message, modalBoxTitle)
{
	Modalbox.show('<div>' + message + '<br/><p> <input type="button" value="OK" onclick="Modalbox.hide();"/></p></div>', 
		{title: modalBoxTitle, width:300, slideDownDuration:0.10, overlayDuration:0.10});
}

function modalBoxConfirm2(message, okButtonText, cancelButtonText, modalBoxTitle, okCallBack)
{
	Modalbox.show('<div>' + message + '</div><br/><input type="button" value="' + okButtonText + '" onclick="' + okCallBack + '"/> <input type="button" value="' + cancelButtonText + '" onclick="Modalbox.hide();"/>', 
		{title: modalBoxTitle, width:300, slideDownDuration:0.10, overlayDuration:0.10});
}

function modalBoxConfirm(message, modalBoxTitle, okCallBack)
{
	modalBoxConfirm2(message, 'OK', 'Cancel', modalBoxTitle, okCallBack); 
}

function trim( str ) 
{
	var	str = str.replace(/^\s\s*/, ''),
		ws = /\s/,
		i = str.length;
	while (ws.test(str.charAt(--i)));
	return str.slice(0, i + 1);
}

function shortenUrl( url, cb )
{
	var shortened = ''; 
	new Ajax.Request( '/include/tweet.php?func=shorten&url='+url, 
	{
		method : 'get',
		onComplete: function( transport, json ) {  
			if ( json.rc == 0 ) { 
				cb( json.rm );
			} else { 
				cb ( url );  	
			}
		} 
	}); 
	return shortened;
}