    

function theRotator($) {
	
	setTimeout('initContent('+$+')',2000);
	setTimeout('initRotator('+$+')',4000);
	
}
function initContent(){
	$j('div#main').fadeIn(3000)
	$j('div#header').fadeIn(3000);
	//$j('body.home').css({'background':'#330033'})
}
function initRotator(){
	
	$j('div#rotator ul li:first').fadeIn(3000, 
	function(){
		 $j('#rotator ul').cycle({
				fx:'fade',
				timeout:10000,
				speed:1000,
				continuous:1
			})
		$j('#footer').fadeIn(1000)
		
		}
		
	);
}

function rotate() {	
	//Get the first image
	var current = ($j('div#rotator ul li.show')?  $j('div#rotator ul li.show') : $j('div#rotator ul li:first'));
	

    if ( current.length == 0 ) current = $j('div#rotator ul li:first');

	//Get next image, when it reaches the end, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $j('div#rotator ul li:first') :current.next()) : $j('div#rotator ul li:first'));


	//Set the fade in effect for the next image, the show class has higher z-index
	next.css({opacity: 0.0}).addClass('show').animate({opacity: 1.0}, 600);
	//next.hide().addClass('show').fadeIn(1000)	
	//Hide the current image
	current.removeClass('show').animate({opacity: 0.0}, 600);
	//current.removeClass('show').fadeOut(700);
	
};



$j=jQuery.noConflict();

 $j(document).ready(function($){
	
	
	
	 
	$('body').addClass('js');
	
		if( ( $.browser.msie ) &&($('body').hasClass('home')==false)){	
		
		  // curvyCorners.addEvent(window, 'load', initCorners);
		
		  function initCorners() {
			var settings = {
			  tl: { radius: 20 },
			  tr: { radius: 20 },
			  bl: { radius: 20 },
			  br: { radius: 20 },
			  antiAlias: true
			}
     
  			 curvyCorners(settings, ".para-first");
		  }
		}

	$('#footer-showHide').click(function(e){
		e.preventDefault();
	
		if($('#footer-widget-area .widget-area').is(':hidden')){
			$('#footer-widget-area .widget-area').slideDown('500');
			$(this).children('a').text('Hide site map')
		}
		else {
			$('#footer-widget-area .widget-area').slideUp('500');
			$(this).children('a').text('Show site map')
		}
	})
	
	
	$('.products ul li').hide()
	$('#about-jcarousel li').click(function(){
		var i = $(this).children('img').attr('alt');
		$('.products ul li').hide()
		$('.products').find('ul li.'+i).fadeIn('slow',
		
		function(){
		 $('html,body').animate({scrollTop : 700},'fast'); 
		}
		);
		   

	})
	

	theRotator($);
	/*
	$('#wrapper').fadeIn(500,
	function(){
		$('div.rotator').fadeIn(500);
        $('div.rotator ul li').fadeIn(500); // tweek for IE
	}
	);
	$('#footer').fadeIn(500);
	
	*/
	
	
		
});
