/* Bryan Kwon */
$(function() {
    
/* dropdown menu */                 
    $('#nav li').hover(function(){
        $(this).addClass('hover');
        $('ul:first', this).css('visibility', 'visible');
    }, function(){
        $(this).removeClass('hover');
        $('ul:first', this).css('visibility', 'hidden');
    });
    
/* home page slides */
if($('body#home').length > 0) {
	$('#entries').cycle({
	    timeout: 5000,
	    speed: 1000,
	    fx: 'fade',
	    pager: '#pagination',
	    activePagerClass: 'active'
	});
}

/* if subpages, */
if($('body#sub').length) {
	$('#nav > ul > li').removeClass('active');
	var thisSub = $('#sidebar h2').text().toLowerCase().replace(/ /g,'').replace(/&/g,'');
	$('#nav > ul > li').filter('#' + thisSub).addClass('active');
	
}


/* Newsletter placeholder text */
	$('#email').addClass('placeholder');
	$('#email').bind('focusin', function(event){
	var obj = $(event.target);
		obj.removeClass('placeholder');
		if(obj.val() == obj.attr('title')) obj.val('');
	});
	$('#email').bind('focusout', function(event){
		var obj = $(event.target);
		if((obj.val() == '') || (obj.val() == obj.attr('title'))) {
			obj.val(obj.attr('title'));
			obj.addClass('placeholder');
		}
	});
	
// Rudy's code
// Style default RFI form (Experimental)
   // First we clean up the mess from original table formatting
   $('div.form_wrapper table').addClass('ui-helper-reset');
   $('div.form_wrapper table').removeAttr("background");
   $('div.form_wrapper table').removeAttr("border");
   // and then we apply modifier to form elements
   $('div.form_wrapper table input[type=text], div.form_wrapper table td');
   $('div.form_wrapper table input[type=submit], div.form_wrapper table input[type=reset]').button();
   $('div.form_wrapper table textarea');
   $('select, input:checkbox, input:radio, input:file').uniform();
	
    
});

