//window.moveTo(0,0);if(document.all){top.window.resizeTo(screen.availWidth,screen.availHeight);}else if(document.layers||document.getElementById){if(top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){top.window.outerHeight=screen.availHeight;top.window.outerWidth=screen.availWidth;}}
var $=function(id){return document.getElementById(id)};
function isIE(){ //ie? 
   if (window.navigator.userAgent.toLowerCase().indexOf("msie")>=1) 
    return true; 
   else 
    return false; 
} 
if(!isIE()){ //firefox innerText define让ie and firefox 都支持innerText
   HTMLElement.prototype.__defineGetter__(     "innerText", 
    function(){
     var anyString = "";
     var childS = this.childNodes;
     for(var i=0; i<childS.length; i++) {
      if(childS[i].nodeType==1)
       anyString += childS[i].tagName=="BR" ? '\n' : childS[i].innerText;
      else if(childS[i].nodeType==3)
       anyString += childS[i].nodeValue;
     }
     return anyString;
    } 
   ); 
   HTMLElement.prototype.__defineSetter__(     "innerText", 
    function(sText){ 
     this.textContent=sText; 
    } 
   ); 
}
if(typeof(HTMLElement)!="undefined" && !window.opera) //让ie和firefox都支持outerHTML
{ 
     HTMLElement.prototype.__defineGetter__("outerHTML",function() 
    { 
        var a=this.attributes, str="<"+this.tagName, i=0;for(;i<a.length;i++) 
        if(a[i].specified) 
             str+=" "+a[i].name+'="'+a[i].value+'"'; 
        if(!this.canHaveChildren) 
            return str+" />"; 
        return str+">"+this.innerHTML+"</"+this.tagName+">"; 
     }); 
     HTMLElement.prototype.__defineSetter__("outerHTML",function(s) 
    { 
        var r = this.ownerDocument.createRange(); 
         r.setStartBefore(this); 
        var df = r.createContextualFragment(s); 
        this.parentNode.replaceChild(df, this); 
        return s; 
     }); 
     HTMLElement.prototype.__defineGetter__("canHaveChildren",function() 
    { 
        return !/^(area|base|basefont|col|frame|hr|img|br|input|isindex|link|meta|param)$/.test(this.tagName.toLowerCase()); 
     }); 
}
var xhr;//无刷新读取内容
function getXHR() {
try {
xhr=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xhr=new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
xhr=false;
}
}
if(!xhr&&typeof XMLHttpRequest!='undefined') {
xhr=new XMLHttpRequest();
}
return xhr;
}
var flag=false; 
function DrawImage(ImgD,iw,ih){ 
 var image=new Image();
 var imgwidth=iw;//最大宽度
 var imgheight=ih;//最大高度
 image.src=ImgD.src; 
 if(image.width>0 && image.height>0){ 
  flag=true; 
  if(image.width/image.height<= imgwidth/imgheight){ 
   if(image.width>imgwidth){
    ImgD.width=imgwidth; 
    ImgD.height=(image.height*imgwidth)/image.width; 
   }
   else{ 
    ImgD.width=image.width;
    ImgD.height=image.height; 
   } 

   ImgD.style.cursor="pointer";
  } 
  else{ 
   if(image.height>imgheight){
    ImgD.height=imgheight; 
    ImgD.width=(image.width*imgheight)/image.height; 
   }else{ 
    ImgD.width=image.width;
    ImgD.height=image.height; 
   } 
   ImgD.style.cursor="pointer";
  } 
 }
}
function sdkdimg(ImgD,iw){ //设定图片的宽度，超过就缩
 var image=new Image();
 var imgwidth=iw;//最大宽度
 image.src=ImgD.src; 
	 if(image.width>0 && image.width>imgwidth){ 
	  ImgD.width=imgwidth
	 } 
}
function flvplayer(flvaddress,strw,strh){
	if (flvaddress!=""){
			$("spc").style.display="block";
			var s1 = new SWFObject("flvplay2010/FlvPlayer201002.swf","playlist",strw,strh,"7");
			s1.addParam("allowfullscreen","true");
			s1.addVariable("autostart","true");
			s1.addVariable("backcolor","0x000000");
			s1.addVariable("frontcolor","0xCCCCCC");
			s1.addVariable("lightcolor","0xffffff");
			s1.addVariable("image","");
			s1.addVariable("file",flvaddress);
			s1.addVariable("width",strw);
			s1.addVariable("height",strh);
			s1.write("flvplayer");
			}
	else{
		alert("没找到相关视频");
		}
	}
	
function wulink(){
	//什么也不做
	}
function tpqh(simg,slink){//五个图片加一个视频切换
	if(simg=="flv"){
		flvplayer(slink,640,428);//播放视频
		}
	else{
		$("piclistqh").innerHTML="<a href='"+slink+"' target='_blank'><img src='"+simg+"' border='0' onload='javascript:DrawImage(this,250,188);'></a>"
		}
	}
function closepf(){//关闭地图中间的漂浮层
		showpf("","","",3,"");
	}
