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;	
				}
			}
			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;
				}
			}
			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;
				}						
			}
			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);
}
window.editPanelZIndex=null;
window.maskPanelZIndex=null;
function animationPanel(panelId,maskParams,animation){
	var maskPanelId='maskPanel';
	var maskOpacity=20;
	var maskColor='lightblue';
	var intX,intY,intWidth,intHeight;
	var objPanel=document.getElementById('editPanel');
	if(maskParams!=undefined){
		var maskParam=maskParams.split(' ');
		maskPanelId=maskParam[0];
		if(maskParam.length>1){
			var rgExp=/^\d*$/;
			if(maskParam[1].match(rgExp)){
				maskOpacity=maskParam[1];
				if(maskParam.length==3) maskColor=maskParam[2];
			}
			else{
				maskColor=maskParam[1];
				if(maskParam.length==3) maskOpacity=maskParam[2];
			}
		}		
	}
	if(panelId!=undefined) objPanel=document.getElementById(panelId);
	var strPos=objPanel.style.position;
	if(window.editPanelZIndex==null){
		window.editPanelZIndex=document.all.length+1;
		window.maskPanelZIndex=window.editPanelZIndex-1;
	}
	if(strPos==''){		
		objPanel.style.position='relative';
		objPanel.style.display='';
		intY=objPanel.offsetTop;
		with(objPanel.style){	
			zIndex=window.editPanelZIndex;
			position='absolute';
			top=intY;
			width=objPanel.offsetWidth+5;						
		}
		strPos='absolute';
	}							
	if(strPos=='absolute'){
		intY=objPanel.offsetTop;
		objPanel.style.left=document.body.scrollLeft+(document.body.offsetWidth/2-objPanel.offsetWidth/2);
		objPanel.style.zIndex=window.editPanelZIndex;
		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='+(maskOpacity)+')';
				objDiv.id='maskPanel';
				if(maskPanelId!=undefined) objDiv.id=maskPanelId;
				with(objDiv.style){				
					position='absolute';
					zIndex=window.maskPanelZIndex;
					top=0;
					left=0;
					width= ((document.body.clientWidth <document.body.scrollWidth)?(document.body.scrollWidth):(document.body.clientWidth));
					height=((document.body.clientHeight<document.body.scrollHeight)?(document.body.scrollHeight):(document.body.clientHeight));
					backgroundColor=maskColor;						
				}		
				self.document.body.appendChild(objDiv);
				window.editPanelZIndex+=2;
				window.maskPanelZIndex=window.editPanelZIndex-1;
				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='+maskOpacity+')';
			objDiv.id='maskPanel';
			if(maskPanelId!=undefined) objDiv.id=maskPanelId;
			with(objDiv.style){				
				position='absolute';
				zIndex=window.maskPanelZIndex;
				top=document.body.scrollTop;
				left=0;
				width=document.body.clientWidth;
				height=document.body.scrollHeight;
				backgroundColor=maskColor;						
			}		
			window.editPanelZIndex+=2;
			window.maskPanelZIndex=window.editPanelZIndex-1;
			self.document.body.appendChild(objDiv);
			return;
		}
	}
	if(animation!=undefined){
		if(!animation)	return;
	}
	var funName="animationPanel(";
	if(panelId!=undefined) funName+="'"+panelId+"'";
	if(maskParams!=undefined) funName+=",'"+maskParams+"'";
	funName+=")";
	window.setTimeout(funName,10);
}
function closePanel(panelId,maskPanelId){	
	var panelId1="editPanel",panelId2="maskPanel";
	if(panelId!=undefined) panelId1=panelId;
	if(maskPanelId!=undefined) panelId2=maskPanelId;
	if(document.getElementById(panelId2)!=null) document.body.removeChild(document.getElementById(panelId2));
	document.getElementById(panelId1).style.visibility='hidden';
}
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,refreshTime){
	this.refreshTime=(refreshTime==undefined)?3000:refreshTime*1000;
	this.instanceName=arguInstanceName; //ÊµÀýÃû
	this.imageShowWidth =imageShowWidth;
	this.imageShowHeight=imageShowHeight;
	this.photos=new Array();  //Í¼Æ¬Êý×é
	this.timeOutVar=null;
	this.currentShowIndex=0;
	this.prevShowDiv=null;
	this.showStyle=0;
}
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 objSelf=this;
	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();
	objPhoto.onclick=function (){newHyperLink(objSelf.photos[arguPhotoIndex][2],'_target');}
	objPhoto.title=this.photos[arguPhotoIndex][3];
	objPhoto.alt=this.photos[arguPhotoIndex][3];
	if(this.showStyle==0){
		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;
	if(this.showStyle==0){
		var objTxt=document.getElementById(instanceName);
		objTxt.style.backgroundColor='#CE0609';
		var objTd=document.getElementById(instanceName+'1');
		with(document.getElementById(this.instanceName+'Arrow').style){
			visibility='visible';
			top=objTd.offsetTop-10;
			left=objTd.offsetLeft+7;
		}
		this.prevShowDiv.style.backgroundColor='';
	}
	this.prevShowDiv=objTxt;
	if(this.showStyle==0) this.changePhoto(parseInt(objTxt.innerText)-1);
	this.timeOutVar=window.setTimeout(this.instanceName+".autoPlay()",this.refreshTime);
}
photoAnimation.prototype.applyEffect=function (){
	try{
		var myFun=this;
		document.writeln("<div id='"+this.instanceName+"Arrow' style='visibility:hidden;position:absolute;top:0;left:0;font-size:7pt;'><span style='font-family:webdings;color:#CE0609'>5</span></div>");
		if(this.showStyle==0){
			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;cursor:hand' src='"+this.photos[0][0]+"' onclick=\"newHyperLink('"+this.photos[0][2]+"')\" width="+this.imageShowWidth+" height="+this.imageShowHeight+">");							
		if(this.showStyle==0){			
			document.writeln("<div style='height:20;filter:alpha(opacity=0,finishOpacity=100,startX=20,finishX=70,style=1);background-color:black;width:100%;margin-top:-36;'></div>");
			document.writeln("<table border=0 style='margin-top:-20' align='center' cellspacing=0 cellpadding=0 style='width:100%;'>");
			document.writeln("<tr height=16>");
			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 width=22 id='"+this.instanceName+'_'+i+"1' style='position:relative;'><span id='"+instanceName+"' style='width:100%;cursor:hand;padding-top:2;height:"+(i==0?15:15)+";background-color:"+(i==0?"":"")+";font-size:12px;text-align:center;color:white;font-weight:bold;'>"+(i+1)+"</span></td><td width=1 bgcolor='white' style='filter:alpha(opacity=50)'></td>");
				if(i==0) this.prevShowDiv=document.getElementById(instanceName);
				var objTxt=document.getElementById(instanceName);
				var arrow=document.getElementById(this.instanceName+'Arrow');					
				objTxt.onclick=function (){
					var objTd=document.getElementById(this.id+'1');					
					with(this){
						arrow.style.visibility='visible';
						arrow.style.top=objTd.offsetTop-10;
						arrow.style.left=objTd.offsetLeft+7;
						style.backgroundColor='#CE0609';
					}
					myFun.prevShowDiv.style.backgroundColor='';
					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=22>");
			document.writeln("	<td bgcolor='#506681' align='center'><a title='"+this.photos[0][3]+"' style='font-size:12px;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()",this.refreshTime);
	}
	catch(e){alert(e)}
}
