// Common Used Functions Go Here

function Trim(str) {
	var out = str;
	
	while( out.charAt(0) == ' ' ) out = out.substring(1);
	while( out.charAt(out.length - 1) == ' ' ) out = out.substring(0, out.length - 2);
	
	return out;
}

//- isObject ------------------------
function isObject(obj) {
	return (typeof(obj) == "object") && (obj != null);
} //:isObject

function printHidden(sUrl) {
	if (window.navigator.userAgent.indexOf("MSIE ")!=-1 && navigator.appVersion.substr(0, 1) >= 4){
		document.body.insertAdjacentHTML("beforeEnd", 
			"<iframe name='printHiddenFrame' width='0' height='0'></iframe>");
		doc = printHiddenFrame.document;
		doc.open();
		doc.write(
			"<frameset onload='parent.printFrame(printMe);' rows=\"100%\">" +
			"<frame name=printMe src=\"" + sUrl + "\">" +
			"</frameset>");
		doc.close();
	}
	else{
		document.location.href=sUrl;
	}
}

function printFrame(frame) {
  frame.focus();
  frame.print();
  return;
}

/**************** Open Window ****************************/
var applicationPath = "";

function openWin(url, width, height, name, params) {
	var left, top;
	
	// inside the application
	if(url.toLowerCase().indexOf("http") == -1)
		url		= applicationPath + url;

	// dimentions
	if(width == null) width = "500";
	if(height == null) height = "480";
	
	// window name
	if(name == null) name = "XPop_" + Math.round(Math.random() * 1000) + "_" + Math.round(Math.random() * 100);
	
	// params
	if(params == null) {
		left	= (screen.width - width)/2;
		top		= (screen.height - height)/2;
	
		params	= "left=" + left + ",top=" + top + ",width=" + width + ", height=" + height + ", scrollbars=yes, menubar=yes, toolbar=yes, resizable=yes";
	}
	else {
		params	= "width=" + width + ", height=" + height + ", " + params;	
	}

	x = window.open(
		url, 
		name, 
		params);
	try{
		x.focus();	
	}catch(e){};
}

function goMod(module, params, tt) {
	var url = applicationPath + module;

    if(params == null) params = "";
    if(tt == null) tt = "";

    // template
    if(tt != "") {
        if(params != "" && !params.endsWith('&'))  params += "&";
        params += "TT=" + tt;
    }
    
	if(params != "") url += "?" + params;
	
	document.location.href	= url;
}

/*-----------------------------------------------------------------------*/
/*-	 Function : SetDefaultButton
/*-----------------------------------------------------------------------*/
var x_defaultButton	= "";

function registerDefaultButton(f) {
	try {
		if(event.keyCode == 13) {
			// prevent the default submission buttion get clicked
			if(canCancelBubble()) {
				event.cancelBubble = true;
				event.returnValue = false;
			}
			
			try{
				if(typeof(x_defaultButton) == "string" && x_defaultButton != "" && canSubmit() ) f.all[x_defaultButton].click();			
			}catch(e){
			}
		}
	}catch(e){
	}
}

function getSrcElementType() {
	if(isObject(event.srcElement) && typeof(event.srcElement.type) == "string")
		return event.srcElement.type;
	else
		return null;
}

function canSubmit() {
	var eleType = getSrcElementType();

	if(eleType == "textarea" || eleType == "reset" || eleType == null)
		return false;
	else
		return true;
}

function canCancelBubble() {
	if(getSrcElementType() == "textarea")
		return false;
	else
		return true;
}
/*-----------------------------------------------------------------------*/

/*-----------------------------------------------------------------------*/
/*-	 Function : Toggle the 'check all' check boxes
/*-----------------------------------------------------------------------*/
function xfn_checkAll(oChkAll, parentID, itemID) {
	var chkAllID = oChkAll.id;
	var bChecked = oChkAll.checked;
	var oInputs	 = xfn_getParent_(parentID).getElementsByTagName("INPUT");

	for(var i=0; i<oInputs.length; i++) {
		if(oInputs[i].type == "checkbox" && 
			oInputs[i].id != chkAllID &&
			oInputs[i].id.indexOf(itemID) != -1) {
			
			oInputs[i].checked = bChecked;
		}
	}
}

