function addFavorite(){
	window.external.addFavorite('http://www.yuyuantm.com.cn/','Yuyuan China Day');
}

function initParameters(prefix){
	if(!prefix)
		prefix='';
	var pairs = document.location.search.substring(1).split("&");
	for (var i=0; i < pairs.length; i++) {
		var values = pairs[i].split("=");
		eval(prefix+values[0]+'="'+unescape(values[1])+'"');
	}
}

function getParameters(){
	return document.location.search.substring(1);
}

function popupMain(lang){
	open('flash/main_'+lang+'.htm','_yuyuan_chinaday_main','width=720 height=530');
}

_mapBase='../';
function getMap(id,lang){
	open(_mapBase+'emap/index.htm?go='+id+'&lang='+lang,'_yuyuan_chinaday_emap','width=200 height=200');
}


//system compatibility codes
function isIE(){
	return navigator.appName=="Microsoft Internet Explorer";
}
function isNetscape(){
	return navigator.appName=="Netscape";
}
function isOpera(){
	return navigator.appName=="Opera";
}
function isMac(){
	return navigator.platform=="MacPPC";
}
function isodd(n){
	return !(Math.floor(n/2)==n/2);
}


//window popup and resizing codes
function _popup(url,target,feature){
	w=open(url,target,feature);
	w.focus;
}

function window_center(w,h){
	window.resizeTo(w,h);
	window.moveTo((screen.width-w)/2,(screen.height-h)/2);
}
function window_expand(w,h,w0,h0,steps) { //v2.0
	if(!steps)
		steps=10;
	if(!w0)
		w0=350;
	if(!h0)
		h0=200;
	window_center(w0,h0);
	if(isIE()){
		dw=w0-window.document.body.clientWidth;
		dh=h0-window.document.body.clientHeight;
	}else{
		dw=w0-window.innerWidth;
		dh=h0-window.innerHeight;
	}
	if(isOpera())
		dw-=16;
//	alert('dw='+dw+' app='+navigator.appName);
	window.focus();
	setTimeout('do_expand('+w+','+h+','+w0+','+h0+','+steps+')',200);
}

function do_expand(w,h,w0,h0,steps){
	for(n=0;n<=steps;n++){
		if(window.closed)
			return;
		window_center(w0+(w-w0)/steps*n+dw,h0+dh);
	}
	for(n=0;n<=steps;n++){
		if(window.closed)
			return;
		window_center(w+dw,h0+(h-h0)/steps*n+dh);
	}
	window_center(w+dw,h+dh);
	if(isNetscape()&&isMac())
		window.setResizable(false);
}
