/* User Scripts */
$(document).ready(function(){
        $('#navigation li li.current_page_item').parent().parent().addClass('current_page_item'); //Navigation
        $('#navigation li li li.current_page_item').parent().parent().parent().parent().addClass('current_page_item'); //Navigation
        $('#home .widget:last, #bottom .widget:last, #home .widget:last h3').css('background', 'none'); //Home and Bottom
        $('#bottom .widget #recent-widget p:last').css('padding', '0'); //Bottom
        $('#middle .post:last').css('background', 'none'); //Middle
        $('blockquote').prepend('<div class="blq"></div>'); //Middle
        $('input:text').css('border-radius', '3px').css('-moz-border-radius', '3px').css('-webkit-border-radius', '3px'); //Validator
        $('textarea').css('border-radius', '3px').css('-moz-border-radius', '3px').css('-webkit-border-radius', '3px'); //Validator
        $('.pp_gallery ul a').css('border', '1px rgba(0,0,0,0.5) solid'); //Validator
        $('.coin-slider').css('zoom', '1'); //Validator
});



/* Navigation */
$(document).ready(function(){
        var $i = $j = $m = $n = 0;
        $.each($('#navigation li'), function() { $i = $i + 1; });
        $.each($('#navigation li li'), function() { $m = $m + 1; });
        $i = $i - $m;
        $j = (980 / $i) + ((100 / ($i - 1)) / 100) - 2;
        $j = ($j).toPrecision(7);
        $('#navigation li').css('width', $j + 'px');
        $.each($('#navigation li li'), function() { $(this).css('width', '225px'); });
        $.each($('#navigation li li li'), function() { $(this).css('width', '225px'); });
        $('#navigation li:last-child').css('background', 'none').css('padding-right', '0');
        $('#navigation li li').css('background', 'none').css('padding-right', '0');
        $('#navigation li li li').css('background', 'none').css('padding-right', '0');
});

$(document).ready(function(){
        $('#navigation li ul').parent().addClass('prnt');
        $('#navigation li li ul').parent().removeClass('prnt').addClass('prnt2');
        $('#navigation li ul li:not(:first-child)').css('border', '0');
        $('#navigation li li ul li').css('border', '0');
        $('#navigation li.prnt').hover(function(){
                $(this).find('ul:first').stop().css({overflow:'hidden', height:'auto', display:'none'}).slideDown(300, function(){
                        $(this).css({overflow:'visible', height:'auto'});
                });
        }, function(){
                $(this).find('ul:first').stop().slideUp(300, function(){
                        jQuery(this).css({overflow:'hidden', display:'none'});
                });
        });
        $('#navigation li.prnt li.prnt2').hover(function(){
                $(this).find('ul:first').stop().css({overflow:'hidden', height:'auto', display:'none'}).slideDown(300, function(){
                        $(this).css({overflow:'visible', height:'auto'});
                });
        }, function(){
                $(this).find('ul:first').stop().slideUp(300, function(){
                        jQuery(this).css({overflow:'hidden', display:'none'});
                });
        });
});



/* Content/Sidebar Height */
$(document).ready(function(){
        var $cheight = $('#content').height();
        var $sheight = $('#sidebar').height();
        if( $cheight > $sheight ){ $('div#sidebar').height( $cheight - 60 ); }
});



/* Right Content/Left Sidebar Height */
$(document).ready(function(){
        var $cheight = $('#content.fr').height();
        var $sheight = $('#sidebar.fl').height();
        if( $cheight > $sheight ){ $('div#sidebar').height( $cheight ); }
});



/* Project/Sidebar Height */
$(document).ready(function(){
        var $cheight = $('.middle_content .pr_thumb').height();
        var $sheight = $('.middle_content #sidebar').height();
        if( $cheight > $sheight ){ $('div#sidebar').height( $cheight + 60 ); }
});