function xfn_checkOne(oChkOne, parentID, checkAllID, itemID) {
	var oInputs	 = xfn_getParent_(parentID).getElementsByTagName("INPUT");
	var bChecked = oChkOne.checked;
	
	if(bChecked) {
		// determine the checked state
		for(var i=0; i<oInputs.length; i++) {
			if(oInputs[i].type == "checkbox" && 
				oInputs[i].id.indexOf(itemID) != -1 &&
				!oInputs[i].checked) {
				
				bChecked	= false;
				break;
			}		
		}
	}

	// set 'check all' checkboxes
	for(var i=0; i<oInputs.length; i++) {
		if(oInputs[i].type == "checkbox" && 
			oInputs[i].id.indexOf(checkAllID) != -1) {
			
			oInputs[i].checked	= bChecked;			
		}		
	}
}

function xfn_getParent_(parentID) {
	var oParent = document.all(parentID);

	if(parentID != null && isObject(oParent))
		return oParent;
	else
		return document.body;
}
/*-----------------------------------------------------------------------*/

// get parent element
function getParentElementByTagName(obj, tagName) {
	var oParent = obj.parentElement;
	
	while(isObject(oParent) && oParent.tagName != tagName) 
		oParent = oParent.parentElement;
	
	if(isObject(oParent) && oParent.tagName == tagName) {
		return oParent;
	}
	else {
		return null;
	}
}

// get element(s) by tagname  
// -  id: integer, to return the object by index in the collection
//		  string   to return the object by the object's name or id (first occurrence)
//		  omitted  return the collection
function getElementsByTagName(obj, tagName, id, checkStartsWith) {
	if( (isObject(obj) == false) || (typeof(obj.getElementsByTagName) == "undefined") ) 
		return null;

	var coll = obj.getElementsByTagName(tagName);

	if(id == null) {
		// 'id' param omitted
		return coll
	}
	else {
		if(coll.length == 0) return null;
	
		if(typeof(id) == "number") {
			// get object by index
			return coll[id];				
		}
		else {
			var idLen = id.length;
		
			for(var i=0; i<coll.length; i++) {
				// name attr presents
				if( (typeof(coll[i].name) == "string") && ( (/* check starts with */checkStartsWith && coll[i].name.substr(0,idLen) == id) || (coll[i].name == id) ) )
					return coll[i];
				else if( (typeof(coll[i].id) == "string") && ( (/* check starts with */checkStartsWith && coll[i].id.substr(0,idLen) == id) || (coll[i].id == id) ) )
					return coll[i];
			}			
		}	
	}	
	return null;
}

function Collection()
{
	function Item(Index)
	{
		var Obj = null;
		if(Index != null)
		{
			var realIndex = parseInt(Index);
			if (!isNaN(realIndex) && realIndex >= 0 && realIndex < this.length)
				Obj = this[realIndex];
		}
		return Obj;
	}
	function Find(Object)
	{
		var i;
		var obj = null;
		for (i=0; i<this.length; i++)
		{
			if (this[i] == Object)
			{
				obj = this[i];
				break;
			}
		}
		return obj;
	}
	function FindByName(Name, Qualifier)
	{
		var i;
		var obj = null;
		for (i=0; i<this.length; i++)
		{
			if (this[i].Name == Name && this[i].Qualifier == Qualifier)
			{
				obj = this[i];
				break;
			}
		}
		return obj;
	}
	function Add(Object)
	{
		var ArraySize = this.length;
		this[ArraySize] = Object;
		return this[ArraySize];
	}
	function Remove(Index)
	{
		var i;
		var realIndex = parseInt(Index);
		if (isFinite(realIndex) && realIndex >= 0 && realIndex < this.length)
		{
			for (i=realIndex; i<this.length-1; i++)
				this[i] = this[i+1];
			this.length--;
		}
	}
	function RemoveObject(Object)
	{
		var i;
		for (i=0; i<this.length; i++)
		{
			if (this[i] == Object)
			{
				this.Remove(i);
				break;
			}
		}
	}
	function Count()
	{
		return this.length;
	}
	var obj = Array();
	obj.Item = Item;
	obj.Count = Count;
	obj.Add = Add;
	obj.Remove = Remove;
	obj.Find = Find;
	obj.FindByName = FindByName;
	obj.RemoveObject = RemoveObject;
	return obj;
}

