/**
 *****page的js部分公用方法********
 *
 * @Author:     libing <>
 * @lastupdate  2007-3-15
 *
 *
/*/
var thisDoc=document;
var cacheArr=[];//cache mobile phone
var sound="请输入您要查询的地点，或点击引导搜索进行选择..";
var searchMob="&nbsp;请输入搜索关键字或点击引导搜索...&nbsp;";
var browser=navigator.appName;//检测浏览器类型
//function gE(id){return thisDoc.getElementById(id);}
//var $ = function(s){if(s);return document.getElementById(s);};//为document.getElementById增加一个快捷方式;
//为display的none增加一个快捷方式
function hD(id) {
	if (typeof (id) == "string") {
		id = $(id);
	}
	id.hide();
}
//为display的block增加一个快捷方式
function sH(id) {
	if (typeof (id) == "string") {
		id = $(id);
	}
	id.show();
}
String.prototype.trim = function(){return this.replace(/^\s*|\s*$/ig, "");};
//页面遮罩
function overbg(){
	var b;
	b=$('bg_all');
	sH(b);
	if(browser=="Microsoft Internet Explorer"){
		b.style.height = thisDoc.body.clientHeight + "px";
	}else{
		b.style.height = thisDoc.body.getHeight() + "px";
	}
	b.style.width = thisDoc.body.scrollWidth + "px";
	b.style.opacity = 0.6;
	b.style.filter = "alpha(opacity=60)";
}
function getScrollY() {
	var scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		scrOfY = window.pageYOffset;
	} else if( thisDoc.body && ( thisDoc.body.scrollLeft || thisDoc.body.scrollTop ) ) {
		scrOfY = thisDoc.body.scrollTop;
	} else if( thisDoc.documentElement && ( thisDoc.documentElement.scrollLeft || thisDoc.documentElement.scrollTop ) ) {
		scrOfY = thisDoc.documentElement.scrollTop;
	}
	return scrOfY;
}
//定位在中央的窗口
function getCenterXY(id){
	var o,x,y,loginH,loginW;
	o=$(id);
	loginH=o.getHeight();
	loginW=o.style.width;
	if (browser=="Microsoft Internet Explorer"){
		y = (getScrollY() + ((window.screen.availHeight-window.screenTop - parseInt(loginH))/2));//window.screen.availHeight-window.screenTop - parseInt(loginH);
		x = thisDoc.body.clientWidth - parseInt(loginW);
	}else{
		y = (innerHeight - parseInt(loginH))/2;
		x = innerWidth - parseInt(loginW);
	}
	return {x:x/2,y:y};
}

//定位窗口左下角坐标；
function getIE(e){ 
	var t=e.offsetTop; 
	var l=e.offsetLeft; 
	var h=e.offsetHeight;
	var w=e.offsetWidth;
	while(e=e.offsetParent){ 
		t+=e.offsetTop; 
		l+=e.offsetLeft;
	}
	return {t:t+h,t2:t,l:l,w:w}
}
//*****浮动提示*********
function toolHint(msg,evn) {
	var obj = $("hint");
	var x = evn.clientX + thisDoc.documentElement.scrollLeft;
	var y = evn.clientY + thisDoc.documentElement.scrollTop;
	obj.className="hint";
	obj.innerHTML = msg;
	obj.style.left = x + 15 + "px";
	obj.style.top = y + "px";
	if(obj.style.display != "block"){
		obj.style.display = "block";
	}
}
document.write("<div id='hint' style='position:absolute; display:none; Z-INDEX: 30;'></div>");
document.write("<div id='bg_all' style='position:absolute; display:none; Z-INDEX: 20; BACKGROUND: #ffffff; left: 0px; top: 0px;'></div>");
document.write("<div id='alert_div' style='position:absolute; display:none; Z-INDEX: 100;'></div>")	//模仿ALERT弹出提示；
document.write("<div id='sel_op' style='position:absolute; display:none; Z-INDEX: 10;'></div>")
//长、宽、高等变化方法。
function anim(id,maxNum,moveFashion,S,direction){
	this.pT=20;
	this.pace=direction*S;//步长
	this.chNum=0;
	this.direction=direction;
	this.st=parseInt(id.style[moveFashion]);
	this.st=this.st?this.st:0
	this.en=this.st+maxNum*direction;
	this.id=id;
	this.moveFashion=moveFashion;
	this.action();
}
anim.prototype.action=function(){
	with(this){
		st+=pace;
		var result=0;
		if(st*direction<en*direction){
			pT=pT*.5
			result=st;
			setTimeout(function(){action()},pT);
		}else{
			result=en;
		}
		id.style[moveFashion]=result;
	}
}
//****打开关闭窗口******
function searchF(obj){
	var o=$(obj);
	if(o.style.display!='block'){
		$(obj).show();
	}else{
		hD(obj);
	}
}
var sound="请输入您要查询的地点，或点击引导搜索进行选择..";
var moreEare="如：金融街，月坛，长椿街; 各关键词以逗号或空格隔开";
var Email="您的邮箱地址将成为您在本网站的用户名";
var mapAdd="地点或小区名称";
var mapKey="搜索关键词";
function clearStr(o,s){
	//alert(o.value=s)
	if(o.value==s){
		o.value="";
	}
}
function showStr(o,s){
	if(o.value==""){
		o.value=s;
	}
}
//*****  creat free div  ****//
function craetDiv(){
	tip_obj=thisDoc.createElement("div");
	tip_obj.style.display="block";
	tip_obj.style.left=0+"px";
	tip_obj.style.top=0+"px";
	thisDoc.body.appendChild(tip_obj);
}