/* Home Widgets Separator */
$(document).ready(function(){
        var $fheight = $('#home .widget:eq(0)').height();
        var $sheight = $('#home .widget:eq(1)').height();
        var $theight = $('#home .widget:eq(2)').height();
        if( $fheight > $sheight && $fheight > $theight ){
                $('#home .widget').css('height', $fheight);
        }else if( $sheight > $fheight && $sheight > $theight ){
                $('#home .widget').css('height', $sheight);
        }else{
                $('#home .widget').css('height', $theight);
        }
});



/* Bottom Widgets Separator */
$(document).ready(function(){
        var $fheight = $('#bottom .widget:eq(0)').height();
        var $sheight = $('#bottom .widget:eq(1)').height();
        var $theight = $('#bottom .widget:eq(1)').height();
        if( $fheight > $sheight && $fheight > $theight ){
                $('#bottom .widget').css('height', $fheight);
        }else if( $sheight > $fheight && $sheight > $theight ){
                $('#bottom .widget').css('height', $sheight);
        }else{
                $('#bottom .widget').css('height', $theight);
        }
});



/* Search Text */
$(document).ready(function(){
        $('.search input#search, .search input#middlesearch').focus(function(){
                if( $(this).val() == 'Search...' ){ $(this).val(''); }
        });
        $('.search input#search, .search input#middlesearch').blur(function(){
                if( $(this).val() == '' ){ $(this).val('Search...'); }
        });
});



/* Bottom Show/Hide */
$(document).ready(function(){
        $('#bottom .hide').hide();
        $('#bottom .bottom').slideUp(250, function(){
                $('#footer').css('margin', '-11px 0 0');
        });
        $('#bottom .show').click(function() {
                $('#bottom .show').hide();
                $('#bottom .hide').show();
                $('#bottom .toggle').css('margin', '0 0 -11px');
                $('#bottom .bottom').slideDown(500, function(){
                        $('#footer').css('margin', '0');
                        $body_height = $('body').height();
                        $('html, body').animate({scrollTop: $body_height}, 1000);
                });
                return false;
        });
        $('#bottom .hide').click(function() {
                $('#bottom .hide').hide();
                $('#bottom .show').show();
                $('#bottom .bottom').slideUp(500, function(){
                        $('#footer').css('margin', '-11px 0 0');
                        $('#bottom .toggle').css('margin', '0');
                });
                return false;
        });
});



/* Form */
function submitform() {
    document.forms["commentform"].submit();
        return false;
};



/* Flickr Lightbox */
$(document).ready(function() {
        $("#flickr .flickr_badge_image a").each(function(i){
                var src = $(this).find("img").attr("src");
                var title = $(this).find("img").attr("title");
                var src2 = src.replace(/_s.jpg/g, ".jpg");
                $(this).removeAttr("href");
                $(this).attr({
                        href: src2,
                        title: title,
                        rel: 'prettyPhoto[flickr_gal]'
                });
        });
});



