/*
Container switcher
by Sindre Wimberger 
v(0.0.2) 08.03.2006
v(0.0.3) 20.04.2007 - scale von px in em umgebaut | Sindre Wimberger

*/

var switchstate;
var exhibitionid;
var shopnid;

function switchstateinfo() {
if (document.switchs) {
switchstate = '';
if (document.switchs.txt.checked==true) {switchstate = 'txt';}
if (document.switchs.img) {if (document.switchs.img.checked==true) {switchstate = switchstate+"img";}}
if (document.switchs.sho) {if (document.switchs.sho.checked==true) {switchstate = switchstate+"sho";}}
requesturl='/content/switcher.php?status='+switchstate+'';
new Ajax.Request(requesturl);
}
}
function ajax_updater(containerid) {
    switchstateinfo();
	if (switchstate=='imgsho') {var img_size = "80"; }
	else if (switchstate=='txtimgsho') {var img_size = "100";}
	else {var img_size = "120"; }
	document.getElementById(containerid).innerHTML ='';
	var objLoaderImagetest = document.getElementById('loaderImage'+containerid);
    if (!objLoaderImagetest) {
    var objloaderImageDiv = document.createElement("div");
	objloaderImageDiv.setAttribute('id','loaderImage'+containerid);
	objloaderImageDiv.innerHTML = '<p>Loading</p>';
	document.getElementById(containerid).appendChild(objloaderImageDiv);	
	}
	var objLoaderImage = document.getElementById('loaderImage'+containerid);	
	if (containerid=='bildi') {url='/content/ajax.php?size='+img_size+'&what=image&type=exhibition&id='+exhibitionid+'';}
	if (containerid=='shopi') {url='/content/ajax.php?size='+img_size+'&what=image&type=shop&id='+exhibitionid+'';}	
    new Ajax.Updater(containerid, url, {
      asynchronous : true,
//	  parameters : , 
      onFailure : function(resp) { objLoaderImage.innerHTML = '<p>Fehler bei Datenabfrage</p>'; },
      onXXX : function(resp) { objLoaderImage.innerHTML = '<p>Fehler bei Datenabfrage</p>'; },
      onComplete : function(resp) { if (objLoaderImage) { objLoaderImage.style.display = 'none';initLightbox();}  }
      } 
   );  
}
function textswitcher() {
var textWidth;
var imgWidth;
var shoWidth;
   if (switchstate=='txtimgsho') {
       textWidth = new fx.Sensible('texti').customx(16.67, 0);
//	   textopacity = new fx.Opacity('texti').custom(1, 0)
       imgWidth = new fx.Sensible('bildi').customx(8.67, 17.08);
       shoWidth = new fx.Sensible('shopi').customx(8.67, 17.08);
	   ajax_updater('bildi');
	   ajax_updater('shopi');	   	   	   
   }
   else if (switchstate=='txtimg') {
       textWidth = new fx.Sensible('texti').customx(23.3, 0);
       imgWidth = new fx.Sensible('bildi').customx(10.3, 34.17);
	   ajax_updater('bildi');	   
   }
   else if (switchstate=='txtsho') {
       textWidth = new fx.Sensible('texti').customx(23.3, 0);
       shoWidth = new fx.Sensible('shopi').customx(10.3, 34.17);
	   ajax_updater('shopi');	   	   	   
   }
   else if (switchstate=='txt') {
       textWidth = new fx.Sensible('texti').customx(35, 0);
   }
   else if (switchstate=='imgsho') {
       textWidth = new fx.Sensible('texti').customx(0, 15.83);
       imgWidth = new fx.Sensible('bildi').customx(17.08, 8.67);
       shoWidth = new fx.Sensible('shopi').customx(17.08, 8.67);
	   ajax_updater('bildi');
	   ajax_updater('shopi');	   	   
   }
   else if (switchstate=='img') {
       textWidth = new fx.Sensible('texti').customx(0, 23.3);
       imgWidth = new fx.Sensible('bildi').customx(34.17, 10.3);   	   
   }
   else if (switchstate=='sho') {
       textWidth = new fx.Sensible('texti').customx(0, 23.3);
       shoWidth = new fx.Sensible('shopi').customx(34.17, 10.3);
   }
   else if (switchstate=='') {
//	   if (browser == 'Internet Explorer')	{document.getElementById('texti').style.display = 'block';}
       textWidth = new fx.Sensible('texti').customx(0, 35);
   }   
}
function imgswitcher() {
var textWidth;
var imgWidth;
var shoWidth;
   if (switchstate=='txtimgsho') {
       textWidth = new fx.Sensible('texti').customx(16.67, 23.3);
       imgWidth = new fx.Sensible('bildi').customx(8.67, 0);
       shoWidth = new fx.Sensible('shopi').customx(8.67, 10.3);
	   ajax_updater('shopi');	   	   
   }
   else if (switchstate=='txtimg') {
       textWidth = new fx.Sensible('texti').customx(23.3, 35);
       imgWidth = new fx.Sensible('bildi').customx(10.3, 0);
   }
   else if (switchstate=='txtsho') {
       textWidth = new fx.Sensible('texti').customx(23.3, 15.83);
       imgWidth = new fx.Sensible('bildi').customx(0, 8.67);	   
       shoWidth = new fx.Sensible('shopi').customx(10.3, 8.67);
	   ajax_updater('bildi');
	   ajax_updater('shopi');	   
   }
   else if (switchstate=='txt') {
       textWidth = new fx.Sensible('texti').customx(35, 23.3);
       imgWidth = new fx.Sensible('bildi').customx(0, 10.3);	 
	   ajax_updater('bildi');	     	   
   }
   else if (switchstate=='imgsho') {
       imgWidth = new fx.Sensible('bildi').customx(17.08, 0);
       shoWidth = new fx.Sensible('shopi').customx(17.08, 34.17);
	   ajax_updater('shopi');	     	   	   
   }
   else if (switchstate=='img') {
       imgWidth = new fx.Sensible('bildi').customx(34.17, 0);
   }
   else if (switchstate=='sho') {
       imgWidth = new fx.Sensible('bildi').customx(0, 17.08);	   
       shoWidth = new fx.Sensible('shopi').customx(34.17, 17.08);
	   ajax_updater('bildi');	 
	   ajax_updater('shopi');	     	   	   	     
   }
   else if (switchstate=='') {
       imgWidth = new fx.Sensible('bildi').customx(0, 34.17);
	   ajax_updater('bildi');	   
   }    
}
function shoswitcher() {
var textWidth;
var imgWidth;
var shoWidth;
   if (switchstate=='txtimgsho') {
       textWidth = new fx.Sensible('texti').customx(15.83, 23.3);
       imgWidth = new fx.Sensible('bildi').customx(8.67, 10.3);
       shoWidth = new fx.Sensible('shopi').customx(8.67, 0);
	   ajax_updater('bildi');
	   ajax_updater('shopi');	   	   
   }
   else if (switchstate=='txtimg') {
       textWidth = new fx.Sensible('texti').customx(23.3, 15.83);
       imgWidth = new fx.Sensible('bildi').customx(10.3, 8.67);
       shoWidth = new fx.Sensible('shopi').customx(0, 8.67);
	   ajax_updater('bildi');
	   ajax_updater('shopi');	   	   
   }
   else if (switchstate=='txtsho') {
       textWidth = new fx.Sensible('texti').customx(23.3, 35);
       shoWidth = new fx.Sensible('shopi').customx(10.3, 0);
   }
   else if (switchstate=='txt') {
       textWidth = new fx.Sensible('texti').customx(35, 23.3);
       shoWidth = new fx.Sensible('shopi').customx(0, 10.3);
	   ajax_updater('shopi');	   	   
   }
   else if (switchstate=='imgsho') {
       imgWidth = new fx.Sensible('bildi').customx(17.08, 34.17);
       shoWidth = new fx.Sensible('shopi').customx(17.08, 0);
	   ajax_updater('bildi');
   }
   else if (switchstate=='img') {
       imgWidth = new fx.Sensible('bildi').customx(34.17, 17.08);
       shoWidth = new fx.Sensible('shopi').customx(0, 17.08);
	   ajax_updater('bildi');
	   ajax_updater('shopi');	   	   
   }
   else if (switchstate=='sho') {
       shoWidth = new fx.Sensible('shopi').customx(34.17, 0);
   }
   else if (switchstate=='') {
       shoWidth = new fx.Sensible('shopi').customx(0, 34.17);
	   ajax_updater('shopi');	   	   
   }    
}
function hideGobutton()
{
	objGobutton = document.getElementById('gobutton');
	if (objGobutton) {objGobutton.style.display = 'none';}
}

addLoadEvent(switchstateinfo);
addLoadEvent(hideGobutton);