SDNMenu = function() {
	if (!document.getElementById || !document.getElementByTagName)
		return false;
	SDNMenu.prototype.menu = null;
	SDNMenu.prototype.defaultStates = null;
	SDNMenu.prototype.submenuState = null;
	SDNMenu.prototype.submenus = null;
	SDNMenu.prototype.titles = null;
	SDNMenu.prototype.titletext = null;
	SDNMenu.prototype.submenu_haschildren = null;
	SDNMenu.prototype.q = null;
	SDNMenu.prototype.rgb = null;
	//IE flicker bug
	try {
		document.execCommand("BackgroundImageCache", false, true);
	} catch(err) {}
	//IE flocker bug end
};

SDNMenu.prototype.define = function(aVar, val) { if (typeof(this[aVar]) == "undefined") this[aVar] = val; };

SDNMenu.prototype.init = function (id) {

  var thisMenu = this;
  this.menu = document.getElementById(id);
  this.define("remember", true);	//Remember menu states, and restore them on next visit.
	this.define("contractall_default", true);	//Should all submenus be contracted by default? (true or false)

//this.contractall_default = true;
//defaultStates - An array of zeros, ones and twos (0,1,2,0) that represent closed (0), open (1), and always open (2) menus.
//if the array is empty, no default state of menu will be loaded. if the array has values, but not as many as there are menus, you will be alerted.
//The init function must be called after the Default States have been set. Init can be called multiple times.
//0 is closed, 1 is open, 2 is always open.... if you want an always closed state, make sure there are no child submenus!

//NOTE: order or priority for menu states is 'remember' (ie. use cookie), defaultStates (if array not empty), 'contractall_default'

	this.define("bypixels", 1);	//Basicly it's speed,
				//but if the (number of submenu elements * bypixels) is larger than the submenu height
				//the menu will change height by ~50% each step.
	this.define("collapse_lastmenu", false); //if true, close the last menu that was opened if it was not a parent or child menu.
	this.define("collapse_topmenus_only", false); //if true, collapse top level menus only; requires collapse_lastmenu to be true.
	this.define("bInstantMenus", false); //if you want the menus to open instantly

	this.define("bRefreshMenu", true); //if true, the submenus will be refreshed if needed at the redraw_timeout interval.
				 //this allows the menu to work with font and window resizing.

	this.define("iSubmenuIndent", 0); //number of pixels for submenu menu title indents.
	this.define("iSubmenuItemIndent", 0); //number of pixels for submenu item indent level.
	this.define("bOnMouseOver", false); //if true, menus will expand a closed menu on mouseover.
	this.define("bOnClick", true); //if true, menus will expand/collapse on mouseover rather than on click.
	//this.rgb = {start:{r:137,g:133,b:133},end:{r:216,g:214,b:214}}; //determines the colour gradient to be used, NOTE: css overwrites this.
	this.define("redraw_timeout", 30); //milliseconds to menu redraw incase of window or font resize.
	this.define("bRightLeft", false);  //draw the menu right to left (true) or left to right (false)

//================= should be no need to configure anything below this line, but feel free to be adventurous ===================================

//var menu, titles, titletext, submenus, bypixels;

	this.menuWidth = 0;
	this.menuHeight = 0;
  this.define("lastMenu", 0);
  //this.lastMenu = 0;
	this.maxdepth = 0;
	this.refreshdelay;
	this.qOpen;
	this.qClose;

	if (this.submenus == null) {
		// to load default states again after init, you must run init again
		// if we allow loadDefaultStates to be run after menu has changed state, then we shouldn't expect titles to be titles.
		// provided the menu has not changed in number of submenus we don't need to find them again.
		this.titles = this.getElementsByClassName("title", "span");
		this.submenus = this.getElementsByClassName("submenu", "div");
		this.titletext = this.getElementsByClassName("tt", "span");
		this.submenu_haschildren = new Array(this.submenus.length);
	}

	if (this.defaultStates == null) { this.defaultStates = new Array(); } //no defaults provided

	if ((this.defaultStates.length > 0) && (this.defaultStates.length != this.submenus.length)) { alert('The number of default states is ' + this.defaultStates.length + ', but the number of menus is ' + this.submenus.length + '. Assuming no defaults.')
		this.defaultStates = new Array(this.submenus.length); //defaults provided, but they are no good
	}

	for(var i=0; i < this.submenus.length; i++) {
		//overwrite default state when there is no children to show
		this.submenu_haschildren[i] = this.hasChildren(i);
		this.defaultStates[i] = (this.submenu_haschildren[i] && this.defaultStates[i]) ? this.defaultStates[i] : ((this.contractall_default)? 0 : 1 );
		if (this.bOnMouseOver) {
			var tmo;
			this.titles[i].onmouseover = function (e) {
					clearTimeout(tmo);
					var thisTitle = this;
					tmo = setTimeout(function(e) { if (thisTitle.className == "titlehidden") thisMenu.gomenu(e, thisMenu.titles.indexOf(thisTitle)); clearTimeout(tmo); }, 300);
			};
			this.titles[i].onmouseout = function () { clearTimeout(tmo) }
		}
		if (this.bOnClick) {
			if ((this.defaultStates[i] < 2) && this.submenu_haschildren[i]) {
				this.titles[i].onclick = function (e) { thisMenu.gomenu(e, thisMenu.titles.indexOf(this)) };
//				this.titletext[i].onclick = function (e) { thisMenu.gomenu(e, thisMenu.titletext.indexOf(this)) };
			} else {
				this.titles[i].onclick = "";
			}
		}
		this.submenus[i].style.height = this.submenuHeight(this.submenus[i])+"px";
		if (this.rgb != null) { this.maxdepth = Math.max(this.maxdepth, this.getDepth(this.submenus[i])) };
	}

	this.q = new Array(false, false); //set no current menu activity

	this.setSubmenuMargins(this.menu, 0);

	//set the menu to the appropriate collapse/expand state
	(this.remember) ? this.restoreFromCookie() : this.restoreStates(this.defaultStates);
  var f = function () { thisMenu.refreshmenu() };
	this.refreshdelay = setInterval(f, this.redraw_timeout);
  this.setColour();

};
SDNMenu.prototype.setColour = function () {
	var o = this;
	if (o.rgb != null) {
		for(var i=0; i < this.titles.length; i++) {
			o.titles[i].style.backgroundColor = o.getColour(o.getDepth(o.submenus[i]), o.maxdepth);
		}
		//this.menu.style.backgroundColor = this.getColour(1,this.maxdepth);
		o.getElementsByClassName("top_lft", "dl")[0].style.backgroundColor = o.getColour(0, o.maxdepth);
		o.getElementsByClassName("bot_lft", "dl")[0].style.backgroundColor = o.getColour(0, o.maxdepth);
	}
};
SDNMenu.prototype.getDepth = function (oElm) {
	var o = this;
	var depth = 1;
    while ((oElm.className != o.menu.className)) {
      depth = depth - 1;
      oElm = oElm.parentNode;
    }
   return Math.abs(depth);
};
SDNMenu.prototype.getColour = function (depth, maxdepth) {
	var o = this;

	var r = o.rgb.start.r + Math.floor(((o.rgb.end.r - o.rgb.start.r)/maxdepth)*depth);
	var g = o.rgb.start.g + Math.floor(((o.rgb.end.g - o.rgb.start.g)/maxdepth)*depth);
	var b = o.rgb.start.b + Math.floor(((o.rgb.end.b - o.rgb.start.b)/maxdepth)*depth);

	return 'rgb('+r+','+g+','+b+')'; //"#" + padHex() + r.toString(16) + padHex() + g.toString(16) + padHex() + b.toString(16);
};
SDNMenu.prototype.setCurrent = function (objA) {
	var o = this;
	var currentlinks = o.getElementsByClassName("current", "a");
	for (var i=0; i < currentlinks.length; i++) {
		currentlinks[i].className = "";
	}
	objA.className = "current";
};
SDNMenu.prototype.hasChildren = function (sm) {
	return (this.submenus[sm].getElementsByTagName("*").length > 0)
};
SDNMenu.prototype.gomenu = function (e, sm) {
var o = this;
    // if we don't allow multiple menus to be manipulated at the same time, check to see if one is being manipulated
    //if ((o.q[0] == true || o.q[1] == true) ) return;
    //alert(sm);
    if (o.q[0] == true && o.qClose == sm) { o.q[0] = false; o.q[1] = true; o.qClose = -1; o.qOpen = sm; return; }
    else if (o.q[1] == true && o.qOpen == sm) { o.q[1] = false; o.q[0] = true; o.qOpen = -1; o.qClose = sm; return; }
    else if (o.q[0] == true || o.q[1] == true) return;

//    if (o.submenu_haschildren[sm] == true) { //only expand the menu if it has sub elements

 		// do not allow the event to bubble up to containing span
		// keep anti-bubble code within "if o.submenu_haschildren[sm] == true"
//	if( e.preventDefault ) { e.preventDefault(); }
//		e.returnValue = false;
//		if( e.stopPropagation ) { e.stopPropagation(); }
//		e.cancelBubble = true;

      if(parseInt(o.submenus[sm].style.height) > 0) {
        o.qClose = sm;
        o.q[0] = true;//action taken in function refreshMenus
      } else if (parseInt(o.submenus[sm].style.height) == 0) { //
        if (o.collapse_lastmenu == true) {
          //don't collapse lastmenu when it is related... menu 1/submenu 1.1/submenu 1.1.1
          if (o.isAncestor(o.submenus[sm], o.submenus[o.lastMenu]) != true) {
            if (o.isAncestor(o.submenus[o.lastMenu], o.submenus[sm]) != true) {
              o.qClose = o.lastMenu;
              //alert(o.lastMenu);
              o.q[0] = true; //action taken in function refreshMenus
            }
          }
        }
        o.qOpen = sm;
        o.q[1] = true; //action taken in function refreshMenus
      }
//    }
};

