//document.body.page
//nivo slider
jQuery(document).ready(function($) {
	
	
	$(".wc-prev img").css("pointer-events", "none")
	$(".wc-next img").css("pointer-events", "none")
	
	/*$(".content").css("display", "none");
 
    $(".content").fadeIn(500);
 
    $("a").click(function(event){
        event.preventDefault();
        linkLocation = this.href;
        $(".content").fadeOut(200, redirectPage);
    });
 
    function redirectPage() {
        window.location = linkLocation;
    }*/
	
	
	 $('#slider').nivoSlider({
        effect:'fade',
		 animSpeed:500,
        pauseTime:4000,
       
      controlNavThumbs:true,
  	  controlNavThumbsFromRel:true
        
	});
  
  
  $("li").each(function (i) {
  	if($(this).attr("id") == "curpage"){
    	$(this).children().css({ backgroundColor: $(this).attr("clr"),color: "white" }, 300);
		
    }
   
	})
 	
checkToBottomShowOrHide()
$(window).resize(function() {
  checkToBottomShowOrHide()
})

function checkToBottomShowOrHide(){	
	if($("body").prop("scrollHeight") < $(window).height()){
			$('#to-bottom').hide()
		}else{
			$('#to-bottom').show()
		}
}



//Hide (Collapse) the toggle containers on load
	$(".toggle_container").hide(); 

	//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
	$("h2.trigger").click(function(){
		$(this).toggleClass("active").next().slideToggle("slow");
		return false; //Prevent the browser jump to the link anchor
	});
	
	
		
  
});


$(function(){


//img captify

	$('img.captify').captify({
		// all of these options are... optional
		// ---
		// speed of the mouseover effect
		speedOver: 'fast',
		// speed of the mouseout effect
		speedOut: 'normal',
		// how long to delay the hiding of the caption after mouseout (ms)
		hideDelay: 200,	
		// 'fade', 'slide', 'always-on'
		animation: 'slide',		
		// text/html to be placed at the beginning of every caption
		prefix: '',		
		// opacity of the caption on mouse over
		opacity: '0.7',					
		// the name of the CSS class to apply to the caption box
		className: 'caption-bottom',	
		// position of the caption (top or bottom)
		position: 'bottom',
		// caption span % of the image
		spanWidth: '100%'
	});



//menu hover
	$('#nav a')
		.mouseover(function(){
        	if($(this).parent().attr("id") != "curpage"){
       			$(this).animate({ backgroundColor: $(this).parent().attr("clr"),color: "white" }, 300);
            }
		})
		.mouseout(function(){
      	  if($(this).parent().attr("id") != "curpage"){
        		$(this).animate({ backgroundColor: "white", color: "#636466"}, 300);
            }   
		})
        
        //tooltip
    $('.tip').poshytip({
        className: 'tip-twitter',
        showTimeout: 1,
        alignTo: 'target',
        alignX: 'center',
        offsetY: 5,
        allowTipHover: false,
        fade: true,
        slide: false
    });
	
	
	$('#to-bottom').click(function(){
	//	alert("$(window).scrollTop():"+$(window).scrollTop()+"\n$(body').prop(''scrollHeight'):"+$("body").prop("scrollHeight")+"\n$(window).height():"+$(window).height()+"\n($(body).prop(scrollHeight)-$(window).height()):"+($("body").prop("scrollHeight")-$(window).height()));
		//alert($("body").prop("scrollHeight"))
		if(($("body").prop("scrollHeight")-$(window).height()) > $(window).scrollTop()){
			$.scrollTo({top:$("body").prop("scrollHeight")+'px', left:'0px'}, 300 );  
		}else{
		//	alert("NOSCROLL")	
		}
		
	});
	
	$('#graphisoft-map').css("display", "none")
	$('#budafoki').mouseover(function(){
		$('#graphisoft-map').css("display", "none")
		$('#budafoki-map').css("display", "block")
		$('#kapcsolat-maps-arrow').animate({marginTop:"25"}, 200);
	})
	$('#graphisoft').mouseover(function(){
		$('#graphisoft-map').css("display", "block")
		$('#budafoki-map').css("display", "none")
		$('#kapcsolat-maps-arrow').animate({marginTop:"95"}, 200);
		//$('#kapcsolat-maps-arrow').css("margin-top","65")
	})
	
	
	
	
	
	$("div.wc-next").mouseover(function(){
		$('#workchooser-next').animate({marginRight:"0"}, 150);
	})
	$("div.wc-next").mouseout(function(){
		$('#workchooser-next').animate({marginRight:-$('#workchooser-next').width()-10}, 150);
	})
	
	$("div.wc-next").click(function(){
		window.location = $("div.wc-next").attr("hrf")
	})
		
		
	$("div.wc-prev").mouseover(function(){
		$('#workchooser-prev').animate({marginLeft:"0"}, 150);
	})
	$("div.wc-prev").mouseout(function(){
		$('#workchooser-prev').animate({marginLeft:-$('#workchooser-prev').width()-10}, 150);
	})
	
	$("div.wc-prev").click(function(){
		window.location = $("div.wc-prev").attr("hrf")
	})
	
	$('#workchooser-prev').css("marginLeft",-$('#workchooser-prev').width()-10)
	$('#workchooser-next').css("marginRight",-$('#workchooser-next').width()-10)
	
});


