/**
 * $Id: slide.js 1731 2009-10-02 07:35:17Z christian $
 * @author Christian Bieber
 */


var showError = {
	init: function(){
	
		if ($('errorliste')) {
		
			this.checkIfError();
		}

	},
	
	checkIfError: function() {
	
		par.error_fields.each(function(conf){
			if ($(conf[0])) {
				$(conf[1]).setStyle('border','1px solid #FF0000');
			}	

		});		
	}	
}



var hoverbuttons = {
	init : function() {

		if ($('hover_backward')) {
			this.hoverBackward();
		}
		
		if ($('hover_forward')) {
			this.hoverForward();
		}
		if ($('hover_backward_en')) {
			this.hoverBackward_en();
		}
		
		if ($('hover_forward_en')) {
			this.hoverForward_en();
		}
		
	},

	hoverForward: function() {
		$('hover_forward').addEvent('mouseover', function(e){
			$('hover_forward').setProperty('src','fileadmin/templates/sma/images/weiter-hover.png');
		});
		$('hover_forward').addEvent('mouseout', function(e){
			$('hover_forward').setProperty('src','fileadmin/templates/sma/images/weiter.png');
		});
	},
	
	hoverBackward: function() {
		$('hover_backward').addEvent('mouseover', function(e){
			$('hover_backward').setProperty('src','fileadmin/templates/sma/images/zuruck-hover.png');
		});
		$('hover_backward').addEvent('mouseout', function(e){
			$('hover_backward').setProperty('src','fileadmin/templates/sma/images/zuruck.png');
		});
	},
	
	hoverForward_en: function() {
		$('hover_forward_en').addEvent('mouseover', function(e){
			$('hover_forward_en').setProperty('src','fileadmin/templates/sma/images/weiter-hover_us.png');
		});
		$('hover_forward_en').addEvent('mouseout', function(e){
			$('hover_forward_en').setProperty('src','fileadmin/templates/sma/images/weiter_us.png');
		});
	},
	
	hoverBackward_en: function() {
		$('hover_backward_en').addEvent('mouseover', function(e){
			$('hover_backward_en').setProperty('src','fileadmin/templates/sma/images/zuruck-hover_al_us.png');
		});
		$('hover_backward_en').addEvent('mouseout', function(e){
			$('hover_backward_en').setProperty('src','fileadmin/templates/sma/images/zuruck_al_us.png');
		});
	}

}