/***************************************************
** StartsWith
****************************************************/
function StartsWith(str, strStart) {
	if(str == null || strStart == null) return false;

	var lenStr = str.length;
	var lenStrStart = strStart.length;

	if(lenStrStart > lenStr) return false;
	
	return str.substr(0, lenStrStart) == strStart;
} // StartsWith

function StartsWith_(str) {
	return StartsWith(this, str);
} // StartsWith_


/***************************************************
** EndsWith
****************************************************/
function EndsWith(str, strEnd) {
	if(str == null || strEnd == null) return false;

	var lenStr = str.length;
	var lenStrEnd = strEnd.length;

	if(lenStrEnd > lenStr) return false;
	
	return str.substr(lenStr - lenStrEnd) == strEnd;
} // EndsWith

function EndsWith_(str) {
	return EndsWith(this, str);
} // EndsWith_

/*********************************************************/
// Add a extention functions to String constructor.
String.prototype.test = function(re){
    return re.test(this);
}
String.prototype.containsWord = function(str){
    re = new RegExp("\\b" + str + "\\b","ig");
    return re.test(this);
}
String.prototype.trim = function()
{
    // Use a regular expression to replace leading and trailing 
    // spaces with the empty string
    return this.replace(/(^\s*)|(\s*$)/g, "");
}

String.prototype.startsWith = StartsWith_;
String.prototype.endsWith = EndsWith_;
/***********************************************/

//---------------------------------------------------------------
// disableOnPostBack
//---------------------------------------------------------------
var optDisabled_DefinedOnly		= 0x01;		/* check property 'disabledOnPostBack' if it's true */
var optDisabled_AlsoOnServer	= 0x02;		/* do not send the data to server */
var disabledAtClient	= "client";			/* disable the elements at client only. Only usable when 'optDisabled_AlsoOnServer' flag is being used. */

var gFrmActive = null;
var gFrmPosting = false;

function disableOnPostBack(oFrm, options, bDisabled) {
	var bDisableDefinedOnly  = false;
	var bDisableAlsoOnServer = false;
	
	// get options
	gFrmActive	= oFrm;
	
	bDisabled	= bDisabled != false;
	if(bDisabled == false) gFrmPosting = false;

	// change cursor
	document.body.style.cursor	= (bDisabled) ? "wait" : "auto";

	// exit here if the posting is in progress
	if(gFrmPosting) return false;
	
	// flag posting in progress		
	gFrmPosting	= true;

	if(!isNaN(options)) {
		bDisableDefinedOnly		= (options & optDisabled_DefinedOnly) == optDisabled_DefinedOnly;
		bDisableAlsoOnServer	= (options & optDisabled_AlsoOnServer) == optDisabled_AlsoOnServer;
	}

	// disable now
	if(bDisableAlsoOnServer) 
		// disable elements immediately, so the data WONT BE SENT to server
		disableOnPostBack_(bDisableDefinedOnly, true, bDisabled);

	// delay disable elements to ALLOW TO SEND the data to server
	setTimeout("disableOnPostBack_(" + bDisableDefinedOnly + ", false, " + bDisabled + ")", 1);
	
	return true;
}

function disableOnPostBack_(bDisableDefinedOnly, bDisableAtServer, bDisabled) {
	// Looking for non-input elements in the form
	for(var i=0; i<gFrmActive.elements.length; i++){
		if((gFrmActive.elements[i].tagName != "INPUT") && canDisable(gFrmActive.elements[i], bDisableDefinedOnly, bDisableAtServer))
			gFrmActive.elements[i].disabled = bDisabled;
	}
	
	// Input Elements
	var oInputs = gFrmActive.getElementsByTagName("INPUT");
	for(var i=0; i<oInputs.length; i++) {
		if(canDisable(oInputs[i], bDisableDefinedOnly, bDisableAtServer))
			oInputs[i].disabled = bDisabled;
	}
} // disableOnPostBack

