// jsEffects.js

function toggleSearchBox(){
	var obj = document.getElementById('input_search');
	if(obj.value == "Site Search"){
		obj.value = "";
	}else if(obj.value == ""){
		obj.value = "Site Search";
	}
}

function toggleQuestionnaireOtherComments(){
	var obj = document.getElementById('comments');
	if(obj.innerHTML == "What do you think are the main issues in the team that you think could be improved even further?"){
		obj.innerHTML = "";
	}else if(obj.innerHTML == ""){
		obj.innerHTML = "What do you think are the main issues in the team that you think could be improved even further?";
	}
}

// 01. toggleInputbox
//------------------------------------------------------------------------------------------

function toggleInputbox(id,text,userevent){

	var obj = document.getElementById(id);
	if(obj.value == text && userevent != "blur"){
		obj.value = "";
		obj.className = obj.className + " input_box_active";
	}else if(obj.value == text){
		obj.className = obj.className.replace("input_box_active","");
	}else if(trim(obj.value) == ""){
		obj.value = text;
		obj.className = obj.className.replace("input_box_active","");
	}else{
		obj.value = trim(obj.value);
	}
	
}
// 02. trim
//------------------------------------------------------------------------------------------

function trim(str) {
	str = str.replace(/^\s+/, '');
	for (var i = str.length - 1; i >= 0; i--) {
		if (/\S/.test(str.charAt(i))) {
			str = str.substring(0, i + 1);
			break;
		}
	}
	return str;
}



