
function init() {
  cbInit();
  //new accordeon('vorteile',2.5,'');
}

function fc(el){if(document.getElementById){el.style.backgroundColor='#E9ECF5';}}
function bl(el){if(document.getElementById){el.style.backgroundColor='#ffffff';}}

function doCallback() {
  var w = 400;
  var h = 250;
  h = h - 20; 
  var x=0, y=0, parameter="";
  if (w < screen.availWidth || h < screen.availHeight) {
     x = (screen.availWidth - w - 12) / 2;
     y = (screen.availHeight - h - 104) / 2;
     if (window.opera) y = 0;
     if (x<0 || y<0) { x=0; y=0; }
     else parameter = "width=" + w + ",height=" + h + ",";
  }
  parameter += "left=" + x + ",top=" + y;
  var name=document.forms['callback']['name'].value;
  var tel=document.forms['callback']['tel'].value;
  window.open('callback.php?name='+name+'&tel='+tel,'callback',parameter+",scrollbars=no,menubar=no,location=no,toolbar=no,status=no,resizable=no");
  return false;
}

function cbInit() {
 if(document.getElementsByTagName("form")) {
   var divs = document.getElementsByTagName("div");
   for(var i = 0; i < divs.length; i++) {
     if(divs[i].className.match("checkbox") || divs[i].className.match("radio")) {
       divs[i].onmousedown = cbEffect;
       divs[i].onmouseup = cbHandle;
       window.onmouseup = cbClear;
     }
   }
 }
}

function cbEffect() {
 if(this.className == "checkbox" || this.className == "radio") {
   this.style.backgroundPosition = "0 -26px";
 } else {
   this.style.backgroundPosition = "0 -77px";
 }
}

function cbHandle() {
 selector = this.getElementsByTagName("input")[0];
 if(this.className == "checkbox") {
   selector.checked = true;
   this.className = "checkbox selected";
   this.style.backgroundPosition = "0 -11px";
 } else if(this.className == "checkbox selected") {
   selector.checked = false;
   this.className = "checkbox";
   this.style.backgroundPosition = "0 0";
 } else {
   selector.checked = true;
   this.className = "radio selected";
   this.style.backgroundPosition = "0 -11px";
   inputs = document.getElementsByTagName("input");
   for(i = 0; i < inputs.length; i++) {
     if(inputs[i].getAttribute("name") == selector.getAttribute("name")) {
       if(inputs[i] != selector) {
         inputs[i].parentNode.className = "radio";
         inputs[i].parentNode.style.backgroundPosition = "0 0";
       }
     }
   }
 }
}

function cbClear() {
 divs = document.getElementsByTagName("div");
 for(var i = 0; i < divs.length; i++) {
   if(divs[i].className == "checkbox" || divs[i].className == "radio") {
     divs[i].style.backgroundPosition = "0 0";
   } else if(divs[i].className == "checkbox selected" || divs[i].className == "radio selected") {
     divs[i].style.backgroundPosition = "0 -11px";
   }
 }
}

/*
DezinerFolio.com Simple Accordians.

Author  : G.S.Navin Raj Kumar
Website : http://dezinerfolio.com

*/

/*
* The Variable names have been compressed to achive a higher level of compression.
*/

// Prototype Method to get the element based on ID
function $(d){
	return document.getElementById(d);
}

// set or get the current display style of the div
function dsp(d,v){
	if(v==undefined){
		return d.style.display;
	}else{
		d.style.display=v;
	}
}

// set or get the height of a div.
function sh(d,v){
	// if you are getting the height then display must be block to return the absolute height
	if(v==undefined){
		if(dsp(d)!='none'&& dsp(d)!=''){
			return d.offsetHeight;
		}
		viz = d.style.visibility;
		d.style.visibility = 'hidden';
		o = dsp(d);
		dsp(d,'block');
		r = parseInt(d.offsetHeight);
		dsp(d,o);
		d.style.visibility = viz;
		return r;
	}else{
		d.style.height=v;
	}
}
/*
* Variable 'S' defines the speed of the accordian
* Variable 'T' defines the refresh rate of the accordian
*/
s=7;
t=10;