SDNMenu.prototype.forceRedraw = function () {
var o = this;
    if ((o.q[0] == false) && (o.q[1] == false)) {
      if ( ( (o.menuWidth != o.menu.offsetWidth) || (o.menuHeight != o.menu.offsetHeight) ) ) {
        o.restoreFromCookie();
      }
    }
};

SDNMenu.prototype.refreshmenu = function () {
var o = this;
    if (o.q[1] == true) {
      (o.bInstantMenus) ? o.showmenunow(o.qOpen, true, true) : o.showmenu(o.qOpen, true);
    }
    if (o.q[0] == true) {
      (o.bInstantMenus) ? o.hidemenunow(o.qClose, true) : o.hidemenu(o.qClose, true);
    }
    // only redraw the menu if we aren't closing or opening a submenu
    if ((o.q[0] == false) && (o.q[1] == false)) {
      //and only do it if the menu dimensions have changed
      if ( ( (o.menuWidth != o.menu.offsetWidth) || (o.menuHeight != o.menu.offsetHeight) ) ) {
        if (o.bRefreshMenu) o.restoreFromMemory();
      }
    }
};

SDNMenu.prototype.slash_expandall = function (bStore) {
var o = this;
    if (typeof o.menu!="undefined"){
      for(var i=o.submenus.length-1; i >= 0; i--){
        if (o.submenu_haschildren[i] == true)
          o.showmenunow(i, bStore, false);
      }
    }
};

