function beginBlendTrandImage(){
	try{
		event.srcElement.filters.blendTrans.apply();
		if(event.type=='mouseover')	event.srcElement.src=event.srcElement.getAttribute('NewSrc');
		if(event.type=='mouseout')	event.srcElement.src=event.srcElement.getAttribute('OldSrc');
		event.srcElement.filters.blendTrans.play();
	}
	catch(e){}
}
function blendTransImage(objImage,strImageMouseOver){
	objImage.style.cssText='filter:blendTrans(duration=0.15)';
	if(objImage.getAttribute('OldSrc')==null){
		objImage.setAttribute('OldSrc',objImage.src);
		objImage.setAttribute('NewSrc',strImageMouseOver);
	}	
	objImage.onmouseover=beginBlendTrandImage;
	objImage.onmouseout=beginBlendTrandImage;
}
function motionLayer(layerId,destX,destY,rateX,rateY,motionType){			
	var strFunName="";
	var distanceX=0,distanceY=0;
	var objLayer=document.getElementById(layerId);
	if(objLayer.style.position!='absolute'){
		with(objLayer.style){
			position='absolute';
			visitility='visible';
			zIndex=1000;
			top=0-offsetHeight;
			left=0-offsetWidth;
		}
	}
	if(objLayer.getAttribute('motionStatus')==null){
		objLayer.setAttribute('motionStatus','start');
		objLayer.onmouseover=function stopLayerMotion(){
			this.setAttribute('motionStatus','stop');
		}
		objLayer.onmouseout=function startLayerMotion(){
			this.setAttribute('motionStatus','start');
			var funName="motionLayer('"+this.getAttribute('layerId')+"',"+this.getAttribute('destX')+","+this.getAttribute('destY')+","+this.getAttribute('rateX')+","+this.getAttribute('rateY')+","+this.getAttribute('motionType')+")";
			window.setTimeout(strFunName,50);
		}
	}
	var createNewPos=false;
	if(destX==0&&destY==0) createNewPos=true;
	if(objLayer.offsetLeft==destX&&objLayer.offsetTop==destY) createNewPos=true;
	if(motionType==4){
		if(objLayer.offsetLeft>=destX||objLayer.offsetTop>=destY) createNewPos=true; 
	}
	if(motionType==3){
		if(objLayer.offsetLeft<=destX||objLayer.offsetTop>=destY) createNewPos=true; 
	}
	if(motionType==2){
		if(objLayer.offsetLeft>=destX||objLayer.offsetTop<=destY) createNewPos=true; 
	}
	if(motionType==1){
		if(objLayer.offsetLeft<=destX||objLayer.offsetTop<=destY) createNewPos=true; 
	}
	if(createNewPos){
		//随机产生一个数字
		destX=Math.floor(Math.random()*document.body.clientWidth);
		destY=Math.floor(Math.random()*document.body.clientHeight);
		//将产生的坐标分为四种区域
		if(destX==objLayer.offsetLeft&&destY!=objLayer.offsetTop){
			rateX=0;rateY=1;
			if(destY<objLayer.offsetTop) rateY=-1;
		}				
		if(destY==objLayer.offsetTop&&destX!=objLayer.offsetLeft){
			rateX=1;rateY=0;
			if(destX<objLayer.offsetLeft) rateX=-1; 
		}
		if(destY!=objLayer.offsetTop&&destX!=objLayer.offsetLeft){					
			//情况一
			if(destY<objLayer.offsetTop&&destX<objLayer.offsetLeft){
				motionType=1;
				distanceX=Math.abs(objLayer.offsetLeft-destX);
				distanceY=Math.abs(objLayer.offsetTop-destY);
				if(distanceX>=distanceY){
					rateX=-1;
					rateY=Math.floor(distanceY/distanceX*-1);
					if(Math.abs(rateY)<=1) rateY=-1;							
				}
				else{
					rateY=-1;
					rateX=Math.floor(distanceX/distanceY)*-1;
					if(Math.abs(rateX)<=1) rateX=-1;	
				}
			}
			//情况2
			if(destY<objLayer.offsetTop&&destX>objLayer.offsetLeft){
				motionType=2;
				distanceX=Math.abs(objLayer.offsetLeft-destX);
				distanceY=Math.abs(objLayer.offsetTop-destY);
				if(distanceX>=distanceY){
					rateX=1;
					rateY=Math.floor(distanceY/distanceX)*-1;
					if(rateY<1) rateY=-1;
				}
				else{
					rateY=-1;
					rateX=Math.floor(distanceX/distanceY);
					if(rateX<1) rateX=1;
				}
			}
			//情况3
			if(destY>objLayer.offsetTop&&destX<objLayer.offsetLeft){
				motionType=3;
				distanceX=Math.abs(objLayer.offsetLeft-destX);
				distanceY=Math.abs(objLayer.offsetTop-destY);
				if(distanceX>=distanceY){
					rateX=-1;
					rateY=Math.floor(distanceY/distanceX);
					if(rateY<1) rateY=1;
				}
				else{
					rateY=1;
					rateX=-Math.floor(distanceX/distanceY);
					if(rateX<1) rateX=-1;
				}						
			}
			//情况4
			if(destY>objLayer.offsetTop&&destX>objLayer.offsetLeft){
				motionType=4
				distanceX=Math.abs(objLayer.offsetLeft-destX);
				distanceY=Math.abs(objLayer.offsetTop-destY);
				if(distanceX>=distanceY){
					rateX=1;
					rateY=Math.floor(distanceY/distanceX);
					if(rateY<1) rateY=1;
				}
				else{
					rateY=1;
					rateX=Math.floor(distanceX/distanceY);
					if(rateX<1) rateX=1;
				}						
			}
		}
	}
	strFunName="motionLayer('"+layerId+"',"+destX+","+destY+","+rateX+","+rateY+","+motionType+")";
	with(objLayer.style){
		left=objLayer.offsetLeft+rateX;
		top=objLayer.offsetTop+rateY; 
	}
	with(objLayer){
		setAttribute('layerId',layerId);
		setAttribute('destX',destX);
		setAttribute('destY',destY);
		setAttribute('rateX',rateX);
		setAttribute('rateY',rateY);
		setAttribute('motionType',motionType);
	}
	if(objLayer.getAttribute('motionStatus')!='stop') window.setTimeout(strFunName,50);
}
//动态显示面板
function animationPanel(panelId,maskPanelId,animation){
	var intX,intY,intWidth,intHeight;
	var objPanel=document.getElementById('editPanel');
	if(panelId!=undefined) objPanel=document.getElementById(panelId);
	var strPos=objPanel.style.position;
	if(strPos==''){
		objPanel.style.position='relative';
		objPanel.style.display='';
		intY=objPanel.offsetTop;
		with(objPanel.style){	
			zIndex='100';
			position='absolute';
			top=intY;
			width=objPanel.offsetWidth+5;						
		}
		strPos='absolute';
	}							
	if(strPos=='absolute'){
		intY=objPanel.offsetTop;
		objPanel.style.left=document.body.offsetWidth/2-objPanel.offsetWidth/2;
		intHeight=objPanel.offsetHeight;		
		if(objPanel.style.visibility=='hidden') objPanel.style.visibility='visible';
		if(animation!=undefined){
			if(!animation){
				intY=document.body.scrollTop+document.body.clientHeight/2-intHeight/2;
				if(intY<=5) intY=25;
				objPanel.style.top=intY;
				var objDiv=document.createElement("DIV");
				objDiv.style.cssText='filter:alpha(opacity=90)';
				objDiv.id='maskPanel';
				if(maskPanelId!=undefined) objDiv.id=maskPanelId;
				with(objDiv.style){				
					position='absolute';
					zIndex='50';
					top=document.body.scrollTop;
					left=0;
					width=document.body.clientWidth;
					height=document.body.offsetHeight;
					backgroundColor='white';						
				}		
				self.document.body.appendChild(objDiv);
				return;
			}
		}
		if(intY>document.body.scrollTop+document.body.clientHeight/2-intHeight/2){
			objPanel.style.top=intY-10;					
		}
		else{		
			if(intY<=5) objPanel.style.top=25;
			var objDiv=document.createElement("DIV");
			objDiv.style.cssText='filter:alpha(opacity=90)';
			objDiv.id='maskPanel';
			if(maskPanelId!=undefined) objDiv.id=maskPanelId;
			with(objDiv.style){				
				position='absolute';
				zIndex='50';
				top=document.body.scrollTop;
				left=0;
				width=document.body.clientWidth;
				height=document.body.offsetHeight;
				backgroundColor='white';						
			}		
			self.document.body.appendChild(objDiv);
			return;
		}
	}
	if(animation!=undefined){
		if(!animation)	return;
	}
	var funName="animationPanel(";
	if(panelId!=undefined) funName+="'"+panelId+"'";
	if(maskPanelId!=undefined) funName+=",'"+maskPanelId+"'";
	funName+=")";
	window.setTimeout(funName,10);
}
function closePanel(panelId,maskPanelId){	
	var panelId1="editPanel",panelId2="maskPanel";
	if(panelId!=undefined) panelId1=panelId;
	if(maskPanelId!=undefined) panelId2=maskPanelId;
	document.body.removeChild(document.getElementById(panelId2));
	document.getElementById(panelId1).style.visibility='hidden';
	var objSelect=document.getElementsByTagName('SELECT');
	for(var i=0;i<objSelect.length;i++){
		objSelect(i).style.display='';
	}
}
//隐藏不在鼠标范围类的图层
function hiddenNotMouseRangeLayer(layerId,rangeTop,rangeBottom,rangeLeft,rangeRight){
	var objLayer=document.getElementById(layerId);			
	if(objLayer==undefined||objLayer==null) return;
	rangeTop=objLayer.offsetTop-rangeTop;
	rangeBottom=objLayer.offsetTop+objLayer.offsetHeight+rangeBottom;
	rangeLeft =objLayer.offsetLeft-rangeLeft;
	rangeRight=objLayer.offsetLeft+objLayer.offsetWidth+rangeRight;
	if(event.clientX<rangeLeft||event.clientX>rangeRight||event.clientY<rangeTop||event.clientY>rangeBottom){
		objLayer.style.visibility='hidden';			
	}
}
function photoAnimation(arguInstanceName,imageShowWidth,imageShowHeight){
	this.instanceName=arguInstanceName; //实例名
	this.imageShowWidth =imageShowWidth;
	this.imageShowHeight=imageShowHeight;
	this.photos=new Array();  //图片数组
	this.timeOutVar=null;
	this.currentShowIndex=0;
	this.prevShowDiv=null;
}
photoAnimation.prototype.addPhoto=function (arguPhotoUrl,arguPhotoTitle,arguLink,arguTitle){								
	this.photos[this.photos.length]=new Array(arguPhotoUrl,arguPhotoTitle,arguLink,arguTitle);
}
photoAnimation.prototype.changePhoto=function (arguPhotoIndex){
	var objPhoto=document.getElementById(this.instanceName+'_photo');
	objPhoto.filters.revealTrans.transition=Math.floor(Math.random()*23);
	objPhoto.src=this.photos[arguPhotoIndex][0];						
	objPhoto.filters.revealTrans.apply();
	objPhoto.filters.revealTrans.play();
	with(document.getElementById(this.instanceName+'_link')){
		innerText=this.photos[arguPhotoIndex][1];
		href=this.photos[arguPhotoIndex][2];
		title=this.photos[arguPhotoIndex][3];
	}
}
photoAnimation.prototype.autoPlay=function (){
	this.currentShowIndex++;
	if(this.currentShowIndex>this.photos.length-1) this.currentShowIndex=0;
	this.changePhoto(this.currentShowIndex);
	var instanceName=this.instanceName+'_'+this.currentShowIndex;
	var objTxt=document.getElementById(instanceName);
	with(objTxt.style){
		height=18
		backgroundColor='#506681';
	}
	with(this.prevShowDiv.style){
		height=16
		backgroundColor='black';
	}
	this.prevShowDiv=objTxt;
	this.changePhoto(parseInt(objTxt.innerText)-1);
	this.timeOutVar=window.setTimeout(this.instanceName+".autoPlay()",2000);
}
photoAnimation.prototype.applyEffect=function (){
	try{
		var myFun=this;
		document.writeln("<table onmouseover='window.clearTimeout("+this.instanceName+".timeOutVar);' border=0 align='center' cellspacing=0 cellpadding=0 style='border:1 solid #D3D3BE'>");
		document.writeln("<tr>");
		document.writeln("	<td style='border:4 solid #E0E0D9'>");
		document.write("<img id='"+this.instanceName+"_photo' style='filter:revealTrans(duration=1.5);border:1 solid #DEDCD6' src='"+this.photos[0][0]+"' width="+this.imageShowWidth+" height="+this.imageShowHeight+">");							
		document.writeln("<table border=0 style='margin-top:-43' align='center' cellspacing=0 cellpadding=0 style='width:100%;'>");
		document.writeln("<tr height=18>");
		document.writeln("	<td align='right'>");
		document.writeln("		<table border=0 cellspacing=0 cellpadding=0>");
		document.writeln("		<tr>");
		for(var i=0;i<this.photos.length;i++){
			var instanceName=this.instanceName+'_'+i;								
			document.writeln("		<td><div id='"+instanceName+"' style='cursor:hand;padding-top:2;width:16;height:"+(i==0?18:16)+";background-color:"+(i==0?"#506681":"black")+";font-size:9pt;text-align:center;color:white;font-weight:bold;'>"+(i+1)+"</div></td><td width=2></td>");
			if(i==0) this.prevShowDiv=document.getElementById(instanceName);
			var objTxt=document.getElementById(instanceName);
			objTxt.onclick=function (){
				with(this.style){
					height=18
					backgroundColor='#506681';
				}
				with(myFun.prevShowDiv.style){
					height=16
					backgroundColor='black';
				}
				myFun.prevShowDiv=this;
				myFun.changePhoto(parseInt(this.innerText)-1);
			}
		}							
		document.writeln("		</tr>");							
		document.writeln("		</table>");							
		document.writeln("	</td>");
		document.writeln("</tr>");
		document.writeln("<tr height=25>");
		document.writeln("	<td bgcolor='#506681' align='center'><a title='"+this.photos[0][3]+"' style='font-size:9pt;color:white;' target='_blank' href='"+this.photos[0][2]+"' id='"+this.instanceName+"_link'>"+this.photos[0][1]+"</a></td>");
		document.writeln("</tr>");							
		document.writeln("</table>");							
		document.writeln("	</td>");
		document.writeln("</tr>");
		document.writeln("</table>");
		this.timeOutVar=window.setTimeout(this.instanceName+".autoPlay()",2000);
	}
	catch(e){alert(e)}
}
