- /**
- * this function checks all checkbox
- * or uncheck all if there are already checked.
- */
- function CheckAll(){
- var checkboxes = document.getElementsByTagName('input');
- var nbCheckbox = checkboxes.length;
- var check = areAllChecked();
- for(var i=0;i<nbCheckbox;i++){
- if(checkboxes[i].getAttribute('type') == "checkbox" ){
- checkboxes[i].checked = (check) ? 0 : 1;
- }
- }
- }
- /**
- * this function return true if all checkbox are checked
- */
- function areAllChecked(){
- var checkboxes = document.getElementsByTagName('input');
- var nbCheckbox = checkboxes.length;
- for(var i=0;i<nbCheckbox;i++){
- if(checkboxes[i].getAttribute('type') == "checkbox" ){
- if(checkboxes[i].checked == 0){
- return false;
- }
- }
- }
- return true;
- }
-
function confirmDelete(message) {
return (confirm(message) ? true : false);
}
function Dopop(link) {
- newin=window.open(link,'popup','width=500,height=400,toolbar=false,scrollbars=yes');
+ newin=window.open(link,'popup','width=500,height=400,toolbar=false,scrollbars=yes,resizeable=yes');
}
$(document).ready(function(){
- if(basketcount){ updateBasket(basketcount,document) }
$(".close").click(function(){
window.close();
});
+ $(".focus").focus();
+ // clear the basket when user logs out
+ $("#logout").click(function(){
+ var nameCookie = "bib_list";
+ var valCookie = readCookie(nameCookie);
+ if (valCookie) { // basket has contents
+ updateBasket(0,null);
+ delCookie(nameCookie);
+ return true;
+ } else {
+ return true;
+ }
+ });
});
-
+
+// build Change Language menus
YAHOO.util.Event.onContentReady("changelanguage", function () {
- var oMenu = new YAHOO.widget.Menu("sublangs", { zindex: 2 });
- function positionoMenu() {
- oMenu.align("bl", "tl");
- }
- oMenu.subscribe("beforeShow", function () {
- if (this.getRoot() == this) {
- positionoMenu();
- }
- });
- oMenu.render();
- oMenu.cfg.setProperty("context", ["showlang", "bl", "tl"]);
- function onYahooClick(p_oEvent) {
- // Position and display the menu
- positionoMenu();
- oMenu.show();
- // Stop propagation and prevent the default "click" behavior
- YAHOO.util.Event.stopEvent(p_oEvent);
- }
- YAHOO.util.Event.addListener("showlang", "click", onYahooClick);
- YAHOO.widget.Overlay.windowResizeEvent.subscribe(positionoMenu);
- });
+ $(".sublangs").each(function(){
+ var menuid = $(this).attr("id");
+ var menuid = menuid.replace("show","");
+
+ var oMenu = new YAHOO.widget.Menu("sub"+menuid, { zindex: 2 });
+ function positionoMenu() {
+ oMenu.align("bl", "tl");
+ }
+ oMenu.subscribe("beforeShow", function () {
+ if (this.getRoot() == this) {
+ positionoMenu();
+ }
+ });
+ oMenu.render();
+ oMenu.cfg.setProperty("context", ["show"+menuid, "bl", "tl"]);
+ function onYahooClick(p_oEvent) {
+ // Position and display the menu
+ positionoMenu();
+ oMenu.show();
+ // Stop propagation and prevent the default "click" behavior
+ YAHOO.util.Event.stopEvent(p_oEvent);
+ }
+ YAHOO.util.Event.addListener("show"+menuid, "click", onYahooClick);
+ YAHOO.widget.Overlay.windowResizeEvent.subscribe(positionoMenu);
+
+ });
+});
+
+// Build lists menu
YAHOO.util.Event.onContentReady("listsmenu", function () {
+ YAHOO.widget.Menu.prototype.onRender = function () { };
$("#listsmenu").css("display","block").css("visibility","hidden");
- $("#cartDetails").css("display","block").css("visibility","hidden");
-
- $('.btn').each(function(){
- var b = $(this);
- var tt = b.text() || b.val();
- if ($(':submit,:button',this)) {
- b = $('<a>').insertAfter(this). addClass(this.className).attr('id',this.id);
- $(this).remove();
- }
- b.text('').css({cursor:'pointer'}). prepend('<i></i>')
- .append( $('<span>').text(tt).append('<i></i><span></span>') );
- });
-
- $("#cartmenulink").find("i:first").before("<img src=\"/opac-tmpl/prog/images/cart.gif\" alt=\"\" />");
- $("#listsmenulink").find("i:last").before("<img src=\"/opac-tmpl/prog/images/list.gif\" alt=\"\" />");
-
- var listMenu = new YAHOO.widget.Menu("listsmenu", { lazyload: true });
+ $("#listsmenulink").attr("href","#");
+ var listMenu = new YAHOO.widget.Menu("listsmenu");
listMenu.render();
listMenu.cfg.setProperty("context", ["listsmenulink", "tr", "br"]);
listMenu.cfg.setProperty("effect",{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.05});
+ listMenu.subscribe("beforeShow",positionlistMenu);
listMenu.subscribe("show", listMenu.focus);
function positionlistMenu() {
listMenu.align("tr", "br");
}
YAHOO.util.Event.addListener("listsmenulink", "click", listMenu.show, null, listMenu);
YAHOO.widget.Overlay.windowResizeEvent.subscribe(positionlistMenu);
+ });
+
+jQuery.fn.preventDoubleFormSubmit = function() {
+ jQuery(this).submit(function() {
+ if (this.beenSubmitted)
+ return false;
+ else
+ this.beenSubmitted = true;
});
-
-function init() {
- $('#cartmenulink').click(function(){
- openBasket(); return false;
- });
- // Build cartOverlay based on markup
- cartOverlay = new YAHOO.widget.Overlay("cartDetails", { context:["cartmenulink","tr","br"],
- visible:false,
- width:"200px",
- effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25} } );
- cartOverlay.render();
- YAHOO.util.Event.addListener("cartmenulink", "mouseover", cartOverlay.show, cartOverlay, true);
- YAHOO.util.Event.addListener("cartmenulink", "mouseout", cartOverlay.hide, cartOverlay, true);
- YAHOO.util.Event.addListener("cartmenulink", "click", cartOverlay.hide, cartOverlay, true);
- }
- YAHOO.util.Event.addListener(window, "load", init);
\ No newline at end of file
+};