function tabBox(id,cookieadd) {

    // get the actual display type
		var displaytype = document.getElementById(id).style.display;

    cookiestring = GetUserCookie("loft");
    
    // if the displaytype is none set it to block and add it to the cookie
		
    if (displaytype == "none") {
        document.getElementById(id).style.display = "block";
        
        // change the class
				if(document.getElementById(id + "_parent")) {
        	document.getElementById(id + "_parent").className = "tabBoxOpen";
				}
				
        if (cookieadd != 'noadd') {
            UpdateUserCookie(cookiestring + ":" + id);            
        }
    }
    else {
        document.getElementById(id).style.display = "none";
        
				// change the class
				if(document.getElementById(id + "_parent")) {
        	document.getElementById(id + "_parent").className = "tabBoxClosed";
				}
				
        if (cookieadd != 'noadd') {
            var replacedstring = eval ("cookiestring.replace(/:"+id+"/g, '')");
            
            UpdateUserCookie(replacedstring);
        }
    }
}

function UpdateUserCookie(string)
{
    date = new Date();
    date.setTime(date.getTime() + (1000 * 60 * 60 * 24 * 30));
    document.cookie = "loft" + "=" + string + "; expires=";
}

function GetUserCookie(crumbName)
{
    colCookie = document.cookie.split(";");
    
    for (a=0; a < colCookie.length; a++)
    {
        colCrumb = colCookie[a].split("=");
        var searcheval = eval("colCrumb[0].search(/"+crumbName+"/)");
        if(searcheval != -1) {
            return unescape(colCrumb[1]);
        }
    }
    return "";
}

function autoOpen() {
    var cookiestring = GetUserCookie("loft");
    var boxarray = cookiestring.split(":");
		var tabsCounter = 0;
    
    for(i = 0; i <= boxarray.length -1; i ++) {
    
        // the snatchboxes
				if (document.getElementById(boxarray[i])) {
            if (document.getElementById(boxarray[i] + "_parent")) {
                document.getElementById(boxarray[i] + "_parent").className = "tabBoxOpen";
            }
            
            document.getElementById(boxarray[i]).style.display = "block";
        }
				
    }

}




function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