/* Pretty Photo Lighbox */
/* <![CDATA[ */
        jQuery(document).ready(function($) {
          $("a[rel^='prettyPhoto']").prettyPhoto({
                animationSpeed: 'normal',
                padding: 20,
                opacity: 0.65,
                showTitle: true,
                allowresize: true,
                counter_separator_label: ' / ',
                theme: 'light_square',
                wmode: 'opaque',
                autoplay: 1,
                hideflash: false,
                modal: false,
                changepicturecallback: function(){},
                callback: function(){},
                markup: '<div class="pp_pic_holder"> \
                          <div class="pp_top"> \
                                <div class="pp_left"></div> \
                                <div class="pp_middle"></div> \
                                <div class="pp_right"></div> \
                          </div> \
                          <div class="pp_content_container"> \
                                <div class="pp_left"> \
                                <div class="pp_right"> \
                                  <div class="pp_content"> \
                                        <div class="pp_fade"> \
                                          <a href="#" class="pp_expand" title="Expand the image">Expand</a> \
                                          <div class="pp_loaderIcon"></div> \
                                          <div class="pp_hoverContainer"> \
                                                <a class="pp_next" href="#">next</a> \
                                                <a class="pp_previous" href="#">previous</a> \
                                          </div> \
                                          <div id="pp_full_res"></div> \
                                          <div class="pp_details clearfix"> \
                                                <p class="pp_description"></p> \
                                                <span class="pp_close">Press Esc or <a href="#">Close</a></span> \
                                                <div class="pp_nav"> \
                                                  <a href="#" class="pp_arrow_previous">Previous</a> \
                                                  <p class="currentTextHolder">0/0</p> \
                                                  <a href="#" class="pp_arrow_next">Next</a> \
                                                </div> \
                                          </div> \
                                        </div> \
                                  </div> \
                                </div> \
                                </div> \
                          </div> \
                          <div class="pp_bottom"> \
                                <div class="pp_left"></div> \
                                <div class="pp_middle"></div> \
                                <div class="pp_right"></div> \
                          </div> \
                        </div> \
                        <div class="pp_overlay"></div> \
                        <div class="ppt"></div>',
                image_markup: '<img id="fullResImage" src="" />',
                flash_markup: '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',
                quicktime_markup: '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>',
                iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',
                inline_markup: '<div class="pp_inline clearfix">{content}</div>'
          });
        });
/* ]]> */



/* Scroll Top */
$(document).ready(function(){
        $('a.scroll_top').click(function(){
                $('html, body').animate({scrollTop:0}, 'slow');
                return false;
        });
});



/* Toggle */
$(document).ready(function(){
        var $togg = $('.togg');
        $.each($togg, function(){
                var $tog = $(this).find('span.tog');
                var $tabc = $(this).find('.tab_content');
                if ($tog.hasClass('current')){
                        $tog.toggle(
                                function(){
                                        $(this).removeClass('current');
                                        $tabc.hide('slide', { direction: 'up' }, 300);
                                },
                                function(){
                                        $(this).addClass('current');
                                        $tabc.show('slide', { direction: 'up' }, 300);
                                }
                        );
                }else{
                        $tabc.hide();
                        $tog.toggle(
                                function(){
                                        $(this).addClass('current');
                                        $tabc.show('slide', { direction: 'up' }, 300);
                                },
                                function(){
                                        $(this).removeClass('current');
                                        $tabc.hide('slide', { direction: 'up' }, 300);
                                }
                        );
                }
        });
});



/* Lightbox Image Hover */
$(document).ready(function(){
        var $rel = $('#middle a img').parent().attr('rel');
        var $hov = $('#middle a img').parent();
        $hov.addClass('hov');
        if($rel){
                $imgh = $('a.hov').find('img').height();
                $imgw = $('a.hov').find('img').width();
                $('a.hov').prepend('<span></span>');
                $('a.hov').find('span').css({ width: $imgw, height: $imgh, margin: '5px' });
                $.each($hov, function(){
                        var $hovs = $(this).find('span');
                        $hovs.css('opacity', '0');
                        $(this).hover(
                                function(){
                                        $hovs.stop().animate({ opacity: '0.5' }, 500);
                                },
                                function(){
                                        $hovs.stop().animate({ opacity: '0' }, 500);
                                }
                        );
                });
        }
});



/* Portfolio Show/Hide */
$(document).ready(function(){
        $('.p_options .p_options_block').hide();
        $('.p_options a.opt_but').toggle(function(){
                $(this).text('Hide Portfolio Options');
                $('.p_options .p_options_block').show('slide', {direction:'up'}, 500);
                return false;
        }, function(){
                $(this).text('Show Portfolio Options');
                $('.p_options .p_options_block').hide('slide', {direction:'up'}, 500);
                return false;
        });
});

