$(document).ready(function(){
	//	TOP NAVIGATION *****
		$("a.expand").each(
			function( intIndex ){
				$(this).bind ("mouseover",function(){
					if(!$(this).is('.active')){
						$("a.expand").removeClass('active')
						$("a.expand").parent().children('div').hide();
						$(this).addClass('active')
						if ($.browser.msie && $.browser.version.substr(0,1)<7) {
							$(this).parent().children('div').show();
						}else{
							$(this).parent().children('div').fadeIn();
						}
					}
				});
					
//				$(this).parent().bind ("mouseover",function(){
//						$(this).removeClass('active')
//						$(this).parent().children('div').hide();
//				});

		});
		$("div.subnav").each(function (i) { $(this).hide();});
		$(document).mouseover(function(){$(".subnav").hide();$("a.expand").removeClass('active')});
		$(".subnav a").click(function(){$(".subnav").hide();$("a.expand").removeClass('active')});
		$("a.expand").parent().mouseover(function(e){e.stopPropagation();});
	//	TOP NAVIGATION *****
	expand=false;
	$("#Loginexpand").parent().parent().animate({marginTop: "-53px"}, {duration: 200});
	$("#Loginexpand").click(function(e){
		if(!expand){
			$(this).parent().parent().animate({marginTop: "0px"}, {duration: 600});
			expand=true;
		}else{
			$(this).parent().parent().animate({marginTop: "-53px"}, {duration: 600});
			expand=false;
		}
		e.preventDefault();
	});
	
	$("div.jsimpleaccordian").jsimpleaccordian({
		handle: true,  
		handleclass: "jsaccordianhandle",
		openclass: "open",
		headclass: "jsaccordianhead",  
		contentclass: "jsaccordiancontent"
	});
	
	$(".iframe_content").fancybox({
		'width'				: '75%',
		'height'			: '75%',
        'autoScale'     	: false,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
});


(function($){  
 $.fn.jsimpleaccordian = function(options) {  
	var defaults = {handle: true,  handleclass: "jsaccordianhandle", openclass: "open", headclass: "jsaccordianhead", contentclass: "jsaccordiancontent"}; 
 	var options=$.extend(defaults,options);
 	obj=$(this);
	obj.children().each(function(e){
		if(options.handle){$(this).children("div."+options.headclass).append('<a href="javascript:;" class="'+options.handleclass+'">&nbsp;</a>');}
		if($(this).hasClass(options.openclass)){
			$(this).children("div."+options.contentclass).slideDown("1000");
		}
	})
	$("div."+options.headclass).click(function(){
		if($(this).parent().hasClass(options.openclass)){
			$(this).next().slideUp("2000",function(){$(this).parent().removeClass(options.openclass);})
		}else{
			obj.children().each(function(){
				$(this).removeClass(options.openclass);
				$("div."+options.contentclass).slideUp("2000")
			})
			$(this).parent().addClass(options.openclass);
			$(this).next().slideDown("2000");
		}
	})
 };  
})(jQuery);
