//JavaScript Document
function writeMiddle(floder_id,menu_id,lang,doc_id){
document.write("<table border=0 cellpadding=0 cellspacing=0 class=table_middle>");
document.write("<tr>");
document.write("<td rowspan=2 class=menu_td_width valign=top>");
addinierFlash(floder_id,doc_id,lang,255,350);
document.write("</td>");
document.write("<td class=menu_td_height></td>");
document.write("</tr>");
document.write("<tr>");
document.write("<td valign=top align=left>");
addIFrame(floder_id,doc_id);
document.write("</td>");
document.write("</tr>");
document.write("</table>");
}

function writePromotionMiddle(){
document.write("<table border=0 cellpadding=0 cellspacing=0 class=news>");
document.write("<tr>");
document.write("<td background=../../img/en/promotion/bg_up.jpg class=news_title style=\"background-repeat:no-repeat\" valign=top>");

document.write('<div class="news_title" id="panel1" style="width:200px; height:215px;float:left; position:absolute; margin-left:20px;">');

document.write("<span style=color:#942C21>1.</span> <span style=color:#ffe198><b>Be Gourmet, Be Città<br/>&nbsp;&nbsp;&nbsp;&nbsp;Member event</b></span>");
document.write("<br/><a href=../promotion/news.html style=color:#310000;text-decoration:none;><b>&nbsp;&nbsp;&nbsp;&nbsp;View</b> ></a><br/>");

document.write("<span style=color:#942C21>2.</span> <span style=color:#ffe198><b>Be Chilled, be Città<br/>&nbsp;&nbsp;&nbsp;&nbsp;Special promotion</b></span>");
document.write("<br/><a href=../promotion/news6.html style=color:#310000;text-decoration:none;><b>&nbsp;&nbsp;&nbsp;&nbsp;View</b> ></a><br/>");

document.write("<span style=color:#942C21>3.</span> <span style=color:#ffe198><b>Be Chilled, be Città<br/>&nbsp;&nbsp;&nbsp;&nbsp;Happy Hours</b></span>");
document.write("<br/><a href=../promotion/news5.html style=color:#310000;text-decoration:none;><b>&nbsp;&nbsp;&nbsp;&nbsp;View</b> ></a><br/>");

document.write("<span style=color:#942C21>4.</span> <label style=color:#942C21><b>Valid until June 30th,2008</b><br/></label>");
document.write("<span style=color:#ffe198><b>&nbsp;&nbsp;&nbsp;&nbsp;Be Italian, Be Città<br/>&nbsp;&nbsp;&nbsp;&nbsp;Italian month in Città</b></span>");
document.write("<br/><a href=../promotion/news4.html style=color:#310000;text-decoration:none;><b>&nbsp;&nbsp;&nbsp;&nbsp;View</b> ></a><br/>");

document.write("</div>");
////hidden section 
document.write('<div class="news_title" id="panel2" style="width:200px; height:220px;float:left; position:absolute; margin-left:20px; display:none;">');

document.write("<span style=color:#942C21>5.</span> <label style=color:#942C21><b>Feb 4th, 2008</b><br/></label>");
document.write("<span style=color:#ffe198><b>&nbsp;&nbsp;&nbsp;&nbsp;Città Espresso Club opening<br/>&nbsp;&nbsp;&nbsp;&nbsp;in Yu Yuan Garden </b></span>");
document.write("<br/>&nbsp;&nbsp;&nbsp;&nbsp;<a href=../promotion/flash1.html style=color:#310000;text-decoration:none;><b>Pictures</b></a> >&nbsp;&nbsp;&nbsp;&nbsp;<a href=../promotion/news2.html style=color:#310000;text-decoration:none;><b>Videos</b></a> ><br/>");

document.write("<span style=color:#942C21>6.</span> <label style=color:#942C21><b>Dec 15th, 2007</b><br/></label>");
document.write("<span style=color:#ffe198><b>&nbsp;&nbsp;&nbsp;&nbsp;First Città Espresso Club opens<br/>&nbsp;&nbsp;&nbsp;&nbsp;its doors next to Zhongshan Park</b></span>");
document.write('</div>');

///buttom begin
document.write('<div id="btn2" style="width:20px; height:20px; float:right; margin-top:275px;"><a href="#" onClick="displayPannel2(\'panel2\')"><img src="../../img/en/promotion/right.jpg" title="Next"></a></div>');
document.write('<div id="btn1" style="width:20px; height:20px; float:right; margin-top:275px; margin-right:10px;"><a href="#" onClick="displayPannel1(\'panel1\')"><img src="../../img/en/promotion/left.jpg" title="Back"/></div>');
///buttom end
document.write("</td>");
document.write("</tr>");
document.write("<tr>");	
document.write("<td height=78><img src=../../img/en/promotion/bg_down.jpg border=0 usemap=\"#Map\"/></td>");
document.write("</tr>");
document.write("</table>");
document.write("<map name=Map id=Map>");
document.write("<area shape=rect coords=13,5,247,28 href=\"../promotion/flash4.html\" />");
document.write("<area shape=rect coords=12,32,248,53 href=\"../email_regist/email_regist.html\" />");
document.write("<area shape=rect coords=14,57,244,78 href=\"../promotion/member.html\" />");
document.write("</map>");
}

