function showElement(id) {
  changeclass('show','hidden');
  document.getElementById(id).className='show';
}



function changeclass(class_old,class_new)
{
  var obj=getElementsByClassName(class_old);

  for(i=0;i<obj.length;i++)
  {
    obj[i].className=class_new;    
  }
}

function getElementsByClassName(class_name)
{
  var all_obj,ret_obj=new Array(),j=0,teststr;

  if(document.all)all_obj=document.all;
  else if(document.getElementsByTagName && !document.all)
    all_obj=document.getElementsByTagName("*");

  for(i=0;i<all_obj.length;i++)
  {
    if(all_obj[i].className.indexOf(class_name)!=-1)
    {
      teststr=","+all_obj[i].className.split(" ").join(",")+",";
      if(teststr.indexOf(","+class_name+",")!=-1)
      {
        ret_obj[j]=all_obj[i];
        j++;
      }
    }
  }
  return ret_obj;
}



function radio_validate(formObj) { 
	var checked = 0; 
	var count = 0;
	var lastname;
	for (i=0;i<formObj.elements.length;i++) { // loop all formelements
		currElem = formObj.elements[i] 
		if (currElem.type == "radio") {
			if(currElem.name != lastname){ // only one of every radiogroup counts
				count++;
			}
			lastname = currElem.name;
			if(currElem.checked){  // count checked values
				checked++;
			}
		} 
	} 
	if (checked != count) {
		alert("Bitte beantworte alle Fragen um den Test abzuschliessen!");
		return false; 
	} else {
		return true;
	}
}
// Dropdown Menu Notanker
function openURL() {
	// grab index number of the selected option
	selInd = document.categories.items.selectedIndex;

	// get value of the selected option
	goURL = document.categories.items.options[selInd].value;

	// redirect browser to the grabbed value (hopefully a URL)
	top.location.href = goURL;
}

//pop up
// This script is free to use as long as this info is left in
// Courtesy of SimplytheBest.net (http://simplythebest.net/info/dhtml_scripts.html)
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+''
win = window.open(mypage,myname,settings)
}


