// Customizations & Styling
// Hybrid Forge (www.HybridForge.com)
// January 2010 

//---------------------------------------------------
// Customizations:
//---------------------------------------------------

jQuery(document).ready(function($) {
	
	$("#donateDialog").dialog({
	  		bgiframe: true,
            autoOpen: false,
            title: 'FFB Donation in Honor of Erick Seed',
            height: 300,
            width: 680,
            modal: true,
            buttons: {
                Close: function() {
                    $(this).dialog('close');
                }
            }
	});
	
	$('.donateAction').click(function() {
            $('#donateDialog').dialog('open');
	});
	

	//Main menu drop-downs
	$("#mainMenu .sf-menu").superfish({				
		delay:       180,								// delay on mouseout 
		animation:   {opacity:'show',height:'show'},	// fade-in and slide-down animation 
		speed:       200,								// animation speed 
		autoArrows:  false,								// generation of arrow mark-up 
		disableHI:	 true,								// true to disable hoverIntent detection 
		dropShadows: false								// false to disable drop shadows 
	});
	//Main menu fixes
	$("#mainMenu li.mmItem").mouseover( function() {
		$(this).find("a.mainlevel").addClass("hover");
	});
	$("#mainMenu li.mmItem").mouseout( function() {
		$(this).find("a.mainlevel").removeClass("hover");
	});
	
	//Search Box text replacement
	var searchIntialVal = "Search Our Site...";
	$('#searchform .button').val('');
	$('#searchform #s').val(searchIntialVal);
	$('#searchform #s').focus( function(){
		if( $.trim($(this).val()) == searchIntialVal ){ $(this).val(''); }
	});
	$('#searchform #s').blur( function(){
		if( $.trim($(this).val()) == '' ){ $(this).val(searchIntialVal); }
	});
	
	//Submit Btn on Comment Form
	$('.leaveCommentForm input.btnSubmit').val('');
	
	//add odd/even classes to tables 
	$('table').each(function() {
		$(this).find('tr:odd').addClass('odd');
		$(this).find('tr:even').addClass('even');
	});	
	
	//Side Panel Image Gallery Pop-up
	$("#side-gallery a[rel='colorbox']").colorbox({
		slideshow:true
	});


});



//----- Validate Email Addresses -----------//
// checks for valid looking email addy
function checkemail(str){
	var filter=/^.+@.+\..{2,3}$/;	
	return (filter.test(str));
}



//----- Trim White Space -----------//
//trim whitespace for validation
function trim(s){
	if((s==null)||(typeof(s)!='string')||!s.length)return'';return s.replace(/^\s+/,'').replace(/\s+$/,'')
}


//----- Open New Window -----------//
//Open a new window with specific width/height/location 
function openWindow(location, width, height) {		
	newWidth = width + 20;
	newHeight = height + 20;
	widthHeight = "width=" + newWidth + ",height=" + newHeight;
	window.open(location,"",widthHeight);		
}

//----- Open New Window -----------//
//Open a new window with specific width/height/location & scroll bars
function openWindowScroll(location, width, height) {		
	newWidth = width + 20;
	newHeight = height + 20;
	windowParameters = "width=" + newWidth + ",height=" + newHeight + ",scrollbars=yes";
	window.open(location,"",windowParameters);		
}