$(document).ready(function(){
        $('.p_options .p_options_block').hide();
        $('.p_options a.opt_but_g').toggle(function(){
                $(this).text('Hide Gallery Options');
                $('.p_options .p_options_block').show('slide', {direction:'up'}, 500);
                return false;
        }, function(){
                $(this).text('Show Gallery Options');
                $('.p_options .p_options_block').hide('slide', {direction:'up'}, 500);
                return false;
        });
});



/* Portfolio/Gallery Column Style */
$(document).ready(function(){
        $("a.p_one").click(function(){
                $('.switcher a').removeClass('current');
                $(this).addClass('current');
                $(".portfolio").fadeOut("fast", function() {
                        $(this).removeClass("four").removeClass("three").removeClass("two").addClass("one").fadeIn("fast");
                        $imgh = $('a.hov').find('img').height();
                        $imgw = $('a.hov').find('img').width();
                        $('a.hov').find('span').css({ width: $imgw, height: $imgh, margin: '5px' });
                        $.each($('a.hov'), function(){
                                var $hovs = $(this).find('span');
                                $hovs.css('opacity', '0');
                                $(this).hover(
                                        function(){
                                                $hovs.stop().animate({ opacity: '0.5' }, 500);
                                        },
                                        function(){
                                                $hovs.stop().animate({ opacity: '0' }, 500);
                                        }
                                );
                        });
                        Cufon.replace ('#middle h5 a', {
                                hover: {
                                        color: '#2cbffd',
                                        textShadow: '1px 1px rgba(0, 0, 0, 0.4)'
                                },
                                textShadow: '1px 1px rgba(255, 255, 255, 0.4)'
                        });
                });
                return false;
        });
        $("a.p_two").click(function(){
                $('.switcher a').removeClass('current');
                $(this).addClass('current');
                $(".portfolio").fadeOut("fast", function(){
                        $(this).removeClass("four").removeClass("three").removeClass("one").addClass("two").fadeIn("fast");
                        $imgh = $('a.hov').find('img').height();
                        $imgw = $('a.hov').find('img').width();
                        $('a.hov').find('span').css({ width: $imgw, height: $imgh, margin: '5px' });
                        $.each($('a.hov'), function(){
                                var $hovs = $(this).find('span');
                                $hovs.css('opacity', '0');
                                $(this).hover(
                                        function(){
                                                $hovs.stop().animate({ opacity: '0.5' }, 500);
                                        },
                                        function(){
                                                $hovs.stop().animate({ opacity: '0' }, 500);
                                        }
                                );
                        });
                        Cufon.replace ('#middle h5 a', {
                                hover: {
                                        color: '#2cbffd',
                                        textShadow: '1px 1px rgba(0, 0, 0, 0.4)'
                                },
                                textShadow: '1px 1px rgba(255, 255, 255, 0.4)'
                        });
                });
                return false;
        });
        $("a.p_three").click(function(){
                $('.switcher a').removeClass('current');
                $(this).addClass('current');
                $(".portfolio").fadeOut("fast", function(){
                        $(this).removeClass("four").removeClass("two").removeClass("one").addClass("three").fadeIn("fast");
                        $imgh = $('a.hov').find('img').height();
                        $imgw = $('a.hov').find('img').width();
                        $('a.hov').find('span').css({ width: $imgw, height: $imgh, margin: '5px' });
                        $.each($('a.hov'), function(){
                                var $hovs = $(this).find('span');
                                $hovs.css('opacity', '0');
                                $(this).hover(
                                        function(){
                                                $hovs.stop().animate({ opacity: '0.5' }, 500);
                                        },
                                        function(){
                                                $hovs.stop().animate({ opacity: '0' }, 500);
                                        }
                                );
                        });
                        Cufon.replace ('#middle h5 a', {
                                hover: {
                                        color: '#2cbffd',
                                        textShadow: '1px 1px rgba(0, 0, 0, 0.4)'
                                },
                                textShadow: '1px 1px rgba(255, 255, 255, 0.4)'
                        });
                });
                return false;
        });
        $("a.p_four").click(function(){
                $('.switcher a').removeClass('current');
                $(this).addClass('current');
                $(".portfolio").fadeOut("fast", function(){
                        $(this).removeClass("three").removeClass("two").removeClass("one").addClass("four").fadeIn("fast");
                        $imgh = $('a.hov').find('img').height();
                        $imgw = $('a.hov').find('img').width();
                        $('a.hov').find('span').css({ width: $imgw, height: $imgh, margin: '5px' });
                        $.each($('a.hov'), function(){
                                var $hovs = $(this).find('span');
                                $hovs.css('opacity', '0');
                                $(this).hover(
                                        function(){
                                                $hovs.stop().animate({ opacity: '0.5' }, 500);
                                        },
                                        function(){
                                                $hovs.stop().animate({ opacity: '0' }, 500);
                                        }
                                );
                        });
                        Cufon.replace ('#middle h5 a', {
                                hover: {
                                        color: '#2cbffd',
                                        textShadow: '1px 1px rgba(0, 0, 0, 0.4)'
                                },
                                textShadow: '1px 1px rgba(255, 255, 255, 0.4)'
                        });
                });
                return false;
        });
});



