var preloadFlag = false;

function preloadImages() {
	if (document.images) {
		home1 = newImage("../interface/home1.gif");
		present1 = newImage("../interface/present1.gif");
		web1 = newImage("../interface/web1.gif");
		design1 = newImage("../interface/design1.gif");
		songbrowser1 = newImage("../interface/songbrowser1.gif");
		clients1 = newImage("../interface/clients1.gif");

		preloadFlag = true;
	}
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function swap() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i < swap.arguments.length; i+=2) {
			document[swap.arguments[i]].src = swap.arguments[i+1];
		}
	}
}

function recommend(myUrl){
	myUrl = '../main/recommend.html?' + myUrl;
	open(myUrl,'recommendWindow','toolbar=0, location=0, status=1, menubar=0, scrollbars=1, resizable=1, width=515, height=400, left=5, top=5');
}


function gameWindow() {
		gameWindow = window.open('../goop/goopgame.html', 'goopWindow', 'width=530,height=430,resizable=0,scrollbars=0');
}
	
function isRequired(fName,fLabel) {
	if (fName.value == "") {
		alert('Please enter a value for the "' + fLabel +'" field.');
		fName.focus();
		return false;
	}
	return true;
}

function validNum(fName,fLabel) {
	testString = fName.value;
	charset = "0123456789-";
  	for (var i=0; i < testString.length; i++) {
		if (charset.indexOf(testString.substr(i,1)) < 0) {
 			alert('Please enter numbers or "-" only in the "' + fieldLabel +'" field.');
			fName.focus();		
			return false;
		}
	}
	return true; 
}

function validEmail(fName,fLabel) {
	email = fName.value
	if ((email.length < 6) || (email.indexOf("@") < 0) || (email.indexOf(".") < 0) || (email.indexOf(" ") > -1)) {
		alert('Please enter a complete email address in the "' + fLabel + '" field in the form: yourname@yourdomain.com.');
		fName.focus();
		return false;
	}
	return true; 
}