Confirm={}
Confirm.ConfirmBox=function(txt)
{
   this.div=document.createElement("div");
   this.div.className="AlertBox";
   var title=document.createElement("h3");
   title.appendChild(document.createTextNode(txt));
   var ok=document.createElement("div")
   ok.className="OKButton HoverHidden";
   ok.appendChild(document.createTextNode("כן"));
   var cancel=document.createElement("div")
   cancel.className="CancelButton HoverHidden";
   cancel.appendChild(document.createTextNode("לא"));
   this.div.appendChild(title);
   this.div.appendChild(ok);
   this.div.appendChild(cancel);
   this.ok=ok;
   this.cancel=cancel;
   return this;
}
Confirm.attach=function(anchor)
{
   anchor.url=anchor.href;
   anchor.href="javascript: {}";
   anchor.onmouseup=function()
   {
     var confirmBox=Confirm.ConfirmBox(anchor.title);
     confirmBox.ok.href=this.url;
     confirmBox.ok.onclick=function()
     {
       window.location=this.href;
     }     
     confirmBox.cancel.root=confirmBox.div
     confirmBox.cancel.onclick=function()
     {
       document.body.removeChild(this.root);
     }
     document.body.appendChild(confirmBox.div);
     return false;
   }
}
Confirm.init=function()
{
  var reg=new RegExp("confirm");
  for(var i=0;i<document.links.length;++i)
  {   
    lnk=document.links.item(i);
    if (reg.test(lnk.className))
      Confirm.attach(lnk);
  }
}                       

Confirm.init();
