Cufon.replace('#navigation ul li a, .intro .slider .slider-nav ul li a span.text, h3, p.button a, h2, #footer .footer-nav li a, .inner-intro p, .profile-page #sidebar ul li p , .profile-page #sidebar ul li h4, .pro-button a, .news-page #sidebar ul li a, .news-page p.first, .news-page .entry a, .contact-info-entry p, form label, .news-page #sidebar ul li h4, .news-page .content-b  p.last, .entry ul li, .entry ol li, a.more', { hover: true });

jQuery(document).ready(function($){ 
 	
	$.fn.equalize_height = function() {
		var h = 0;
		var collection = $(this);	
		collection.each(function() {
			if ($(this).height() > h) {
				h = $(this).height();
			}
		});
		collection.each(function() {
			$(this).height(h);
		});
	}
	
	$('.equalize').equalize_height();
	
	$('form .selects').jqTransform();
	
 	//PNG FIX for IE6
	if($.browser.msie && $.browser.version.substr(0,1) == 6 ){
		DD_belatedPNG.fix('#sidebar ul li .image-info, #header, h1#logo a, #navigation ul li, .intro .slider .slider-carousel ul li .white-bg, p.button a, #sidebar, .sidebar-t, .sidebar-b, p.more a, .content, .content-t, .content-b, .inner-intro, .inner-intro .intro-entry .entry-t, .inner-intro .intro-entry .entry-bg, .inner-intro .intro-entry .entry-b, .sub-page .sub-page-t, .sub-page .sub-page-b, ul.news-list li, .news-page .sub-page-b, .contact-page #main, .contact-form-t, .contact-form, .contact-form-b, form span, input.submit, #footer, .fixpng')
	}
	
	  $(function($){
            $('.blink').
                focus(function() {
                    if(this.title==this.value) {
                        this.value = '';
                    }
                }).
                blur(function(){
                    if(this.value=='') {
                        this.value = this.title;
                    }
                });
				
			$('.blink').blur();
        })

/* slider for all browsers, except IE */
	if ( ! $.browser.msie ) {	
		$('.slider-nav ul > li a').eq(0).addClass('slider-active');
		function show_slide(slide_index, hover) {
			
			var current_slide = $('.slider-carousel > ul > li:visible');
			var slide_to_show = $('.slider-carousel > ul > li:eq(' + slide_index + ')');
			if (hover) { 
				current_slide.stop(true, true).fadeOut('slow');
				$('.slider-nav ul > li a:visible').removeClass('slider-active');
				slide_to_show.stop(true, true).fadeIn('slow');
			} else {
	
				current_slide.stop(true, true).fadeOut('slow');
				slide_to_show.stop(true, true).fadeIn('slow');
				$('.slider-nav ul > li a:visible').removeClass('slider-active');
				$('.slider-nav ul > li:eq(' + slide_index + ')').find('a').addClass('slider-active');
				
	
			}	
		}
		var slideshow_change_interval;
	
		function loop_slides(start_index) {
			var current_slideshow_index = start_index;
			slideshow_change_interval = setInterval(function () {
				var next_slideshow_index = current_slideshow_index++ % $('.slider-nav li').length;
				show_slide(next_slideshow_index);
	
			}, 10000);
		}
		loop_slides(1);
	
		$('.slider').hover(
			function () { clearInterval(slideshow_change_interval); },
			function () { 
				var next_slide_index = $('.slider-carousel > ul > li:visible').index() + 1;
				loop_slides(next_slide_index); 
			}
		);
	
		$('.slider-nav li').hover(
			function() { 
				var hovered = $('.slider-nav li').index($(this));	
				show_slide(hovered, true);
			}, function() {
				$(this).find('a').removeClass('slider-active');
			}
		);	
	};
/* end general slider */	


/* slider for IE */
	if ( $.browser.msie ) {
		var SlideShow = setInterval( "slideSwitch()", 10000 );
		$('.intro .slider li:first').css('display', 'block');
		$('.slider-nav li:first a').addClass('slider-active');
		
		$('.slider-nav li').hover(
			function() { 
				clearInterval(SlideShow);
				$('.slider-nav li a').removeClass('slider-active');
				$(this).find('a').addClass('slider-active');
				var id = parseInt($(this).find('a').attr('rel')) - 1;
				var hovered = $('.intro .slider li:eq(' + id + ')');
				//hovered.css('display', 'block');
				slideSwitch(hovered);
			}, function() {
				var id = parseInt($(this).find('a').attr('rel'));
				SlideShow = setInterval( "slideSwitch()", 10000 );
			}
		);
	}

});

function slideSwitch(switch_to, start_from) {
	if ( switch_to == undefined ) {
		
    	var $active = $('.intro .slider li.active');
    	
	    if ( $active.length == 0 ) $active = $('.intro .slider li:first');
	    var id_active = parseInt($active.index());
    	
	    var $next =  $active.next().length ? $active.next() : $('.intro .slider li:first');
	    var id_next = parseInt($next.index());
	    
	    $active.addClass('last-active');
	
	    $next.css({opacity: 0.0})
	        .addClass('active')
	        .css('display', 'block')
	        .animate({opacity: 1.0}, 2000, function() {
	            $active.removeClass('active last-active').css('display', 'none');
	            $('.slider-nav li:eq(' + id_next + ') a').addClass('slider-active');
	            $('.slider-nav li:eq(' + id_active + ') a').removeClass('slider-active');
	        });
	} else {
		var $active = $('.intro .slider li.active');
		
		if ( $active.length == 0 ) $active = $('.intro .slider li:first');
	
	    var $next = switch_to;
	    
    	if ( $active.is(':visible') ) {
    		$active.removeClass('active last-active').css('display', 'none');
    	};
    	if ( ! $next.is(':visible') ) {
	    	$next.addClass('active').css('display', 'block');
	    };
	};
}