SDNMenu.prototype.slash_contractall = function (bStore) {
var o = this;
    if (typeof o.menu!="undefined"){
      for(var i=0; i<o.submenus.length; i++){
//				if (o.defaultStates.length > 0 && o.defaultStates[i] >= 0) o.hidemenunow(i, bStore);
				if (o.defaultStates[i] < 2) o.hidemenunow(i, bStore); //don't hide always open menus
      }
    }
};

SDNMenu.prototype.setSubmenuMargins = function (oElm, currentMargin) {
var o = this;
    var oElmCurrent = oElm.firstChild;
    while (oElmCurrent) {
      if (oElmCurrent.className == "submenu") {
        o.setSubmenuMargins(oElmCurrent, parseInt(currentMargin) + parseInt(o.iSubmenuIndent));
      } else if (oElmCurrent.nodeType == 1) {//nodeType test to skip non-HTML elements, i.e. text nodes
        if (oElmCurrent.nodeName == "A") {
          if ((oElmCurrent.firstChild.className == "title") || (oElmCurrent.firstChild.className == "titlehidden") || (oElmCurrent.firstChild.className == "rtitlehidden")) {//submenu title link
            if (o.bRightLeft) {
            	oElmCurrent.firstChild.firstChild.style.marginRight = String(currentMargin) + "px" ;
            } else {
            	oElmCurrent.firstChild.firstChild.style.marginLeft = String(currentMargin) + "px" ;
            }
          } else {//normal menu link
            if (o.bRightLeft) {
	            oElmCurrent.firstChild.style.marginRight = String(parseInt(currentMargin)+(parseInt(o.iSubmenuItemIndent))) + "px" ;
            } else {
  	          oElmCurrent.firstChild.style.marginLeft = String(parseInt(currentMargin)+(parseInt(o.iSubmenuItemIndent))) + "px" ;
            }
          }
        } else if ((oElmCurrent.className == "title") || (oElmCurrent.className == "titlehidden") || (oElmCurrent.className == "rtitlehidden")) {
            if (o.bRightLeft) {
          		oElmCurrent.firstChild.style.marginRight = String(currentMargin) + "px" ;
            } else {
          		oElmCurrent.firstChild.style.marginLeft = String(currentMargin) + "px" ;
            }
        }
      }
      oElmCurrent = oElmCurrent.nextSibling;
    }
};

