/*------------------------------------------------------------------------------------
* Filename: common.js 
* Version: 1.0.0 (2009-09-09)
* Website: www.abv.org.au
* Author: Tanvir Ahmad  & Tayyab Azam
* Description: Handles layout animations.
    ------------------------------------------------------------------------------------*/
	
/*-----------------------------------------------------------------------------------------------------------------------------
* Function: 
* Description:
* Notes: 
* Author: 
    ---------------------------------------------------------------------------------------------------------------------------*/
$(document).ready(function()
 {// Start Document Ready
	
	$('#site_menu_extend').css('position','relative').css('top',0);
	
	//setup();// Start up Function.   
	
	// buinding toggleMenu/Site Menu function  with Site Menu button. 
	$('.site_menu_btn').click(function () {
		toggleMenu();// Call this Function to Show/hide site menu.
	});
	// buinding toggleMenu/Site Menu function  with Site Menu Close button. 
	$(".close_btn img").click(function(){
	 	toggleMenu();// Call this Function to Show/hide site menu.
	});
	
	
	/*CLICKED ON SITE MENU BUTTON*/

	//var group = $('#site_menu_extend');
	//	jslog(3,$('#site_menu_extend').tagName);
	//var groupIsVisible = group.toggle().visible();
	//jslog(3,groupIsVisible);
	/*$(".site_menu_btn").toggle(
	function() {
	//$("#site_menu_extend").animate({height: 1,opacity: "hide" }, 700);
	//jslog(1,"Toggle height:1");
	//	$("#site_menu_extend").stop();
	},
	function() {
	//$("#site_menu_extend").animate({height: 640,opacity: "show"}, 700);
	//jslog(1,"Toggle height:640");
	//$("#site_menu_extend").stop();
	}
	);	
	
	*/
	
	/*	CLICKED ON CROSS BUTTON*/
	$(".close_banner_btn img").toggle(
		function() {
			$("#banner").stop().animate({height: 0,borderTopWidth: 0}, 350);
			$('#plus_minus').attr('src','/images/site_design/plus_btn.png');
			$.cookie('hidebanner', 'yes');
		},
		function() {
			$("#banner").stop().animate({height: 320,borderTopWidth: '10px'}, 350);
			$('#plus_minus').attr('src','/images/site_design/minus_btn.png');
			$.cookie('hidebanner', null);
		}
	);

	$('h2 a[href=#]').each(function(){
		var $p = $(this).parents('h2:first').nextAll('p');
		$(this).parents('h2:first').css('border-bottom','1px dotted #ccc');
		$p.hide();
	}).click(function(){
		$(this).parents('h2:first').nextAll('p,h2').each(function(){
			if (!$(this).is('p')) {
				return false;
			}
			$(this).slideToggle('slow');
		});
		return false;
	});
	
	$('.smallsub .sub_page_record .float_left').each(function(){
		$('p:first',$(this)).after('<p><a href="#" onclick="$(this).parents(\'.float_left:first\').find(\'*:hidden\').show();$(this).parents(\'p:first\').remove();return false">Read More</a></p>');
		$('p:gt(1),h1:gt(0),h2:gt(0),h3:gt(0)',$(this)).hide();
	});
	
	
	if ($.cookie('hidebanner')) {
		$('#banner').css({height: 0,borderTopWidth: 0});
		$('#plus_minus').attr('src','/images/site_design/plus_btn.png');
	}
	/*
	if ($('#banner_images').length)
	{
		$('#banner_images').append('\
		\
			<img src="/images/site_design/banner1.jpg"  width="960" height="320" alt="Banner Image" title="Strengthening Business &amp; Communities - " />\
			<img src="/images/site_design/banner2.jpg"  width="960" height="320" alt="Banner Image" title="Strengthening Business &amp; Communities - " />\
			<img src="/images/site_design/banner3.jpg"  width="960" height="320" alt="Banner Image" title="Strengthening Business &amp; Communities - " />\
			<img src="/images/site_design/banner4.jpg"  width="960" height="320" alt="Banner Image" title="Strengthening Business &amp; Communities - " />\
			<img src="/images/site_design/banner5.jpg"  width="960" height="320" alt="Banner Image" title="Strengthening Business &amp; Communities - " />\
			<img src="/images/site_design/banner6.jpg"  width="960" height="320" alt="Banner Image" title="Strengthening Business &amp; Communities - " />\
			<img src="/images/site_design/banner7.jpg"  width="960" height="320" alt="Banner Image" title="Strengthening Business &amp; Communities - " />\
			<img src="/images/site_design/banner8.jpg"  width="960" height="320" alt="Banner Image" title="Strengthening Business &amp; Communities - " />\
			<img src="/images/site_design/banner9.jpg"  width="960" height="320" alt="Banner Image" title="Strengthening Business &amp; Communities - " />\
			<img src="/images/site_design/banner10.jpg" width="960" height="320" alt="Banner Image" title="Strengthening Business &amp; Communities - " />\
			<img src="/images/site_design/banner11.jpg" width="960" height="320" alt="Banner Image" title="Strengthening Business &amp; Communities - " />\
			<img src="/images/site_design/banner12.jpg" width="960" height="320" alt="Banner Image" title="Strengthening Business &amp; Communities - " />\
		\
		').sdswitch({
				time: 5000,
		    	animateTime: 1000,
		    	startElement: 0,
		    	showWindow: true,
		    	showTitle: true
		});
	}
	*/
	
	
	/* Lets find us some phone numbers! */
	
	
	
	
}); // End Document Ready
/*===========setup===========Start======
* Function: start up Funcition 
* Description: This Function Will run before any 
* Author: Tanvir Ahmad ronty
* Date : 20090914
=======================================*/
//function setup()
//{	
		//toggleMenu();// Call this Function to hide site menu.
			
			
//}
/*============setup==========End=======*/
/*===========toggleMenu===========Start======
* Function: Toggle Site Menu 
* Description: This Function Will Open and Close Site Menu
	1. First it will Check visible status.
	2. If Site Menu visible then it will hide/Close the menu. or 
	3. If Side Menu Not Visible then it will Show/open the menu. also
	4. It will toggle active and inactive class to change + / - image
* Author: Tanvir Ahmad ronty
* Date : 20090914
=======================================*/
function toggleMenu()
{
		if ($("#site_menu_extend").is(":hidden")) {
			$("#site_menu_extend").slideDown(350);
		} else {
			$("#site_menu_extend").slideUp(350);
		}
		
		$(".site_menu_btn").toggleClass("active");
		$(".site_menu_btn").toggleClass("inactive");
	
}
