var suchlayervisible ="false";
var zaheler = 0;
function suchezeigen(lang){
  if(suchlayervisible == "false"){
    suchlayervisible="true";
    document.getElementById("suchlayer").style.display="block";
    
    if(lang == "en"){
            document.getElementById("suchtxt").innerHTML ="Hide filter option [-]";
    }else{
            document.getElementById("suchtxt").innerHTML ="Filteroptionen ausblenden [-]"; 
    }
    
  }else{
    suchlayervisible="false";
    document.getElementById("suchlayer").style.display="none";
    if (lang == "en") {
            document.getElementById("suchtxt").innerHTML ="Show filter option [+]";
    }else{
            document.getElementById("suchtxt").innerHTML ="Filteroptionen einblenden [+]";
    }
     
  }
}

function func_chng(chngimg,txt,att){
	
	
	
	
document.getElementById("detpic").src = chngimg;



if(att == 'b'){
	$("detpic").setStyles({
		'width': 450
		,'height':'auto'
	})
}else{
	$("detpic").setStyles({
		'width': 'auto'
		,'height':450
	})
}

document.getElementById("txt").innerHTML = txt;
}

function func_showdetail(){
  func_colorRow();
  if(document.getElementById("inp_showresult_on").checked == true){
    var totaldiv = document.getElementsByTagName("div").length;
    for (var i=0;i<=totaldiv-1;i++){
      if(document.getElementsByTagName("div")[i].id.indexOf("objdetail")!=-1){
      	document.getElementsByTagName("div")[i].style.display ="block";
      }
    }
  }else{
    var totaldiv = document.getElementsByTagName("div").length;
    for (var i=0;i<=totaldiv-1;i++){
      if(document.getElementsByTagName("div")[i].id.indexOf("objdetail")!=-1){
      	document.getElementsByTagName("div")[i].style.display ="none";
      }
    }
  }
}

function func_colorRow(){
  var totaltd = document.getElementsByTagName("td").length;
  for (var i=0;i<=totaltd-1;i++){
    if(document.getElementsByTagName("td")[i].id.indexOf("objrow")!=-1 && document.getElementById("inp_showresult_on").checked != true && zaheler == 0){
      document.getElementsByTagName("td")[i].style.backgroundColor ="#ffffff";
      document.getElementsByTagName("td")[i+1].style.backgroundColor ="#ffffff";
      document.getElementsByTagName("td")[i+2].style.backgroundColor ="#ffffff";
      document.getElementsByTagName("td")[i+3].style.backgroundColor ="#ffffff";
      i = i+3;
      zaheler = 1;
    }else if(document.getElementsByTagName("td")[i].id.indexOf("objrow")!=-1){
      document.getElementsByTagName("td")[i].style.backgroundColor ="#ebeaea";
      document.getElementsByTagName("td")[i+1].style.backgroundColor ="#ebeaea";
      document.getElementsByTagName("td")[i+2].style.backgroundColor ="#ebeaea";
      document.getElementsByTagName("td")[i+3].style.backgroundColor ="#ebeaea";
      i = i+3;
      zaheler = 0;
    }
  }
}

function closepop(){
	var showcover = new Fx.Tween($('cover'), {duration: 800});
  	showcover.start('opacity','0.9','0');
	
	var showpop = new Fx.Tween($('popup'), {duration: 800});
  	showpop.start('opacity','1','0');
}

function gallery(object){
	
	bh = $$('body').getScrollSize();
	$('cover').setStyles({'opacity':'0','display':'block','height' : bh[0].y+35});
	
	var showcover = new Fx.Tween($('cover'), {duration: 800});
  	showcover.start('opacity','0','0.9');
	
	//alert($('cover').getStyle('width'));
	
	/*
	$('popup').setStyles({
		'top' : '200px'
		
	});*/
	
	
	
	
	
	
	$('popup').setStyles({'opacity':'0','display':'block'});
	
	$('popup').makeDraggable();
	
	var showpop = new Fx.Tween($('popup'), {duration: 800});
  	showpop.start('opacity','0','1');
	
	
	var myRequest = new Request({
		method: 'post',
		url: root+'objects/gallery.php?hid='+object,

		onComplete: function(response) {
           
		   $('popconent').innerHTML = response;
		   
			if($('formattype').value == 'B'){
				
				$('popup').setStyles({'height':480});
				$('holder').setStyles({'height':350});
			}
			
                        
		},
		
		onRequest: function() { 		
			
			
		}
	});
	
	myRequest.send();
	
	/*
	var name = "Gallery";
	var h = 400;
	var w = 600;
	var scroll = "no";
	var LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	var TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	var settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable=no,statusbar=no'
	win = window.open("objects/gallery.php?hid="+object, name, settings);
	win.focus();*/
}




function func_colorRow2(){
  var totaltd = document.getElementsByTagName("td").length;
  for (var i=0;i<=totaltd-1;i++){
    if(document.getElementsByTagName("td")[i].id.indexOf("objrow")!=-1 && zaheler == 0){
      document.getElementsByTagName("td")[i].style.backgroundColor ="#ffffff";
      document.getElementsByTagName("td")[i+1].style.backgroundColor ="#ffffff";
      document.getElementsByTagName("td")[i+2].style.backgroundColor ="#ffffff";
      document.getElementsByTagName("td")[i+3].style.backgroundColor ="#ffffff";
      i = i+3;
      zaheler = 1;
    }else if(document.getElementsByTagName("td")[i].id.indexOf("objrow")!=-1){
      document.getElementsByTagName("td")[i].style.backgroundColor ="#ebeaea";
      document.getElementsByTagName("td")[i+1].style.backgroundColor ="#ebeaea";
      document.getElementsByTagName("td")[i+2].style.backgroundColor ="#ebeaea";
      document.getElementsByTagName("td")[i+3].style.backgroundColor ="#ebeaea";
      i = i+3;
      zaheler = 0;
    }
  }
}
