/* Javascript code to switch language main page */
/* Also for other cookie info passing */

function SwitchLang(varLang,basepath){
 // Also check and clear the PageInfo cookie
        var tempstr
        tempstr = GetCookie("PageInfo");
        if(tempstr != null){
           DeleteCookie("PageInfo","/");
        };
 // end clear PageInfo
	var expdate=new Date();
	enpath="en/"; //index.html";
	chpath="ch/"; //index.html";
	if(basepath == null){
		enurl=enpath;
		churl=chpath;
	}else{
		enurl=basepath + enpath;
		churl=basepath + chpath;
	}
	//set expire date to 30days
	expdate.setTime(expdate.getTime() + (30*24*3600*1000));
	SetCookie("Lang", varLang,expdate,"/");
	if(varLang == "EN"){
		top.location.href=enurl;
	}
	if(varLang == "CH"){
		top.location.href=churl;
	}
};

function SetMovie(varMovie, varMovieSite, basepath){
	var expdate=new Date();
    var tempstr
    var varurl
	//set expire date to 1 day
	expdate.setTime(expdate.getTime() + (1*24*3600*1000));
	SetCookie("Movie", varMovie,expdate,"/");
	SetCookie("MovieSite", varMovieSite,expdate,"/");

	//call up the moviebox
	if(basepath == null){
		varurl='moviebox.htm';
	}else{
		varurl=basepath + 'moviebox.htm';
	}

    tempstr='height=460,width=460,toolbar=no,menubar=no,resizable=yes,status=no,location=no,scrollbars=yes';
	QWin = window.open( varurl,"Video", config=tempstr);
};