<!--
Initialise.addEvent(function() {

	KeepInMindList.ini();

});


var KeepInMindList = {
    
    ini : function() {
        
        addLinks = $$('a.keep-in-mind-list-add-link');
	
    	addLinks.each(function(item) {
    	   
    	   item.observe('click', KeepInMindList.add, false);
    	   
    	});
    	
    	deleteLinks = $$('a.keep-in-mind-list-delete-link');
	
    	deleteLinks.each(function(item) {
    	   
    	   item.observe('click', KeepInMindList.deleteItem, false);
    	   
    	});
    	
        var TDiv = new Element("div", {
            "id" : "customerMessageWindow",
            "class" : "message-window",
            "style" : "display: none;"
        });
        
        var TSpan = new Element("span", {
            "class" : "message",
        });
    
        $("page").insert(TDiv);
        $("customerMessageWindow").insert(TSpan);
        
    },
    
    deleteItem : function() {
        
        artId = this.readAttribute('name');
        
        if (artId && Conf.sid && Conf.loc) {
            
            currentLink = this;
            
            currentLink.removeAttribute('href');
            
            new Ajax.Request(
                '/xhr/keepinmind/delete.php', {
                method: 'post', 
                parameters: {
                    art : artId,
                    sid : Conf.sid,
                    loc : Conf.loc
                },
                onSuccess : function(transport) {
                    
                    scrollOffset = document.viewport.getScrollOffsets();                   
                    
                    topPx = scrollOffset[1]+document.viewport.getHeight()/2;
                    
                    // scale message window
                    $('customerMessageWindow').setStyle({
                        top : topPx + 'px'
                    });                    
                    
                    $('customerMessageWindow').down('span').update(transport.responseText);
                    KeepInMindList.showCustomerMessageWindow();
                    
                    KeepInMindList.hideCustomerMessageWindow.delay(2.5);
                    
                    currentLink.hide();
                }
            });
            
            return true;
            
        }
        
        return false;
        
    },
    
    add : function() {
        
        artId = this.readAttribute('name');
        
        if (artId && Conf.sid && Conf.loc) {
            
            currentLink = this;
            
            currentLink.removeAttribute('href');
            
            new Ajax.Request(
                '/xhr/keepinmind/add.php', {
                method: 'post', 
                parameters: {
                    art : artId,
                    sid : Conf.sid,
                    loc : Conf.loc
                },
                onSuccess : function(transport) {
                    
                    scrollOffset = document.viewport.getScrollOffsets();                   
                    
                    topPx = scrollOffset[1]+document.viewport.getHeight()/2;
                    
                    // scale message window
                    $('customerMessageWindow').setStyle({
                        top : topPx + 'px'
                    });                    
                    
                    $('customerMessageWindow').down('span').update(transport.responseText);
                    KeepInMindList.showCustomerMessageWindow();
                    
                    KeepInMindList.hideCustomerMessageWindow.delay(2.5);
                    
                    currentLink.hide();
                }
            });
            
            return true;
            
        }
        
        return false;
        
    },
    
    showCustomerMessageWindow : function() {
        new Effect.Appear($('customerMessageWindow'), {
            duration : 0.4,
            to : 0.95
        });
    },
    
    hideCustomerMessageWindow : function() {
        $('customerMessageWindow').hide();
    }
    
};

-->

