﻿var isWidened=0;

function show(d,img){
	tempImg=$("Imag");
	tempBox=$(d);
	tempImg.style.width="";
	tempBox.style.top=Math.max((document.body.clientHeight==document.body.offsetHeight?document.documentElement.scrollTop:document.body.scrollTop)+0,0)+"px";
    tempBox.style.display="";
	tempImg.onload=function(){
		if(tempImg.width>1000)tempImg.style.width="1000px";
		tempBox.style.top=Math.max((document.body.clientHeight==document.body.offsetHeight?document.documentElement.scrollTop:document.body.scrollTop)+Math.max(((document.body.clientHeight==document.body.offsetHeight?document.documentElement.clientHeight:document.body.clientHeight)-tempImg.height-4)/2,0),0)+"px";
	tempImg.onload=null;
	}
	tempImg.src=img;
	if(show.arguments[2]){$("picTxt").innerHTML=show.arguments[2];}
}
	
var leftmar=window.screen.width/2-300;
var tempBox;
var tempImg;
if(isNaN(leftmar))leftmar=250;
document.write("<div id='Layer999' style=\"position:absolute;display:none;width:100%;height:10px;text-align:center;padding:0;margin:0;z-index:99;border:0;left:0px;top:0px\"><table cellpadding=0 cellspacing=0 border=2 align=center bordercolor=#FFCC33><tr><td style='background:#fff;cursor:hand'><img id=Imag src='images/loading.gif' title='单击关闭' onclick=Imag.src='images/loading.gif';$('Layer999').style.display='none'></td></tr><tr style='background:#ff0;'><td><span id='picTxt' style='color:#00f'></span></td></tr></table></div>");


function doZm(size){
var zfs=$("endText");
var dzt=document.getElementById('dozm');
if (dzt.innerHTML=="大") {
	zfs.className=zfs.className.replace(/\bzoom.*?\b/ig,"")+" zoom16";
	dzt.innerHTML="中";dzt.style.fontSize=14+'px';
}
else {
	if (dzt.innerHTML=="中") {
		zfs.className=zfs.className.replace(/\bzoom.*?\b/ig,"")+" zoom14";
		dzt.innerHTML="小";
		dzt.style.fontSize=12+'px';
	}
		else  {
		zfs.className=zfs.className.replace(/\bzoom.*?\b/ig,"")+" zoom12";
			dzt.innerHTML="大";
		dzt.style.fontSize=16+'px';
		}
}
}


var isDoWd=0;
function doWd(){
	isDoWd=1;
	if($("doWdSpan").innerHTML=="&gt;&gt;"){
		arkMaxWidth=700;
		$("doWdSpan").innerHTML="&lt;&lt;"
		setCookie("isWd",1);
	}
	else
	{
		arkMaxWidth=500;
		$("doWdSpan").innerHTML="&gt;&gt;"
		setCookie("isWd",0);
		}
	reLayout();
	reImg();
	}




function setCopy(_sTxt){
	try {
		clipboardData.setData('Text',_sTxt)
		return true;
	}
	catch(e){
		return false;
	}
}
function sharetopic(l, t){
	setCopy(t + " " + l);
	alert("本帖标题和地址已经复制到剪切板，你可以按 CTRL+V粘贴到QQ、MSN等发送给好友~");
}