SDNMenu.prototype.loadDefaultStates = function (arrDefaultStates) {
var thisMenu = this;

	this.defaultStates = new Array();
	this.defaultStates = arrDefaultStates;

	if (this.submenus != null) {
		if ((this.defaultStates.length > 0) && (this.defaultStates.length != this.submenus.length)) { alert('The number of default states is ' + this.defaultStates.length + ', but the number of menus is ' + this.submenus.length + '. Assuming no defaults.')
			this.defaultStates = new Array(this.submenus.length); //defaults provided, but they are no good
		}

		for(var i=0; i < this.submenus.length; i++) {
			//overwrite default state when there is no children to show
			this.submenu_haschildren[i] = this.hasChildren(i);
			this.defaultStates[i] = (this.submenu_haschildren[i] && this.defaultStates[i]) ? this.defaultStates[i] : ((this.contractall_default)? 0 : 1 );
			if (this.bOnMouseOver) {
				this.titles[i].onmouseover = function (e) { thisMenu.gomenu(e, thisMenu.titles.indexOf(this)) };
			} else {
				if ((this.defaultStates[i] < 2) && this.submenu_haschildren[i]) {
					this.titles[i].onclick = function (e) { thisMenu.gomenu(e, thisMenu.titles.indexOf(this)) };
				} else {
					this.titles[i].onclick = "";
				}
			}
			this.submenus[i].style.height = this.submenuHeight(this.submenus[i])+"px";
		}

		this.q = [false, false]; //set no current menu activity

		this.setSubmenuMargins(this.menu, 0);
		this.restoreStates(this.defaultStates);

	}
};

SDNMenu.prototype.restoreStates = function (arrStates) {
var o = this;
    if (o.submenus.length == arrStates.length) {
      for (var i=arrStates.length-1; i>=0; i--) {
        if (arrStates[i] == 0 || o.submenu_haschildren[i] == false) {
          o.hidemenunow(i, true);
        } else {
          o.showmenunow(i, true, false);
        }
      }
    } else {
        o.restoreStates(o.defaultStates);
    }
};

SDNMenu.prototype.restoreFromMemory = function () {
var o = this;
    for (var i=o.submenuState.length-1; i>=0; i--) {
      if (o.submenuState[i] == 0) {
        if (parseInt(o.submenus[i].style.height) != 0) { // || o.submenu_haschildren[i] == false) {
          o.hidemenunow(i, false); // no need to store cookie info, it will be the same in the end
        }
      } else {
        if (parseInt(o.submenus[i].style.height) != o.submenuHeight(o.submenus[i])) {
          o.showmenunow(i, false, false); // no need to store cookie info, it will be the same in the end
        }
      }
    }
};

SDNMenu.prototype.restoreFromCookie = function () {
var o = this;
    if (o.getcookie(o.menu.id) != null) {
    	o.submenuState = o.getcookie(o.menu.id).split(",");
      o.restoreStates(o.submenuState);
    } else {
      o.restoreStates(o.defaultStates);
    }
    o.menuWidth = o.menu.offsetWidth;
    o.menuHeight = o.menu.offsetHeight;
};

SDNMenu.prototype.isAncestor = function (oElm, oElmTest) {
var o = this;
    if (oElm.className != o.menu.className) {
      if (oElm == oElmTest) {
        return (true);
      } else {
        return (o.isAncestor(oElm.parentNode, oElmTest));
      }
    } else {
      return (false);
    }
};

