var state = new Object();
	
state['art_der_anstellung'] = false;
state['position_branche'] = false;
state['region'] = false;
state['gehaltsvorstellungen'] = false;
state['unternehmensgroesse'] = false;
state['verantwortung'] = false;
state['wohnortwechsel'] = false;
state['entryDate'] = false;


function changeView(element) {
	if(state[element]) {
		Effect.BlindUp(element)
		state[element] = false;
	} else {
		Effect.BlindDown(element)
		state[element] = true;
	}
}
function closeAll() {
	for(var element in state) {
		Effect.BlindUp(element, {duration:0});
		state[element] = false;
	}
}

/* functions for quarterCalendar */
function createHidden(period, id) {
	var cell = document.getElementById(period);
	var act = cell.getAttribute("class");
	var form = document.getElementById("JobOfTheWeek");
	if(act == "qCalendar_normal") {
		var newHidden = document.createElement("input");
		newHidden.setAttribute("type","hidden");
		newHidden.setAttribute("name","period"+id);
		newHidden.setAttribute("id","period"+id);
		newHidden.setAttribute("value",period);
		form.appendChild(newHidden);
	} else {
		var field = document.getElementById("period"+id);
		form.removeChild(field);
	}
	changeState(period);
}
function changeState(id) {
	var field = document.getElementById(id);
	var act = field.getAttribute("class");
	if(act == "qCalendar_normal") {
		field.setAttribute("class", "qCalendar_active");
	} else {
		field.setAttribute("class", "qCalendar_normal");
	}
}

function showDiv(id) {
	document.getElementById(id).style.display = 'block';
}

function hideDiv(id) {
	document.getElementById(id).style.display = 'none';
}

function switchVisibility(id) {					
  if(document.getElementById(id).style.display == 'none')
  {
    // document.getElementById(id).style.display = 'block';
    Element.show(id);
  }
  else
  {
    // document.getElementById(id).style.display = 'none';
    Element.hide(id);
  }
}

function genHorStepSlider(handle_id, track_id, output_id, minVal, maxVal, step) {
	var vals = new Array();
	var j = 0;
	for(var i = minVal; i <= maxVal; i=i+step) {
		vals[j] = i;
		j++;
	}
	new Control.Slider(handle_id,track_id,{range:$R(minVal,maxVal),
		values:vals,
		onSlide:function(v){$(output_id).innerHTML=v},
		onChange:function(v){$(output_id).innerHTML=v}});
		//handleImage: 'slider_2handle';
}

function genDoubleHorStepSlider(handle_low, handle_high, track_id, output_id, minVal, maxVal, step) {
		var vals = new Array();
		var out = new Array();
		var j = 1;
		vals[0] = minVal-step;
		for(var i = minVal; i <= maxVal; i=i+step) {
			vals[j] = i;
			j++;
		}
		vals[j] = maxVal+step;
		
		var dbl_slider = new Control.Slider([handle_low, handle_high],track_id,{
  								sliderValue:[minVal, maxVal],range:$R(minVal-step,maxVal+step),
  								values:vals,
  								restricted:true,
  								onSlide:function(v){
									out[0] = "init0";
									out[1] = "init1";
									if(v[0] < minVal) {
										if(v[1] > maxVal) {
											out[0] = "keine Beschr�nkung";
											out[1] = "";
										}
										else {
											out[0] = "<"+minVal;
											out[1] = v[1]+' EUR';
										}
									}
									else if(v[0] >= maxVal) {
										out[0] = "ab "+maxVal+' EUR';
										out[1] = "";
									} else {
										out[0] = v[0];
										out[1] = v[1]+" EUR";;
									}
									if(v[1] > maxVal && v[0] >=minVal && v[0] < maxVal) {
										out[1] = "unbegrenzt EUR";
									}
									else if(v[1] < minVal) {
										out[1] = "";
									}
									if(out[1] == "") {
										$(output_id).innerHTML = out[0];
									} else {
										$(output_id).innerHTML = out[0] + " - " + out[1];
									}
								},
  								onChange:function(v){
									out[0] = "init0";
									out[1] = "init1";
									if(v[0] < minVal) {
										if(v[1] > maxVal) {
											out[0] = "keine Beschr�nkung";
											out[1] = "";
										}
										else {
											out[0] = "<"+minVal;
											out[1] = v[1]+' EUR';
										}
									}
									else if(v[0] >= maxVal) {
										out[0] = "ab "+maxVal+' EUR';
										out[1] = "";
									} else {
										out[0] = v[0];
										out[1] = v[1]+" EUR";;
									}
									if(v[1] > maxVal && v[0] >=minVal && v[0] < maxVal) {
										out[1] = "unbegrenzt EUR";
									}
									else if(v[1] < minVal) {
										out[1] = "";
									}
									if(out[1] == "") {
										$(output_id).innerHTML = out[0];
									} else {
										$(output_id).innerHTML = out[0] + " - " + out[1];
									}
								}
								} );
}

function clearRadioButton(field, radio)
{
  Element.hide(field);
  for( i = 0; i < document.form1[radio].length; i++ )
    document.form1[radio][i].checked = false;
}
