//this function goes with the bFunctions so that we can drad and add information to a list.
function findIn(iglu, search){
	return(iglu[0]!=search)
}

var iglu=new Array();
var nIglu=new Array();
var count=0;
function addValue(newItem,out,elem,opt){
	var subItem = newItem.split(":|:");
	var value="";
	
	//if they are draging the item into a delete area
	if(opt=="delete"){
		var temp=iglu;
		var n=0;
		iglu=new Array();
		for(i=0; i<temp.length; i++){
			if(temp[i][0]!=subItem[0]){
				iglu[n]=new Array();
				iglu[n][0]=temp[i][0];
				iglu[n][1]=temp[i][1];
				n++;
			}
		}
		count=iglu.length;
	}
	
	if(subItem[1]){	//if the item has a second element, (ie. it's original)
		iglu[count]=new Array();
		iglu[count][0]=subItem[0];
		iglu[count][1]=subItem[1];
		count=count+1;
	}
	
	var html="<ul>";
	for (var i=0; i<iglu.length; i++){
		var sub=iglu[i];
		html += "<li id=\"clr\" style=\"background-color:#0033CC\"><a href=\"\" onClick=\"return false\" onDragStart=\"startDrag('"+sub[0]+"')\"><font color=\"#FFFF00\">&nbsp; "+sub[1]+"</font></a>";
		value=sub[0]+':|:'+value;
	}
	html += "</ul>";
	document.getElementById(elem).value=':|:'+value;	//output the id's
	if(out!=""){
	document.getElementById(out).innerHTML = html;	//output the list
	}
}

var x=null;
var html=null;
var opt=null;
function sElement(feName,way){ //to use this script, enclose the select element in span tages with an id that has the same name as the form element and call the ondblclick
	x = document.getElementById(feName);
	if(way=="t"){
		opt = x.innerHTML;
		html = "<input type=\"text\" name=\""+feName+"\" size=\"20\" ondblclick=\"sElement('"+feName+"','d')\">";
		x.innerHTML = html;
		way="d";
	}else if(way=="d"){
		html = opt;
		x.innerHTML = html;
	}	
}

function doBlink() {
  // Blink, Blink, Blink...
  var blink = document.all.tags("BLINK")
  for (var i=0; i < blink.length; i++)
    blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : "" 
}

function startBlink() {
  // Make sure it is IE4
  if (document.all)
    setInterval("doBlink()",1000)
}

//this is to setup the head feature, it sets whatever somebody clicks on
var oldCmd="";
function blink(cmd){
	cmd='hf_'+cmd
	if(oldCmd!=""){
		if(oldCmd==cmd){
			hideIt(oldCmd);
			showIt('hf_bc');
			oldCmd='hf_bc';
		}else{
			hideIt(oldCmd);
			showIt(cmd);
			oldCmd=cmd;
		}
	}else{
		hideIt('hf_bc');
		showIt(cmd);
		oldCmd=cmd;
	}
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

//set sidemenu according to the screen resolution
if(document.body.offsetWidth<="650"){
	hideIt('rSide');
}