function canDisable(obj, bDisableDefinedOnly, bDisableAtServer) {
	if(typeof(obj.disabled) == "undefined") return false;

	var sDisabledFlagValue = obj.disabledOnPostBack;
	var bDisabledFlagDefined = (typeof(sDisabledFlagValue) != "undefined");
	
	// flag not defined
	if( bDisabledFlagDefined == false ) {
		// eliminate if the flag is required but not present
		if( bDisableDefinedOnly ) return false;
			
		// set the flag value to 'disabledAtClient' if not defined. ie send to server as it is.
		sDisabledFlagValue = disabledAtClient;
	}

	// format the flag
	sDisabledFlagValue = sDisabledFlagValue.toLowerCase();
	
	// element type
	var type = (typeof(obj.type) == "undefined") ? "" : obj.type;
	
	if(bDisableAtServer) {
		// disable at server
		return sDisabledFlagValue == "true";
	}
	else {
		// disable at client
		if(type == "hidden") 
			// ignore hidden fields
			return false;
		else
			return (sDisabledFlagValue == "true") || (sDisabledFlagValue == disabledAtClient);
	}
} // canDisable
//---------------------------------------------------------

 /************************************************************************************************************ 
   (C) www.dhtmlgoodies.com, October 2005 
    
   This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.    
    
   Terms of use: 
   You are free to use this script as long as the copyright message is kept intact. However, you may not 
   redistribute, sell or repost it without our permission. 
    
   Thank you! 
    
   www.dhtmlgoodies.com 
   Alf Magne Kalleland 
    
   ************************************************************************************************************/    
        
   var dhtmlgoodies_menuObj;   // Reference to the menu div 
   var currentZIndex = 1000; 
   var liIndex = 0; 
   var visibleMenus = new Array(); 
   var activeMenuItem = false; 
   var timeBeforeAutoHide = 1200; // Microseconds from mouse leaves menu to auto hide. 
   var dhtmlgoodies_menu_arrow = 'http://www.dhtmlgoodies.com/scripts/dhtmlgoodies-menu2/images/arrow.gif'; 
    
   var MSIE = navigator.userAgent.indexOf('MSIE')>=0?true:false; 
   var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox')>=0?true:false; 
   var navigatorVersion = navigator.appVersion.replace(/.*?MSIE ([0-9]\.[0-9]).*/g,'$1')/1; 
   var menuBlockArray = new Array(); 
   var menuParentOffsetLeft = false;    


    // {{{ getStyle() 
   /** 
   * Return specific style attribute for an element 
   * 
   * @param Object el = Reference to HTML element 
   * @param String property = Css property 
   * @private 
   */        
   function getStyle(el,property) 
   {        

      if (document.defaultView && document.defaultView.getComputedStyle) { 

         var retVal = null;              
         var comp = document.defaultView.getComputedStyle(el, ''); 
         if (comp){ 
            retVal = comp[property]; 
              
            if(!retVal){ 
               var comp = document.defaultView.getComputedStyle(el, null); 
               retVal = comp.getPropertyCSSValue(property); 
            }          
         }    

         if(retVal==null)retVal=''; 
          
         return el.style[property] || retVal; 
      } 
      if (document.documentElement.currentStyle && MSIE){    
         var value = el.currentStyle ? el.currentStyle[property] : null; 
         return ( el.style[property] || value ); 
                                              
      } 
      return el.style[property];              
   } 
      
   function getTopPos(inputObj) 
   { 
   	var origInputObj = inputObj;
 
     var returnValue = inputObj.offsetTop; 
     if(inputObj.tagName=='LI' && inputObj.parentNode.className=='menuBlock1'){    
        var aTag = inputObj.getElementsByTagName('A')[0]; 
        if(aTag)returnValue += aTag.parentNode.offsetHeight; 
     } 
     var topOfMenuReached = false; 
     while((inputObj = inputObj.offsetParent) != null){ 
        if(inputObj.parentNode.id=='dhtmlgoodies_menu')topOfMenuReached=true; 
        if(topOfMenuReached && !inputObj.className.match(/menuBlock/gi) || (!MSIE && origInputObj.parentNode.className=='menuBlock1')){ 
           var style = getStyle(inputObj,'position'); 
           if(style=='absolute' || style=='relative'){                
              return returnValue;            
           } 
        } 
          
        returnValue += inputObj.offsetTop;          
     } 

     return returnValue; 
   } 
    
   function getLeftPos(inputObj) 
   { 
     var returnValue = inputObj.offsetLeft; 
      
     var topOfMenuReached = false; 
     while((inputObj = inputObj.offsetParent) != null){ 
       if(inputObj.parentNode.id=='dhtmlgoodies_menu')topOfMenuReached=true; 
        if(topOfMenuReached && !inputObj.className.match(/menuBlock/gi)){ 
           var style = getStyle(inputObj,'position'); 
           if(style=='absolute' || style=='relative')return returnValue; 
        } 
      
        returnValue += inputObj.offsetLeft; 
     } 
     return returnValue; 
   } 


    
   function showHideSub() 
   { 

      var attr = this.parentNode.getAttribute('currentDepth'); 
      if(navigator.userAgent.indexOf('Opera')>=0){ 
         attr = this.parentNode.currentDepth; 
      } 
        
      this.className = 'currentDepth' + attr + 'over'; 
        
      if(activeMenuItem && activeMenuItem!=this){ 
         activeMenuItem.className=activeMenuItem.className.replace(/over/,''); 
      } 
      activeMenuItem = this; 
    
      var numericIdThis = this.id.replace(/[^0-9]/g,''); 
      var exceptionArray = new Array(); 
      // Showing sub item of this LI 
      var sub = document.getElementById('subOf' + numericIdThis); 
      if(sub){ 
         visibleMenus.push(sub); 
         sub.style.display=''; 
         sub.parentNode.className = sub.parentNode.className + 'over'; 
         exceptionArray[sub.id] = true; 
      }    
        
      // Showing parent items of this one 
        
      var parent = this.parentNode; 
      while(parent && parent.id && parent.tagName=='UL'){ 
         visibleMenus.push(parent); 
         exceptionArray[parent.id] = true; 
         parent.style.display=''; 
          
         var li = document.getElementById('dhtmlgoodies_listItem' + parent.id.replace(/[^0-9]/g,'')); 
         if(li.className.indexOf('over')<0)li.className = li.className + 'over'; 
         parent = li.parentNode; 
          
      } 

          
      hideMenuItems(exceptionArray); 



   } 

   function hideMenuItems(exceptionArray) 
   { 
      /* 
      Hiding visible menu items 
      */ 
      var newVisibleMenuArray = new Array(); 
      for(var no=0;no<visibleMenus.length;no++){ 
         if(visibleMenus[no].className!='menuBlock1' && visibleMenus[no].id){ 
            if(!exceptionArray[visibleMenus[no].id]){ 
               var el = visibleMenus[no].getElementsByTagName('A')[0]; 
               visibleMenus[no].style.display = 'none'; 
               var li = document.getElementById('dhtmlgoodies_listItem' + visibleMenus[no].id.replace(/[^0-9]/g,'')); 
               if(li.className.indexOf('over')>0)li.className = li.className.replace(/over/,''); 
            }else{              
               newVisibleMenuArray.push(visibleMenus[no]); 
            } 
         } 
      }        
      visibleMenus = newVisibleMenuArray;        
   } 
    
    
    
   var menuActive = true; 
   var hideTimer = 0; 
   function mouseOverMenu() 
   { 
      menuActive = true;        
   } 
    
   function mouseOutMenu() 
   { 
      menuActive = false; 
      timerAutoHide();    
   } 
    
   function timerAutoHide() 
   { 
      if(menuActive){ 
         hideTimer = 0; 
         return; 
      } 
        
      if(hideTimer<timeBeforeAutoHide){ 
         hideTimer+=100; 
         setTimeout('timerAutoHide()',99); 
      }else{ 
         hideTimer = 0; 
         autohideMenuItems();    
      } 
   } 
    
   function autohideMenuItems() 
   { 
      if(!menuActive){ 
         hideMenuItems(new Array());    
         if(activeMenuItem)activeMenuItem.className=activeMenuItem.className.replace(/over/,'');        
      } 
   } 
    
    
   function initSubMenus(inputObj,initOffsetLeft,currentDepth) 
   {    
      var subUl = inputObj.getElementsByTagName('UL'); 
      if(subUl.length>0){ 
         var ul = subUl[0]; 
          
         ul.id = 'subOf' + inputObj.id.replace(/[^0-9]/g,''); 
         ul.setAttribute('currentDepth' ,currentDepth); 
         ul.currentDepth = currentDepth; 
         ul.className='menuBlock' + currentDepth; 
         ul.onmouseover = mouseOverMenu; 
         ul.onmouseout = mouseOutMenu; 
         currentZIndex+=1; 
         ul.style.zIndex = currentZIndex; 
         menuBlockArray.push(ul); 
         ul = dhtmlgoodies_menuObj.appendChild(ul); 
         var topPos = getTopPos(inputObj); 
         var leftPos = getLeftPos(inputObj)/1 + initOffsetLeft/1;          
         
         ul.style.position = 'absolute'; 
         ul.style.left = leftPos + 'px'; 
         ul.style.top = topPos + 'px'; 
         var li = ul.getElementsByTagName('LI')[0]; 
         while(li){ 
            if(li.tagName=='LI'){    
               li.className='currentDepth' + currentDepth;                
               li.id = 'dhtmlgoodies_listItem' + liIndex; 
               liIndex++;              
               var uls = li.getElementsByTagName('UL'); 
               li.onmouseover = showHideSub; 

               if(uls.length>0){ 
                  var offsetToFunction = li.getElementsByTagName('A')[0].offsetWidth+2; 
                  if(navigatorVersion<6 && MSIE)offsetToFunction+=15;   // MSIE 5.x fix 
                  initSubMenus(li,offsetToFunction,(currentDepth+1)); 
               }    
               if(MSIE){ 
                  var a = li.getElementsByTagName('A')[0]; 
                  a.style.width=li.offsetWidth+'px'; 
                  a.style.display='block'; 
               }                
            } 
            li = li.nextSibling; 
         } 
         ul.style.display = 'none';    
         if(!document.all){ 
            //dhtmlgoodies_menuObj.appendChild(ul); 
         } 
      }    
   } 


   function resizeMenu() 
   { 
      var offsetParent = getLeftPos(dhtmlgoodies_menuObj); 
        
      for(var no=0;no<menuBlockArray.length;no++){ 
         var leftPos = menuBlockArray[no].style.left.replace('px','')/1; 
         menuBlockArray[no].style.left = leftPos + offsetParent - menuParentOffsetLeft + 'px'; 
      } 
      menuParentOffsetLeft = offsetParent; 
   } 
    
   /* 
   Initializing menu 
   */ 
   function initDhtmlGoodiesMenu() 
   { 
      dhtmlgoodies_menuObj = document.getElementById('dhtmlgoodies_menu'); 
        
      if (isObject(dhtmlgoodies_menuObj))
      {
          var aTags = dhtmlgoodies_menuObj.getElementsByTagName('A'); 
          for(var no=0;no<aTags.length;no++)
          {          
             var subUl = aTags[no].parentNode.getElementsByTagName('UL'); 
             if(subUl.length>0 && aTags[no].parentNode.parentNode.parentNode.id != 'dhtmlgoodies_menu')
             { 
                var img = document.createElement('IMG'); 
                img.src = dhtmlgoodies_menu_arrow; 
                aTags[no].appendChild(img);              
             } 

          } 
                  
          var mainMenu = dhtmlgoodies_menuObj.getElementsByTagName('UL')[0]; 
          mainMenu.className='menuBlock1'; 
          mainMenu.style.zIndex = currentZIndex; 
          mainMenu.setAttribute('currentDepth' ,1); 
          mainMenu.currentDepth = '1'; 
          mainMenu.onmouseover = mouseOverMenu; 
          mainMenu.onmouseout = mouseOutMenu;        

          var mainMenuItemsArray = new Array(); 
          var mainMenuItem = mainMenu.getElementsByTagName('LI')[0]; 
          mainMenu.style.height = mainMenuItem.offsetHeight + 2 + 'px';
           
          while(mainMenuItem)
          { 
             mainMenuItem.className='currentDepth1'; 
             mainMenuItem.id = 'dhtmlgoodies_listItem' + liIndex; 
             mainMenuItem.onmouseover = showHideSub; 
             liIndex++;              
             if(mainMenuItem.tagName=='LI')
             { 
                mainMenuItem.style.cssText = 'float:left;';    
                mainMenuItem.style.styleFloat = 'left'; 
                mainMenuItemsArray[mainMenuItemsArray.length] = mainMenuItem; 
                initSubMenus(mainMenuItem,0,2); 
             }          
             mainMenuItem = mainMenuItem.nextSibling; 
          } 

          for(var no=0;no<mainMenuItemsArray.length;no++)
          { 
             initSubMenus(mainMenuItemsArray[no],0,2);          
          } 
            
          menuParentOffsetLeft = getLeftPos(dhtmlgoodies_menuObj);    
          window.onresize = resizeMenu;    
          dhtmlgoodies_menuObj.style.visibility = 'visible';  
      }  
   } 
   
   window.onload = initDhtmlGoodiesMenu;
