	/************************************************************************************************************
	(C) www.teopto.com, October 2008
	产品栏目仿XP导航菜单滑动效果。
	************************************************************************************************************/	
	var xpPanel_slideSpeed = 50;	// Speed of slide
	var cookieNames = "xpPane";
	var xpPanel_currentDirection = new Array();
	/*
	These cookie functions are downloaded from 
	*/	
	function Get_Cookie(name) { 
		var start = document.cookie.indexOf(name+"="); 
		var len = start+name.length+1; 
		if ((!start) && (name != document.cookie.substring(0,name.length))) return null; 
		if (start == -1) return null; 
		var end = document.cookie.indexOf(";",len); 
		if (end == -1) end = document.cookie.length; 
		return unescape(document.cookie.substring(len,end)); 
	} 
	// This function has been slightly modified
	function Set_Cookie(name,value,expires,path,domain,secure) { 
		expires = expires * 60*60*24*1000;
		var today = new Date();
		var expires_date = new Date( today.getTime() + (expires) );
	    var cookieString = name + "=" +escape(value) + 
	       ( (expires) ? ";expires=" + expires_date.toGMTString() : "") + 
	       ( (path) ? ";path=" + path : "") + 
	       ( (domain) ? ";domain=" + domain : "") + 
	       ( (secure) ? ";secure" : ""); 
	    document.cookie = cookieString; 
	}
	function showHidePaneContent(){
		var img = document.getElementById('showHideButton');
		var obj = document.getElementById('dhtmlgoodies_Content');
		if(img.src.toLowerCase().indexOf('up')>=0){
			img.src = img.src.replace('up','down');
			obj.style.display='block';
			xpPanel_currentDirection[obj.id] = (xpPanel_slideSpeed*-1);
			slidePane((xpPanel_slideSpeed*-1), obj.id);
			if(cookieNames)Set_Cookie(cookieNames,'0',100000);
		}else{
			img.src = img.src.replace('down','up');
			if(document.all){
				obj.style.display='block';
			}
			xpPanel_currentDirection[obj.id] = xpPanel_slideSpeed;
			slidePane(xpPanel_slideSpeed,obj.id);
			if(cookieNames)Set_Cookie(cookieNames,'1',100000);
		}	
		return true;	
	}

	function slidePane(slideValue,id){
		if(slideValue!=xpPanel_currentDirection[id]){
			return false;
		}
		var activePane = document.getElementById(id);
		var subDiv = document.getElementById('menu');
		//var subDiv = activePane.getElementsByTagName('DIV')[0];

		var height = activePane.offsetHeight;
		var innerHeight = subDiv.offsetHeight;
		height+=slideValue;
		if(height<0)height=0;
		if(height>innerHeight)height = innerHeight;
		
		if(document.all){
			activePane.style.filter = 'alpha(opacity=' + Math.round((height / subDiv.offsetHeight)*100) + ')';
		}else{
			var opacity = (height / subDiv.offsetHeight);
			if(opacity==0)opacity=0.01;
			if(opacity==1)opacity = 0.99;
			activePane.style.opacity = opacity;
		}			
		
					
		if(slideValue<0){			
			activePane.style.height = height + 'px';
			subDiv.style.top = height - subDiv.offsetHeight + 'px';
			if(height>0){
				setTimeout('slidePane(' + slideValue + ',"' + id + '")',10);
			}else{
				if(document.all)activePane.style.display='none';
			}
		}else{			
			subDiv.style.top = height - subDiv.offsetHeight + 'px';
			activePane.style.height = height + 'px';
			if(height<innerHeight){
				setTimeout('slidePane(' + slideValue + ',"' + id + '")',10);				
			}		
		}
	}
	
	function mouseoverTopbar(str){
		var span = str.getElementsByTagName('SPAN')[0];
		span.style.color='#222222';	
		var img = document.getElementById('showHideButton');
		var src = img.src;
		img.src = img.src.replace('.gif','_over.gif');
	}
	function mouseoutTopbar(str){
		var span = str.getElementsByTagName('SPAN')[0];
		span.style.color='';
		var img = document.getElementById('showHideButton');
		var src = img.src;
		img.src = img.src.replace('_over.gif','.gif');	
	}
	function initDhtmlgoodies_xpPane(cookieNames,panelDisplayed){
		cookieValue = Get_Cookie(cookieNames);
		if(cookieValue) panelDisplayed = (cookieValue==1?true:false);
		
		if(!panelDisplayed){
			var Aobj1= document.getElementById('dhtmlgoodies_Content');
			var Aobj2 = document.getElementById('menu');
			
			//Aobj1.getElementsByTagName('DIV')[0]; 
			//var AsubDiv = Aobj.getElementsByTagName('DIV')[0];
			Aobj1.style.height = '0px';
			Aobj2.style.top = 0 - Aobj2.offsetHeight + 'px';
			if(document.all)Aobj1.style.display='none';
			var img = document.getElementById('showHideButton');
		    img.src = '/images/orange_down.gif';	
		}
	}
