var CHeight
var lastHeight
var lastDiv=null
var speed=.25
var Cid=null
var Menu=Array()
var ProductMenu=Array()
var ST=null
var MaxH=30
var MinH=28
Menu[0]=new menuText("HOME","")
Menu[1]=new menuText("ABOUT US","")
Menu[2]=new menuText("PRODUCT","")
Menu[3]=new menuText("CONTACT US","")
Menu[4]=new menuText("ADDRESS","")

var SubCHeight
var SubMaxH = 30
var SubMinH = 28
ProductMenu[0]=new menuText("Pillow Machine","")
ProductMenu[1]=new menuText("Stand-up pouch filling","")
ProductMenu[2]=new menuText("Pipe and tube extruder","")
ProductMenu[3]=new menuText("Blow Moulding","")
ProductMenu[4]=new menuText("Packaging Machine","")
ProductMenu[5]=new menuText("Foamed Extrusion Line","")
ProductMenu[6]=new menuText("Filling Lines","")
ProductMenu[7]=new menuText("Printing Machine ","")
ProductMenu[8]=new menuText("Slitting and Limination","")
ProductMenu[9]=new menuText("Bagging Machine","")

function menuText(Title,content)
{
this.title=Title
this.content=content
}

function ChangeHeight(){

if (treediv.length)
{
for (i=0;i<treediv.length;i++){
 diffH=CHeight[i]
 pH=(speed)*(diffH-lastHeight[i]);
 if(pH>0)pH=Math.ceil(pH);
   else pH=Math.floor(pH);
 treediv[i].style.pixelHeight+=pH;
 lastHeight[i]=lastHeight[i]+pH;
 }
}
else
{
 diffH=CHeight
 pH=(speed)*(diffH-lastHeight);
 if(pH>0)pH=Math.ceil(pH);
   else pH=Math.floor(pH);
 treediv.style.pixelHeight+=pH;
 lastHeight=lastHeight+pH;
}

}

function DivOver(id,obj){
divitem=event.srcElement
if (treediv.length) {CHeight[id]=MaxH;Cid=id}else {CHeight=MaxH;Cid=0}
divitem.style.backgroundColor="";
divitem.style.fontSize="14px";
ST=window.setTimeout("show()",160)
}

function DivOut(id,obj){
divitem=event.srcElement
if (treediv.length) CHeight[id]=MinH;else CHeight=MinH;
divitem.style.backgroundColor=""
divitem.style.fontSize="12px"
if (Cid!=null)
 {
 if (treediv.length) treediv[Cid].innerHTML=Menu[Cid].title;else
treediv.innerHTML=Menu[Cid].title;
 }
if (ST!=null) window.clearTimeout(ST)
if (treediv.length)
 {if (treediv[Cid].filters[0])
{treediv[Cid].filters[0].stop();treediv[Cid].style.filter=""}}
 else
 {if (treediv.filters[0]) {treediv.filters[0].stop();treediv.style.filter=""}}
}

function show(){
if (treediv.length)
{
 treediv[Cid].style.filter="blendtrans(duration=.1)"
 treediv[Cid].filters[0].apply();
 treediv[Cid].innerHTML=Menu[Cid].title+"<br>     "+Menu[Cid].content
 treediv[Cid].filters[0].play();
 }
 else
 {
 treediv.style.filter="blendtrans(duration=.1)"
 treediv.filters[0].apply();
 treediv.innerHTML=Menu[Cid].title+"<br>     "+Menu[Cid].content
 treediv.filters[0].play();
 }
}

function init(){
if (treediv.length){
	CHeight=new Array()
	lastHeight=new Array()
	for (i=0;i<treediv.length;i++){
	 CHeight[i]=0
	 lastHeight[i]=0
	 treediv[i].innerHTML=Menu[i].title

	 }

	// new add begin
	SubCHeight=new Array()
	for (i=0;i<SubTreediv.length;i++){
	 SubCHeight[i]=0
	 SubTreediv[i].innerHTML="&nbsp;&nbsp;&nbsp;"+ProductMenu[i].title
	}
	 // new add end
}else{
	 CHeight=0
	 lastHeight=0
	 treediv.innerHTML=Menu[0].title
	 
	 // new add begin
	 SubCHeight=0
	 SubTreediv[i].innerHTML="&nbsp;&nbsp;&nbsp;"+ProductMenu[i].title
	 // new add end
	}
	DivTD.style.pixelHeight=DivTD.scrollHeight+(MaxH-MinH)+4
	setInterval("ChangeHeight()",1)
}


// new add begin
function DivProductOver(id,obj){
	divitem=event.srcElement
	if (SubTreediv.length) {SubCHeight[id]=SubMaxH;Cid=id}else {SubCHeight=SubMaxH;Cid=0}
	divitem.style.backgroundColor="";
	divitem.style.fontSize="12px";
	ST=window.setTimeout("showProduct()",160)
}

function DivProductOut(id,obj){
	divitem=event.srcElement
	if (SubTreediv.length) SubCHeight[id]=SubMinH;else SubCHeight=SubMinH;
	divitem.style.backgroundColor=""
	divitem.style.fontSize="11px"
	if (Cid!=null){
		if (SubTreediv.length) 
			SubTreediv[Cid].innerHTML="&nbsp;&nbsp;&nbsp;"+ProductMenu[Cid].title;
		else
			SubTreediv.innerHTML="&nbsp;&nbsp;&nbsp;"+ProductMenu[Cid].title;
	}
	if (ST!=null) window.clearTimeout(ST)
	if (SubTreediv.length){
		if (SubTreediv[Cid].filters[0]){
			SubTreediv[Cid].filters[0].stop();SubTreediv[Cid].style.filter=""
		}
	}else{
		if (SubTreediv.filters[0]) {
			SubTreediv.filters[0].stop();SubTreediv.style.filter=""
		}
	}
}

function showProduct(){
	if (SubTreediv.length){
		 SubTreediv[Cid].style.filter="blendtrans(duration=.1)"
		 SubTreediv[Cid].filters[0].apply();
		 SubTreediv[Cid].innerHTML="&nbsp;&nbsp;&nbsp;"+ProductMenu[Cid].title+"<br>     "+ProductMenu[Cid].content
		 SubTreediv[Cid].filters[0].play();
	 } else {
		 SubTreediv.style.filter="blendtrans(duration=.1)"
		 SubTreediv.filters[0].apply();
		 SubTreediv.innerHTML="&nbsp;&nbsp;&nbsp;"+ProductMenu[Cid].title+"<br>     "+ProductMenu[Cid].content
		 SubTreediv.filters[0].play();
	 }
}

function ProductDisPlay(){
	for (i=0;i<SubTreediv.length;i++){
		SubTreediv[i].style.display = "block";
	}
}

function ProductUnDisPlay(){
	for (i=0;i<SubTreediv.length;i++){
		SubTreediv[i].style.display = "none";
	}
}

// new add end

function XIAOXIAO_openWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}