var product_properties = {
	init : function(){

		if ($('productname')) {

			this.showThem();
		}
	},
	
	
	displayBoxes: function() {
		$('box2').setStyle('display','block');
		$('box3').setStyle('display','block');
		$('box4').setStyle('display','block');
	},

	hideBoxes: function() {
		$('box2').setStyle('display','none');
		$('box3').setStyle('display','none');
		$('box4').setStyle('display','none');
	},

	
	showThem: function() {
	if ($('productname')) {

			var  pe = $('partner_entspricht').getProperty('checked');
			var  pa = $('partner_abweichend').getProperty('checked');
			
			var  de = $('deliveryadress_entspricht').getProperty('checked');
			var  da = $('deliveryadress_abweichend').getProperty('checked');
			
			var  peb = $('partner_entspricht_b').getProperty('checked');
			var  pab = $('partner_abweichend_b').getProperty('checked');
			
			var  seb = $('standort_entspricht_b').getProperty('checked');
			var  sab = $('standort_abweichend_b').getProperty('checked');
			
			if (pe == false && pa == false && de == false && da == false && peb == false && pab == false && seb == false &&  pe == false) {
				$('partner_entspricht').setProperty('checked','checked');
				$('deliveryadress_entspricht').setProperty('checked','checked');
				$('partner_entspricht_b').setProperty('checked','checked');
				$('standort_entspricht_b').setProperty('checked','checked');
			}



		if ($('productname').getValue('value') != '') {
			var productValue = $('productname').getValue('value');
			var myOpacity = new Fx.Style($('devicedetails'), 'opacity', {
				duration: 350,
				transition: Fx.Transitions.linear
			});
				var myOpacity2 = new Fx.Style($('noerrorcode'), 'opacity', {
					duration: 350,
					transition: Fx.Transitions.linear
				});
				var myOpacity3 = new Fx.Style($('noerrrorcode2'), 'opacity', {
					duration: 350,
					transition: Fx.Transitions.linear
				});
				var myOpacity4 = new Fx.Style($('devicedetails-20'), 'opacity', {
					duration: 350,
					transition: Fx.Transitions.linear
				});	
				var myOpacity5 = new Fx.Style($('teamplatine_special'), 'opacity', {
					duration: 350,
					transition: Fx.Transitions.linear
				});
			switch ($('productname').getValue('value')) {
				case "SB 2500":
				case "SB 3000":
				case "SB 2800i":
						myOpacity.start(0, 1).chain(function(){
							$('devicedetails').setStyle('display', 'block');
						});
						myOpacity2.start(0, 1).chain(function(){
							$('noerrorcode').setStyle('display', 'block');
						});								
						myOpacity3.start(1, 0).chain(function(){
							$('noerrrorcode2').setStyle('display', 'none');
						});	
						myOpacity4.start(1, 0).chain(function(){
							$('devicedetails-20').setStyle('display', 'none');
						});
						myOpacity5.start(0, 1);
						
						this.displayBoxes();	
						$('devicetype').setProperty('value','1');														
										
				break;
				case "SB 5000TLW":
				case "SB 5000TLHC":
				case "SB 5000TL":
				case "SB 4200TL":
				case "SB 4200TLHC":
				case "SB 4000TL":
				case "SB 3800":
				case "SB 3300TLHC":
				case "SB 3300TL":
				case "SB 3300":
				case "SB 2100TL":
				case "SB 1700":
				case "SB 1200":
				case "SB 1100LV":
				case "SB 1100":
				case "SB 700":
				case "SWR 3000":
				case "SWR 2500":
				case "GCI2400 (SWR1700)":
				case "SWR 2000":
				case "SWR 1700E":
				case "SWR 1700":
				case "SWR 1500":
				case "GCI1200 (SWR850E)":	
				case "SWR 1100E":
				case "SWR 1100LV":
				case "GCI1100 (SWR850)":
				case "SWR 1100":
				case "GCI1000 (SWR700)":
				case "SWR 850E":
				case "SWR 850":
				case "SWR 700":
				case "Sunny Mini Central 11000TL":
				case "Sunny Mini Central 10000TL":
				case "Sunny Mini Central 9000TL":
				case "Sunny Mini Central 8000TL":
				case "Sunny Mini Central 7000HV-11":
				case "Sunny Mini Central 7000HV":
				case "Sunny Mini Central 7000TL":
				case "Sunny Mini Central 6000TL":
				case "Sunny Mini Central 6000A":
				case "Sunny Mini Central 6000":
				case "Sunny Mini Central 5000A":
				case "Sunny Mini Central 5000":
				case "Sunny Mini Central 4600A":
				case "WB 6000A":
				case "WB 5000A":
				case "WB 3800":
				case "WB 3300":
				case "WB 3000":
				case "WB 2500":
				case "WB 1700":
				case "WB 1100LV":
				case "WB 1100":	
						myOpacity.start(0, 1).chain(function(){
							$('devicedetails').setStyle('display', 'block');
						});
						myOpacity2.start(0, 1).chain(function(){
							$('noerrorcode').setStyle('display', 'block');
						});								
						myOpacity3.start(1, 0).chain(function(){
							$('noerrrorcode2').setStyle('display', 'none');
						});	
						myOpacity4.start(1, 0).chain(function(){
							$('devicedetails-20').setStyle('display', 'none');
						});
						myOpacity5.start(1, 0);
						this.displayBoxes();
						$('devicetype').setProperty('value','1');		
				break;
				case "SB 5000TL-20":
				case "SB 4000TL-20":
				case "SB 3000TL-20":
				case "STP 10000TL":
				case "STP 12000TL":	
				case "STP 15000TL":	
				case "STP 17000TL":		
						myOpacity.start(1, 0).chain(function(){
							$('devicedetails').setStyle('display', 'none');
						});
						myOpacity2.start(1, 0).chain(function(){
							$('noerrorcode').setStyle('display', 'none');
						});								
						myOpacity3.start(0, 1).chain(function(){
							$('noerrrorcode2').setStyle('display', 'block');
						});
						myOpacity4.start(0, 1).chain(function(){
							$('devicedetails-20').setStyle('display', 'block');
						});	
						this.displayBoxes();
						$('devicetype').setProperty('value','2');		

				break;		
				case "null":				
				default:
					if ( $('devicedetails').getStyle('opacity') == 1 ) {
						myOpacity.start(1, 0).chain(function(){
							$('devicedetails').setStyle('display', 'none');
						});
						myOpacity2.start(1, 0).chain(function(){
							$('noerrorcode').setStyle('display', 'none');
						});								
						myOpacity3.start(1, 0).chain(function(){
							$('noerrrorcode2').setStyle('display', 'none');
						});	
						myOpacity4.start(1, 0).chain(function(){
							$('devicedetails-20').setStyle('display', 'none');
						});	
						myOpacity5.start(1, 0);
						this.hideBoxes();	
						$('devicetype').setProperty('value','0');		

					}
				break;
			}
			

			par.checked_kom.each(function(conf){
				var el = $(conf[0]);	
				var hidden = $(conf[1]);	
			
				if (el.getProperty('checked') == true) {
					hidden.setProperty('value','1');

				}	

			});


			par.checked_spec.each(function(conf){
				var el = $(conf[0]);	
				var hidden = $(conf[1]);	
			
				if (el.getProperty('checked') == true) {
					hidden.setProperty('value','1');

				}	

			});			
			
			par.uncheck_sonder.each(function(conf){

				var el = $(conf[0]); 
								
				if (el.getProperty('checked') == true ) {

						$('gs_keine').setProperty('value', '1');
						$('gs_ens').setProperty('value', '1');
						$('gs_weiter').setProperty('value', '1');
						$('gs_nothing').setProperty('value', '1');										
				}
			});

			if( ($('gs_keine').getProperty('value') == 0 ) && ($('gs_ens').getProperty('value') == 0 ) && ($('gs_weiter').getProperty('value') == 0 )) {
				$('gs_nothing').setProperty('value', '');		
			}
			
		
			par.display_service.each(function(conf) {
				var event_trigger = $(conf[0]);
				var effect_id = $(conf[1]);
				var effect = conf[2];
							
					var myOpacity = new Fx.Style(effect_id, 'opacity', {
						duration: 350,
						transition: Fx.Transitions.linear
					});	
		
					if (event_trigger.getProperty('checked')) {
							myOpacity.start(0, 1).chain(function(){
							effect_id.setStyle('display', effect);
						});					
					}				
				
				
			});
			
			par.steckertyp.each(function(conf) {
				el = $(conf[0]);
				
				if (el.getProperty('checked') == true) {
					$('dc_decision').setProperty('value',conf[0]);
				}					
			});
			
			par.komm_rs485.each(function(conf) {
				el = $(conf[0]);
				
				if (el.getProperty('checked') == true) {
					$('rs485_decision').setProperty('value',$(conf[0]).value);
				}
			});
			
			par.checked_kom.each(function(conf) {
				el = $(conf[1]);
				if (el.getValue('value') == 1) {
					$('com_checkedall').setProperty('value','1');
				}					
			});


			if ($('yellow_led_blink').getProperty('checked') == true) {
				$('blinkcount').setProperty('disabled','');
			}

			if ($('errorcode').getProperty('checked') == true) {
				$('displayerror_b').setProperty('readonly','');
			}

			if ($('errordescription_check_b').getProperty('checked') == true) {
				$('errordescription_b').setProperty('readonly','');
			}
			
			if ($('further').getProperty('checked') == true) {
				$('furthermsg').setProperty('readonly','');
			}						
					
		}

		$('productname').addEvent('change', function(e){
			var productValue = $('productname').getValue('value');
			var myOpacity = new Fx.Style($('devicedetails'), 'opacity', {
				duration: 350,
				transition: Fx.Transitions.linear
			});
				var myOpacity2 = new Fx.Style($('noerrorcode'), 'opacity', {
					duration: 350,
					transition: Fx.Transitions.linear
				});
				var myOpacity3 = new Fx.Style($('noerrrorcode2'), 'opacity', {
					duration: 350,
					transition: Fx.Transitions.linear
				});
				var myOpacity4 = new Fx.Style($('devicedetails-20'), 'opacity', {
					duration: 350,
					transition: Fx.Transitions.linear
				});	
				var myOpacity5 = new Fx.Style($('teamplatine_special'), 'opacity', {
					duration: 350,
					transition: Fx.Transitions.linear
				});		
							
				switch (productValue) {
					case "SB 2500":
					case "SB 3000":
					case "SB 2800i":
							myOpacity.start(0, 1).chain(function(){
								$('devicedetails').setStyle('display', 'block');
							});
							myOpacity2.start(0, 1).chain(function(){
								$('noerrorcode').setStyle('display', 'block');
							});								
							myOpacity3.start(1, 0).chain(function(){
								$('noerrrorcode2').setStyle('display', 'none');
							});	
							myOpacity4.start(1, 0).chain(function(){
								$('devicedetails-20').setStyle('display', 'none');
							});	
							myOpacity5.start(0, 1);		
							this.displayBoxes();	
							$('devicetype').setProperty('value','1');														
											
					break;
					case "SB 5000TLW":
					case "SB 5000TLHC":
					case "SB 5000TL":
					case "SB 4200TL":
					case "SB 4200TLHC":
					case "SB 4000TL":
					case "SB 3800":
					case "SB 3300TLHC":
					case "SB 3300TL":
					case "SB 3300":
					case "SB 2100TL":
					case "SB 1700":
					case "SB 1200":
					case "SB 1100LV":
					case "SB 1100":
					case "SB 700":
					case "SWR 3000":
					case "SWR 2500":
					case "GCI2400 (SWR1700)":
					case "SWR 2000":
					case "SWR 1700E":
					case "SWR 1700":
					case "SWR 1500":
					case "GCI1200 (SWR850E)":	
					case "SWR 1100E":
					case "SWR 1100LV":
					case "GCI1100 (SWR850)":
					case "SWR 1100":
					case "GCI1000 (SWR700)":
					case "SWR 850E":
					case "SWR 850":
					case "SWR 700":
					case "Sunny Mini Central 11000TL":
					case "Sunny Mini Central 10000TL":
					case "Sunny Mini Central 9000TL":
					case "Sunny Mini Central 8000TL":
					case "Sunny Mini Central 7000HV-11":
					case "Sunny Mini Central 7000HV":
					case "Sunny Mini Central 7000TL":
					case "Sunny Mini Central 6000TL":
					case "Sunny Mini Central 6000A":
					case "Sunny Mini Central 6000":
					case "Sunny Mini Central 5000A":
					case "Sunny Mini Central 5000":
					case "Sunny Mini Central 4600A":
					case "WB 6000A":
					case "WB 5000A":
					case "WB 3800":
					case "WB 3300":
					case "WB 3000":
					case "WB 2500":
					case "WB 1700":
					case "WB 1100LV":
					case "WB 1100":	
					
							myOpacity.start(0, 1).chain(function(){
								$('devicedetails').setStyle('display', 'block');
							});
							myOpacity2.start(0, 1).chain(function(){
								$('noerrorcode').setStyle('display', 'block');
							});								
							myOpacity3.start(1, 0).chain(function(){
								$('noerrrorcode2').setStyle('display', 'none');
							});	
							myOpacity4.start(1, 0).chain(function(){
								$('devicedetails-20').setStyle('display', 'none');
							});	
							myOpacity5.start(1, 0);
							this.displayBoxes();
							$('devicetype').setProperty('value','1');
					break;
					case "SB 5000TL-20":
					case "SB 4000TL-20":
					case "SB 3000TL-20":
					case "STP 10000TL":
					case "STP 12000TL":	
					case "STP 15000TL":	
					case "STP 17000TL":	
							myOpacity.start(1, 0).chain(function(){
								$('devicedetails').setStyle('display', 'none');
							});
							myOpacity2.start(1, 0).chain(function(){
								$('noerrorcode').setStyle('display', 'none');
							});								
							myOpacity3.start(0, 1).chain(function(){
								$('noerrrorcode2').setStyle('display', 'block');
							});	
							myOpacity4.start(0, 1).chain(function(){
								$('devicedetails-20').setStyle('display', 'block');
							});	
							this.displayBoxes();	
							$('devicetype').setProperty('value','2');						

					break;		
					case "":
						if ( $('devicedetails').getStyle('opacity') == 1 ) {
							myOpacity.start(1, 0).chain(function(){
								$('devicedetails').setStyle('display', 'none');
							});
							myOpacity2.start(1, 0).chain(function(){
								$('noerrorcode').setStyle('display', 'none');
							});								
							myOpacity3.start(1, 0).chain(function(){
								$('noerrrorcode2').setStyle('display', 'none');
							});	
							myOpacity4.start(1, 0).chain(function(){
								$('devicedetails-20').setStyle('display', 'none');
							});	
							myOpacity5.start(1, 0);
							this.hideBoxes();
							$('devicetype').setProperty('value','0');
						}
					break;			
					default:
						if ( $('devicedetails').getStyle('opacity') == 1 ) {
							myOpacity.start(1, 0).chain(function(){
								$('devicedetails').setStyle('display', 'none');
							});
							myOpacity2.start(1, 0).chain(function(){
								$('noerrorcode').setStyle('display', 'none');
							});								
							myOpacity3.start(1, 0).chain(function(){
								$('noerrrorcode2').setStyle('display', 'none');
							});	
							myOpacity4.start(1, 0).chain(function(){
								$('devicedetails-20').setStyle('display', 'none');
							});	
							myOpacity5.start(1, 0);
							this.hideBoxes();
							$('devicetype').setProperty('value','0');
						}
					break;
				}

			}.bind(this));
						
		}
	}
}

