function getYoutubeDataSource() {
	var url = "../../showAction.do?method=getYoutubeDataSource&lang=hk";
	return url;
}

function getHomeBigBannerBannerDataSource() {
	var url = "../../showAction.do?method=banner&lang=hk";
	return url;
}

function getHomeBigBannerGalleryDataSource() {
	var url = "../../showAction.do?method=getHomeBigBannerGalleryDataSource&lang=hk";
	return url;
}

function getSmallBannerDataSource() {
	var url = "../../showAction.do?method=getSmallBannerDataSource&lang=hk";
	return url;
}

function getXmlLeftNavDataSource() {
	var url = "../../showAction.do?method=getXmlLeftNavDataSource&lang=hk";
	return url;
}

function getMainNavDataSource() {
	var url = "../../showAction.do?method=getMainNavDataSource&lang=hk";
	return url;
}

function getGalleryXMLDataSource() {
     var url = "../../showAction.do?method=photogallery&lang=hk";
     return url;
}

function fontsizeplus(){	
	controlfontsize(1);
}

function fontsizeminus(){
	controlfontsize(-1);
}

function controlfontsize(_inc){
	changeFontSize('content', _inc, 0);
	for(var i=0; i<10; i++){
		var obj = document.getElementById('fontsizeContent' + i);
		if(obj)
			changeFontSize('fontsizeContent' + i, _inc, 0);
	}
}

function print_page(){
	window.print();
}

function switchLang(lang,ver){
	//alert("lang:" + lang + ", ver:" + ver);
	var url = window.location.href;
	
	//handler in text version
	if(lang == 'txt'){
		//handle transfer to images version
		if(ver == 'img'){
			if(url.indexOf('?txt=y&') != -1)
				window.location.href = url.replace('txt=y&','');
			else if(url.indexOf('?txt=y') != -1)
				window.location.href = url.replace('?txt=y','');
			else if(url.indexOf('&txt=y') != -1)
				window.location.href = url.replace('&txt=y','');		
		}else{
			transferLang(ver);
		}
	//handler in images version
	}else{
		//handle transfer to text version
		if(ver == 'txt'){
			if(url.indexOf('txt') != -1)
				return;
			(url.indexOf('?') == -1 && url.slice(-3) == '.do')			
				? window.location.href += '?txt=y'
				: window.location.href += '&txt=y';
		}else{
			transferLang(ver);
		}
	}
	
	//handle transfer languages
	function transferLang(_lang){		
		if(_lang == 'hk') _lang = 'tc';
		else if(_lang == 'cn') _lang = 'sc';
		else if(_lang == 'eng') _lang = 'en';
		
		var url = window.location.href;
		//alert("url:" + url + ", lang:" + _lang);
		if(url.indexOf('/tc/') != -1)
			window.location.href = url.replace('/tc/', '/' + _lang + '/');
		else if(url.indexOf('/sc/') != -1)
			window.location.href = url.replace('/sc/', '/' + _lang + '/');
		else if(url.indexOf('/en/') != -1)
			window.location.href = url.replace('/en/', '/' + _lang + '/');	
	}
}

/* 
Methods for resizing the flash stage at runtime.

setFlashWidth(divid, newW)
divid: id of the div containing the flash movie.
newW: new width for flash movie

setFlashWidth(divid, newH)
divid: id of the div containing the flash movie.
newH: new height for flash movie

setFlashSize(divid, newW, newH)
divid: id of the div containing the flash movie.
newW: new width for flash movie
newH: new height for flash movie

canResizeFlash()
returns true if browser supports resizing flash, false if not. 
*/
function setFlashWidth(divid, newW){
	document.getElementById(divid).style.width = newW+"px";
}
function setFlashHeight(divid, newH){
	document.getElementById(divid).style.height = newH+"px";		
}
function setFlashSize(divid, newW, newH){
	setFlashWidth(divid, newW);
	setFlashHeight(divid, newH);
}
function canResizeFlash(){
	var ua = navigator.userAgent.toLowerCase();
	var opera = ua.indexOf("opera");
	if( document.getElementById ){
		if(opera == -1) return true;
		else if(parseInt(ua.substr(opera+6, 1)) >= 7) return true;
	}
	return false;
}