// JavaScript Document

// changes the the name of the user and places it in front of the the short statement for a preview
function statement_preview_fname(t)
{	
	//var f = document.getElementById('fname');
	//f.innerHTML = t;
}
function statement_preview_lname(t)
{
	//var f = document.getElementById('lname');
	//f.innerHTML = t;
}

// limit number of characters
function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}

// clears or replaces "is/are..." in web forms
function clear_input(name)
{
	// store reference
	var f = document.getElementById('member_statement_short');
	
	if (f.value == 'is/are...')
	{
		f.value = '';
		f.className = 'double dark';
	}
	else if (f.value == '')
	{
		f.value = 'is/are...';
		f.className = 'double light';
	}
}


// search bar
function submitSearch()
{
	// store value
	var str = document.getElementById('q').value;
	// clean string
	str = str.replace("\n", "");
	str = str.replace("\r", "");
	str = str.replace("\t", "");
	// perform a global case-insensitive search for all spaces and replace with "-" for the url
	q = str.replace(/ /gi, "-");
	window.location.href='/search/' + q;	
	return false;
}