//Collapse Timer is triggered as a setInterval to reduce the height of the div exponentially.
function ct(d){
	d = $(d);
	if(sh(d)>0){
		v = Math.round(sh(d)/d.s);
		v = (v<1) ? 1 :v ;
		v = (sh(d)-v);
		sh(d,v+'px');
		d.style.opacity = (v/d.maxh);
		d.style.filter= 'alpha(opacity='+(v*100/d.maxh)+');';
	}else{
		sh(d,0);
		dsp(d,'none');
		clearInterval(d.t);
	}
}

//Expand Timer is triggered as a setInterval to increase the height of the div exponentially.
function et(d){
	d = $(d);
	if(sh(d)<d.maxh){
		v = Math.round((d.maxh-sh(d))/d.s);
		v = (v<1) ? 1 :v ;
		v = (sh(d)+v);
		sh(d,v+'px');
		d.style.opacity = (v/d.maxh);
		d.style.filter= 'alpha(opacity='+(v*100/d.maxh)+');';
	}else{
		sh(d,d.maxh);
		clearInterval(d.t);
	}
}

// Collapse Initializer
function cl(d){
	if(dsp(d)=='block'){
		clearInterval(d.t);
		d.t=setInterval('ct("'+d.id+'")',t);
	}
}

//Expand Initializer
function ex(d){
	if(dsp(d)=='none'){
		dsp(d,'block');
		d.style.height='0px';
		clearInterval(d.t);
		d.t=setInterval('et("'+d.id+'")',t);
	}
	/*
	else{
		clearInterval(d.t);
		d.t=setInterval('ct("'+d.id+'")',t);
	}
	*/
}

// Removes Classname from the given div.
function cc(n,v){
	s=n.className.split(/\s+/);
	for(p=0;p<s.length;p++){
		if(s[p]==v+n.tc){
			s.splice(p,1);
			n.className=s.join(' ');
			break;
		}
	}
}
//Accordian Initializer
function accordeon(d,s,tc){
	// get all the elements that have id as content
	l=$(d).getElementsByTagName('div');
	c=[];
	for(i=0;i<l.length;i++){
		h=l[i].id;
		if(h.substr(h.indexOf('-')+1,h.length)=='content'){c.push(h);}
	}
	sel=null;
	//then search through headers
	for(i=0;i<l.length;i++){
		h=l[i].id;
		if(h.substr(h.indexOf('-')+1,h.length)=='header'){
			d=$(h.substr(0,h.indexOf('-'))+'-content');
			d.style.display='none';
			d.style.overflow='hidden';
			d.maxh =sh(d);
			d.s=(s==undefined)? 7 : s;
			h=$(h);
			h.tc=tc;
			h.c=c;
			// set the onclick function for each header.
			h.onclick = function(){
				for(i=0;i<this.c.length;i++){
					cn=this.c[i];
					n=cn.substr(0,cn.indexOf('-'));
					if((n+'-header')==this.id){
					  tmp=document.getElementById(n+'-content').style.display;
					  if(tmp=='none'){
  						ex($(n+'-content'));
  						n=$(n+'-header');
  						cc(n,'__');
  						n.className=n.className+' '+n.tc;
  					}
  					else {
  					 cl($(n+'-content'));
  					 n=$(n+'-header');
  					 cc(n,'_');
  					 cn=n.className.split(' ');
  					 n.className=cn[0];
  					}
					}else{
						cl($(n+'-content'));
						cc($(n+'-header'),'');
						//document.getElementById(n+'-content').style.display='none';
					}
				}
			}
			if(h.className.match(/selected+/)!=undefined){ sel=h;}
		}
	}
	if(sel!=undefined){sel.onclick();}
}

