var $EFFECT_IMG$ = $JS_DIR$+"effect_img";

/*=================================================================================================
The setDrag Function By Fengfeng ( fengfeng@itp.ac.cn )

REQUIRE : common.js

setDrag(node) to enable the node for draging
and use the [ ref="drag" ] for the div as dragbar and if there's no [ ref="drag" ] then the node will be choose.
=================================================================================================*/

function setDrag_(o) 
{
	if (typeof o == "string") o = document.getElementById(o);
	if(!o) return;
	document.oDragStart=document.ondragstart;
	document.oSelectStart=document.onselectstart;
	document.oSelect=document.onselectstart;
	document.oMouseOver=document.onmousemove;
    	o.origX = parseInt(o.style.left) - document.body.scrollLeft;  
    	o.origY = parseInt(o.style.top) - document.body.scrollTop;
    	o.origIndex = o.style.zIndex;
    	var self_drag=true;
    	var divs = o.getElementsByTagName("div");
    	for(var m=0;m<divs.length;m++)
    	{
    		if(divs[m].getAttribute("ref")=="drag")
    		{
    			self_drag = false;
    			divs[m].ocursor = divs[m].style.cursor;
    			divs[m].super_=o;
    			divs[m].onmousedown=function(e)
    			{
    				this.style.cursor = "move";
				this.super_.style.zIndex = 9999;
		        	var evt = window.event || e;  
		        	this.super_.x =  evt.clientX+document.body.scrollLeft-parseInt(this.super_.style.left);  
		        	this.super_.y =  evt.clientY+document.body.scrollTop-parseInt(this.super_.style.top);
		        	document.movenode_=this;
		        	
		        	document.ondragstart = function(e){return false;};
				document.onselectstart = function(e){return false;}; 
				document.onselect = function(e){document.selection.empty();};
				
				if(this.setCapture) this.setCapture();  
	        		else if(window.captureEvents) window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
		        	
		        	document.onmousemove = function(e)
				{
			    		var evt = window.event || e; 
			    		document.movenode_.super_.style.left =  evt.clientX+document.body.scrollLeft-document.movenode_.super_.x+"px";  
			    		document.movenode_.super_.style.top =  evt.clientY+document.body.scrollTop-document.movenode_.super_.y+"px";  
			    		document.movenode_.super_.origX = parseInt(document.movenode_.super_.style.left) - document.body.scrollLeft;  
			    		document.movenode_.super_.origY = parseInt(document.movenode_.super_.style.top) - document.body.scrollTop;  
				};
				
				document.onmouseup=function()
	    			{
	    				document.ondragstart = document.oDragStart; 
					document.onselectstart = document.oSelectStart; 
					document.onselect = document.oSelect;
 	   				document.onmousemove=document.oMouseOver;
	    				if(!document.movenode_) return;
	    				document.movenode_.style.cursor = document.movenode_.ocursor;
	    				document.movenode_.super_.style.zIndex=document.movenode_.super_.origIndex;
	    				if(document.movenode_.releaseCapture) document.movenode_.releaseCapture();  
	            			else if(window.captureEvents) window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
	    			};
    			};
    		}
    	}
    	
    	if(self_drag)
    	{
		o.ocursor = o.style.cursor;
		o.onmousedown=function(e)
		{
			this.style.cursor = "move";
			this.drag=1;
			this.style.zIndex = 9999;
	        	var evt = window.event || e;  
	        	this.x =  evt.clientX+document.body.scrollLeft-parseInt(this.style.left);  
	        	this.y =  evt.clientY+document.body.scrollTop-parseInt(this.style.top); 
	        	document.movenode_=this;
	        	
	        	document.ondragstart = function(e){return false;};
			document.onselectstart = function(e){return false;}; 
			document.onselect = function(e){document.selection.empty();};
			
	        	if(this.setCapture) this.setCapture();  
	        	else if(window.captureEvents) window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
	        	
	        	document.onmousemove = function(e)
			{
		    		var evt = window.event || e; 
		    		document.movenode_.style.left =  evt.clientX+document.body.scrollLeft-document.movenode_.x+"px";  
		    		document.movenode_.style.top =  evt.clientY+document.body.scrollTop-document.movenode_.y+"px";  
		    		document.movenode_.origX = parseInt(document.movenode_.style.left) - document.body.scrollLeft;  
		    		document.movenode_.origY = parseInt(document.movenode_.style.top) - document.body.scrollTop;  
			};
			
			document.onmouseup=function()
			{
				document.onmousemove=document.oMouseOver;
    				document.ondragstart = document.oDragStart; 
				document.onselectstart = document.oSelectStart; 
				document.onselect = document.oSelect;
	    			if(typeof(document.movenode_)=="undefined") return;
				document.movenode_.style.cursor = document.movenode_.ocursor;
				document.movenode_.style.zIndex = document.movenode_.origIndex;
				if(document.movenode_.releaseCapture) document.movenode_.releaseCapture();  
	            		else if(window.captureEvents) window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
			};		
    		};
	}
}
//The End

