extranet/www/js/scripts.js

83 lines
1.8 KiB
JavaScript
Raw Normal View History

$(document).ready(function(){
$("#formR-naf").autocomplete("./pages/nafajax.php", {
minChars:3,
width: 400,
highlight: false,
scroll: true,
formatResult: function(data, value) {
return value.split(" , ")[0];
}
});
});
var myMenu;
window.onload = function() {
myMenu = new SDMenu("my_menu");
myMenu.init();
var page = location.href;
var sPage= page.substr(page.lastIndexOf('/') + 7, 4);
var refr = document.referrer;
var sRefr= refr.substr(refr.lastIndexOf('/') + 7, 4);
//alert (sRefr);
if ((sPage=='rech'||sPage=='main') && sRefr!='rech' && sRefr!='main') {
myMenu.collapseAll();
var firstSubmenu = myMenu.submenus[0];
myMenu.expandMenu(firstSubmenu);
}
};
/*
myMenu.();
var myMenu = new SDMenu("main_menu"); // ID of the menu element
// Default values...
myMenu.speed = 3;
myMenu.remember = true;
myMenu.oneSmOnly = false;
myMenu.markCurrent = true;
myMenu.init();
// Additional methods...
var firstSubmenu = myMenu.submenus[0];
myMenu.expandMenu(firstSubmenu); // Expand a submenu
myMenu.collapseMenu(firstSubmenu); // Collapse a menu
myMenu.toggleMenu(firstSubmenu); // Expand if collapsed and collapse if expanded
myMenu.expandAll(); // Expand all submenus
myMenu.collapseAll(); // Collapse all submenus
*/
function getImagePageLeft(img){
var x,obj;
x=0;
obj=img;
if(img!=null){
while(obj.offsetParent!=null){
x+=obj.offsetLeft;
obj=obj.offsetParent;
}
x+=obj.offsetLeft;
return x;
} else {
return(-1);
}
}
function getImagePageTop(img){
var y,obj;
y=0;
obj=img;
if(img!=null){
while(obj.offsetParent!=null){
y+=obj.offsetTop;
obj=obj.offsetParent
}
y+=obj.offsetTop;
return y;
} else {
return(-1);
}
}