<!--
//*******************************************************
//* Tiny2Go util functions
//*******************************************************
//function trimIt(trimStr) { var i = trimStr.length; while (trimStr.charAt(0) == " ") {  trimStr = trimStr.substring(1,i);  i = i-1; } while (trimStr.charAt(trimStr.length-1) == " ") { trimStr = trimStr.substring( 0,trimStr.length-1) } return trimStr; }
//function geturl() { form_url = trimIt(document.f.url.value); if (form_url == "") { alert("Please enter a valid URL. Something you can get to on the Internet. (incl. http, ftp or https)"); document.f.url.focus(); return false; } else if (isInvalidUrl(form_url)) { alert("Please enter a valid URL. Something you can get to on the Internet. (incl. http, ftp or https)"); document.f.url.focus(); return false; } else if (form_url.length < 21) { alert("The URL you entered is quite short already. No point to shortening it."); document.f.url.focus(); return false; } return true; }
function isInvalidUrl(url) { re = /^(http|https|ftp):\/\/([a-zA-Z0-9\-]+\.):?(\d*)/; if (re.test(url)) { return false; } else { return true; } }
function initialize_copy() { clip = window.clipboardData.getData("Text"); tiny = /tiny2go\.com/; if (!isInvalidUrl(clip) && !tiny.test(clip)) { document.f.url.value=clip; cleared=true; } else { document.f.url.value=''; } }
function checkurl() {
	url = document.f.url.value;
	var isValid = url.match(/^(ftp|http|https|gopher|mailto|news|nntp|telnet|wais|file|prospero|aim|webcal):(([A-Za-z0-9$_.+!*(),;/?:@&~=-])|%[A-Fa-f0-9]{2})+(#([a-zA-Z0-9][a-zA-Z0-9$_.+!*(),;/?:@&~=%-]*))?/);
//	var isValid = url.match(/^(ftp|http|https|gopher|mailto|news|nntp|telnet|wais|file|prospero|aim|webcal)+(:\/\/)+[a-z0-9_-]+\.+[a-z0-9_-]/);
	if (!isValid) {
		isValid = url.match(/^(mailto)+(:)+[a-z0-9_-]/);
		if(!isValid) {
			alert("Please enter a valid URL. Something you can get on the Internet. (incl. ftp|http|https|gopher|mailto|news|nntp|telnet|wais|file|prospero|aim|webcal)");
			document.f.url.focus();
			return false;
		}
	}
}
//-->