window.addEvent('domready', function() {

   var aTips = new Class({
       Extends: Tips,
       elementLeave: function (b, a) { }
   });

   var curLink;

   var cTips = new aTips(null,{text:'',showDelay:0, fixed:1,className:'inform'});

   $$('a.getform').each(function(a) {

      a.addEvent('click', function(event) {

         event.stop();

         var url = a.href;
         regp = /^.+\/([^\/\?]+).*$/;
         url = url.replace(regp,"$1");

         new Request.HTML ({

             url: '/inform.phtml?productid='+url+"&header="+a.name,
             onSuccess: function(responseTree, responseElements, responseHTML, responseJavaScript){
                a.store('tip:text', responseHTML);
                cTips.attach(a);
                cTips.elementEnter(event, a);
             }
         }).get();

      });

      a.addEvent('mouseover', function(event) {
         event.stop();
         cTips.detach(a);
      });
   });
});

function closeForm () {
   $$('div.inform').setStyle('display', 'none');

}

function sendEmail () {


   var prodID = document.forms["nform"]["productid"].value;
   var email = document.forms["nform"]["email"].value;

   //if (!email.match(/^[\w\-]+@[\w\-]+\.\w{2,}$/)) {
   //   document.forms["nform"]["email"].className = 'email';
   //   return;
   //}
   var req = new Request({
      url: '/addsendlist.phtml?email='+email+'&productid='+prodID,
      method: 'get',
      onRequest: function() {

      },
      onSuccess: function(responseText) {
         $('prod'+prodID).set('html', 'by request');
         closeForm();

      }
   }).send();
}

