function showquickfinder(){
	$("#qfind").css({'opacity' : 0.0});
	//$(".subm").css({'opacity' : 0.0});
	size = false;

	

	
	
	$("#quickfindclick").click(function() {
		if(size == false){
			$(this).prev().animate({
				height: "330px"
			  }, 500, function() {
				  size = true;
				  $("#acco").css({'display' : 'block'});
				  $("#qfind").css({'display' : 'block'});
				  $("#quickfindclick").css({'background-position' : '-810px -679px'});
				  $('#qfind').animate({opacity: 1.0});
				  //$(".subm").css({'opacity' : 1.0});
			  });
		} else {
			if(navigator.userAgent.match("MSIE 8\.0")){
				$("#qfind").css({'display' : 'none'});
			}
			$('#qfind').animate({
				opacity: 0
			  }, 500, function() {
				  $('#quickfind').animate({
					height: "187px"
				   }, 500, function() {
					   size = false;
					   
					   $("#acco").css({'display' : 'none'});
					   $("#quickfindclick").css({'background-position' : '-810px -653px'});
				   });	
			  });	
		}
	});
}

function showcarousel(divid){
    $('#'+divid).jcarousel({
        scroll: 1,
        wrap: 'circular',
        initCallback: mycarousel_initCallback,
        buttonNextHTML: null,
        buttonPrevHTML: null
    });

    
}

function mycarousel_initCallback(carousel) {
	$('#nextsw').bind('click', function() {
		carousel.next();
		return false;
	});

	$('#backsw').bind('click', function() {
		carousel.prev();
		return false;
	});
}



function calendar(){
	$("#datepicker").datepicker({
		prevText: '< Zurück',
		nextText:  'Vor >',
		monthNames: ['Jänner','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'],
		dayNamesMin: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
		showOn: 'button', 
		buttonImage: '/static/img/datepicker.png', 
		buttonImageOnly: true,
		regional: "de",
		closeText: '', closeStatus: '',
		prevStatus: '',
		currentText: '', currentStatus: '',
		weekHeader: 'Wk', weekStatus: '',
		dateFormat: ' dd.mm.yy',
		firstDay: 1
	});

}

function menu(){

	$("#menu > ul > li").mouseover(function() {
											
			
		var p = $(this);
		var position = p.position();

		leftpos = position.left;
		if(leftpos > 398){
			newpos = 760 - 370 - leftpos;
			
			$(this).find("ul").css({'left' : newpos+'px'});
			$(this).find(".menuteaser").css({'left' : newpos+'px'});
		}

		
		$(this).find("a").addClass("sfhover");
		$(this).find("ul").css({'display' : 'block'});
		$(this).find(".menuteaser").css({'display' : 'block'});
		

		animul = p.find("ul li").length;

        if(animul > 8){
            $(this).find("ul").css("top","-197px");
            $(this).find("ul").css("height","187px");
            $(this).find(".menuteaser").css("top","-329px");
        }
		
		
		
	}).mouseout(function(){
		$(this).find("a").removeClass("sfhover");
		$(this).find("ul").css({'display' : 'none'});
		$(this).find(".menuteaser").css({'display' : 'none'});
	});

}



function infoteaser(){
	var openteaser = false;
		$("#infoteaser_bt").click(function() {
			if(openteaser == false){ 
				$("#infoteaser_content").show("slow", function () {
					openteaser = true;
				  });
			} else {
				$("#infoteaser_content").hide("slow", function () {
					openteaser = false;
				});
			}	
		}); 
		$(".close").click(function() {
			$("#infoteaser_content").hide("slow", function () {
				openteaser = false;
			});							   
		});
}

function portalteasernav(){
	anz_box = $("#portalteaser").find(".slideteaser").length;
	for(i=0; i < anz_box; i++){
		if(i == 0){
			$("#slidetesernav").append('<div class="poi on">&nbsp;</div>');
		} else {
			$("#slidetesernav").append('<div class="poi">&nbsp;</div>');
		}
	}
}

function poislide(teserslide){

	
	$(".poi").click(function () {
		window.clearInterval(teserslide);
		var index = $(".poi").index(this);
		
		anz_box = $("#portalteaser").find(".slideteaser").length;
		
		box_width = $(".slideteaser").width();
		container_width = anz_box*box_width;
		slide_width = ((anz_box*box_width) - box_width) * -1;
		
		if(index == 0){
			newpos = 0;
		}
		if(index == 1){
			newpos = (box_width* -1);
		}
		if(index == 2){
			newpos = ((box_width*2)* -1);
		}
		if(index == 3){
			newpos = ((box_width*3)* -1);
		}
		if(index == 4){
			newpos = ((box_width*4)* -1);
		}
		
		for(i=0; i<anz_box; i++){
			$(".poi").eq(i).removeClass("on");
		}
		$(".poi").eq(index).addClass("on");
		
		$("#portalteaserinlay").animate(
			{left: newpos}, 1600, function(){
			}
		);

	});

}

/*function portalteaser(){
	
	$("#slidetesernav").css({'display' : 'block'});
	anz_box = $("#portalteaser").find(".slideteaser").length;
	
	box_width = $(".slideteaser").width();
	container_width = anz_box*box_width;
	slide_width = ((anz_box*box_width) - box_width) * -1;
	$("#portalteaserinlay").css({'width' : container_width});

	pos = $("#portalteaserinlay").position().left;
	
	
	if(pos == slide_width){
		$("#portalteaserinlay").css({'left' : 0});
		elem = 1;
		for(i=0; i<anz_box; i++){
			$(".poi").eq(i).removeClass("on");
		}
		$(".poi").eq(elem-1).addClass("on");

	} else {
		if(pos == 0){
			elem = 2;
		}
		if(pos == (box_width* -1)){
			elem = 3;
		}
		if(pos == ((box_width*2)* -1)){
			elem = 4;
		}
		for(i=0; i<anz_box; i++){
			$(".poi").eq(i).removeClass("on");
		}
		$(".poi").eq(elem-1).addClass("on");

		$("#portalteaserinlay").animate(
			{left: pos - box_width}, 1600, function(){


			}
		);
	}
}*/


function webcams(){
	$(".webcam a").fancybox({
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'width' : 660,
		'height' : 590
	});
}




function box(){
	
	$(".pic a").fancybox({

		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic'
	});

    $(".picture a").fancybox({
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic'
	});

    $(".picture a.iframe").fancybox({
        'width' : 640,
        'height' : 590,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic'
	});

}


function gotoLink (htmlElement) {
	var destinationURL = "";
	var target = "";
	
	if(htmlElement.href) {
		destinationURL = htmlElement.href;
		target = htmlElement.getAttribute("target");
	}
	else {
		if(htmlElement.childNodes) {
			if(htmlElement.getElementsByTagName("a")) {
				destinationURL = htmlElement.getElementsByTagName("a")[0].href;
				target = htmlElement.getElementsByTagName("a")[0].getAttribute("target");
			}
		}
	}
	
	if(target == "_blank") {
		window.open(destinationURL);
	}
	else {
		location.href = destinationURL;
	}
}

function showlink(link, target){
	if(target == "_self"){
		document.location.href = link;
	} else {
		window.open(link);
	}
}

function showlinkemail(link){
	document.location.href ="mailto:"+link;
}
















