﻿/*
* Author: simon.gilhooly
*/

function loadDynamic(){

	$('.submenu').hide();
	$('#nav li.mainmenu').hover(function(){
		$(this).css('height', '260px');
		$(this).children('div.submenu').slideDown("fast");
	}, function(){
			$('#nav div.submenu').slideUp("fast");
			$(this).css('height', '50px');
		}
	);

	getMyBlogFeed("367689580224828862");
	
	// populates the calendar section with upcoming events by reading a Google calendar
	googleCal.calId = "colchestercricket.org_885rvg3vfa584f4ep1od1mog1k@group.calendar.google.com";
	googleCal.targetDiv = "calendar";
	googleCal.googleCal();

/*	// Create a search control
		var mySearchControl = new google.search.SearchControl();	//'006772075494994992394:sy_y1n_bffy'
		var newBlogSearch = new google.search.BlogSearch();
		newBlogSearch.setUserDefinedLabel('Results from C&EE blog .. ');
		newBlogSearch.setSiteRestriction('blog.colchestercricket.org');
		newBlogSearch.setUserDefinedClassSuffix('cee');
		mySearchControl.addSearcher(newBlogSearch); 

		var newWebSearch = new google.search.WebSearch();
		newWebSearch.setUserDefinedLabel('Results from C&EE website .. ');
		newWebSearch.setSiteRestriction('www.colchestercricket.org');
		newWebSearch.setUserDefinedClassSuffix('cee');
		mySearchControl.addSearcher(newWebSearch); 
		
	// Draw the control in 'search' div
		mySearchControl.draw(document.getElementById('search')); */
		
// trying to make it work with my own search form -

// define the callback function that gets called when search is complete
		window.processSearchResults = function() {
			var searchResults = this.results;
			var index;
			for (index = 0; index < searchResults.length; index++){
				$('#qsearch-results').append(searchResults[index].html);
			}
		};
		
		var newBlogSearch = new google.search.BlogSearch();
		newBlogSearch.setUserDefinedLabel('Results from C&EE blog .. ');
		newBlogSearch.setSiteRestriction('blog.colchestercricket.org');
		newBlogSearch.setUserDefinedClassSuffix('cee');
		newBlogSearch.setSearchCompleteCallback(newBlogSearch, processSearchResults);
//		mySearch.addSearcher(newBlogSearch); 

// add 'submit' and 'click' events to the form to execute the search using the given string
		$('#quick-search').bind('submit', function(){ return false; });
		$('#quick-search input.btn').bind('click', function(){ newBlogSearch.execute($('#qsearch').val()); }); 
}

// if defined this function is automatically called when Facebook JS library is loaded
window.fbAsyncInit = function() {
    FB.init({
//      appId  : &#39;YOUR APP ID&#39;,
      status : true, // check login status
      cookie : true, // enable cookies to allow the server to access the session
      xfbml  : true  // parse XFBML
    });
  };

// utility functions ....
function showDiv(divId){
	document.getElementById(divId).className = "show";
}
function hideDiv(divId){
	document.getElementById(divId).className = "hide";
}

