function stripURL(which){ //check postcode format is valid
	test = which.value; size = test.length
	while (test.slice(0,1) == " ") {//Strip leading spaces 
		test = test.substr(1,size-1);size = test.length
	}
	if (test.slice(0,7) == "http://") {//Strip leading spaces 
		test = test.substr(7,size-7);size = test.length
	}
	if (test.slice(0,7) == "mailto:") {//Strip leading spaces 
		test = test.substr(7,size-7);size = test.length
	}
	if (test.slice(0,6) == "ftp://") {//Strip leading spaces 
		test = test.substr(6,size-6);size = test.length
	}
	if (test.slice(0,8) == "https://") {//Strip leading spaces 
		test = test.substr(8,size-8);size = test.length
	}
	while (test.slice(0,1) == " ") {//Strip leading spaces 
		test = test.substr(1,size-1);size = test.length
	}
	while(test.slice(size-1,size)== " ") { //Strip trailing spaces
		test = test.substr(0,size-1);size = test.length
	}
	which.value = test; //write back to form field
	return true;
}

function PrintEmail(user, domain, display, props){
	document.write('<a href="mailto:' + user + '@' + domain + '"');
	if (props != '' && props != null) {
		document.write(' ' + props);
	}
	document.write('>');
	if (display != '' && display != null) {
		document.write(display);
	} else {
		var temp = new Array();
		temp = domain.split('?');
		document.write(user + '@' + temp[0]);
	}
	document.write('</a>');
// useage: Place the following in script tages (the 'display' and 'props' parameters are optional):
//	PrintEmail('user','domain.tld','Display Name', 'additional attributes of the "a href" tag');
//	eg: PrintEmail('webservant','MennoniteMission.net','WebServant', 'class="Special_CSS_Class"');
//	OR: PrintEmail('webservant','MennoniteMission.net');
}

function checkNotNULL() {
	var argLength = checkNotNULL.arguments.length; 
	for(arg=0;arg<argLength;arg++) { 
		if (checkNotNULL.arguments[arg] == '') {
			arg++
			alert(checkNotNULL.arguments[arg]);
			return false;
		}
		arg++
    }
}
// Provides for a Plain pop up window without: toolbar, scrollbars, location status, menu bar, not resizable 
function PlainpopUp(URL,w,h) {
	win=window.open(URL,'_blank','height='+h+',width='+w+'address=0,toolbar=0,scrollbars=0,location=0,menubar=0,resizable=0');
};
// Old Functions
function CreateWindow(url){
	win = window.open(url,"_blank",'width=275,height=300,resizable');
};
function Show_Scripture(scripture){
	url = "http://bible.gospelcom.net/bible?" + scripture;
	win = window.open(url,"_blank",'width=500,height=300,scrollbars=yes,menubar=yes,resizable');
};
function ClearFormElement(whichbox,whatphrase){
	if (whichbox.value == whatphrase){whichbox.value = "";}
}
function changeInputs()
{
	var els = document.getElementsByTagName('input');
	var elsLen = els.length;
	var i = 0;
	for ( i=0;i<elsLen;i++ )
	{
		classToAdd = els[i].getAttribute('type');
		els[i].className += " input"+classToAdd;
	}
}


function EmbedRadPreview(mp3File,tagLine,divProps) {
	if (tagLine == null) { tagLine = '<br />Preview this spot above, or click "Download" (on the right) <br />for high-quality MP3s for broadcast or your own use.' }
	if (divProps == null) { divProps = 'align="center" class="tiny"' }
	document.write('<div ' + divProps + '>&nbsp;<embed width="100" height="20" flashvars="&amp;file=' + mp3File + '&amp;height=20&amp;width=100&amp;location=/navfiles/flash_mp3_player/mp3player.swf" allowfullscreen="true" src="/navfiles/flash_mp3_player/mp3player.swf"></embed>&nbsp;' + tagLine + '</div>');
}

