function previewSound(id) {

sound = document.soundform.sound.value;
window.open('playSound.php?sound='+sound+'&type='+id,'mywindow','width=200,height=100')

}

// This function checks for required fields
// Fields that are required must start with 'required_'
function checkrequired(which) {

var pass = true;
var num_chars = 9;

if (document.images) {

	for (i = 0; i < which.length; i ++) {
	var tempobj = which.elements[i];

		if (tempobj.name.substring(0,num_chars) == "required_") {
			if (((tempobj.type == "text" || tempobj.type == "textarea") &&
				tempobj.value == '') || (tempobj.type.toString().charAt(0) == "s" &&
				tempobj.selectedIndex == 0)) {
				pass = false;
				break;
      }
    }
  }
}

if (!pass) {
	shortFieldName = tempobj.name.substring(num_chars,30).toUpperCase();
	alert("Please enter a value in the " + shortFieldName + " field.");
	return false;
}
else
	return true;
}// end function

function confirm_create (form,thing,value) {

var answer, message;

if (value == true) {
	message = "Are you sure you want to " + thing + "?";
	answer = confirm(message);

	if (answer) {
		form.submit();
	}
}
else {
	form.submit();
}
}

function launchGame(value) {

var mySplitResult = value.split("-");
window.open('game/game.php?charID='+mySplitResult[0]+'&securityCode='+mySplitResult[1],'jav','titlebar=1,toolbar=0,scrollbars=0,location=0,status=no,menubar=0,resizable=0,top=10,width=795,height=605');

}

function launchGameDev(charID) {

window.open('dev/game/game.php?charID='+charID,'jav','titlebar=1,toolbar=0,scrollbars=0,location=0,status=no,menubar=0,resizable=0,top=10,width=795,height=605');

}

function sf(){
document.login_form.required_username.focus();
}
