<!--
var limit = "140";
var urlsintweet = 0;
function countchars() {
	var thetweet = document.form.tweet.value;
	var tweetlength = thetweet.length;
	//var urlstruc = /http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}(.^\s)*\s?/g;
	var urlstruc = /http:\/\/[A-Za-z0-9\.-\/\?\#\=\_\&]*\s?/g;
	if(thetweet.match(urlstruc) != null) {
		var urlmatches = thetweet.match(urlstruc);
		urlsintweet = urlmatches.length;	
	} else {
		urlsintweet = 0;
	}
	if(urlsintweet > 0) {
	  for (i = 1; i <= urlsintweet; i++) {
	    slength = urlmatches[i-1].length;
		if(slength > 20) {
			subtractnum = urlmatches[i-1].length;
			tweetlength = tweetlength - subtractnum + 20;
			if(urlmatches[i-1].indexOf(" ") != -1) {
				tweetlength = tweetlength + 1;
				if(urlmatches[i-1].indexOf("/", slength - 2) != -1) {
					tweetlength = tweetlength - 1;
				}
			} else {
				if(urlmatches[i-1].indexOf("/", slength - 1) != -1) {
					tweetlength = tweetlength - 1;
				}
			}
		}
	  }   
	}
	cnt = eval(limit - tweetlength);
	cnt = (cnt?cnt:'no');
	
	tmp = 280 - cnt;
	tmp2 = tmp * 1.781;
	tmp2 = Math.round(tmp2, 0);
	tmp2 = tmp2 + "px";
	tmp = tmp + "px";
	document.getElementById("drop").style.width = tmp;
	document.getElementById("drop").style.height = tmp2;
	document.getElementById('charactersleft').innerHTML = "You have " + cnt + " characters left.";
}


function validate_tweet() {
	if(document.form.tweet.value == null || document.form.tweet.value == "")
		return false;
	else
		return true;
}

var w = 140;
var beat = 0;
function heartbeat(){
	clearTimeout(this.timeout);
	if (!(document.form.tweet.value))
		{
		w += 20;
		if (w <= 200) 
			{
			h = w * 1.781;
			h = Math.round(h, 0);
			document.getElementById("drop").style.width = w+"px";
			document.getElementById("drop").style.height = h+"px";
			setTimeout(heartbeat,30);
			}
		else	
			{
			w = 140;
			document.getElementById("drop").style.width = "140px";
			document.getElementById("drop").style.height = "249px";
			beat++;
			if (beat < 2) {pause = 30;}
			else 
				{
				pause = 3000;
				beat = 0;
				}
			setTimeout(heartbeat, pause);
			}
		}
}

var x = 500;
var y = 190;
var w = 130;
var maxW = 410;
var odd = 1;
function growingDrop(){
	clearTimeout(this.timeout);
	if (!(document.form.tweet.value))
		{
		w +=20;
		if (w < maxW)
			{
			h = w * 1.781;
			h = Math.round(h, 0);
			x -= (odd<0?10:9);
			odd *= (-1);
			y -= 3;
			document.getElementById("drop").style.width = w+"px";
			document.getElementById("drop").style.height = h+"px";
			document.getElementById("drop").style.left = x+"px";
			document.getElementById("drop").style.top = y+"px";
			setTimeout(growingDrop,30);
			}
		else
			{
			if (w == maxW)
				{
				setTimeout(growingDrop,1000);
				}
			else	
				{
				x = 500;
				y = 190;
				w = 130;
				h = w * 1.781;
				h = Math.round(h, 0);
				document.getElementById("drop").style.width = w+"px";
				document.getElementById("drop").style.height = h+"px";
				document.getElementById("drop").style.left = x+"px";
				document.getElementById("drop").style.top = y+"px";
				setTimeout(growingDrop,5000);
				}
			}
		}
}


// -->
