var default_revision_date = '7/16/2010';
var default_review_review_Date = '7/16/2010';
var langs = new Array('en', 'tc', 'sc');
var langCaption = new Array('English', '繁體中文', '簡体中文');
var lang = '';
var langSearch = '';
function Menu() {
	this.contentId = 0;
	this.alt = "";
	this.href = "";
	this.target = "";
	this.Class = "";
	this.aClass = "";
	this.divClass = "";
	this.menuItem="";
	this.ulID = '';
	this.ulClass = '';
	this.extraHTML="";
	this.childs = new Array();
	this.addChild = function(m) {
		this.childs[this.childs.length] = m;
	}
}

for(var counter=0; counter<langs.length; counter++){
	if(location.href.toString().search('/'+langs[counter]+'/')!=-1){
		lang = langs[counter];
		
	}
}
if(lang==''){
	var temp = 1;
	if (location.href.indexOf("lang=")>0) {
		temp = location.href.match(/lang=\d+/)[0];
		temp = temp.replace('lang=','') - 1;
	}
	lang = langs[temp];
	var currentSection = '';
}else{
	var theEval = eval('/'+lang+'\\/[a-zA-Z0-9\_]+/');
	var currentSection = location.href.toString().match(theEval)[0].replace(lang+'/','');
}
try{
	var currentRootSection = zmsCurrentContentId;
	if(zmsParentContentId!=''){
		currentRootSection = zmsParentContentId.match(/\d+,$/)[0].replace(',','');
	}
	
}catch(e){
}


function getPath(){
	var langs = ['en', 'tc', 'sc'];
	var currentLang = langs[0];
	var locat = '';
	for(x in langs){
		if(location.href.search("/"+langs[x]+"/")!=-1){
			currentLang = langs[x];
			locat = location.href.substr(0, location.href.search('/'+currentLang+'/'));
			break;
		}
		else{
			if(location.href.search("/index.html")!=-1){
				locat = location.href.substr(0, location.href.search('/index.html'));
			}else if(location.href.search("/indext.html")!=-1){
				locat = location.href.substr(0, location.href.search('/indext.html'));
			}else{
				locat = location.href.substr(0, location.href.length-1);
			}
		}
	}
	//alert(location.href.substr(0, location.href.search('/'+currentLang+'/')));
	return [locat, currentLang];
}
var temp = getPath();
var currentPath = temp[0];
var currentLang = temp[1];
var currentPathLang = temp[0] + '/' + temp[1] + '/';

var ar_section_coming_link = ["","",currentPath + "/en/skin/index.html",currentPath + "/en/facial/index.html",currentPath + "/en/share/index.html",currentPath + "/en/news/index.html",currentPath + "/en/president_share/index.html",currentPath + "/en/intro/index.html"];

function SwitchLang(charsetID){
	//alert(charsetID);
	var url = window.location.toString();
	var isStaticURL = false;
	var langPaths = new Array("en", "tc", "sc");
	var oldLangPath = "";

	// Check url type (is static page or dynamic page)
	for (i=0; i < langPaths.length; i++){
		if (url.indexOf("/"+langPaths[i]+"/") != -1){
			oldLangPath = "/"+langPaths[i]+"/";
			isStaticURL = true;
			//alert(oldLangPath);
			break;
		}
	}

	if (isStaticURL){
		var path;
		path = window.location.href;
		
		if(getCurrentSection(rootMenu) == 1 || charsetID >= 0){
			window.location = path.replace(oldLangPath, "/"+langPaths[charsetID]+"/");
		}else{
			window.location = ar_section_coming_link[getCurrentSection(rootMenu)];
		}
	
	}else{
		if (url.indexOf("lang=") != -1){
			window.location = 
				url.replace(/lang=\d/, "lang="+charsetID);
		}
	}
}

function generateFlash(title_id){
	var flashvars = {};
	var attributes = {};
	var params = {};
	params.quality = "high";
	params.allowScriptAccess ="sameDomain";
	params.menu = "false";
	params.align = "middle";
	params.play = "true";
	params.scale = "exactfit";
	params.wmode = "transparent";
	
	swfobject.embedSWF(currentPath+"/filemanager/template/common/images/nav.swf?titleId="+title_id+"", "flash_container", "100%", "300", "9", "expressInstall.swf", flashvars, params, attributes);
}


function zmsGenerateSectionImage(image_id) {
	if(typeof image_id=='undefined'){
		image_id = 0;
	}
	if (typeof sectionImage!='undefined') {
		var thisSectionImage = '';
		for(var i=sectionImage.length-1;i>0;i--){
			if(sectionImage[i][image_id]!==""){
				thisSectionImage = sectionImage[i][image_id];
				break;
			}else
			return; 
		}
		document.write('<img src="'+thisSectionImage+'" />');
		//alert(thisSectionImage);
	}
}

function printPage() { 
var url=location.href;
if (url.indexOf("?")>0) {
	url += "&print=1";
} else {
url += "?print=1";
 }
 window.open(url);
} 

function DisplayPopup(id,left,top) {

document.write('<div id="'+id+'" style="position:fixed;z-index:100">');
document.write('<map name="image-map">');
document.write('<area shape="rect" coords="317,38,356,55" onclick="document.getElementById(\''+id+'\').style.display=\'none\'"/></map>');
document.write('<img src="../../../filemanager/template/common/images/company.gif" border=0 width=400px height=300px usemap="#image-map"></div>');

document.getElementById(id).style.left=left+'px';
document.getElementById(id).style.top=top+'px';
document.getElementById(id).style.display='block';

}