var arkMaxWidth=500;
var arkMaxHeight=10000;
var tempW=new Object(),tempH=new Object();
var zoomImg;
var arkTop;
function reloadimg(imgobj){
	imgobj.isResized=true;
	imgobj.title="单击放大";
	if(!tempW[imgobj.nCount]){
    tempW[imgobj.nCount]=imgobj.offsetWidth;
	tempH[imgobj.nCount]=imgobj.offsetHeight;
	}
  if(imgobj.width>arkMaxWidth){imgobj.width=arkMaxWidth;
	imgobj.height=tempH[imgobj.nCount]*(arkMaxWidth/tempW[imgobj.nCount]);}
  if(imgobj.height>arkMaxHeight){
    imgobj.height=arkMaxHeight;
    imgobj.width=imgobj.width*(arkMaxHeight/tempH[imgobj.nCount]);}
	  imgobj.style.position="relative";
	  var oNewNode = document.createElement("div");
	  oNewNode.id="arkImgHand"+imgobj.nCount;
	  oNewNode.style.position="absolute";
	  oNewNode.style.top=getTop(imgobj)+"px";
	  oNewNode.style.left=getLeft(imgobj)+imgobj.width+"px";
	  oNewNode.style.lineHeight="1.2em";
	  oNewNode.style.fontSize="12px";
	  oNewNode.style.textIndent="0";
	  oNewNode.style.padding="3px 0 0 0";
	  oNewNode.style.width="16px";
	  oNewNode.style.textAlign="center";
	  oNewNode.style.overflow="hidden";
	  oNewNode.innerHTML="点击放大";
	  oNewNode.style.background="#ffc";
	  oNewNode.style.color="#999";
	  oNewNode.style.zIndex=3;
	  oNewNode.style.border="1px solid #ccc";
	  imgobj.parentNode.insertBefore(oNewNode,imgobj.nextSibling);
	var arkImgHand=$("arkImgHand"+imgobj.nCount);
try{  arkImgHand.style.cursor=imgobj.style.cursor="pointer";}catch(e){arkImgHand.style.cursor=imgobj.style.cursor="hand";}
  arkImgHand.onclick=imgobj.onclick=function(){
	var arkIH=$("arkImgHand"+imgobj.nCount);
	  if(imgobj.style.position!="absolute"){
		 arkTop=document.documentElement.scrollTop; 
	  try{
		 if(arkTop<document.body.scrollTop)
		 	arkTop=document.body.scrollTop;
		  }catch(e2){}
  
	//  imgobj.width=tempW[imgobj.nCount];
	//  imgobj.height=tempH[imgobj.nCount];
	  imgobj.title="单击还原";
	  imgobj.style.top=getTop(imgobj)+"px";
	  imgobj.style.left=getLeft(imgobj)+"px";
	  imgobj.style.position="absolute";
	  var oNewNode = document.createElement("DIV");
	  oNewNode.id="imgBox"+imgobj.nCount;
	  oNewNode.style.height=imgobj.height+"px";
	  oNewNode.style.overflow="hidden";
	  imgobj.parentNode.insertBefore(oNewNode,imgobj.nextSibling);
	  imgobj.style.border="3px solid #333333";
	  imgobj.style.background="#ffffff";
	  var oNewNode1 = document.createElement("DIV");
	  oNewNode1.id= "imgBg"+imgobj.nCount;
	  oNewNode1.style.cssText="filter:alpha(opacity=50);opacity:0.5;background:#000;";
	  oNewNode1.style.height=Math.max(document.documentElement.clientHeight,tempH[imgobj.nCount]+6)+"px";
	  oNewNode1.style.width=Math.max(document.documentElement.clientWidth,tempW[imgobj.nCount]+6)+"px";
	  oNewNode1.style.overflow="hidden";
	  oNewNode1.style.left=0;
	  oNewNode1.style.top=arkTop+"px";
	  oNewNode1.style.position="absolute";
	  oNewNode1.style.zIndex=3;
	  imgobj.parentNode.insertBefore(oNewNode1,imgobj.nextSibling);
	  var startTop=Math.max(arkTop+Math.max((document.documentElement.clientHeight-imgobj.height-4)/2,0),0);
	  var startLeft=Math.max(document.documentElement.scrollLeft+Math.max((document.documentElement.clientWidth-imgobj.width-4)/2,0),0);
	  var tempTop=Math.max(arkTop+Math.max((document.documentElement.clientHeight-tempH[imgobj.nCount]-4)/2,0),0);
	  var tempLeft=Math.max(document.documentElement.scrollLeft+Math.max((document.documentElement.clientWidth-tempW[imgobj.nCount]-4)/2,0),0);
	  arkIH.style.top=tempTop+"px";
	  arkIH.style.left=tempLeft+tempW[imgobj.nCount]+6+"px";
	  try{arkIH.innerHTML="点击还原";}catch(e){arkIH.innerText="点击还原";}
	  arkIH.style.zIndex=99;
	  imgobj.style.zIndex=99;
	  actionImg(imgobj,startTop,startLeft,tempTop,tempLeft,tempW[imgobj.nCount],tempH[imgobj.nCount]);
	  
	  
	  }
	  else{
	  imgobj.parentNode.removeChild($("imgBox"+imgobj.nCount));
	  imgobj.parentNode.removeChild($("imgBg"+imgobj.nCount));
	  imgobj.style.position="relative";
	  imgobj.style.border="0";
	  imgobj.style.background="";
	  imgobj.width=arkMaxWidth;
	  imgobj.height=tempH[imgobj.nCount]*(arkMaxWidth/tempW[imgobj.nCount]);
	  imgobj.title="单击放大";
	  imgobj.style.top=0;
	  imgobj.style.left=0;
	  imgobj.style.zIndex=0;
	  arkIH.style.top=getTop(imgobj)+"px";
	  arkIH.style.left=getLeft(imgobj)+imgobj.width+"px";
	  try{arkIH.innerHTML="点击放大";}catch(e){arkIH.innerText="点击放大";}
	  arkIH.style.zIndex=3;
		  }
  }
}
var actObj=new Object();
var actFlag=0;
var actTime=null;
function actionImg(s,a,b,t,l,w,h){
actObj.t=parseInt(s.style.top);
actObj.l=parseInt(s.style.left);
actObj.w=parseInt(s.width);
actObj.h=parseInt(s.height);
	if(Math.abs(actObj.t-a)>50&&actFlag<1){
	s.style.top=actObj.t-50*((actObj.t-a)/Math.abs(actObj.t-a))+"px";
	s.style.left=actObj.l-50*((actObj.l-b)/Math.abs(actObj.t-b))+"px";
		}
		else{
	actFlag++;
	if(Math.abs(actObj.t-t)>50){
	s.style.top=actObj.t-50*((actObj.t-t)/Math.abs(actObj.t-t))+"px";
	s.style.left=actObj.l-50*((actObj.l-l)/Math.abs(actObj.t-t))+"px";
	}
	else{
	s.style.top=t+"px";
	s.style.left=l+"px";
	}
	if(w-actObj.w>100){
	s.width=actObj.w+100;
	s.height=h*(actObj.w/w);
	}
	else{
	s.width=w;
	s.height=h;
	clearTimeout(actTime);
	actFlag=0;
	return;
	}
		}
	actTime=setTimeout(function(){actionImg(s,a,b,t,l,w,h)},50);
	}


