/**
 * Parallax Scrolling Tutorial
 * For Smashing Magazine
 * July 2011
 *   
 * Author: Richard Shepherd
 * 		   www.richardshepherd.com
 * 		   @richardshepherd   
 */

// On your marks, get set...
$(document).ready(function(){


$('.signin').mouseover(function(){
	$('#loginform').css('display','block');
});

$('#loginform').mouseover(function(){
	$('#loginform').css('display','block');
});

$('#loginform').mouseout(function(){
	$('#loginform').css('display','none');
});

$('.contact').click(function() {
	
		$( this ).addClass("sub_select");
		$('.mainmenu_inner li').removeClass("sub_select");
        $('#navi').css('position','absolute');
		$('.contactinner').css('display','block');
		$('.contactus').animate({
			height: '500px'
		}, 1000, function() {
		
  });
  return false;
});

$('.close').click(function() {
		$('.contact').removeClass("sub_select");
        $('.contactus').animate({
			height: '0'
		}, 1000, function() {
    	$('#navi').css('position','fixed');
		$('.contactinner').css('display','none');
  });
});
	
$('a[href*=#judgepanel]').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;
}
}
});

$('a[href*=#sopnsors]').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;
}
}
});

$('a[href*=#event]').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;
}
}
});

$('a[href*=#home]').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;
}
}
});

$('a[href*=#intro]').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;
}
}
});

$('a[href*=#quickdown]').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;
}
}
});

$('.dropdown').mouseover(function(){
		$(this).parent().addClass('sub_select');
		$(this).mouseout(function(){
		$(this).parent().removeClass('sub_select');
	});
});


	
});

(function($) {
    function toggleLabel() {
        var input = $(this);
        setTimeout(function() {
            var def = input.attr('title');
            if (!input.val() || (input.val() == def)) {
                input.prev('span').css('visibility', '');
                if (def) {
                    var dummy = $('<label></label>').text(def).css('visibility','hidden').appendTo('body');
                    input.prev('span').css('margin-left', dummy.width() + 3 + 'px');
                    dummy.remove();
                }
            } else {
                input.prev('span').css('visibility', 'hidden');
            }
        }, 0);
    };

    function resetField() {
        var def = $(this).attr('title');
        if (!$(this).val() || ($(this).val() == def)) {
            $(this).val(def);
            $(this).prev('span').css('visibility', '');
        }
    };

    $('input, textarea').live('keydown', toggleLabel);
    $('input, textarea').live('paste', toggleLabel);
    $('select').live('change', toggleLabel);

    $('input, textarea').live('focusin', function() {
        $(this).prev('span').css('color', '#b3b3b3');
    });
    $('input, textarea').live('focusout', function() {
        $(this).prev('span').css('color', '#b3b3b3');
    });
	
	 $('.textarea2').live('focusin', function() {
        $(this).prev('span').css('color', '#b3b3b3');
    });
    $('.textarea2').live('focusout', function() {
        $(this).prev('span').css('color', '#b3b3b3');
    });
	
	$('.inp_txt_final, .textarea').live('focusin', function() {
        $(this).prev('span').css('color', '#cecece');
    });
	
    $('.inp_txt_final, .textarea').live('focusout', function() {
        $(this).prev('span').css('color', '#cecece');
    });


    $(function() {
        $('input, textarea').each(function() { toggleLabel.call(this); });
    });

})(jQuery);