SDNMenu.prototype.expandChildren = function (oElm) {
var o = this;
    //recursively expand child submenus (that are not hidden) of the given menu element
    //I don't believe this should be needed, but without it the auto-resize/restore function
    //prevented submenus from being drawn as menus expand.

    var oElmCurrent = oElm.firstChild;

    while (oElmCurrent) {
      if (oElmCurrent.className == "submenu") {
        if (oElmCurrent.style.display != "none") {
          oElmCurrent.style.height = o.submenuHeight(oElmCurrent)+"px";
          o.expandChildren(oElmCurrent);
        }
      }
      oElmCurrent = oElmCurrent.nextSibling;
    }
};

SDNMenu.prototype.changeHeight = function (oElm, iDelta) {
var o = this;
    //recursively change the height of the object oElm and its parent until the parent object is 'sdmenu' or the parent not displayed
    //Note: if iDelta is negative, the menu height will be decreased, if it is positive, the menu height will increase.
    var newHeight;

    o.expandChildren(oElm); //ensure submenus that should be displayed are displayed.
    while ((oElm.className != o.menu.className) && (oElm.style.display != "none")) {
      newHeight = parseInt(oElm.style.height) + iDelta;
      if (newHeight <= 0) {
        oElm.style.height = "0px";
      } else {
          oElm.style.height = newHeight+"px";
        }
      var lastElm = oElm;
      oElm = oElm.parentNode;
    }
};

SDNMenu.prototype.hidemenu = function (sm, bStore) {
var o = this;
    var iChildCount = o.submenuChildCount(o.submenus[sm]);
//		var submenuContentHeight = o.submenuHeight(o.submenus[sm]);
		var iDelta = iChildCount*o.bypixels;
//		var iDelta = Math.floor(submenuContentHeight / o.bypixels);
//		var iDelta = Math.max(Math.floor(submenuContentHeight / o.bypixels), iChildCount*o.bypixels);

    if (iDelta >= parseInt(o.submenus[sm].style.height))
      iDelta = Math.floor((parseInt(o.submenus[sm].style.height)+1)/2);

    o.changeHeight(o.submenus[sm], -iDelta);

    if(parseInt(o.submenus[sm].style.height) == 0) {
      o.titles[sm].className = "titlehidden";
      o.titletext[sm].className = "tthidden";
      o.submenus[sm].style.display = "none";
      if (bStore == true) { o.store(); }
      //must set o.q[0] here because this is the only time we know the hiding has finished.
      o.q[0] = false; o.qClose = -1;
    }
};

SDNMenu.prototype.hidemenunow = function (sm, bStore) {
var o = this;
    //whatever the height is, reduce the height by this much to make it 0, make the same height change to parent elements
    o.changeHeight(o.submenus[sm], -parseInt(o.submenus[sm].style.height));
		if (o.submenu_haschildren[sm] == false) {
     	o.titles[sm].className = "rtitlehidden";
   	} else {
     	o.titles[sm].className = "titlehidden";
   	}
    o.titletext[sm].className = "tthidden";
    o.submenus[sm].style.display = "none";
    if (bStore == true) o.store();
     //must set o.q[0] here because this is the only time we know hidemenu has finished.
    o.q[0] = false; o.qClose = -1;
};

SDNMenu.prototype.submenuChildCount = function (oElm) {
var o = this;
    var subMenuCC = 0;
    var oElmCurrent = oElm.firstChild;

    while (oElmCurrent) {
      if (oElmCurrent.className == "submenu") {
        if (oElmCurrent.style.display != "none") {
          subMenuCC = subMenuCC + o.submenuChildCount(oElmCurrent);
        }
      } else if (oElmCurrent.nodeType == 1) { //not submenu so add height of element...
        //nodeType test to skip non-HTML elements, i.e. text nodes
        subMenuCC = subMenuCC + 1;
      }
      oElmCurrent = oElmCurrent.nextSibling;
    }
    return subMenuCC;
};

SDNMenu.prototype.submenuHeight = function (oElm) {
var o = this;
    var th = 0;
    var oElmCurrent;

    oElmCurrent = oElm.firstChild;

    while (oElmCurrent) {
      if (oElmCurrent.className == "submenu") {
        if (oElmCurrent.style.display != "none") {
          th = th + o.submenuHeight(oElmCurrent);
        }
      } else if (oElmCurrent.nodeType == 1) { //not submenu so add height of element...
        //nodeType test to skip non-HTML elements, i.e. text nodes
        th = th + oElmCurrent.offsetHeight;
      }
      oElmCurrent = oElmCurrent.nextSibling;
    }
    return th;
};

