$(document).ready(function(){
	// background image
	$("#bgimg").fadeIn(100);
	$("#bgimg").fullscreenr({
		width: 1024,
		height: 768,
		bgID: '#bgimg'
	});
	// product hover
	$("#home li a,#overview li a,#producer-products li a").hover(function(){
		$(this).removeClass('unselected');
		if($.browser.msie){
			$('.unselected').children(".darken").stop().css('display','block');
		}else{
			$('.unselected').children(".darken").stop().fadeTo('fast',0.4);
		}
	},function(){
		if($.browser.msie){
			$('.unselected').children(".darken").stop().css('display','none');
		}else{
			$('.unselected').children(".darken").stop().fadeTo('fast',0.0);
		}
		$(this).addClass('unselected');
	});
	// general hover
	$(".opacity").hover(function(){
		$(this).fadeTo(200,0.7);
	},function(){
		$(this).fadeTo(200,1.0);
	});
	// fade in
	$(".hide-n-seek").fadeIn(500);
	// product thumbnail switcher
	$("#product-thumbnails a").click(function(){
		$("#product-thumbnails a.active").removeClass('active');
		$(this).addClass('active');
		var fileName = $(this).children("img").attr("longdesc").split("|");
		$("#product-image a img").stop().fadeTo(200,0.0,function(){
			if($(this).parent().hasClass('zoomable')){
				$(this).parent().removeClass('zoomable');
			}
			if(fileName[2]<396){
				$(this).parent().removeAttr('href');
			}else{
				$(this).parent().addClass('zoomable');
				$(this).parent().attr('href','files/'+fileName[1]);
			}
			$(this).attr('src',fileName[0]);
			$(this).fadeTo(200,1.0);
		});
	});
	// zoom
	var jqZoomOptions = {
		zoomWidth:540,
		zoomHeight:494,
		zoomType:'reverse',
		showEffect:'fadein',
		fadeinSpeed:'medium',
		hideEffect:'fadeout',
		fadeoutSpeed:'medium',
		title:false,
		yOffset:-19,
		xOffset:9,
		preloadText:'zoom'
	}
	$("#product-image a.zoomable").jqzoom(jqZoomOptions);
	$("#product-image a").click(function(){ return false; });
	// content h1 span
	var titTxt = $(".content h1").html();
	$(".content h1").html("<span>"+titTxt+"</span>");
	// team
	$("#team-members li a").click(function(){
		var teamMember = $(this).attr("rev").split("|");
		$(this).parent().parent().children("li").children("a").children("img.active").removeClass("active");
		$(this).children("img.hidden").addClass("active");
		$("#team-member").html("<h1><span>"+teamMember[0]+"</span></h1><p><strong>"+teamMember[1]+"</strong><br />Tel: "+teamMember[2]+"<br /><a href='mailto:"+teamMember[3]+"'>E-Mail an "+teamMember[0]+"</a></p>");
	});
	// forms
	//$("input.radio").addClass("jquery-mobitare-checkbox");
	$(".formlabel-pobox label,.formlabel-telp label,.formlabel-telg label,label.textarea").addClass("no-bg");
	$('input:radio').checkbox({cls:'jquery-mobitare-checkbox'});
	$("div.rex-message").parent().children("p").css("display","none");
	// form validation
	$("form#newsletterform").validate();
	// fancybox
	$("a[class*=issuu]").fancybox({
		'autoScale'			: false,
		'titleShow'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'overlayOpacity'	: 0.7,
		'overlayColor'		: '#000000'
	});
});
$(window).load(function(){
});
$(window).resize(function(){
});
// gmap
function initializeGmap(gMapLat,gMapLng,gMapZoom,gMapElementId,gMapImage){
	var latlng = new google.maps.LatLng(gMapLat,gMapLng);
	var myOptions = {
		zoom: gMapZoom,
		center: latlng,
		mapTypeControl: true,
		mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DEFAULT},
		navigationControl: true,
		navigationControlOptions: {style: google.maps.NavigationControlStyle.DEFAULT},
		mapTypeId: google.maps.MapTypeId.ROADMAP
	};
	var map = new google.maps.Map(document.getElementById(gMapElementId), myOptions);
	var image = gMapImage;
	var spotMarker = new google.maps.Marker({
		position: latlng,
		map: map,
		icon: image
	});
}