function showpf(mp_x,mp_y,mp_title,mp_sy,mp_str){//打开漂浮层并显示内容_x是x坐标，_y是Y坐标，mp_title,是层的标题，_sy是类别，1是用来直接显示内容的，2是显示网页，3是不显示，只是标坐标
		//$("pf_zw").innerHTML="加载中，请稍候...";
		if(mp_sy==1){
			$("mappf").style.display="block";
			$("pf_title").innerHTML=mp_title;
			$("pf_zw").innerHTML=mp_str;
			$("pf_zw").style.display="none";
			startObjVisible("pf_zw");
				if(mp_x!=""&&mp_y!=""){
					javascript:Showdw('10','','kunshan','',mp_x,mp_y,'5')
					}
			}
		if(mp_sy==2){
			$("mappf").style.display="block";
			$("pf_title").innerHTML=mp_title;
				//
				getXHR();
				xhr.open("get",mp_str);
				xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
				xhr.setRequestHeader("charset","gb2312"); 
				xhr.onreadystatechange=function() {
				if(xhr.readyState!=4) return;
				 fhjg=xhr.responseText;
				if (fhjg!=""){
					$("pf_zw").innerHTML=fhjg;
					$("pf_zw").style.display="none";
					startObjVisible("pf_zw");
					}

				}
				xhr.send(null);
				//
				if(mp_x!=""&&mp_y!=""){
					javascript:Showdw('10','','kunshan','',mp_x,mp_y,'5')
					}
			}
		if(mp_sy==3){
			
				/*if ($("pf_zw").innerHTML!=""){
					$("pf_zw").innerHTML="";
					}
				if ($("mappf").style.display=="block"){
					$("mappf").style.display="none";
					}*/
				if(mp_x!=""&&mp_y!=""){
					javascript:Showdw('10','','kunshan','',mp_x,mp_y,'5')
					}
				$('fdtpurl').href='http://www.3dkunshan.com/?l=zh-chs&x='+ mp_x +'&y='+ mp_y;
			}
		if(mp_sy==4){
			$("mappf").style.display="block";
			$("pf_zw").innerHTML="实景加载中，请稍候...";
			$("pf_title").innerHTML=mp_title;
			$("pf_zw").innerHTML="<iframe src='"+mp_str+"' width='568' height='320' frameborder='0' scrolling='no'>您的浏览器不支持框架，请升级您的浏览器。</iframe>";
				if(mp_x!=""&&mp_y!=""){
					javascript:Showdw('10','','kunshan','',mp_x,mp_y,'5')
					}
			}
	}
function showpf_map(strid,mp_x,mp_y){//打开漂浮层并显示内容_x是x坐标，_y是Y坐标，mp_title,是层的标题，_sy是类别，1是用来直接显示内容的，2是显示网页，3是不显示，只是标坐标
				if(mp_x!=""&&mp_y!=""){
					javascript:Showdw(strid,'','kunshan','',mp_x,mp_y,'5')
					}

	}
function pagegoto(mp_str){
	//
				getXHR();
				xhr.open("get","map_search.asp?"+mp_str+"&timestamp="+ new Date().getTime());
				xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
				xhr.setRequestHeader("charset","gb2312"); 
				xhr.onreadystatechange=function() {
				if(xhr.readyState!=4) return;
				 fhjg=xhr.responseText;
				if (fhjg!=""){
					$("searchjg").innerHTML=fhjg;
						if (fhjg!=""){
						mqnum=fhjg.split("<li")
						zkdi=mqnum.length-1;
						}
					}

				}
				xhr.send(null);
				//
	}
function shpt(str){
	for(var i=1;i<7;i++){
		if (str==i){
			$("ptr_"+i).style.display="block";
			$("sh_"+i).className="sl_db2";
			}
		else{
			$("ptr_"+i).style.display="none";
			$("sh_"+i).className="sl_db";
			}
		}
	
	}
function lpshow(str){
	for(var i=1;i<3;i++){
		if (str==i){
			$("lplb_"+i).style.display="block";
			$("lps_"+i).className="xk_1";
			}
		else{
			$("lplb_"+i).style.display="none";
			$("lps_"+i).className="xk_2";
			}
		}
	
	}
function tabqh(tab,zw,str,zid,class1,class2){
  		for(i=1;i<(zid+1);i++){
			if (i==str){
			$(tab+"_"+i).className=class1;
			$(zw+"_"+i).style.display="block";
			}
			else{
			$(tab+"_"+i).className=class2;
			$(zw+"_"+i).style.display="none";
			}
		}
  
  }
function test()
{
  if ($("yutitle").value=="") {
		alert("请题写预约内容！");
		$("yutitle").focus();		
		    return (false);
  }
  if ($("yutitle").value.length>400){
	  alert("预约内容不能超过400个字符！");
		$("yutitle").focus();		
		    return (false);
	  }
   if ($("yuzz").value=="") {
		alert("请题写您的称呼！");
		$("yuzz").focus();		
		    return (false);
  }
  if ($("yuphone").value=="") {
		alert("请题写您的联系电话！");
		$("yuphone").focus();		
		    return (false);
  }
   if ($("validate").value=="") {
		alert("请题写验证码！");
		$("validate").focus();		
		    return (false);
  }
}