/* Portfolio Filter */
$(document).ready(function(){
        var newFilter = '';
        $('.p_filter li:first-child').addClass("current");
        $('.p_filter li a').click(function(){
                newFilter = $(this).attr('name');
                $('.portfolio').fadeTo(500, 0.25);
                $('.p_filter li').removeClass('current').css('display', 'block');
                $(this).parent().addClass("current");
                $('.p_item').not('.'+newFilter).slideUp();
                $('.p_item a img').parent().not($(this).attr({rel: 'prettyPhoto[portfolio]'})).attr({rel: 'prettyPhoto[portfolio]'});
                $('.'+newFilter+' a img').parent().attr({rel: 'prettyPhoto[portfolio'+newFilter+']'});
                $('.'+newFilter).slideDown();
                $('.portfolio').fadeTo(500, 1);
                return false;
        });
        $('.p_filter').hover(function(){
                $(this).find('li').slideDown(250);
        }, function(){
                $(this).find('li').not('.current').slideUp(250);
        });
});



/* Portfolio Sort */
jQuery.fn.sort = (function(){
        var sort = [].sort;
        return function(comparator, getSortable){
                getSortable = getSortable || function(){return this;};
                var placements = this.map(function(){
                        var sortElement = getSortable.call(this),
                        parentNode = sortElement.parentNode,
                        nextSibling = parentNode.insertBefore(
                                document.createTextNode(''),
                                sortElement.nextSibling
                        );
                        return function(){
                                if (parentNode === this){
                                        throw new Error( "You can't sort elements if any one is a descendant of another." );
                                }
                                parentNode.insertBefore(this, nextSibling);
                                parentNode.removeChild(nextSibling);
                        };
                });
                return sort.call(this, comparator).each(function(i){
                        placements[i].call(getSortable.call(this));
                });
        };
})();

