$(document).ready(function(){
	
	/**
	* Blur / Focus Functions on Search Input
	*/
	
	$('#searchLeft input[type="text"]').focus(function(){
		if($(this).val().toLowerCase() == 'search')
		{
			$(this).val('');	
		}
	});
	
	$('#searchLeft input[type="text"]').blur(function(){
		if($(this).val() == '')
		{
			$(this).val('Search');	
		}
	});

	/**
	* external links
	*/
	
	$('a[rel="ext"]').attr('target','_blank');
						   
});

	/**
	* Font Replacements
	*/

	Cufon.replace('ul#topMenu li', { fontFamily: 'Myriad Condensed Web' });
	Cufon.replace('#searchLeft', { fontFamily: 'Myriad Condensed Web' });
	Cufon.replace('h1,#theQuoter', { fontFamily: 'Myriad Pro' });
	Cufon.replace('div#quoteHolder p#theQuote', { fontFamily: 'Myriad Pro Italic' });
	Cufon.replace('span.bi', { fontFamily: 'Myriad Pro Italic' });
	
	/**
	* Flash Header and home boxes
	*/
		
	var flashvarsa = {};
	flashvarsa.fv_title = "Community Sector";
	flashvarsa.fv_text = "We can help you develop your projects and ideas by researching into community needs, testing the viability and developing project business plans as well as advising on and helping you secure funding. ";
	flashvarsa.fv_number = "1";
	flashvarsa.fv_color = "#ac1c36";
	flashvarsa.fv_hyper = "";
	var attributesa = {};
	attributesa.id = "box_1_fl";
		
	var flashvarsb = {};
	flashvarsb.fv_title = "Public Sector";
	flashvarsb.fv_text = "We can help you by advising on service delivery and strategy, evaluating your projects and programmes and develop and facilitate partnerships. We undertake sector studies and appraisals and various research assignments.";
	flashvarsb.fv_number = "2";
	flashvarsb.fv_color = "#f0960d";
	flashvarsb.fv_hyper = "";
	var attributesb = {};
	attributesb.id = "box_2_fl";
			
	var flashvarsc = {};
	flashvarsc.fv_title = "Business Sector";
	flashvarsc.fv_text = "We deliver advice workshops to those seeking to set up their own business, mentoring for SMEs and work for and in partnership with other companies. We also bring a specialist understanding of business needs to partnerships seeking...";
	flashvarsc.fv_number = "3";
	flashvarsc.fv_color = "#777777";
	flashvarsc.fv_hyper = "";
	var attributesc = {};
	attributesc.id = "box_3_fl";
		
	var params = {};
			
	swfobject.embedSWF("images/flash/homebox.swf", "boxVoluntaryInside", "300", "131", "8.0.0", false, flashvarsa, params, attributesa);
	swfobject.embedSWF("images/flash/homebox.swf", "boxPublicInside", "300", "131", "8.0.0", false, flashvarsb, params, attributesb);
	swfobject.embedSWF("images/flash/homebox.swf", "boxPrivateInside", "300", "131", "8.0.0", false, flashvarsc, params, attributesc);
			
	/**
	* Drop Shadow
	*/
	$(document).ready(function(){
		setTimeout ( function(){ $('#mainBody').dropShadow() }, 500);
	});
	
	/**
	* Self Explantory - is ie?
	*/
	function isIE()
	{
		return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent);
	}
	
	/**
	*  Top Menu
	*/
	
	$(document).ready(function(){
		
		if(isIE()){ $('ul#topMenu li').removeClass('current'); }
		
		$('ul#topMenu li').hover(
			function(){
				if(!isIE())
				{
					$(this).addClass('current');
				}
				else
				{
					$(this).removeClass('current');
					if($(this).attr('id') == 'home')
					{
						$('#home').css('background',"url(/images/template/top-menu/home.png)");
					}
					else if($(this).attr('id') == 'about-us')
					{
						$('#about-us').css('background',"url(/images/template/top-menu/about-us.png)");	
					}
					else if($(this).attr('id') == 'news')
					{
						$('#news').css('background',"url(/images/template/top-menu/news.png)");
					}
					else if($(this).attr('id') == 'testimonials')
					{
						$('#testimonials').css('background',"url(/images/template/top-menu/testimonials.png)");
					}
					else if($(this).attr('id') == 'contact-us')
					{
						$('#contact-us').css('background',"url(/images/template/top-menu/contact-us.png)");	
					}
				}
			},
			function(){
				if(!isIE()){
					if(!$(this).hasClass('page'))
					{
						$(this).removeClass('current');	
					}
				}
				else
				{
					$('ul#topMenu li:not(.page)').css('background','none');
				}
			}
		);
	});

	/**
	* Preload Images
	*/
	if(document.images)
	{
		var path = "images/template/top-menu/";
	
		homeIMG = new Image();
		aboutUsIMG = new Image();
		contactUsIMG = new Image();
		newsIMG = new Image();
		testimonialsIMG = new Image();

		homeIMG.src = path + "home.png";
		aboutUsIMG.src = path + "about-us.png";
		contactUsIMG.src = path + "contact-us.png";
		newsIMG.src = path + "news.png";
		testimonialsIMG.src = path + "testimonials.png";

	}