function write_cn_PromotionMiddle(){
document.write("<table border=0 cellpadding=0 cellspacing=0 class=news>");
document.write("<tr>");
document.write("<td height=307 background=../../img/cn/promotion/bg_up.jpg class=news_title style=\"background-repeat:no-repeat\" valign=top>");
document.write('<div class="news_title" id="panel1" style="width:200px; height:215px;float:left; position:absolute; margin-left:20px;">');

document.write("<span style=color:#942C21>1.</span> <label style=color:#ffe198><b>Be Gourmet, Be Città<br/>&nbsp;&nbsp;&nbsp;&nbsp;会员专属活动</b></label>");
document.write("<br/><a href=../promotion/news.html style=color:#310000;text-decoration:none;><b>&nbsp;&nbsp;&nbsp;&nbsp;查看</b> ></a><br/>");

document.write("<span style=color:#942C21>2.</span> <label style=color:#ffe198><b>Be Chilled, be Città<br/>&nbsp;&nbsp;&nbsp;&nbsp;促销活动</b></label>");
document.write("<br/><a href=../promotion/news6.html style=color:#310000;text-decoration:none;><b>&nbsp;&nbsp;&nbsp;&nbsp;查看</b> ></a><br/>");


document.write("<span style=color:#942C21>3.</span> <label style=color:#ffe198><b>Be Chilled, be Città<br/>&nbsp;&nbsp;&nbsp;&nbsp;欢乐时光</b></label>");
document.write("<br/><a href=../promotion/news5.html style=color:#310000;text-decoration:none;><b>&nbsp;&nbsp;&nbsp;&nbsp;查看</b> ></a><br/>");

document.write("<span style=color:#942C21>4.</span> <label style=color:#942C21><b>有效期至 2008年6月30号</b><br/></label>");
document.write("<label style=color:#ffe198><b>&nbsp;&nbsp;&nbsp;&nbsp;Be Italian, Be Città<br/>&nbsp;&nbsp;&nbsp;&nbsp;Città的意大利月</b></label>");
document.write("<br/><a href=../promotion/news4.html style=color:#310000;text-decoration:none;>&nbsp;&nbsp;&nbsp;&nbsp;<b>查看</b> ></a><br/>");

document.write("</div>");

document.write('<div class="news_title" id="panel2" style="width:200px; height:220px;float:left; position:absolute; margin-left:20px; display:none;">');

document.write("<span style=color:#942C21>5.</span> <label style=color:#942C21><b>2008年2月4日</b><br/></label>");
document.write("<label style=color:#ffe198><b>&nbsp;&nbsp;&nbsp;&nbsp;享咖俱乐部在豫园盛大开幕</b></label>");
document.write("<br/>&nbsp;&nbsp;&nbsp;&nbsp;<a href=../promotion/flash1.html style=color:#310000;text-decoration:none;><b>照片</b></a> >&nbsp;&nbsp;&nbsp;&nbsp;<a href=../promotion/news2.html style=color:#310000;text-decoration:none;><b>视频</b></a> ><br/>");
document.write("<span style=color:#942C21>6.</span> <label style=color:#942C21><b>2007年12月15日</b><br/></label>");
document.write("<label style=color:#ffe198><b>&nbsp;&nbsp;&nbsp;&nbsp;第一家享咖俱乐部在中山公园<br/>&nbsp;&nbsp;&nbsp;&nbsp;盛大开幕</b> </label>");
document.write('</div>');

///buttom begin
document.write('<div id="btn2" style="width:20px; height:20px; float:right; margin-top:275px;"><a href="#" onClick="displayPannel2(\'panel2\')"><img src="../../img/en/promotion/right.jpg" title="下一页"></a></div>');
document.write('<div id="btn1" style="width:20px; height:20px; float:right; margin-top:275px; margin-right:10px;"><a href="#" onClick="displayPannel1(\'panel1\')"><img src="../../img/en/promotion/left.jpg" title="上一页"/></div>');
///buttom end
document.write("</td>");
document.write("<tr>");	
document.write("<td height=78><a href=../email_regist/email_regist.html><img src=../../img/cn/promotion/bg_down.jpg border=0 usemap=\"#Map\"/></a></td>");
document.write("</tr>");
document.write("</table>");
document.write("<map name=Map id=Map>");
document.write("<area shape=rect coords=13,5,247,28 href=\"../promotion/flash4.html\" />");
document.write("<area shape=rect coords=12,32,248,53 href=\"../email_regist/email_regist.html\" />");
document.write("<area shape=rect coords=14,57,244,78 href=\"../promotion/member.html\" />");
document.write("</map>");
}

