/**
	Basisklasse mit allen moeglichen Hilfsfunktionen
	@author Felix Schul
*/

function resetFields(whichform) {//pass the selected form into the function
	for(var i=0; i < whichform.elements.length; i++){//loop through all elements in the form that was passed through
		var element = whichform.elements[i];//asign the element variable to each form element in the loop

		if(element.type == "submit") continue;//continue on submit button
		if(!element.defaultValue) continue;//if the element has a value other than the default, continue
		if(element.className != "clearonfocus") continue; //Nur aktivierte Elemente
		
		element.onfocus = function() {
			if(this.value == this.defaultValue) {//when you focus on the form, if its value is the default
				this.value = "";//clear the value from the form
			}
		}
			
		element.onblur = function(){//when you click off the selected form field
			if(this.value == "") {//if there is no value in the form input
				this.value = this.defaultValue;//return the value back to the default
			}
		}
	}
}

function autoSize(i) {
	(i.width/i.parentNode.width) > (i.height/i.parentNode.height) ?
	i.style.width = "100%" :
	i.style.height = "100%"
};

//http://snook.ca/archives/javascript/testing_for_a_v
function oc(a) {
  var o = {};
  for(var i=0;i<a.length;i++)
  {
    o[a[i]]='';
  }
  return o;
}