// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

//prevents duplicate form submitting
var smed = false;
function check(){
	if(smed){
		alert('Your data is being sent, please wait!');
		return false;
	} else {
		smed = true;
		return true;
	}
}

function containsElement(arr, ele) {
var found = false, index = 0;
while(!found && index < arr.length)
if(arr[index] == ele)
found = true;
else
index++;
return found;
}
function getIndex(input) {{
var index = -1, i = 0, found = false;
while (i < input.form.length && index == -1)
if (input.form[i] == input)index = i;
else i++;
return index;
}
return true;
}




function toggle(id, show){
 document.getElementById(id).style.display=(show)?'':'none';
}

// prevent user accidently submitting the form through 'enter'key in text field
function bar(evt){
  var k=evt.keyCode||evt.which;
  return k!=13;
}

