//free JavaScripts at http://www.ScriptBreaker.com
var pull=0;
var height = 620;
var vwidth = 180;
var speed = 0;
var step =4;

var hheight = 28; // heigth of a header item
var iheight = 20; // heigth of a item

var bgc = "#E4E6D8" // background color of the item
var tc = "#000000" // text color of the item
var  textdec  =  "none";
  
var over_bgc = "#E4E6D8";
var over_tc = "#000000";
var  over_textdec  =  "none"; // underline 
var open1 = -1;

var N = (document.all) ? 0 : 1;
var Link_count = 0;
var ntop = 0;
var items = false
var z = 0;
var hnr = 1;
var timerID = null;
var link_array = new Array();

function write_menu()
{
	document.write("<div id=main_panel style='height:")
	if (N) document.write(height-5);
	else document.write(height-2-5);
	document.write(";width:");
	if (N) document.write(vwidth)
	else document.write(vwidth-2)
	document.write("'>");

	cl =0;
	for(i=0;i<Link.length;i++)
	{
		la = Link[i].split("|");
		if(la[0] == "0")
		{
			if (items == true) {document.write("</div>");items = false;}
			document.write("<div class='head_item' id='move"+cl+"' style='height:"+hheight+";width:"+vwidth+";top:"+(ntop-1)+";z-index:"+z+"' onclick='move("+cl+","+hnr+")'>&nbsp;&nbsp;"+la[1]+"</a></div>");
			link_array[cl] = new Array("up",0,hnr);
			cl++;hnr++;
			ntop += hheight-1;
			z++;
		}
		else
		{
			cheight = height - ntop + 1;
			if (items == false) 
			{
				document.write("<div class='item_panel' id='move"+cl+"' style='height:"+cheight+"px;width:"+vwidth+";top:")
				if (N) document.write(ntop+2);
				else document.write(ntop);
				document.write(";z-index:"+z+"'>");
				z++;
				link_array[cl] = new Array("up",0,"");
				cl++;
			}
			document.write("<img src='/goodpic/s.gif' width=1 height=1><br><a style='color:"+ tc +"; text-decoration: "+ textdec +"' href='"+la[2]+"'");
			if (la[3] != "") document.write(" target='" + la[3] + "' ");
			document.write(" onmouseover=color('item"+i+"') onmouseout=uncolor('item"+i+"') ><div class='item' id='item"+i+"' style='height:"+iheight+";width:"+vwidth+"'>&nbsp;&nbsp;&nbsp;&nbsp;"+la[1]+"</div></a>");
			items = true;
		}
	}
	//document.write("</div>");
	if (items == true) {document.write("</div>");}
}

function color(obj)
{
 document.getElementById(obj).style.backgroundColor = over_bgc;
 document.getElementById(obj).style.color = over_tc
 document.getElementById(obj).style.textDecoration  =  over_textdec; 
}

function uncolor(obj)
{
 document.getElementById(obj).style.backgroundColor = bgc;
 document.getElementById(obj).style.color = tc;
 document.getElementById(obj).style.textDecoration  =  textdec;
}

function move(idnr,hid)
{
	if ((idnr != open1)&& (timerID == null))
	{
		if(link_array[idnr][0] == "up")
		{
			down = height - (hid * hheight) - ((hnr -(hid+1))* hheight) + 2;
			if(N) down+=2;
			dmover(idnr+2,down);
		}
		else
		{
		   up = height - ((hid -1) * hheight) -((hnr - (hid))* hheight) +2;
		   if(N) up+=2;
		   umover(idnr,up);
		}
	   open1 = idnr;
	}
}

function dmover(idnr,down)
{
 for (i=idnr;i<link_array.length;i++)
 {
  if(link_array[i][0] == "up")
  {
   txt_obj = "move" + i
   document.getElementById(txt_obj).style.top = parseInt(document.getElementById(txt_obj).style.top) + step;
  }
 }
 down-= step;
 if(down > 0)timerID = setTimeout("dmover("+idnr+","+down+")",speed);
 else 
 {
  for (i=idnr;i<link_array.length;i++) {link_array[i][0] = "down";}
 timerID = null;
 }
}

function umover(idnr,up)
{
 for (i=0;i<(idnr+2);i++)
 {
  if(link_array[i][0] == "down")
  {
   txt_obj = "move" + i
   document.getElementById(txt_obj).style.top = parseInt(document.getElementById(txt_obj).style.top) - step;
  }
 }
 up-=step;
 if(up > 0)timerID = setTimeout("umover("+idnr+","+up+")",speed);
 else 
 {
  for (i=0;i<(idnr+2);i++) {link_array[i][0] = "up";}
 timerID = null;
 }
}
//free JavaScripts at http://www.ScriptBreaker.com

function start(idnr)
{
 write_menu(); 
 for(i=0;i<link_array.length;i++)
 {
  if (link_array[i][2] == idnr)
  {	
   pull = i;
   i = link_array.length;
  }
 }
 move(pull,idnr);
}  
function getgift()
{
	if (document.gift.giftoptions.value != "")
	{
		location.href = document.gift.giftoptions.value
	}
}

function gotostore()
{
	if (document.store.stores.value != "")
	{
		location.href = document.store.stores.value
	}
}