var uncheck = {
	init: function(){

		if ($('keine')) {
			this.uncheckfield();
		}

		if ($('special_keine')) {
			this.uncheckfield2();
		}
		
		if ($('sonder_keine')) {
			this.uncheckfield3();
		}
		
		if ($('dc_decision')) {
			this.fillstecker();
		}
		
		if ($('rs485_decision')) {
			this.fillrs485();
		}
		
	},
		
	uncheckfield: function() {

		par.uncheckelements_kom.each(function(conf){
			if (conf[0]){			
				var el = $(conf[0]); 
				var box = $(conf[1]);
				var hidden = $(conf[2]);

				
				el.addEvent('click', function(e){

						box.setProperty('checked', '');
						
						$('com_checkedall').setProperty('value', '0');
					
						if ((hidden.getValue('value') == 1) && ( conf[0] != 'keine' || conf[0] != 'nichtbekannt' ) ) {
							hidden.setProperty('value', '0');						
						} else {
							hidden.setProperty('value', '1');	
							$('com_checkedall').setProperty('value', '1');
						}	
						
						if ( conf[0] == 'keine' ) {			
							$('com_powerline').setProperty('value', '0');	
							$('com_rs232').setProperty('value', '0');
							$('com_rs485').setProperty('value', '0');
							$('com_sunnybeam').setProperty('value', '0');
							$('com_display').setProperty('value', '0');
							$('com_bluetooth').setProperty('value', '0');
							$('com_nichtbekannt').setProperty('value', '0');
						}
						
						if ( conf[0] == 'nichtbekannt' ) {			
							$('com_powerline').setProperty('value', '0');	
							$('com_rs232').setProperty('value', '0');
							$('com_rs485').setProperty('value', '0');
							$('com_sunnybeam').setProperty('value', '0');
							$('com_display').setProperty('value', '0');
							$('com_bluetooth').setProperty('value', '0');
//							$('com_keine').setProperty('value', '0');
						}
						

						if ( conf[0] == 'powerline' ) {				
							$('com_rs232').setProperty('value', '0');
							$('com_rs485').setProperty('value', '0');
							$('com_sunnybeam').setProperty('value', '0');
						}
						
						if ( conf[0] == 'rs232' ) {				
							$('com_powerline').setProperty('value', '0');
							$('com_rs485').setProperty('value', '0');
							$('com_sunnybeam').setProperty('value', '0');
						}
						
						if ( conf[0] == 'rs485' ) {				
							$('com_powerline').setProperty('value', '0');
							$('com_rs232').setProperty('value', '0');
							$('com_sunnybeam').setProperty('value', '0');
						}
						
						if ( conf[0] == 'sunnybeam' ) {				
							$('com_powerline').setProperty('value', '0');
							$('com_rs232').setProperty('value', '0');
							$('com_rs485').setProperty('value', '0');
						}

						if ($(conf[0]).getProperty('checked') && conf[0] != 'keine') {
							$('com_keine').setProperty('value', '0');
						}
						
						if ((el.getValue('value') == 0) && conf[0] == 'keine') {
							$('com_checkedall').setProperty('value', '0');						
						}
						if ($(conf[0]).getProperty('checked') && conf[0] != 'nichtbekannt') {
							$('com_nichtbekannt').setProperty('value', '0');
						}
						
						if ((el.getValue('value') == 0) && conf[0] == 'nichtbekannt') {
							$('com_checkedall').setProperty('value', '0');						
						}
						
				}.bind(this));
			}
	
		});
		
	},
	
	uncheckfield2: function() {
	
		par.uncheckelements_son.each(function(conf){
			if (conf[0]){
				
				var el = $(conf[0]); 
				var box = $(conf[1]);
				var hidden = $(conf[2]);


				el.addEvent('click', function(e){

						box.setProperty('checked', '');
						
						
						$('spec_checkedall').setProperty('value', '0');

					
						if ((hidden.getValue('value') == 1) && (conf[0] != 'special_keine' || conf[0] != 'special_nichtbekannt')) {
							if (!el.getProperty('checked')) {
								hidden.setProperty('value', '0');
								console.debug('A');
								console.debug(conf);
							} else {
								console.debug('B');
								console.debug(conf);
							}
						} else if ( hidden != null ) {
							hidden.setProperty('value', '1');	
							$('spec_checkedall').setProperty('value', '1');
						}	

						if ( conf[0] == 'special_keine' ) {
							$('spec_ovp').setProperty('value', '0');
							$('spec_ess').setProperty('value', '0');
							$('spec_teamplatine').setProperty('value', '0');
							$('spec_erdungsset_positiv').setProperty('value', '0');
							$('spec_erdungsset_negativ').setProperty('value', '0');
							$('spec_nichtbekannt').setProperty('value', '0');
						}
						
						if ( conf[0] == 'special_nichtbekannt' ) {
							$('spec_ovp').setProperty('value', '0');
							$('spec_ess').setProperty('value', '0');
							$('spec_teamplatine').setProperty('value', '0');
							$('spec_erdungsset_positiv').setProperty('value', '0');
							$('spec_erdungsset_negativ').setProperty('value', '0');
							$('spec_keine').setProperty('value', '0');
						}
						
						if ( conf[0] == 'erdungsset_positiv' ) {
							$('spec_erdungsset_negativ').setProperty('value', '0');
						}
						
						if ( conf[0] == 'erdungsset_negativ' ) {
							$('spec_erdungsset_positiv').setProperty('value', '0');
						}

						if ($(conf[0]).getProperty('checked') == '') {
							$('spec_keine').setProperty('value', '0');
						}
	
						if ((el.getValue('value') == 0) && conf[0] == 'special_keine') {
							$('spec_checkedall').setProperty('value', '0');						
						}

						if ($(conf[0]).getProperty('checked') && conf[0] != 'special_keine') {
							$('spec_keine').setProperty('value', '0');
						}
						if ((el.getValue('value') == 0) && conf[0] == 'special_nichtbekannt') {
							$('spec_checkedall').setProperty('value', '0');						
						}

						if ($(conf[0]).getProperty('checked') && conf[0] != 'special_nichtbekannt') {
							$('spec_nichtbekannt').setProperty('value', '0');
						}

				}.bind(this));
			}
		});
		
	},
	
	uncheckfield3: function() {

		par.uncheck_sonder.each(function(conf){
			if (conf[0]){
				
				var el = $(conf[0]); 
				var box = $(conf[1]);

				el.addEvent('click', function(e){

						box.setProperty('checked', '');
						
						if (conf[0] == "sonder_keine") {
						
							$('furthermsg').setProperty('value','');	
							
						}
						
						$('gs_nothing').setProperty('value', '1');
						$('gs_keine').setProperty('value', '1');
						$('gs_ens').setProperty('value', '1');
						$('gs_weiter').setProperty('value', '1');

				}.bind(this));
			}
	
		});
		
	},
	
	
	fillstecker: function() {
	
		par.steckertyp.each(function(conf){
			var el = $(conf[0]); 
	

			el.addEvent('click', function(e){

				$('dc_decision').setProperty('value',conf[0]);
				
			}.bind(this));
	
		});
		
	},
	
	fillrs485: function() {
	
		par.komm_rs485.each(function(conf){
			var el = $(conf[0]); 
	

			el.addEvent('click', function(e){

				$('rs485_decision').setProperty('value',$(conf[0]).value);
				
			}.bind(this));
	
		});
		
	}
}