$(document).ready(function(){
        var $date = $('.p_sort a[name="date"]'), $name = $('.p_sort a[name="name"]'), inverse = false;
        $name.click(function(){
                $('.portfolio').fadeTo(100, 0.25).delay(300).fadeTo(100, 1);
                $p_item = $('.portfolio .p_item');
                $p_item.sort(function(a, b){
                        a = $(a).find('h5').text();
                        b = $(b).find('h5').text();
                        return ( isNaN(a) || isNaN(b) ? a > b : +a > +b ) ? inverse ? -1 : 1 : inverse ? 1 : -1;
                });
                $date.removeClass('sel').removeClass('sel2');
                if($(this).hasClass('sel')){
                        $(this).removeClass('sel').addClass('sel2');
                }else{
                        $(this).removeClass('sel2').addClass('sel');
                }
                inverse = !inverse;
                return false;
        });
        $date.click(function(){
                $('.portfolio').fadeTo(100, 0.25).delay(300).fadeTo(100, 1);
                $p_item = $('.portfolio .p_item');
                $p_item.sort(function(a, b){
                        a = $(a).find('.p_date').text();
                        b = $(b).find('.p_date').text();
                        return ( isNaN(a) || isNaN(b) ? a > b : +a > +b ) ? inverse ? -1 : 1 : inverse ? 1 : -1;
                });
                $name.removeClass('sel').removeClass('sel2');
                if($(this).hasClass('sel')){
                        $(this).removeClass('sel').addClass('sel2');
                }else{
                        $(this).removeClass('sel2').addClass('sel');
                }
                inverse = !inverse;
                return false;
        });
});



/* Contact Form */
function checkemail(emailaddress){
    var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
        return pattern.test(emailaddress);
}

