//Ready Global Functions
$(document).ready(function() {
	
	//Categories/Archives Navigation
	//Hide categories/archives navigation
	$('.navsub').css({'display':'none'});
	$('#nav_sub ul#archives_btn_sect').css({'margin-top':'3.00em'});
	$('#page.blog').css({'padding':'0'});
	
	//Function to hide/show categories/archives
	$('#nav_sub a.parent').click(function(){
		$('a.parent').removeClass('active');
		var whichSection = $(this).attr("id");
		if ($('#'+whichSection+'_sect').is(':visible')) {
			$('#'+whichSection+'_sect').fadeOut('regular');
		}
		if ($('#'+whichSection+'_sect').is(':hidden')) {
			$('.navsub:visible').fadeOut(1);
			$('#'+whichSection+'_sect').fadeIn('regular');
			$(this).addClass('active');
		}
	});
	
	
	//Auto-clear Search Box Using Plugin:clearingInput 
	$('#s').clearingInput(); // Input value 'The label text'
	
	
	//Social Networking - open links in a new window
	$('#social a, #credits a').click(function(){
		window.open(this.href);
		return false;
	});
	
	
	//Create "Hire Me" modal popup form - powered by cforms plugin
	//...and disable default URL reference
	$('#form_hire').css({'display':'none'});
	$('#hiremeform').attr({'href':'#hireme'});
	$('#hiremeform').click(function(){
		$('#form_hire .cf_info').text('');
		$('#form_hire').dialog({
			bgiframe: true,
			modal: true,
			draggable: false,
			width: 546,
			title: 'Hire me! - <span>Submit a Project Request</span>',
			resizable: false,
			buttons: {
				cancel: function() {
					$(this).dialog('close');
				}
			}
		})
		.dialog('open');
		//Move the 'Send' button down in line with the 'Cancel' button
		var hiremeSendBtn = $('.cf-sb').html();
		$('.cf-sb').remove();
		$('.ui-dialog-buttonpane').append(hiremeSendBtn);
	});

});