function displayPannel2(id){
	document.getElementById(id).style.display = "block";
	document.getElementById('panel1').style.display = "none";
}

function displayPannel1(id){
	document.getElementById(id).style.display = "block";
	document.getElementById('panel2').style.display = "none";
}
//********************************************************************
function $(s){return document.getElementById(s);}
//********************************************************************
function News_Hover(n,counter){
	for(var i=1;i<=counter;i++){
		$("News_ID_"+i).className = "left_out";
	}
		$("News_ID_"+n).className = "left_over";
}
function Promotion_Hover(n,counter){
	for(var i=1;i<=counter;i++){
		$("Promotion_ID_"+i).className = "y_2";
		$("Promotion_Pic_"+i).className = "pic_out";
	}
		$("Promotion_ID_"+n).className = "red";
		$("Promotion_Pic_"+n).className = "pic_over";
}
//********************************************************************
var flag=false;//图片按比例缩放
function DrawImage(ImgD,iwidth,iheight){ //参数(图片,允许的宽度,允许的高度)
	var image=new Image();
	image.src=ImgD.src;
	if(image.width>0 && image.height>0){
		flag=true;
		if(image.width/image.height>= iwidth/iheight){
			if(image.width>iwidth){ 
				ImgD.width=iwidth;
				ImgD.height=(image.height*iwidth)/image.width;
			}
			else{
				ImgD.width=image.width; 
				ImgD.height=image.height;
			}
			ImgD.alt=image.width+"×"+image.height;
		}
		else{
			if(image.height>iheight){ 
				ImgD.height=iheight;
				ImgD.width=(image.width*iheight)/image.height; 
			}
			else{
				ImgD.width=image.width; 
				ImgD.height=image.height;
			}
			ImgD.alt=image.width+"×"+image.height;
		}
	}
}
//********************************************************************
function getHttpObject(){
	var Http=null;
	if(window.ActiveXObject){
		Http=new ActiveXObject("Msxml2.XMLHTTP");
		if(!Http){Http=new ActiveXObject("Microsoft.XMLHTTP");}
	}
	else if(window.XMLHttpRequest){Http=new XMLHttpRequest();}
	return Http;
}
//********************************************************************
var News_Title_Http = getHttpObject();
var News_Content_Http = getHttpObject();
var Promotion_Title_Http = getHttpObject();
var Promotion_Content_Http = getHttpObject();
//********************************************************************
function Ajax_News_Title(Class_ID,Page,Lang){
	var News_Title_Url = "../../XK_Include/Web_Ajax.Asp?Action=Ajax_News_Title&Class_ID="+Class_ID+"&Lang="+Lang+"&Page="+Page+"&RandomID="+Math.random();
	News_Title_Http.open("GET", News_Title_Url , true);
	News_Title_Http.onreadystatechange = Ajax_News_Title_HttpResponse;
	News_Title_Http.send(null);
}
//********************************************************************
function Ajax_News_Content(Class_ID,ID,Lang){
	if (Lang=="cn"){
		$("News_Content").innerHTML = "<div style='padding:100px 180px;'>正在加载信息。。。</div>";			
	}
	else {
		$("News_Content").innerHTML = "<div style='padding:100px 180px;'>Loading ...</div>";	
	}
	var News_Content_Url = "../../XK_Include/Web_Ajax.Asp?Action=Ajax_News_Content&Class_ID="+Class_ID+"&Lang="+Lang+"&ID="+ID+"&RandomID="+Math.random();
	News_Content_Http.open("GET", News_Content_Url , true);
	News_Content_Http.onreadystatechange = Ajax_News_Content_HttpResponse;
	News_Content_Http.send(null);
}
//********************************************************************
function Ajax_News_Title_HttpResponse(){
	if (News_Title_Http.readyState == 4 && News_Title_Http.status == 200) {
		Results = News_Title_Http.responseText;
		$("News_Title").innerHTML = Results;
	}
}
//********************************************************************
function Ajax_News_Content_HttpResponse(){
	if (News_Content_Http.readyState == 4 && News_Content_Http.status == 200) {
		Results = News_Content_Http.responseText;
		$("News_Content").innerHTML = Results;
	}
}
//********************************************************************
function Ajax_Promotion_Title(Page,Lang){
	var Promotion_Title_Url = "../../XK_Include/Web_Ajax.Asp?Action=Ajax_Promotion_Title&Lang="+Lang+"&Page="+Page+"&RandomID="+Math.random();
	Promotion_Title_Http.open("GET", Promotion_Title_Url , true);
	Promotion_Title_Http.onreadystatechange = Ajax_Promotion_Title_HttpResponse;
	Promotion_Title_Http.send(null);
}
//********************************************************************
function Ajax_Promotion_Content(ID,Lang){
	if (Lang=="cn"){
		$("Promotion_Content").innerHTML = "<div style='padding:100px 180px;'>正在加载信息。。。</div>";			
	}
	else {
		$("Promotion_Content").innerHTML = "<div style='padding:100px 180px;'>Loading ...</div>";	
	}
	var Promotion_Content_Url = "../../XK_Include/Web_Ajax.Asp?Action=Ajax_Promotion_Content&Lang="+Lang+"&ID="+ID+"&RandomID="+Math.random();
	Promotion_Content_Http.open("GET", Promotion_Content_Url , true);
	Promotion_Content_Http.onreadystatechange = Ajax_Promotion_Content_HttpResponse;
	Promotion_Content_Http.send(null);
}
//********************************************************************
function Ajax_Promotion_Title_HttpResponse(){
	if (Promotion_Title_Http.readyState == 4 && Promotion_Title_Http.status == 200) {
		Results = Promotion_Title_Http.responseText;
		$("Promotion_Title").innerHTML = Results;
	}
}
//********************************************************************
function Ajax_Promotion_Content_HttpResponse(){
	if (Promotion_Content_Http.readyState == 4 && Promotion_Content_Http.status == 200) {
		Results = Promotion_Content_Http.responseText;
		$("Promotion_Content").innerHTML = Results;
	}
}
//********************************************************************
function email(Lang,ID){
	if(Lang=="cn"){
		var tishi_cn=prompt("提示：请填写发送目标的电子邮件","@");
		if(tishi_cn!=null&&tishi_cn!=""){
			window.open('service.asp?Action=Email&email='+tishi_cn+'&ID='+ID+'','','');
		}
	}
	if(Lang=="en"){
		var tishi_en=prompt("Tip:Please fill in the e-mail address","@");
		if(tishi_en!=null&&tishi_en!=""){
			window.open('service.asp?Action=Email&email='+tishi_en+'&ID='+ID+'','','');
		}
	}
}
//********************************************************************
function Down(ID){
	window.open('service.asp?Action=Down&ID='+ID+'','','');
}
//********************************************************************
//window.open('mailto:'+tishi_en+'?subject=Recommend to your friend coupons&amp;body=Dear friend:%0d%0aClick link to view that I assure you recommend coupons %0d%0a'+url+'','','');	