function reImg(){
zoomImg=$("endText").getElementsByTagName('img');
var tW=0;
for(var i=0;i<zoomImg.length;i++){
	zoomImg[i].style.width="";
	zoomImg[i].style.height="";
var zIW=zoomImg[i].width;
	if($("arkImgHand"+i)){
		if(tempW[zoomImg[i].nCount]&&isDoWd){
			if(tempW[zoomImg[i].nCount]>arkMaxWidth){
				tW=arkMaxWidth;
				$("arkImgHand"+i).style.display="";
				}
				else{
					tW=tempW[zoomImg[i].nCount];
					$("arkImgHand"+i).style.display="none";
					}
					zoomImg[i].width=tW;
					zoomImg[i].height=tempH[zoomImg[i].nCount]*(tW/tempW[zoomImg[i].nCount]);
					}
		if(zoomImg[i].style.position!="absolute"){
			 $("arkImgHand"+i).style.top=getTop(zoomImg[i])+"px";
			 $("arkImgHand"+i).style.left=getLeft(zoomImg[i])+zoomImg[i].width+"px";
	    }

			continue;
	}
	zoomImg[i].nCount=i;
  if(zIW>arkMaxWidth||zoomImg[i].height>arkMaxHeight)reloadimg(zoomImg[i]);
  zoomImg[i].onload=function(){if(!this.isResized&&(this.width>arkMaxWidth||this.height>arkMaxHeight))reloadimg(this);}
  
}
isDoWd=0;
setTimeout("reImg()",1000);
}


