	$(document).ready(
				function(){
					addMenuClose('.newleftmenu',false);
					//addSubMenuClose('.submenu',false);
					addSubMenuPop('.submenu','.indrop');
					//addQandA('.qanda-question');
					addQandA('.qanda-q-link');
					setAudio();
					if (navigator.userAgent.substr(0,40).indexOf('MSIE 6.0') !=-1){
						$("#nav-one li").hover(
							function(){ $("ul", this).show();$('#newsearch').hide(); }, 
							function() { $("ul", this).hide();$('#newsearch').show();} 
						);	
					}else{
						$("#nav-one li").hover(
							function(){ $("ul", this).show(); }, 
							function() { $("ul", this).hide();} 
						);						
					}

				  	if (document.all) {
						$("#nav-one li").hoverClass ("sfHover");
					}	

					$('#roller1').innerfade({
						animationtype: 'fade',
						speed: 500,
						timeout: 2000,
						type: 'sequence',
						containerheight: '180px'
					});					



				
	});
	
	$.fn.hoverClass = function(c) {
		return this.each(function(){
			$(this).hover( 
				function() { $(this).addClass(c);  },
				function() { $(this).removeClass(c); }
			);
		});
	};	  
	
	var menuProgress=false;	

	function addMenuClose(inClass,showPanel){
		$(inClass+' h3').css({cursor:'pointer'});
		$(inClass+' h3').next().hide();
		$lastMenu=readCookie('menuopen');
		if($lastMenu!=''){
			$('#'+$lastMenu).next().show();
		}

		$(inClass+' h3').bind('mouseenter',function(e){
			createCookie('menuopen',$(this).attr('id'),1);

			cPanel=$(this).next();
			if(cPanel.css('display')=='none' && !menuProgress){
				menuProgress=true;

				$(inClass+' h3:visible').next().slideUp('fast');
				id=$(this).attr('id');
				$('.indrop').hide();
				if(showPanel){
					$('.lockpanel:visible').hide();
					
					$('#index-'+id).show();							
					
				}

				cPanel.show('fast',function(){menuProgress=false;});						
			}

		});
	}
	
	function resetMenu(){
		createCookie('menuopen','nomenu',1);
	}
	
	function addSubMenuClose(inClass,showPanel){
		$(inClass).css({cursor:'pointer'});
		$(inClass).next().hide();

		$(inClass).bind('mouseenter',function(e){
			cPanel=$(this).next();
			if(cPanel.css('display')=='none'){
				cPanel.slideDown('fast');						
			}
		});
	}
	
	var popTimer;
	
	function addSubMenuPop(inClass,subClass){
		$(inClass).css({cursor:'pointer'});
		$(inClass).next().addClass('popout');
		//$(subclass).css({zIndex:'999'});
		$(subClass).bgiframe();
		$(inClass).bind('mouseenter',function(e){
			if(popTimer){
				clearTimeout(popTimer);
			}
			//first hide anyflash items
			$('.taudio,.tvideo').hide();
			cPanel=$(this).next();
			p1=$(this).position();
			dx=(cPanel.height()/2);
			ttop=p1.top-dx;
			if(ttop<30){ttop=0};
			cPanel.css('top',ttop);
			cPanel.css('left',p1.left+190);
			cPanel.bgiframe();
			cPanel.show();						
			
		});
		$(inClass).bind('mouseleave',function(e){
			cPanel=$(this).next();
			popTimer=setTimeout('closePop()',300);
			
		});	
		
		$(subClass).bind('mouseenter',function(e){
			if(popTimer){
				clearTimeout(popTimer);
			}
		});	
		
		$(subClass).bind('mouseleave',function(e){
			if(popTimer){
				clearTimeout(popTimer);
			}
			popTimer=setTimeout('closePop()',300);
		});					
	}
	
	function closePop(cPanel){
		$('.indrop').hide();
		$('.taudio,.tvideo').show();

		
	}
	
	function addQandA(inClass){
		$(inClass).css({cursor:'pointer'});
		$(inClass).next().hide();
		$(inClass).bind('click',function(e,inClass){
			cPanel=$(this).next();
			if($(this).next().css('display')=='none'){
				$('.qanda-q-link').text('More...');
				$(this).text('Less...');
				$('.answers:visible').slideUp('fast');
				cPanel=$(this).next();
				cPanel.slideDown('fast');				
			}else{
				$(this).text('More...');
				cPanel.slideUp('fast');
			}
			return false;



			
		});
	}
	
	function setAudio(){
		$f("a.taudio", "http://cdn.clevertech.tv/cdn/flash/flowplayer-3.1.1.swf", { 
		    plugins: {controls: {fullscreen: false,height: 30}},clip: {autoPlay: false}});		
		$f("a.tvideo", "http://cdn.clevertech.tv/cdn/flash/flowplayer-3.1.1.swf",{ 
		    plugins: {controls: {fullscreen: false}},clip: {autoPlay: false}});		
	}
	
	
	

	

	function editMe(){
		$('.fx').each(function(i){
			//$('#'+this.id).prepend('<a style=%22background:#ff0000;color:#ffffff;position:absolute;margin:5px;%22 href=%22../edit/edit.php?id='+this.id+'%22>'+this.id+'</a>');
			$('#'+this.id).prepend('<a style="background:#ff0000;color:#ffffff;position:absolute;margin-left:5px;" href="../edit/edit.php?id='+this.id+'">'+this.id+'</a>');;
		});
	}
