function setFrameSize(minHeight) {
	if (window.frameElement) {
		var myHeight=document.body.scrollHeight;
		if(myHeight<1){
			window.location.reload();
			return;
		}
		if(minHeight){
			myHeight=myHeight>minHeight?myHeight:minHeight;
		}
		window.frameElement.style.height = (myHeight + 10)+"px";
	}
}
function GetCookieVal(offset){
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
	endstr = document.cookie.length;
	return decodeURI(document.cookie.substring(offset, endstr));
}
function GetCookie(name){
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen)
	{
	var j = i + alen;
	if (document.cookie.substring(i, j) == arg)
	return GetCookieVal (j);
	i = document.cookie.indexOf(" ", i) + 1;
	if (i == 0) break;
	}
	return null;
}
function orderTicket(langCode,id) {
	var url="http://123.127.254.130/otherticket"
	if(id){
		var userName = GetCookie("userName");
		var token = GetCookie("token");
		if(token && userName){
	   		if("en"==langCode){
	   			
	   		}else {
	   			langCode="zh";	
	   		}
	   		var ticketWindowWidth = screen.width>1024?screen.width:1024;
	   		var ticketWindowHeight = screen.height>768?screen.height:768;
	   		url=url +"/"+id+"/" + token +"/" +langCode;
	   		var ticketWindowConfig = 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,left=0,top=0,width='+ ticketWindowWidth +',height='+ticketWindowHeight;
	   		window.open(url, '', ticketWindowConfig);
		}else {
	   		if("en"==langCode){
	   			alert("please login first.");
	   		}else {
	   			//open new window
	   			var windowConfig = "left=100,top=0,toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=630,height=500";	   			
	   			url="/visitweb/login/performLogin.jsp?performId="+id;
	   			window.open(url, '', windowConfig);
	   			
	   		}
		}
	}
}
