function change_lang()
{
	tempurl = window.location.href;
	var from;
	var to;
	if (tempurl.search("/chi/") != -1)
	{
		from = 'chi';
		to = 'eng';
	}
	else
	{
		from = 'eng';
		to = 'chi';
	}

	tempurl = tempurl.replace("/"+from+"/", "/"+to+"/");
	window.location.href = tempurl;
}

function indexcalendar_load(url)
{
	$('#index-calendar').load(url);
	return false;
}

function scroll_to_top()
{
	if ($.browser.opera)
		$('html').animate({scrollTop:0}, 'fast'); 
	else
		$('html, body').animate({scrollTop:0}, 'fast'); 
	return false;
}

function load_flash_content(container, url, options)
{
	options.src = url;
	options.allowscriptaccess = 'always';

	$('#'+container).flash(options);
}

function index_slideshow_panel_switch(type)
{
	var photoContainer = $('#slideshow-photo-container');
	var videoContainer = $('#slideshow-video-container');
	if (type == 'v')
	{
		if (!videoContainer.videoSlideShowReady())
			return;

		videoContainer.css('visibility', 'visible');
		videoContainer.activateVideoSlideShow();
		// set left & to to workaround chrome issue
		photoContainer.hide();
		photoContainer.deactivatePhotoSlideShow();

		videoContainer.css('left', 0); 
		videoContainer.css('top', 0);
		photoContainer.css('left', '-1000px'); 
		photoContainer.css('top', '-1000px');

	}	
	else
	{
		videoContainer.css('visibility', 'hidden');
		videoContainer.deactivateVideoSlideShow();
		photoContainer.show();
		photoContainer.activatePhotoSlideShow();

		photoContainer.css('left', '0'); 
		photoContainer.css('top', '0');
		videoContainer.css('left', '-1000px'); 
		videoContainer.css('top', '-1000px');
	}
}

if (jQuery)
{
	jQuery(document).ready(function() 
	{
		$('img.hoverable').imghover({suffix: '-o'});
	});
}
