/*============================================================

Author: Simon Young
http://simonyoung.net
http://twitter.com/simon180

ONLOAD.JS 
Site specific JavaScript functionality

(c) Simon Young, 2010. All rights reserved.

============================================================*/

$(document).ready(function () {

	// make links with rel=external open in new window/tab
	$(function() {
        $('a[rel*=external]:not(.additional-rt a)').click( function() {
            window.open(this.href);
            return false;
        });
    });
    
    $(function() {
        $('.additional-rt a').click( function() {
            window.open(this.href);
            return false;
        });
    });
    
    
    //$("#tabs").tabs();
    $('#tabs').tabs({ fx: [{opacity:'toggle', duration:400},   // hide option
                            {opacity:'toggle', duration:700}] });  // show option
                            		
                            $(function(){
                                $('a[href*=#]').click(function() {
                                if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
                                    && location.hostname == this.hostname) {
                                        var $target = $(this.hash);
                                        $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
                                        if ($target.length) {
                                            var targetOffset = $target.offset().top;
                                            $('html,body').animate({scrollTop: targetOffset}, 1000);
                                            return false;
                                        }
                                    }
                                });
                            });
    
	
                            $('.comment-form-url input').focus(function () {
                                if ($(this).val() === $(this).attr('title')) {
                                    $(this).val('').css('color','#666666');
                                }
                                }).blur(function () {
                                    if ($(this).val() === '') {
                                    $(this).css('color','#999999').val($(this).attr('title'));
                                }
                            });
                            
                            $('textarea#comment').focus(function () {
                                if ($(this).val() === $(this).attr('title')) {
                                    $(this).val('').css('color','#666666');
                                }
                                }).blur(function () {
                                    if ($(this).val() === '') {
                                    $(this).css('color','#999999').val($(this).attr('title'));
                                }
                            });
                            
                            $('.comment-form-email input').focus(function () {
                                if ($(this).val() === $(this).attr('title')) {
                                    $(this).val('').css('color','#666666');
                                }
                                }).blur(function () {
                                    if ($(this).val() === '') {
                                    $(this).css('color','#999999').val($(this).attr('title'));
                                }
                            });
                            
                            $('.comment-form-author input').focus(function () {
                                if ($(this).val() === $(this).attr('title')) {
                                    $(this).val('').css('color','#666666');
                                }
                                }).blur(function () {
                                    if ($(this).val() === '') {
                                    $(this).css('color','#999999').val($(this).attr('title'));
                                }
                            });
	
    //apply rounded corners with javascript if border radius is not supported
    /*if(!Modernizr.borderradius) { 
        $('#header #menu-header-secondary-navigation li:last-child a').corner('10px');
        $('#nav li a').corner('10px');
        $('.home #home-upper-container #home-upper-content a.button').corner('20px');
        $('.single-events #aside .aside-profile a.button').corner('15px');
        $('.single-post #aside .aside-profile a.button').corner('15px');
        $('.home #section .col .newsletter .input-btn').corner('15px');
        $('.single-post #commentform input#submit').corner('15px');
        $('.gform_footer input.button').corner('15px');
    }*/
	
});
