$(document).ready(  function(){ 
	$('DIV.categories:not(:has(DIV.gal-listview))').click(function() {
		  var linkziel = $(this).find('h2 a:first').attr('href');
		  if(linkziel != undefined) {
		  	document.location.href = document.location.protocol + "//" + document.location.host + "/" + linkziel;
		  }
		  });
	$('DIV.categories h2:has(a)').parents('.categories').addClass("arrow");
	$('a[href^="http://www.expoformer.ch/"]').click(function() {
		$.cookie("wwwexpoformerch", true, { path: '/', domain: 'expoformer.ch' });
	});
$('DIV.galitem-cols').click(function() {
		  var linkziel = $(this).find('a:first').attr('href');
		  if(linkziel != undefined) {
			  // fix wegen coolURI...
		  	document.location.href = document.location.protocol + "//" + document.location.host +"/" + linkziel;
		  }
 });
//SKALIERUNG GALERIEBILD FUER IPHONE:
	var agent=navigator.userAgent.toLowerCase();
	if ((agent.indexOf("iphone") != -1) || (agent.indexOf("ipod") != -1)) {
		var checkOrientation = setInterval(updateOrientation,400);
	}
	function updateOrientation(){
		var orient = "";
		switch(window.orientation){
			case 0: orient = "portrait"; break;
			case -90: orient = "landscape"; break;
			case 90: orient="landscape"; break;
		}
		setOrient(orient);
	}
	function setOrient(orient){
		if(orient == "landscape") {
			$("body").addClass("landscape");
		} else {
			$("body").removeClass("landscape");			
		}
		var gW = parseInt($("DIV.tx-nwshowcase-pi1").css("width")) - parseInt($("DIV.tx-nwshowcase-pi1").css("padding-left"));
		$("#nwsc-grossbild ").attr("width",gW);
		$("#nwsc-grossbild ").attr("height",gW);
	}
});

