/**************************************************
	NAVIGATION
**************************************************/

function nav(){
	$('.nav2 ul ul').css({display: 'none'});
	
	$('.nav2 ul li').hover(function(){
		$(this).find('ul:first').css({
			visibility: 'visible',
			display: 'none'
		}).fadeIn('1000');
	},
	function(){
		$(this).find('ul:first').css({
			visibility: 'hidden'
		});
	});
}
$(document).ready(function() {

	/**************************************************
		NAVIGATION
	**************************************************/

	nav();

	/**************************************************
		PORTFOLIO
	**************************************************/
	
	$('.posts.portfolio .item').hover(function(){
		$(this).find('.image p.pattern').hide();
		$(this).find('.info').animate({bottom: '10px'}, {queue:false, duration: 300});
	},
	function(){
		$(this).find('.image p.pattern').show();
		$(this).find('.info').animate({bottom: '65px'}, {queue:false, duration: 300});
	});
	
	/**************************************************
		PRETTY PHOTO
	**************************************************/
	
	$("a[rel^='prettyPhoto']").prettyPhoto({
		showTitle : false,
		theme : 'dark_square'
	});
	
	
	
	
	

});

(function($){
    $.fn.extend({
    customStyle : function(options) {
        if(!$.browser.msie || ($.browser.msie&&$.browser.version>6)) {
            return this.each(function() {
                var currentSelected = $(this).find(':selected');
                $(this).after('<span class="customStyleSelectBox"><span class="customStyleSelectBoxInner">'+currentSelected.text()+'</span></span>').css({position:'absolute', opacity:0,fontSize:$(this).next().css('font-size')});
                var selectBoxSpan = $(this).next();
                var selectBoxWidth = parseInt($(this).width()) - parseInt(selectBoxSpan.css('padding-left')) -parseInt(selectBoxSpan.css('padding-right'));            
                var selectBoxSpanInner = selectBoxSpan.find(':first-child');
                selectBoxSpan.css({display:'inline-block'});
                selectBoxSpanInner.css({width:selectBoxWidth, display:'inline-block'});
                var selectBoxHeight = parseInt(selectBoxSpan.height()) + parseInt(selectBoxSpan.css('padding-top')) + parseInt(selectBoxSpan.css('padding-bottom'));
                $(this).height(selectBoxHeight).change(function() {
                    selectBoxSpanInner.text($(this).find(':selected').text()).parent().addClass('changed');
                });
         });
        }
    }
    });
})(jQuery);

$(function() {
    $('select.styled').customStyle();
});