//以下是图片特效
var intTimeStep=25;
var isIe=(window.ActiveXObject)?true:false;
var intAlphaStep=(isIe)?5:0.05;
var curSObj=null;
var curOpacity=null;
function startObjVisible(objId)
{
curSObj=$(objId);
setObjState();
}
function setObjState(evTarget)
{
	if (curSObj.style.display==""){
		curOpacity=1;setObjClose();
	}
	else{
		if(isIe){
		curSObj.style.cssText='DISPLAY: none; FILTER: alpha(opacity=0);';
		curSObj.filters.alpha.opacity=0;
		}
		else{
		curSObj.style.opacity=0
		}
	curSObj.style.display='';
	curOpacity=0;
	setObjOpen();
	}
}
function setObjOpen()
{
if(isIe)
{
curSObj.filters.alpha.opacity+=intAlphaStep;
if (curSObj.filters.alpha.opacity<100) setTimeout('setObjOpen()',intTimeStep);
}else{
curOpacity+=intAlphaStep;
curSObj.style.opacity =curOpacity;
if (curOpacity<1) setTimeout('setObjOpen()',intTimeStep);
}
}
function setObjClose()
{
if(isIe)
{
curSObj.filters.alpha.opacity-=intAlphaStep;
if (curSObj.filters.alpha.opacity>0) {
setTimeout('setObjClose()',intTimeStep);}
else {curSObj.style.display="none";}
}else{
curOpacity-=intAlphaStep;
if (curOpacity>0) {
curSObj.style.opacity =curOpacity;
setTimeout('setObjClose()',intTimeStep);}
else {curSObj.style.display='none';}
}
}
function spclose(){
	$("flvplayer").innerHTML="";
	$("spc").style.display="none";
	}
function checkid(strObj) { 
if(typeof(eval("document.all."+strObj))!= "undefined") { 
	return true;
	} 
else { 
	return false;
	} 
}
function showdiv(str,str1){ //str显示，str1隐藏
		$(str).style.display="block";
		$(str1).style.display="none";
	}
function doZoom(str){//控制新闻详情页正文字体大小
	$("newszw").style.fontSize=str+"px";
	}
function DrawImage(ImgD,iw,ih){ 
 var image=new Image();
 var imgwidth=iw;//最大宽度
 var imgheight=ih;//最大高度
 image.src=ImgD.src; 
 if(image.width>0 && image.height>0){ 
  flag=true; 
  if(image.width/image.height>= imgwidth/imgheight){ 
   if(image.width>imgwidth){
    ImgD.width=imgwidth; 
    ImgD.height=(image.height*imgwidth)/image.width; 
   }else{ 
    ImgD.width=image.width;
    ImgD.height=image.height; 
   } 

  } 
  else{ 
   if(image.height>imgheight){
    ImgD.height=imgheight; 
    ImgD.width=(image.width*imgheight)/image.height; 
   }else{ 
    ImgD.width=image.width;
    ImgD.height=image.height; 
   } 
  } 
 }
}
function checkpl(){//检查提交评论的表单
	if ($("pcontent").value==""){
		alert("评论内容不能为空");
		$("pcontent").focus();
		return false
		}
	if ($("pname").value==""){
		alert("昵称不能为空");
		$("pname").focus();
		return false
		}
	if ($("validate").value==""){
		alert("验证码不能为空");
		$("validate").focus();
		return false
		}	
	}
function plnameonclick(){
	if($("pname").value=="视窗网友"){
		$("pname").value="";
		}
	}
function checktg(){//检查团购报名的表单，详情页的
	if ($("u_name").value==""){
		alert("姓名不能为空");
		$("u_name").focus();
		return false
		}
	if ($("u_tel").value==""&&$("u_ptot").value==""){
		alert("电话和手机至少填写一项");
		$("u_tel").focus();
		return false
		}
	if ($("u_content").value.length>500){
		alert("该留言有广告嫌疑");
		$("u_content").focus();
		return false
		}	
	if ($("validate2").value==""){
		alert("验证码不能为空");
		$("validate2").focus();
		return false
		}
	}
function checkyuyue(){
	if ($("yutitle").value.length<10){
		alert("预约内容不能少于10个字");
		$("yutitle").focus();
		return false
		}
	if ($("yutitle").value.length>500){
		alert("该留言有广告嫌疑");
		$("yutitle").focus();
		return false
		}
	if ($("yuzz").value==""){
		alert("姓名不能为空");
		$("yuzz").focus();
		return false
		}
	if ($("yuphone").value==""){
		alert("电话不能为空");
		$("yuphone").focus();
		return false
		}
	if ($("yuaddress").value==""){
		alert("地址不能为空");
		$("yuaddress").focus();
		return false
		}
	if ($("validate").value==""){
		alert("验证码不能为空");
		$("validate").focus();
		return false
		}
	}
