// JavaScript Document
function ExtendTree()
{
var I;
var Class_Item;
if (GetCookie("Class"));
for(I=0;I<50;I++)//?¨¬2¨¦50??¡Á¨®????
	{
	if (FindCookie(I))//?¨°¦Ì??¨°?1?a
		{
		Class_Item=eval("Class"+I);
		Class_Item.style.display="";
		}
	}
}
function SwitchTree(Item) {//¦Ì??¡é?3¡Á¨®?????¡äDD??3¨¬D¨°
var bit;
var Class_Item;
bit=FindCookie(Item);//??cookie??¨º?0,1¡ê?0¡¤¦Ì??false,1¡¤¦Ì??true
Class_Item=eval("Class"+Item);
  if (!bit) {//?1?a
    Class_Item.style.display="";
	SwitchCookie(GetCookieVal("Class"),Item)
  }
  else {//1?¡À?
    Class_Item.style.display="none"; 
	SwitchCookie(GetCookieVal("Class"),Item)
  }
}
function FindCookie(Item)//??cookie??¨º?0,1¡ê?0¡¤¦Ì??false,1¡¤¦Ì??true
{
var ClassCookie;
if (ClassCookie=GetCookieVal("Class"))//?¨°¦Ì???cookie
	{
		if (ClassCookie.charAt(Item)=="0")
				{
		     	return false;
				}		
				else
				{
				return true;
				}
	}
 	else//???¨°¦Ì???cookie¡ê??¡§¨¢¡é¨°???3¡è?¨¨?a50¦Ì?¡Á?¡¤?¡ä?¡ê?¡ä¨²¡À¨ª50??¨¦¨¬?¡¤¡Á¨®????
	{
	SetCookie ("Class","00000000000000000000000000000000000000000000000000")
	return false;
	}
}


 function getCookieVal (offset)//¨¨?cookie?¦Ì
 { var endstr = document.cookie.indexOf (";", offset); 
      if (endstr == -1)
	 endstr = document.cookie.length;
	 return unescape(document.cookie.substring(offset, endstr));
 }
 function GetCookieVal (name)//¨¨?cookie?¦Ì
 { var arg = name + "="; var alen = arg.length; 
	var clen = document.cookie.length;
	 var I = 0; while (I < clen)
      	{
	 var j = I + alen; 
	if (document.cookie.substring(I, j) == arg) return getCookieVal (j); 
	I = document.cookie.indexOf(" ", I) + 1; 
	if (I == 0) break; 
	} return   null;
 }
 function SwitchCookie(Char,Item)//????cookie?3??¦Ì??¦Ì¡ê?0¡À?1¡ê?1¡À?0
 {
 var newchar;
 if(Char.charAt(Item)=="0") newchar="1"; else newchar="0";
 newchar=Char.substring(0,Item)+newchar+Char.substring(Item+1);
 SetCookie ("Class", newchar);
 }
 
  function SetCookie (name, value) {
 document.cookie = name + "=" + value + "expires = null"; 
 }

function DeleteCookie (name,cval) { var exp = new Date(); exp.setTime 
      (exp.getTime() - 1); // This cookie is history var cval = GetCookie (name); 
      document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString(); 
      }
function GetCookie(name)
{
var cookieString=new String(document.cookie);
var cookieHeader=name;
var beginPosition=cookieString.indexOf(cookieHeader);
if (beginPosition!=-1)
				return true;
	else				
				return false;
		
}	
function animate()
{
if (!display_G)
	{
	pic1.pixelLeft=document.body.clientWidth-guideman.width;
	pic1.pixelTop=document.body.scrollTop;
	}else
	{
	pic4.pixelLeft=document.body.clientWidth-arrow.width;
	pic4.pixelTop=document.body.scrollTop;
	
	}

}function display()
{
if (!display_G) 
{
pic2.visibility='visible';
pic3.visibility='visible';
}
pic2.pixelLeft=pic1.pixelLeft+((guideman.width-cart.width)/2);
pic2.pixelTop=document.body.scrollTop+guideman.height-guideman.height/2;
pic3.pixelLeft=document.body.clientWidth-arrow.width;
pic3.pixelTop=document.body.scrollTop;

}

function MouseDown()
{
if (!display_G)
	{
pic1.visibility='hidden';
pic2.visibility='hidden';
pic3.visibility='hidden';
pic4.visibility='visible';
 SetCookie (C_Guidman,1);
display_G=true;
	}else
	{
pic1.visibility='visible';
pic2.visibility='visible';
pic3.visibility='visible';
pic4.visibility='hidden';
 DeleteCookie(C_Guidman,1);
display_G=false;
	}
}
function getwindowsize()
{
if (display_G)
pic4.visibility='visible';
 
guideman=new Image();
guideman.src="../image/guideman.gif";
cart=new Image();
cart.src="../image/cart.gif";
arrow=new Image();
arrow.src="../image/min.bmp";
document.onmousemove=animate;
}
function dispear(current){pic2.visibility='hidden';if (!display_G) pic3.visibility='hidden';
}
function openbag() {
        openwindow("bag");				} 
function cash() { 
        openwindow("cash");				} 
function addupbag(id) {
        openwindow("bag",id);				} 
function payinfo() {
        openwindow("payinfo");				} 
function discountinfo() {
        openwindow("discountinfo");				} 
function howbuy() {
        openwindow("howbuy");				} 
		
function openwindow(filename,id)
{ try
   {pic2.visibility='hidden';
  
   bagwin.close();
  
   if (id)    
    bagwin=window.open(filename+".asp?id="+id,'bagwin',"height=420,width=640,left=140,top=10,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
    else
    bagwin=window.open(filename+".asp",'bagwin',"height=420,width=640,left=140,top=10,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
    bagwin.focus();}
   catch(exception)
   {
 if (id)    
    bagwin=window.open(filename+".asp?id="+id,'bagwin',"height=420,width=640,left=140,top=10,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
    else
    bagwin=window.open(filename+".asp",'bagwin',"height=420,width=640,left=140,top=10,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
   bagwin.focus();}

}