if ( $.browser.webkit) {
	$(window).load(function() {	
		// vertical scroll	
		$('.scroll-pane').jScrollPane({
			showArrows:false,
			scrollbarWidth:27,
			dragMaxHeight:77
		});					   
	})
} else{
	$(document).ready(function() {	
		// vertical scroll	
		$('.scroll-pane').jScrollPane({
			showArrows:false,
			scrollbarWidth:27,
			dragMaxHeight:77
		});					   
	})
}
$(document).ready(function() {		
	//images hover
	$('.hover_img .img_act').css({opacity:'0', visibility:'hidden'})
	$('.hover_img').hover(function(){
			$(this).find('.img_act').css({visibility:'visible'}).stop().animate({opacity:'1'},400, function(){$(this).css({opacity:'none'})})
		}, function(){
			$(this).find('.img_act').stop().animate({opacity:'0'},400, function(){$(this).css({visibility:'hidden'})})
		}
	)
	// portfolio
	$('.gallery1').roundabout({
			 shape: 'waterWheel',
           minOpacity: 0.2,
           maxOpacity: 1.0,
        	 minScale: 0.5,
        	 maxScale: 1,
       	     btnNext: '#prev1',
             btnPrev: '#next1',
			 easing:'easeOutExpo',
			 clickToFocus:'true',
			 focusBearing:'1',
			 duration:800,
			 tilt:'0',
			 reflect:true
	});
	$('.gallery2').roundabout({
			 shape: 'waterWheel',
           minOpacity: 0.2,
        	 minScale: 0.5,
        	 maxScale: 1,
       	     btnNext: '#prev2',
             btnPrev: '#next2',
			 easing:'easeOutExpo',
			 clickToFocus:'true',
			 focusBearing:'1',
			 duration:800,
			 tilt:'0',
			 reflect:true
	});
	$('.gallery3').roundabout({
			 shape: 'waterWheel',
           minOpacity: 0.2,
        	 minScale: 0.5,
        	 maxScale: 1,
       	     btnNext: '#prev3',
             btnPrev: '#next3',
			 easing:'easeOutExpo',
			 clickToFocus:'true',
			 focusBearing:'1',
			 duration:800,
			 tilt:'0',
			 reflect:true
	});

	$('.portfolio li a').css({display:'none'});
  $.each(['-webkit-border-image', '-moz-border-image', 'border-image'], function(index, value){
    $('.portfolio li').find('.img').css(value, 'url(images/border-image.blackToGrey.png) 5 5 5 5 stretch');
  });
  //$('.portfolio li').find('.img').css({'-webkit-border-image':'url(images/border-image.blackToGrey.png) 5 5 5 5 stretch', '-moz-border-image':'url(images/border-image.blackToGrey.png) 5 5 5 5 stretch'});
	$('.portfolio li').hover(function(){
			if ($(this).hasClass('roundabout-in-focus')) {
				$(this).find('a').css({display:'block'});
				//$(this).find('.img_act').css({display:'block'}).stop().animate({opacity:'1'}, 400, function(){$(this).css({opacity:'none'})})
        //$(this).find('.img').css({background:'#fe5312'}).stop().animate({opacity:'1'}, 400, function(){$(this).css({opacity:'none'})})
        // WORKING: $(this).find('.img').css({background:'#595FFF'})
        if($(this).find('.img').attr('highlightColor') !== undefined) {
          $.each({'-webkit-border-image': $(this), '-moz-border-image': $(this), 'border-image': $(this)}, function(key, value){
            //alert('Setting ' + value + ' to: ' + 'url(images/border-image.' + highlightColor + '.png) 5 5 5 5 stretch');
            $(this).find('.img').css(key, 'url(images/border-image.' + $(this).find('.img').attr('highlightColor') + '.png) 5 5 5 5 stretch');
          });
          $(this).find('.img').css('border-color','#595FFF');
          // $(this).find('.img').css({'-webkit-border-image':'url(images/border-image.' + $(this).find('.img').attr('highlightColor') + '.png) 5 5 5 5 stretch', '-moz-border-image':'url(images/border-image.' + $(this).find('.img').attr('highlightColor') + '.png) 5 5 5 5 stretch'});
        }
			}
		}, function(){
			if ($(this).hasClass('roundabout-in-focus')) {
				$(this).find('a').css({display:'none'});
				// $(this).find('.img_act').stop().animate({opacity:'0'}, 400, function(){$(this).css({display:'none'})})
        //$(this).find('.img').background.stop().animate({opacity:'0'}, 400)
        // WORKING: $(this).find('.img').css({background:'transparent'})
        //$(this).find('.img').css({'-webkit-border-image':'url(images/border-image.blackToGrey.png) 5 5 5 5 stretch', '-moz-border-image':'url(images/border-image.blackToGrey.png) 5 5 5 5 stretch'})
        if($(this).find('.img').attr('highlightColor') !== undefined) {
          $.each({'-webkit-border-image': $(this), '-moz-border-image': $(this), 'border-image': $(this)}, function(key, value){
            //alert('Setting ' + value + ' to: ' + 'url(images/border-image.' + highlightColor + '.png) 5 5 5 5 stretch');
            $(this).find('.img').css(key, 'url(images/border-image.blackToGrey.png) 5 5 5 5 stretch');
          });
          $(this).find('.img').css('border-color','#595454');
        }
			}
	})
	var h, new_h;
	setInterval(setNew,00)
	function setHeight(){
		new_h=$(window).height();
	}
	function setNew(){
		setHeight();
		if ((h!=new_h)) {
			h=new_h;
			$('.gallery .container_12').css({height:h});
			$('#icons li a').mouseenter().mouseleave();
		}
	}
	// menu
	$('ul#menu').superfish({
      delay:       600,
      animation:   { height:'show'},
      speed:       400,
      autoArrows:  false,
      dropShadows: false
    });
	// tool tip
	$('.normaltip').aToolTip({
    	toolTipClass: 'aToolTip'});
	
	
 });
