function mouseOver(btn){
	btn.style.backgroundPosition = "bottom";
}
function mouseOut(btn){
	btn.style.backgroundPosition = "top";
}

function empty_field(inputfield){
	val_input = inputfield.value;
	if((val_input=='username')||(val_input=='password')||(val_input=="Input Keywords")){
		inputfield.value = '';
	}
}
function fill_field(inputfield,default_value){
	val_input = inputfield.value;
	if(val_input==''){
		inputfield.value = default_value;
	}
}

function validateComment(){
	elmt_comment = document.form_name.comment;
	if(elmt_comment.value == ''){
		alert('You need to fill in comments.');
		return false;
	}else{
		return true;
	}
}

function validateEmail(){
	elmt_email = document.form_name.email;
	elmt_comment = document.form_name.comment;
	errors = '';
	if((!elmt_email.value) || (elmt_email.value.indexOf("@")==-1)) errors += '- valid email address\n';
	if(!elmt_comment.value) errors += '- comments\n';
	if(errors != ''){
		errors = "Please, fill out the following mandatory field(s), marked with *:\n" + errors;
		alert(errors);
		return false;
	}else{
		return true;	
	}
}

function validateQuestion(){
	elmt_comment = document.form_name.question;
	if(elmt_comment.value == ''){
		alert('You need to fill in questions.');
		return false;
	}else{
		return true;
	}
}


function confirmDelete(msg,url){
	if(confirm(msg)) location.href = url;
}//end function confirmDelete

function fCalculateFees(){
	var dom = document.form_name;
	var totalGross = document.getElementById('gross');
	var numLocation = document.getElementById('location');
	var firstFee = 0;
	var addFee = 0;
	var error = 0;
	
	if((totalGross.value != "0")&&(numLocation.value != ""))
	{//two fields are filled
		//calculation allowed
		if(totalGross.value == "1"){
			firstFee += 600;
		}else if(totalGross.value == "2"){
			firstFee += 1000;
		}else if(totalGross.value == "3"){
			firstFee += 1500;
		}else if(totalGross.value == "4"){
			firstFee += 2200;
		}else if(totalGross.value == "5"){
			firstFee += 3500;
		}else if(totalGross.value == "6"){
			firstFee += 5000;
		}else if(totalGross.value == "7"){
			firstFee += 7500;
		}//end if 2
		
		for(i=0; i<=20; i++){ 
			if(numLocation.value == i){
				addFee += 50*i;
			}//end if
		}//end for
		dom.totalFees.value = firstFee + addFee; 
	}//end if
	else
	{//one field or two fields are missing information
		//output error message
		alert('Please select both "Total Gross Revenue" and "The Number of Additional Locations"');
	}//end else
}//end function

function displayBtn(id)
{//begin function displayBtn
	obj = document.getElementById(id);
	obj.style.visibility = 'visible';
}//end function displayBtn

function hideBtn(id)
{//begin function displayBtn
	obj = document.getElementById(id);
	obj.style.visibility = 'hidden';
}//end function displayBtn

function expand(id){
  var obj=document.getElementById(id);
  if(!obj)return true;
  if(obj.style.display=="none"){
    obj.style.display="block";
  } else {
    obj.style.display="none";
  }
  return true;
}