/*=================================================================================================
The Vaccordion_ Class By Fengfeng ( fengfeng@itp.ac.cn )

REQUIRE : common.js style.css 

(and not set the padding border margin of the Object,you can set them in the child div)

Usage : 1. Create a Vaccordion_ Object;
	2. call the Object's animate method
=================================================================================================*/
function Vaccordion_(obj,speed)
{
	this.status_= "toshow";
	this.node_ = (typeof obj == "string") ? document.getElementById(obj) : obj ;
	this.speed_ = speed || 3 ;
	if(this.node_.style.overflowY=="") this.node_.style.overflowY="hidden";
	if(this.node_.style.overflowX=="") this.node_.style.overflowX="hidden";
	this.node_.style.width = (parseInt(this.node_.style.width) || parseInt(this.node_.offsetWidth ))+"px";
	this.node_.style.height = (parseInt(this.node_.style.height) || parseInt(this.node_.offsetHeight ))+"px";
	this.oHeight_ = parseInt(this.node_.offsetHeight );
	this.cascading_=false;
}

$Vstep$ = function()
{
	var opacity = Math.ceil((parseInt(this.node_.style.height)/this.oHeight_)*100);
	//setOpacity_(this.node_,opacity);
	if(this.status_=="tohide")
	{
		if(parseInt(this.node_.style.height) > this.speed_) 
		{
			this.cascading_=true;
			this.node_.style.height=parseInt(this.node_.style.height)-this.speed_+"px";
		}
		else
		{
			this.node_.style.height="0px";
			this.node_.style.display="none";
			//setOpacity_(this.node_,0);
			this.status_="toshow";
			this.cascading_=false;
			return;			
		}
		this.timer_=setTimeout($Vstep$.bind(this),10);
	}
	else if(this.status_=="toshow")
	{
		this.node_.style.display="block";
		if( parseInt(this.node_.style.height)+this.speed_ >= this.oHeight_ ) 
		{
			this.cascading_=false;
			this.status_="tohide";
			this.node_.style.height=this.oHeight_-(browser.msie ? 0 : border_(this.node_).Y)+"px";
			//setOpacity_(this.node_,100);
			return;
		}
		this.cascading_=true;
		this.node_.style.height=parseInt(this.node_.style.height)+this.speed_+"px";
		this.timer_=setTimeout($Vstep$.bind(this),10);
	}
	else
	{
		alert("The status_ in Cascade_ Class Must Be Wrong!");	
	}
};

Vaccordion_.prototype.animate_ = function(speed)
{
	if(this.timer_) clearTimeout(this.timer_);
	if(this.cascading_) this.status_= ( this.status_ == "tohide" ? "toshow" : "tohide" );
	$Vstep$.bind(this)(speed || this.speed_);
};
//The End

/*=================================================================================================
The Haccordion_ Class By Fengfeng ( fengfeng@itp.ac.cn )

REQUIRE : common.js style.js
(and not set the padding border margin of the Object,you can set them in the child div)

Usage : 1. Create a Haccordion_ Object;
	2. call the Object's animate method
=================================================================================================*/
function Haccordion_(obj,speed)
{
	this.status_= "toshow";
	this.node_ = obj || document.body;
	this.speed_ = speed || 3 ;
	if(this.node_.style.overflowY=="") this.node_.style.overflowY="hidden";
	if(this.node_.style.overflowX=="") this.node_.style.overflowX="hidden";
	this.node_.style.width = (parseInt(this.node_.style.width) || parseInt(this.node_.offsetWidth ))+"px";
	this.node_.style.height = (parseInt(this.node_.style.height) || parseInt(this.node_.offsetHeight ))+"px";
	this.oWidth_ = parseInt(this.node_.offsetWidth );
	this.cascading_=false;
}

$Hstep$ = function()
{
	var opacity = Math.ceil((parseInt(this.node_.style.width)/this.oWidth_)*100);
	//setOpacity_(this.node_,opacity);
	if(this.status_=="tohide")
	{
		if(parseInt(this.node_.style.width) > this.speed_) 
		{
			this.cascading_=true;
			this.node_.style.width=parseInt(this.node_.style.width)-this.speed_+"px";
		}
		else
		{
			this.node_.style.width="0px";
			this.node_.style.display="none";
			//setOpacity_(this.node_,0);
			this.status_="toshow";
			this.cascading_=false;
			return;			
		}
		this.timer_=setTimeout($Hstep$.bind(this),10);
	}
	else if(this.status_=="toshow")
	{
		this.node_.style.display="block";
		if( parseInt(this.node_.style.width)+this.speed_ >= this.oWidth_ ) 
		{
			this.cascading_=false;
			this.status_="tohide";
			//setOpacity_(this.node_,100);
			this.node_.style.width=this.oWidth_-(browser.msie ? 0 : border_(this.node_).X)+"px";
			return;
		}
		this.cascading_=true;
		this.node_.style.width=parseInt(this.node_.style.width)+this.speed_+"px";
		this.timer_=setTimeout($Hstep$.bind(this),10);
	}
	else
	{
		alert("The status_ in Cascade_ Class Must Be Wrong!");	
	}
};

Haccordion_.prototype.animate_ = function(speed)
{
	if(this.timer_) clearTimeout(this.timer_);
	if(this.cascading_) this.status_= ( this.status_ == "tohide" ? "toshow" : "tohide" );
	$Hstep$.bind(this)(speed || this.speed_);
};
//The End