﻿

$(document).ready(function(){

		$("a[rel^='prettyPhoto']").prettyPhoto({
												slideshow:3000, 
											//	autoplay_slideshow:false //true
												});


		$(".cornerdiv").corner("10px");
		$("a.darkBg").corner("6px");
//		$(".loginbar").corner("top cc:#333 0px").corner("bottom cc:#fff 10px");



//		$('.loginbar').delay(0).fadeIn(1000);




		$('.slideshow, .slideshowHalf').cycle({ 
			fx:      	'scrollHorz',
//		    speed:    	1500,
			timeout:  	6000,
//			sync:   	0,
			easing: 'backinout', 
			next:   '#nextSlide', 
		    prev:   '#prevSlide',
			pause:  1 
		});
		$('.slideshowTop, .footerslideshow').cycle({ 
			fx:      'scrollLeft',
			timeout:  6000,
			speed:    1500,
			sync:   	0,
			pause:  1 
		});		
		$('.slideshowFade').cycle({ 
			fx:      	'fade',
//		    speed:    	1500,
			timeout:  	3000,
//			sync:   	0,
//			easing: 'backinout', 
//			next:   '#nextSlide', 
//		    prev:   '#prevSlide',
			pause:  1 
		});





		$("ul.sf-menu").supersubs({ 
            minWidth:    12,   // minimum width of sub-menus in em units 
            maxWidth:    27,   // maximum width of sub-menus in em units 
            extraWidth:  1,    // extra width can ensure lines don't sometimes turn over 
                               // due to slight rounding differences and font-family 
			delay:         100
			}).superfish();  // call supersubs first, then superfish, so that subs are 
                         // not display:none when measuring. Call before initialising 
                         // containing tabs for same reason. 


		$("a.fadeFx, .submenu ul li a, .galleryHolder a").fadeTo("slow", 1.0); // This sets the opacity of the thumbs to 100% when the page loads
		$("a.fadeFx, .submenu ul li a, .galleryHolder a").hover(function(){
			$(this).fadeTo("fast", 0.4); // This should set the opacity to 60% on hover
			},function(){
			$(this).fadeTo("slow", 1.0); // This should set the opacity back to 1000% on mouseout
			});


/*Since all the tabs are hidden with css we are displaying the tab with class .active_tab using fadeIn()
function. If you just want it to show with no effect, just put show() instead of fadeIn() */
        $('.active_tab').fadeIn();
        
        //when a tab link is clicked...
        $('.tab_link').live('click', function(event){
            
            /*...prevent the default behaviour...*/
            event.preventDefault();
            
            /* ...remove the tab_link_selected class from current active link... */
            $('.tab_link_selected').removeClass('tab_link_selected');
            
            /* ...and add it to the new active link */
            $(this).addClass('tab_link_selected');
        
            /*...get the title attribute (which corensponds to the id of the needed text container),
            but you can use any attribute you want*/
            var container_id = $(this).attr('title');
            
            //...animate the current active_tab by changing it's height and opacity ...'
            $('.active_tab').animate({ 
                
                height : 'toggle' , opacity : 'toggle' 
                
            //...and when that animation ends...
            },function(){
            
                //...remove the active_tab class from the current active tab...
                $(this).removeClass('active_tab');
                
                //...and add that class to the tab that corensponds the clicked link...
                $(container_id).addClass('active_tab');
                
                //...and animate the new active_tab by using toggle on height and opacity again...
                $('.active_tab').animate({
                   
                    height : 'toggle' , opacity : 'toggle'
                    
                });
            });
            
        });            








	$('.message').prettyComments({animate: true, maxHeight:250});



/*
//*Nice hover things:

	$('#nav li').hover(
		function () {
			//show its submenu
			$('ul', this).slideDown(100);

		}, 
		function () {
			//hide its submenu
			$('ul', this).slideUp(100);			
		}
	);





	//$("#afterhover").slideUp({ duration: 1000, easing: method, complete: callback}); 

		/*
		$("#mouseout").hover(
			function(e){
				$("#afterhover").slideDown({ duration: 1000 }); 
			},
			function(){
				//$("#afterhover").slideUp({ duration: 1000 }); 
			}
		);
		
		$("#mouseout").click(
			function(e){
				$("#afterhover").slideDown({ duration: 1000 }); 
			}
		);

		$("#afterhover").hover(
			function(){},
			function(){
				$("#afterhover").slideUp({ duration: 1000 }); 
			}
		);
*/
		//$("#afterhover").slideUp({ duration: 1000 }); 
		
		
/* Hover efect for li mouse over
 * @author Alexander Farkas
 * v. 1.02
 */
(function($) {
	$.extend($.fx.step,{
	    backgroundPosition: function(fx) {
            if (fx.state === 0 && typeof fx.end == 'string') {
                var start = $.curCSS(fx.elem,'backgroundPosition');
                start = toArray(start);
                fx.start = [start[0],start[2]];
                var end = toArray(fx.end);
                fx.end = [end[0],end[2]];
                fx.unit = [end[1],end[3]];
			}
            var nowPosX = [];
            nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
            nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];
            fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];

           function toArray(strg){
               strg = strg.replace(/left|top/g,'0px');
               strg = strg.replace(/right|bottom/g,'100%');
               strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
               var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
               return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
           }
        }
	});
})(jQuery);

            $(function(){
                $('.footerLinks li')
                    .css( {backgroundPosition: "0 0px"} )
                    .mouseover(function(){
                        $(this).stop().animate(
							 { backgroundPosition:"(9px 0px)"},
							 { queue: false,
							   duration: 300,
							   easing: 'easeOutElastic'
						})
                    })
                    .mouseout(function(){
                        $(this).stop().animate({backgroundPosition:"(0 0px)"}, {duration:400, complete:function(){
                            $(this).css({backgroundPosition: "0 0px"})
                        }})
                    })
            });

            $(function(){
                $('.leftmenu a')
                    .css( {backgroundPosition: "-5px 10px"} )
                    .mouseover(function(){
                        $(this).stop().animate(
							 { backgroundPosition:"(5px 10px)"},
							 { queue: false,
							   duration: 300,
							   easing: 'easeOutElastic'
						})
                    })
                    .mouseout(function(){
                        $(this).stop().animate({backgroundPosition:"(-5px 10px)"}, {duration:400, complete:function(){
                            $(this).css({backgroundPosition: "-5px 10px"})
                        }})
                    })
            });


		

});




jQuery.fn.topLink = function(settings) {
		settings = jQuery.extend({
			min: 1,
			fadeSpeed: 200,
			ieOffset: 50
		}, settings);
		return this.each(function() {
			//listen for scroll
			var el = $(this);
			el.css('display','none'); //in case the user forgot
			$(window).scroll(function() {
				if(!jQuery.support.hrefNormalized) {
					el.css({
						'position': 'absolute',
						'top': $(window).scrollTop() + $(window).height() - settings.ieOffset
					});
				}
				if($(window).scrollTop() >= settings.min)
				{
					el.fadeIn(settings.fadeSpeed);
				}
				else
				{
					el.fadeOut(settings.fadeSpeed);
				}
			});
		});
	};
	
	$(document).ready(function() {
		$('#top-link').topLink({
			min: 400,
			fadeSpeed: 500
		});
		//smoothscroll
		$('#top-link').click(function(e) {
			e.preventDefault();
			$.scrollTo(0,300);
		});
	});




//			var flashvars = {};
//			var params = {wmode: "transparent"};
//			var attributes = {};
//			swfobject.embedSWF("flash/inproject_bg.swf", "mybg", "950", "550", "9.0.0","expressInstall.swf", flashvars, params, attributes);