var disable_enable = {
	init: function(){
		if ($('blinkcount')) {
			this.able2();
		}
		
		if ($('errordescription_b')) {
			this.able2b();
		}
		
		if ($('furthermsg')) {
			this.able3();  
		}
				
	},
	
	able2: function() {	
		par.disable_enable.each(function(conf){
			var el = $(conf[0]);
			var effect = conf[1];		
			el.addEvent('click', function(e){	

				var box = $('blinkcount');											
				var text = $('errordescription');
				
				box.setProperty('disabled', effect);

				if (conf[0] != 'yellow_led_blink') {	

					$('blinkcount').setProperty('value','');											
		
				}
								
			}.bind(this));				

		}.bind(this));
	},

	able2b: function() {	
			var el = $('errordescription_check_b');
			var el2 = $('errorcode');
			
				
			el.addEvent('click', function(e){	
				var box = $('errordescription_b');
				var box2 = $('displayerror_b');
									
				box2.setProperty('readonly', 'readonly');
				box2.setProperty('value','');						
				box.setProperty('readonly', '');
				
			}.bind(this));				

			el2.addEvent('click', function(e){	
				var box = $('errordescription_b');
				var box2 = $('displayerror_b');
									
				box.setProperty('readonly', 'readonly');
				box.setProperty('value','');							
				box2.setProperty('readonly', '');
				
			}.bind(this));				


	},
	
	able3: function() {	
			var el = $('further');
	
			el.addEvent('click', function(e){	
				var box = $('furthermsg');	
				
				if (el.getProperty('checked') == true) {								
					box.setProperty('readonly', '');									
				} else {
					box.setProperty('readonly', 'readonly');
					box.setProperty('value','');
				}
				
			}.bind(this));
			
				
	}
}

