function check_form() {
	var comm = "";
	if (document.getElementById('name').value == "" || document.getElementById('name').value == "Your name") {
		comm += 'Your first name\n';
	}
	if(document.getElementById('friend1').value == "First friends email...") {
		comm += 'Please enter a first wingman for this day trip!\n';
	}
	if(document.getElementById('friend1').value == "First friends email") {
		comm += 'Please enter a first wingman for this day trip!\n';
	}
	if(document.getElementById('friend2').value == "Second friends email...") {
		comm += 'Please enter a second wingman for this day trip!\n';
	}
	if(document.getElementById('friend2').value == "Second friends email") {
		comm += 'Please enter a second wingman for this day trip!\n';
	}
	if(document.getElementById('friend3').value == "Reserve friends email...") {
		comm += 'Please enter a reserve wingman for this day trip!\n';
	}
	if(document.getElementById('friend3').value == "Reserve friends email") {
		comm += 'Please enter a reserve wingman for this day trip!\n';
	}
	if (document.getElementById('email').value == "") {
		comm += 'Email address\n';
	} else {
		var str = document.getElementById('email').value;
		if ((str.lastIndexOf(".") > str.indexOf("@") && str.indexOf("@") > 0) == false) {
			comm += 'Email address\n';
		}
	}
	
	if (comm.length == 0) {
		return true;
	} else {
		alert('Please complete following fields!\n\n'+comm);
		return false;
	}
}

function popUp(strURL, strName, strType, strTop, strLeft, strWidth, strHeight) {
	var strOptions = "";
	if (strType == "console") strOptions = "resizable, scrollbars, top="+strTop+", left="+strLeft+", width="+strWidth+", height="+strHeight;
	if (strType == "fixed") strOptions = "status, top="+strTop+", left="+strLeft+", width="+strWidth+", height="+strHeight;
	if (strType == "elastic") strOptions = "toolbar, menubar, scrollbars, resizable, location, top="+strTop+", left="+strLeft+", width="+strWidth+", height="+strHeight;
	var newWin = window.open(strURL, strName, strOptions);
	newWin.focus();
}

//code to remove yellow color from form fileds (google toolbar)
if(window.attachEvent) {
	window.attachEvent("onload",setListeners);
}
function setListeners(){
	inputList = document.getElementsByTagName("INPUT");
	for(i=0; i<inputList.length; i++) {
		inputList[i].attachEvent("onpropertychange",restoreStyles);
		inputList[i].style.backgroundColor = "";
	}
	selectList = document.getElementsByTagName("SELECT");
	for(i=0; i<selectList.length; i++) {
		selectList[i].attachEvent("onpropertychange",restoreStyles);
		selectList[i].style.backgroundColor = "";
	}
}
function restoreStyles() {
	if(event.srcElement.style.backgroundColor != "") {
		event.srcElement.style.backgroundColor = "";
	}
}