$(document).ready(function(){
        var $math1 = Math.floor( Math.random() * (100) );
        var $math2 = Math.floor( Math.random() * (100) );
        $('#contactform #math1').text($math1);
        $('#contactform #math2').text($math2);
        var $mathsum = $math1 + $math2;
        $('#contactform a#formsend').click(function(){
                var $name         = $('#name').val();
                var $email         = $('#email').val();
                var $subject = $('#subject').val();
                var $message = $('#message').val();
                var $confirm = $('#confirm').val();
                var $contactemail = $('#contactemail').val();
                if($name != '' && $name.length < 3){ $nameshort = true; }else{ $nameshort = false; }
                if($name != '' && $name.length > 30){ $namelong = true; }else{ $namelong = false; }
                if($email != '' && checkemail($email)){ $emailerror = true; }else{ $emailerror = false; }
                if($subject != '' && $subject.length < 3){ $subjectshort = true; }else{ $subjectshort = false; }
                if($subject != '' && $subject.length > 100){ $subjectlong = true; }else{ $subjectlong = false; }
                if($message != '' && $message.length < 3){ $messageshort = true; }else{ $messageshort = false; }
                if($confirm != '' && $confirm != $mathsum){ $confirmerror = true; }else{ $confirmerror = false; }
                $('.loading').fadeIn('fast');
                if($name != '' && $nameshort != true && $namelong != true && $email != '' && $emailerror != false && $subject != '' && $subjectshort != true && $subjectlong != true && $message != '' && $messageshort != true && $confirm != '' && $confirmerror != true && $contactemail != ''){
                        $.post('php/sendmail.php',
                                {contactemail: $contactemail, name: $name, email: $email, subject: $subject, message: $message},
                                function(data){
                                        $('.loading').fadeOut('fast');
                                        $('#contactform').fadeOut();
                                        $('#name, #subject, #url, #email, #message, #confirm').val('').css({'border':'1px solid #d2d2d2'});
                                        $('#contactform label span').remove();
                                        $('<div class="box info"><table><tbody><tr><td class="b_img"></td><td>Thank you, ' + $name + '! <br />Your message has been send successfully.</td></tr></tbody></table></div>').insertBefore('#contactform');
                                        $('.box').delay(5000).fadeOut(1000, function(){
                                                $(this).remove();
                                                $('#contactform').fadeIn();
                                        });
                                }
                        );
                        return false;
                }else{
                        $('.loading').fadeOut('fast');
                        $('<div class="box error"><table><tbody><tr><td class="b_img"></td><td>Your message has not been send successfully.<br />It was an error on page!</td></tr></tbody></table></div>').insertBefore('#contactform');
                        $('.box').delay(5000).fadeOut(1000, function(){ $(this).remove(); });
                        if($name == ''){
                                $('#name').css({'border':'1px solid #2cbffd'});
                                $('#name').parent('p').find('label').find('span').remove();
                                $('#name').parent('p').find('label').append('<span>You forgot to enter your name.</span>');
                        }else if($nameshort == true){
                                $('#name').css({'border':'1px solid #2cbffd'});
                                $('#name').parent('p').find('label').find('span').remove();
                                $('#name').parent('p').find('label').append('<span>Entered name must not be shorter than 3 characters.</span>');
                        }else if($namelong == true){
                                $('#name').css({'border':'1px solid #2cbffd'});
                                $('#name').parent('p').find('label').find('span').remove();
                                $('#name').parent('p').find('label').append('<span>Entered name must not be longer than 30 characters.</span>');
                        }else{
                                $('#name').css({'border':'1px solid #d2d2d2'});
                                $('#name').parent('p').find('label').find('span').remove();
                        }
                        if($email == ''){
                                $('#email').css({'border':'1px solid #2cbffd'});
                                $('#email').parent('p').find('label').find('span').remove();
                                $('#email').parent('p').find('label').append('<span>You forgot to enter your email address.</span>');
                        }else if($emailerror == false){
                                $('#email').css({'border':'1px solid #2cbffd'});
                                $('#email').parent('p').find('label').find('span').remove();
                                $('#email').parent('p').find('label').append('<span>You entered an invalid email address.</span>');
                        }else{
                                $('#email').css({'border':'1px solid #d2d2d2'});
                                $('#email').parent('p').find('label').find('span').remove();
                        }
                        if($subject == ''){
                                $('#subject').css({'border':'1px solid #2cbffd'});
                                $('#subject').parent('p').find('label').find('span').remove();
                                $('#subject').parent('p').find('label').append('<span>You forgot to enter the subject of your message.</span>');
                        }else if($subjectshort == true){
                                $('#subject').css({'border':'1px solid #2cbffd'});
                                $('#subject').parent('p').find('label').find('span').remove();
                                $('#subject').parent('p').find('label').append('<span>Entered subject must not be shorter than 3 characters.</span>');
                        }else if($subjectlong == true){
                                $('#subject').css({'border':'1px solid #2cbffd'});
                                $('#subject').parent('p').find('label').find('span').remove();
                                $('#subject').parent('p').find('label').append('<span>Entered subject must not be longer than 100 characters.</span>');
                        }else{
                                $('#subject').css({'border':'1px solid #d2d2d2'});
                                $('#subject').parent('p').find('label').find('span').remove();
                        }
                        if($message == ''){
                                $('#message').css({'border':'1px solid #2cbffd'});
                                $('#message').parent('p').find('label').find('span').remove();
                                $('#message').parent('p').find('label').append('<span>You forgot to enter the text of your message.</span>');
                        }else if($messageshort == true){
                                $('#message').css({'border':'1px solid #2cbffd'});
                                $('#message').parent('p').find('label').find('span').remove();
                                $('#message').parent('p').find('label').append('<span>Entered message must not be shorter than 3 characters.</span>');
                        }else{
                                $('#message').css({'border':'1px solid #d2d2d2'});
                                $('#message').parent('p').find('label').find('span').remove();
                        }
                        if($confirm == ''){
                                $('#confirm').css({'border':'1px solid #2cbffd'});
                                $('#confirm').parent('p').find('label').find('span').remove();
                                $('#confirm').parent('p').find('label').append('<span>You forgot to fill the confirmation field.</span>');
                        }else if($confirmerror == true){
                                $('#confirm').css({'border':'1px solid #2cbffd'});
                                $('#confirm').parent('p').find('label').find('span').remove();
                                $('#confirm').parent('p').find('label').append('<span>Entered confirmation value is incorrect.</span>');
                        }else{
                                $('#confirm').css({'border':'1px solid #d2d2d2'});
                                $('#confirm').parent('p').find('label').find('span').remove();
                        }
                        return false;
                }
        });
});
