$(document).ready(function() {
	$('input[title!=""]').hint();

	
	$("#main-nav ul:first").ohMenu();
	
	// $("ul.menu li.active-trail:first ul:first").attr("style", "");
	
	//$("#flowpanes").tabs(".items > div");.mousewheel(400)
	// select #flowplanes and make it scrollable. use circular and navigator plugins
		
  				
  		$("#flowpanes").scrollable(
					
					{
					
					size: 1
					}
			)
			.circular()	
			.navigator(
							{
							 navi: "#flowtabs",          
							 // select A tags inside the navigator to work as items (not direct children)            
							 naviItem: 'a',           
							 // assign "current" class name for the active A tag inside navigator           
							 activeClass: 'current',           
							 // make browser's back button work            
							 history: true       
							}
				)
				
			.autoscroll(			
			{  	
							autoplay: true,		
							interval: 7000
  		}
  		)
  	;
  					
  		
  	
  		$("#flowpanes-facilitiesone").scrollable(
					
					{
					
					size: 1
					}
			)
			.circular()	
			.navigator(
							{
							 navi: "#flowtabs",          
							 // select A tags inside the navigator to work as items (not direct children)            
							 naviItem: 'a',           
							 // assign "current" class name for the active A tag inside navigator           
							 activeClass: 'current',           
							 // make browser's back button work            
							 history: true       
							}
				)			
			
  	;
  					
			

  	
  	$("#flowpanes-facilitiestwo").scrollable(
					
					{
					
					size: 1
					}
			)
			.circular()	
			.navigator(
							{
							 navi: "#flowtabs",          
							 // select A tags inside the navigator to work as items (not direct children)            
							 naviItem: 'a',           
							 // assign "current" class name for the active A tag inside navigator           
							 activeClass: 'current',           
							 // make browser's back button work            
							 history: true       
							}
				)
			
  	;	
  	
  	

// highlight events 
if (thistemplate == "events")
				$("li.menu-mlid-160").addClass("active-trail"); 	

 



  	
	// Table styling 
	$('table tr:first-child').addClass('table-head');
	$('table tr:last-child').addClass('table-footer');
	
	$('table td:odd').addClass('odd');
	$('table td:even').addClass('even');

	$(document).ready(function(){
		$(".gallery a[rel^='prettyPhoto']").prettyPhoto({theme:'facebook'});
	});
		
	/* Sitemap layout tweaks */
    var oldMap = $("#site-map ul");
    $firstCol = new Array();
    $secondCol = new Array();
    $thirdCol = new Array();
    $("#site-map").append("<div id='col-one'><ul class='menu'></ul></div>");
    $("#site-map").append("<div id='col-two'><ul class='menu'></ul></div>");
    $("#site-map").append("<div id='col-three'><ul class='menu'></ul></div>");
    $("#site-map ul li a").each(function() {
    	if($(this).text() == 'Come to Calgary' || $(this).text() == 'About the GB') {
    		$firstCol.push($(this).parent());
    	}

    	if($(this).text() == 'About the GBC' || $(this).text() == 'About Calgary') {
    		$secondCol.push($(this).parent());
    	}

    	if($(this).text() == 'Events' || $(this).text() == '') {
    		$thirdCol.push($(this).parent());
    	}
    });

    $.each($firstCol,function( intIndex, objValue ){
    	var ul = document.createElement("ul");
    	ul.setAttribute("class", intIndex);
    	$("#col-one").append(ul);
    	$("#col-one ul[class='" + intIndex + "']").append(objValue);
    	ul.setAttribute("class", "menu");
    });

    $.each($secondCol,function( intIndex, objValue ){
    	var ul = document.createElement("ul");
    	ul.setAttribute("class", intIndex);
    	$("#col-two").append(ul);
    	$("#col-two ul[class='" + intIndex + "']").append(objValue);
    	ul.setAttribute("class", "menu");
    });

    $.each($thirdCol,function( intIndex, objValue ){
    	var ul = document.createElement("ul");
    	ul.setAttribute("class", intIndex);
    	$("#col-three").append(ul);
    	$("#col-three ul[class='" + intIndex + "']").append(objValue);
    	ul.setAttribute("class", "menu");
    });

    $("#site-map ul:first").remove();
    $("#col-one ul:first").remove();
    $("#col-two ul:first").remove();
    $("#col-three ul:first").remove();
});
