//////////////////////////////////////////////////////////////
//Function: Navigate to select options 
//Source: Tom Savola, Basepaths Sports
//Date: 4/17/2001
//////////////////////////////////////////////////////////////

function jumpTo(page) {
	if(page != "") {
		self.location=page;
	}
}

//////////////////////////////////////////////////////////////
//Function: Search muilti select by character input
//Source: Brian Tracy
//Date: 3/15/2006
//////////////////////////////////////////////////////////////

function searchSelectBox(in_sFormName, in_sInputName, in_sSelectName)
{
	sSearchString = document.forms[in_sFormName].elements[in_sInputName].value.toUpperCase();
	iSearchTextLength = sSearchString.length;

	for (j=0; j < document.forms[in_sFormName].elements[in_sSelectName].options.length; j++)
	{
		sOptionText = document.forms[in_sFormName].elements[in_sSelectName].options[j].text;
		sOptionComp = sOptionText.substr(0, iSearchTextLength).toUpperCase();

		if(sSearchString == sOptionComp)
		{
			document.forms[in_sFormName].elements[in_sSelectName].selectedIndex = j;
			break;
		}
	}
}

//*********************************************************************************
//**	function purpose:	insert display pseudo-code
//**	date created:		07/2001
//**	created by:		briant@btgraphix.com
//*********************************************************************************

function AddText(NewCode) {
document.authoring.text.value+=NewCode
}

function bold() {
	AddTxt="[b][/b]";
	AddText(AddTxt);
}
	
function italicize() {
	AddTxt="[i][/i]";
	AddText(AddTxt);
}

function underline() {
	AddTxt="[u][/u]";
	AddText(AddTxt);
}

function left() {
	AddTxt="[left][/left]";
	AddText(AddTxt);
}

function center() {
	AddTxt="[center][/center]";
	AddText(AddTxt);
}

function right() {
	AddTxt="[right][/right]";
	AddText(AddTxt);
}

function hyperlink() {
	AddTxt="[url][/url]";
	AddText(AddTxt);
}

function image() {
	AddTxt="[img][/img]";
	AddText(AddTxt);
}

function code() {
	AddTxt=" [code] [/code]";
	AddText(AddTxt);
}

function numbering() {
	AddTxt=" [numbering][*][/*] [*][/*] [*][/*][/numbering]";
	AddText(AddTxt);
}

function bullets() {
	AddTxt=" [bullets][*][/*] [*][/*] [*][/*][/bullets]";
	AddText(AddTxt);
}

function mailto() {
	AddTxt="[url][/url]";
	AddText(AddTxt);
}

function quote() {
	AddTxt=" [quote] [/quote]";
	AddText(AddTxt);

}
	
function textcolor(color) {
	AddTxt="["+color+"][/"+color+"]";
	AddText(AddTxt);
}


// jQuery form processor
$(function() {
	$('.error').hide();
	$('textarea.text-input').css({backgroundColor:"#FFFFFF"});
	$('textarea.text-input').focus(function(){
		$(this).css({backgroundColor:"#FFDDAA"});
	});
	$('textarea.text-input').blur(function(){
		$(this).css({backgroundColor:"#FFFFFF"});
	});

	$(".ftr_submit").click(function() {
		// validate and process form
		// first hide any error messages
		$('.error').hide();

		var name = $("input#name").val();
		if (name == "") {
			$("label#name_error").show();
			$("input#name").focus();
			return false;
		}
		var email = $("input#email").val();
		if (email == "") {
			$("label#email_error").show();
			$("input#email").focus();
			return false;
		}
		var comments = $("textarea#comments").val();
		if (comments == "") {
			$("label#comments_error").show();
			$("textarea#comments").focus();
			return false;
		}

		var dataString = 'commments='+ comments;
		//alert (dataString);return false;

		/*$.ajax({
			type: "POST",
			url: "bin/comment_form.php",
			data: dataString,
			success: function() {
				$('#contact_form').html("<div id='message'></div>");
				$('#message').html("<h2>Your comments have been submitted.</h2>")
				.append("<p>Thanks!</p>")
				.hide()
				.fadeIn(1500, function() {
					$('#message');
				});
			}
		});*/
	//return false;
	});
});


