$.fn.hoverClass = function(c) {

	return this.each(function(){
	$(this).hover(

	function() { $(this).addClass(c); },
	function() { $(this).removeClass(c); }

		);
	});
};

function menu(){
$("#menu li").hover(function(){$("ul", this).hide(); $("ul", this).fadeIn('slow'); },function() { }	);
	if (document.all) {	$("#menu li").hoverClass ("sfHover");}	
}
function topMenu(){
	$("#top li").hover(function(){$('#top li').children('a').removeClass('active'); $(this).children('a').addClass('active');$(".top-down").show("20")},function() { }	);
	if (document.all) {	$("#top li").hoverClass ("sfHover");}
	$("#top li").mouseout(function(){$(".top-down").hide()});
	/*$("#top li").mouseout(function(){$(".top-down").hide();});*/
	$(".top-down").mouseover(function(){$(this).show();});
	$(".top-down").mouseout(function(){$(this).hide(); $('#top li').children('a').removeClass('active'); });
}
function searchForm(){
	$('#search').mouseover(function(){	$('#search .input').show('fast'); $('#search .input:first').focus(); $('#search .submit').removeAttr('disabled');  });
	$('#search .input').blur(function(){ if($(this).val()==''){	$(this).hide(); $('#search .submit').attr("disabled", true);}});
}
function loadMenu(title)
{
	$(".top-down").html('');
	$(".top-down").removeClass('quick-links');
	if(title=='quick-links')
	{
		$(".top-down").addClass('quick-links');
	}
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request");
	 return;
	 }
	var url="loadmenu.php";
	url=url+"?url="+title;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function newsLetter()
{
	$('#popup').children('img.close').click(function(){$('#popup-container').fadeOut();$('#popup').fadeOut();});
	$('#popup-container').click(function(){$(this).fadeOut();$('#popup').fadeOut();});
	if($('.subscription-form').length > 0)
	{
		$('.subscription-form').validate();	
	}
}

function showPop()
{
	$('#popup-container').fadeIn('50');$('#popup').fadeIn('50');
}



function stateChanged() 
{ 	
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	 $(".top-down").html(xmlHttp.responseText);
	 var script = 'http://s7.addthis.com/js/250/addthis_widget.js#domready=1';
		if (window.addthis){
			window.addthis = null;
		}
		$.getScript( script );
	 }
	 else
	 {
		 $(".top-down").html('<img src="/siteimages/images/loader.gif" alt="Loading" class="loader"/>');	 
	 }
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}



