jamlo(document).ready(function() {
 
	try
	{
		// nb this is to initialize the photo gallery
		// as its js's are not included in all pages
		// we use try to suppress errors
		jamlo("a[rel^='prettyPhoto']").prettyPhoto();		
	}
	catch(e)
	{
		// do nothing
	}
	
	
   // put all your jQuery goodness in here.
 
	
	
	/*
	 * this animation is not working on i.e.
	jamlo(".shadetabs").mouseover(function() {  
		jamlo("#tabcontent").fadeTo("slow", 0.4, function() {
			    // Animation complete.
			  });
		  
	});
	jamlo(".shadetabs").mouseout(function() { 

		jamlo('#tabcontent').fadeIn('slow', function() {
			    // Animation complete.
				jamlo("#tabcontent").clearQueue();
			  }); 
	});
	*/
 }); // end document ready


/***
 * 

Global functions
 * 
 *  jamlo is aliasing $ in JQuery, to avoid conflicts
 */ 
function select_tab(tab_id)
{ 
	jamlo('.shadetabs li').removeClass('selected');
	jamlo('#'+tab_id).addClass('selected');
	jamlo('#'+tab_id).fadeIn("slow"); 
} 


function select_tabmenu(id)
{ 
	jamlo('.tabmenu li').removeClass('selected');
	jamlo('#'+id).addClass('selected');
	jamlo('#'+id).fadeIn("slow"); 
} 

 
function fadeIO( id )
{	  
	jamlo("#"+id).fadeTo("slow", 0.2, function() {
	      // Animation complete.
		jamlo("#"+id).fadeTo("slow", 1, function() {
		      // Animation complete.
		    });
	    });	     
}

function fadeOut( id )
{
	jamlo("#"+id).fadeTo("slow", 1, function() {
	      // Animation complete.
			jamlo("#"+id).clearQueue();
	    });
}
function fadeIn( id )
{
	jamlo("#"+id).fadeTo(3000, 0.4, function() {
	      // Animation complete.
	    });
}
 
 

/**
 * Apply carousel animation to the inner page tabs
 */
function animate_tabs()
{ 
	stepcarousel.setup({
	galleryid: 'tabcarousol', //id of carousel DIV
	beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
	panelclass: 'panel', //class of panel DIVs each holding content 
	panelbehavior: {speed:500, wraparound:false, wrapbehavior:'slide', persist:false},
	defaultbuttons: {enable: true, moveby: 1, leftnav: ['../images/tab_left.gif', 27, 109], rightnav: ['../images/tab_right.gif', -405, 109]},
	 contenttype: ['inline'] //content setting ['inline'] or ['ajax', 'path_to_external_file']
	})
}
/**
 * Apply animation carousel  to the top banner images
 */
function animate_topbanner()
{

	/*
	stepcarousel.setup({
		galleryid: 'topcarousol', //id of carousel DIV
		beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
		panelclass: 'panel', //class of panel DIVs each holding content
		autostep: {enable:true, moveby:1, pause:3000},
		panelbehavior: {speed:500, wraparound:true, wrapbehavior:'slide', persist:false},
		defaultbuttons: {enable: true, moveby: 1, leftnav: ['../images/top_left.gif', 30, 158], rightnav: ['../images/top_right.gif', -50, 158]},
		 contenttype: ['inline'] //content setting ['inline'] or ['ajax', 'path_to_external_file']
	});
	*/
}
 
function animate_news(page, lang)
{ 
	stepcarousel.setup({
	galleryid: 'newscarousol', //id of carousel DIV
	beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
	panelclass: 'panel', //class of panel DIVs each holding content
	autostep: {enable:true, moveby:1, pause:4000}, 
	panelbehavior: {speed:500, wraparound:true, wrapbehavior:'slide', persist:false},
	defaultbuttons: {enable: false, moveby: 1, leftnav: ['../images/top_left.gif', 30, 158], rightnav: ['../images/top_right.gif', -50, 158]},
    contenttype: ['ajax', '../News/get_rnews.php?page=' + page + '&lang='+lang] //content setting ['inline'] or ['ajax', 'path_to_external_file']
	})
}


/**
 * buttom news animation
 * @param page
 * @param lang
 */
function animate_bnews(lang)
{ 
	stepcarousel.setup({
	galleryid: 'bnewscarousol', //id of carousel DIV
	beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
	panelclass: 'panel', //class of panel DIVs each holding content
	autostep: {enable:true, moveby:1, pause:5000}, 
	panelbehavior: {speed:500, wraparound:true, wrapbehavior:'slide', persist:false},
	defaultbuttons: {enable: false, moveby: 4, leftnav: ['../images/top_left.gif', 30, 158], rightnav: ['../images/top_right.gif', -50, 158]},
    contenttype: ['ajax', '../News/get_bnews.php?lang='+lang] //content setting ['inline'] or ['ajax', 'path_to_external_file']
	})
}