var second_site_checked = {
	init: function(){
		if ($('val_powerline')) {
			this.display_check();	
		}	
	},
	
	display_check: function(){
		
		par.checked_elements.each(function(conf){			
			el = $(conf[0]);

			if (el.getProperty('value') == 1) {				
				el.setProperty('checked', 'checked');			
			}	
	
		}.bind(this));	
	}
}

var kind_of_service = {
	init : function(){

		if ($('auftraggeber')) {
			this.display_service();
			this.check_service();
		}
	},

	display_service: function() {
				
		if ($('auftraggeber')) {

			par.display_service.each(function(conf){

				var event_trigger = $(conf[0]);
				var effect_id = $(conf[1]);
				var effect = conf[2];
			
				event_trigger.addEvent('click', function(e){ 
				
					var myOpacity = new Fx.Style(effect_id, 'opacity', {
						duration: 350,
						transition: Fx.Transitions.linear
					});	
		
					if (event_trigger.getProperty('checked')) {
							myOpacity.start(0, 1).chain(function(){
							effect_id.setStyle('display', effect);
						});					
					}

				});	
		
			}.bind(this));				
	
		}
	},
	
	
	check_service: function() {
		

		
		if ($('service_techniker').getProperty('checked')) {
				
				var myOpacity = new Fx.Style($('serviceart_a'), 'opacity', {
					duration: 350,
					transition: Fx.Transitions.linear
				});
				var myOpacity2 = new Fx.Style($('serviceart_b'), 'opacity', {
					duration: 350,
					transition: Fx.Transitions.linear
				});
				var myOpacity3 = new Fx.Style($('auftraggeber'), 'opacity', {
					duration: 350,
					transition: Fx.Transitions.linear
				});
				
				if ($('service_techniker').getProperty('checked') ) {
					myOpacity.start(0, 1).chain(function(){
						$('serviceart_a').setStyle('display', 'block');
					});
					myOpacity2.start(1, 0).chain(function(){
						$('serviceart_b').setStyle('display', 'none');
					});	
					myOpacity3.start(0, 1).chain(function(){
						$('auftraggeber').setStyle('display', 'block');
					});										
									
				}	
						
			}

		if ($('service_versand').getProperty('checked')) {
				
				var myOpacity = new Fx.Style($('serviceart_a'), 'opacity', {
					duration: 350,
					transition: Fx.Transitions.linear
				});
				var myOpacity2 = new Fx.Style($('serviceart_b'), 'opacity', {
					duration: 350,
					transition: Fx.Transitions.linear
				});
				var myOpacity3 = new Fx.Style($('auftraggeber'), 'opacity', {
					duration: 350,
					transition: Fx.Transitions.linear
				});
				
				if ($('service_versand').getProperty('checked') ) {
					myOpacity.start(1, 0).chain(function(){
						$('serviceart_a').setStyle('display', 'none');
					});
					myOpacity2.start(0, 1).chain(function(){
						$('serviceart_b').setStyle('display', 'block');
					});						
					myOpacity3.start(0, 1).chain(function(){
						$('auftraggeber').setStyle('display', 'block');
					});
					
				}			
			}

			$('service_techniker').addEvent('click', function(e){
		
				var myOpacity = new Fx.Style($('serviceart_a'), 'opacity', {
					duration: 350,
					transition: Fx.Transitions.linear
				});
				var myOpacity2 = new Fx.Style($('serviceart_b'), 'opacity', {
					duration: 350,
					transition: Fx.Transitions.linear
				});
				var myOpacity3 = new Fx.Style($('auftraggeber'), 'opacity', {
					duration: 350,
					transition: Fx.Transitions.linear
				});
				
				if ($('service_techniker').getProperty('checked') ) {
					myOpacity.start(0, 1).chain(function(){
						$('serviceart_a').setStyle('display', 'block');
					});
					myOpacity2.start(1, 0).chain(function(){
						$('serviceart_b').setStyle('display', 'none');
					});	
					myOpacity3.start(0, 1).chain(function(){
						$('auftraggeber').setStyle('display', 'block');
					});										
										
					/* empty versand */
					$('partner_b_surname').setProperty('value','');
					$('standort_surname').setProperty('value','');
				}

			});

			$('service_versand').addEvent('click', function(e){

				var myOpacity = new Fx.Style($('serviceart_a'), 'opacity', {
					duration: 350,
					transition: Fx.Transitions.linear
				});
				var myOpacity2 = new Fx.Style($('serviceart_b'), 'opacity', {
					duration: 350,
					transition: Fx.Transitions.linear
				});
				var myOpacity3 = new Fx.Style($('auftraggeber'), 'opacity', {
					duration: 350,
					transition: Fx.Transitions.linear
				});
				
				if ($('service_versand').getProperty('checked') ) {
					myOpacity.start(1, 0).chain(function(){
						$('serviceart_a').setStyle('display', 'none');
					});
					myOpacity2.start(0, 1).chain(function(){
						$('serviceart_b').setStyle('display', 'block');
					});						
					myOpacity3.start(0, 1).chain(function(){
						$('auftraggeber').setStyle('display', 'block');
					});
										
					/* empty techniker */
					$('partner_surname').setProperty('value','');
					$('deliveryadress_surname').setProperty('value','');				
				}
			});
	}
}
