function skipSelection(){
	var x = 0;
	var checked = false;	
	$$('.produktdetail-tab1 input').each(function(item){
		item.removeProperty('checked');
	});
	document.resetsession.target = '_top';
	document.resetsession.submit();	
}

function checkStep1(){
	var x = 0;
	var checked = false;	
	
	$$('.produktdetail-tab1 input').each(function(item){
		if(item.checked)			
			checked = true;		
	});		
	if(checked == false){
		$('error').setStyle("display","block");
	}else{
		$('error').setStyle("display","none");
		document.step1.target = '_top';
		document.step1.submit();
	}
}

function checkStep2(){
	var x = 0;
	var checked = false;	
	
	$$('.produktdetail-tab1 input').each(function(item){
		if(item.checked)			
			checked = true;
	});
	
	if(checked == false)
		$('error').setStyle("display","block");
	else{
		$('error').setStyle("display","none");
		document.step2.target = '_top';
		document.step2.submit();
	}
}

function checkStep3(){
	var x = 0;
	var checked = false;	
	
	$$('.produktdetail-tab1 input').each(function(item){
		if(item.checked)			
			checked = true;
	});		
	if(checked == false)
		$('error').setStyle("display","block");
	else{
		$('error').setStyle("display","none");
		document.step3.target = '_top';
		document.step3.submit();
	}
}

function changeSelection(step,current){
						var form = step;
						
						$(current).setProperty('name',form);
						$(current).setProperty('id',form);
						$('do').setProperty('value',step);
						
						document.forms[form].action = 'index.php?id=18';
						document.forms[form].target = '_top';
						document.forms[form].submit();
}

function initSteps(){
  //if(!parameter[0]){
    $$('.ab-tab2').setStyle('opacity','100');
  //}
  
}

function step(num) {
  if(num.length == 2){
  	num =  num.substring(0, 1);
  }
 // num = 2;
 // alert(num);
	if(num == 1) {
		
		$$('.ab-tab1').setStyle('overflow','visible');
		$$('.ab-tab2').setStyle('overflow','hidden');
		
	}
	
	if(num == 2) {
		
		$$('.ab-tab1').setStyle('overflow','hidden');
		$$('.ab-tab2').setStyle('overflow','visible');
		$$('.ab-tab2').setStyle('width','160');
		
	  $$('.ab-tab1').setStyle('z-index','2');
		$$('.ab-tab2').setStyle('z-index','20');
    
    
		$$('.ab-tab2').setStyle('opacity','100');
	}
	
	if(num == 3) {
	  $$('.ab-tab1').setStyle('overflow','hidden');
		$$('.ab-tab2').setStyle('overflow','hidden');
		$$('.ab-tab3').setStyle('overflow','visible');
		
	  $$('.ab-tab2').setStyle('z-index','2');
		$$('.ab-tab3').setStyle('z-index','20');
    
		$$('.ab-tab3').setStyle('opacity','100');
	}
	
	if(num == 4) {
	
		$$('.ab-tab1').setStyle('overflow','hidden');
		$$('.ab-tab2').setStyle('overflow','hidden');
		$$('.ab-tab3').setStyle('overflow','hidden');
		$$('.ab-tab4').setStyle('overflow','visible');
		
	  $$('.ab-tab3').setStyle('z-index','2');
		$$('.ab-tab4').setStyle('z-index','20');

		$$('.ab-tab4').setStyle('opacity','100');
	}
	
	if(num == 5) {
	
		$$('.ab-tab1').setStyle('overflow','hidden');
		$$('.ab-tab2').setStyle('overflow','hidden');
		$$('.ab-tab3').setStyle('overflow','hidden');
		$$('.ab-tab4').setStyle('overflow','hidden');
		$$('.ab-tab5').setStyle('overflow','visible');
		
	  $$('.ab-tab4').setStyle('z-index','2');
		$$('.ab-tab5').setStyle('z-index','20');

		$$('.ab-tab5').setStyle('opacity','100');
	}
	
	if(num == 6) {
	
		$$('.ab-tab1').setStyle('overflow','hidden');
		$$('.ab-tab2').setStyle('overflow','hidden');
		$$('.ab-tab3').setStyle('overflow','hidden');
		$$('.ab-tab4').setStyle('overflow','hidden');
		$$('.ab-tab5').setStyle('overflow','hidden');
		$$('.ab-tab6').setStyle('overflow','visible');
		
	  $$('.ab-tab5').setStyle('z-index','2');
		$$('.ab-tab6').setStyle('z-index','20');

		$$('.ab-tab6').setStyle('opacity','100');
	}
}


if(location.search) {
	window.addEvent('domready', function(){	
		
		//activeid = location.search.substr(10);
		//parameter =  queryStrings(location.search);
		//alert(location.search);
		//step(parameter[0]);
		parameter = getQueryVariable("step");
		step(parameter);
		
	});
};

function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  }
  return 2;
  //alert('Query Variable ' + variable + ' not found');
} 

/*function queryStrings(querystring) {
  if(querystring == '') return;
  var param = new Array();
  var wertestring = unescape(querystring);

  wertestring = wertestring.slice(1);
  var paare = wertestring.split("&");
  for (var i=0; i < paare.length; i++) {
    var name = paare[i].substring(0, paare[i].indexOf("="));
    var wert = paare[i].substring(paare[i].indexOf("=")+1, paare[i].length);
    param[i] = wert;
  }
  
  return param;
}*/

