function ValidateURL() {

	if (document.form.exists.value == document.form.url.value) {
		alert('Your short URL is created. Just copy it and use it as you like!');
		return false;
	}
	
	if (document.form.url.value == '') {
		alert ("Opps! Please type or paste the URL you want to shrink.");
		document.form.url.focus();
		return false;
	}
	var hasdot = false;

	for (var i=0; i < document.form.url.value.length; i++) {
		var dot = document.form.url.value.charAt(i);
		
		if (dot == '.') {
			hasdot = true;
			break;
		}
	}
	
	if (hasdot == false) {
		alert ("Please enter a valid web address (URL).");
                document.form.url.focus();
                return false;
	}
	
	document.form.exists.value = document.form.url.value;
	getAjax();
}

var dir = 1;
var xmul = Math.floor(Math.random()*5);
var ymul = Math.floor(Math.random()*5);


function flobee() {

	if (xmul < 2) { xmul = 2; }
	if (ymul < 2) { ymul = 2; }
	
	var randx = Math.floor(Math.random()*xmul);
	var randy = Math.floor(Math.random()*ymul);
	
	var thebee = getStyleObject("bee");
	var beeleft = parseInt(thebee.left);
	var beetop = parseInt(thebee.top)
	
	if (beeleft <= 0 || beetop <= 0) {
		dir = 1;
		xmul = Math.floor(Math.random()*4);
		ymul = Math.floor(Math.random()*4);
	}
	if (beeleft > 30 || beetop > 30) {
		dir = 0;
		xmul = Math.floor(Math.random()*4);
		ymul = Math.floor(Math.random()*4);
	}
	
	if (dir == 1) {
		beeleft += randx;
		beetop += randy;
  	}
  	else {
		beeleft -= randx;
		beetop -= randy;  	
  	}
  		
  	if (document.layers) {
    	thebee.left = beeleft;
    	thebee.top = beetop;
	}
	else {
		thebee.left = beeleft + "px";
		thebee.top = beetop + "px";  
	}
}

  function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
}

function flogo() {
	setInterval("flobee()",75);
}