Login   Register  
PHP Classes
elePHPant
Icontem

File: rsd.js

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Luis I. Larrateguy  >  XML Menu  >  rsd.js  >  Download  
File: rsd.js
Role: Auxiliary data
Content type: text/plain
Description: Javascript functions to show or hide menus
Class: XML Menu
Generate hierarchic menu defined in XML using XSLT
Author: By
Last change: New javascript code, now showing on Mozilla FireFox!
Configurations for displaying the menu in Mozilla compatible browsers
Date: 2004-06-15 07:09
Size: 2,203 bytes
 

Contents

Class file image Download
/* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 *
 * Copyright (C) 2003-2004 Luis I. Larrateguy <luisignacio@larrateguy.com.ar>
 *
 *     This file is part of XMLMenu
 *  Foobar is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  any later version.
 *
 *  XMLMenu is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Foobar; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *
 * @version 0.7.0
 * @copyright 2004 
 **/ 

function show(container,submenu,deftop) {
	var objMenu;
	var objCont;
	var objDefTop;
	objMenu = document.getElementById(submenu);
	if (navigator.appVersion.indexOf("MSIE")==-1){
		if ((container != '') && (deftop != '')){
			objCont = document.getElementById(container);
			objDefTop = document.getElementById(deftop);
			objMenu.style.top = objDefTop.offsetTop;
			objMenu.style.left = objCont.style.width + objCont.style.marginLeft;
		}
	}
	objMenu.style.visibility='visible';
	return;
}

function hide(m) {
	document.getElementById(m).style.visibility='hidden';
	return;
}

function findPosX(obj) {
	var curleft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	} else if (obj.x) curleft += obj.x;
	
	return curleft;
}

function findWidth(obj) {
	var w = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			w += obj.offsetWidth;
			obj = obj.offsetParent;
		}
	} 
	
	return w - 2;
}

function findPosY(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
	} else if (obj.y) curtop += obj.y;
	
	return curtop;
}