
/*lightbox */
$( function() {
    $('[rel=lightbox], [rel=lightbox[gallery]]').prettyPhoto( {
        theme: 'dark_square'
    } );
} );


/*news */
$(function() {
    $('.newsBox .more').click( function() {
        if($('#home').get().length>0) {
            return true;
        }
        $(this).parent().parent().find('.full').slideDown();
        $(this).css('display', 'none');
        $('.newsBox .back').css('display', 'block');
        return false;
    } );
    $('.newsBox .img a').click(function() {
        $(this).parent().parent().find('.more').click();
        return false;
    });
    $('.newsBox .back').each(function() {
        if($(this).parent().parent().hasClass('fullNews')) {
            return;
        }
        $(this).click( function() {
            $(this).hide();
            $(this).parent().parent().find('.more').css('display', 'block');
            $(this).parent().slideUp();
            return false;
        } )} );
});
/*news */
$(function() {
    $('#page .newsBox .more').click( function() {
        /*if($('#home').get().length>0) {
            return true;
        }*/
        $(this).parent().parent().find('.full').slideDown();
        $(this).slideUp();
        $('.newsBox .back').css('display', 'block');
        return false;
    } );
    $('#page .newsBox .img a').click(function() {
        $(this).parent().parent().find('.more').click();
        return false;
    });
    $('#page .newsBox .back').each(function() {
        if($(this).parent().parent().hasClass('fullNews')) {
            return;
        }
        $(this).click( function() {
            $(this).hide();

            $(this).parent().slideUp('normal', function() {
                $(this).parent().find('.more').slideDown();
            });
            return false;
        } )
    } );
});
/*
 * Contact Form
 */
$( function() {
    $('.txtinput, #searchForm .text').each( function() {
        $(this).attr('defaultText', ( $(this).hasClass('mess') ? $(this).text() : $(this).attr('value') )).focus( txtinputFocus ).blur( txtinputBlur );
    } );

} );
function txtinputFocus() {
    if($(this).hasClass('mess')) {
        if($(this).attr('defaultText') == $(this).text())
            $(this).text('');
    } else {
        if($(this).attr('defaultText') == $(this).attr('value'))
            $(this).attr('value','');

    }
}

function txtinputBlur() {
    if($(this).hasClass('mess')) {
        if($(this).attr('value') == '')
            $(this).text($(this).attr('defaultText'));
    } else {
        if($(this).attr('value') == '')
            $(this).attr('value', $(this).attr('defaultText') );

    }
}

$(  function() {
    $('#top .logo, #top .text1, #top .text2').css( 'opacity', 0 );
    setTimeout( function() {
        $( '#top .logo' ).animate({opacity: 1}, 1000);
        $( '#top .text1' ).animate({opacity: 1}, 1200, function() {
            $('#top .text2').animate( {opacity: 1}, 1200 );
        });
    }, 600 );
    

});

$(function() {
    $('.polecamy .title').toggle( function() {
        var up = $(this).parent();
        up.find('.all').slideDown();
        up.stop().animate( {height: '193px'} ).addClass('polecamyActive');
        return false;
    }, function() {
        var up = $(this).parent();
        up.find('.all').slideUp();
        up.stop().animate( {height: '25px'}, 'normal', function() {
            $(this).removeClass('polecamyActive');
        } );
        return false;
    } );
});


