var Case={}; Case.Init=function () { this.CaseElement=$("case"); this.Element=$("mycaseElement"); this.CountElement=$("caseCount"); this.Opener=$("contentMenu"); if (this.CaseElement) { this.Position=Position.cumulativeOffset(this.CaseElement); this.CaseElement.makeLink(); } }; Case.Add = function(element, publicationId, theTargetId, operator, p, classAnimation) { var theTarget = document.getElementById(theTargetId); if (theTarget == null) return; var TheCan = element.parentNode; var Targetcurleft = 0; var Targetcurtop = 0; var curleft = 0; var curtop = 0; var newdiv = document.createElement("div"); var newtext = document.createTextNode(" "); newdiv.appendChild(newtext) //append text to new div newdiv.setAttribute('class', classAnimation) // 'canClone'); document.body.appendChild(newdiv); newdiv.className = classAnimation; //'canClone'; if (TheCan.offsetParent) { curleft = TheCan.offsetLeft; curtop = TheCan.offsetTop; } while (TheCan = TheCan.offsetParent) { curleft += TheCan.offsetLeft; curtop += TheCan.offsetTop; } if (theTarget.offsetParent) { Targetcurleft = theTarget.offsetLeft; Targetcurtop = theTarget.offsetTop; } while (theTarget = theTarget.offsetParent) { Targetcurleft += theTarget.offsetLeft; Targetcurtop += theTarget.offsetTop; } newdiv.style.left = curleft + 6 + "px"; newdiv.style.top = curtop + "px"; endPosX = Targetcurleft; endPosY = Targetcurtop + 10; new Effect.Parallel([ new Effect.Move(newdiv, { x: endPosX, y: endPosY, mode: 'absolute' }) ], { duration: 1, beforeStart: function() { }, afterFinish: function() { document.body.removeChild(newdiv); new Effect.Pulsate(theTargetId, { duration: 1, from: .4 }); //setInterval(changeTheClass(theTargetId),1000); } }); function changeTheClass(obj) { var theObj = document.getElementById(obj); var intrvl = 0; if (theObj.className.indexOf("Off") != -1) { theObj.className = theObj.className.replace("Off", "On"); } else { theObj.className = theObj.className.replace("On", "Off"); } } //new Effect.Move (newdiv,{ x: endPosX, y: endPosY, mode: 'absolute'}); /* while ((curleft - endPosX)!=0 && (curtop - endPosY)!=0 ) { newdiv.style.visibility = 'hidden' curleft=curleft+1 curtop=curtop+1 newdiv.style.left = curleft; newdiv.style.top = curtop; newdiv.style.visibility = 'visible' setTimeout('',50); }*/ } /* Case.Add=function (element,publicationId,theTargetId,operator) { var link=_("a",null); ////link.addClassName("caseClone"); link.addClassName(element.className + "Clone"); document.body.appendChild(link); Position.clone(element,link); var pos=Position.cumulativeOffset(link); var theTargetObj = $(theTargetId); var theTargetObjPos = Position.cumulativeOffset(theTargetObj); //alert(theTargetObjPos[0]) //alert(Position.cumulativeOffset(theTargetObj)) //alert(theTargetObjPos.substring(0,theTargetObjPos.lastIndexOf(","))) //link.setOpacity('0.6'); link.style.height = "25px"; // new Effect.Move (link,{ x: theTargetObjPos[0], y: theTargetObjPos[1], mode: 'absolute'}); //OLD //new Effect.MoveBy(link, 20, 50, {duration: 0.3, transition: Effect.Transitions.slowstop}); new Effect.Move(link,{ x: theTargetObjPos[0]-pos[0]+40, y: theTargetObjPos[1]-pos[1], afterFinish:function () { link.remove(); element.remove(); Case.updateNum(theTargetId,operator) new Effect.Pulsate(Case.CaseElement,{duration:1,from:.4}); } }); return false; }; Case.updateNum = function(theTargetId,operator){ var theTargetObj = $(theTargetId); var theContent,tempContent; var bracketsFlag = false; tempContent = theTargetObj.innerHTML //removes () if(tempContent.indexOf("(")>-1 && tempContent.indexOf(")")>-1){ bracketsFlag = true; theContent = tempContent.substring(tempContent.indexOf("(")+1,tempContent.indexOf(")")) } else{ theContent = tempContent; } if(operator == "-"){ theContent = parseInt(theContent) - 1; }else{ theContent = parseInt(theContent) + 1; } if(bracketsFlag){ theTargetObj.innerHTML = "(" + theContent + ")"; }else{ theTargetObj.innerHTML = theContent; } } */