function reLayout(){
	if(isWidened){
		isWidened=0;
	    document.getElementById("endBody").style.width=col1sws+'px';
	    document.getElementById("endMain").style.overflow='auto';
		}
	else{
	//var col1swe=document.getElementById("endMain").scrollWidth;
	//if(col1swe>col1sws){
		isWidened=1;
	    document.getElementById("endBody").style.width='770px';
	    document.getElementById("endMain").style.overflow='hidden';
	//	}
	}
}

function reText(){
	if(getCookie("isWd"))doWd();
	else
	reImg();
	addPIndent("endText");
	if(!Browser.isIE){
		return;
	}
	var dPu="";
	try{
		dPu=$("navChannel").getElementsByTagName('a')[0].pathname.replace(/(.*\/){0,}([^\.]+.*)/ig,"$2");
		}catch(e){}
		if(dPu=="video.html"){
			$("endText").innerHTML=$("endText").innerHTML;
		}
		else if(dPu=="text.html"||dPu=="photo.html"){
		
			}
			var cTabs=$("endText").getElementsByTagName("table");
			for(i=0;i<cTabs.length;i++){
				if(cTabs[i].offsetWidth>520)
				cTabs[i].style.width="98%";
				}
		//	$("adShowfile").innerHTML='<div class="adBox" style="overflow:hidden;padding:3px 0;border-bottom:1px solid #B3C58F"><a href="http://www.shidi.org/zt/jingsai/" target="_blank"><img src="http://www.shidi.org/zt/jingsai/image/jingsai468x60.jpg" alt="“西溪湿地杯”网络创作竞赛" width="468" height="61" /></a></div>';
			
}


var currentpos,timer; 
var BoE=document.body.clientHeight==document.body.offsetHeight?document.documentElement:document.body;
function initialize() { 
timer=setInterval("scrollwindow()",16); 
} 
function sc(){ 
clearInterval(timer); 
} 
function scrollwindow() {
currentpos=BoE.scrollTop; 
window.scroll(0,++currentpos); 
if(currentpos != BoE.scrollTop) 
sc(); 
} 
document.onmousedown=sc 
document.ondblclick=initialize


var url=location.href;
var temploc=url.toString();
var arkarticleid=temploc.replace(/^.*?(sf_|articleid=)(.*?)(_|\&|$).*$/ig,"$2");
var arkCountSeeUrl="http://vip-pub.arkoo.com/showreview.aspx?articleid="+arkarticleid+"&tabname=www_shidi_org_articleinfo";
var arkInterval=120000;

function reTest(){
	$("Form1").Submit.onclick=function(){
/*
if($("username").value==""&&getCookie("re"+arkarticleid)=="y"){
		alert("请登录！");$("username").focus();return false;}
		*/
	setCookie("re"+arkarticleid,"y",3600000);
	subto();
	}
	}

function reCountSee(){
arkInterval*=4;
setTimeout("reCountSee()",arkInterval);
if($("arkReCountSee")){
$("arkReCountSee").src=arkCountSeeUrl;
return;
}
var s=document.createElement('script');
s.setAttribute('src',arkCountSeeUrl);
s.setAttribute('id','arkReCountSee');
s.setAttribute('type','text/javascript');
s.setAttribute('charset','utf-8');
document.body.appendChild(s);
}
setTimeout("reCountSee()",arkInterval);