SDNMenu.prototype.showmenu = function (sm, bStore, bRememberLastMenu) {
var o = this;
    var iDelta;
    var iChildCount = o.submenuChildCount(o.submenus[sm]);

    o.submenus[sm].style.display = "";
    o.titles[sm].className = "title";
    o.titletext[sm].className = "tt";

    var i = 0;
    var submenuContentHeight = o.submenuHeight(o.submenus[sm]);
    iDelta = iChildCount*o.bypixels;
//		iDelta = Math.floor(submenuContentHeight / o.bypixels);
//		iDelta = Math.max(Math.floor(submenuContentHeight / o.bypixels), iChildCount*o.bypixels);

    if (iDelta >= submenuContentHeight - parseInt(o.submenus[sm].style.height)) {
      iDelta = Math.floor((submenuContentHeight - parseInt(o.submenus[sm].style.height)+1)/2);
    }
    o.changeHeight(o.submenus[sm], iDelta);
//alert('submenu height = ' + parseInt(o.submenus[sm].style.height) + '...SubmenuContentHeight is ' + submenuContentHeight);
    if (parseInt(o.submenus[sm].style.height) == submenuContentHeight) {
      if ((o.collapse_topmenus_only != true) || (o.submenus[sm].parentNode == o.menu)) { o.lastMenu = sm; } //remember the appropriate lastmenu
      if (bStore == true) { o.store(); }
      //must set o.q[1] here because this is the only time we know showmenu has finished.
      o.q[1] = false; o.qOpen = -1;
    }
};

SDNMenu.prototype.showmenunow = function (sm, bStore, bRememberLastMenu) {
var o = this;
    o.submenus[sm].style.display = "";
//    o.titles[sm].className = "title";
    o.titletext[sm].className = "tt";

		if (o.defaultStates[sm] == 2) {
     	o.titles[sm].className = "rtitlehidden";
   	} else {
     	o.titles[sm].className = "title";
   	}

    //calculate the last iDelta, ie. the difference between the submenu div height and the submenu content height
    var iDelta = o.submenuHeight(o.submenus[sm]) - parseInt(o.submenus[sm].style.height);
    o.changeHeight(o.submenus[sm], iDelta);
    if (o.bRememberLastMenu && ((o.collapse_topmenus_only != true) || (o.submenus[sm].parentNode == o.menu))) { o.lastMenu = sm; } //remember the appropriate lastmenu
    if (bStore == true) o.store();
    //must set o.q[1] here because this is the only time we know the hiding has finished.
    o.q[1] = false; o.qOpen = -1;
};

SDNMenu.prototype.store = function () {
var o = this;
    o.submenuState = new Array();

    for (var i = 0; i < o.submenus.length; i++) {
      if ( ((o.defaultStates[i] < 2) && (o.submenus[i].style.display == "none")) || o.submenu_haschildren[i] == false) {
        o.submenuState.push(0);  //collapsed
      } else {
        o.submenuState.push(1); //expanded
      }
    }
    o.putcookie(o.menu.id, o.submenuState.join(","), 30);
};

SDNMenu.prototype.getElementsByClassName = function (strClassName, strTagName){
var o = this;
    var arrElements = o.menu.getElementsByTagName(strTagName);
    var arrReturnElements = new Array();
    strClassName = strClassName.replace(/\-/g, "\\-");
    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
    var oElement;
    for(var i=0; i<arrElements.length; i++){
        oElement = arrElements[i];
        if(oRegExp.test(oElement.className)){
            arrReturnElements.push(oElement);
        }
    }
    return (arrReturnElements)
};

SDNMenu.prototype.putcookie = function (c_name,value,expiredays) {
		var c_name_v = c_name + "_v1";
    var exdate=new Date();
    exdate.setDate(exdate.getDate()+expiredays);
    document.cookie = c_name_v + "=" + escape(value) + ((expiredays==null) ? "" : ";expires="+exdate);
};

SDNMenu.prototype.getcookie = function (c_name) {
	var c_name_v = c_name + "_v1";
    if(document.cookie.length > 0) {
        var c_start = document.cookie.indexOf(c_name_v + "=");
        if(c_start != -1) {
            c_start = c_start + c_name_v.length + 1;
            var c_end = document.cookie.indexOf(";",c_start);
            if(c_end == -1)
                c_end = document.cookie.length;
            return unescape(document.cookie.substring(c_start, c_end));
        }
    }
    return null;
};



