function stat(theform,thevalue) {
	theform.status.value = eval(thevalue+"_text");
}

// *******************************************************

function namedlink(theform,thetype,target) {
// inserts named url or email link 
	linktext = prompt(link_text_prompt,"");
		var prompttext;
		if (thetype == "URL") {
			prompt_text = link_url_prompt;
			prompt_contents = "http://";
			mailto = "";
			}
		else {
			prompt_text = link_email_prompt;
			prompt_contents = "";
			mailto = "mailto:";
			}
	linkurl = prompt(prompt_text,prompt_contents);
	if ((linkurl != null) && (linkurl != "")) {
		if ((linktext != null) && (linktext != ""))
			theform.Text.value += "<a href='"+mailto+""+linkurl+"' target='"+target+"'>"+linktext+"</a>";
		else
			theform.Text.value += "<a href='"+mailto+""+linkurl+"' target='"+target+"'>"+linkurl+"</a>";
		}
	theform.Text.focus();
}

// *******************************************************

function validate_presignupform(theform) {
		if (theform.Email.value=="") {
			alert("Please supply a valid e-mail adress, as activation link will be sent here!");
			return false; }
		if (theform.Email.value.length < 6) {
			alert("The e-mail adress you specified is not valid!\nPlease supply a valid e-mail adress, as activation link will be sent here!"); 
			return false; }
		if (theform.Email2.value=="") {
			alert("You need to confirm your e-mail adress!");
			return false; }
		if (theform.Email2.value != theform.Email.value) {
			alert("E-mail adresses do not match!");
			return false; }			
		if (theform.first_name.value=="" || theform.last_name.value=="") {
			alert("Please enter your full name (first and last)!");
			return false; }
		if (theform.captchacode.value=="") {
			alert("Please enter the numbers you see in the red box. This is to prevent abuse from computers and spammers!");
			return false; }					
		else { return true; }
}

// *******************************************************

function validate_signupform(theform) {
	if (theform.name.value=="" || theform.Mob_name.value=="" || theform.StreetAddress.value=="" || theform.ZipCode.value=="" || theform.City.value=="" || theform.CountryID.value=="x" || theform.BornDay.value=="x" || theform.BornMonth.value=="x" || theform.Born.value=="x" || theform.Gender.value=="x" || theform.Mob_pwd.value=="" || theform.Mob_pwd2.value=="" ) {
		alert("Please complete the necessary fields!\n\nAll fields except 'State' and 'Comments' are required.");
		return false; }
	if (theform.Mob_pwd.value.length < 5) {
		alert("Your selected password is too short. For your own security, please lengthen your password to at least 5 characters.\n\nStrong password suggestions:\n* Combine letters and numbers.\n* Combine lowercase and uppercase letters."); 
		return false; }		
	if (theform.Mob_pwd.value != theform.Mob_pwd2.value) {
		alert("Sorry - your passwords do not match!\n\nPlease make sure to enter a password you can remember\n(but also one that is NOT easily guessed), and confirm it \nby entering it once more below.");
		return false; }		
		else { return true; }
}

// *******************************************************

function validate_supportcentercontact(theform) {
	if (theform.email.value=="" || theform.message.value=="" ) {
		alert("Please enter at least an e-mail address and a message!");
		return false; }
		else { return true; }
}

// *******************************************************

function validate_forum(theform) {
//	if (theform.Text.value=="") {
	if (theform.Text.value.length < 5) {		
//		alert("You cannot make a post without any content!");
		alert("The message you have entered is too short. Please lengthen your message to at least 5 characters!");
		return false; }
	if (theform.fid.value=="") {
		alert("Please select a forum to post your thread in, from the drop-down box!");
		return false; }		
	if (theform.Subject.value=="") {
		alert("Your cannot make a post without a subject!")
		return false; }
	
//		myVar = theform.Text.value.split('-');
//		if (myVar.length>100) {
//		alert('Too many dashes(-) in your post!')
//		return false; }
		else { return true; }		
		
}

// *******************************************************

function validate_poll(theform) {
	if (theform.OldPollID.value=="0") {
		if (theform.pollQ.value.length < 5) {
			alert("No poll question entered or it's too short.");
			return false; }
		if (theform.pollA1.value=="" || theform.pollA2.value=="") {
			alert("You need to enter 2 possible answers to create a poll.");
			return false; }
		else { return true; }
	}
}

// *******************************************************

function InsertTag(theform,startTag,endTag) {
	var txtarea = theform.Text;

	if (document.selection) {
		theSelection = document.selection.createRange().text;
		if (!theSelection) {
			txtarea.value += startTag + endTag;
			txtarea.focus();
			return;
		}
		document.selection.createRange().text = startTag + theSelection + endTag;
		txtarea.focus();
		return;
	}
	else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
	{
		Mozilla(txtarea, startTag, endTag);
		return;
	}
	else
	{
		txtarea.value += startTag + endTag;
		txtarea.focus();
	}
}

// *******************************************************

function validate_affiliate_bonuscode(theform) {
	if (theform.bonuscode.value=="") {
		alert("You must supply a bonuscode so that we can track your referred players to you!\n\nExamples: GET50, VIP50, BONUS50, FREEDOLLARS etc.");
		return false; }
	if (theform.bonuscode.value.length <3) {
		alert("Your bonuscode is too short.\nMinimum 3 characters.")
		return false; }
		else { return true; }
}

// *******************************************************