1//Copyright LMSOFT 1999 - 2024 2 3var pub_home = "./indexanc.html"; 4if (!String.prototype.startsWith) { 5 String.prototype.startsWith = function(searchString, position) { 6 position = position || 0; 7 return this.indexOf(searchString, position) === position; 8 }; 9} 10 11var z_index=0; 12var currentIdIn=-1; 13var gMaxVisibleItems=0; 14 15function AddAnchorTagToObject(id) 16{ 17 var tagdiv=document.getElementById(id); 18 if(tagdiv.parentNode.tagName=="A") { 19 if(tagdiv.parentNode.name != "ANCHOR_"+id) { 20 tagdiv.parentNode.name="ANCHOR_"+id; 21 } 22 } 23 else { 24 var newElement= $("<A name=\"ANCHOR_"+id+"\"/>"); 25 26 var parent= tagdiv.parentNode; 27 for (i= 0; i < parent.children.length; i++) { 28 if (parent.children[i].id == id) { 29 parent.insertBefore(newElement[0],parent.children[i]); 30 break; 31 } 32 } 33 } 34} 35 36function LMObject(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,BranchLst,tooltip,param,addlink) 37{ 38 addlink= false; 39 if(addlink==true) { 40 AddAnchorTagToObject(id); 41 } 42 43 var tagdiv=document.getElementById(id); 44 tagdiv.drawok=0; 45 tagdiv.drawingeffect=0; 46 if(tooltip) tagdiv.title=tooltip; 47 48 z_index++; 49 this.id = id; 50 this.object=null; 51 this.LTO=new Array; 52 this.InitObject=null; 53 this.ResizeObject=null; 54 this.OnAfterPageDisplay=null; 55 this.ShowObject=null; 56 this.HideObject=null; 57 this.Play=null; 58 this.Stop=null; 59 this.RollIn=null; 60 this.RollOut=null; 61 this.IsMovable=true; 62 this.visible=initvisible; 63 this.displayenable=displayenable; 64 this.initvisible=initvisible; 65 try 66 { 67 if($("#"+id).css("left") != undefined) 68 this.x = $("#"+id).css("left").replace("px", ""); 69 if($("#"+id).css("top") != undefined) 70 this.y = $("#"+id).css("top").replace("px", ""); 71 if($("#"+id).css("width") != undefined) 72 this.w = $("#"+id).css("width").replace("px", ""); 73 if($("#"+id).css("height") != undefined) 74 this.h = $("#"+id).css("height").replace("px", ""); 75 76 if(id.startsWith("Page")) 77 { 78 if(this.x == "auto" || this.x == undefined) 79 this.x = tagdiv.offsetLeft; 80 if(this.y == "auto" || this.y == undefined) 81 this.y = tagdiv.offsetTop; 82 if(this.w == "auto" || this.w == undefined) 83 this.w = tagdiv.offsetWidth; 84 if(this.h == "auto" || this.h == undefined) 85 this.h = tagdiv.offsetHeight; 86 } 87 88 this.orix = this.x; 89 this.oriy = this.y; 90 this.oriw = this.w; 91 this.orih = this.h; 92 this.initvisible=initvisible; 93 }catch(e){ 94 console.log("Exception in LMObject ", e); 95 } 96 97 this.param = param; 98 this.BranchLst = BranchLst; 99 100 if (delais == null) { 101 this.delais = 0; 102 } else { 103 this.delais = delais; 104 } 105 106 if (delaisdisp == null) { 107 this.delaisdisp = 0; 108 } else { 109 this.delaisdisp = delaisdisp; 110 } 111 112 if (effect == null) { 113 this.Effect = LMEffectShow; 114 } else { 115 this.Effect = effect; 116 } 117 118 if (effectdisp == null) { 119 this.EffectDisp = LMEffectHide; 120 } else { 121 this.EffectDisp = effectdisp; 122 } 123 this.EffectDisp = LMEffectHide; 124 this.EffectFinishEvent=null; 125 126 this.TagObject=tagdiv; 127 tagdiv.LMObjectsIdx=FindIdxInLMObjects(id); 128 129 tagdiv.GetTop=TagGetTop; 130 tagdiv.SetTop=TagSetTop; 131 tagdiv.GetLeft=TagGetLeft; 132 tagdiv.SetLeft=TagSetLeft; 133 tagdiv.GetWidth=TagGetWidth; 134 tagdiv.SetWidth=TagSetWidth; 135 tagdiv.GetHeight=TagGetHeight; 136 tagdiv.SetHeight=TagSetHeight; 137 tagdiv.SetClip=TagSetClip; 138 139 //Methods 140 tagdiv.SetX=LMObjectMethodSetX; 141 tagdiv.GetX=LMObjectMethodGetX; 142 tagdiv.SetY=LMObjectMethodSetY; 143 tagdiv.GetY=LMObjectMethodGetY; 144 tagdiv.SetW=LMObjectMethodSetW; 145 tagdiv.GetW=LMObjectMethodGetH; 146 tagdiv.SetH=LMObjectMethodSetH; 147 tagdiv.GetH=LMObjectMethodGetH; 148 tagdiv.SetXYWH=LMObjectMethodSetXYWH; 149 tagdiv.IsVisible=TagIsVisible; 150 tagdiv.Show=TagShow; 151 tagdiv.Hide=TagHide; 152 tagdiv.ShowEffect=TagShowEffect; 153 tagdiv.HideEffect=TagHideEffect; 154 tagdiv.ToggleVisibleState=TagToggleVisibleState;
155 tagdiv.IsDrawingEffect=TagIsDrawingEffect; 156 tagdiv.RollIn=TagRollIn; 157 tagdiv.RollOut=TagRollOut; 158 tagdiv.FullScreenMode=TagFullScreenMode; 159 tagdiv.Maximize=TagMaximize; 160 tagdiv.Minimize=TagMinimize; 161 tagdiv.ToggleMaximizeMinimize=TagToggleMaximizeMinimize; 162 tagdiv.IsMaximized=TagIsMaximized; 163 tagdiv.IsFullScreen=TagIsFullScreen; 164 if(initvisible==false) tagdiv.Hide(); 165 166 return this; 167} 168 169 170function FireEvent(id,event) 171{ 172 var strvar="window."+id+event; 173 var strcnd="if("+strvar+") "+ strvar + "()"; 174 eval(strcnd); 175} 176 177function LMObjectClick(id,idxbr) 178{ 179 var LMObject=FindClassObjectFromId(id); 180 if (LMObject && LMObject.BranchLst && LMObject.BranchLst[idxbr]) { 181 var DoBranch = true; 182 if(LMObject.BranchLst[idxbr].code) { 183 DoBranch = LMObject.BranchLst[idxbr].code(LMObject.BranchLst[idxbr],id,LMObject,LMObject); 184 } 185 if(DoBranch) LMObjectBranch(LMObject.BranchLst[idxbr]); 186 } 187} 188 189function LMObjectBranch(branch) 190{ 191 if(branch == null) return; 192 if(branch.where == null) return; 193 if(branch.where == "") return; 194 195 switch (branch.where) { 196 case "GADGET: 1": // home 197 location = pub_home; 198 break; 199 case "GADGET: 2": // back 200 history.back(); 201 break; 202 case "GADGET: 3": // quit without confirm 203 parent.window.close(); 204 break; 205 case "GADGET: 4": // signet 206 break; 207 case "GADGET: 5": // quit with confirm 208 var ok = confirm(MSG_QUIT); //quit with confirm 209 if (ok) parent.window.close(); 210 break; 211 case "GADGET: 6": // next 212 history.forward(); 213 break; 214 case "GADGET: 7": // print 215 window.print(); 216 break; 217 case "GADGET: 8": // event next 218 break; 219 case "GADGET: 9": // event previous 220 break; 221 case "GADGET: 10": // Add to favorites 222 if(is.ie) window.external.AddFavorite(location.href, document.title); 223 else if (is.ns) alert(RES_ADDFAVORITES); 224 break; 225 case "GADGET: 11": // Send to a friend 226 window.location="mailto:?subject="+document.title+"&body="+location.href; 227 break; 228 default: 229 if(branch.where.substring(0,1).toLowerCase()=="#") { 230 ScrollToAnchor(branch.where.substring(1)); 231 } 232 else if(branch.openinnewwindow) { 233 var param=""; 234 param+="status="+branch.status+","; 235 param+="menubar="+branch.menubar+","; 236 param+="toolbar="+branch.toolbar+","; 237 param+="location="+branch.toolbar+","; 238 param+="scrollbars="+branch.scrollbar+","; 239 param+="resizable="+branch.resizeenable+","; 240 if(branch.setdefaultwh) { 241 param+="width="+branch.width+","; 242 param+="height="+branch.height+","; 243 } 244 window.open(branch.where,branch.windowname,param); 245 } 246 else { 247 if(branch.where.substring(0,5).toLowerCase()=="http:") { 248 window.location = branch.where; 249 } 250 else if(branch.where.substring(0,6).toLowerCase()=="https:") { 251 window.location = branch.where; 252 } 253 else if(branch.where.substring(0,4).toLowerCase()=="ftp:") { 254 window.location = branch.where; 255 } 256 else window.location = branch.where; 257 } 258 break; 259 } 260} 261 262function ScrollToAnchor(id) { 263 var catTopPosition = jQuery('#'+id).offset().top; 264 jQuery('html, body').animate({scrollTop:catTopPosition}, 'slow'); 265} 266 267function LMGlobalUp(e) 268{ 269 if(e==null) var e=window.event; 270 e.cancelBubble = true; 271 272 if(currentIdIn==-1) return; 273 274 var obj=FindClassObjectFromId(currentIdIn); 275 if(!obj) return; 276 277 var id=currentIdIn; 278 FireEvent(id,"_OnMouseUp"); 279 FireEvent(id,"_OnClick"); 280 281 if(obj.MouseUp) obj.MouseUp(); 282} 283 284function LMGlobalDn(e) 285{ 286 if(e==null) var e=window.event; 287 e.cancelBubble = true; 288 289 if(currentIdIn==-1) return; 290 291 var obj=FindClassObjectFromId(currentIdIn); 292 if(!obj) return; 293 294 FireEvent(currentIdIn,"_OnMouseDown"); 295 296 if(obj.MouseDn) obj.MouseDn(); 297} 298 299var infct=false; 300function LMGlobalOver(id) 301{ 302 if(infct) return; 303 infct=true; 304 305 if(currentIdIn==id) { 306 infct=false; 307 return; } 308 LMGlobalOut(); 309 if(id<=-1) { 310 infct=false; 311 return; } 312 313 currentIdIn=id; 314 315 var obj=FindClassObjectFromId(currentIdIn); 316 if(!obj) { 317 infct=false; 318 return; } 319 320 if(currentIdIn!=-1) { 321 FireEvent(currentIdIn,"_OnMouseEnter"); 322 } 323 324 if(obj.MouseOver) obj.MouseOver(); 325 326 infct=false; 327} 328 329function LMGlobalOut() 330{ 331 if(currentIdIn<=-1) return; 332 var id=currentIdIn; 333 334 var obj=FindClassObjectFromId(id); 335 if(!obj) return; 336 337 if(currentIdIn!=-1) { 338 FireEvent(currentIdIn,"_OnMouseLeave"); 339 } 340 currentIdIn=-1; 341 342 if(obj.MouseOut) obj.MouseOut(); 343} 344 345function LMObjectMethodSetX(x) 346{ 347 obj=FindClassObjectFromTagDiv(this); 348 if(!obj) return; 349 this.SetXYWH(x,obj.oriy,obj.oriw,obj.orih); 350} 351 352function LMObjectMethodGetX() 353{ 354 obj=FindClassObjectFromTagDiv(this); 355 if(!obj) return 0; 356 return obj.orix; 357} 358 359function LMObjectMethodSetY(y) 360{ 361 obj=FindClassObjectFromTagDiv(this); 362 if(!obj) return; 363 this.SetXYWH(obj.orix,y,obj.oriw,obj.orih); 364} 365 366function LMObjectMethodGetY() 367{ 368 obj=FindClassObjectFromTagDiv(this); 369 if(!obj) return 0; 370 return obj.oriy; 371} 372 373function LMObjectMethodSetW(w) 374{ 375 obj=FindClassObjectFromTagDiv(this); 376 if(!obj) return; 377 this.SetXYWH(obj.orix,obj.oriy,w,obj.orih); 378} 379 380function LMObjectMethodGetW() 381{ 382 obj=FindClassObjectFromTagDiv(this); 383 if(!obj) return 0; 384 return obj.oriw; 385} 386 387function LMObjectMethodSetH(h) 388{ 389 obj=FindClassObjectFromTagDiv(this); 390 if(!obj) return; 391 this.SetXYWH(obj.orix,obj.oriy,obj.oriw,h);
392} 393 394function LMObjectMethodGetH() 395{ 396 obj=FindClassObjectFromTagDiv(this); 397 if(!obj) return 0; 398 return obj.orih; 399} 400 401function LMObjectMethodSetXYWH(x,y,w,h) 402{ 403 var LMObject=FindClassObjectFromId(this.id); 404 LMObject.orix=x; 405 LMObject.oriy=y; 406 LMObject.oriw=w; 407 LMObject.orih=h; 408 409 wori=this.GetWidth(); 410 hori=this.GetHeight(); 411 412 newx=(x*GPropW)+GOffetX; 413 LMObject.x=newx; 414 LMObject.TagObject.SetLeft(newx); 415 416 newy=(y*GPropH)+GOffetY; 417 LMObject.y=newy; 418 LMObject.TagObject.SetTop(newy); 419 420 neww=w*GPropW; 421 newh=h*GPropH; 422 423 this.SetWidth(neww); 424 this.SetHeight(newh); 425 if(LMObject.ResizeObject) LMObject.ResizeObject(neww/wori,newh/hori); 426 this.SetClip(0,this.GetWidth(),this.GetHeight(),0) 427} 428 429init=false; 430function AdjustHeight() 431{ 432 return; 433 if(init==false) { 434 for(var i=0; i<LMObjects.length; i++) { 435 LMObjects[i].orih=1.1*LMObjects[i].orih; 436 LMObjects[i].TagObject.SetHeight(LMObjects[i].orih); 437 LMObjects[i].TagObject.SetClip(0,LMObjects[i].TagObject.GetWidth(),LMObjects[i].orih,0); 438 } 439 init=true; 440 } 441} 442 443function LMObjectDelaiHide(LMObjects,idx) 444{ 445 if(LMObjects[idx].TagObject.drawingeffect==1) { 446 setTimeout("LMObjectDelaiHide(LMObjects," + idx + ")",10); 447 return; 448 } 449 LMGlobalOver(-1); 450 LMObjects[idx].EffectDisp(); 451} 452 453function LMObjectAnimateElem(LMObjects,currentidx) 454{ 455var v=0; 456 457 if(currentidx>=gMaxVisibleItems) return; 458 459 if(LMObjects[currentidx].InitObject) LMObjects[currentidx].InitObject(); 460 461 //Init all object that have the same delai and have no effect 462 for(v=currentidx+1; v<gMaxVisibleItems; v++) { 463 if(LMObjects[currentidx].delais!=LMObjects[v].delais || LMObjects[v].Effect!=LMEffectShow) break; 464 if(LMObjects[v].InitObject) LMObjects[v].InitObject(); 465 } 466 467 if(LMObjects[currentidx].TagObject.drawok==0) { 468 setTimeout("LMObjectAnimateElem(LMObjects," + currentidx + ")",10); 469 return; 470 } 471 472 //Must be at the same value for drawingeffect 473 //If one of then are not equal then we will wait 474 if(LMObjects[currentidx].TagObject.drawingeffect==0) { 475 for(v=currentidx; v<gMaxVisibleItems; v++) { 476 if(LMObjects[currentidx].delais!=LMObjects[v].delais || LMObjects[v].TagObject.drawok==0 || LMObjects[v].Effect!=LMEffectShow) break; 477 } 478 } 479 else { 480 for(v=currentidx; v<gMaxVisibleItems; v++) { 481 if(LMObjects[currentidx].delais!=LMObjects[v].delais) break; 482 if(LMObjects[v].Effect!=LMEffectShow) break; 483 if(LMObjects[v].TagObject.drawingeffect==0) break; 484 if(LMObjects[currentidx].TagObject.drawingeffect!=LMObjects[v].TagObject.drawingeffect) { 485 setTimeout("LMObjectAnimateElem(LMObjects," + currentidx + ")",10); 486 return; 487 } 488 } 489 } 490 if(v==currentidx) v++; 491 var valend=v; 492 493 drawingeffect=LMObjects[currentidx].TagObject.drawingeffect; 494 495 if(v+1<gMaxVisibleItems) { 496 if(LMObjects[v+1].InitObject) LMObjects[v+1].InitObject(LMObjects[v+1]); 497 } 498 499 if(drawingeffect==0) { //Show all the objects ready of the same delai 500 for(var v=currentidx; v<valend; v++) { 501 LMObjects[v].Effect(); 502 } 503 setTimeout("LMObjectAnimateElem(LMObjects," + currentidx + ")",10); 504 } 505 else if(drawingeffect==1) { //Wait all objects ready of the same delai to finish drawing 506 setTimeout("LMObjectAnimateElem(LMObjects," + currentidx + ")",10); 507 return; 508 } 509 else if(drawingeffect==2) { 510 var delai=LMObjects[currentidx].delaisdisp-LMObjects[currentidx].delais; 511 if(delai>0 || (LMObjects[currentidx].delais>0 && delai==0)) { 512 setTimeout("LMObjectDelaiHide(LMObjects," + currentidx + ")",delai); 513 } 514 515 currentidx=valend; 516 517 if(currentidx<gMaxVisibleItems) { 518 var offset=0; 519 if(currentidx>0) offset=LMObjects[currentidx-1].delais; 520 setTimeout("LMObjectAnimateElem(LMObjects," + currentidx + ")",(LMObjects[currentidx].delais-offset)); 521 } 522 else { 523 for(var i=0; i<LMObjects.length; i++) { 524 if(LMObjects[i].OnAfterPageDisplay) LMObjects[i].OnAfterPageDisplay(); 525 } 526 AdjustHeight(); 527 } 528 } 529 else { 530 //alert("bug LMObjectAnimateElem"); 531 //alert(LMObjects[i].TagObject.drawingeffect); 532 } 533} 534 535function LMObjectAnimate() 536{ 537 if(LMObjects.length<=0) return; 538 539 //LMGlobalPosPage(); 540 541 //Split 542 var i=0; 543 var countvisible=0; 544 var countnotvisible=0; 545 var LMObjectsVisible = new Array(); 546 var LMObjectsNotVisible = new Array(); 547 548 for(i=0; i<LMObjects.length; i++) { 549 if(LMObjects[i].initvisible==true) { 550 LMObjectsVisible[countvisible]=LMObjects[i]; 551 LMObjectsVisible[countvisible].TagObject.LMObjectsIdx=countvisible; 552 countvisible++; 553 } 554 else { 555 LMObjectsNotVisible[countnotvisible]=LMObjects[i]; 556 LMObjectsNotVisible[countnotvisible].TagObject.LMObjectsIdx=countvisible; 557 countnotvisible++; 558 } 559 } 560 gMaxVisibleItems=countvisible; 561 LMObjects=LMObjectsVisible; 562 563 LMObjectSort(LMObjects,0,LMObjects.length-1); 564 565 //Concatain 566 var i,j; 567 var start=LMObjects.length; 568 for(i=0,j=LMObjects.length; i<countnotvisible; i++,j++) { 569 LMObjects[j]=LMObjectsNotVisible[i]; 570 LMObjects[j].TagObject.LMObjectsIdx=j; 571 } 572 573 //Initialise new object 574 for(i=start; i<LMObjects.length; i++) { 575 if(LMObjects[i].InitObject) LMObjects[i].InitObject(); 576 LMObjects[i].TagObject.drawingeffect=2; 577 LMObjects[i].delais=0; 578 } 579 580 setTimeout("LMObjectAnimateElem(LMObjects,0)",LMObjects[0].delais); 581} 582 583function LMObjectSort(LMObjects,first,last) 584{ 585var a,b,left,right; 586var left_ref,right_ref,x; 587 588 if (first==last) return; 589 590 middle = parseInt((first+last)/2); 591 if(isNaN(middle)) middle=0; 592 593 do { 594 left_ref=LMObjects[first].delais; 595 left=first; 596 for(var a=first; a<=middle; a++) { 597 x=LMObjects[a].delais; 598 if (x > left_ref) { 599 left=a; 600 left_ref=x; 601 } 602 } 603 604 right_ref=LMObjects[middle+1].delais; 605 right=middle+1; 606 for(var b=middle+1; b<=last; b++) { 607 x=LMObjects[b].delais; 608 if(x < right_ref) { 609 right_ref=x; 610 right=b; 611 } 612 } 613 614 if(left_ref > right_ref) { 615 object=LMObjects[left];
616 LMObjects[left]=LMObjects[right]; 617 LMObjects[right]=object; 618 LMObjects[left].TagObject.LMObjectsIdx=left; 619 LMObjects[right].TagObject.LMObjectsIdx=right; 620 } 621 622 }while(left_ref > right_ref); 623 624 LMObjectSort(LMObjects,first,middle); 625 LMObjectSort(LMObjects,middle+1,last); 626} 627 628function LMBranch(id,where) 629{ 630 this.id = eval(id); 631 this.where = where; 632 633 this.sound = null; 634 this.code = null; 635 this.param = null; 636 this.delais = 0,0; 637 638 this.openinnewwindow = 0; 639 this.status = 0; 640 this.menubar = 0; 641 this.toolbar = 0; 642 this.scrollbar = 0; 643 this.resizeenable = 0; 644 this.setdefaultwh = 0; 645 this.width = 0; 646 this.height = 0; 647 this.windowname = ""; 648} 649 650function LMBranchEx(id,where,sound,delais,code,param,openinnewwindow,status,menubar, 651 toolbar,scrollbar,resizeenable,setdefaultwh,width,height,windowname) 652{ 653 this.id = eval(id); 654 this.where = where; 655 this.sound = sound; 656 this.code = code; 657 this.param = param; 658 this.delais = delais; 659 660 this.openinnewwindow = openinnewwindow; 661 this.status = status; 662 this.menubar = menubar; 663 this.toolbar = toolbar; 664 this.scrollbar = scrollbar; 665 this.resizeenable = resizeenable; 666 this.setdefaultwh = setdefaultwh; 667 this.width = width; 668 this.height = height; 669 this.windowname = windowname; 670} 671 672function GadgetShowLink(branch) 673{ 674 if(branch == null) return; 675 if(branch.where == null) return; 676 if(branch.where == "") return; 677 678 switch (branch.where) { 679 case "GADGET: 1": // home 680 window.status=RES_GADGETHOME; 681 break; 682 case "GADGET: 2": // back 683 window.status=RES_GADGETBACK; 684 break; 685 case "GADGET: 3": // quit without confirm 686 window.status=RES_GADGETQUIT; 687 break; 688 case "GADGET: 4": // signet 689 break; 690 case "GADGET: 5": // quit with confirm 691 window.status=RES_GADGETQUIT; 692 break; 693 case "GADGET: 6": // next 694 window.status=RES_GADGETFOWARD; 695 break; 696 case "GADGET: 7": // print 697 window.status=RES_GADGETPRINT; 698 break; 699 case "GADGET: 8": // event next 700 break; 701 case "GADGET: 9": // event previous 702 break; 703 case "GADGET: 10": // Add to favorites 704 window.status=RES_GADGETADDFAVORITE; 705 break; 706 case "GADGET: 11": // Send to a friend 707 window.status=RES_GADGETSENDTOFRIEND; 708 break; 709 } 710}function LMButton(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,branchdn,branchup,tooltip,param,is2state,initpress,
710cursor) 711{ 712 var tmp = " "; 713 var BranchLst = null; 714 715 if(branchup || branchdn) { 716 BranchLst = new Array(); 717 BranchLst[0] = branchdn; 718 BranchLst[1] = branchup; 719 } 720 721 var LMButton = new LMObject(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,BranchLst,tooltip,param,true); 722 723 var tagdiv=document.getElementById(id); 724 725 if(tooltip) tagdiv.text=tooltip; 726 727 tagdiv.SetWidth=TagSetWidth; 728 tagdiv.SetHeight=TagSetHeight; 729 tagdiv.onmouseover=TagLMButtonMouseOver; 730 tagdiv.onmouseout=TagLMButtonMouseOut; 731 tagdiv.onmouseup=LMGlobalUp; 732 tagdiv.onmousedown=LMGlobalDn; 733 734 LMButton.MouseUp=LMButtonMouseUp; 735 LMButton.MouseDn=LMButtonMouseDn; 736 LMButton.MouseOver=LMButtonMouseOver; 737 LMButton.MouseOut=LMButtonMouseOut; 738 LMButton.InitObject=LMButtonInit; 739 LMButton.ButtonOver = false; 740 LMButton.init=false; 741 742 LMButton.cursor=cursor; 743 if(is2state==0) initpress=0; 744 LMButton.is2state=is2state; 745 LMButton.pressstate=initpress; 746 747 LMButton.TagDiv=tagdiv; 748 749 LMButton.TagObject.IsPress=TagLMButtonIsPress; 750 LMButton.TagObject.Press=TagLMButtonSetPressState; 751 752 return LMButton; 753} 754 755function LMButtonInit() 756{ 757 if(this.init==true) return; 758 this.init=true; 759 760 tagdiv=document.getElementById(this.id); 761 if(this.is2state && this.pressstate) { 762 SetStateUp(this.id); 763 tagdiv.className="Down"; 764 tagdiv.drawok=1; 765 } 766 else { 767 SetStateUp(this.id); 768 tagdiv.className="Up"; 769 tagdiv.drawok=1; 770 } 771} 772 773function SetState(id,state,text) 774{ 775 var tagdiv=document.getElementById(id); 776 if(!tagdiv) return; 777 tagdiv.className=state; 778 779 if(text==null) return; 780 781 var object=FindClassObjectFromId(id); 782 if(!object) return; 783 784 var tagp=$("#" + id + " p"); 785 if(tagp.html()==null) return; 786 tagp.html(text); 787} 788 789function SetStateUp(id) 790{ 791 var object=FindClassObjectFromId(id); 792 if(!object) return; 793 794 var tagtxt=$("#l" + id + "Up"); 795 SetState(id,"Up",tagtxt.html()); 796} 797 798function SetStateDown(id) 799{ 800 var object=FindClassObjectFromId(id); 801 if(!object) return; 802 803 var tagtxt=$("#l" + id + "Down"); 804 if(tagtxt.html()==null) { 805 tagtxt=$("#l" + id + "Over"); 806 if(tagtxt.html()==null) { 807 tagtxt=$("#l" + id + "Up"); 808 } 809 } 810 SetState(id,"Down",tagtxt.html()); 811} 812 813function SetStateOver(id) 814{ 815 var object=FindClassObjectFromId(id); 816 if(!object) return; 817 818 var tagtxt=$("#l" + id + "Over"); 819 if(tagtxt.html()==null) { 820 tagtxt=$("#l" + id + "Up"); 821 } 822 SetState(id,"Over",tagtxt.html()); 823} 824 825function TagLMButtonMouseOver(e) 826{ 827 if(e==null) var e=window.event; 828 e.cancelBubble = true; 829 830 LMGlobalOver(this.id); 831} 832 833function TagLMButtonMouseOut(e) 834{ 835 if(e==null) var e=window.event; 836 e.cancelBubble = true; 837 838 LMGlobalOver(-1); 839} 840 841function LMButtonMouseUp() 842{ 843 if(this.is2state) { 844 if(this.pressstate) { 845 FireEvent(this.id,"_WhenButtonDown"); 846 LMObjectClick(this.id,0); 847 } 848 else { 849 FireEvent(this.id,"_WhenButtonUp"); 850 LMObjectClick(this.id,1); 851 } 852 } 853 else { 854 if (!this.ButtonOver) { 855 SetStateUp(this.id); 856 } 857 else { 858 SetStateOver(this.id); 859 } 860 861 FireEvent(this.id,"_WhenButtonUp"); 862 863 LMObjectClick(this.id,0); 864 } 865} 866 867function LMButtonMouseDn() 868{ 869 if(this.is2state) { 870 if(this.pressstate) { 871 SetStateUp(this.id); 872 } 873 else { 874 SetStateDown(this.id); 875 } 876 if(this.pressstate) this.pressstate=0; 877 else this.pressstate=1; 878 } 879 else { 880 SetStateDown(this.id); 881 FireEvent(this.id,"_WhenButtonDown"); 882 } 883} 884 885function LMButtonMouseOver() 886{ 887 this.ButtonOver = true; 888 889 SetStateOver(this.id); 890 891 if(this.cursor) this.TagDiv.style.cursor = "pointer"; 892 if(this.BranchLst) GadgetShowLink(this.BranchLst[this.pressstate]); 893} 894 895function LMButtonMouseOut() 896{ 897 this.ButtonOver = false; 898 899 if(this.is2state) { 900 if(this.pressstate) { 901 SetStateDown(this.id); 902 } 903 else { 904 SetStateUp(this.id); 905 } 906 } 907 else { 908 SetStateUp(this.id); 909 } 910 911 if(this.BranchLst) window.status=""; 912} 913 914function TagLMButtonIsPress() 915{ 916 var object=FindClassObjectFromId(this.id); 917 if(!object) return false; 918 return object.pressstate; 919} 920 921function TagLMButtonSetPressState(state) 922{ 923 var object=FindClassObjectFromId(this.id); 924 if(!object) return; 925 926 if(object.is2state==false) return; 927 928 object.pressstate=state; 929 if(object.pressstate) { 930 SetStateDown(this.id); 931 FireEvent(this.id,"_WhenButtonDown"); 932 } 933 else { 934 SetStateUp(this.id); 935 FireEvent(this.id,"_WhenButtonUp"); 936 } 937} 938 939function getCookie(name) { 940 var key = name + "="; 941 var cookies = document.cookie; 942 var keyPosition = cookies.indexOf(key); 943 944 if (keyPosition == -1) return null; 945 946 var valuePosition = keyPosition + key.length;
947 var valuePositionEnd = cookies.indexOf(";", valuePosition); 948 949 if (valuePositionEnd == -1) valuePositionEnd = cookies.length; 950 951 return unescape(cookies.substring(valuePosition, valuePositionEnd)); 952} 953 954function setCookie(name, value, path, timeseesion) { 955 var cookie = name + "=" + value; 956 var exp = new Date(); 957 958 //patch pour netscape 4.x. 959 if (is.ns && is.major < 5 && exp.getYear() < 1900) exp.setYear(exp.getYear() + 1900); 960 961 //le cookie expire dans timeseesion. 962 exp.setTime(exp.getTime() + timeseesion); 963 cookie = cookie + "; expires=" + exp.toGMTString(); 964 965 if (path != null) cookie = cookie + "; path=" + path; 966 967 //assignation du cookie 968 document.cookie = cookie; 969} 970 971// jQuery is not loaded for password pages 972if (window.jQuery18) { 973 CookieAcceptation = { 974 acceptAll: () => { 975 CookieAcceptation.set(["ALL"]); 976 window.location = window.location; 977 }, 978 denyAll: (forceRefresh) => { 979 CookieAcceptation.set(["NONE"]); 980 if(forceRefresh) { 981 window.location = window.location; 982 }else { 983 CookieAcceptation.showCookieIcon(); 984 } 985 }, 986 set: (list, expire) => { 987 if (!expire || !expire instanceof Date) { 988 expire = new Date() 989 halfYearInDays = 182; 990 expire = new Date(new Date(expire).setDate(expire.getDate() + halfYearInDays)) 991 } 992 993 localStorage.setItem("CookieAcceptation", "Cookies=" + list.join(",") + ";Expire=" + expire); 994 }, 995 isAccepted(cookieName) { 996 CookieAcceptation.showCookieIcon(); 997 try { 998 const accept = localStorage.getItem("CookieAcceptation") ?? ""; 999 const parts = accept.split(";"); 1000 const values = {}; 1001 1002 for (let i in parts) { 1003 itemParts = parts[i].split("="); 1004 values[itemParts[0]] = itemParts[1]; 1005 } 1006 1007 if (values.Expire && Date.now() < Date.parse(values.Expire) && values.Cookies) { 1008 const accepted = values.Cookies.split(","); 1009 1010 for (const i in accepted) { 1011 if (accepted[i] == "ALL" || accepted[i] == cookieName) { 1012 return true; 1013 } 1014 1015 if (accepted[i] == "NONE") { 1016 return false; 1017 } 1018 } 1019 } 1020 1021 CookieAcceptation.showCookieBanner(); 1022 1023 return false; 1024 } 1025 catch { 1026 return false; 1027 } 1028 } 1029 }; 1030 1031 (function ($) { 1032 let showingBanner = false; 1033 let cookieOptions = {}; 1034 1035 CookieAcceptation.SetRelPath = (relPath) => { 1036 cookieOptions.relPath = relPath; 1037 }; 1038 CookieAcceptation.showConsentForm = (forceRefresh) => { 1039 setTimeout(() => { 1040 if (confirm(RES_ACCEPT_COOKIES)) { 1041 showingBanner = false; 1042 CookieAcceptation.acceptAll(forceRefresh); 1043 } else { 1044 showingBanner = false; 1045 CookieAcceptation.denyAll(forceRefresh); 1046 } 1047 }, 0); 1048 }; 1049 CookieAcceptation.setCookieOptions = (options) => { 1050 cookieOptions = { 1051 ...cookieOptions, 1052 ...options, 1053 bannerPage: { 1054 html: options.bannerPage.html.replaceAll('./', cookieOptions.relPath), 1055 js: options.bannerPage.js.replaceAll('./', cookieOptions.relPath), 1056 css: options.bannerPage.css.replaceAll('./', cookieOptions.relPath) 1057 } 1058 } 1059 }; 1060 CookieAcceptation.showCookieIcon = () => { 1061 if (showingBanner) return; 1062 1063 $("#LmCookiesIcon").remove(); 1064 let position; 1065 1066 if (cookieOptions.icon?.position == "BottomLeft") { 1067 position = "bottom: 10px; left: 10px;" 1068 } else if (cookieOptions.icon?.position == "BottomRight") { 1069 position = "bottom: 10px; right: 10px;" 1070 } 1071 1072 if (position) { 1073 const backColor = cookieOptions.backColor ? " background-color: white;" : ""; 1074 const iconDiv = $("<div id='LmCookiesIcon' style='display: flex; padding: 4px; border-radius: 50%; justify-content:center; position: fixed; " + position + "; z-index:10000;" + backColor + "'></div>") 1075 iconDiv.click(() => CookieAcceptation.showCookieBanner(true)); 1076 const url = (cookieOptions.isMobile ? "./jqueryMobile" : "./jquery").replaceAll('./', cookieOptions.relPath) + "/images/cookie.png"; 1077 const icon = $(`<img src="${url}" width="32" height="32" alt="cookie" title="${cookieOptions.icon.tooltip}" />`); 1078 icon.appendTo(iconDiv); 1079 document.body.appendChild(iconDiv[0]); 1080 } 1081 } 1082 CookieAcceptation.hideCookieIcon = () => { 1083 $("#LmCookiesIcon").remove(); 1084 } 1085 CookieAcceptation.showCookieBanner = (forceRefresh) => { 1086 if (showingBanner) return; 1087 showingBanner = true; 1088 1089 CookieAcceptation.hideCookieIcon(); 1090 1091 if (cookieOptions.bannerPage.html) { 1092 var doc = (new DOMParser).parseFromString(cookieOptions.bannerPage.html, "text/html"); 1093 const backColor = cookieOptions.backColor ? " background-color:" + cookieOptions.backColor + ";" : "";
1094 const footer = $("<div id='LmCookiesBanner' style='display: flex; justify-content:center; position: fixed; bottom: 0; left: 0; right: 0; z-index:10000;" + backColor + "'></div>") 1095 1096 if (cookieOptions.isMobile) { 1097 // We want the content of LmCookiesBanner_Page / LmCookiesBanner_PageContent 1098 const content = $("body > div > div > *", doc); 1099 content.appendTo(footer); 1100 } else { 1101 const content = $("body > *", doc); 1102 content.appendTo(footer); 1103 } 1104 1105 const style = $("<style>" + cookieOptions.bannerPage.css + "</style>"); 1106 style.appendTo(footer); 1107 1108 document.body.appendChild(footer[0]); 1109 // jQuery = 1.7 with jQueryMobile 1110 // $ = 1.8 1111 jQuery("#LmCookiesBanner").trigger("create"); 1112 1113 eval(cookieOptions.bannerPage.js); 1114 $("#LmCookiesBanner_ButAcceptAll").click(() => { 1115 footer.remove(); 1116 showingBanner = false; 1117 CookieAcceptation.acceptAll(forceRefresh); 1118 }); 1119 $("#LmCookiesBanner_ButDenyAll").click(() => { 1120 footer.remove(); 1121 showingBanner = false; 1122 CookieAcceptation.denyAll(forceRefresh); 1123 }); 1124 } else { 1125 CookieAcceptation.showConsentForm(forceRefresh); 1126 } 1127 }; 1128 })(jQuery18); 1129} 1130function DoorOpenHCallBack(isend,TagObject,lefty,righty) 1131{ 1132 TagObject.SetClip(lefty,TagObject.GetWidth(),righty,0); 1133} 1134 1135function DoorOpenH() 1136{ 1137 this.TagObject.Show(); 1138 this.TagObject.drawingeffect=1; 1139 1140 var timeslide=0.; 1141 var y=this.TagObject.GetTop(); 1142 var w=this.TagObject.GetWidth(); 1143 var h=this.TagObject.GetHeight(); 1144 1145 var my=h/2.; 1146 var lefty=my; 1147 var righty=my; 1148 1149 this.TagObject.SetClip(my,w,my,0); 1150 1151 var delta=8; 1152 var dep=0.; 1153 1154 for(var i=0; i<(h-1)/2+1; i+=delta) { 1155 lefty=my-dep; 1156 if(lefty<0) lefty=0; 1157 righty=my+dep; 1158 if(righty>h) righty=h; 1159 1160 dep+=delta; 1161 1162 setTimeout("DoorOpenHCallBack(false, FindTagFromId(\"" + this.id + "\")," + lefty + "," + righty + ")",timeslide); 1163 timeslide+=25.; 1164 } 1165 setTimeout("DoorOpenHCallBack(true, FindTagFromId(\"" + this.id + "\")," + 0 + "," + h + ")",timeslide); 1166 setTimeout("SetDrawingEffect(FindTagFromId(\"" + this.id + "\"),2)",timeslide+1); 1167} 1168 1169 1170function DoorOpenWCallBack(isend,TagObject,leftx,rightx) 1171{ 1172 TagObject.SetClip(0,rightx,TagObject.GetHeight(),leftx); 1173} 1174 1175function DoorOpenW() 1176{ 1177 this.TagObject.Show(); 1178 this.TagObject.drawingeffect=1; 1179 1180 var timeslide=0.; 1181 var x=this.TagObject.GetTop(); 1182 var w=this.TagObject.GetWidth(); 1183 var h=this.TagObject.GetHeight(); 1184 1185 var mx=w/2.; 1186 var leftx=mx; 1187 var rightx=mx; 1188 1189 this.TagObject.SetClip(0,mx,h,mx); 1190 1191 var delta=8; 1192 var dep=0.; 1193 1194 for(var i=0; i<(w-1)/2+1; i+=delta) { 1195 leftx=mx-dep; 1196 if(leftx<0) leftx=0; 1197 rightx=mx+dep; 1198 if(rightx>w) rightx=w; 1199 1200 dep+=delta; 1201 1202 setTimeout("DoorOpenWCallBack(false, FindTagFromId(\"" + this.id + "\")," + leftx + "," + rightx + ")",timeslide); 1203 timeslide+=25.; 1204 } 1205 setTimeout("DoorOpenWCallBack(true, FindTagFromId(\"" + this.id + "\")," + 0 + "," + w + ")",timeslide); 1206 setTimeout("SetDrawingEffect(FindTagFromId(\"" + this.id + "\"),2)",timeslide+1); 1207} 1208 1209 1210function EffectBottomUpCallBack(isend,TagObject,valy,valh) 1211{ 1212 if(isend) { 1213 TagObject.SetTop(valy); 1214 TagObject.SetClip(0,TagObject.GetWidth(),valh,0); 1215 } 1216 else { 1217 TagObject.SetTop(TagObject.GetTop()-5); 1218 if(TagObject.GetTop()<valy) TagObject.SetTop(valy); 1219 var offsetclip = valy+valh-TagObject.GetTop(); 1220 TagObject.SetClip(0,TagObject.GetWidth(),offsetclip,0); 1221 } 1222} 1223 1224function EffectBottomUp() 1225{ 1226 this.TagObject.Show(); 1227 this.TagObject.drawingeffect=1; 1228 1229 var timeslide=0.; 1230 var y=this.TagObject.GetTop(); 1231 var w=this.TagObject.GetWidth(); 1232 var h=this.TagObject.GetHeight(); 1233 1234 this.TagObject.SetTop(y+h); 1235 var val=y+h-this.TagObject.GetTop(); 1236 this.TagObject.SetClip(0,w,val,0); 1237 1238 for(var i=0; i<h-1; i+=5) { 1239 setTimeout("EffectBottomUpCallBack(false, FindTagFromId(\"" + this.id + "\")," + y + "," + h + ")",timeslide); 1240 timeslide+=25.; 1241 } 1242 setTimeout("EffectBottomUpCallBack(true, FindTagFromId(\"" + this.id + "\")," + y + "," + h + ")",timeslide);
1243 setTimeout("SetDrawingEffect(FindTagFromId(\"" + this.id + "\"),2)",timeslide+1); 1244} 1245 1246 1247function EffectCrossH() 1248{ 1249 this.Effect = LMEffectShow; 1250 this.Effect(); 1251} 1252 1253 1254function EffectCrossV() 1255{ 1256 this.Effect = LMEffectShow; 1257 this.Effect(); 1258} 1259 1260 1261function EffectDemiCercle() 1262{ 1263 this.Effect = LMEffectShow; 1264 this.Effect(); 1265} 1266 1267 1268function EffectDissolve() 1269{ 1270 if (is.ns) { 1271 this.Effect = LMEffectShow; 1272 this.Effect(); 1273 } 1274 else if(is.ie) { 1275 if(is.minor>=5.5) { 1276 this.TagObject.style.filter="progid:DXImageTransform.Microsoft.RandomDissolve(duration=1.0)"; 1277 EffetTryCatch(this,1000); 1278 } 1279 else { 1280 this.TagObject.style.filter="revealTrans(duration=1.0,transition=12)"; 1281 if(this.TagObject.filters && this.TagObject.filters[0]) { 1282 this.TagObject.filters[0].Apply(); 1283 this.TagObject.Show(); 1284 this.TagObject.drawingeffect=1; 1285 this.TagObject.filters[0].Play(); 1286 setTimeout("SetDrawingEffect(" + this.id + ",2)",1000); 1287 } 1288 else { 1289 this.Effect = LMEffectShow; 1290 this.Effect(); 1291 } 1292 } 1293 } 1294} 1295 1296 1297function EffectExplodeCallBack(isend,TagObject,leftx,rightx,upy,downy) 1298{ 1299 TagObject.SetClip(upy,rightx,downy,leftx); 1300} 1301 1302function EffectExplode() 1303{ 1304 this.TagObject.Show(); 1305 this.TagObject.drawingeffect=1; 1306 1307 var timeslide=0.; 1308 var x=this.TagObject.GetLeft(); 1309 var y=this.TagObject.GetTop(); 1310 var w=this.TagObject.GetWidth(); 1311 var h=this.TagObject.GetHeight(); 1312 1313 var mx=w/2.; 1314 var my=h/2.; 1315 this.TagObject.SetClip(my,mx,my,mx); 1316 1317 var prop=h/w; 1318 1319 var delta=8; 1320 var dep=0.; 1321 var prop2=delta*prop; 1322 1323 for(var i=0; i<(w-1)/2+1; i+=delta) { 1324 var rightx=mx+i; 1325 if(rightx>w) rightx=w-1; 1326 var leftx=mx-i; 1327 if(leftx<0) leftx=0; 1328 var upy=my-dep; 1329 if(upy<0) upy=0; 1330 var downy=my+dep; 1331 if(downy>h) downy=h-1; 1332 dep+=prop2; 1333 setTimeout("EffectExplodeCallBack(false, FindTagFromId(\"" + this.id + "\")," + leftx + "," + rightx + "," + upy + "," + downy + ")",timeslide); 1334 timeslide+=25.; 1335 } 1336 setTimeout("EffectExplodeCallBack(true, FindTagFromId(\"" + this.id + "\")," + 0 + "," + w + "," + 0 + "," + h + ")",timeslide); 1337 setTimeout("SetDrawingEffect(FindTagFromId(\"" + this.id + "\"),2)",timeslide+1); 1338} 1339 1340 1341function EffectHtoCenter() 1342{ 1343 //keod unsupported 1344 this.Effect = LMEffectShow; 1345 this.Effect(); 1346} 1347 1348 1349function EffectImplode() 1350{ 1351 if (is.ns) { 1352 this.Effect = LMEffectShow; 1353 this.Effect(); 1354 } 1355 else if(is.ie) { 1356 timetot=this.TagObject.GetWidth()/1200.; 1357 if(timetot<0.5) timetot=0.5; 1358 1359 if(is.minor>=5.5) { 1360 this.TagObject.style.filter="progid:DXImageTransform.Microsoft.Iris(irisstyle='SQUARE', motion='in')"; 1361 EffetTryCatch(this,timetot*1000); 1362 } 1363 else { 1364 this.TagObject.style.filter="revealTrans(duration=" + timetot + ",transition=0)"; 1365 if(this.TagObject.filters && this.TagObject.filters[0]) { 1366 this.TagObject.filters[0].Apply(); 1367 this.TagObject.Show(); 1368 this.TagObject.drawingeffect=1; 1369 this.TagObject.filters[0].Play(); 1370 setTimeout("SetDrawingEffect(" + this.id + ",2)",timetot*1000); 1371 } 1372 else { 1373 this.Effect = LMEffectShow; 1374 this.Effect(); 1375 } 1376 } 1377 } 1378} 1379 1380 1381function EffectLeftRightCallBack(isend,TagObject,val) 1382{ 1383 if(isend) { 1384 TagObject.SetLeft(val); 1385 TagObject.SetClip(0,TagObject.GetWidth(),TagObject.GetHeight(),0); 1386 } 1387 else { 1388 TagObject.SetLeft(TagObject.GetLeft()+5); 1389 if(TagObject.GetLeft()>val) TagObject.SetLeft(val); 1390 var offsetclip = val-TagObject.GetLeft(); 1391 TagObject.SetClip(0,TagObject.GetWidth(),TagObject.GetHeight(),offsetclip); 1392 } 1393 return; 1394} 1395 1396function EffectLeftRight() 1397{ 1398 this.TagObject.Show(); 1399 this.TagObject.drawingeffect=1; 1400 1401 var timeslide=0.; 1402 var x=this.TagObject.GetLeft(); 1403 var w=this.TagObject.GetWidth(); 1404 var h=this.TagObject.GetHeight(); 1405 1406 this.TagObject.SetLeft(x-w); 1407 var val=x-this.TagObject.GetLeft(); 1408 this.TagObject.SetClip(0,w,h,val); 1409 1410 for(var i=0; i<w-1; i+=5) { 1411 setTimeout("EffectLeftRightCallBack(false, FindTagFromId(\"" + this.id + "\")," + x + ")",timeslide); 1412 timeslide+=25.; 1413 } 1414 setTimeout("EffectLeftRightCallBack(true, FindTagFromId(\"" + this.id + "\")," + x + ")",timeslide);
1415 setTimeout("SetDrawingEffect(FindTagFromId(\"" + this.id + "\"),2)",timeslide+1); 1416} 1417 1418 1419function EffectLigne() 1420{ 1421 this.Effect = LMEffectShow; 1422 this.Effect(); 1423} 1424 1425 1426function EffectOuvertureCirculaire() 1427{ 1428 this.Effect = LMEffectShow; 1429 this.Effect(); 1430} 1431 1432 1433function EffectOuvertureCirculaireNoir() 1434{ 1435 this.Effect = LMEffectShow; 1436 this.Effect(); 1437} 1438 1439 1440function EffectPapillon() 1441{ 1442 this.Effect = LMEffectShow; 1443 this.Effect(); 1444} 1445 1446 1447function EffectPapillonNoir() 1448{ 1449 this.Effect = LMEffectShow; 1450 this.Effect(); 1451} 1452 1453 1454function EffectRandomBloc() 1455{ 1456 this.Effect = LMEffectShow; 1457 this.Effect(); 1458} 1459 1460 1461function EffectRandomCircle() 1462{ 1463 this.Effect = LMEffectShow; 1464 this.Effect(); 1465} 1466 1467 1468function EffectRideauBottomUpCallBack(isend,TagObject,cliptop) 1469{ 1470 TagObject.SetClip(cliptop,TagObject.GetWidth(),TagObject.GetHeight(),0); 1471} 1472 1473function EffectRideauBottomUp() 1474{ 1475 this.TagObject.Show(); 1476 this.TagObject.drawingeffect=1; 1477 1478 var timeslide=0.; 1479 var w=this.TagObject.GetWidth(); 1480 var h=this.TagObject.GetHeight(); 1481 this.TagObject.SetClip(0,w,h,0); 1482 1483 var delta=8; 1484 var val; 1485 var i,j; 1486 for(i=0,j=h; i<h-1; i+=delta) { 1487 j-=delta; 1488 val=j; 1489 if(val<0) val=0; 1490 setTimeout("EffectRideauBottomUpCallBack(false, FindTagFromId(\"" + this.id + "\")," + val + ")",timeslide); 1491 timeslide+=25.; 1492 } 1493 setTimeout("EffectRideauBottomUpCallBack(true, FindTagFromId(\"" + this.id + "\")," + 0 + ")",timeslide); 1494 setTimeout("SetDrawingEffect( FindTagFromId(\"" + this.id + "\"),2)",timeslide+1); 1495} 1496 1497 1498function EffectRideauLeftRightCallBack(isend,TagObject,clipright) 1499{
1500 TagObject.SetClip(0,clipright,TagObject.GetHeight(),0); 1501} 1502 1503 1504function EffectRideauLeftRight() 1505{ 1506 this.TagObject.Show(); 1507 this.TagObject.drawingeffect=1; 1508 1509 var timeslide=0.; 1510 var w=this.TagObject.GetWidth(); 1511 var h=this.TagObject.GetHeight(); 1512 this.TagObject.SetClip(0,0,h,0); 1513 1514 var val; 1515 for(var i=0; i<w-1; i+=8) { 1516 val=i; 1517 if(val>w) val=w; 1518 setTimeout("EffectRideauLeftRightCallBack(false, FindTagFromId(\"" + this.id + "\")," + val + ")",timeslide); 1519 timeslide+=25.; 1520 } 1521 setTimeout("EffectRideauLeftRightCallBack(true, FindTagFromId(\"" + this.id + "\")," + w + ")",timeslide); 1522 setTimeout("SetDrawingEffect(FindTagFromId(\"" + this.id + "\"),2)",timeslide+1); 1523} 1524 1525function EffectRideauRightLeftCallBack(isend,TagObject,clipleft) 1526{ 1527 TagObject.SetClip(0,TagObject.GetWidth(),TagObject.GetHeight(),clipleft); 1528} 1529 1530function EffectRideauRightLeft() 1531{ 1532 this.TagObject.Show(); 1533 this.TagObject.drawingeffect=1; 1534 1535 var timeslide=0.; 1536 var w=this.TagObject.GetWidth(); 1537 var h=this.TagObject.GetHeight(); 1538 this.TagObject.SetClip(0,w,h,0); 1539 1540 var val; 1541 var i,j; 1542 var delta=8; 1543 for(i=0,j=w; i<w-1; i+=delta) { 1544 j-=delta; 1545 val=j; 1546 if(val<0) val=0; 1547 setTimeout("EffectRideauRightLeftCallBack(false, FindTagFromId(\"" + this.id + "\")," + val + ")",timeslide); 1548 timeslide+=25.; 1549 } 1550 setTimeout("EffectRideauRightLeftCallBack(true, FindTagFromId(\"" + this.id + "\")," + 0 + ")",timeslide); 1551 setTimeout("SetDrawingEffect( FindTagFromId(\"" + this.id + "\"),2)",timeslide+1); 1552} 1553 1554function EffectRideauTopDownCallBack(isend,TagObject,clipbottom) 1555{ 1556 TagObject.SetClip(0,TagObject.GetWidth(),clipbottom,0); 1557} 1558 1559function EffectRideauTopDown() 1560{ 1561 this.TagObject.Show(); 1562 this.TagObject.drawingeffect=1; 1563 1564 var timeslide=0.; 1565 var w=this.TagObject.GetWidth(); 1566 var h=this.TagObject.GetHeight(); 1567 this.TagObject.SetClip(0,w,0,0); 1568 1569 var val; 1570 for(var i=0; i<h-1; i+=5) { 1571 val=i; 1572 if(val>h) val=h; 1573 setTimeout("EffectRideauTopDownCallBack(false, FindTagFromId(\"" + this.id + "\")," + val + ")",timeslide); 1574 timeslide+=25.; 1575 } 1576 setTimeout("EffectRideauTopDownCallBack(true, FindTagFromId(\"" + this.id + "\")," + h + ")",timeslide); 1577 setTimeout("SetDrawingEffect(FindTagFromId(\"" + this.id + "\"),2)",timeslide+1); 1578} 1579 1580 1581function EffectRightLeftCallBack(isend,TagObject,valx,valw) 1582{ 1583 if(isend) { 1584 TagObject.SetLeft(valx); 1585 TagObject.SetClip(0,valw,TagObject.GetHeight(),0); 1586 } 1587 else { 1588 TagObject.SetLeft(TagObject.GetLeft()-5); 1589 if(TagObject.GetLeft()<valx) TagObject.SetLeft(valx); 1590 var offsetclip = valx+valw-TagObject.GetLeft(); 1591 TagObject.SetClip(0,offsetclip,TagObject.GetHeight(),0); 1592 } 1593} 1594 1595function EffectRightLeft() 1596{ 1597 this.TagObject.Show(); 1598 this.TagObject.drawingeffect=1; 1599 1600 var timeslide=0.; 1601 var x=this.TagObject.GetLeft(); 1602 var w=this.TagObject.GetWidth(); 1603 var h=this.TagObject.GetHeight(); 1604 1605 this.TagObject.SetLeft(x+w); 1606 var val=x+w-this.TagObject.GetLeft(); 1607 this.TagObject.SetClip(0,val,h,0); 1608 1609 for(var i=0; i<w-1; i+=5) { 1610 setTimeout("EffectRightLeftCallBack(false, FindTagFromId(\"" + this.id + "\")," + x + "," + w + ")",timeslide); 1611 timeslide+=25.; 1612 } 1613 setTimeout("EffectRightLeftCallBack(true, FindTagFromId(\"" + this.id + "\")," + x + "," + w + ")",timeslide); 1614 setTimeout("SetDrawingEffect(FindTagFromId(\"" + this.id + "\"),2)",timeslide+1); 1615} 1616 1617 1618function EffectRoundExplode() 1619{ 1620 if (is.ns) { 1621 this.Effect = LMEffectShow; 1622 this.Effect(); 1623 } 1624 else if(is.ie) { 1625 timetot=this.TagObject.GetWidth()/1000.; 1626 if(timetot<0.4) timetot=0.4; 1627 1628 if(is.minor>=5.5) { 1629 this.TagObject.style.filter="progid:DXImageTransform.Microsoft.Iris(irisstyle='CIRCLE', motion='out')"; 1630 EffetTryCatch(this,timetot*1000); 1631 } 1632 else { 1633 this.TagObject.style.filter="revealTrans(duration=" + timetot + ",transition=3)"; 1634 if(this.TagObject.filters && this.TagObject.filters[0]) { 1635 this.TagObject.filters[0].Apply(); 1636 this.TagObject.Show(); 1637 this.TagObject.drawingeffect=1; 1638 this.TagObject.filters[0].Play();
1639 setTimeout("SetDrawingEffect(" + this.id + ",2)",timetot*1000); 1640 } 1641 else { 1642 this.Effect = LMEffectShow; 1643 this.Effect(); 1644 } 1645 } 1646 } 1647} 1648 1649 1650function EffectRoundImplode() 1651{ 1652 if (is.ns) { 1653 this.Effect = LMEffectShow; 1654 this.Effect(); 1655 } 1656 else if(is.ie) { 1657 timetot=this.TagObject.GetWidth()/1000.; 1658 if(timetot<0.4) timetot=0.4; 1659 1660 if(is.minor>=5.5) { 1661 this.TagObject.style.filter="progid:DXImageTransform.Microsoft.Iris(irisstyle='CIRCLE', motion='in')"; 1662 EffetTryCatch(this,timetot*1000); 1663 } 1664 else { 1665 this.TagObject.style.filter="revealTrans(duration=" + timetot + ",transition=2)"; 1666 if(this.TagObject.filters && this.TagObject.filters[0]) { 1667 this.TagObject.filters[0].Apply(); 1668 this.TagObject.Show(); 1669 this.TagObject.drawingeffect=1; 1670 this.TagObject.filters[0].Play(); 1671 setTimeout("SetDrawingEffect(" + this.id + ",2)",timetot*1000); 1672 } 1673 else { 1674 this.Effect = LMEffectShow; 1675 this.Effect(); 1676 } 1677 } 1678 } 1679} 1680 1681 1682function EffectTopDownCallBack(isend,TagObject,val) 1683{ 1684 if(isend) { 1685 TagObject.SetTop(val); 1686 TagObject.SetClip(0,TagObject.GetWidth(),TagObject.GetHeight(),0); 1687 } 1688 else { 1689 TagObject.SetTop(TagObject.GetTop()+5); 1690 if(TagObject.GetTop()>val) TagObject.SetTop(val); 1691 var offsetclip = val-TagObject.GetTop(); 1692 TagObject.SetClip(offsetclip,TagObject.GetWidth(),TagObject.GetHeight(),0); 1693 } 1694 return; 1695} 1696 1697function EffectTopDown() 1698{ 1699 this.TagObject.Show(); 1700 this.TagObject.drawingeffect=1; 1701 1702 var timeslide=0.; 1703 var y=this.TagObject.GetTop(); 1704 var w=this.TagObject.GetWidth(); 1705 var h=this.TagObject.GetHeight(); 1706 1707 this.TagObject.SetTop(y-h); 1708 var val=y-this.TagObject.GetTop(); 1709 this.TagObject.SetClip(val,w,h,0); 1710 1711 for(var i=0; i<h-1; i+=5) { 1712 setTimeout("EffectTopDownCallBack(false, FindTagFromId(\"" + this.id + "\")," + y + ")",timeslide); 1713 timeslide+=25.; 1714 } 1715 setTimeout("EffectTopDownCallBack(true, FindTagFromId(\"" + this.id + "\")," + y + ")",timeslide); 1716 setTimeout("SetDrawingEffect(FindTagFromId(\"" + this.id + "\"),2)",timeslide+1); 1717} 1718 1719function EffectWtoCenter() 1720{ 1721 //keod unsupported 1722 this.Effect = LMEffectShow; 1723 this.Effect(); 1724} 1725 1726 1727function SetDrawingEffect(LMObject,val) 1728{ 1729 LMObject.drawingeffect=val; 1730 1731 if(val==2) { 1732 object=FindClassObjectFromId(LMObject.id); 1733 if(object && object.BranchLst) { 1734 for(var i=0; i<object.BranchLst.length; i++) { 1735 if (object.BranchLst[i]!= null && object.BranchLst[i].delais>0) { 1736 delais=object.BranchLst[i].delais*1000; 1737 setTimeout("LMObjectClick('" + object.id + "'," + i + ")",delais); 1738 } 1739 } 1740 } 1741 if(object.EffectFinishEvent) object.EffectFinishEvent(object.id); 1742 } 1743} 1744 1745function LMEffectShow() 1746{ 1747 this.TagObject.Show(); 1748 this.TagObject.drawingeffect=1; 1749 setTimeout("SetDrawingEffect(FindTagFromId(\"" + this.id + "\"),2)",10); 1750} 1751 1752function LMEffectHide() 1753{ 1754 this.TagObject.Hide(); 1755} 1756 1757function EffetTryCatch(obj,time) 1758{ 1759 try{obj.TagObject.filters[0].Apply(); 1760 obj.TagObject.Show(); 1761 obj.TagObject.drawingeffect=1; 1762 obj.TagObject.filters[0].Play(); 1763 setTimeout("SetDrawingEffect("+obj.id+",2)",time); 1764 } 1765 catch(e){ 1766 obj.Effect=LMEffectShow;obj.Effect(); 1767 } 1768} 1769 1770function PushBottomUp() 1771{ 1772 this.Effect = LMEffectShow; 1773 this.Effect(); 1774} 1775 1776 1777function PushHtoCenter() 1778{ 1779 this.Effect = LMEffectShow; 1780 this.Effect(); 1781} 1782 1783 1784function PushLeftRight() 1785{ 1786 this.Effect = LMEffectShow; 1787 this.Effect(); 1788} 1789 1790 1791function PushRightLeft() 1792{ 1793 this.Effect = LMEffectShow; 1794 this.Effect(); 1795} 1796 1797 1798function PushTopDown() 1799{ 1800 this.Effect = LMEffectShow; 1801 this.Effect(); 1802} 1803 1804 1805function PushWtoCenter() 1806{ 1807 this.Effect = LMEffectShow; 1808 this.Effect(); 1809} 1810 1811function InitFormValidationResources(language) 1812{ 1813switch(language){ 1814case "de": 1815(function($){ 1816 $.fn.validationEngineLanguage = function(){ 1817 }; 1818 $.validationEngineLanguage = { 1819 newLang: function(){ 1820 $.validationEngineLanguage.allRules = { 1821 "required": { // Add your regex rules here, you can take telep
1821hone as an example 1822 "regex": "none", 1823 "alertText": "* Dieses Feld ist ein Pflichtfeld", 1824 "alertTextCheckboxMultiple": "* Bitte wählen Sie eine Option", 1825 "alertTextCheckboxe": "* Dieses Feld ist ein Pflichtfeld" 1826 }, 1827 "requiredInFunction": { 1828 "func": function(field, rules, i, options){ 1829 return (field.val() == "test") ? true : false; 1830 }, 1831 "alertText": "* Field must equal test" 1832 }, 1833 "minSize": { 1834 "regex": "none", 1835 "alertText": "* Mindestens ", 1836 "alertText2": " Zeichen benötigt" 1837 }, 1838 "maxSize": { 1839 "regex": "none", 1840 "alertText": "* Maximal ", 1841 "alertText2": " Zeichen erlaubt" 1842 }, 1843 "groupRequired": { 1844 "regex": "none", 1845 "alertText": "* Sie müssen mindestens eines dieser Felder ausfüllen" 1846 }, 1847 "min": { 1848 "regex": "none", 1849 "alertText": "* Mindestwert ist " 1850 }, 1851 "max": { 1852 "regex": "none", 1853 "alertText": "* Maximalwert ist " 1854 }, 1855 "past": { 1856 "regex": "none", 1857 "alertText": "* Datum vor " 1858 }, 1859 "future": { 1860 "regex": "none", 1861 "alertText": "* Datum nach " 1862 }, 1863 "maxCheckbox": { 1864 "regex": "none", 1865 "alertText": "* Maximale Anzahl Markierungen überschritten" 1866 }, 1867 "minCheckbox": { 1868 "regex": "none", 1869 "alertText": "* Bitte wählen Sie ", 1870 "alertText2": " Optionen" 1871 }, 1872 "equals": { 1873 "regex": "none", 1874 "alertText": "* Felder stimmen nicht überein" 1875 }, 1876 "creditCard": { 1877 "regex": "none", 1878 "alertText": "* Ungültige Kreditkartennummer" 1879 }, 1880 "phone": { 1881 // credit: jquery.h5validate.js / orefalo 1882 "regex": /^([\+][0-9]{1,3}([ \.\-])?)?([\(][0-9]{1,6}[\)])?([0-9 \.\-]{1,32})(([A-Za-z \:]{1,11})?[0-9]{1,4}?)$/, 1883 "alertText": "* Ungültige Telefonnummer" 1884 }, 1885 "email": { 1886 // Shamelessly lifted from Scott Gonzalez via the Bassistance Validation plugin http://projects.scottsplayground.com/email_address_validation/ 1887 "regex": /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i, 1888 "alertText": "* Ungültige E-Mail-Adresse" 1889 }, 1890 "integer": { 1891 "regex": /^[\-\+]?\d+$/, 1892 "alertText": "* Keine gültige Ganzzahl" 1893 }, 1894 "number": { 1895 // Number, including positive, negative, and floating decimal. credit: orefalo 1896 "regex": /^[\-\+]?((([0-9]{1,3})([,][0-9]{3})*)|([0-9]+))?([\.]([0-9]+))?$/, 1897 "alertText": "* Keine gültige FlieÃkommazahl" 1898 }, 1899 "date": { 1900 // Date in ISO format. Credit: bassistance 1901 "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/, 1902 "alertText": "* Ungültiges Datumsformat, erwartet wird das Format JJJJ-MM-TT" 1903 }, 1904 "ipv4": { 1905 "regex": /^((([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))[.]){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))$/, 1906 "alertText": "* Ungültige IP-Adresse" 1907 }, 1908 "url": { 1909 "regex": /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i, 1910 "alertText": "* Ungültige URL" 1911 }, 1912 "onlyNumberSp": { 1913 "regex": /^[0-9\ ]+$/, 1914 "alertText": "* Nur Zahlen" 1915 }, 1916 "onlyLetterSp": { 1917 "regex": /^[a-zA-ZäüöÃÃÃÃs\ \\\']+$/, 1918 "alertText": "* Nur Buchstaben erlaubt" 1919 },
1920 "onlyLetterAccentSp":{ 1921 "regex": /^[a-zÃ\u00C0-\u017F\ ]+$/i, 1922 "alertText": "* Nur Buchstaben erlaubt" 1923 }, 1924 "onlyLetterNumber": { 1925 "regex": /^[0-9a-zA-ZäüöÃÃÃÃs-]+$/, 1926 "alertText": "* Keine Sonderzeichen erlaubt" 1927 }, 1928 // --- CUSTOM RULES -- Those are specific to the demos, they can be removed or changed to your likings 1929 "ajaxUserCall": { 1930 "url": "ajaxValidateFieldUser", 1931 // you may want to pass extra data on the ajax call 1932 "extraData": "name=eric", 1933 "alertText": "* Dieser Benutzer ist bereits vergeben", 1934 "alertTextLoad": "* Ãberprüfe Angaben, bitte warten" 1935 }, 1936 "ajaxNameCall": { 1937 // remote json service location 1938 "url": "ajaxValidateFieldName", 1939 // error 1940 "alertText": "* Dieser Name ist bereits vergeben", 1941 // if you provide an "alertTextOk", it will show as a green prompt when the field validates 1942 "alertTextOk": "* Dieser Name ist verfügbar", 1943 // speaks by itself 1944 "alertTextLoad": "* Ãberprüfe Angaben, bitte warten" 1945 }, 1946 "validate2fields": { 1947 "alertText": "* Bitte HELLO eingeben" 1948 } 1949 }; 1950 1951 } 1952 }; 1953 $.validationEngineLanguage.newLang(); 1954})(jQuery18); 1955 1956 1957 1958 1959break; 1960case "nl": 1961(function($){ 1962 $.fn.validationEngineLanguage = function(){ 1963 }; 1964 $.validationEngineLanguage = { 1965 newLang: function(){ 1966 $.validationEngineLanguage.allRules = { 1967 "required": { // Add your regex rules here, you can take telephone as an example 1968 "regex": "geen", 1969 "alertText": "* Dit veld is verplicht", 1970 "alertTextCheckboxMultiple": "* Selecteer a.u.b. een optie", 1971 "alertTextCheckboxe": "* Dit selectievakje is verplicht" 1972 }, 1973 "requiredInFunction": { 1974 "func": function(field, rules, i, options){ 1975 return (field.val() == "test") ? true : false; 1976 }, 1977 "alertText": "* Velden moeten gelijk zijn" 1978 }, 1979 "minSize": { 1980 "regex": "none", 1981 "alertText": "* Minimaal ", 1982 "alertText2": " karakters toegestaan" 1983 }, 1984 "maxSize": { 1985 "regex": "none", 1986 "alertText": "* Maximaal ", 1987 "alertText2": " karakters toegestaan" 1988 }, 1989 "groupRequired": { 1990 "regex": "none", 1991 "alertText": "* Vul één van de volgende velden in" 1992 }, 1993 "min": { 1994 "regex": "none", 1995 "alertText": "* Minimale waarde is " 1996 }, 1997 "max": { 1998 "regex": "none", 1999 "alertText": "* Maximale waarde is " 2000 }, 2001 "past": { 2002 "regex": "none", 2003 "alertText": "* Datum voorafgaand aan " 2004 }, 2005 "future": { 2006 "regex": "none", 2007 "alertText": "* Datum na " 2008 }, 2009 "maxCheckbox": { 2010 "regex": "none", 2011 "alertText": "* Toegestane aantal vinkjes overschreden" 2012 }, 2013 "minCheckbox": { 2014 "regex": "none", 2015 "alertText": "* Selecteer a.u.b. ", 2016 "alertText2": " opties" 2017 }, 2018 "equals": { 2019 "regex": "none", 2020 "alertText": "* Velden komen niet overeen" 2021 }, 2022 "creditCard": { 2023 "regex": "none", 2024 "alertText": "* Ongeldige credit card nummer" 2025 }, 2026 "phone": { 2027 // credit: jquery.h5validate.js / orefalo 2028 "regex": /^([\+][0-9]{1,3}([ \.\-])?)?([\(][0-9]{1,6}[\)])?([0-9 \.\-]{1,32})(([A-Za-z \:]{1,11})?[0-9]{1,4}?)$/, 2029 "alertText": "* Ongeldig telefoonnummer" 2030 }, 2031 "email": { 2032 // Shamelessly lifted from Scott Gonzalez via the Bassistance Validation plugin http://projects.scottsplayground.com/email_address_validation/ 2033 // Replaced incredible long regex with shorter and working one! :) 2034// "regex": /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i, 2035 "regex": /^[a-z0-9]+[a-z0-9._%+-]*@(?:[a-z0-9-]+\.)+[a-z]{2,6}$/i, 2036 "alertText": "* Ongeldig emailadres" 2037 }, 2038 "integer": { 2039 "regex": /^[\-\+]?\d+$/, 2040 "alertText": "* Ongeldig geheel getal" 2041 }, 2042 "number": { 2043 // Number, including positive, negative, and floating decimal. credit: orefalo 2044 "regex": /^[\-\+]?((([0-9]{1,3})([,][0-9]{3})*)|([0-9]+))?([\.]([0-9]+))?$/, 2045 "alertText": "* Ongeldig komma getal" 2046 }, 2047 "date": { 2048 "regex": /^(?:(?:31(\/|-|\.)(?:0?[13578]|1[02]))\1|(?:(?:29|30)(\/|-|\.)(?:0?[1,3-9]|1[0-2])\2))(?:(?:1[6-9]|[2-9]\d)?\d{2}
2048)$|^(?:29(\/|-|\.)0?2\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\d|2[0-8])(\/|-|\.)(?:(?:0?[1-9])|(?:1[0-2]))\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$/, 2049 "alertText": "* Ongeldige datum, formaat moet DD-MM-JJJJ zijn" 2050 }, 2051 "ipv4": { 2052 "regex": /^((([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))[.]){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))$/, 2053 "alertText": "* Ongeldig IP-adres" 2054 }, 2055 "url": { 2056 "regex": /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i, 2057 "alertText": "* Ongeldige URL" 2058 }, 2059 "onlyNumberSp": { 2060 "regex": /^[0-9\ ]+$/, 2061 "alertText": "* Alleen cijfers" 2062 }, 2063 "onlyLetterSp": { 2064 "regex": /^[a-zA-Z\ \']+$/, 2065 "alertText": "* Alleen leestekens" 2066 }, 2067 "onlyLetterAccentSp":{ 2068 "regex": /^[a-z\u00C0-\u017F\ ]+$/i, 2069 "alertText": "* Alleen leestekens" 2070 }, 2071 "onlyLetterNumber": { 2072 "regex": /^[0-9a-zA-Z]+$/, 2073 "alertText": "* Geen vreemde tekens toegestaan" 2074 }, 2075 // --- CUSTOM RULES -- Those are specific to the demos, they can be removed or changed to your likings 2076 "ajaxUserCall": { 2077 "url": "ajaxValidateFieldUser", 2078 // you may want to pass extra data on the ajax call 2079 "extraData": "name=eric", 2080 "alertText": "* Deze gebruiker bestaat al", 2081 "alertTextLoad": "* Bezig met valideren, even geduld aub" 2082 }, 2083 "ajaxNameCall": { 2084 // remote json service location 2085 "url": "ajaxValidateFieldName", 2086 // error 2087 "alertText": "* Deze naam bestaat al", 2088 // if you provide an "alertTextOk", it will show as a green prompt when the field validates 2089 "alertTextOk": "* Deze naam is beschikbaar", 2090 // speaks by itself 2091 "alertTextLoad": "* Bezig met valideren, even geduld aub" 2092 }, 2093 "validate2fields": { 2094 "alertText": "* Voer aub HELLO in" 2095 } 2096 }; 2097 2098 } 2099 }; 2100 $.validationEngineLanguage.newLang(); 2101})(jQuery18); 2102 2103break; 2104case "es": 2105 2106(function($){ 2107 $.fn.validationEngineLanguage = function(){ 2108 }; 2109 $.validationEngineLanguage = { 2110 newLang: function(){ 2111 $.validationEngineLanguage.allRules = { 2112 "required": { // Add your regex rules here, you can take telephone as an example 2113 "regex": "none", 2114 "alertText": "* Este campo es obligatorio", 2115 "alertTextCheckboxMultiple": "* Por favor seleccione una opción", 2116 "alertTextCheckboxe": "* Este checkbox es obligatorio" 2117 }, 2118 "requiredInFunction": { 2119 "func": function(field, rules, i, options){ 2120 return (field.val() == "test") ? true : false; 2121 }, 2122 "alertText": "* Field must equal test" 2123 }, 2124 "minSize": { 2125 "regex": "none", 2126 "alertText": "* MÃnimo de ", 2127 "alertText2": " caracteres autorizados" 2128 }, 2129 "groupRequired": { 2130 "regex": "none", 2131 "alertText": "* Debe de rellenar al menos uno de los siguientes campos" 2132 }, 2133 "maxSize": { 2134 "regex": "none", 2135 "alertText": "* Máximo de ", 2136 "alertText2": " caracteres autorizados" 2137 }, 2138 "min": { 2139 "regex": "none", 2140 "alertText": "* El valor mÃnimo es " 2141 }, 2142 "max": { 2143 "regex": "none", 2144 "alertText": "* El valor máximo es " 2145 }, 2146 "past": { 2147 "regex": "none", 2148 "alertText": "* Fecha anterior a " 2149 }, 2150 "future": { 2151 "regex": "none", 2152 "alertText": "* Fecha posterior a " 2153 }, 2154 "maxCheckbox": { 2155 "regex": "none", 2156 "alertText": "* Se ha excedido el número de opciones permitidas" 2157 }, 2158 "minCheckbox": { 2159 "regex": "none", 2160 "alertText": "* Por favor seleccione ", 2161 "alertText2": " opciones" 2162 }, 2163 "equals": { 2164 "regex": "none", 2165 "alertText": "* Los campos no coinciden" 2166 }, 2167 "creditCard": { 2168 "regex": "none", 2169 "alertText": "* La tarjeta de crédito no es válida" 2170 }, 2171 "phone": { 2172 // credit: jquery.h5validate.js / orefalo 2173 "regex": /^([\+][0-9]{1,3}([ \.\-])?)?([\(][0-9]{1,6}[\)])?([0-9 \.\-]{1,32})(([A-Za-z \:]{1,11})?[0-9]{1,4}?)$/, 2174 "alertText": "* Número de teléfono inválido" 2175 }, 2176 "email": { 2177 // Shamelessly lifted from Scott Gonzalez via the Bassistance Validation plugin http://projects.scottsplayground.com/email_address_validation/ 2178 "regex": /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i, 2179 "alertText": "* Correo inválido" 2180 }, 2181 "integer": { 2182 "regex": /^[\-\+]?\d+$/, 2183 "alertText": "* No es un valor entero válido" 2184 }, 2185 "number": { 2186 // Number, including positive, negative, and floating decimal. credit: orefalo 2187 "regex": /^[\-\+]?((([0-9]{1,3})([,][0-9]{3})*)|([0-9]+))?([\.]([0-9]+))?$/, 2188 "alertText": "* No es un valor decimal válido" 2189 }, 2190 "date": { 2191 "regex": /^(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[012])[\/\-]\d{4}$/, 2192 "alertText": "* Fecha inválida, por favor utilize el formato DD/MM/AAAA" 2193 }, 2194 "ipv4": { 2195 "regex": /^((([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))[.]){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))$/, 2196 "alertText": "* Direccion IP inválida" 2197 }, 2198 "url": { 2199 "regex": /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i, 2200 "alertText": "* URL Inválida" 2201 }, 2202 "onlyNumberSp": { 2203 "regex": /^[0-9\ ]+$/, 2204 "alertText": "* Sólo números" 2205 }, 2206 "onlyLetterSp": { 2207 "regex": /^[a-zA-Z\ \']+$/, 2208 "alertText": "* Sólo letras" 2209 },
2210 "onlyLetterAccentSp":{ 2211 "regex": /^[a-z\u00C0-\u017F\ ]+$/i, 2212 "alertText": "* Sólo letras" 2213 }, 2214 "onlyLetterNumber": { 2215 "regex": /^[0-9a-zA-Z]+$/, 2216 "alertText": "* No se permiten caracteres especiales" 2217 }, 2218 // --- CUSTOM RULES -- Those are specific to the demos, they can be removed or changed to your likings 2219 "ajaxUserCall": { 2220 "url": "ajaxValidateFieldUser", 2221 // you may want to pass extra data on the ajax call 2222 "extraData": "name=eric", 2223 "alertTextLoad": "* Cargando, espere por favor", 2224 "alertText": "* Este nombre de usuario ya se encuentra usado" 2225 }, 2226 "ajaxNameCall": { 2227 // remote json service location 2228 "url": "ajaxValidateFieldName", 2229 // error 2230 "alertText": "* Este nombre ya se encuentra usado", 2231 // if you provide an "alertTextOk", it will show as a green prompt when the field validates 2232 "alertTextOk": "* Este nombre está disponible", 2233 // speaks by itself 2234 "alertTextLoad": "* Cargando, espere por favor" 2235 }, 2236 "validate2fields": { 2237 "alertText": "* Por favor entrar HELLO" 2238 } 2239 }; 2240 2241 } 2242 }; 2243 $.validationEngineLanguage.newLang(); 2244})(jQuery18); 2245 2246 2247break; 2248case "fr": 2249(function($){ 2250 $.fn.validationEngineLanguage = function(){ 2251 }; 2252 $.validationEngineLanguage = { 2253 newLang: function(){ 2254 $.validationEngineLanguage.allRules = { 2255 "required": { 2256 "regex": "none", 2257 "alertText": "* Ce champ est requis", 2258 "alertTextCheckboxMultiple": "* Choisir une option", 2259 "alertTextCheckboxe": "* Cette option est requise" 2260 }, 2261 "requiredInFunction": { 2262 "func": function(field, rules, i, options){ 2263 return (field.val() == "test") ? true : false; 2264 }, 2265 "alertText": "* Field must equal test" 2266 }, 2267 "minSize": { 2268 "regex": "none", 2269 "alertText": "* Minimum ", 2270 "alertText2": " caractères requis" 2271 }, 2272 "groupRequired": { 2273 "regex": "none", 2274 "alertText": "* Vous devez remplir un des champs suivant" 2275 }, 2276 "maxSize": { 2277 "regex": "none", 2278 "alertText": "* Maximum ", 2279 "alertText2": " caractères requis" 2280 }, 2281 "min": { 2282 "regex": "none", 2283 "alertText": "* Valeur minimum requise " 2284 }, 2285 "max": { 2286 "regex": "none", 2287 "alertText": "* Valeur maximum requise " 2288 }, 2289 "past": { 2290 "regex": "none", 2291 "alertText": "* Date antérieure au " 2292 }, 2293 "future": { 2294 "regex": "none", 2295 "alertText": "* Date postérieure au " 2296 }, 2297 "maxCheckbox": { 2298 "regex": "none", 2299 "alertText": "* Nombre max de choix excédé" 2300 }, 2301 "minCheckbox": { 2302 "regex": "none", 2303 "alertText": "* Veuillez choisir ", 2304 "alertText2": " options" 2305 }, 2306 "equals": { 2307 "regex": "none", 2308 "alertText": "* Votre champ n'est pas identique" 2309 }, 2310 "creditCard": { 2311 "regex": "none", 2312 "alertText": "* Numéro de carte bancaire valide" 2313 }, 2314 "phone": { 2315 // credit: jquery.h5validate.js / orefalo 2316 "regex": /^([\+][0-9]{1,3}([ \.\-])?)?([\(][0-9]{1,6}[\)])?([0-9 \.\-]{1,32})(([A-Za-z \:]{1,11})?[0-9]{1,4}?)$/, 2317 "alertText": "* Numéro de téléphone invalide" 2318 }, 2319 "email": { 2320 // Shamelessly lifted from Scott Gonzalez via the Bassistance Validation plugin http://projects.scottsplayground.com/email_address_validation/ 2321 "regex": /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i, 2322 "alertText": "* Adresse email invalide" 2323 }, 2324 "integer": { 2325 "regex": /^[\-\+]?\d+$/, 2326 "alertText": "* Nombre entier invalide" 2327 }, 2328 "number": { 2329 // Number, including positive, negative, and floating decimal. credit: orefalo 2330 "regex": /^[\-\+]?((([0-9]{1,3})([,][0-9]{3})*)|([0-9]+))?([\.]([0-9]+))?$/, 2331 "alertText": "* Nombre flottant invalide" 2332 }, 2333 "date": { 2334 "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/, 2335 "alertText": "* Date invalide, format YYYY-MM-DD requis" 2336 }, 2337 "ipv4": { 2338 "regex": /^((([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))[.]){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))$/, 2339 "alertText": "* Adresse IP invalide" 2340 }, 2341 "url": { 2342 "regex": /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,
2343 "alertText": "* URL invalide" 2344 }, 2345 "onlyNumberSp": { 2346 "regex": /^[0-9\ ]+$/, 2347 "alertText": "* Seuls les chiffres sont acceptés" 2348 }, 2349 "onlyLetterSp": { 2350 "regex": /^[a-zA-Z\u00C0-\u00D6\u00D9-\u00F6\u00F9-\u00FD\ \']+$/, 2351 "alertText": "* Seules les lettres sont acceptées" 2352 }, 2353 "onlyLetterNumber": { 2354 "regex": /^[0-9a-zA-Z\u00C0-\u00D6\u00D9-\u00F6\u00F9-\u00FD]+$/, 2355 "alertText": "* Aucun caractère spécial n'est accepté" 2356 }, 2357 // --- CUSTOM RULES -- Those are specific to the demos, they can be removed or changed to your likings 2358 "ajaxUserCall": { 2359 "url": "ajaxValidateFieldUser", 2360 "extraData": "name=eric", 2361 "alertTextLoad": "* Chargement, veuillez attendre", 2362 "alertText": "* Ce nom est déjà pris" 2363 }, 2364 "ajaxNameCall": { 2365 "url": "ajaxValidateFieldName", 2366 "alertText": "* Ce nom est déjà pris", 2367 "alertTextOk": "*Ce nom est disponible", 2368 "alertTextLoad": "* Chargement, veuillez attendre" 2369 }, 2370 "validate2fields": { 2371 "alertText": "Veuillez taper le mot HELLO" 2372 } 2373 }; 2374 } 2375 }; 2376 $.validationEngineLanguage.newLang(); 2377})(jQuery18); 2378break; 2379case "en": 2380(function($){ 2381 $.fn.validationEngineLanguage = function(){ 2382 }; 2383 $.validationEngineLanguage = { 2384 newLang: function(){ 2385 $.validationEngineLanguage.allRules = { 2386 "required": { // Add your regex rules here, you can take telephone as an example 2387 "regex": "none", 2388 "alertText": "* This field is required", 2389 "alertTextCheckboxMultiple": "* Please select an option", 2390 "alertTextCheckboxe": "* This checkbox is required", 2391 "alertTextDateRange": "* Both date range fields are required" 2392 }, 2393 "requiredInFunction": { 2394 "func": function(field, rules, i, options){ 2395 return (field.val() == "test") ? true : false; 2396 }, 2397 "alertText": "* Field must equal test" 2398 }, 2399 "dateRange": { 2400 "regex": "none", 2401 "alertText": "* Invalid ", 2402 "alertText2": "Date Range" 2403 }, 2404 "dateTimeRange": { 2405 "regex": "none", 2406 "alertText": "* Invalid ", 2407 "alertText2": "Date Time Range" 2408 }, 2409 "minSize": { 2410 "regex": "none", 2411 "alertText": "* Minimum ", 2412 "alertText2": " characters required" 2413 }, 2414 "maxSize": { 2415 "regex": "none", 2416 "alertText": "* Maximum ", 2417 "alertText2": " characters allowed" 2418 }, 2419 "groupRequired": { 2420 "regex": "none", 2421 "alertText": "* You must fill one of the following fields", 2422 "alertTextCheckboxMultiple": "* Please select an option", 2423 "alertTextCheckboxe": "* This checkbox is required" 2424 }, 2425 "min": { 2426 "regex": "none", 2427 "alertText": "* Minimum value is " 2428 }, 2429 "max": { 2430 "regex": "none", 2431 "alertText": "* Maximum value is " 2432 }, 2433 "past": { 2434 "regex": "none", 2435 "alertText": "* Date prior to " 2436 }, 2437 "future": { 2438 "regex": "none", 2439 "alertText": "* Date past " 2440 }, 2441 "maxCheckbox": { 2442 "regex": "none", 2443 "alertText": "* Maximum ", 2444 "alertText2": " options allowed" 2445 }, 2446 "minCheckbox": { 2447 "regex": "none", 2448 "alertText": "* Please select ", 2449 "alertText2": " options" 2450 }, 2451 "equals": { 2452 "regex": "none", 2453 "alertText": "* Fields do not match" 2454 }, 2455 "creditCard": { 2456 "regex": "none", 2457 "alertText": "* Invalid credit card number" 2458 }, 2459 "phone": { 2460 // credit: jquery.h5validate.js / orefalo 2461 "regex": /^([\+][0-9]{1,3}([ \.\-])?)?([\(][0-9]{1,6}[\)])?([0-9 \.\-]{1,32})(([A-Za-z \:]{1,11})?[0-9]{1,4}?)$/, 2462 "alertText": "* Invalid phone number" 2463 }, 2464 "email": { 2465 // HTML5 compatible email regex ( http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html# e-mail-state-%28type=email%29 ) 2466 "regex": /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/, 2467 "alertText": "* Invalid email address" 2468 }, 2469 "fullname": { 2470 "regex":/^([a-zA-Z]+[\'\,\.\-]?[a-zA-Z ]*)+[ ]([a-zA-Z]+[\'\,\.\-]?[a-zA-Z ]+)+$/, 2471 "alertText":"* Must be first and last name" 2472 }, 2473 "zip": { 2474 "regex":/^\d{5}$|^\d{5}-\d{4}$/, 2475 "alertText":"* Invalid zip format" 2476 }, 2477 "integer": { 2478 "regex": /^[\-\+]?\d+$/, 2479 "alertText": "* Not a valid integer" 2480 }, 2481 "number": { 2482 // Number, including positive, negative, and floating decimal. credit: orefalo 2483 "regex": /^[\-\+]?((([0-9]{1,3})([,][0-9]{3})*)|([0-9]+))?([\.]([0-9]+))?$/, 2484 "alertText": "* Invalid floating decimal number" 2485 }, 2486 "date": { 2487 // Check if date is valid by leap year 2488 "func": function (field) { 2489 var pattern = new RegExp(/^(\d{4})[\/\-\.](0?[1-9]|1[012])[\/\-\.](0?[1-9]|[12][0-9]|3[01])$/); 2490 var match = pattern.exec(field.val()); 2491 if (match == null) 2492 return false; 2493 2494 var year = match[1];
2495 var month = match[2]*1; 2496 var day = match[3]*1; 2497 var date = new Date(year, month - 1, day); // because months starts from 0. 2498 2499 return (date.getFullYear() == year && date.getMonth() == (month - 1) && date.getDate() == day); 2500 }, 2501 "alertText": "* Invalid date, must be in YYYY-MM-DD format" 2502 }, 2503 "ipv4": { 2504 "regex": /^((([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))[.]){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))$/, 2505 "alertText": "* Invalid IP address" 2506 }, 2507 "url": { 2508 "regex": /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i, 2509 "alertText": "* Invalid URL" 2510 }, 2511 "onlyNumberSp": { 2512 "regex": /^[0-9\ ]+$/, 2513 "alertText": "* Numbers only" 2514 }, 2515 "onlyLetterSp": { 2516 "regex": /^[a-zA-Z\ \']+$/, 2517 "alertText": "* Letters only" 2518 }, 2519 "onlyLetterAccentSp":{ 2520 "regex": /^[a-z\u00C0-\u017F\ ]+$/i, 2521 "alertText": "* Letters only (accents allowed)" 2522 }, 2523 "onlyLetterNumber": { 2524 "regex": /^[0-9a-zA-Z]+$/, 2525 "alertText": "* No special characters allowed" 2526 }, 2527 // --- CUSTOM RULES -- Those are specific to the demos, they can be removed or changed to your likings 2528 "ajaxUserCall": { 2529 "url": "ajaxValidateFieldUser", 2530 // you may want to pass extra data on the ajax call 2531 "extraData": "name=eric", 2532 "alertText": "* This user is already taken", 2533 "alertTextLoad": "* Validating, please wait" 2534 }, 2535 "ajaxUserCallPhp": { 2536 "url": "phpajax/ajaxValidateFieldUser.php", 2537 // you may want to pass extra data on the ajax call 2538 "extraData": "name=eric", 2539 // if you provide an "alertTextOk", it will show as a green prompt when the field validates 2540 "alertTextOk": "* This username is available", 2541 "alertText": "* This user is already taken", 2542 "alertTextLoad": "* Validating, please wait" 2543 }, 2544 "ajaxNameCall": { 2545 // remote json service location 2546 "url": "ajaxValidateFieldName", 2547 // error 2548 "alertText": "* This name is already taken", 2549 // if you provide an "alertTextOk", it will show as a green prompt when the field validates 2550 "alertTextOk": "* This name is available", 2551 // speaks by itself 2552 "alertTextLoad": "* Validating, please wait" 2553 }, 2554 "ajaxNameCallPhp": { 2555 // remote json service location 2556 "url": "phpajax/ajaxValidateFieldName.php", 2557 // error 2558 "alertText": "* This name is already taken", 2559 // speaks by itself 2560 "alertTextLoad": "* Validating, please wait" 2561 }, 2562 "validate2fields": { 2563 "alertText": "* Please input HELLO" 2564 }, 2565 //tls warning:homegrown not fielded 2566 "dateFormat":{ 2567 "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$|^(?:(?:(?
2567:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(?:(?:0?[1-9]|1[0-2])(\/|-)(?:0?[1-9]|1\d|2[0-8]))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(0?2(\/|-)29)(\/|-)(?:(?:0[48]00|[13579][26]00|[2468][048]00)|(?:\d\d)?(?:0[48]|[2468][048]|[13579][26]))$/, 2568 "alertText": "* Invalid Date" 2569 }, 2570 //tls warning:homegrown not fielded 2571 "dateTimeFormat": { 2572 "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1}$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^((1[012]|0?[1-9]){1}\/(0?[1-9]|[12][0-9]|3[01]){1}\/\d{2,4}\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1})$/, 2573 "alertText": "* Invalid Date or Date Format", 2574 "alertText2": "Expected Format: ", 2575 "alertText3": "mm/dd/yyyy hh:mm:ss AM|PM or ", 2576 "alertText4": "yyyy-mm-dd hh:mm:ss AM|PM" 2577 } 2578 }; 2579 2580 } 2581 }; 2582 2583 $.validationEngineLanguage.newLang(); 2584 2585})(jQuery18); 2586 2587break; 2588default: 2589(function($){ 2590 $.fn.validationEngineLanguage = function(){ 2591 }; 2592 $.validationEngineLanguage = { 2593 newLang: function(){ 2594 $.validationEngineLanguage.allRules = { 2595 "required": { // Add your regex rules here, you can take telephone as an example 2596 "regex": "none", 2597 "alertText": "* This field is required", 2598 "alertTextCheckboxMultiple": "* Please select an option", 2599 "alertTextCheckboxe": "* This checkbox is required", 2600 "alertTextDateRange": "* Both date range fields are required" 2601 }, 2602 "requiredInFunction": { 2603 "func": function(field, rules, i, options){ 2604 return (field.val() == "test") ? true : false; 2605 }, 2606 "alertText": "* Field must equal test" 2607 }, 2608 "dateRange": { 2609 "regex": "none", 2610 "alertText": "* Invalid ", 2611 "alertText2": "Date Range" 2612 }, 2613 "dateTimeRange": { 2614 "regex": "none", 2615 "alertText": "* Invalid ", 2616 "alertText2": "Date Time Range" 2617 }, 2618 "minSize": { 2619 "regex": "none", 2620 "alertText": "* Minimum ", 2621 "alertText2": " characters required" 2622 }, 2623 "maxSize": { 2624 "regex": "none", 2625 "alertText": "* Maximum ", 2626 "alertText2": " characters allowed" 2627 }, 2628 "groupRequired": { 2629 "regex": "none", 2630 "alertText": "* You must fill one of the following fields", 2631 "alertTextCheckboxMultiple": "* Please select an option", 2632 "alertTextCheckboxe": "* This checkbox is required" 2633 }, 2634 "min": { 2635 "regex": "none", 2636 "alertText": "* Minimum value is " 2637 }, 2638 "max": { 2639 "regex": "none", 2640 "alertText": "* Maximum value is " 2641 }, 2642 "past": { 2643 "regex": "none", 2644 "alertText": "* Date prior to " 2645 }, 2646 "future": { 2647 "regex": "none", 2648 "alertText": "* Date past " 2649 }, 2650 "maxCheckbox": { 2651 "regex": "none", 2652 "alertText": "* Maximum ", 2653 "alertText2": " options allowed" 2654 }, 2655 "minCheckbox": { 2656 "regex": "none", 2657 "alertText": "* Please select ", 2658 "alertText2": " options" 2659 }, 2660 "equals": { 2661 "regex": "none", 2662 "alertText": "* Fields do not match" 2663 }, 2664 "creditCard": { 2665 "regex": "none", 2666 "alertText": "* Invalid credit card number" 2667 }, 2668 "phone": { 2669 // credit: jquery.h5validate.js / orefalo 2670 "regex": /^([\+][0-9]{1,3}([ \.\-])?)?([\(][0-9]{1,6}[\)])?([0-9 \.\-]{1,32})(([A-Za-z \:]{1,11})?[0-9]{1,4}?)$/, 2671 "alertText": "* Invalid phone number" 2672 }, 2673 "email": { 2674 // HTML5 compatible email regex ( http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html# e-mail-state-%28type=email%29 ) 2675 "regex": /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/, 2676 "alertText": "* Invalid email address" 2677 }, 2678 "fullname": { 2679 "regex":/^([a-zA-Z]+[\'\,\.\-]?[a-zA-Z ]*)+[ ]([a-zA-Z]+[\'\,\.\-]?[a-zA-Z ]+)+$/, 2680 "alertText":"* Must be first and last name" 2681 }, 2682 "zip": { 2683 "regex":/^\d{5}$|^\d{5}-\d{4}$/, 2684 "alertText":"* Invalid zip format" 2685 }, 2686 "integer": { 2687 "regex": /^[\-\+]?\d+$/, 2688 "alertText": "* Not a valid integer" 2689 }, 2690 "number": { 2691 // Number, including positive, negative, and floating decimal. credit: orefalo 2692 "regex": /^[\-\+]?((([0-9]{1,3})([,][0-9]{3})*)|([0-9]+))?([\.]([0-9]+))?$/, 2693 "alertText": "* Invalid floating decimal number" 2694 }, 2695 "date": { 2696 // Check if date is valid by leap year 2697 "func": function (field) { 2698 var pattern = new RegExp(/^(\d{4})[\/\-\.](0?[1-9]|1[012])[\/\-\.](0?[1-9]|[12][0-9]|3[01])$/); 2699 var match = pattern.exec(field.val()); 2700 if (match == null) 2701 return false; 2702 2703 var year = match[1];
2704 var month = match[2]*1; 2705 var day = match[3]*1; 2706 var date = new Date(year, month - 1, day); // because months starts from 0. 2707 2708 return (date.getFullYear() == year && date.getMonth() == (month - 1) && date.getDate() == day); 2709 }, 2710 "alertText": "* Invalid date, must be in YYYY-MM-DD format" 2711 }, 2712 "ipv4": { 2713 "regex": /^((([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))[.]){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))$/, 2714 "alertText": "* Invalid IP address" 2715 }, 2716 "url": { 2717 "regex": /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i, 2718 "alertText": "* Invalid URL" 2719 }, 2720 "onlyNumberSp": { 2721 "regex": /^[0-9\ ]+$/, 2722 "alertText": "* Numbers only" 2723 }, 2724 "onlyLetterSp": { 2725 "regex": /^[a-zA-Z\ \']+$/, 2726 "alertText": "* Letters only" 2727 }, 2728 "onlyLetterAccentSp":{ 2729 "regex": /^[a-z\u00C0-\u017F\ ]+$/i, 2730 "alertText": "* Letters only (accents allowed)" 2731 }, 2732 "onlyLetterNumber": { 2733 "regex": /^[0-9a-zA-Z]+$/, 2734 "alertText": "* No special characters allowed" 2735 }, 2736 // --- CUSTOM RULES -- Those are specific to the demos, they can be removed or changed to your likings 2737 "ajaxUserCall": { 2738 "url": "ajaxValidateFieldUser", 2739 // you may want to pass extra data on the ajax call 2740 "extraData": "name=eric", 2741 "alertText": "* This user is already taken", 2742 "alertTextLoad": "* Validating, please wait" 2743 }, 2744 "ajaxUserCallPhp": { 2745 "url": "phpajax/ajaxValidateFieldUser.php", 2746 // you may want to pass extra data on the ajax call 2747 "extraData": "name=eric", 2748 // if you provide an "alertTextOk", it will show as a green prompt when the field validates 2749 "alertTextOk": "* This username is available", 2750 "alertText": "* This user is already taken", 2751 "alertTextLoad": "* Validating, please wait" 2752 }, 2753 "ajaxNameCall": { 2754 // remote json service location 2755 "url": "ajaxValidateFieldName", 2756 // error 2757 "alertText": "* This name is already taken", 2758 // if you provide an "alertTextOk", it will show as a green prompt when the field validates 2759 "alertTextOk": "* This name is available", 2760 // speaks by itself 2761 "alertTextLoad": "* Validating, please wait" 2762 }, 2763 "ajaxNameCallPhp": { 2764 // remote json service location 2765 "url": "phpajax/ajaxValidateFieldName.php", 2766 // error 2767 "alertText": "* This name is already taken", 2768 // speaks by itself 2769 "alertTextLoad": "* Validating, please wait" 2770 }, 2771 "validate2fields": { 2772 "alertText": "* Please input HELLO" 2773 }, 2774 //tls warning:homegrown not fielded 2775 "dateFormat":{ 2776 "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$|^(?:(?:(?
2776:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(?:(?:0?[1-9]|1[0-2])(\/|-)(?:0?[1-9]|1\d|2[0-8]))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(0?2(\/|-)29)(\/|-)(?:(?:0[48]00|[13579][26]00|[2468][048]00)|(?:\d\d)?(?:0[48]|[2468][048]|[13579][26]))$/, 2777 "alertText": "* Invalid Date" 2778 }, 2779 //tls warning:homegrown not fielded 2780 "dateTimeFormat": { 2781 "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1}$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^((1[012]|0?[1-9]){1}\/(0?[1-9]|[12][0-9]|3[01]){1}\/\d{2,4}\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1})$/, 2782 "alertText": "* Invalid Date or Date Format", 2783 "alertText2": "Expected Format: ", 2784 "alertText3": "mm/dd/yyyy hh:mm:ss AM|PM or ", 2785 "alertText4": "yyyy-mm-dd hh:mm:ss AM|PM" 2786 } 2787 }; 2788 2789 } 2790 }; 2791 2792 $.validationEngineLanguage.newLang(); 2793 2794})(jQuery18); 2795 2796break; 2797} 2798} 2799 2800function InitFormValidation() 2801{ 2802 (function($) { 2803 2804 "use strict"; 2805 2806 var methods = { 2807 2808 /** 2809 * Kind of the constructor, called before any action 2810 * @param {Map} user options 2811 */ 2812 init: function(options) { 2813 var form = this; 2814 if (!form.data('jqv') || form.data('jqv') == null ) { 2815 options = methods._saveOptions(form, options); 2816 // bind all formError elements to close on click 2817 $(document).on("click", ".formError", function() { 2818 $(this).fadeOut(150, function() { 2819 // remove prompt once invisible 2820 $(this).closest('.formErrorOuter').remove(); 2821 }); 2822 }); 2823 } 2824 return this; 2825 }, 2826 /** 2827 * Attachs jQuery.validationEngine to form.submit and field.blur events 2828 * Takes an optional params: a list of options 2829 * ie. jQuery("#formID1").validationEngine('attach', {promptPosition : "centerRight"}); 2830 */ 2831 attach: function(userOptions) { 2832 2833 var form = this; 2834 var options; 2835 2836 if(userOptions) 2837 options = methods._saveOptions(form, userOptions); 2838 else 2839 options = form.data('jqv'); 2840 2841 options.validateAttribute = (form.find("[data-validation-engine*=validate]").length) ? "data-validation-engine" : "class"; 2842 if (options.binded) { 2843 2844 // delegate fields 2845 form.on(options.validationEventTrigger, "["+options.validateAttribute+"*=validate]:not([type=checkbox]):not([type=radio]):not(.datepicker)", methods._onFieldEvent); 2846 form.on("click", "["+options.validateAttribute+"*=validate][type=checkbox],["+options.validateAttribute+"*=validate][type=radio]", methods._onFieldEvent); 2847 form.on(options.validationEventTrigger,"["+options.validateAttribute+"*=validate][class*=datepicker]", {"delay": 300}, methods._onFieldEvent); 2848 } 2849 if (options.autoPositionUpdate) { 2850 $(window).bind("resize", { 2851 "noAnimation": true, 2852 "formElem": form 2853 }, methods.updatePromptsPosition); 2854 } 2855 form.on("click","a[data-validation-engine-skip], a[class*='validate-skip'], button[data-validation-engine-skip], button[class*='validate-skip'], input[data-validation-engine-skip], input[class*='validate-skip']", methods._submitButtonClick); 2856 form.removeData('jqv_submitButton'); 2857 2858 // bind form.submit 2859 form.on("submit", methods._onSubmitEvent); 2860 return this; 2861 }, 2862 /** 2863 * Unregisters any bindings that may point to jQuery.validaitonEngine 2864 */ 2865 detach: function() { 2866 2867 var form = this; 2868 var options = form.data('jqv'); 2869 2870 // unbind fields 2871 form.off(options.validationEventTrigger, "["+options.validateAttribute+"*=validate]:not([type=checkbox]):not([type=radio]):not(.datepicker)", methods._onFieldEvent); 2872 form.off("click", "["+options.validateAttribute+"*=validate][type=checkbox],["+options.validateAttribute+"*=validate][type=radio]", methods._onFieldEvent); 2873 form.off(options.validationEventTrigger,"["+options.validateAttribute+"*=validate][class*=datepicker]", methods._onFieldEvent); 2874 2875 // unbind form.submit 2876 form.off("submit", methods._onSubmitEvent); 2877 form.removeData('jqv'); 2878 2879 form.off("click", "a[data-validation-engine-skip], a[class*='validate-skip'], button[data-validation-engine-skip], button[class*='validate-skip'], input[data-validation-engine-skip], input[class*='validate-skip']", methods._submitButtonClick); 2880 form.removeData('jqv_submitButton'); 2881 2882 if (options.autoPositionUpdate) 2883 $(window).off("resize", methods.updatePromptsPosition); 2884 2885 return this; 2886 }, 2887 /** 2888 * Validates either a form or a list of fields, shows prompts accordingly. 2889 * Note: There is no ajax form validation with this method, only field ajax validation are evaluated 2890 * 2891 * @return true if the form validates, false if it fails 2892 */ 2893 validate: function(userOptions) { 2894 var element = $(this);
2895 var valid = null; 2896 var options; 2897 2898 if (element.is("form") || element.hasClass("validationEngineContainer")) { 2899 if (element.hasClass('validating')) { 2900 // form is already validating. 2901 // Should abort old validation and start new one. I don't know how to implement it. 2902 return false; 2903 } else { 2904 element.addClass('validating'); 2905 if(userOptions) 2906 options = methods._saveOptions(element, userOptions); 2907 else 2908 options = element.data('jqv'); 2909 var valid = methods._validateFields(this); 2910 2911 // If the form doesn't validate, clear the 'validating' class before the user has a chance to submit again 2912 setTimeout(function(){ 2913 element.removeClass('validating'); 2914 }, 100); 2915 if (valid && options.onSuccess) { 2916 options.onSuccess(); 2917 } else if (!valid && options.onFailure) { 2918 options.onFailure(); 2919 } 2920 } 2921 } else if (element.is('form') || element.hasClass('validationEngineContainer')) { 2922 element.removeClass('validating'); 2923 } else { 2924 // field validation 2925 var form = element.closest('form, .validationEngineContainer'), 2926 options = (form.data('jqv')) ? form.data('jqv') : $.validationEngine.defaults, 2927 valid = methods._validateField(element, options); 2928 } 2929 if(options.onValidationComplete) { 2930 // !! ensures that an undefined return is interpreted as return false but allows a onValidationComplete() to possibly return true and have form continue processing 2931 return !!options.onValidationComplete(form, valid); 2932 } 2933 return valid; 2934 }, 2935 /** 2936 * Redraw prompts position, useful when you change the DOM state when validating 2937 */ 2938 updatePromptsPosition: function(event) { 2939 2940 if (event && this == window) { 2941 var form = event.data.formElem; 2942 var noAnimation = event.data.noAnimation; 2943 } 2944 else 2945 var form = $(this.closest('form, .validationEngineContainer')); 2946 2947 var options = form.data('jqv'); 2948 // No option, take default one 2949 if (!options) 2950 options = methods._saveOptions(form, options); 2951 form.find('['+options.validateAttribute+'*=validate]').not(":disabled").each(function(){ 2952 var field = $(this); 2953 if (options.prettySelect && field.is(":hidden")) 2954 field = form.find("#" + options.usePrefix + field.attr('id') + options.useSuffix); 2955 var prompt = methods._getPrompt(field); 2956 var promptText = $(prompt).find(".formErrorContent").html(); 2957 2958 if(prompt) 2959 methods._updatePrompt(field, $(prompt), promptText, undefined, false, options, noAnimation); 2960 }); 2961 return this; 2962 }, 2963 /** 2964 * Displays a prompt on a element. 2965 * Note that the element needs an id! 2966 * 2967 * @param {String} promptText html text to display type 2968 * @param {String} type the type of bubble: 'pass' (green), 'load' (black) anything else (red) 2969 * @param {String} possible values topLeft, topRight, bottomLeft, centerRight, bottomRight 2970 */ 2971 showPrompt: function(promptText, type, promptPosition, showArrow) { 2972 var form = this.closest('form, .validationEngineContainer'); 2973 var options = form.data('jqv'); 2974 // No option, take default one 2975 if(!options) 2976 options = methods._saveOptions(this, options); 2977 if(promptPosition) 2978 options.promptPosition=promptPosition; 2979 options.showArrow = showArrow==true; 2980 2981 methods._showPrompt(this, promptText, type, false, options); 2982 return this; 2983 }, 2984 /** 2985 * Closes form error prompts, CAN be invidual 2986 */ 2987 hide: function() { 2988 var form = $(this).closest('form, .validationEngineContainer'); 2989 var options = form.data('jqv'); 2990 // No option, take default one 2991 if (!options) 2992 options = methods._saveOptions(form, options); 2993 var fadeDuration = (options && options.fadeDuration) ? options.fadeDuration : 0.3; 2994 var closingtag; 2995
2996 if($(this).is("form") || $(this).hasClass("validationEngineContainer")) { 2997 closingtag = "parentForm"+methods._getClassName($(this).attr("id")); 2998 } else { 2999 closingtag = methods._getClassName($(this).attr("id")) +"formError"; 3000 } 3001 $('.'+closingtag).fadeTo(fadeDuration, 0.3, function() { 3002 $(this).closest('.formErrorOuter').remove(); 3003 }); 3004 return this; 3005 }, 3006 /** 3007 * Closes all error prompts on the page 3008 */ 3009 hideAll: function() { 3010 3011 var form = this; 3012 var options = form.data('jqv'); 3013 var duration = options ? options.fadeDuration:300; 3014 $('.formError').fadeTo(duration, 300, function() { 3015 $(this).closest('.formErrorOuter').remove(); 3016 }); 3017 return this; 3018 }, 3019 /** 3020 * Typically called when user exists a field using tab or a mouse click, triggers a field 3021 * validation 3022 */ 3023 _onFieldEvent: function(event) { 3024 var field = $(this); 3025 var form = field.closest('form, .validationEngineContainer'); 3026 var options = form.data('jqv'); 3027 // No option, take default one 3028 if (!options) 3029 options = methods._saveOptions(form, options); 3030 options.eventTrigger = "field"; 3031 3032 if (options.notEmpty == true){ 3033 3034 if(field.val().length > 0){ 3035 // validate the current field 3036 window.setTimeout(function() { 3037 methods._validateField(field, options); 3038 }, (event.data) ? event.data.delay : 0); 3039 3040 } 3041 3042 }else{ 3043 3044 // validate the current field 3045 window.setTimeout(function() { 3046 methods._validateField(field, options); 3047 }, (event.data) ? event.data.delay : 0); 3048 3049 } 3050 3051 3052 3053 3054 }, 3055 /** 3056 * Called when the form is submited, shows prompts accordingly 3057 * 3058 * @param {jqObject} 3059 * form 3060 * @return false if form submission needs to be cancelled 3061 */ 3062 _onSubmitEvent: function() { 3063 var form = $(this); 3064 var options = form.data('jqv'); 3065 3066 //check if it is trigger from skipped button 3067 if (form.data("jqv_submitButton")){ 3068 var submitButton = $("#" + form.data("jqv_submitButton")); 3069 if (submitButton){ 3070 if (submitButton.length > 0){
3071 if (submitButton.hasClass("validate-skip") || submitButton.attr("data-validation-engine-skip") == "true") 3072 return true; 3073 } 3074 } 3075 } 3076 3077 options.eventTrigger = "submit"; 3078 3079 // validate each field 3080 // (- skip field ajax validation, not necessary IF we will perform an ajax form validation) 3081 var r=methods._validateFields(form); 3082 3083 if (r && options.ajaxFormValidation) { 3084 methods._validateFormWithAjax(form, options); 3085 // cancel form auto-submission - process with async call onAjaxFormComplete 3086 return false; 3087 } 3088 3089 if(options.onValidationComplete) { 3090 // !! ensures that an undefined return is interpreted as return false but allows a onValidationComplete() to possibly return true and have form continue processing 3091 return !!options.onValidationComplete(form, r); 3092 } 3093 return r; 3094 }, 3095 /** 3096 * Return true if the ajax field validations passed so far 3097 * @param {Object} options 3098 * @return true, is all ajax validation passed so far (remember ajax is async) 3099 */ 3100 _checkAjaxStatus: function(options) { 3101 var status = true; 3102 $.each(options.ajaxValidCache, function(key, value) { 3103 if (!value) { 3104 status = false; 3105 // break the each 3106 return false; 3107 } 3108 }); 3109 return status; 3110 }, 3111 3112 /** 3113 * Return true if the ajax field is validated 3114 * @param {String} fieldid 3115 * @param {Object} options 3116 * @return true, if validation passed, false if false or doesn't exist 3117 */ 3118 _checkAjaxFieldStatus: function(fieldid, options) { 3119 return options.ajaxValidCache[fieldid] == true; 3120 }, 3121 /** 3122 * Validates form fields, shows prompts accordingly 3123 * 3124 * @param {jqObject} 3125 * form 3126 * @param {skipAjaxFieldValidation} 3127 * boolean - when set to true, ajax field validation is skipped, typically used when the submit button is clicked 3128 * 3129 * @return true if form is valid, false if not, undefined if ajax form validation is done 3130 */ 3131 _validateFields: function(form) { 3132 var options = form.data('jqv'); 3133 3134 // this variable is set to true if an error is found 3135 var errorFound = false; 3136 3137 // Trigger hook, start validation 3138 form.trigger("jqv.form.validating"); 3139 // first, evaluate status of non ajax fields 3140 var first_err=null; 3141 form.find('['+options.validateAttribute+'*=validate]').not(":disabled").each( function() { 3142 var field = $(this); 3143 var names = []; 3144 if ($.inArray(field.attr('name'), names) < 0) { 3145 errorFound |= methods._validateField(field, options); 3146 if (errorFound && first_err==null) 3147 if (field.is(":hidden") && options.prettySelect) 3148 first_err = field = form.find("#" + options.usePrefix + methods._jqSelector(field.attr('id')) + options.useSuffix); 3149 else { 3150 3151 //Check if we need to adjust what element to show the prompt on 3152 //and and such scroll to instead 3153 if(field.data('jqv-prompt-at') instanceof jQuery ){ 3154 field = field.data('jqv-prompt-at'); 3155 } else if(field.data('jqv-prompt-at')) { 3156 field = $(field.data('jqv-prompt-at')); 3157 } 3158 first_err=field; 3159 } 3160 if (options.doNotShowAllErrosOnSubmit) 3161 return false; 3162 names.push(field.attr('name')); 3163 3164 //if option set, stop checking validation rules after one error is found 3165 if(options.showOneMessage == true && errorFound){ 3166 return false; 3167 } 3168 } 3169 }); 3170 3171 // second, check to see if all ajax calls completed ok 3172 // errorFound |= !methods._checkAjaxStatus(options); 3173 3174 // third, check status and scroll the container accordingly 3175 form.trigger("jqv.form.result", [errorFound]); 3176 3177 if (errorFound) { 3178 if (options.scroll) { 3179 var destination=first_err.offset().top; 3180 var fixleft = first_err.offset().left; 3181 3182 //prompt positioning adjustment support. Usage: positionType:Xshift,Yshift (for ex.: bottomLeft:+20 or bottomLeft:-20,+10) 3183 var positionType=options.promptPosition; 3184 if (typeof(positionType)=='string' && positionType.indexOf(":")!=-1) 3185 positionType=positionType.substring(0,positionType.indexOf(":")); 3186 3187 if (positionType!="bottomRight" && positionType!="bottomLeft") { 3188 var prompt_err= methods._getPrompt(first_err); 3189 if (prompt_err) { 3190 destination=prompt_err.offset().top; 3191 } 3192 } 3193 3194 // Offset the amount the page scrolls by an amount in px to accomodate fixed elements at top of page 3195 if (options.scrollOffset) { 3196 destination -= options.scrollOffset; 3197 } 3198 3199 // get the position of the first error, there should be at least one, no need to check this 3200 //var destination = form.find(".formError:not('.greenPopup'):first").offset().top; 3201 if (options.isOverflown) { 3202 var overflowDIV = $(options.overflownDIV); 3203 if(!overflowDIV.length) return false; 3204 var scrollContainerScroll = overflowDIV.scrollTop(); 3205 var scrollContainerPos = -parseInt(overflowDIV.offset().top); 3206
3207 destination += scrollContainerScroll + scrollContainerPos - 5; 3208 var scrollContainer = $(options.overflownDIV).filter(":not(:animated)"); 3209 3210 scrollContainer.animate({ scrollTop: destination }, 1100, function(){ 3211 if(options.focusFirstField) first_err.focus(); 3212 }); 3213 3214 } else { 3215 $("html, body").animate({ 3216 scrollTop: destination 3217 }, 1100, function(){ 3218 if(options.focusFirstField) first_err.focus(); 3219 }); 3220 $("html, body").animate({scrollLeft: fixleft},1100) 3221 } 3222 3223 } else if(options.focusFirstField) 3224 first_err.focus(); 3225 return false; 3226 } 3227 return true; 3228 }, 3229 /** 3230 * This method is called to perform an ajax form validation. 3231 * During this process all the (field, value) pairs are sent to the server which returns a list of invalid fields or true 3232 * 3233 * @param {jqObject} form 3234 * @param {Map} options 3235 */ 3236 _validateFormWithAjax: function(form, options) { 3237 3238 var data = form.serialize(); 3239 var type = (options.ajaxFormValidationMethod) ? options.ajaxFormValidationMethod : "GET"; 3240 var url = (options.ajaxFormValidationURL) ? options.ajaxFormValidationURL : form.attr("action"); 3241 var dataType = (options.dataType) ? options.dataType : "json"; 3242 $.ajax({ 3243 type: type, 3244 url: url, 3245 cache: false, 3246 dataType: dataType, 3247 data: data, 3248 form: form, 3249 methods: methods, 3250 options: options, 3251 beforeSend: function() { 3252 return options.onBeforeAjaxFormValidation(form, options); 3253 }, 3254 error: function(data, transport) { 3255 if (options.onFailure) { 3256 options.onFailure(data, transport); 3257 } else { 3258 methods._ajaxError(data, transport); 3259 } 3260 }, 3261 success: function(json) { 3262 if ((dataType == "json") && (json !== true)) { 3263 // getting to this case doesn't necessary means that the form is invalid 3264 // the server may return green or closing prompt actions 3265 // this flag helps figuring it out 3266 var errorInForm=false; 3267 for (var i = 0; i < json.length; i++) { 3268 var value = json[i]; 3269 3270 var errorFieldId = value[0]; 3271 var errorField = $($("#" + errorFieldId)[0]); 3272 3273 // make sure we found the element 3274 if (errorField.length == 1) { 3275 3276 // promptText or selector 3277 var msg = value[2]; 3278 // if the field is valid 3279 if (value[1] == true) { 3280 3281 if (msg == "" || !msg){ 3282 // if for some reason, status==true and error="", just close the prompt 3283 methods._closePrompt(errorField); 3284 } else { 3285 // the field is valid, but we are displaying a green prompt 3286 if (options.allrules[msg]) { 3287 var txt = options.allrules[msg].alertTextOk; 3288 if (txt) 3289 msg = txt; 3290 } 3291 if (options.showPrompts) methods._showPrompt(errorField, msg, "pass", false, options, true); 3292 } 3293 } else { 3294 // the field is invalid, show the red error prompt 3295 errorInForm|=true; 3296 if (options.allrules[msg]) { 3297 var txt = options.allrules[msg].alertText; 3298 if (txt) 3299 msg = txt; 3300 } 3301 if(options.showPrompts) methods._showPrompt(errorField, msg, "", false, options, true); 3302 } 3303 } 3304 } 3305 options.onAjaxFormComplete(!errorInForm, form, json, options); 3306 } else 3307 options.onAjaxFormComplete(true, form, json, options); 3308 3309 } 3310 }); 3311 3312 }, 3313 /** 3314 * Validates field, shows prompts accordingly 3315 * 3316 * @param {jqObject} 3317 * field 3318 * @param {Array[String]} 3319 * field's validation rules 3320 * @param {Map} 3321 * user options 3322 * @return false if field is valid (It is inversed for *fields*, it return false on validate and true on errors.) 3323 */ 3324 _validateField: function(field, options, skipAjaxValidation) { 3325 if (!field.attr("id")) { 3326 field.attr("id", "form-validation-field-" + $.validationEngine.fieldIdCounter); 3327 ++$.validationEngine.fieldIdCounter; 3328 } 3329 3330 if(field.hasClass(options.ignoreFieldsWithClass)) 3331 return false; 3332 3333 if (!options.validateNonVisibleFields && (field.is(":hidden") && !options.prettySelect || field.parent().is(":hidden"))) 3334 return false; 3335 3336 var rulesParsing = field.attr(options.validateAttribute); 3337 var getRules = /validate\[(.*)\]/.exec(rulesParsing); 3338 3339 if (!getRules) 3340 return false; 3341 var str = getRules[1]; 3342 var rules = str.split(/\[|,|\]/); 3343
3344 // true if we ran the ajax validation, tells the logic to stop messing with prompts 3345 var isAjaxValidator = false; 3346 var fieldName = field.attr("name"); 3347 var promptText = ""; 3348 var promptType = ""; 3349 var required = false; 3350 var limitErrors = false; 3351 options.isError = false; 3352 options.showArrow = true; 3353 3354 // If the programmer wants to limit the amount of error messages per field, 3355 if (options.maxErrorsPerField > 0) { 3356 limitErrors = true; 3357 } 3358 3359 var form = $(field.closest("form, .validationEngineContainer")); 3360 // Fix for adding spaces in the rules 3361 for (var i = 0; i < rules.length; i++) { 3362 rules[i] = rules[i].replace(" ", ""); 3363 // Remove any parsing errors 3364 if (rules[i] === '') { 3365 delete rules[i]; 3366 } 3367 } 3368 3369 for (var i = 0, field_errors = 0; i < rules.length; i++) { 3370 3371 // If we are limiting errors, and have hit the max, break 3372 if (limitErrors && field_errors >= options.maxErrorsPerField) { 3373 // If we haven't hit a required yet, check to see if there is one in the validation rules for this 3374 // field and that it's index is greater or equal to our current index 3375 if (!required) { 3376 var have_required = $.inArray('required', rules); 3377 required = (have_required != -1 && have_required >= i); 3378 } 3379 break; 3380 } 3381 3382 3383 var errorMsg = undefined; 3384 switch (rules[i]) { 3385 3386 case "required": 3387 required = true; 3388 errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._required); 3389 break; 3390 case "custom": 3391 errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._custom); 3392 break; 3393 case "groupRequired": 3394 // Check is its the first of group, if not, reload validation with first field 3395 // AND continue normal validation on present field 3396 var classGroup = "["+options.validateAttribute+"*=" +rules[i + 1] +"]"; 3397 var firstOfGroup = form.find(classGroup).eq(0); 3398 if(firstOfGroup[0] != field[0]){ 3399 3400 methods._validateField(firstOfGroup, options, skipAjaxValidation); 3401 options.showArrow = true; 3402 3403 } 3404 errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._groupRequired); 3405 if(errorMsg) required = true; 3406 options.showArrow = false; 3407 break; 3408 case "ajax": 3409 // AJAX defaults to returning it's loading message 3410 errorMsg = methods._ajax(field, rules, i, options); 3411 if (errorMsg) { 3412 promptType = "load"; 3413 } 3414 break; 3415 case "minSize": 3416 errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._minSize); 3417 break; 3418 case "maxSize": 3419 errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._maxSize); 3420 break; 3421 case "min": 3422 errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._min); 3423 break; 3424 case "max": 3425 errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._max); 3426 break; 3427 case "past": 3428 errorMsg = methods._getErrorMessage(form, field,rules[i], rules, i, options, methods._past); 3429 break; 3430 case "future": 3431 errorMsg = methods._getErrorMessage(form, field,rules[i], rules, i, options, methods._future); 3432 break; 3433 case "dateRange": 3434 var classGroup = "["+options.validateAttribute+"*=" + rules[i + 1] + "]"; 3435 options.firstOfGroup = form.find(classGroup).eq(0); 3436 options.secondOfGroup = form.find(classGroup).eq(1); 3437 3438 //if one entry out of the pair has value then proceed to run through validation 3439 if (options.firstOfGroup[0].value || options.secondOfGroup[0].value) { 3440 errorMsg = methods._getErrorMessage(form, field,rules[i], rules, i, options, methods._dateRange); 3441 } 3442 if (errorMsg) required = true; 3443 options.showArrow = false; 3444 break; 3445 3446 case "dateTimeRange": 3447 var classGroup = "["+options.validateAttribute+"*=" + rules[i + 1] + "]"; 3448 options.firstOfGroup = form.find(classGroup).eq(0); 3449 options.secondOfGroup = form.find(classGroup).eq(1); 3450 3451 //if one entry out of the pair has value then proceed to run through validation 3452 if (options.firstOfGroup[0].value || options.secondOfGroup[0].value) { 3453 errorMsg = methods._getErrorMessage(form, field,rules[i], rules, i, options, methods._dateTimeRange); 3454 } 3455 if (errorMsg) required = true; 3456 options.showArrow = false; 3457 break; 3458 case "maxCheckbox": 3459 field = $(form.find("input[name='" + fieldName + "']")); 3460 errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._maxCheckbox); 3461 break; 3462 case "minCheckbox": 3463 field = $(form.find("input[name='" + fieldName + "']")); 3464 errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._minCheckbox); 3465 break; 3466 case "equals": 3467 errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._equals); 3468 break; 3469 case "funcCall": 3470 errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._funcCall); 3471 break; 3472 case "creditCard": 3473 errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._creditCard); 3474 break; 3475 case "condRequired": 3476 errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._c
3476ondRequired); 3477 if (errorMsg !== undefined) { 3478 required = true; 3479 } 3480 break; 3481 case "funcCallRequired": 3482 errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._funcCallRequired); 3483 if (errorMsg !== undefined) { 3484 required = true; 3485 } 3486 break; 3487 3488 default: 3489 } 3490 3491 var end_validation = false; 3492 3493 // If we were passed back an message object, check what the status was to determine what to do 3494 if (typeof errorMsg == "object") { 3495 switch (errorMsg.status) { 3496 case "_break": 3497 end_validation = true; 3498 break; 3499 // If we have an error message, set errorMsg to the error message 3500 case "_error": 3501 errorMsg = errorMsg.message; 3502 break; 3503 // If we want to throw an error, but not show a prompt, return early with true 3504 case "_error_no_prompt": 3505 return true; 3506 break; 3507 // Anything else we continue on 3508 default: 3509 break; 3510 } 3511 } 3512 3513 //funcCallRequired, first in rules, and has error, skip anything else 3514 if( i==0 && str.indexOf('funcCallRequired')==0 && errorMsg !== undefined ){ 3515 promptText += errorMsg + "<br/>"; 3516 options.isError=true; 3517 field_errors++; 3518 end_validation=true; 3519 } 3520 3521 // If it has been specified that validation should end now, break 3522 if (end_validation) { 3523 break; 3524 } 3525 3526 // If we have a string, that means that we have an error, so add it to the error message. 3527 if (typeof errorMsg == 'string') { 3528 promptText += errorMsg + "<br/>"; 3529 options.isError = true; 3530 field_errors++; 3531 } 3532 } 3533 // If the rules required is not added, an empty field is not validated 3534 //the 3rd condition is added so that even empty password fields should be equal 3535 //otherwise if one is filled and another left empty, the "equal" condition would fail 3536 //which does not make any sense 3537 if(!required && !(field.val()) && field.val().length < 1 && $.inArray('equals', rules) < 0) options.isError = false; 3538 3539 // Hack for radio/checkbox group button, the validation go into the 3540 // first radio/checkbox of the group 3541 var fieldType = field.prop("type"); 3542 var positionType=field.data("promptPosition") || options.promptPosition; 3543 3544 if ((fieldType == "radio" || fieldType == "checkbox") && form.find("input[name='" + fieldName + "']").size() > 1) { 3545 if(positionType === 'inline') { 3546 field = $(form.find("input[name='" + fieldName + "'][type!=hidden]:last")); 3547 } else { 3548 field = $(form.find("input[name='" + fieldName + "'][type!=hidden]:first")); 3549 } 3550 options.showArrow = options.showArrowOnRadioAndCheckbox; 3551 } 3552 3553 if(field.is(":hidden") && options.prettySelect) { 3554 field = form.find("#" + options.usePrefix + methods._jqSelector(field.attr('id')) + options.useSuffix); 3555 } 3556 3557 if (options.isError && options.showPrompts){ 3558 methods._showPrompt(field, promptText, promptType, false, options); 3559 }else{ 3560 if (!isAjaxValidator) methods._closePrompt(field); 3561 } 3562 3563 if (!isAjaxValidator) { 3564 field.trigger("jqv.field.result", [field, options.isError, promptText]); 3565 } 3566 3567 /* Record error */ 3568 var errindex = $.inArray(field[0], options.InvalidFields); 3569 if (errindex == -1) { 3570 if (options.isError) 3571 options.InvalidFields.push(field[0]); 3572 } else if (!options.isError) { 3573 options.InvalidFields.splice(errindex, 1); 3574 } 3575 3576 methods._handleStatusCssClasses(field, options); 3577 3578 /* run callback function for each field */ 3579 if (options.isError && options.onFieldFailure) 3580 options.onFieldFailure(field); 3581 3582 if (!options.isError && options.onFieldSuccess) 3583 options.onFieldSuccess(field); 3584 3585 return options.isError; 3586 }, 3587 /** 3588 * Handling css classes of fields indicating result of validation 3589 * 3590 * @param {jqObject} 3591 * field 3592 * @param {Array[String]} 3593 * field's validation rules 3594 * @private 3595 */ 3596 _handleStatusCssClasses: function(field, options) { 3597 /* remove all classes */ 3598 if(options.addSuccessCssClassToField) 3599 field.removeClass(options.addSuccessCssClassToField); 3600 3601 if(options.addFailureCssClassToField) 3602 field.removeClass(options.addFailureCssClassToField); 3603 3604 /* Add classes */ 3605 if (options.addSuccessCssClassToField && !options.isError) 3606 field.addClass(options.addSuccessCssClassToField); 3607 3608 if (options.addFailureCssClassToField && options.isError) 3609 field.addClass(options.addFailureCssClassToField); 3610 }, 3611 3612 /******************** 3613 * _getErrorMessage 3614 * 3615 * @param form 3616 * @param field 3617 * @param rule 3618 * @param rules 3619 * @param i 3620 * @param options 3621 * @param originalValidationMethod 3622 * @return {*} 3623 * @private 3624 */ 3625 _getErrorMessage:function (form, field, rule, rules, i, options, originalValidationMethod) { 3626 // If we are using the custon validation type, build the index for the rule. 3627 // Otherwise if we are doing a function call, make the call and return the object 3628 // that is passed back. 3629 var rule_index = jQuery.inArray(rule, rules); 3630 if (rule === "custom" || rule === "funcCall" || rule === "funcCallRequired") { 3631 var custom_validation_type = rules[rule_index + 1]; 3632 rule = rule + "[" + custom_validation_type + "]"; 3633 // Delete the rule from the rules array so that it doesn't try to call the 3634 // same rule over again 3635 delete(rules[rule_index]); 3636 } 3637 // Change the rule to the composite rule, if it was different from the original 3638 var alteredRule = rule; 3639 3640 3641 var element_classes = (field.attr("data-validation-engine")) ? field.attr("data-validation-engine") : field.attr("class"); 3642 var element_classes_array = element_classes.split(" "); 3643 3644 // Call the original validation method. If we are dealing with dates or checkboxes, also pass the form 3645 var errorMsg; 3646 if (rule == "future" || rule == "past" || rule == "maxCheckbox" || rule == "minCheckbox") { 3647 errorMsg = originalValidationMethod(form, field, rules, i, options); 3648 } else { 3649 errorMsg = originalValidationMethod(field, rules, i, options); 3650 } 3651 3652 // If the original validation method returned an error and we have a custom error message, 3653 // return the custom message instead. Otherwise return the original error message. 3654 if (errorMsg != undefined) { 3655 var custom_message = methods._getCustomErrorMessage($(field), element_classes_array, alteredRule, options); 3656 if (custom_message) errorMsg = custom_message; 3657 } 3658 return errorMsg; 3659 3660 }, 3661 _getCustomErrorMessage:function (field, classes, rule, options) { 3662 var custom_message = false;
3663 var validityProp = /^custom\[.*\]$/.test(rule) ? methods._validityProp["custom"] : methods._validityProp[rule]; 3664 // If there is a validityProp for this rule, check to see if the field has an attribute for it 3665 if (validityProp != undefined) { 3666 custom_message = field.attr("data-errormessage-"+validityProp); 3667 // If there was an error message for it, return the message 3668 if (custom_message != undefined) 3669 return custom_message; 3670 } 3671 custom_message = field.attr("data-errormessage"); 3672 // If there is an inline custom error message, return it 3673 if (custom_message != undefined) 3674 return custom_message; 3675 var id = '#' + field.attr("id"); 3676 // If we have custom messages for the element's id, get the message for the rule from the id. 3677 // Otherwise, if we have custom messages for the element's classes, use the first class message we find instead. 3678 if (typeof options.custom_error_messages[id] != "undefined" && 3679 typeof options.custom_error_messages[id][rule] != "undefined" ) { 3680 custom_message = options.custom_error_messages[id][rule]['message']; 3681 } else if (classes.length > 0) { 3682 for (var i = 0; i < classes.length && classes.length > 0; i++) { 3683 var element_class = "." + classes[i]; 3684 if (typeof options.custom_error_messages[element_class] != "undefined" && 3685 typeof options.custom_error_messages[element_class][rule] != "undefined") { 3686 custom_message = options.custom_error_messages[element_class][rule]['message']; 3687 break; 3688 } 3689 } 3690 } 3691 if (!custom_message && 3692 typeof options.custom_error_messages[rule] != "undefined" && 3693 typeof options.custom_error_messages[rule]['message'] != "undefined"){ 3694 custom_message = options.custom_error_messages[rule]['message']; 3695 } 3696 return custom_message; 3697 }, 3698 _validityProp: { 3699 "required": "value-missing", 3700 "custom": "custom-error", 3701 "groupRequired": "value-missing", 3702 "ajax": "custom-error", 3703 "minSize": "range-underflow", 3704 "maxSize": "range-overflow", 3705 "min": "range-underflow", 3706 "max": "range-overflow", 3707 "past": "type-mismatch", 3708 "future": "type-mismatch", 3709 "dateRange": "type-mismatch", 3710 "dateTimeRange": "type-mismatch", 3711 "maxCheckbox": "range-overflow", 3712 "minCheckbox": "range-underflow", 3713 "equals": "pattern-mismatch", 3714 "funcCall": "custom-error", 3715 "funcCallRequired": "custom-error", 3716 "creditCard": "pattern-mismatch", 3717 "condRequired": "value-missing" 3718 }, 3719 /** 3720 * Required validation 3721 * 3722 * @param {jqObject} field 3723 * @param {Array[String]} rules 3724 * @param {int} i rules index 3725 * @param {Map} 3726 * user options 3727 * @param {bool} condRequired flag when method is used for internal purpose in condRequired check 3728 * @return an error string if validation failed 3729 */ 3730 _required: function(field, rules, i, options, condRequired) { 3731 switch (field.prop("type")) { 3732 case "radio": 3733 case "checkbox": 3734 // new validation style to only check dependent field 3735 if (condRequired) { 3736 if (!field.prop('checked')) { 3737 return options.allrules[rules[i]].alertTextCheckboxMultiple; 3738 } 3739 break; 3740 } 3741 // old validation style 3742 var form = field.closest("form, .validationEngineContainer"); 3743 var name = field.attr("name"); 3744 if (form.find("input[name='" + name + "']:checked").size() == 0) { 3745 if (form.find("input[name='" + name + "']:visible").size() == 1) 3746 return options.allrules[rules[i]].alertTextCheckboxe; 3747 else 3748 return options.allrules[rules[i]].alertTextCheckboxMultiple; 3749 } 3750 break; 3751 case "text": 3752 case "password": 3753 case "textarea": 3754 case "file": 3755 case "select-one": 3756 case "select-multiple": 3757 default: 3758 var field_val = $.trim( field.val() ); 3759 var dv_placeholder = $.trim( field.attr("data-validation-placeholder") ); 3760 var placeholder = $.trim( field.attr("placeholder") ); 3761 if ( 3762 ( !field_val ) 3763 || ( dv_placeholder && field_val == dv_placeholder ) 3764 || ( placeholder && field_val == placeholder ) 3765 ) { 3766 return options.allrules[rules[i]].alertText; 3767 } 3768 break; 3769 } 3770 }, 3771 /** 3772 * Validate that 1 from the group field is required 3773 * 3774 * @param {jqObject} field 3775 * @param {Array[String]} rules 3776 * @param {int} i rules index 3777 * @param {Map} 3778 * user options 3779 * @return an error string if validation failed 3780 */ 3781 _groupRequired: function(field, rules, i, options) { 3782 var classGroup = "["+options.validateAttribute+"*=" +rules[i + 1] +"]"; 3783 var isValid = false; 3784 // Check all fields from the group 3785 field.closest("form, .validationEngineContainer").find(classGroup).each(function(){ 3786 if(!methods._required($(this), rules, i, options)){ 3787 isValid = true; 3788 return false; 3789 } 3790 }); 3791 3792 if(!isValid) { 3793 return options.allrules[rules[i]].alertText; 3794 } 3795 }, 3796 /** 3797 * Validate rules 3798 * 3799 * @param {jqObject} field 3800 * @param {Array[String]} rules 3801 * @param {int} i rules index 3802 * @param {Map} 3803 * user options 3804 * @return an error string if validation failed 3805 */ 3806 _custom: function(field, rules, i, options) { 3807 var customRule = rules[i + 1];
3808 var rule = options.allrules[customRule]; 3809 var fn; 3810 if(!rule) { 3811 alert("jqv:custom rule not found - "+customRule); 3812 return; 3813 } 3814 3815 if(rule["regex"]) { 3816 var ex=rule.regex; 3817 if(!ex) { 3818 alert("jqv:custom regex not found - "+customRule); 3819 return; 3820 } 3821 var pattern = new RegExp(ex); 3822 3823 if (!pattern.test(field.val())) return options.allrules[customRule].alertText; 3824 3825 } else if(rule["func"]) { 3826 fn = rule["func"]; 3827 3828 if (typeof(fn) !== "function") { 3829 alert("jqv:custom parameter 'function' is no function - "+customRule); 3830 return; 3831 } 3832 3833 if (!fn(field, rules, i, options)) 3834 return options.allrules[customRule].alertText; 3835 } else { 3836 alert("jqv:custom type not allowed "+customRule); 3837 return; 3838 } 3839 }, 3840 /** 3841 * Validate custom function outside of the engine scope 3842 * 3843 * @param {jqObject} field 3844 * @param {Array[String]} rules 3845 * @param {int} i rules index 3846 * @param {Map} 3847 * user options 3848 * @return an error string if validation failed 3849 */ 3850 _funcCall: function(field, rules, i, options) { 3851 var functionName = rules[i + 1]; 3852 var fn; 3853 if(functionName.indexOf('.') >-1) 3854 { 3855 var namespaces = functionName.split('.'); 3856 var scope = window; 3857 while(namespaces.length) 3858 { 3859 scope = scope[namespaces.shift()]; 3860 } 3861 fn = scope; 3862 } 3863 else 3864 fn = window[functionName] || options.customFunctions[functionName]; 3865 if (typeof(fn) == 'function') 3866 return fn(field, rules, i, options); 3867 3868 }, 3869 _funcCallRequired: function(field, rules, i, options) { 3870 return methods._funcCall(field,rules,i,options); 3871 }, 3872 /** 3873 * Field match 3874 * 3875 * @param {jqObject} field 3876 * @param {Array[String]} rules 3877 * @param {int} i rules index 3878 * @param {Map} 3879 * user options 3880 * @return an error string if validation failed 3881 */ 3882 _equals: function(field, rules, i, options) { 3883 var equalsField = rules[i + 1]; 3884 3885 if (field.val() != $("#" + equalsField).val()) 3886 return options.allrules.equals.alertText; 3887 }, 3888 /** 3889 * Check the maximum size (in characters) 3890 * 3891 * @param {jqObject} field 3892 * @param {Array[String]} rules 3893 * @param {int} i rules index 3894 * @param {Map} 3895 * user options 3896 * @return an error string if validation failed 3897 */ 3898 _maxSize: function(field, rules, i, options) { 3899 var max = rules[i + 1]; 3900 var len = field.val().length; 3901 3902 if (len > max) { 3903 var rule = options.allrules.maxSize; 3904 return rule.alertText + max + rule.alertText2; 3905 } 3906 }, 3907 /** 3908 * Check the minimum size (in characters) 3909 * 3910 * @param {jqObject} field 3911 * @param {Array[String]} rules 3912 * @param {int} i rules index 3913 * @param {Map} 3914 * user options 3915 * @return an error string if validation failed 3916 */ 3917 _minSize: function(field, rules, i, options) { 3918 var min = rules[i + 1]; 3919 var len = field.val().length; 3920 3921 if (len < min) { 3922 var rule = options.allrules.minSize; 3923 return rule.alertText + min + rule.alertText2; 3924 } 3925 }, 3926 /** 3927 * Check number minimum value 3928 * 3929 * @param {jqObject} field 3930 * @param {Array[String]} rules 3931 * @param {int} i rules index 3932 * @param {Map} 3933 * user options 3934 * @return an error string if validation failed 3935 */ 3936 _min: function(field, rules, i, options) { 3937 var min = parseFloat(rules[i + 1]); 3938 var len = parseFloat(field.val()); 3939 3940 if (len < min) { 3941 var rule = options.allrules.min; 3942 if (rule.alertText2) return rule.alertText + min + rule.alertText2; 3943 return rule.alertText + min; 3944 } 3945 }, 3946 /** 3947 * Check number maximum value 3948 * 3949 * @param {jqObject} field 3950 * @param {Array[String]} rules 3951 * @param {int} i rules index 3952 * @param {Map} 3953 * user options 3954 * @return an error string if validation failed 3955 */ 3956 _max: function(field, rules, i, options) { 3957 var max = parseFloat(rules[i + 1]); 3958 var len = parseFloat(field.val()); 3959 3960 if (len >max ) { 3961 var rule = options.allrules.max; 3962 if (rule.alertText2) return rule.alertText + max + rule.alertText2; 3963 //orefalo: to review, also do the translations 3964 return rule.alertText + max; 3965 } 3966 }, 3967 /** 3968 * Checks date is in the past 3969 * 3970 * @param {jqObject} field 3971 * @param {Array[String]} rules 3972 * @param {int} i rules index 3973 * @param {Map} 3974 * user options 3975 * @return an error string if validation failed 3976 */ 3977 _past: function(form, field, rules, i, options) { 3978 3979 var p=rules[i + 1];
3980 var fieldAlt = $(form.find("*[name='" + p.replace(/^#+/, '') + "']")); 3981 var pdate; 3982 3983 if (p.toLowerCase() == "now") { 3984 pdate = new Date(); 3985 } else if (undefined != fieldAlt.val()) { 3986 if (fieldAlt.is(":disabled")) 3987 return; 3988 pdate = methods._parseDate(fieldAlt.val()); 3989 } else { 3990 pdate = methods._parseDate(p); 3991 } 3992 var vdate = methods._parseDate(field.val()); 3993 3994 if (vdate > pdate ) { 3995 var rule = options.allrules.past; 3996 if (rule.alertText2) return rule.alertText + methods._dateToString(pdate) + rule.alertText2; 3997 return rule.alertText + methods._dateToString(pdate); 3998 } 3999 }, 4000 /** 4001 * Checks date is in the future 4002 * 4003 * @param {jqObject} field 4004 * @param {Array[String]} rules 4005 * @param {int} i rules index 4006 * @param {Map} 4007 * user options 4008 * @return an error string if validation failed 4009 */ 4010 _future: function(form, field, rules, i, options) { 4011 4012 var p=rules[i + 1]; 4013 var fieldAlt = $(form.find("*[name='" + p.replace(/^#+/, '') + "']")); 4014 var pdate; 4015 4016 if (p.toLowerCase() == "now") { 4017 pdate = new Date(); 4018 } else if (undefined != fieldAlt.val()) { 4019 if (fieldAlt.is(":disabled")) 4020 return; 4021 pdate = methods._parseDate(fieldAlt.val()); 4022 } else { 4023 pdate = methods._parseDate(p); 4024 } 4025 var vdate = methods._parseDate(field.val()); 4026 4027 if (vdate < pdate ) { 4028 var rule = options.allrules.future; 4029 if (rule.alertText2) 4030 return rule.alertText + methods._dateToString(pdate) + rule.alertText2; 4031 return rule.alertText + methods._dateToString(pdate); 4032 } 4033 }, 4034 /** 4035 * Checks if valid date 4036 * 4037 * @param {string} date string 4038 * @return a bool based on determination of valid date 4039 */ 4040 _isDate: function (value) { 4041 var dateRegEx = new RegExp(/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(?:(?:0?[1-9]|1[0-2])(\/|-)(?:0?[1-9]|1\d|2[0-8]))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(0?2(\/|-)29)(\/|-)(?:(?:0[48]00|[13579][26]00|[2468][048]00)|(?:\d\d)?(?:0[48]|[2468][048]|[13579][26]))$/); 4042 return dateRegEx.test(value); 4043 }, 4044 /** 4045 * Checks if valid date time 4046 * 4047 * @param {string} date string 4048 * @return a bool based on determination of valid date time 4049 */ 4050 _isDateTime: function (value){ 4051 var dateTimeRegEx = new RegExp(/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1}$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^((1[012]|0?[1-9]){1}\/(0?[1-9]|[12][0-9]|3[01]){1}\/\d{2,4}\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1})$/); 4052 return dateTimeRegEx.test(value); 4053 }, 4054 //Checks if the start date is before the end date 4055 //returns true if end is later than start 4056 _dateCompare: function (start, end) { 4057 return (new Date(start.toString()) < new Date(end.toString())); 4058 }, 4059 /** 4060 * Checks date range 4061 * 4062 * @param {jqObject} first field name 4063 * @param {jqObject} second field name 4064 * @return an error string if validation failed 4065 */ 4066 _dateRange: function (field, rules, i, options) { 4067 //are not both populated 4068 if ((!options.firstOfGroup[0].value && options.secondOfGroup[0].value) || (options.firstOfGroup[0].value && !options.secondOfGroup[0].value)) { 4069 return options.allrules[rules[i]].alertText + options.allrules[rules[i]].alertText2; 4070 } 4071 4072 //are not both dates 4073 if (!methods._isDate(options.firstOfGroup[0].value) || !methods._isDate(options.secondOfGroup[0].value)) { 4074 return options.allrules[rules[i]].alertText + options.allrules[rules[i]].alertText2; 4075 } 4076 4077 //are both dates but range is off 4078 if (!methods._dateCompare(options.firstOfGroup[0].value, options.secondOfGroup[0].value)) { 4079 return options.allrules[rules[i]].alertText + options.allrules[rules[i]].alertText2; 4080 } 4081 }, 4082 /** 4083 * Checks date time range 4084 * 4085 * @param {jqObject} first field name 4086 * @param {jqObject} second field name 4087 * @return an error string if validation failed 4088 */ 4089 _dateTimeRange: function (field, rules, i, options) { 4090 //are not both populated 4091 if ((!options.firstOfGroup[0].value && options.secondOfGroup[0].value) || (options.firstOfGroup[0].value && !options.secondOfGroup[0].value)) { 4092 return options.allrules[rules[i]].alertText + options.allrules[rules[i]].alertText2; 4093 } 4094 //are not both dates 4095 if (!methods._isDateTime(options.firstOfGroup[0].value) || !methods._isDateTime(options.secondOfGroup[0].value)) { 4096 return options.allrules[rules[i]].alertText + options.allrules[rules[i]].alertText2; 4097 } 4098 //are both dates but range is off 4099 if (!methods._dateCompare(options.firstOfGroup[0].value, options.secondOfGroup[0].value)) { 4100 return options.allrules[rules[i]].alertText + options.allrules[rules[i]].alertText2; 4101 } 4102 }, 4103 /** 4104 * Max number of checkbox selected 4105 * 4106 * @param {jqObject} field 4107 * @param {Array[String]} rules 4108 * @param {int} i rules index 4109 * @param {Map} 4110 * user options 4111 * @return an error string if validation failed 4112 */ 4113 _maxCheckbox: function(form, field, rules, i, options) { 4114 4115 var nbCheck = rules[i + 1];
4116 var groupname = field.attr("name"); 4117 var groupSize = form.find("input[name='" + groupname + "']:checked").size(); 4118 if (groupSize > nbCheck) { 4119 options.showArrow = false; 4120 if (options.allrules.maxCheckbox.alertText2) 4121 return options.allrules.maxCheckbox.alertText + " " + nbCheck + " " + options.allrules.maxCheckbox.alertText2; 4122 return options.allrules.maxCheckbox.alertText; 4123 } 4124 }, 4125 /** 4126 * Min number of checkbox selected 4127 * 4128 * @param {jqObject} field 4129 * @param {Array[String]} rules 4130 * @param {int} i rules index 4131 * @param {Map} 4132 * user options 4133 * @return an error string if validation failed 4134 */ 4135 _minCheckbox: function(form, field, rules, i, options) { 4136 4137 var nbCheck = rules[i + 1]; 4138 var groupname = field.attr("name"); 4139 var groupSize = form.find("input[name='" + groupname + "']:checked").size(); 4140 if (groupSize < nbCheck) { 4141 options.showArrow = false; 4142 return options.allrules.minCheckbox.alertText + " " + nbCheck + " " + options.allrules.minCheckbox.alertText2; 4143 } 4144 }, 4145 /** 4146 * Checks that it is a valid credit card number according to the 4147 * Luhn checksum algorithm. 4148 * 4149 * @param {jqObject} field 4150 * @param {Array[String]} rules 4151 * @param {int} i rules index 4152 * @param {Map} 4153 * user options 4154 * @return an error string if validation failed 4155 */ 4156 _creditCard: function(field, rules, i, options) { 4157 //spaces and dashes may be valid characters, but must be stripped to calculate the checksum. 4158 var valid = false, cardNumber = field.val().replace(/ +/g, '').replace(/-+/g, ''); 4159 4160 var numDigits = cardNumber.length; 4161 if (numDigits >= 14 && numDigits <= 16 && parseInt(cardNumber) > 0) { 4162 4163 var sum = 0, i = numDigits - 1, pos = 1, digit, luhn = new String(); 4164 do { 4165 digit = parseInt(cardNumber.charAt(i)); 4166 luhn += (pos++ % 2 == 0) ? digit * 2 : digit; 4167 } while (--i >= 0) 4168 4169 for (i = 0; i < luhn.length; i++) { 4170 sum += parseInt(luhn.charAt(i)); 4171 } 4172 valid = sum % 10 == 0; 4173 } 4174 if (!valid) return options.allrules.creditCard.alertText; 4175 }, 4176 /** 4177 * Ajax field validation 4178 * 4179 * @param {jqObject} field 4180 * @param {Array[String]} rules 4181 * @param {int} i rules index 4182 * @param {Map} 4183 * user options 4184 * @return nothing! the ajax validator handles the prompts itself 4185 */ 4186 _ajax: function(field, rules, i, options) { 4187 4188 var errorSelector = rules[i + 1]; 4189 var rule = options.allrules[errorSelector]; 4190 var extraData = rule.extraData; 4191 var extraDataDynamic = rule.extraDataDynamic; 4192 var data = { 4193 "fieldId" : field.attr("id"), 4194 "fieldValue" : field.val() 4195 }; 4196 4197 if (typeof extraData === "object") { 4198 $.extend(data, extraData); 4199 } else if (typeof extraData === "string") { 4200 var tempData = extraData.split("&"); 4201 for(var i = 0; i < tempData.length; i++) { 4202 var values = tempData[i].split("="); 4203 if (values[0] && values[0]) { 4204 data[values[0]] = values[1]; 4205 } 4206 } 4207 } 4208 4209 if (extraDataDynamic) { 4210 var tmpData = []; 4211 var domIds = String(extraDataDynamic).split(","); 4212 for (var i = 0; i < domIds.length; i++) { 4213 var id = domIds[i]; 4214 if ($(id).length) { 4215 var inputValue = field.closest("form, .validationEngineContainer").find(id).val(); 4216 var keyValue = id.replace('#', '') + '=' + escape(inputValue); 4217 data[id.replace('#', '')] = inputValue; 4218 } 4219 } 4220 } 4221 4222 // If a field change event triggered this we want to clear the cache for this ID 4223 if (options.eventTrigger == "field") { 4224 delete(options.ajaxValidCache[field.attr("id")]); 4225 } 4226 4227 // If there is an error or if the the field is already validated, do not re-execute AJAX 4228 if (!options.isError && !methods._checkAjaxFieldStatus(field.attr("id"), options)) { 4229 $.ajax({
4230 type: options.ajaxFormValidationMethod, 4231 url: rule.url, 4232 cache: false, 4233 dataType: "json", 4234 data: data, 4235 field: field, 4236 rule: rule, 4237 methods: methods, 4238 options: options, 4239 beforeSend: function() {}, 4240 error: function(data, transport) { 4241 if (options.onFailure) { 4242 options.onFailure(data, transport); 4243 } else { 4244 methods._ajaxError(data, transport); 4245 } 4246 }, 4247 success: function(json) { 4248 4249 // asynchronously called on success, data is the json answer from the server 4250 var errorFieldId = json[0]; 4251 //var errorField = $($("#" + errorFieldId)[0]); 4252 var errorField = $("#"+ errorFieldId).eq(0); 4253 4254 // make sure we found the element 4255 if (errorField.length == 1) { 4256 var status = json[1]; 4257 // read the optional msg from the server 4258 var msg = json[2]; 4259 if (!status) { 4260 // Houston we got a problem - display an red prompt 4261 options.ajaxValidCache[errorFieldId] = false; 4262 options.isError = true; 4263 4264 // resolve the msg prompt 4265 if(msg) { 4266 if (options.allrules[msg]) { 4267 var txt = options.allrules[msg].alertText; 4268 if (txt) { 4269 msg = txt; 4270 } 4271 } 4272 } 4273 else 4274 msg = rule.alertText; 4275 4276 if (options.showPrompts) methods._showPrompt(errorField, msg, "", true, options); 4277 } else { 4278 options.ajaxValidCache[errorFieldId] = true; 4279 4280 // resolves the msg prompt 4281 if(msg) { 4282 if (options.allrules[msg]) { 4283 var txt = options.allrules[msg].alertTextOk; 4284 if (txt) { 4285 msg = txt; 4286 } 4287 } 4288 } 4289 else 4290 msg = rule.alertTextOk; 4291 4292 if (options.showPrompts) { 4293 // see if we should display a green prompt 4294 if (msg) 4295 methods._showPrompt(errorField, msg, "pass", true, options); 4296 else 4297 methods._closePrompt(errorField); 4298 } 4299 4300 // If a submit form triggered this, we want to re-submit the form 4301 if (options.eventTrigger == "submit") 4302 field.closest("form").submit(); 4303 } 4304 } 4305 errorField.trigger("jqv.field.result", [errorField, options.isError, msg]); 4306 } 4307 }); 4308 4309 return rule.alertTextLoad; 4310 } 4311 }, 4312 /** 4313 * Common method to handle ajax errors 4314 * 4315 * @param {Object} data 4316 * @param {Object} transport 4317 */ 4318 _ajaxError: function(data, transport) { 4319 if(data.status == 0 && transport == null) 4320 alert("The page is not served from a server! ajax call failed"); 4321 else if(typeof console != "undefined") 4322 console.log("Ajax error: " + data.status + " " + transport); 4323 }, 4324 /** 4325 * date -> string 4326 * 4327 * @param {Object} date 4328 */ 4329 _dateToString: function(date) { 4330 return date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate(); 4331 }, 4332 /** 4333 * Parses an ISO date 4334 * @param {String} d 4335 */ 4336 _parseDate: function(d) { 4337 4338 var dateParts = d.split("-"); 4339 if(dateParts==d) 4340 dateParts = d.split("/"); 4341 if(dateParts==d) { 4342 dateParts = d.split("."); 4343 return new Date(dateParts[2], (dateParts[1] - 1), dateParts[0]); 4344 } 4345 return new Date(dateParts[0], (dateParts[1] - 1) ,dateParts[2]); 4346 }, 4347 /** 4348 * Builds or updates a prompt with the given information 4349 * 4350 * @param {jqObject} field 4351 * @param {String} promptText html text to display type 4352 * @param {String} type the type of bubble: 'pass' (green), 'load' (black) anything else (red) 4353 * @param {boolean} ajaxed - use to mark fields than being validated with ajax 4354 * @param {Map} options user options 4355 */ 4356 _showPrompt: function(field, promptText, type, ajaxed, options, ajaxform) { 4357 //Check if we need to adjust what element to show the prompt on 4358 if(field.data('jqv-prompt-at') instanceof jQuery ){ 4359 field = field.data('jqv-prompt-at'); 4360 } else if(field.data('jqv-prompt-at')) { 4361 field = $(field.data('jqv-prompt-at')); 4362 } 4363 4364 var prompt = methods._getPrompt(field); 4365 // The ajax submit errors are not see has an error in the form, 4366 // When the form errors are returned, the engine see 2 bubbles, but those are ebing closed by the engine at the same time 4367 // Because no error was found befor submitting 4368 if(ajaxform) prompt = false; 4369 // Check that there is indded text 4370 if($.trim(promptText)){ 4371 if (prompt) 4372 methods._updatePrompt(field, prompt, promptText, type, ajaxed, options); 4373 else 4374 methods._buildPrompt(field, promptText, type, ajaxed, options); 4375 } 4376 }, 4377 /** 4378 * Builds and shades a prompt for the given field. 4379 * 4380 * @param {jqObject} field 4381 * @param {String} promptText html text to display type 4382 * @param {String} type the type of bubble: 'pass' (green), 'load' (black) anything else (red) 4383 * @param {boolean} ajaxed - use to mark fields than being validated with ajax 4384 * @param {Map} options user options 4385 */ 4386 _buildPrompt: function(field, promptText, type, ajaxed, options) { 4387 4388 // create the prompt 4389 var prompt = $('<div>'); 4390 prompt.addClass(methods._getClassName(field.attr("id")) + "formError"); 4391 // add a class name to identify the parent form of the prompt 4392 prompt.addClass("parentForm"+methods._getClassName(field.closest('form, .validationEngineContainer').attr("id"))); 4393 prompt.addClass("formError"); 4394 4395 switch (type) { 4396 case "pass": 4397 prompt.addClass("greenPopup"); 4398 break; 4399 case "load": 4400 prompt.addClass("blackPopup"); 4401 break; 4402 default: 4403 /* it has error */ 4404 //alert("unknown popup type:"+type); 4405 } 4406 if (ajaxed) 4407 prompt.addClass("ajaxed"); 4408 4409 // create the prompt content 4410 var promptContent = $('<div>').addClass("formErrorContent").html(promptText).appendTo(prompt); 4411 4412 // determine position type 4413 var positionType=field.data("promptPosition") || options.promptPosition; 4414 4415 // create the css arrow pointing at the field 4416 // note that there is no triangle on max-checkbox and radio 4417 if (options.showArrow) { 4418 var arrow = $('<div>').addClass("formErrorArrow"); 4419 4420 //prompt positioning adjustment support. Usage: positionType:Xshift,Yshift (for ex.: bottomLeft:+20 or bottomLeft:-20,+10) 4421 if (typeof(positionType)=='string') 4422 { 4423 var pos=positionType.indexOf(":"); 4424 if(pos!=-1) 4425 positionType=positionType.substring(0,pos); 4426 } 4427 4428 switch (positionType) { 4429 case "bottomLeft": 4430 case "bottomRight": 4431 prompt.find(".formErrorContent").before(arrow); 4432 arrow.addClass("formErrorArrowBottom").html('<div class="line1"><!-- --></div><div class="line2"><!-- --></div><div class="line3"><!-- --></div><div class="line4"><!-- --></div><div class="line5"><!-- --></div><div class="line6"><!-- --></div><div class="line7"><!-- --></div><div class="line8"><!-- --></div><div class="line9"><!-- --></div><div class="line10"><!-- --></div>'); 4433 break; 4434 case "topLeft": 4435 case "topRight": 4436 arrow.html('<div class="line10"><!-- --></div><div class="line9"><!-- --></div><div class="line8"><!-- --></div><div class="line7"><!-- --></div><div class="line6"><!-- --></div><div class="line5"><!-- --></div><div class="line4"><!-- --></div><div class="line3"><!-- --></div><div class="line2"><!-- --></div><div class="line1"><!-- --></div>'); 4437 prompt.append(arrow); 4438 break; 4439 } 4440 } 4441 // Add custom prompt class 4442 if (options.addPromptClass) 4443 prompt.addClass(options.addPromptClass); 4444 4445 // Add custom prompt class defined in element 4446 var requiredOverride = field.attr('data-required-class'); 4447 if(requiredOverride !== undefined) { 4448 prompt.addClass(requiredOverride); 4449 } else { 4450 if(options.prettySelect) { 4451 if($('#' + field.attr('id')).next().is('select')) { 4452 var prettyOverrideClass = $('#' + field.attr('id').substr(options.usePrefix.length).substring(options.useSuffix.length)).attr('data-required-class'); 4453 if(prettyOverrideClass !== undefined) { 4454 prompt.addClass(prettyOverrideClass); 4455 } 4456 } 4457 } 4458 } 4459 4460 prompt.css({ 4461 "opacity": 0 4462 }); 4463 if(positionType === 'inline') { 4464 prompt.addClass("inline"); 4465 if(typeof field.attr('data-prompt-target') !== 'undefined' && $('#'+field.attr('data-prompt-target')).length > 0) { 4466 prompt.appendTo($('#'+field.attr('data-prompt-target'))); 4467 } else { 4468 field.after(prompt); 4469 } 4470 } else { 4471 field.before(prompt); 4472 } 4473 4474 var pos = methods._calculatePosition(field, prompt, options); 4475 prompt.css({ 4476 'position': positionType === 'inline' ? 'relative' : 'absolute', 4477 "top": pos.callerTopPosition, 4478 "left": pos.callerleftPosition, 4479 "marginTop": pos.marginTopSize, 4480 "opacity": 0 4481 }).data("callerField", field); 4482 4483 4484 if (options.autoHidePrompt) { 4485 setTimeout(function(){ 4486 prompt.animate({ 4487 "opacity": 0 4488 },function(){ 4489 prompt.closest('.formErrorOuter').remove(); 4490 });
4491 }, options.autoHideDelay); 4492 } 4493 return prompt.animate({ 4494 "opacity": 0.87 4495 }); 4496 }, 4497 /** 4498 * Updates the prompt text field - the field for which the prompt 4499 * @param {jqObject} field 4500 * @param {String} promptText html text to display type 4501 * @param {String} type the type of bubble: 'pass' (green), 'load' (black) anything else (red) 4502 * @param {boolean} ajaxed - use to mark fields than being validated with ajax 4503 * @param {Map} options user options 4504 */ 4505 _updatePrompt: function(field, prompt, promptText, type, ajaxed, options, noAnimation) { 4506 4507 if (prompt) { 4508 if (typeof type !== "undefined") { 4509 if (type == "pass") 4510 prompt.addClass("greenPopup"); 4511 else 4512 prompt.removeClass("greenPopup"); 4513 4514 if (type == "load") 4515 prompt.addClass("blackPopup"); 4516 else 4517 prompt.removeClass("blackPopup"); 4518 } 4519 if (ajaxed) 4520 prompt.addClass("ajaxed"); 4521 else 4522 prompt.removeClass("ajaxed"); 4523 4524 prompt.find(".formErrorContent").html(promptText); 4525 4526 var pos = methods._calculatePosition(field, prompt, options); 4527 var css = {"top": pos.callerTopPosition, 4528 "left": pos.callerleftPosition, 4529 "marginTop": pos.marginTopSize, 4530 "opacity": 0.87}; 4531 4532 if (noAnimation) 4533 prompt.css(css); 4534 else 4535 prompt.animate(css); 4536 } 4537 }, 4538 /** 4539 * Closes the prompt associated with the given field 4540 * 4541 * @param {jqObject} 4542 * field 4543 */ 4544 _closePrompt: function(field) { 4545 var prompt = methods._getPrompt(field); 4546 if (prompt) 4547 prompt.fadeTo("fast", 0, function() { 4548 prompt.closest('.formErrorOuter').remove(); 4549 }); 4550 }, 4551 closePrompt: function(field) { 4552 return methods._closePrompt(field); 4553 }, 4554 /** 4555 * Returns the error prompt matching the field if any 4556 * 4557 * @param {jqObject} 4558 * field 4559 * @return undefined or the error prompt (jqObject) 4560 */ 4561 _getPrompt: function(field) { 4562 var formId = $(field).closest('form, .validationEngineContainer').attr('id'); 4563 var className = methods._getClassName(field.attr("id")) + "formError"; 4564 var match = $("." + methods._escapeExpression(className) + '.parentForm' + methods._getClassName(formId))[0]; 4565 if (match) 4566 return $(match); 4567 }, 4568 /** 4569 * Returns the escapade classname 4570 * 4571 * @param {selector} 4572 * className 4573 */ 4574 _escapeExpression: function (selector) { 4575 return selector.replace(/([#;&,\.\+\*\~':"\!\^$\[\]\(\)=>\|])/g, "\\$1"); 4576 }, 4577 /** 4578 * returns true if we are in a RTLed document 4579 * 4580 * @param {jqObject} field 4581 */ 4582 isRTL: function(field) 4583 { 4584 var $document = $(document); 4585 var $body = $('body'); 4586 var rtl = 4587 (field && field.hasClass('rtl')) || 4588 (field && (field.attr('dir') || '').toLowerCase()==='rtl') || 4589 $document.hasClass('rtl') || 4590 ($document.attr('dir') || '').toLowerCase()==='rtl' || 4591 $body.hasClass('rtl') || 4592 ($body.attr('dir') || '').toLowerCase()==='rtl'; 4593 return Boolean(rtl); 4594 }, 4595 /** 4596 * Calculates prompt position 4597 * 4598 * @param {jqObject} 4599 * field 4600 * @param {jqObject} 4601 * the prompt 4602 * @param {Map} 4603 * options 4604 * @return positions 4605 */ 4606 _calculatePosition: function (field, promptElmt, options) { 4607 4608 var promptTopPosition, promptleftPosition, marginTopSize; 4609 var fieldWidth = field.width(); 4610 var fieldLeft = field.position().left; 4611 var fieldTop = field.position().top; 4612 var fieldHeight = field.height(); 4613 var promptHeight = promptElmt.height(); 4614 4615 4616 // is the form contained in an overflown container? 4617 promptTopPosition = promptleftPosition = 0; 4618 // compensation for the arrow 4619 marginTopSize = -promptHeight; 4620 4621 4622 //prompt positioning adjustment support 4623 //now you can adjust prompt position 4624 //usage: positionType:Xshift,Yshift 4625 //for example: 4626 // bottomLeft:+20 means bottomLeft position shifted by 20 pixels right horizontally 4627 // topRight:20, -15 means topRight position shifted by 20 pixels to right and 15 pixels to top 4628 //You can use +pixels, - pixels. If no sign is provided than + is default. 4629 var positionType=field.data("promptPosition") || options.promptPosition; 4630 var shift1=""; 4631 var shift2=""; 4632 var shiftX=0; 4633 var shiftY=0; 4634 if (typeof(positionType)=='string') { 4635 //do we have any position adjustments ? 4636 if (positionType.indexOf(":")!=-1) { 4637 shift1=positionType.substring(positionType.indexOf(":")+1); 4638 positionType=positionType.substring(0,positionType.indexOf(":")); 4639 4640 //if any advanced positioning will be needed (percents or something else) - parser should be added here 4641 //for now we use simple parseInt() 4642 4643 //do we have second parameter? 4644 if (shift1.indexOf(",") !=-1) { 4645 shift2=shift1.substring(shift1.indexOf(",") +1); 4646 shift1=shift1.substring(0,shift1.indexOf(",")); 4647 shiftY=parseInt(shift2); 4648 if (isNaN(shiftY)) shiftY=0; 4649 }; 4650 4651 shiftX=parseInt(shift1); 4652 if (isNaN(shift1)) shift1=0; 4653 4654 }; 4655 }; 4656 4657 4658 switch (positionType) { 4659 default: 4660 case "topRight": 4661 promptleftPosition += fieldLeft + fieldWidth - 27; 4662 promptTopPosition += fieldTop; 4663 break; 4664 4665 case "topLeft": 4666 promptTopPosition += fieldTop; 4667 promptleftPosition += fieldLeft; 4668 break; 4669 4670 case "centerRight": 4671 promptTopPosition = fieldTop+4; 4672 marginTopSize = 0; 4673 promptleftPosition= fieldLeft + field.outerWidth(true)+5; 4674 break; 4675 case "centerLeft": 4676 promptleftPosition = fieldLeft - (promptElmt.width() + 2); 4677 promptTopPosition = fieldTop+4; 4678 marginTopSize = 0; 4679 4680 break; 4681 4682 case "bottomLeft": 4683 promptTopPosition = fieldTop + field.height() + 5; 4684 marginTopSize = 0; 4685 promptleftPosition = fieldLeft; 4686 break; 4687 case "bottomRight": 4688 promptleftPosition = fieldLeft + fieldWidth - 27; 4689 promptTopPosition = fieldTop + field.height() + 5; 4690 marginTopSize = 0; 4691 break; 4692 case "inline": 4693 promptleftPosition = 0; 4694 promptTopPosition = 0; 4695 marginTopSize = 0; 4696 }; 4697 4698 4699 4700 //apply adjusments if any 4701 promptleftPosition += shiftX; 4702 promptTopPosition += shiftY; 4703 4704 return { 4705 "callerTopPosition": promptTopPosition + "px", 4706 "callerleftPosition": promptleftPosition + "px", 4707 "marginTopSize": marginTopSize + "px" 4708 }; 4709 }, 4710 /** 4711 * Saves the user options and variables in the form.data 4712 * 4713 * @param {jqObject} 4714 * form - the form where the user option should be saved 4715 * @param {Map} 4716 * options - the user options 4717 * @return the user options (extended from the defaults) 4718 */ 4719 _saveOptions: function(form, options) { 4720 4721 // is there a language localisation ? 4722 if ($.validationEngineLanguage) 4723 var allRules = $.validationEngineLanguage.allRules; 4724 else 4725 $.error("jQuery.validationEngine rules are not loaded, plz add localization files to the page"); 4726 // --- Internals DO NOT TOUCH or OVERLOAD --- 4727 // validation rules and i18 4728 $.validationEngine.defaults.allrules = allRules; 4729 4730 var userOptions = $.extend(true,{},$.validationEngine.defaults,options); 4731 4732 form.data('jqv', userOptions); 4733 return userOptions; 4734 }, 4735 4736 /** 4737 * Removes forbidden characters from class name 4738 * @param {String} className 4739 */ 4740 _getClassName: function(className) { 4741 if(className) 4742 return className.replace(/:/g, "_").replace(/\./g, "_"); 4743 }, 4744 /** 4745 * Escape special character for jQuery selector 4746 * http://totaldev.com/content/escaping-characters-get-valid-jquery-id 4747 * @param {String} selector 4748 */ 4749 _jqSelector: function(str){ 4750 return str.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g, '\\$1'); 4751 }, 4752 /** 4753 * Conditionally required field 4754 * 4755 * @param {jqObject} field 4756 * @param {Array[String]} rules 4757 * @param {int} i rules index 4758 * @param {Map} 4759 * user options 4760 * @return an error string if validation failed 4761 */ 4762 _condRequired: function(field, rules, i, options) { 4763 var idx, dependingField; 4764 4765 for(idx = (i + 1); idx < rules.length; idx++) { 4766 dependingField = jQuery("#" + rules[idx]).first(); 4767 4768 /* Use _required for determining wether dependingField has a value. 4769 * There is logic there for handling all field types, and default value; so we won't replicate that here 4770 * Indicate this special use by setting the last parameter to true so we only validate the dependingField on chackboxes and radio buttons (#462) 4771 */ 4772 if (dependingField.length && methods._required(dependingField, ["required"], 0, options, true) == undefined) { 4773 /* We now know any of the depending fields has a value, 4774 * so we can validate this field as per normal required code 4775 */ 4776 return methods._required(field, ["required"], 0, options); 4777 } 4778 } 4779 }, 4780 4781 _submitButtonClick: function(event) { 4782 var button = $(this); 4783 var form = button.closest('form, .validationEngineContainer'); 4784 form.data("jqv_submitButton", button.attr("id")); 4785 } 4786 }; 4787 4788 /** 4789 * Plugin entry point. 4790 * You may pass an action as a parameter or a list of options. 4791 * if none, the init and attach methods are being called. 4792 * Remember: if you pass options, the attached method is NOT called automatically 4793 * 4794 * @param {String} 4795 * method (optional) action 4796 */ 4797 $.fn.validationEngine = function(method) { 4798 4799 var form = $(this); 4800 if(!form[0]) return form; // stop here if the form does not exist 4801 4802 if (typeof(method) == 'string' && method.charAt(0) != '_' && methods[method]) { 4803 4804 // make sure init is called once 4805 if(method != "showPrompt" && method != "hide" && method != "hideAll") 4806 methods.init.apply(form); 4807 4808 return methods[method].apply(form, Array.prototype.slice.call(arguments, 1)); 4809 } else if (typeof method == 'object' || !method) { 4810 4811 // default constructor with or without arguments 4812 methods.init.apply(form, arguments); 4813 return methods.attach.apply(form); 4814 } else { 4815 $.error('Method ' + method + ' does not exist in jQuery.validationEngine'); 4816 } 4817 }; 4818 4819 4820 4821 // LEAK GLOBAL OPTIONS 4822 $.validationEngine= {fieldIdCounter: 0,defaults:{ 4823 4824 // Name of the event triggering field validation 4825 validationEventTrigger: "blur", 4826 // Automatically scroll viewport to the first error 4827 scroll: true, 4828 // Focus on the first input 4829 focusFirstField:true, 4830 // Show prompts, set to false to disable prompts 4831 showPrompts: true, 4832 // Should we attempt to validate non-visible input fields contained in the form? (Useful in cases of tabbed containers, e.g. jQuery-UI tabs) 4833 validateNonVisibleFields: false, 4834 // ignore the validation for fields with this specific class (Useful in cases of tabbed containers AND hidden fields we don't want to validate) 4835 ignoreFieldsWithClass: 'ignoreMe', 4836 // Opening box position, possible locations are: topLeft, 4837 // topRight, bottomLeft, centerRight, bottomRight, inline 4838 // inline gets inserted after the validated field or into an element specified in data-prompt-target
4839 promptPosition: "topRight", 4840 bindMethod:"bind", 4841 // internal, automatically set to true when it parse a _ajax rule 4842 inlineAjax: false, 4843 // if set to true, the form data is sent asynchronously via ajax to the form.action url (get) 4844 ajaxFormValidation: false, 4845 // The url to send the submit ajax validation (default to action) 4846 ajaxFormValidationURL: false, 4847 // HTTP method used for ajax validation 4848 ajaxFormValidationMethod: 'get', 4849 // Ajax form validation callback method: boolean onComplete(form, status, errors, options) 4850 // retuns false if the form.submit event needs to be canceled. 4851 onAjaxFormComplete: $.noop, 4852 // called right before the ajax call, may return false to cancel 4853 onBeforeAjaxFormValidation: $.noop, 4854 // Stops form from submitting and execute function assiciated with it 4855 onValidationComplete: false, 4856 4857 // Used when you have a form fields too close and the errors messages are on top of other disturbing viewing messages 4858 doNotShowAllErrosOnSubmit: false, 4859 // Object where you store custom messages to override the default error messages 4860 custom_error_messages:{}, 4861 // true if you want to validate the input fields on blur event 4862 binded: true, 4863 // set to true if you want to validate the input fields on blur only if the field it's not empty 4864 notEmpty: false, 4865 // set to true, when the prompt arrow needs to be displayed 4866 showArrow: true, 4867 // set to false, determines if the prompt arrow should be displayed when validating 4868 // checkboxes and radio buttons 4869 showArrowOnRadioAndCheckbox: false, 4870 // did one of the validation fail ? kept global to stop further ajax validations 4871 isError: false, 4872 // Limit how many displayed errors a field can have 4873 maxErrorsPerField: false, 4874 4875 // Caches field validation status, typically only bad status are created. 4876 // the array is used during ajax form validation to detect issues early and prevent an expensive submit 4877 ajaxValidCache: {}, 4878 // Auto update prompt position after window resize 4879 autoPositionUpdate: false, 4880 4881 InvalidFields: [], 4882 onFieldSuccess: false, 4883 onFieldFailure: false, 4884 onSuccess: false, 4885 onFailure: false, 4886 validateAttribute: "class", 4887 addSuccessCssClassToField: "", 4888 addFailureCssClassToField: "", 4889 4890 // Auto-hide prompt 4891 autoHidePrompt: false, 4892 // Delay before auto-hide 4893 autoHideDelay: 10000, 4894 // Fade out duration while hiding the validations 4895 fadeDuration: 0.3, 4896 // Use Prettify select library 4897 prettySelect: false, 4898 // Add css class on prompt 4899 addPromptClass : "", 4900 // Custom ID uses prefix 4901 usePrefix: "", 4902 // Custom ID uses suffix 4903 useSuffix: "", 4904 // Only show one message per error prompt 4905 showOneMessage: false 4906 }}; 4907 $(function(){$.validationEngine.defaults.promptPosition = methods.isRTL()?'topLeft':"topRight"}); 4908})(jQuery18); 4909}function lmsimplemenu3dopen(ul) { 4910 ul.show(); 4911 var timeoutsToClear = ul.data('LM3DTimeoutIds'); 4912 if (timeoutsToClear) { 4913 $.each(timeoutsToClear, function (index, value) { 4914 clearTimeout(value); 4915 }); 4916 } 4917 4918 var timeoutIds = []; 4919 $(ul.find('> li').toArray()).each(function (index, li) { 4920 timeoutIds.push(setTimeout(function () { 4921 $(li).removeClass('swing-out').addClass('swing-in'); 4922 }, 50 + index * 150)) 4923 }) 4924 ul.data('LM3DTimeoutIds', timeoutIds) 4925} 4926 4927function lmsimplemenu3dclose(ul) { 4928 var timeoutsToClear = ul.data('LM3DTimeoutIds'); 4929 if (timeoutsToClear) { 4930 $.each(timeoutsToClear, function (index, value) { 4931 clearTimeout(value); 4932 }); 4933 } 4934 4935 var timeoutIds = []; 4936 var lis = ul.find('> li') 4937 $(lis.toArray().reverse()).each(function (index, li) { 4938 timeoutIds.push(setTimeout(function () { 4939 $(li).removeClass('swing-in').addClass('swing-out'); 4940 //console.log(index, lis.length); 4941 if (index === lis.length-1) { 4942 timeoutIds.push(setTimeout(function () { 4943 lis.removeClass('swing-out'); 4944 ul.hide(); 4945 }, 650)); 4946 } 4947 }, index * 150)); 4948 }); 4949 4950 ul.data('LM3DTimeoutIds', timeoutIds) 4951} 4952 4953var LMSimpleMenuCool = function(objname, specifiedOptions) 4954{ 4955 var scrolltop = null; 4956 var isDocked = false; 4957 var autodocked = false; 4958 var selector = '#' + objname; 4959 var classselector = '.' + objname; 4960 var options; 4961 specifiedOptions = specifiedOptions || {}; 4962 4963 var toHide = {}; 4964 var intelligentShow = function(child){ 4965 switch(options.animation){ 4966 case 'none': 4967 child.show(); 4968 break; 4969 case 'fade': 4970 child.fadeIn(200); 4971 break; 4972 case 'reveal': 4973 child.show(200); 4974 break; 4975 case '3danimation': 4976 if(checkIf3DTransformIsSupported()){ 4977 child.addClass('lm3dactive'); 4978 lmsimplemenu3dopen(child); 4979 }else{ 4980 child.fadeIn(200); 4981 } 4982 //TODO: Implement animation 3D 4983 break; 4984 } 4985 }; 4986 4987 var canHideUl = function(ul) 4988 { 4989 var ul = $(ul); 4990 if(ul.lenght = 0) 4991 return false; 4992 var _canHide = !(ul.is(':hover')); 4993 // see parent 4994 var parentIndex = ul.data('listitem-parent'); 4995 var parentLi = $(classselector+' li[data-index="'+parentIndex+'"]'); 4996 if(parentLi.length > 0) 4997 _canHide = _canHide && !(parentLi.is(':hover')); 4998 // see children 4999 var lis = ul.find('li'); 5000 for(var i = 0; i < lis.length; i++) 5001 { 5002 var li = $(lis[i]); 5003 var childIndex = li.data('index'); 5004 var children = $('ul'+ classselector +'[data-listitem-parent^="'+childIndex+'"]') 5005 for(var j = 0; j < children.length; j++) 5006 { 5007 _canHide = _canHide && canHideUl($(children[j])); 5008 } 5009 } 5010 return _canHide; 5011 }; 5012 5013 var checkIf3DTransformIsSupported = function () { 5014 var cssProp = 'transform'; 5015 var cssPropsValues = { 5016 transform: 'scale(1)' 5017 }; 5018 5019 var el = document.createElement('div'); 5020 var before = el.style[cssProp]; 5021 5022 if (before === undefined) { 5023 return false; 5024 } 5025 5026 try { 5027 el.style[cssProp] = cssPropsValues[cssProp]; 5028 } catch(e) {} 5029 5030 return before !== el.style[cssProp]; 5031 } 5032 5033 var isScrolled = function(){ 5034 if(scrolltop === null){ 5035 scrolltop = $(selector).offset().top; 5036 } 5037 return $(window).scrollTop() > scrolltop; 5038 } 5039 5040 var intelligentHide = function(element) 5041 { 5042 switch(options.animation){ 5043 case 'none': 5044 element.hide(); 5045 break; 5046 case 'fade': 5047 element.fadeOut(200); 5048 break; 5049 case 'reveal': 5050 element.hide(200); 5051 break; 5052 case '3danimation': 5053 if(checkIf3DTransformIsSupported()){ 5054 element.addClass('lm3dactive'); 5055 lmsimplemenu3dclose(element); 5056 }else{ 5057 element.fadeOut(200); 5058 } 5059 break; 5060 } 5061 }; 5062 var hideWithTimeOut = function(element, timeout) 5063 { 5064 timeout = timeout != undefined ? timeout : 500; 5065 return setTimeout(function(){ 5066 if(canHideUl(element)) 5067 intelligentHide(element); 5068 }, timeout); 5069 } 5070 options = { 5071 'orientation': specifiedOptions['orientation'] || 'horizontal', 5072 'animation': specifiedOptions['animation'] || 'none', 5073 'autodocked': specifiedOptions['autodocked'] || 0 5074 }; 5075 //Are we fixed? 5076 var domlvl0 = $(classselector + '.level0'); 5077 menuParent = domlvl0.parent().parent(); 5078 var parentFixed = false; 5079 while(!menuParent.is("body") && !options.autodocked) 5080 { 5081 if(menuParent.css('position') == "fixed") 5082 { 5083 parentFixed = true; 5084 break; 5085 } 5086 else 5087 { 5088 menuParent = menuParent.parent(); 5089 } 5090 } 5091 5092 $(selector).find("li").click(function(){ 5093 var linkTo = $(this).children("a").attr('href'); 5094 if(linkTo){ 5095 location.href = linkTo; 5096 } 5097 });
5098 5099 $(selector + ' li[data-level="0"]').each(function(){ 5100 var me = $(this); 5101 var index = me.data('index'); 5102 var child = $(selector).find('ul[data-listitem-parent="'+index+'"]'); 5103 if(child){ 5104 if(options.orientation == "horizontal"){ 5105 child.css('left', me.position().left + parseInt(me.css('margin-left'))); 5106 child.css('top', me.position().top + me.outerHeight(true) + parseInt(me.css('margin-bottom'))); 5107 } 5108 if(options.orientation == "vertical"){ 5109 child.css('top', me.position().top + parseInt(me.css('margin-top'))); 5110 child.css('left', me.parent().position().left + me.parent().outerWidth(true) + parseInt(me.parent().css('margin-right'))); 5111 } 5112 } 5113 }); 5114 5115 $(selector + ' li:not([data-level="0"])').each(function(){ 5116 var me = $(this); 5117 var index = me.data('index'); 5118 var child = $(selector).find('ul[data-listitem-parent="'+index+'"]'); 5119 if(child){ 5120 child.css('top', me.position().top + me.parent().position().top + parseInt(me.css('margin-top'))); 5121 child.css('left', me.parent().position().left + me.parent().outerWidth(true) + parseInt(me.parent().css('margin-right'))); 5122 } 5123 }); 5124 5125 5126 if(parentFixed) 5127 { 5128 var pageOffset = $(selector).offset(); //VNP 16/05/2016 5129 } 5130 else 5131 { 5132 var pageOffset = $("#Page").offset(); //VNP 16/05/2016 5133 } 5134 $('ul'+ classselector +':not([data-list-level="0"])').each(function(){ 5135 var currentOffset = $(this).offset(); 5136 var delta = {left: currentOffset.left - pageOffset.left, top: currentOffset.top - pageOffset.top}; 5137 $(this).css('left', delta.left); 5138 $(this).css('top', delta.top); 5139 $(this).css('z-index', '100000'); 5140 var element = $(this).detach(); 5141 if(parentFixed) 5142 { 5143 $(selector).append(element); //VNP 16/05/2016 5144 5145 } 5146 else 5147 $("#Page").append(element); //VNP 16/05/2016 5148 }); 5149 if(parentFixed){ 5150 //Separate the menu from its parent and set it to fixed at the same position its parent was. 5151 prevTop = $(selector).offset().top; 5152 prevLeft = $(selector).offset().left; 5153 menu = $(selector).detach(); 5154 menu.css("position","fixed"); 5155 menu.css("z-index","10001"); 5156 menu.css("left",prevLeft); 5157 menu.css("top",prevTop); 5158 $("body").append(menu); 5159 } 5160 5161 // hide all <UL> except the level0 5162 $('ul'+ classselector +':not([data-list-level="0"])').hide(); 5163 5164 var onMouseEnter = function() 5165 { 5166 //Over 5167 var me = $(this).parent(); // li 5168 var meUl = $(this).parent().parent(); // ul 5169 var currentLevel = me.data('level'); 5170 var index = me.data('index'); 5171 var child = $('ul'+ classselector +'[data-listitem-parent="'+index+'"]'); 5172 intelligentShow(child); 5173 5174 // don't hide me 5175 if(toHide[meUl.data('ul-id')] > 0) 5176 { 5177 //console.log('1-dont hide ',meUl.data('ul-id')); 5178 clearTimeout(toHide[meUl.data('ul-id')]); 5179 delete toHide[meUl.data('ul-id')]; 5180 } 5181 // and don't hide my child 5182 if(toHide[child.data('ul-id')] > 0) 5183 { 5184 //console.log('2-dont hide ',child.data('ul-id')); 5185 clearTimeout(toHide[child.data('ul-id')]); 5186 delete toHide[child.data('ul-id')]; 5187 } 5188 // and don't hide all my parents 5189 var indexParents = meUl.data('listitem-parent'); 5190 while(indexParents != undefined && indexParents != "0") 5191 { 5192 var parentUl = $(classselector +' li[data-index="'+indexParents+'"]').parent(); 5193 if(toHide[parentUl.data('ul-id')] > 0) 5194 { 5195 //console.log('3-dont hide ',parentUl.data('ul-id')); 5196 clearTimeout(toHide[parentUl.data('ul-id')]); 5197 delete toHide[parentUl.data('ul-id')]; 5198 } 5199 indexParents = parentUl.data('listitem-parent'); 5200 } 5201 }; 5202 var onMouseLeave = function() 5203 { 5204 var me = $(this).parent();// li 5205 var meUl = $(this).parent().parent(); // ul 5206 var currentLevel = me.data('level'); 5207 var index = me.data('index'); 5208 var child = $('ul'+ classselector +'[data-listitem-parent="'+index+'"]'); 5209 5210 // hide all children 5211 var childIndex = index; 5212 var children = $('ul'+ classselector +'[data-listitem-parent^="'+index+'"]') 5213 for(var i = 0; i < children.length; i++) 5214 { 5215 var _child = $(children[i]); 5216 //console.log("hide ", _child.data('ul-id')); 5217 toHide[_child.data('ul-id')] = hideWithTimeOut(_child); 5218 } 5219 // hide parent without level0 5220 var parentUl = meUl; 5221 var indexParent = parentUl.data('listitem-parent'); 5222 while(currentLevel != "0" && parentUl.data('ul-id') != "0") 5223 { 5224 if(parentUl.data('hover') == 0) 5225 { 5226 //console.log("hide ", parentUl.data('ul-id')); 5227 toHide[parentUl.data('ul-id')] = hideWithTimeOut(parentUl); 5228 }else { 5229 function timeoutCall(ul){ 5230 setTimeout(function(){ 5231 if(canHideUl(ul)) 5232 ul.trigger('mouseleave'); 5233 }, 500); 5234 } 5235 timeoutCall(parentUl); 5236 } 5237 indexParent = parentUl.data('listitem-parent'); 5238 parentUl = $(classselector +' li[data-index="'+indexParent+'"]').parent(); 5239 } 5240 }; 5241 5242 $(classselector + ' li[data-level] > a').hover(onMouseEnter,onMouseLeave); 5243 $(classselector + ' li[data-level] > a').click(onMouseEnter,onMouseLeave); 5244 5245 $('ul'+classselector).hover(function(){ 5246 $(this).attr('data-hover',1).data('hover',1); //store in that element that the mouse is over it 5247 }, 5248 function() 5249 { 5250 $(this).attr('data-hover',0).data('hover',0); //store in that element that the mouse is no longer over it 5251 var currentLevel = $(this).data('list-level'); 5252 if(currentLevel != 0) 5253 { 5254 toHide[$(this).data('ul-id')] = hideWithTimeOut($(this)); 5255 // hide parent without level0 5256 var indexParent = $(this).data('listitem-parent'); 5257 var parentUl = $(classselector +' li[data-index="'+indexParent+'"]').parent(); 5258 while(parentUl.data('ul-id') != 0 && parentUl.data('hover') == 0) 5259 { 5260 toHide[parentUl.data('ul-id')] = hideWithTimeOut(parentUl); 5261 indexParent = parentUl.data('listitem-parent'); 5262 parentUl = $(classselector +' li[data-index="'+indexParent+'"]').parent(); 5263 } 5264 } 5265 });
5266 5267 /******** Update position of subMenu 1 dynamically *********/ 5268 // update position of submenus level1, this depend on the oriontation 5269 $(selector+ ' li[data-level="0"]').hover(function(){ 5270 if(isDocked || parentFixed) 5271 return; 5272 var me = $(this); 5273 var index = me.data('index'); 5274 var child = $('ul'+classselector+'[data-listitem-parent="'+index+'"]'); 5275 var pageOffset = $("#Page").offset(); 5276 var selectorOffset = $(selector).offset(); 5277 var offsetTopInitial = selectorOffset.top; 5278 var offsetLeftInitial = selectorOffset.left ; 5279 if(child && !parentFixed){ 5280 var currentOffset = {left: offsetLeftInitial, top: offsetTopInitial} 5281 if(options.orientation == "horizontal") 5282 { 5283 currentOffset = { 5284 left: offsetLeftInitial+ me.position().left + parseInt(me.css('margin-left')), 5285 top: offsetTopInitial + me.outerHeight(true) + parseInt(me.css('margin-bottom')) 5286 } 5287 } 5288 if(options.orientation == "vertical"){ 5289 currentOffset = { 5290 left: offsetLeftInitial+ me.parent().position().left + me.parent().outerWidth(true) + parseInt(me.parent().css('margin-right')), 5291 top: selectorOffset.top + me.position().top + parseInt(me.css('margin-top')) 5292 } 5293 } 5294 var delta = {left: currentOffset.left - pageOffset.left, top: currentOffset.top - pageOffset.top}; 5295 child.css('left', delta.left); 5296 child.css('top', delta.top); 5297 } 5298 }); 5299 /******** Update position of subMenus 2,3,4... dynamically *********/ 5300 // update position of submenus level2,3,4,5 .... 5301 $(classselector+' > li:not([data-level="0"])').hover(function(){ 5302 if(isDocked || parentFixed) 5303 return; 5304 var me = $(this); 5305 var parent = me.parent(); 5306 var index = me.data('index'); 5307 var child = $('ul'+classselector+'[data-listitem-parent="'+index+'"]'); 5308 var pageOffset = $("#Page").offset(); 5309 var selectorOffset = $(selector).offset(); 5310 var offsetTopInitial = selectorOffset.top; 5311 var offsetLeftInitial = selectorOffset.left; 5312 if(child && !parentFixed){ 5313 var currentOffset = { 5314 left: parent.offset().left + parent.outerWidth(true) + parseInt(parent.css('margin-right')), 5315 top: me.offset().top + parseInt(me.css('margin-top')) 5316 } 5317 var delta = {left: currentOffset.left - pageOffset.left, top: currentOffset.top - pageOffset.top}; 5318 child.css('left', delta.left); 5319 child.css('top', delta.top); 5320 } 5321 }); 5322 5323 var realparent = null; 5324 var originalleft = null; 5325 var originaltop = null; 5326 var elemtmp; 5327 var offsettopinitial = null; 5328 var offsettopend = null; 5329 var offsetleftinitial = null; 5330 var offsetleftend = null; 5331 5332 var activateDocking = function(){ 5333 isDocked = true; 5334 var domlvl0 = $(classselector + '.level0'); 5335 offsettopinitial = domlvl0.offset().top; 5336 offsetleftinitial = domlvl0.offset().left; 5337 realparent = domlvl0.parent(); 5338 var offsets = domlvl0.offset(); 5339 originalleft = parseInt(realparent.css('left')); 5340 originaltop = parseInt(realparent.css('top')); 5341 domlvl0.css('left', offsets.left + 'px'); 5342 domlvl0.css('top', '0px'); 5343 domlvl0.css('z-index', '100000'); 5344 domlvl0.css('position', 'fixed'); 5345 domlvl0.css('-webkit-transform', 'translate3d(0px, 0px, 0px)'); 5346 var elemtmp = domlvl0.detach(); 5347 $('#Page').append(elemtmp); 5348 offsettopend = domlvl0.offset().top; 5349 offsetleftend = domlvl0.offset().left; 5350 //console.log($('ul' + classselector + ':not(.level0)')); 5351 $('ul' + classselector + ':not(.level0)').each(function(){ 5352 if($(this).css('display') == 'none'){ 5353 $(this).show(); 5354 var deltatop = parseInt($(this).offset().top - offsettopinitial); 5355 var deltaleft = parseInt($(this).offset().left); 5356 $(this).hide(); 5357 }else{ 5358 var deltatop = parseInt($(this).offset().top - offsettopinitial); 5359 var deltaleft = parseInt($(this).offset().left); 5360 } 5361 5362 $(this).data('oldtop', $(this).css('top')) 5363 $(this).data('oldleft', $(this).css('left')) 5364 $(this).data('deltatopoffset', deltatop); 5365 $(this).data('deltaleftoffset', deltaleft); 5366 $(this).css('top', deltatop + 'px'); 5367 $(this).css('left', deltaleft + 'px'); 5368 $(this).css('position', 'fixed'); 5369 }); 5370 } 5371 5372 var deactivateDocking = function(){ 5373 isDocked = false; 5374 var domlvl0 = $(classselector + '.level0'); 5375 domlvl0.css('left', 'auto'); 5376 domlvl0.css('top', 'auto'); 5377 domlvl0.css('z-index', '100000'); 5378 domlvl0.css('position', 'static'); 5379 domlvl0.css('-webkit-transform', 'none'); 5380 var elemtmp = domlvl0.detach(); 5381 realparent.append(elemtmp); 5382 5383 $('ul' + classselector + ':not(.level0)').each(function(){ 5384 $(this).css('top', $(this).data('oldtop')); 5385 $(this).css('left', $(this).data('oldleft')); 5386 $(this).css('position', 'absolute'); 5387 }); 5388 } 5389 5390 var scrollHandle = function(){ 5391 if(isScrolled() && !isDocked){ 5392 activateDocking(); 5393 }else if(!isScrolled() && isDocked){ 5394 deactivateDocking(); 5395 } 5396 } 5397 5398 var resizeHandle = function(){ 5399 if(isDocked){ 5400 var domlvl0 = $(classselector + '.level0'); 5401 var initialleft = parseInt(domlvl0.css('left')); 5402 tmpleft = parseInt($(realparent).offset().left) + parseInt($(realparent).css('padding-left')); 5403 domlvl0.css('left', tmpleft + 'px'); 5404 var deltatmp = tmpleft - initialleft; 5405 $('ul' + classselector + ':not(.level0)').each(function(){ 5406 var tmpleft2 = parseInt($(this).css('left')); 5407 tmpleft2 += deltatmp; 5408 $(this).css('left', tmpleft2); 5409 } 5410 ) 5411 } 5412 } 5413 5414 if(options.autodocked){ 5415 $(window).scroll(scrollHandle); 5416 $(window).resize(resizeHandle); 5417 } 5418 5419 return { 5420 isScrolled: isScrolled 5421 } 5422}; 5423
5424var LMSimpleMenuBuilder = function(objname, htmlTemplate, cssTemplate){ 5425 var selector = '#' + objname; 5426 $('head').append(cssTemplate.replace(new RegExp("@ObjectName@", 'g'), objname)); 5427 $(selector).html(htmlTemplate.replace(new RegExp("@ObjectName@", 'g'), objname)); 5428 $("."+objname+" a").each(function(){ 5429 var menuItemId = $(this).attr('id'); 5430 var branchData = $(this).attr('data-branch'); 5431 if(menuItemId != "" && branchData != "" && branchData != "null") 5432 { 5433 var expression = branchData; 5434 var branch = eval( expression ); 5435 LMObjects[objindex++] = new LMDiv(menuItemId,1,1,0,null,0,null,branch,null,null,1); 5436 } 5437 }) 5438} 5439var LMPrivacyPolicyLink = function (cntrlId) { 5440 var selector = '#' + cntrlId; 5441 5442 var branchData = $(selector).attr('data-branch'); 5443 var expression = branchData; 5444 var branch = eval( expression ); 5445 LMObjects[objindex++] = new LMDiv(cntrlId,1,0,0,null,0,null,branch,null,null,1); 5446 5447 try { 5448 fetch(branch.where).then(function (response) { 5449 return response.text(); 5450 }).then(function (html) { 5451 var parser = new DOMParser(); 5452 var doc = parser.parseFromString(html, 'text/html'); 5453 var content = doc.documentElement && doc.documentElement.textContent 5454 var input = document.getElementById(cntrlId + "_input"); 5455 input.value = content; 5456 }); 5457 } 5458 catch(ex) 5459 { 5460 // Ignore, it will fail in local preview 5461 } 5462}; 5463function LMFlash(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp) 5464{ 5465 var LMFlash = new LMObject(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,null,null,null,true); 5466 5467 LMFlash.InitObject=LMFlashInit; 5468 LMFlash.ResizeObject=LMFlashResize; 5469 LMFlash.ShowObject=LMFlashShow; 5470 LMFlash.HideObject=LMFlashHide; 5471 LMFlash.Play=LMFlashPlay; 5472 LMFlash.Stop=LMFlashStop; 5473 LMFlash.TogglePlayState=LMFlashTogglePlayState; 5474 LMFlash.Rewind=LMFlashRewind; 5475 LMFlash.Back=LMFlashBack; 5476 LMFlash.Forward=LMFlashForward; 5477 5478 LMFlash.TagObject.Play=TagPlay; 5479 LMFlash.TagObject.Stop=TagStop; 5480 LMFlash.TagObject.TogglePlayState=TagTogglePlayState; 5481 LMFlash.TagObject.Rewind=LMFlashTagRewind; 5482 LMFlash.TagObject.Back=LMFlashTagBack; 5483 LMFlash.TagObject.Forward=LMFlashTagForward; 5484 5485 var tagdiv=FindTagFromId(id); 5486 tagdiv.drawok=1; 5487 5488 return LMFlash; 5489} 5490 5491function LMFlashInit() 5492{ 5493 var flash=FindTagFromId(this.id+"Embed"); 5494 if(flash==null) { alert("flash=null"); return; } 5495 5496 if(flash.init==true) return; 5497 flash.init=true; 5498 5499 flash.objectid=this.id; 5500 this.object=flash; 5501} 5502 5503function LMFlashResize(propw,proph) 5504{ 5505 var flash=FindTagFromId(this.id+"Embed"); 5506 if(flash==null) { alert("flash=null"); return; } 5507 flash.width=this.TagObject.GetWidth(); 5508 flash.height=this.TagObject.GetHeight(); 5509} 5510 5511function LMFlashShow() 5512{ 5513 if(!this.object) return; 5514 if(this.autostart) { 5515 try { 5516 this.object.Play(); 5517 }catch(e){} 5518 } 5519} 5520 5521function LMFlashHide() 5522{ 5523 if(!this.object) return; 5524 try { 5525 this.object.FrameNum=0; 5526 }catch(e){} 5527} 5528 5529function LMFlashPlay() 5530{ 5531 if(!this.object) return; 5532 if(this.TagObject.IsVisible()==false) return; 5533 try { 5534 this.object.Play(); 5535 }catch(e){} 5536} 5537 5538function LMFlashStop() 5539{ 5540 if(!this.object) return; 5541 if(this.TagObject.IsVisible()==false) return; 5542 try { 5543 this.object.Stop(); 5544 }catch(e){} 5545} 5546 5547function LMFlashTogglePlayState() 5548{ 5549 if(this.object.Playing==true) this.Stop(); 5550 else this.Play(); 5551} 5552 5553function LMFlashTagRewind() 5554{ 5555 var object=FindClassObjectFromId(this.id); 5556 if(!object) return; 5557 if(object.Rewind) object.Rewind(); 5558} 5559 5560function LMFlashTagBack() 5561{ 5562 var object=FindClassObjectFromId(this.id); 5563 if(!object) return; 5564 if(object.Back) object.Back(); 5565} 5566 5567function LMFlashTagForward() 5568{ 5569 var object=FindClassObjectFromId(this.id); 5570 if(!object) return; 5571 if(object.Forward) object.Forward(); 5572} 5573 5574function LMFlashRewind() 5575{ 5576 if(!this.object) return; 5577 if(this.TagObject.IsVisible()==false) return; 5578 try { 5579 this.object.Rewind(); 5580 }catch(e){} 5581} 5582 5583function LMFlashForward() 5584{ 5585 if(!this.object) return; 5586 if(this.TagObject.IsVisible()==false) return; 5587 try { 5588 this.object.Forward(); 5589 }catch(e){} 5590} 5591 5592function LMFlashBack() 5593{ 5594 if(!this.object) return; 5595 if(this.TagObject.IsVisible()==false) return; 5596 try { 5597 this.object.Back(); 5598 }catch(e){} 5599} 5600 5601 5602function LMListValue(value,assvalue,selected) 5603{ 5604 this.value = value; 5605 this.assvalue = assvalue; 5606 this.selected = selected; 5607} 5608 5609function LMInputEnable() 5610{ 5611 if(!this.object) return; 5612 this.object.disabled=false; 5613 FireEvent(this.id,"_OnEnable"); 5614} 5615 5616function LMInputDisable() 5617{ 5618 if(!this.object) return; 5619 this.object.disabled=true; 5620 FireEvent(this.id,"_OnDisable"); 5621} 5622 5623function LInputToggleEnableState() 5624{ 5625 if(!this.object) return; 5626 this.object.disabled=!this.object.disabled; 5627 5628 if(this.object.disabled==false) FireEvent(this.id,"_OnEnable"); 5629 else FireEvent(this.id,"_OnDisable"); 5630} 5631 5632function CheckRadioOnClick(id) 5633{ 5634 FireEvent(id,"_OnClick"); 5635 FireEvent(id,"_OnChange"); 5636} 5637 5638function CheckRadioOnKeyPress(id) 5639{ 5640 FireEvent(id,"_OnKeyPress"); 5641 FireEvent(id,"_OnChange"); 5642} 5643 5644function AddElemToForm(form,id) 5645{ 5646 var formtag=FindTagFromId(form); 5647 if(!formtag.ListElems) formtag.ListElems=new Array(); 5648 formtag.ListElems[formtag.ListElems.length]=id; 5649} 5650 5651function IsAllDigit(c) 5652{ 5653 if(!(c>='0' && c<='9')) return 0; 5654 return 1; 5655} 5656 5657function IsAllAlpha(c) 5658{ 5659 if(c>='a' && c<='z') return 1; 5660 if(c>='A' && c<='Z') return 1; 5661 switch(c) { 5662 case 'à ': 5663 case 'â': 5664 case 'ä':
5665 case 'Ã': 5666 case 'Ã': 5667 case 'Ã': 5668 case 'Ã¥': 5669 case 'é': 5670 case 'è': 5671 case 'ê': 5672 case 'ë': 5673 case 'Ã': 5674 case 'Ã': 5675 case 'Ã': 5676 case 'Ã': 5677 case 'Ã': 5678 case 'ì': 5679 case 'î': 5680 case 'ï': 5681 case 'Ã': 5682 case 'Ã': 5683 case 'Ã': 5684 case 'Ã': 5685 case 'ó': 5686 case 'ò': 5687 case 'ô': 5688 case 'ö': 5689 case 'õ': 5690 case 'Ã': 5691 case 'Ã': 5692 case 'Ã': 5693 case 'Ã': 5694 case 'Ã': 5695 case 'ú': 5696 case 'ù': 5697 case 'û': 5698 case 'ü': 5699 case 'Ã': 5700 case 'Ã': 5701 case 'Ã': 5702 case 'Ã': 5703 case 'ý': 5704 case 'Ã': 5705 case 'ÿ': 5706 case 'Ã': 5707 case 'ç': 5708 case ' ': 5709 return 1; 5710 } 5711 return 0; 5712} 5713 5714function IsMail(string) 5715{ 5716 var i; 5717 var length=string.length; 5718 for(i=0; i<length; i++) { 5719 var c=string.charAt(i); 5720 if(c=='@') return 1; 5721 } 5722 return 0; 5723} 5724 5725function IsBlank(string) 5726{ 5727 var i; 5728 var length=string.length; 5729 for(i=0; i<length; i++) { 5730 if(string.charAt(i) != ' ') return 0; 5731 } 5732 return 1; 5733} 5734 5735function LMInputField(id,form,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,validdigit,validalpha,validmail,validreq) 5736{ 5737 var LMInput = new LMObject(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,null,null,null,true); 5738 5739 LMInput.validdigit=validdigit; 5740 LMInput.validalpha=validalpha; 5741 LMInput.validmail=validmail; 5742 LMInput.validreq=validreq; 5743 5744 AddElemToForm(form,id); 5745 5746 var tagdiv=FindTagFromId(id); 5747 tagdiv.drawok=1; 5748 5749 tagdiv.Enable=LMInputEnable; 5750 tagdiv.Disable=LMInputDisable; 5751 tagdiv.ToggleEnableState=LInputToggleEnableState; 5752 tagdiv.object=eval("document."+form+".obj"+id); 5753 5754 return LMInput; 5755} 5756 5757function LMInputSimpleField(id,form,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,validdigit,validalpha,validmail,validreq) 5758{ 5759 var LMInput = new LMObject(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,null,null,null,true); 5760 5761 LMInput.validdigit=validdigit; 5762 LMInput.validalpha=validalpha; 5763 LMInput.validmail=validmail; 5764 LMInput.validreq=validreq; 5765 5766 AddElemToForm(form,id); 5767 5768 var tagdiv=FindTagFromId(id); 5769 tagdiv.drawok=1; 5770 5771 tagdiv.Enable=LMInputEnable; 5772 tagdiv.Disable=LMInputDisable; 5773 tagdiv.ToggleEnableState=LInputToggleEnableState; 5774 tagdiv.object=$("#"+id)[0]; 5775 5776 return LMInput; 5777} 5778 5779 5780function LMInputButton(id,form,initvisible,displayenable,delais,effect,delaisdisp,effectdisp) 5781{ 5782 var LMInput = new LMObject(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,null,null,null,true); 5783 5784 var tagdiv=FindTagFromId(id); 5785 tagdiv.drawok=1; 5786 5787 tagdiv.Enable=LMInputEnable; 5788 tagdiv.Disable=LMInputDisable; 5789 tagdiv.ToggleEnableState=LInputToggleEnableState; 5790 tagdiv.object=eval("document."+form+".obj"+id); 5791 5792 return LMInput; 5793} 5794 5795function ButonOnClickSubmit(id,form) 5796{ 5797 FireEvent(id,"_OnClick"); 5798 var objform=FindTagFromId(form); 5799 if(!objform) return; 5800 objform.FSubmit(); 5801} 5802 5803function ButonOnClickReset(id,form) 5804{ 5805 FireEvent(id,"_OnClick"); 5806 var objform=FindTagFromId(form); 5807 if(!objform) return; 5808 objform.FReset(); 5809} 5810 5811function ValidateForm(form) 5812{ 5813 var formtag=FindTagFromId(form); 5814 5815 if(!formtag.ListElems) return 1; 5816 5817 var i,j; 5818 var listelems = formtag.ListElems.length; 5819 for(i=0; i<listelems; i++) { 5820 var tagobject=FindTagFromId(formtag.ListElems[i]); 5821 var inputtag=tagobject.object; 5822 var objet=FindClassObjectFromTagDiv(tagobject); 5823 5824 if(objet.validreq) { 5825 if (inputtag.type == "checkbox") { 5826 if (!inputtag.checked) { 5827 if(inputtag.id.includes("RGDP")) 5828 alert(RES_VALIDCONSENT); 5829 else 5830 alert(RES_VALIDBLANK); 5831 inputtag.focus(); 5832 return 0; 5833 } 5834 } 5835 else if (IsBlank(inputtag.value)) { 5836 alert(RES_VALIDBLANK); 5837 inputtag.focus(); 5838 return 0; 5839 } 5840 } 5841 5842 if(objet.validmail) { 5843 if(!IsMail(inputtag.value)) { 5844 alert(RES_VALIDMAIL); 5845 inputtag.focus(); 5846 return 0; 5847 } 5848 } 5849 5850 var length=inputtag.value.length; 5851 for(j=0; j<length; j++) { 5852 var c=inputtag.value.charAt(j); 5853 5854 if(objet.validdigit && objet.validalpha) { 5855 if(!IsAllDigit(c) && !IsAllAlpha(c)) { 5856 alert(RES_VALIDDIGITALPHA); 5857 inputtag.focus(); 5858 return 0; 5859 } 5860 } 5861 5862 if(objet.validdigit && !objet.validalpha) { 5863 if(!IsAllDigit(c)) { 5864 alert(RES_VALIDDIGIT); 5865 inputtag.focus(); 5866 return 0; 5867 } 5868 } 5869 5870 if(!objet.validdigit && objet.validalpha) { 5871 if(!IsAllAlpha(c)) { 5872 alert(RES_VALIDALPHA); 5873 inputtag.focus(); 5874 return 0; 5875 } 5876 } 5877 } 5878 } 5879 5880 return 1; 5881} 5882 5883function FormSubmit() 5884{
5885 if(ValidateForm(this.id)==0) return false; 5886 if(this.lmcheck) this.lmcheck.value='LMGoodV5_2'; 5887 if(this.lmserial) this.lmserial.value=eval(this.id+"v1"); 5888 if(this.lmserialemail) this.lmserialemail.value=eval(this.id+"v2"); 5889 if(this.lmto) this.lmto.value=eval(this.id+"v3"); 5890 if(this.lmserialwc) this.lmserialwc.value=eval(this.id+"v4"); 5891 if(this.lmactivationkey) this.lmactivationkey.value=eval(this.id+"v5"); 5892 5893 [...this.getElementsByTagName("input")].filter(x => x.type == "button").forEach(x => x.setAttribute('disabled', 'disabled')) 5894 this.onsubmit(); 5895 this.submit(); 5896 return false; 5897} 5898 5899function FormReset() 5900{ 5901 this.reset(); 5902} 5903 5904function FormBindSubmitReset(id) 5905{ 5906 var object=FindTagFromId(id); 5907 if(!object) return; 5908 5909 object.FSubmit=FormSubmit; 5910 object.FReset=FormReset; 5911} 5912 5913function AdjustCheckRadioPosition(id) 5914{ 5915 var tagdiv=document.getElementById(id); 5916 var x=tagdiv.GetLeft(); 5917 var y=tagdiv.GetTop(); 5918 if(is.opera) { 5919 tagdiv.SetLeft(x+3); 5920 tagdiv.SetTop(y+2); 5921 } 5922 else if(is.safari) { 5923 tagdiv.SetLeft(x+2); 5924 tagdiv.SetTop(y+2); 5925 } 5926 else if(is.ns) { 5927 tagdiv.SetTop(y+1); 5928 } 5929} 5930 5931 5932function LMGroup(id,initvisible,obj_list) 5933{ 5934 var LMGroup = new LMObject(id,initvisible,0,0,null,0,null,null,null,null,true); 5935 5936 var tagdiv=document.getElementById(id); 5937 LMGroup.TagDiv=tagdiv; 5938 tagdiv.objectid=id; 5939 tagdiv.drawok= true; 5940 5941 LMGroup.objlist= obj_list; 5942 LMGroup.InitObject= LMGroupInit; 5943 LMGroup.ShowObject= LMGroupShow; 5944 LMGroup.HideObject= LMGroupHide; 5945 if(initvisible==0) LMGroup.HideObject(); 5946 LMGroup.visible= true; 5947 5948 return LMGroup; 5949} 5950 5951function LMGroupInit() 5952{ 5953 if(this.init==true) return; 5954 for(i=0; i>this.objlist.length; i++) { 5955 var obj=FindClassObjectFromId(this.objlist[i]); 5956 if(!obj) continue; 5957 5958 obj.groupid=this.id; 5959 } 5960 this.init=true; 5961} 5962 5963function LMGroupShow() 5964{ 5965 for(i=0; i<this.objlist.length; i++) { 5966 var obj=FindClassObjectFromId(this.objlist[i]); 5967 if(!obj) continue; 5968 5969 if(obj.visible==true && obj.delais==0) obj.TagObject.Show(); 5970 } 5971} 5972 5973function LMGroupHide() 5974{ 5975 for(i=0; i<this.objlist.length; i++) { 5976 var obj=FindClassObjectFromId(this.objlist[i]); 5977 if(!obj) continue; 5978 5979 obj.initvisible= false; 5980 if(obj.visible==true) { 5981 obj.TagObject.Hide(); 5982 obj.visible=true; 5983 } 5984 } 5985} 5986 5987function LMIAnim(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,branchlist,tooltip,param,imagelist,islooping,loop_count,auto_start,controls,secpimg) 5988{ 5989 var tmp = " "; 5990 5991 var LMIAnim = new LMObject(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,branchlist,tooltip,param,true); 5992 5993 flagbranch=false; 5994 if(branchlist) { 5995 for(var i=0; i<branchlist.length; i++) { 5996 if(branchlist[i]) { 5997 flagbranch=true; 5998 break; 5999 } 6000 } 6001 } 6002 6003 var tagimg=document.getElementById("LMIAnim"+id); 6004 if(tooltip) tagimg.alt=tooltip; 6005 6006 tagimg.onmouseover=TagLMIAnimMouseOver; 6007 tagimg.onmouseout=TagLMIAnimMouseOut; 6008 tagimg.onload=new Function("TagLMIAnimLoad(document.getElementById('"+tagimg.id+"'));"); 6009 tagimg.onmouseup=LMGlobalUp; 6010 tagimg.onmousedown=LMGlobalDn; 6011 6012 LMIAnim.MouseUp=LMIAnimMouseUp; 6013 LMIAnim.MouseOver=LMIAnimMouseOver; 6014 LMIAnim.MouseOut=LMIAnimMouseOut; 6015 LMIAnim.InitObject=LMIAnimInit; 6016 LMIAnim.ResizeObject=LMIAnimResize; 6017 LMIAnim.init=false; 6018 LMIAnim.Play=LMIAnimPlay; 6019 LMIAnim.Stop=LMIAnimStop; 6020 LMIAnim.TogglePlayState=LMIAnimTogglePlayState; 6021 LMIAnim.RollIn=LMIAnimRollIn; 6022 LMIAnim.RollOut=LMIAnimRollOut; 6023 LMIAnim.ShowObject=LMIAnimShow; 6024 LMIAnim.HideObject=LMIAnimHide; 6025 6026 LMIAnim.ImageList=imagelist; 6027 LMIAnim.CurImageIndex=0; 6028 LMIAnim.CanPlay=false; 6029 LMIAnim.islooping=islooping; 6030 if(loop_count<1) LMIAnim.loop_count=1; 6031 else LMIAnim.loop_count=loop_count; 6032 LMIAnim.auto_start=auto_start; 6033 LMIAnim.controls=controls; 6034 LMIAnim.secpimg=secpimg; 6035 LMIAnim.InTimeOut=false; 6036 6037 LMIAnim.TagObject.Play=TagPlay; 6038 LMIAnim.TagObject.Stop=TagStop; 6039 LMIAnim.TagObject.TogglePlayState=TagTogglePlayState; 6040 LMIAnim.TagObject.RollIn=TagRollIn; 6041 LMIAnim.TagObject.RollOut=TagRollOut; 6042 6043 LMIAnim.TagImg=tagimg; 6044 6045 tagimg.objectid=id; 6046 tagimg.onerror=TagLMIAnimError; 6047 6048 var last = preloadImages.length; 6049 for(var i=0; i<imagelist.length; i++) { 6050 preloadImages[last] = new Image; 6051 preloadImages[last++].src = imagelist[i]; 6052 } 6053 6054 return LMIAnim; 6055} 6056 6057function LMIAnimChangeImage(TagImg) 6058{ 6059 var LMObject=FindClassObjectFromId(TagImg.objectid); 6060 if(!LMObject) return; 6061 if(LMObject.init==false) return; 6062 6063 LMObject.InTimeOut=false; 6064 if(LMObject.ImageList.length<=0) return; 6065 if(LMObject.CurImageIndex>=LMObject.ImageList.length) LMObject.CurImageIndex=LMObject.ImageList.length-1; 6066 if(LMObject.CanPlay==false) return; 6067 6068 TagImg.src = LMObject.ImageList[LMObject.CurImageIndex]; 6069} 6070 6071function TagLMIAnimLoad(TagImg) 6072{ 6073 var LMObject=FindClassObjectFromId(TagImg.objectid); 6074 if(!LMObject) return; 6075 if(LMObject.init==false) return; 6076 6077 if(TagImg.complete==false) { 6078 setTimeout("TagLMIAnimLoad(FindTagFromId(\"LMIAnim" + TagImg.objectid + "\"))",100.); 6079 return; 6080 } 6081 6082 var tagdiv=FindTagFromId(TagImg.objectid); 6083 tagdiv.drawok=1; 6084 6085 var LMObject=FindClassObjectFromId(TagImg.objectid); 6086 if(!LMObject) return; 6087 6088 if(LMObject.InTimeOut==true) { 6089 setTimeout("TagLMIAnimLoad(FindTagFromId(\"LMIAnim" + TagImg.objectid + "\"))",100.); 6090 return; 6091 } 6092 6093 if(tagdiv.drawingeffect!=2) { 6094 setTimeout("TagLMIAnimLoad(FindTagFromId(\"LMIAnim" + TagImg.objectid + "\"))",100.); 6095 return; 6096 } 6097 6098 LMObject.CurImageIndex++; 6099 if(LMObject.CurImageIndex<LMObject.ImageList.length) {} 6100 else if(LMObject.islooping) { 6101 LMObject.CurImageIndex=0; 6102 LMObject.loop_count--; 6103 if(LMObject.loop_count==0) { 6104 if(LMObject.BranchLst.length>=2 && LMObject.BranchLst[1]!=null) { 6105 LMObjectClick(TagImg.objectid,1); 6106 } 6107 } 6108 } 6109 else return; 6110 6111 LMObject.InTimeOut=true; 6112 setTimeout("LMIAnimChangeImage(FindTagFromId(\"LMIAnim" + TagImg.objectid + "\"))",LMObject.secpimg*1000.); 6113} 6114 6115function TagLMIAnimError() 6116{ 6117 var LMObject=FindClassObjectFromId(this.objectid); 6118 if(!LMObject) return; 6119 var tagdiv=FindTagFromId(this.objectid); 6120 if(this.src!="" && LMObject.init==true) { 6121 //alert("IAnim on error"); 6122 tagdiv.drawok=1; 6123 } 6124} 6125 6126function LMIAnimInit() 6127{ 6128 if(this.init==true) return; 6129 this.init=true; 6130 6131 if (this.ImageList.length>0) { 6132 this.TagImg.src = this.ImageList[0]; 6133 TagLMIAnimLoad(this.TagImg); 6134 } 6135 6136 if(this.initvisible) this.Play(); 6137} 6138 6139function LMIAnimResize(propw,proph) 6140{
6141 TagImg=FindTagFromId("LMIAnim"+this.id); 6142 if(TagImg==null) { alert("TagImg=null"); return; } 6143 TagImg.width=this.TagObject.GetWidth(); 6144 TagImg.height=this.TagObject.GetHeight(); 6145} 6146 6147function TagLMIAnimMouseOver(e) 6148{ 6149 if(e==null) var e=window.event; 6150 e.cancelBubble = true; 6151 6152 LMGlobalOver(this.id); 6153} 6154 6155function TagLMIAnimMouseOut(e) 6156{ 6157 if(e==null) var e=window.event; 6158 e.cancelBubble = true; 6159 6160 LMGlobalOver(-1); 6161} 6162 6163function LMIAnimMouseUp() 6164{ 6165 LMObjectClick(this.id,0); 6166} 6167 6168//function LMIAnimMouseDn() 6169//{ 6170//} 6171 6172function LMIAnimMouseOver() 6173{ 6174 if((this.BranchLst&&this.BranchLst[0])) window.status=this.BranchLst[0].where; 6175 if((this.BranchLst && this.BranchLst[0])) { 6176 if(this.BranchLst[0].where) this.TagImg.style.cursor = "pointer"; 6177 } 6178} 6179 6180function LMIAnimMouseOut() 6181{ 6182 if((this.BranchLst&&this.BranchLst[0])) window.status=""; 6183} 6184 6185function LMIAnimShow() 6186{ 6187 if(this.auto_start) this.Play(); 6188} 6189 6190function LMIAnimHide() 6191{ 6192 this.CanPlay=false; 6193 this.CurImageIndex=0; 6194 this.InTimeOut=false; 6195 this.TagImg.src = this.ImageList[0]; 6196} 6197 6198function LMIAnimPlay() 6199{ 6200 if(this.TagObject.IsVisible()==false) return; 6201 this.InTimeOut=false; 6202 6203 this.CurImageIndex=0; 6204 if(this.TagImg.src == this.ImageList[0]) TagLMIAnimLoad(this.TagImg); 6205 else this.TagImg.src=this.ImageList[0]; 6206 this.CanPlay=true; 6207} 6208 6209function LMIAnimStop() 6210{ 6211 if(this.TagObject.IsVisible()==false) return; 6212 this.CanPlay=false; 6213 this.CurImageIndex=0; 6214 this.InTimeOut=false; 6215 this.TagImg.src = this.ImageList[0]; 6216} 6217 6218function LMIAnimTogglePlayState() 6219{ 6220 if(this.CanPlay) this.Stop(); 6221 else this.Play(); 6222} 6223 6224function LMIAnimRollIn() 6225{ 6226 LMIAnim=FindClassObjectFromId(this.id); 6227 if(!LMIAnim) return; 6228 LMIAnim.TagObject.Show(); 6229 LMIAnim.TagObject.Play(); 6230} 6231 6232function LMIAnimRollOut() 6233{ 6234 LMIAnim=FindClassObjectFromId(this.id); 6235 if(!LMIAnim) return; 6236 LMIAnim.TagObject.Stop(); 6237 LMIAnim.TagObject.Hide(); 6238} 6239 6240 6241function LMImage(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,branch,tooltip,param,cursor) 6242{ 6243 var BranchLst = null; 6244 if (branch) { 6245 BranchLst = new Array(branch); 6246 } 6247 6248 var LMImage = new LMObject(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,BranchLst,tooltip,param,true); 6249 6250 var tagchilds=document.getElementById(id+"Childs"); 6251 if(tagchilds) { 6252 tagchilds.onmouseover=TagLMImageMouseOver; 6253 tagchilds.onmouseout=TagLMImageMouseOut; 6254 tagchilds.onmouseup=LMGlobalUp; 6255 tagchilds.onmousedown=LMGlobalDn; 6256 tagchilds.objectid=id; 6257 } 6258 6259 var tagimg=document.getElementById(id+"Inner"); 6260 6261 if(tooltip) tagimg.alt=tooltip; 6262 6263 tagimg.SetWidth=TagSetWidth; 6264 tagimg.SetHeight=TagSetHeight; 6265 tagimg.onmouseover=TagLMImageMouseOver; 6266 tagimg.onmouseout=TagLMImageMouseOut; 6267 tagimg.onload=new Function("TagLMImageLoad(document.getElementById('"+tagimg.id+"'));"); 6268 tagimg.onmouseup=LMGlobalUp; 6269 tagimg.onmousedown=LMGlobalDn; 6270 6271 LMImage.MouseOver=LMImageMouseOver; 6272 LMImage.MouseOut=LMImageMouseOut; 6273 LMImage.MouseUp=LMImageMouseUp; 6274 LMImage.InitObject=LMImageInit; 6275 LMImage.ResizeObject=LMImageResize; 6276 LMImage.imagesrc=tagimg.src; 6277 LMImage.init=false; 6278 6279 LMImage.cursor=cursor; 6280 LMImage.TagImg=tagimg; 6281 tagimg.objectid=id; 6282 tagimg.onerror=TagLMImageError; 6283 if(is.opera) tagimg.src="./toto.gif"; 6284 6285 return LMImage; 6286} 6287 6288function TagLMImageLoad(TagImg) 6289{ 6290 var LMObject=FindClassObjectFromId(TagImg.objectid); 6291 if(!LMObject) return; 6292 if(LMObject.init==false) return; 6293 6294 if(TagImg.complete==false) { 6295 setTimeout("TagLMImageLoad(FindTagFromId('" + TagImg.objectid + "Inner'))",100.); 6296 return; 6297 } 6298 6299 var tagdiv=FindTagFromId(TagImg.objectid); 6300 tagdiv.drawok=1; 6301} 6302 6303function TagLMImageError() 6304{ 6305 var LMObject=FindClassObjectFromId(this.objectid); 6306 if(!LMObject) return; 6307 6308 var tagdiv=FindTagFromId(this.objectid); 6309 if(this.src!="" && LMObject.init==true) { 6310 //alert("Image on error"); 6311 tagdiv.drawok=1; 6312 } 6313} 6314 6315function LMImageInit() 6316{ 6317 if(this.init==true) return; 6318 this.init=true; 6319 if (this.imagesrc) { 6320 this.TagImg.src = this.imagesrc; 6321 TagLMImageLoad(this.TagImg); 6322 } 6323} 6324 6325function LMImageResize(propw,proph) 6326{ 6327 TagImg=FindTagFromId(this.id+"Inner");
6328 if(TagImg==null) { alert("TagImg=null"); return; } 6329 TagImg.SetWidth(this.TagObject.GetWidth()); 6330 TagImg.SetHeight(this.TagObject.GetHeight()); 6331} 6332 6333function TagLMImageMouseOver(e) 6334{ 6335 if(e==null) var e=window.event; 6336 e.cancelBubble = true; 6337 6338 LMGlobalOver(this.objectid); 6339} 6340 6341function TagLMImageMouseOut(e) 6342{ 6343 if(e==null) var e=window.event; 6344 e.cancelBubble = true; 6345 6346 LMGlobalOver(-1); 6347} 6348 6349function LMImageMouseUp() 6350{ 6351 LMObjectClick(this.id,0); 6352} 6353 6354function LMImageMouseOver() 6355{ 6356 if(this.cursor) this.TagImg.style.cursor = "pointer"; 6357 if(this.BranchLst) GadgetShowLink(this.BranchLst[0]); 6358} 6359 6360function LMImageMouseOut() 6361{ 6362 if(this.BranchLst) window.status=""; 6363} 6364 6365function LMImageClosePopUp(id) 6366{ 6367 $("#"+id).dialog("close"); 6368} 6369 6370function LMImageOpenPopUp(id,w,h) 6371{ 6372 id=id+'PopUp'; 6373 6374 var obj=FindTagFromId(id); 6375 obj.onclick=new Function("LMImageClosePopUp('"+id+"');"); 6376 var src = $("#"+id+"Inner").attr("src"); 6377 if(src.indexOf("_lmresized_") !== -1) 6378 { 6379 var newSr
6379c = src.substring(0,src.search("_lmresized_")) + src.substring(src.lastIndexOf(".")); 6380 $("#"+id+"Inner").attr("src",newSrc); 6381 } 6382 $("#"+id).css({'overflow':'hidden','cursor':'pointer'}); 6383 $("#"+id).dialog({width:'auto', height:'auto', modal:true, draggable:false, resizable:false, position:'center', closeOnEscape:true, closeText:'', show: {effect: "fade", duration: 300}, hide: {effect: "fade", duration: 300}}); 6384 6385 $("#"+id).css({'width':w+'px','height':h+'px','padding-left':'0px','padding-top':'0px','padding-right':'0px','padding-bottom':'0px'}); 6386 $("#"+id).parent().css({'width':w+'px','height':'auto','left':'0px','top':'0px','padding-left':'0px','padding-top':'0px','padding-right':'0px','padding-bottom':'0px'}); 6387 6388 $("#"+id).parent().LMCentreInWindow(); 6389 6390 $("#ui-dialog-title-" + id).parent().hide(); 6391 $(".ui-widget-overlay").css({'opacity':'0.6','background':'none','background-Color':'#000000','cursor':'pointer'}); 6392 6393 $("#"+id).parent().css({'-webkit-border-radius': '10px'}); 6394 $("#"+id).parent().css({'-moz-border-radius': '10px'}); 6395 $("#"+id).parent().css({'border-radius': '10px'}); 6396 6397 $("#"+id).parent().css({'box-shadow': '10px 10px 10px rgba(0,0,0,0.5)'}); 6398 $("#"+id).parent().css({'-moz-box-shadow': '10px 10px 5px rgba(0,0,0,0.5)'}); 6399 $("#"+id).parent().css({'-webkit-box-shadow': '10px 10px 5px rgba(0,0,0,0.5)'}); 6400 $('.ui-widget-overlay').click(function() { $("#"+id).dialog('close'); }); 6401} 6402 6403var gRootMenuArray= new Array(); 6404 6405function RegisterMainMenu(MainMenu) { 6406 gRootMenuArray[gRootMenuArray.length]= MainMenu; 6407 //document.onmousemove=HideOpenedMenus; 6408 $(document).bind('mousemove', HideOpenedMenus); 6409} 6410 6411function MenuHitTest(menu) { 6412 var layer= FindTagFromId(menu.id); 6413 if(layer.style.visibility == "hidden") return false; 6414 6415 var pagediv=FindTagFromId("Page"); 6416 var oxstretch= pagediv.GetLeft(); 6417 var oystretch= pagediv.GetTop(); 6418 6419 if ( mnuX >= oxstretch + layer.offsetLeft && 6420 mnuX <= oxstretch + layer.offsetLeft + layer.offsetWidth && 6421 mnuY >= oystretch + layer.offsetTop && 6422 mnuY <= oystretch + layer.offsetTop + layer.offsetHeight) return true; 6423 6424 var i; 6425 for (i= 0; i < menu.itemList.length; i++) { 6426 var item= menu.itemList[i]; 6427 if (item.submenu) { 6428 var ret= MenuHitTest(item.submenu); 6429 if (ret == true) { 6430 return true; 6431 } 6432 } 6433 } 6434 6435 return false; 6436} 6437 6438var mnuX= 0; 6439var mnuY= 0; 6440 6441function getScrollXY() { 6442 var scrOfX = 0, scrOfY = 0; 6443 if( typeof( window.pageYOffset ) == 'number' ) { 6444 scrOfY = window.pageYOffset; 6445 scrOfX = window.pageXOffset; 6446 } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) { 6447 scrOfY = document.body.scrollTop; 6448 scrOfX = document.body.scrollLeft; 6449 } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) { 6450 scrOfY = document.documentElement.scrollTop; 6451 scrOfX = document.documentElement.scrollLeft; 6452 } 6453 return [ scrOfX, scrOfY ]; 6454} 6455 6456function HideOpenedMenus(e) 6457{ 6458 if(e==null) e=window.event; 6459 6460 var scroll= getScrollXY(); 6461 6462 mnuX = e.clientX + scroll[0]; 6463 mnuY = e.clientY + scroll[1]; 6464 6465 var i; 6466 for (i= 0; i < gRootMenuArray.length; i++) { 6467 var menu= gRootMenuArray[i]; 6468 if (!menu.opened) continue; 6469 if (MenuHitTest(menu)) continue; 6470 6471 var j; 6472 for (j= 0; j < menu.itemList.length; j++) { 6473 var item= menu.itemList[j]; 6474 if (item.submenu) { 6475 if (MenuHitTest(item.submenu)) continue; 6476 HideSubMenu(item.submenu); 6477 } 6478 } 6479 6480 menu.opened= false; 6481 6482 SendMenuToBack(menu); 6483 } 6484} 6485 6486function FindMenu(rendu, menu) { 6487 var i; 6488 for (i= 0; i < rendu.itemList.length; i++) { 6489 var item= rendu.itemList[i]; 6490 if (item.submenu) { 6491 CloseUnfocusedBranches(rendu,menu); 6492 if (FindMenu(item.submenu, menu)) { 6493 return true; 6494 } 6495 } 6496 } 6497 6498 if (rendu == menu) return true; 6499 return false; 6500} 6501 6502function CloseUnfocusedBranches(menu,focused) { 6503 var i; 6504 for (i= 0; i < menu.itemList.length; i++) { 6505 var mnu= menu.itemList[i]; 6506 if (mnu.submenu) { 6507 if (!FindMenu(mnu.submenu,focused)) HideSubMenu(mnu.submenu); 6508 } 6509 } 6510} 6511 6512function FindMenu(rendu, menu) { 6513 var i; 6514 for (i= 0; i < rendu.itemList.length; i++) { 6515 var item= rendu.itemList[i]; 6516 if (item.submenu) { 6517 CloseUnfocusedBranches(rendu,menu); 6518 if (FindMenu(item.submenu, menu)) { 6519 return true; 6520 } 6521 } 6522 } 6523 6524 if (rendu == menu) return true; 6525 return false; 6526} 6527 6528function BringMenuToFront(menu) { 6529 var layer= FindTagFromId(menu.id); 6530 layer.style.zIndex= Number(layer.style.zIndex) + Number(Math.abs(z_index)); 6531 6532 var i; 6533 for (i= 0; i < menu.itemList.length; i++) { 6534 var item= menu.itemList[i]; 6535 if (item.submenu) { 6536 BringMenuToFront(item.submenu); 6537 } 6538 } 6539} 6540 6541function SendMenuToBack(menu) { 6542 var layer= FindTagFromId(menu.id); 6543 layer.style.zIndex= Number(layer.style.zIndex) - Number(Math.abs(z_index)); 6544 6545 var i; 6546 for (i= 0; i < menu.itemList.length; i++) { 6547 var item= menu.itemList[i]; 6548 if (item.submenu) { 6549 SendMenuToBack(item.submenu); 6550 } 6551 } 6552} 6553 6554function LMMenuItemStruct(id,x,y,w,h,initvisible,delais,effect,delaisdisp,effectdisp,branch,tooltip,param,ImageUp,ImageOver,submenu,upstyle,overstyle,caption) 6555{ 6556 this.id = id; 6557 6558 this.x = x; 6559 this.y = y; 6560 this.w = w; 6561 this.h = h; 6562 6563 this.initvisible= initvisible; 6564 6565 this.delais = delais; 6566 this.effect = effect; 6567 6568 this.delaisdisp = delaisdisp; 6569 this.effectdisp = effectdisp; 6570 6571 this.branch = branch; 6572 6573 this.tooltip = tooltip; 6574 6575 this.param = param; 6576 6577 this.ImageUp = ImageUp; 6578 this.ImageOver = ImageOver; 6579 6580 this.submenu= submenu; 6581 6582 this.upstyle= upstyle; 6583 this.overstyle= overstyle; 6584 this.caption= caption; 6585 6586 return this; 6587} 6588 6589function ShowSubMenu(submenu) 6590{ 6591 var layer= FindTagFromId(submenu.id); 6592 var totalHeight= 0; 6593 6594 layer.style.visibility= "inherit"; 6595 6596 submenu.selected= true; 6597} 6598 6599function HideSubMenu(submenu) 6600{ 6601 var layer= FindTagFromId(submenu.id); 6602 layer.style.visibility= "hidden"; 6603 6604 if (submenu.opener) { 6605 if (submenu.opener.isOver) { 6606 submenu.opener.isOver= false; 6607 6608 var layer=FindTagFromId(submenu.opener.id); 6609 if(layer) { 6610 layer.style.backgroundImage= "url("+submenu.opener.ImageUp+")"; 6611 layer.childNodes[0].style.cssText= submenu.opener.upstyle; 6612 layer.style.zIndex= Number(layer.style.zIndex) - Number(Math.abs(z_index)); 6613 } 6614 } 6615 } 6616 6617 submenu.selected= false; 6618 6619 for(var i=0; i< submenu.itemList.length; i++) { 6620 var child= submenu.itemList[i]; 6621 layer= FindTagFromId(child.id); 6622 if (child.submenu) HideSubMenu(child.submenu); 6623 } 6624} 6625 6626function IsSubMenuVisible(submenu) 6627{ 6628 if (submenu.itemList.length == 0) return false; 6629 6630 var layer= FindTagFromId(submenu.id); 6631 if (layer.style.visibility == "hidden") return false; 6632 else return true; 6633} 6634 6635function SetMainMenu(menu, MainMenu) 6636{ 6637 menu.MainMenu= MainMenu; 6638 6639 for(var i=0; i< menu.itemList.length; i++) { 6640 var child= menu.itemList[i]; 6641 child.MainMenu= MainMenu; 6642 if (child.submenu) SetMainMenu(child.submenu, MainMenu); 6643 } 6644} 6645 6646function LMMenu(parentid,id,x,y,w,h,initvisible,delais,effect,delaisdisp,effectdisp,items,autoOpen) 6647{ 6648 var buffer=""; 6649 for(var i=0; i<items.length; i++) {
6650 buffer=buffer+LMMenuItemBuildHTML(buffer,items[i].id, items[i].x, items[i].y, items[i].w, items[i].h, items[i].ImageUp); 6651 } 6652 6653 var mydiv = document.getElementById(id); 6654 if (mydiv == null) { 6655 var menutag = document.getElementById(parentid); 6656 var maintag = document.getElementById("Page"); 6657 mydiv = document.createElement("DIV"); 6658 maintag.appendChild(mydiv); 6659 var ox= x + menutag.offsetLeft; 6660 var oy= y + menutag.offsetTop; 6661 6662 mydiv.id= id; 6663 mydiv.style.visibility= "hidden"; 6664 mydiv.style.position= "absolute"; 6665 mydiv.style.left= ox + "px"; 6666 mydiv.style.top= oy + "px"; 6667 mydiv.style.width= w + "px"; 6668 mydiv.style.height= h + "px"; 6669 } 6670 mydiv.innerHTML= buffer; 6671 6672 var LMMenu= new LMObject(id,initvisible,0,delais,effect,delaisdisp,effectdisp,null,null,null,false); 6673 LMMenu.HideObject= LMMenuHide; 6674 6675 LMMenu.parentid= null; 6676 LMMenu.id= id; 6677 LMMenu.opened= false; 6678 LMMenu.AutoOpen= autoOpen; 6679 6680 LMMenu.itemList= new Array; 6681 var i = 0; 6682 for(var i=0; i<items.length; i++) { 6683 var menuitem = new LMMenuItem(items[i].id, items[i].x, items[i].y, items[i].w, items[i].h, items[i].initvisible, items[i].delais, items[i].effect, items[i].delaisdisp, items[i].effectdisp, items[i].branch, items[i].tooltip, items[i].param, items[i].ImageUp, items[i].ImageOver, items[i].submenu, LMMenu, items[i].upstyle, items[i].overstyle, items[i].caption); 6684 LMObjects[objindex++] = menuitem; 6685 LMMenu.itemList[i] = menuitem; 6686 } 6687 6688 SetMainMenu(LMMenu, LMMenu); 6689 6690 var tagdiv=FindTagFromId(id); 6691 tagdiv.drawok=1; 6692 6693 return LMMenu; 6694} 6695 6696function LMMenuHide() 6697{ 6698 HideSubMenu(this); 6699} 6700 6701function LMMenuItemBuildHTML(buffer,id,x,y,w,h,ImageUp) 6702{ 6703 var buffer="<DIV id='"+id+"' style='position:absolute;left:"+x+"px;top:"+y+"px;width:"+w+"px;height:"+h+"px;background-image:url("+ImageUp+")'>"; 6704 buffer=buffer+"</DIV>"; 6705 return buffer; 6706} 6707 6708function LMMenuItem(id,x,y,w,h,initvisible,delais,effect,delaisdisp,effectdisp,branchdn,tooltip,param,ImageUp,ImageOver,submenu,parentmenu,upstyle,overstyle,caption) 6709{ 6710 var tmp = " "; 6711 var BranchLst = null; 6712 6713 if(branchdn) { 6714 BranchLst = new Array(); 6715 BranchLst[0] = branchdn; 6716 } 6717 6718 var LMMenuItem = new LMObject(id,initvisible,0,delais,effect,delaisdisp,effectdisp,BranchLst,tooltip,param,false); 6719 6720 LMMenuItem.IsMovable= false; 6721 LMMenuItem.MainMenu= null; 6722 LMMenuItem.parentmenu= parentmenu; 6723 LMMenuItem.selected= false; 6724 LMMenuItem.isOver= false; 6725 6726 var tagimg=document.getElementById(LMMenuItem.id); 6727 if(tooltip) tagimg.alt=tooltip; 6728 6729 tagimg.objectid=id; 6730 tagimg.onmouseover=TagLMMenuItemMouseOver; 6731 tagimg.onmouseout=TagLMMenuItemMouseOut; 6732 tagimg.onload=new Function("TagLMMenuItemLoad(document.getElementById('"+tagimg.id+"'));"); 6733 tagimg.onmouseup=LMGlobalUp; 6734 tagimg.onmousedown=LMGlobalDn; 6735 tagimg.onerror=TagLMMenuItemError; 6736 6737 LMMenuItem.submenu= submenu; 6738 if (submenu) { 6739 submenu.opener= LMMenuItem; 6740 } 6741 6742 if (ImageUp) LMMenuItem.ImageUp = ImageUp; 6743 if (ImageOver) LMMenuItem.ImageOver = ImageOver; 6744 6745 LMMenuItem.upstyle= upstyle; 6746 LMMenuItem.overstyle= overstyle; 6747 6748 LMMenuItem.MouseUp=LMMenuItemMouseUp; 6749 LMMenuItem.MouseDn=LMMenuItemMouseDn; 6750 LMMenuItem.MouseOver=LMMenuItemMouseOver; 6751 LMMenuItem.MouseOut=LMMenuItemMouseOut; 6752 LMMenuItem.InitObject=LMMenuItemInit; 6753 LMMenuItem.OnAfterPageDisplay=LMMenuItemOnAfterPageDisplay; 6754 LMMenuItem.MenuOver = false; 6755 LMMenuItem.init=false; 6756 6757 var layer= FindTagFromId(LMMenuItem.id); 6758 layer.style.visibility= "inherit"; 6759 layer.innerHTML= "<p style='" + upstyle + "'>" + caption + "</p>"; 6760 6761 return LMMenuItem; 6762} 6763 6764function TagLMMenuItemLoad(TagImg) 6765{ 6766 if(TagImg.complete==false) { 6767 setTimeout("TagLMMenuItemLoad(FindTagFromId(\"LMMenuItem" + TagImg.objectid + "\"))",100.); 6768 return; 6769 } 6770 6771 var tagdiv=FindTagFromId(TagImg.objectid); 6772 if(tagdiv==null) { alert("MenuOnLoad tagdiv=null"); return; } 6773 tagdiv.drawok=1; 6774} 6775 6776function TagLMMenuItemError() 6777{ 6778 var LMObject=FindClassObjectFromId(this.objectid); 6779 if(!LMObject) return; 6780 6781 var tagdiv=FindTagFromId(this.objectid); 6782 if(tagdiv==null) { alert("MenuOnError tagdiv=null"); return; } 6783 6784 if(this.src!="" && LMObject.init==true) { 6785 tagdiv.drawok=1; 6786 } 6787} 6788 6789function LMMenuItemInit() 6790{ 6791 if(this.init==true) return; 6792 this.init=true; 6793 6794 if(this.ImageUp) { 6795 var layer= FindTagFromId(this.id); 6796 layer.style.backgroundImage= "url("+this.ImageUp+")"; 6797 layer.childNodes[0].style.cssText= this.upstyle; 6798 6799 this.isOver= false; 6800 TagLMMenuItemLoad(layer); 6801 } 6802} 6803 6804function LMMenuItemOnAfterPageDisplay() 6805{ 6806 var last = preloadImages.length; 6807 if (this.ImageOver) { 6808 preloadImages[last] = new Image; 6809 preloadImages[last++].src = this.ImageOver; 6810 } 6811} 6812 6813function LMMenuOnAfterPageDisplay() 6814{ 6815 alert("preloading!"); 6816} 6817 6818function TagLMMenuItemMouseOver(e) 6819{ 6820 if(e==null) var e=window.event; 6821 e.cancelBubble = true; 6822 6823 LMGlobalOver(this.objectid); 6824} 6825 6826function TagLMMenuItemMouseOut(e) 6827{ 6828 if(e==null) var e=window.event; 6829 e.cancelBubble = true; 6830 6831 LMGlobalOver(-1); 6832} 6833 6834function LMMenuItemMouseUp() 6835{ 6836 if (!this.MenuOver) { 6837 if (this.ImageUp) { 6838 if (this.isOver) { 6839 this.isOver= false; 6840 6841 var layer=FindTagFromId(this.id); 6842 if(layer) { 6843 layer.style.backgroundImage= "url("+this.ImageUp+")"; 6844 layer.childNodes[0].style.cssText= this.upstyle; 6845 layer.style.zIndex= Number(layer.style.zIndex) - Number(Math.abs(z_index)); 6846 } 6847 } 6848 } 6849 } 6850 else { 6851 if (this.ImageOver) { 6852 if (!this.isOver) { 6853 this.isOver= true; 6854 6855 var layer=FindTagFromId(this.id); 6856 if(layer) { 6857 layer.style.backgroundImage= "url("+this.ImageOver+")"; 6858 layer.childNodes[0].style.cssText= this.overstyle; 6859 layer.style.zIndex= Number(layer.style.zIndex) + Number(Math.abs(z_index)); 6860 } 6861 } 6862 } 6863 else { 6864 if (this.isOver) { 6865 this.isOver= false; 6866 6867 var layer=FindTagFromId(this.id); 6868 if(layer) { 6869 layer.style.backgroundImage= "url("+this.ImageUp+")"; 6870 layer.childNodes[0].style.cssText= this.upstyle; 6871 layer.style.zIndex= Number(layer.style.zIndex) - Number(Math.abs(z_index)); 6872 } 6873 } 6874 } 6875 } 6876 6877 LMObjectClick(this.id,0); 6878} 6879 6880function LMMenuItemMouseDn() 6881{ 6882 if (this.MainMenu.AutoOpen) return; 6883 6884 if (this.submenu) { 6885 if (this.MainMenu.opened) { 6886 var atRoot= false; 6887 var i = 0; 6888 for(var i=0; i< this.MainMenu.itemList.length; i++) { 6889 var menuitem = this.MainMenu.itemList[i]; 6890 if (menuitem == this) { 6891 atRoot= true; 6892 break; 6893 } 6894 } 6895 6896 if (atRoot) { 6897 this.MainMenu.opened= false; 6898 6899 SendMenuToBack(this.MainMenu); 6900 6901 for(var i=0; i< this.MainMenu.itemList.length; i++) { 6902 var menuitem = this.MainMenu.itemList[i]; 6903 if (menuitem.submenu) HideSubMenu(menuitem.submenu); 6904 } 6905 } 6906 } 6907 else { 6908 if (IsSubMenuVisible(this.submenu)) HideSubMenu(this.submenu); 6909 else { 6910 ShowSubMenu(this.submenu); 6911 CloseUnfocusedBranches(this.MainMenu,this.submenu); 6912 } 6913 this.MainMenu.opened= true; 6914 BringMenuToFront(this.MainMenu); 6915 } 6916 } 6917} 6918 6919function LMMenuItemMouseOver() 6920{ 6921 if (this.submenu && this.MainMenu.AutoOpen == true) { 6922 if (!this.MainMenu.opened) { 6923 var e= new Object; 6924 e.pageX= -1; 6925 e.pageY= -1; 6926 e.clientX= -1; 6927 e.clientY= -1; 6928 HideOpenedMenus(e); 6929 ShowSubMenu(this.submenu); 6930 CloseUnfocusedBranches(this.MainMenu,this.submenu); 6931 this.MainMenu.opened= true; 6932 BringMenuToFront(this.MainMenu); 6933 } 6934 } 6935 6936 this.MenuOver = true; 6937 6938 if (this.ImageOver) { 6939 if (!this.isOver) { 6940 this.isOver= true; 6941 6942 var layer=FindTagFromId(this.id); 6943 if(layer) { 6944 layer.style.backgroundImage= "url("+this.ImageOver+")"; 6945 layer.childNodes[0].style.cssText= this.overstyle; 6946 layer.style.zIndex= Number(layer.style.zIndex) + Number(Math.abs(z_index)); 6947 } 6948 } 6949 } 6950 6951 if (this.submenu && this.MainMenu.opened) { 6952 ShowSubMenu(this.submenu); 6953 CloseUnfocusedBranches(this.MainMenu,this.submenu); 6954 } 6955 else if (this.MainMenu.opened) { 6956 CloseUnfocusedBranches(this.MainMenu,this.parentmenu); 6957 } 6958 6959 if((this.BranchLst && this.BranchLst[0])) { 6960 idx=this.BranchLst[0].where.indexOf("GADGET:"); 6961 if(idx>=0) GadgetShowLink(this.BranchLst[0]); 6962 else window.status=this.BranchLst[0].where; 6963 } 6964 6965 if(this.BranchLst && this.BranchLst[0]) { 6966 if(this.BranchLst[0].where) { 6967 var layer= FindTagFromId(this.id); 6968 layer.style.cursor = "pointer"; 6969 } 6970 } 6971} 6972 6973function LMMenuItemMouseOut() 6974{ 6975 this.MenuOver = false; 6976 6977 if (this.ImageUp) { 6978 if (this.submenu && this.submenu.selected) { 6979 } 6980 else { 6981 if (this.isOver) { 6982 this.isOver= false; 6983 6984 var layer=FindTagFromId(this.id); 6985 if(layer) { 6986 layer.style.zIndex= Number(layer.style.zIndex) - Number(Math.abs(z_index)); 6987 layer.style.backgroundImage= "url("+this.ImageUp+")"; 6988 layer.childNodes[0].style.cssText= this.upstyle; 6989 } 6990 } 6991 } 6992 } 6993 6994 if((this.BranchLst&&this.BranchLst[0])) window.status=""; 6995} 6996 6997function ReIndexMenu(menu, index) { 6998 var layer= FindTagFromId(menu.id); 6999 layer.style.zIndex= index++; 7000 7001 var i; 7002 for (i= 0; i < menu.itemList.length; i++) { 7003 var item= menu.itemList[i]; 7004 if (item.submenu) { 7005 ReIndexMenu(item.submenu, index++); 7006 } 7007 } 7008} 7009 7010function PinMenu(menuname, index) 7011{
7012 var item= FindClassObjectFromId(menuname + "_MenuItem" + (index + 1)); 7013 if (item == null) { 7014 alert("Bad parameter passed to PinMenu, check your custom code"); 7015 return; 7016 } 7017 7018 if (item.ImageUp2) return; 7019 7020 item.ImageUp2= item.ImageUp; 7021 item.upstyle2= item.upstyle; 7022 item.ImageUp= item.ImageOver; 7023 item.upstyle= item.overstyle; 7024 7025 var layer=FindTagFromId(item.id); 7026 7027 layer.style.backgroundImage= "url("+item.ImageUp+")"; 7028 layer.childNodes[0].style.cssText= item.upstyle; 7029} 7030 7031function UnpinMenu(menuname, index) 7032{ 7033 var item= FindClassObjectFromId(menuname + "_MenuItem" + (index + 1)); 7034 if (item == null) { 7035 alert("Bad parameter passed to UnpinMenu, check your custom code"); 7036 return; 7037 } 7038 7039 if (!item.ImageUp2) return; 7040 7041 item.ImageUp= item.ImageUp2; 7042 item.upstyle= item.upstyle2; 7043 item.ImageUp2= null; 7044 item.upstyle2= null; 7045 7046 var layer=FindTagFromId(item.id); 7047 7048 layer.style.backgroundImage= "url("+item.ImageUp+")"; 7049 layer.childNodes[0].style.cssText= item.upstyle; 7050} 7051 7052function ClearMenuPins(menuname) 7053{ 7054 var menu= FindClassObjectFromId(menuname); 7055 for (var i=0;i<menu.itemList.length;i++) { 7056 UnpinMenu(menuname, i); 7057 } 7058} 7059function LMMessage(id,initactive,message,target,speed,animationType) 7060{ 7061 var LMMessage= new LMObject(id,1,1,0,null,0,null,null,null,null,true); 7062 7063 LMMessage.id= id; 7064 7065 LMMessage.message= message; 7066 LMMessage.target= target; 7067 LMMessage.speed= speed; 7068 LMMessage.animationType= animationType; 7069 LMMessage.active= initactive; 7070 LMMessage.pos= 0; 7071 7072 LMMessage.BounceParams= new Object; 7073 LMMessage.BounceParams.Leftspace= "Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "; 7074 LMMessage.BounceParams.Rightspace= "Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "; 7075 LMMessage.BounceParams.message1= LMMessage.BounceParams.Leftspace + message + LMMessage.BounceParams.Rightspace; 7076 LMMessage.BounceParams.dir= "left"; 7077 7078 LMMessage.oldMessage= ""; 7079 7080 LMMessage.Activate= LMMessage_Activate; 7081 LMMessage.Deactivate= LMMessage_Deactivate; 7082 7083 LMMessage.TagObject.Activate= tagActivate; 7084 LMMessage.TagObject.Deactivate= tagDeactivate; 7085 7086 7087 var layer= FindTagFromId(id); 7088 layer.lmobj= LMMessage; 7089 7090 if (initactive) { 7091 LMMessage.Activate(); 7092 } 7093 7094 layer.drawok= 2; 7095 7096 return LMMessage; 7097} 7098 7099function SetMessage(msg, target) { 7100 var buf= msg; 7101 var alt255= "Â "; 7102 if (buf == "") buf= alt255; 7103 if (buf[0] == ' ') buf[0]= alt255; 7104 7105 switch (target) { 7106 case 0: 7107 window.status= buf; 7108 break; 7109 case 1: 7110 document.title= buf; 7111 break; 7112 case 2: 7113 alert(buf); 7114 break; 7115 } 7116} 7117 7118function tagActivate() { 7119 var object=FindClassObjectFromId(this.id); 7120 if(!object) return; 7121 if(object.Activate) object.Activate(); 7122} 7123 7124function tagDeactivate() { 7125 var object=FindClassObjectFromId(this.id); 7126 if(!object) return; 7127 if(object.Deactivate) object.Deactivate(); 7128} 7129 7130function LMMessage_Activate() { 7131 var id= this.id; 7132 var obj= this; 7133 7134 if (obj.target == 0) obj.oldMessage= window.status; 7135 else if (obj.target == 1) obj.oldMessage= document.title; 7136 7137 if (obj.target != 2) obj.active= true; 7138 else { 7139 SetMessage(obj.message, obj.target); 7140 return; 7141 } 7142 7143 switch(obj.animationType) { 7144 case 0: 7145 SetMessage(obj.message, obj.target); 7146 break; 7147 case 1: 7148 LMMessage_Bounce(id); 7149 break; 7150 case 2: 7151 LMMessage_Flash(id); 7152 break; 7153 case 3: 7154 LMMessage_Marquee(id); 7155 break; 7156 case 4: 7157 LMMessage_RtlSlide(id); 7158 break; 7159 case 5: 7160 LMMessage_Typewriter(id); 7161 break; 7162 } 7163} 7164 7165function LMMessage_Deactivate() { 7166 var obj= this; 7167 obj.active= false; 7168 if (obj.animationType == 0 && obj.target != 2) LMMessage_CheckActive(this.id); 7169} 7170 7171 7172function LMMessage_CheckActive(id) { 7173 var layer= FindTagFromId(id); 7174 var obj= layer.lmobj; 7175 if (!obj.active) { 7176 if (obj.target == 0) window.status= obj.oldMessage; 7177 else if (obj.target == 1) document.title= obj.oldMessage; 7178 7179 obj.oldMessage= ""; 7180 obj.pos= 0; 7181 obj.BounceParams.message1= obj.BounceParams.Leftspace + obj.message + obj.BounceParams.Rightspace; 7182 obj.BounceParams.dir= "left"; 7183 7184 return true; 7185 } 7186 return false; 7187} 7188 7189function LMMessage_Marquee(id) 7190{ 7191 var layer= FindTagFromId(id); 7192 var obj= layer.lmobj; 7193 7194 SetMessage(obj.message.substring(obj.pos, obj.message.length) + " " + obj.message.substring(0,obj.pos), obj.target); 7195 7196 obj.pos++; 7197 if (obj.pos > obj.message.length) obj.pos = 0; 7198 7199 if (LMMessage_CheckActive(id)) return; 7200 window.setTimeout("LMMessage_Marquee(\"" + obj.id + "\")", obj.speed); 7201} 7202 7203function LMMessage_RtlSlide(id) 7204{ 7205 var layer= FindTagFromId(id); 7206 var obj= layer.lmobj; 7207 7208 SetMessage(obj.message.substring(obj.pos, obj.message.length), obj.target); 7209 7210 obj.pos++; 7211 if (obj.pos > obj.message.length) obj.pos = 0; 7212 7213 if (LMMessage_CheckActive(id)) return; 7214 window.setTimeout("LMMessage_RtlSlide(\"" + obj.id + "\")", obj.speed); 7215} 7216 7217function LMMessage_Bounce(id) { 7218 var layer= FindTagFromId(id); 7219 var obj= layer.lmobj; 7220 7221 if (obj.BounceParams.dir == "left") { 7222 var message2 = obj.BounceParams.message1.substring(1, obj.BounceParams.message1.length) + "Â "; 7223 SetMessage(message2, obj.target); 7224 7225 obj.BounceParams.message1 = message2; 7226 if (obj.BounceParams.message1.substring(0, 1) != "Â ") obj.BounceParams.dir= "right"; 7227 } 7228 else { 7229 message2 = "Â " + obj.BounceParams.message1.substring(0, obj.BounceParams.message1.length - 1); 7230 SetMessage(message2, obj.target); 7231 7232 obj.BounceParams.message1 = message2; 7233 if (obj.BounceParams.message1.substring(obj.BounceParams.message1.length - 1, obj.BounceParams.message1.length) != "Â ") obj.BounceParams.dir= "left"; 7234 } 7235 7236 if (LMMessage_CheckActive(id)) return; 7237 window.setTimeout("LMMessage_Bounce(\"" + obj.id + "\")", obj.speed); 7238} 7239 7240function LMMessage_Flash(id) { 7241 var layer= FindTagFromId(id); 7242 var obj= layer.lmobj; 7243 7244 if (obj.target == 0) { 7245 if (window.status == obj.message) SetMessage("", obj.target); 7246 else SetMessage(obj.message, obj.target); 7247 } 7248 else if (obj.target == 1) { 7249 if (document.title == obj.message) SetMessage("", obj.target); 7250 else SetMessage(obj.message, obj.target); 7251 } 7252 7253 if (LMMessage_CheckActive(id)) return; 7254 window.setTimeout("LMMessage_Flash(\"" + obj.id + "\")", obj.speed); 7255} 7256 7257 7258function LMMessage_Typewriter(id) { 7259 var layer= FindTagFromId(id); 7260 var obj= layer.lmobj; 7261 7262 SetMessage(obj.message.substring(0, obj.pos), obj.target); 7263 7264 obj.pos++; 7265 if (obj.pos > obj.message.length) obj.pos= 0; 7266 7267 if (LMMessage_CheckActive(id)) return; 7268 window.setTimeout("LMMessage_Typewriter(\"" + obj.id + "\")", obj.speed); 7269} 7270 7271var GOffetX=0,GOffetY=0; 7272var GRelX=0,GRelY=0; 7273var GPropW=1,GPropH=1; 7274var gbasewidth=0,gbaseheight=0,gbaseinit=false; 7275var defpagewitdh=0; 7276 7277function Is() { 7278 var agent = navigator.userAgent.toLowerCase(); 7279 idx=navigator.userAgent.indexOf("MSIE"); 7280 if(idx>=0) { 7281 var ua=navigator.userAgent; 7282 this.major = parseInt(ua.substring(idx+5,ua.indexOf(".",idx))); 7283 this.minor = parseFloat(ua.substring(idx+5,ua.indexOf(" ",idx+5))); 7284 } 7285 else { 7286 idx=navigator.userAgent.indexOf("Netscape/"); 7287 if(idx>=0) { 7288 var ua=navigator.userAgent; 7289 this.major = parseInt(ua.substring(idx+9,ua.indexOf(".",idx))); 7290 this.minor = parseFloat(ua.substr(idx+9,5)); 7291 } 7292 else { 7293 this.major = parseInt(navigator.appVersion); 7294 this.minor = parseFloat(navigator.appVersion); 7295 } 7296 } 7297 this.safari = agent.indexOf('safari')!=-1; 7298 this.opera = agent.indexOf('opera')!=-1; 7299 this.firefox = agent.indexOf('firefox')!=-1; 7300 this.netscape = ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1))); 7301 this.explorer = (agent.indexOf("msie") != -1); 7302 this.ns = (this.netscape && (this.minor >= 4.03)); 7303 this.ie3 = (navigator.userAgent.indexOf("MSIE 3.0") != -1); 7304 this.ie = (this.explorer && !this.ie3); 7305 this.macpowerpc = (navigator.userAgent.indexOf("Mac_PowerPC") != -1); 7306 7307 if(this.opera) { 7308 this.netscape=true; 7309 this.ns=true; 7310 this.major=7; 7311 this.minor=7.1; 7312 this.explorer=false; 7313 this.ie=false; 7314 } 7315 if(this.firefox) { 7316 this.major=7; 7317 this.minor=7.1; 7318 } 7319} 7320 7321var is = new Is(); 7322var language; 7323var fontfact; 7324var fontbase=96.; 7325 7326function isValideBrowser(minor_ns,minor_ie) 7327{ 7328 var language; //Ajout de cette variable pour ne pas avoir d'assignation globale 7329 7330/* if(is.explorer) { 7331 language=navigator.browserLanguage.toLowerCase(); 7332 } 7333 else { 7334 language=navigator.language.toLowerCase(); 7335 } 7336*/ 7337 return true; 7338} 7339 7340function FindIdxInLMObjects(id) 7341{ 7342 for(var i=0; i<LMObjects.length; i++) { 7343 if(LMObjects[i].id==id) return i; 7344 } 7345 return -1; 7346} 7347 7348function FindTagStyleFromId(id) 7349{ 7350 var tag=FindTagFromId(id); 7351 return tag.style; 7352} 7353 7354function FindTagFromId(id) 7355{ 7356 return document.getElementById(id); 7357} 7358 7359function FindClassObjectFromId(id) 7360{ 7361 for(var i=0; i<LMObjects.length; i++) { 7362 if(LMObjects[i].id==id) return LMObjects[i]; 7363 } 7364 return null; 7365} 7366 7367function FindClassObjectFromTagDiv(TagObject) 7368{
7369 if(TagObject.LMObjectsIdx==-1) { 7370 TagObject.LMObjectsIdx=FindIdxInLMObjects(TagObject.id); 7371 } 7372 return LMObjects[TagObject.LMObjectsIdx]; 7373} 7374 7375function IsDisplayVisble(id) 7376{ 7377 var tag=$("#" + id); 7378 if(tag.css('display')=='none') return false; 7379 return true; 7380} 7381 7382function TagIsVisible() 7383{ 7384 var layershow = true; 7385 7386 var LMObject=FindClassObjectFromId(this.id); 7387 if(LMObject.layerid) { 7388 var layertag=FindTagFromId(LMObject.layerid); 7389 7390 var LMObjectLayer=FindClassObjectFromId(this.id); 7391 if(LMObjectLayer.displayenable) { 7392 if(IsDisplayVisble(LMObject.layerid)==false) layershow=false; 7393 } 7394 else { 7395 if(layertag.style.visibility != "inherit") layershow=false; 7396 } 7397 } 7398 7399 var show=false; 7400 7401 if(LMObject.displayenable) { 7402 if(IsDisplayVisble(this.id)==true && layershow) show=true; 7403 } 7404 else { 7405 if(this.style.visibility == "inherit" && layershow) show=true; 7406 } 7407 7408 return show; 7409} 7410 7411function TagIsDrawingEffect() 7412{ 7413 if(this.drawingeffect==1) return true; 7414 return false; 7415} 7416function TagFullScreenMode() 7417{ 7418 var object=FindClassObjectFromId(this.id); 7419 if(!object) return; 7420 var $obj = $("#"+this.id); 7421 var $clone = $obj.clone(); 7422 var css = { 7423 "width":"100%", 7424 "height":"100%", 7425 "position":"fixed", 7426 "top":"0", 7427 "left":"0", 7428 "z-index": 9999, 7429 "background-color": "rgba(0, 0, 0, 0.8)" 7430 }; 7431 $clone.css(css); 7432 $clone.toggleClass('fullscrean'); 7433 $clone.append("<span class='fullscreen-close fa fa-times'></span>"); 7434 var $close = $clone.find('.fullscreen-close'); 7435 $close.css({ 7436 "position": "absolute", 7437 "top": "5px", 7438 "right": "10px", 7439 "font-size": "30px", 7440 "color": "white", 7441 "cursor": "pointer", 7442 }); 7443 $close.click(function(){ 7444 $(this).parent().remove(); 7445 }) 7446 $clone.appendTo("body"); 7447} 7448function TagMaximize() 7449{ 7450 var object=FindClassObjectFromId(this.id); 7451 if(!object) return; 7452 var css = { 7453 "width":"100%", 7454 "height":"100%", 7455 "position":"absolute", 7456 "top":"0", 7457 "left":"0", 7458 "z-index": 9999, 7459 //"background-color": "#000" 7460 }; 7461 7462 var obj = $("#"+this.id); 7463 obj.css(css); 7464 obj.toggleClass('maximized'); 7465} 7466function TagMinimize() 7467{ 7468 var object=FindClassObjectFromId(this.id); 7469 if(!object) return; 7470 7471 var obj = $("#"+this.id); 7472 obj.attr('style', ""); 7473 obj.toggleClass('maximized'); 7474 7475} 7476function TagToggleMaximizeMinimize() 7477{ 7478 if(this.IsMaximized()) 7479 { 7480 this.Minimize(); 7481 }else{ 7482 this.Maximize(); 7483 } 7484} 7485function TagIsFullScreen() 7486{ 7487 return $("#"+this.id).hasClass('fullscrean'); 7488} 7489 7490function TagIsMaximized() 7491{ 7492 return $("#"+this.id).hasClass('maximized'); 7493} 7494 7495function TagShow() 7496{ 7497 if(this.drawingeffect==1) return; 7498 7499 var object=FindClassObjectFromId(this.id); 7500 if(!object) return; 7501 var placeholderId = "#" + this.id + "_placeholder" 7502 var objectPlaceholder = $(placeholderId); 7503 7504 if(object.layerid) { 7505 var layer=FindClassObjectFromId(object.layerid); 7506 if(layer.visible==false) return; 7507 } 7508 object.visible=true; 7509 7510 if(object.displayenable) { 7511 if(this.style.display == "block") return; 7512 if(objectPlaceholder.length >= 1) 7513 { 7514 objectPlaceholder.css("display","block"); 7515 } 7516 this.style.display = "block"; 7517 } 7518 else { 7519 if(this.style.visibility == "inherit") return; 7520 if(objectPlaceholder.length >= 1) 7521 { 7522 objectPlaceholder.css("display","inherit"); 7523 } 7524 this.style.visibility = "inherit"; 7525 } 7526 7527 if(object.ShowObject) object.ShowObject(); 7528} 7529 7530function TagHide() 7531{ 7532 if(this.drawingeffect==1) return; 7533 7534 var object=FindClassObjectFromId(this.id); 7535 if(!object) return; 7536 var placeholderId = "#" + this.id + "_placeholder" 7537 var objectPlaceholder = $(placeholderId); 7538 7539 object.visible=false; 7540 7541 if(object.displayenable) { 7542 if(this.style.display == "none") return; 7543 if(objectPlaceholder.length >= 1) 7544 { 7545 objectPlaceholder.css("display","none"); 7546 } 7547 this.style.display = "none"; 7548 } 7549 else { 7550 if(this.style.visibility == "hidden") return; 7551 if(objectPlaceholder.length >= 1) 7552 { 7553 objectPlaceholder.css("display","hidden"); 7554 } 7555 this.style.visibility = "hidden"; 7556 } 7557 7558 if(object.HideObject) object.HideObject(); 7559} 7560 7561function TagShowEffect() 7562{ 7563 if(this.drawingeffect==1) return; 7564 var object=FindClassObjectFromId(this.id); 7565 if(!object) return; 7566 7567 if(object.InitObject) object.InitObject(); 7568 object.Effect(); 7569} 7570 7571function TagHideEffect() 7572{ 7573 if(this.drawingeffect==1) return; 7574 7575 var object=FindClassObjectFromId(this.id); 7576 if(!object) return; 7577 7578 if(object.displayenable) { 7579 this.style.display = "none"; 7580 } 7581 else { 7582 this.style.visibility = "hidden"; 7583 } 7584 7585 if(object.HideObject) object.HideObject(); 7586} 7587 7588function TagToggleVisibleState() 7589{ 7590 if(this.IsVisible()) this.Hide(); 7591 else this.Show(); 7592} 7593 7594function TagPlay() 7595{ 7596 var object=FindClassObjectFromId(this.id); 7597 if(!object) return; 7598 if(object.Play) object.Play(); 7599} 7600 7601function TagStop() 7602{ 7603 var object=FindClassObjectFromId(this.id); 7604 if(!object) return; 7605 if(object.Stop) object.Stop(); 7606} 7607 7608function TagTogglePlayState() 7609{ 7610 var object=FindClassObjectFromId(this.id); 7611 if(!object) return; 7612 if(object.TogglePlayState) object.TogglePlayState(); 7613} 7614 7615function TagRollIn() 7616{ 7617 var object=FindClassObjectFromId(this.id); 7618 if(!object) return; 7619 if(object.RollIn) object.RollIn(); 7620 else if(this.Show) this.Show(); 7621} 7622 7623function TagRollOut() 7624{ 7625 var object=FindClassObjectFromId(this.id); 7626 if(!object) return; 7627 if(object.RollOut) object.RollOut(); 7628 else if(this.Hide) this.Hide(); 7629} 7630 7631function TagGetTop() 7632{ 7633 if(this.offsetTop==0) { 7634 var LMObject=FindClassObjectFromTagDiv(this); 7635 if(LMObject) return LMObject.y; 7636
7637 return $("#"+this.id).css("top").replace("px", ""); 7638 } 7639 else { 7640 return this.offsetTop; 7641 } 7642} 7643 7644function TagSetTop(top) 7645{ 7646 var LMObject=FindClassObjectFromTagDiv(this); 7647 if(LMObject) LMObject.y=top; 7648 this.style.top=top + "px"; 7649} 7650 7651function TagGetLeft() 7652{ 7653 if(this.offsetLeft==0) { 7654 var LMObject=FindClassObjectFromTagDiv(this); 7655 if(LMObject) return LMObject.x; 7656 7657 return $("#"+this.id).css("left").replace("px", ""); 7658 } 7659 else { 7660 return this.offsetLeft; 7661 } 7662} 7663 7664function TagSetLeft(left) 7665{ 7666 var LMObject=FindClassObjectFromTagDiv(this); 7667 if(LMObject) LMObject.x=left; 7668 this.style.left=left + "px"; 7669} 7670 7671function TagGetWidth() 7672{ 7673 if(this.offsetWidth==0) { 7674 var LMObject=FindClassObjectFromTagDiv(this); 7675 if(LMObject) return LMObject.w; 7676 7677 return $("#"+this.id).css("width").replace("px", ""); 7678 } 7679 else { 7680 return this.offsetWidth; 7681 } 7682} 7683 7684function TagSetWidth(width) 7685{ 7686 var LMObject=FindClassObjectFromTagDiv(this); 7687 if(LMObject) LMObject.w=width; 7688 this.style.width=width + "px"; 7689} 7690 7691function TagGetHeight() 7692{ 7693 if(this.offsetHeight==0) { 7694 var LMObject=FindClassObjectFromTagDiv(this); 7695 if(LMObject) return LMObject.h; 7696 7697 return $("#"+this.id).css("height").replace("px", ""); 7698 } 7699 else { 7700 return this.offsetHeight; 7701 } 7702} 7703 7704function TagSetHeight(height) 7705{ 7706 var LMObject=FindClassObjectFromTagDiv(this); 7707 if(LMObject) LMObject.h=height; 7708 this.style.height=height + "px"; 7709} 7710 7711function TagSetClip(top,right,bottom,left) 7712{ 7713 this.style.clip = "rect(" + top + "px, " + right + "px, " + bottom + "px, " + left + "px)"; 7714} 7715 7716function PosPage(Stretch,Position,scalefx,scalefy) 7717{ 7718 if(scalefx<=0) scalefx=1; 7719 if(scalefy<=0) scalefy=1; 7720 7721 if(window.innerWidth == undefined) { 7722 wwindow=document.body.clientWidth; 7723 hwindow=document.body.clientHeight; 7724 } 7725 else { 7726 wwindow=window.innerWidth; 7727 hwindow=window.innerHeight; 7728 if(is.major>=9) wwindow-=18; 7729 } 7730 7731 if(gbaseinit==false) { 7732 var backpanel=FindTagFromId("Page"); 7733 backpanel.SetLeft=TagSetLeft; 7734 backpanel.SetTop=TagSetTop; 7735 backpanel.SetWidth=TagSetWidth; 7736 backpanel.SetHeight=TagSetHeight; 7737 backpanel.GetLeft=TagGetLeft; 7738 backpanel.GetTop=TagGetTop; 7739 backpanel.GetWidth=TagGetWidth; 7740 backpanel.GetHeight=TagGetHeight; 7741 backpanel.oriw=backpanel.GetWidth(); 7742 backpanel.orih=backpanel.GetHeight(); 7743 7744 gbasewidth=LMObjects[0].TagObject.GetWidth(); 7745 gbaseheight=LMObjects[0].TagObject.GetHeight(); 7746 7747 //Patch pour jQuery Accordeon 7748 if(gbasewidth==0) gbasewidth=defpagewitdh; 7749 7750 var tags=document.getElementsByTagName("SPAN"); 7751 var len=tags.length; 7752 for(var i=0; i<len; i++) { 7753 fonttag=tags[i]; 7754 fonttag.ptori=0; 7755 if(parseInt(fonttag.style.fontSize)==0) continue; 7756 if(!isNaN(fonttag.style.fontSize)) continue; 7757 fonttag.ptori=fonttag.style.fontSize; 7758 } 7759 gbaseinit=true; 7760 } 7761 7762 //5 2 6 7763 //1 0 3 7764 //7 4 8 7765 7766 w=gbasewidth; 7767 h=gbaseheight; 7768 var offx=0; 7769 var offy=0; 7770 7771 switch(Position) { 7772 case 0: 7773 offx=(wwindow-w)/2.; 7774 offy=(hwindow-h)/2.; 7775 break; 7776 case 1: 7777 offx=0; 7778 offy=(hwindow-h)/2.; 7779 break; 7780 case 2: 7781 offx=(wwindow-w)/2.; 7782 offy=0; 7783 break; 7784 case 3: 7785 offx=(wwindow-w); 7786 offy=(hwindow-h)/2.; 7787 break; 7788 case 4: 7789 offx=(wwindow-w)/2.; 7790 offy=(hwindow-h); 7791 break; 7792 case 5: 7793 offx=0; 7794 offy=0; 7795 break; 7796 case 6: 7797 offx=(wwindow-w); 7798 offy=0; 7799 break; 7800 case 7: 7801 offx=0; 7802 offy=(hwindow-h); 7803 break; 7804 case 8: 7805 offx=(wwindow-w); 7806 offy=(hwindow-h); 7807 break; 7808 } 7809 7810 var backpanel=FindTagFromId("Page"); 7811 7812 offy=0; 7813 if (offx < 0) offx= 0; 7814 if (offy < 0) offy= 0; 7815 7816 backpanel.SetLeft(offx); 7817 backpanel.SetTop(offy); 7818} 7819 7820function ShowProperties(obj,framed) 7821{
7822 var sProps=""; 7823 for(props in obj) { 7824 sProps += props + ": "+ obj[props] + "\n"; 7825 if(framed==0) { 7826 alert(sProps); 7827 sProps=""; 7828 } 7829 } 7830 7831 if(framed==1) { 7832 alert(sProps); 7833 } 7834 else if(framed==2) { 7835 var hwnd = window.open("about:blank","debug",""); 7836 hwnd.document.write("<PRE>\n" + sProps + "</PRE>\n"); 7837 } 7838} 7839 7840 7841function HexToStr(str) 7842{ 7843 var strOut = ""; 7844 7845 var l2 = str.length/2; 7846 for(var x=1; x<=l2; x++) { 7847 var c1=HexToDec(str.charAt((x-1)*2)); 7848 var c2=HexToDec(str.charAt((x-1)*2+1)); 7849 var c=c1*16+c2; 7850 strOut = strOut + String.fromCharCode(c); 7851 } 7852 return strOut; 7853} 7854 7855function HexToUnicode(str) 7856{ 7857 var strOut = ""; 7858 var s1=16; 7859 var s2=16*16; 7860 var s3=16*16*16; 7861 7862 var l2 = str.length/4; 7863 for(var x=1; x<=l2; x++) { 7864 var c1=HexToDec(str.charAt((x-1)*4)); 7865 var c2=HexToDec(str.charAt((x-1)*4+1)); 7866 var c3=HexToDec(str.charAt((x-1)*4+2)); 7867 var c4=HexToDec(str.charAt((x-1)*4+3)); 7868 var c=c1*s3+c2*s2+c3*s1+c4; 7869 strOut = strOut + String.fromCharCode(c); 7870 } 7871 return strOut; 7872} 7873 7874function HexToDec(c) 7875{ 7876var alpha="aA"; 7877 7878 if(c>='a' && c<='f') return c.charCodeAt(0)-alpha.charCodeAt(0)+10; 7879 if(c>='A' && c<='F') return c.charCodeAt(0)-alpha.charCodeAt(1)+10; 7880 else return eval(c); 7881} 7882 7883function EnDecrypStr(sSecret) 7884{ 7885 var sSecretTodo = sSecret; 7886 var sPassword = "$%¢£²¼|*°«¢@%)-¾?"; 7887 var strOut = ""; 7888 7889 var l = sPassword.length; 7890 var l2 = sSecretTodo.length/2; 7891 for(var x=1; x<=l2; x++) { 7892 var g=((x-1) % l); 7893 var iChar = sPassword.charCodeAt(g); 7894 var c1=HexToDec(sSecretTodo.charAt((x-1)*2)); 7895 var c2=HexToDec(sSecretTodo.charAt((x-1)*2+1)); 7896 var c=c1*16+c2; 7897 iChar = c ^ iChar; 7898 strOut = strOut + String.fromCharCode(iChar); 7899 } 7900 return strOut; 7901} 7902 7903function AuthorisationFail(pageerror) 7904{ 7905 if(pageerror.length) location=pageerror; 7906 else location="./lmpasswerror.html"; 7907} 7908 7909function SetPasswordCookie(login,password,timeseesion) 7910{ 7911 var name=login+password; 7912 setCookie(name, "1", null, timeseesion); 7913} 7914 7915function GetPasswordCookie(login,password) 7916{ 7917 var name=login+password; 7918 if(getCookie(name)) return true; 7919 else return false; 7920} 7921 7922function CompareUnicodeString(str1,str2) 7923{ 7924 if(str1.length!=str2.length) { return false; } 7925 7926 l=str1.length; 7927 for(i=0; i<l; i++) { 7928 if(str1.charCodeAt(i)!=str2.charCodeAt(i)) { return false; } 7929 } 7930 return true; 7931} 7932 7933function GetDisplayInfo(loginpar,passwordpar,timeseesion,pageerror,path) 7934{ 7935 login=EnDecrypStr(loginpar); 7936 login=HexToUnicode(login); 7937 7938 password=EnDecrypStr(passwordpar); 7939 password=HexToUnicode(password); 7940 7941 if(GetPasswordCookie(loginpar,passwordpar)) { 7942 SetPasswordCookie(loginpar,passwordpar,timeseesion); 7943 return; 7944 } 7945 7946 str=path+"lmpasswdlg.html?l='"+loginpar+"',p='"+passwordpar+"',t="+timeseesion+",pa='"+pageerror+"',pth='"+path+"',f='"+location+"',lang='"+language+"'"; 7947 location=str; 7948 return; 7949} 7950 7951 7952var MSG_QUIT; 7953var preloadImages = new Array(); 7954 7955function InitResources() 7956{ 7957 //InitResources2(language); 7958 InitResources2("en"); 7959} 7960 7961function InitResources2(lang) 7962{ 7963 language=lang; 7964 if(lang=="fr" || lang=="fr-ca" || lang=="fr-fr" || lang=="fr-be" || lang=="fr-ch" || lang=="fr-lu") { 7965 MSG_QUIT = "Voulez-vous vraiment quitter ?"; 7966 MSG_LINKNOTAVAILABLE = "Publiez le site pour vérifier cette fonction."; 7967 RES_PASSTitleStr="Entrez votre identifiant et votre mot de passe<br>"; 7968 RES_PASSLoginStr="Identifiant :"; 7969 RES_PASSPasswordStr="Mot de passe :"; 7970 RES_PASSButOkStr=" Ok "; 7971 RES_PASSButCancelStr="Annuler"; 7972 RES_VALIDDIGITALPHAMAIL="Chiffres, lettres ou courriel seulement"; 7973 RES_VALIDDIGITALPHA="Chiffres ou lettres seulement"; 7974 RES_VALIDDIGITMAIL="Chiffres ou courriel seulement"; 7975 RES_VALIDALPHAMAIL="Lettres ou courriel seulement"; 7976 RES_VALIDDIGIT="Chiffres seulement"; 7977 RES_VALIDALPHA="Lettres seulement"; 7978 RES_VALIDMAIL="Courriel seulement"; 7979 RES_VALIDBLANK="Le champ ne doit pas être vide"; 7980 RES_VALIDCONSENT = "Le consentement est obligatoire. Veuillez cocher la case."; 7981 RES_ADDFAVORITES="Les utilisateurs de Netscape ou Firefox doivent ajouter le lien manuellement en pressant les touches <Ctrl+D>"; 7982 RES_TIMEOUT="Ce site Web à été réalisé avec une version d'évaluation de LMSOFT Web Creator.\nPour découvrir ou acheter Web Creator allez à www.lmsoft.com"; 7983 RES_GADGETHOME="Accueil"; 7984 RES_GADGETBACK="Précédente"; 7985 RES_GADGETQUIT="Quitter"; 7986 RES_GADGETFOWARD="Suivante"; 7987 RES_GADGETPRINT="Imprimer page courante"; 7988 RES_GADGETADDFAVORITE="Ajouter aux favoris"; 7989 RES_GADGETSENDTOFRIEND="Envoyer à un ami"; 7990 RES_MONTHS = ['janvier','février','mars','avril','mai','juin','juillet','août','septembre','octobre','novembre','décembre']; 7991 RES_DAYS = ["Dim","Lun","Mar","Mer","Jeu","Ven","Sam"]; 7992 RES_CAL_HEADER="\"Montrer l'archive du mois\""; 7993 RES_CAL_PREM="\"Mois précédent\""; 7994 RES_CAL_PREY="\"Année précédente\""; 7995 RES_CAL_NEXTM="\"Mois suivant\""; 7996 RES_CAL_NEXTY="\"Année suivante\""; 7997 RES_NOTWORKING_IN_LOCAL="Le son fonctionnera une fois le site en ligne."; 7998 RES_FLVEveAct_Local="FlashVideo Event/Action fonctionnera une fois le site en ligne."; 7999 RES_ACCEPT_COOKIES="Cette page nécessite d'activer les cookies pour offrir la meilleure expérience. Faites Ok pour les accepter ou Annuler pour les refuser. (Expire dans 182 jours)"; 8000 } 8001 else if(lang=="nl" || lang=="nl-be") { 8002 MSG_QUIT = "Weet u zeker dat u wilt stoppen?"; 8003 MSG_LINKNOTAVAILABLE = "Publiceer de site om deze functie te controleren."; 8004 RES_PASSTitleStr="Voer uw gebruikersnaam en wachtwoord in<br>"; 8005 RES_PASSLoginStr="Gebruikersnaam:"; 8006 RES_PASSPasswordStr="Wachtwoord :"; 8007 RES_PASSButOkStr=" Ok "; 8008 RES_PASSButCancelStr=" Annuleren "; 8009 RES_VALIDDIGITALPHAMAIL="Alleen cijfers, letters en e-mail zijn in het veld toegestaan"; 8010 RES_VALIDDIGITALPHA="Alleen cijfers en letters zijn in het veld toegestaan"; 8011 RES_VALIDDIGITMAIL="Alleen cijfers en e-mail zijn in het veld toegestaan"; 8012 RES_VALIDALPHAMAIL="Alleen letters en e-mail zijn in het veld toegestaan"; 8013 RES_VALIDDIGIT="Alleen cijfers zijn in het veld toegestaan"; 8014 RES_VALIDALPHA="Alleen letters zijn in het veld toegestaan"; 8015 RES_VALIDMAIL="Alleen e-mail is in het veld toegestaan"; 8016 RES_VALIDBLANK="Het veld mag niet leeg zijn"; 8017 RES_ADDFAVORITES="Firefox- en Netscape-gebruikers moeten handmatig bladwijzers naar pagina's maken door op <Ctrl+D> te drukken"; 8018 RES_TIMEOUT="This Web page was created with an evaluation copy of LMSOFT Web Creator.\nTo discover or buy Web Creator go to www.lmsoft.com"; 8019 RES_GADGETHOME="Start"; 8020 RES_GADGETBACK="Terug"; 8021 RES_GADGETQUIT="Afsluiten"; 8022 RES_GADGETFOWARD="Vooruitspoelen"; 8023 RES_GADGETPRINT="Huidige pagina afdrukken"; 8024 RES_GADGETADDFAVORITE="Aan favorieten toevoegen"; 8025 RES_GADGETSENDTOFRIEND="Naar een vriend/vriendin sturen"; 8026 RES_MONTHS = ['Januari','Februari','Maart','April','Mei','Juni','Juli','Augustus','September','Oktober','November','December']; 8027 RES_DAYS = ["Zon","Maa","Din","Woe","Don","Vr","Zat"]; 8028 RES_CAL_HEADER="\"Archiefmaand weergeven\""; 8029 RES_CAL_PREM="\"Vorige maand\""; 8030 RES_CAL_PREY="\"Vorig jaar\""; 8031 RES_CAL_NEXTM="\"Volgende maand\"";
8032 RES_CAL_NEXTY="\"Volgend jaar\""; 8033 RES_NOTWORKING_IN_LOCAL="Het geluid werkt zodra de website online is."; 8034 RES_FLVEveAct_Local="FlashVideo Event/Action werkt zodra de website online is."; 8035 RES_ACCEPT_COOKIES="Deze pagina vereist het inschakelen van cookies om de beste ervaring te bieden. Klik op OK om ze te accepteren of op Annuleren om ze te weigeren. (Vervalt in 182 dagen)"; 8036 } 8037 else if(lang=="de") { 8038 MSG_QUIT = "Sind Sie sicher, dass Sie beenden möchten?"; 8039 MSG_LINKNOTAVAILABLE = "Veröffentlichen Sie die Website, um diese Funktion zu überprüfen."; 8040 RES_PASSTitleStr="Geben Sie Ihren Benutzernamen und Ihr Kennwort ein<br>"; 8041 RES_PASSLoginStr="Benutzername :"; 8042 RES_PASSPasswordStr="Kennwort :"; 8043 RES_PASSButOkStr=" OK "; 8044 RES_PASSButCancelStr=" Abbrechen "; 8045 RES_VALIDDIGITALPHAMAIL="In diesem Feld sind nur Zahlen, Buchstaben und E-Mail-Adressen zulässig"; 8046 RES_VALIDDIGITALPHA="In diesem Feld sind nur Zahlen und Buchstaben zulässig"; 8047 RES_VALIDDIGITMAIL="In diesem Feld sind nur Zahlen und E-Mail-Adressen zulässig"; 8048 RES_VALIDALPHAMAIL="In diesem Feld sind nur Buchstaben und E-Mail-Adressen zulässig"; 8049 RES_VALIDDIGIT="In diesem Feld sind nur Zahlen zulässig"; 8050 RES_VALIDALPHA="In diesem Feld sind nur Buchstaben zulässig"; 8051 RES_VALIDMAIL="In diesem Feld sind nur E-Mail-Adressen zulässig"; 8052 RES_VALIDBLANK="Dieses Feld muss ausgefüllt werden"; 8053 RES_VALIDCONSENT = "Die Einwilligung ist zwingend erforderlich. Bitte kreuzen Sie das Kästchen an."; 8054 RES_ADDFAVORITES="Benutzer von Firefox und Netscape müssen die Seiten manuell zu den Favoriten hinzufügen, indem sie die Tastenkombination <Strg+D> verwenden"; 8055 RES_TIMEOUT="This Web page was created with an evaluation copy of LMSOFT Web Creator.\nTo discover or buy Web Creator go to www.lmsoft.com"; 8056 RES_GADGETHOME="Startseite"; 8057 RES_GADGETBACK="Zurück"; 8058 RES_GADGETQUIT="Beenden"; 8059 RES_GADGETFOWARD="Weiter"; 8060 RES_GADGETPRINT="Aktuelle Seite drucken"; 8061 RES_GADGETADDFAVORITE="Zu Favoriten hinzufügen"; 8062 RES_GADGETSENDTOFRIEND="An einen Freund senden"; 8063 RES_MONTHS = ['Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember']; 8064 RES_DAYS = ["So","Mo","Di","Mi","Do","Fr","Sa"]; 8065 RES_CAL_HEADER="\"Monatsarchiv anzeigen\""; 8066 RES_CAL_PREM="\"Vormonat\""; 8067 RES_CAL_PREY="\"Letztes Jahr\""; 8068 RES_CAL_NEXTM="\"Nächster Monat\""; 8069 RES_CAL_NEXTY="\"Nächstes Jahr\""; 8070 RES_NOTWORKING_IN_LOCAL="Ton funktioniert, wenn die Website online ist."; 8071 RES_FLVEveAct_Local="FlashVideo Event/Action, wenn die Website online ist."; 8072 RES_ACCEPT_COOKIES="Diese Seite erfordert die Aktivierung von Cookies, um das bestmögliche Erlebnis zu bieten. Klicken Sie auf OK, um sie zu akzeptieren, oder auf Abbrechen, um sie abzulehnen. (Läuft in 182 Tagen ab)"; 8073 } 8074 else if(lang=="es") { 8075 MSG_QUIT = "¿Desea salir?"; 8076 MSG_LINKNOTAVAILABLE = "Publique el sitio para comprobar esta función."; 8077 RES_PASSTitleStr="Introduzca el nombre de usuario y la contraseña<br>"; 8078 RES_PASSLoginStr="Nombre de usuario:"; 8079 RES_PASSPasswordStr="Contraseña :"; 8080 RES_PASSButOkStr=" Aceptar "; 8081 RES_PASSButCancelStr=" Cancelar "; 8082 RES_VALIDDIGITALPHAMAIL="Sólo se permiten números, letras y direcciones de correo electrónico en el campo"; 8083 RES_VALIDDIGITALPHA="Sólo se permiten números y letras en el campo"; 8084 RES_VALIDDIGITMAIL="Sólo se permiten números y direcciones de correo electrónico en el campo"; 8085 RES_VALIDALPHAMAIL="Sólo se permiten letras y direcciones de correo electrónico en el campo"; 8086 RES_VALIDDIGIT="Sólo se permiten números en el campo"; 8087 RES_VALIDALPHA="Sólo se permiten letras en el campo"; 8088 RES_VALIDMAIL="Sólo se permiten direcciones de correo de electrónico en el campo"; 8089 RES_VALIDBLANK="El campo no debe estar vacÃo"; 8090 RES_VALIDCONSENT = "El consentimiento es obligatorio. Marque la casilla."; 8091 RES_ADDFAVORITES="Los usuarios de Firefox y Netscape deben marcar las páginas favoritas de forma manual, con <Ctrl+D>"; 8092 RES_TIMEOUT="Esta página web fue creada con una copia de evaluación de LMSOFT Web Creator.\nPara descubrir o adquirir Web Creator, vaya a www.lmsoft.com"; 8093 RES_GADGETHOME="Inicio"; 8094 RES_GADGETBACK="Atrás"; 8095 RES_GADGETQUIT="Salir"; 8096 RES_GADGETFOWARD="Avanzar"; 8097 RES_GADGETPRINT="Imprimir página actual"; 8098 RES_GADGETADDFAVORITE="Agregar a los favoritos"; 8099 RES_GADGETSENDTOFRIEND="Enviar a un amigo"; 8100 RES_MONTHS = ['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Augosto','Septiembre','Octubre','Noviembre','Diciembre']; 8101 RES_DAYS = ["Do","Lu","Ma","Mi","Ju","Vi","Sá"]; 8102 RES_CAL_HEADER="\"Mostrar archivo de mes\""; 8103 RES_CAL_PREM="\"Mes anterior\""; 8104 RES_CAL_PREY="\"Año anterior\""; 8105 RES_CAL_NEXTM="\"Mes siguiente\""; 8106 RES_CAL_NEXTY="\"Año siguiente\""; 8107 RES_NOTWORKING_IN_LOCAL="El sonido funcionará cuando su sitio es en lÃnea."; 8108 RES_FLVEveAct_Local="FlashVideo Event/Action funcionará cuando su sitio es en lÃnea."; 8109 RES_ACCEPT_COOKIES="Esta página requiere activar las cookies para ofrecer la mejor experiencia. Haz clic en Aceptar para aceptarlas o en Cancelar para rechazarlas. (Expira en 182 dÃas)"; 8110 } 8111 else if(lang=="vi") { 8112 MSG_QUIT = "Bạn có chắc là bạn muá»n thoát?"; 8113 MSG_LINKNOTAVAILABLE = " site Äá» kiá»m tra chức nÄng nà y."; 8114 RES_PASSTitleStr="Nháºp Tên Ngưá»i Dùng và Máºt khẩu cá»§a bạn<br>"; 8115 RES_PASSLoginStr="Tên Ngưá»i Dùng :"; 8116 RES_PASSPasswordStr="Máºt khẩu :"; 8117 RES_PASSButOkStr=" Äá»ng à "; 8118 RES_PASSButCancelStr=" Há»§y bá» "; 8119 RES_VALIDDIGITALPHAMAIL="Chá» có sá», chữ cái và email lÃ ÄÆ°á»£c phép nháºp trong trưá»ng nà y"; 8120 RES_VALIDDIGITALPHA="Chá» có sá» và chữ cái ÄÆ°á»£c phép nháºp trong trưá»ng nà y"; 8121 RES_VALIDDIGITMAIL="Chá» có sá» và email ÄÆ°á»£c phép nháºp trong trưá»ng nà y"; 8122 RES_VALIDALPHAMAIL="Chá» có chữ cái và email ÄÆ°á»£c phép nháºp trong trưá»ng nà y"; 8123 RES_VALIDDIGIT="Chá» có sá» ÄÆ°á»£c phép nháºp trong trưá»ng nà y"; 8124 RES_VALIDALPHA="Chá» có chữ cái ÄÆ°á»£c phép nháºp trong trưá»ng nà y"; 8125 RES_VALIDMAIL="Chá» có email ÄÆ°á»£c phép nháºp trong trưá»ng nà y"; 8126 RES_VALIDBLANK="Trưá»ng bắt buá»c không ÄÆ°á»£c Äá» trá»ng"; 8127 RES_VALIDCONSENT = "Sá»± Äá»ng ý là bắt buá»c. Vui lòng Äánh dấu và o ô."; 8128 RES_ADDFAVORITES="Ngưá»i dùng Firefox và Netscape phải dùng tay là m dấu những trang bằng cách nhấn <Ctrl+D>"; 8129 RES_TIMEOUT="Trang Web nà y Äã ÄÆ°á»£c tạo vá»i má»t bản sao có Äá»nh lượng (thá»i gian) cá»§a LMSOFT Web Creator.\n Äá» tìm hiá»u hoặc mua Web Creator hãy Äến trang www.lmsoft.com"; 8130 RES_GADGETHOME="Trang chá»§"; 8131 RES_GADGETBACK="Quay lại"; 8132 RES_GADGETQUIT="Thoát"; 8133 RES_GADGETFOWARD="Tiếp tá»i"; 8134 RES_GADGETPRINT="In trang hiá»n hà nh"; 8135 RES_GADGETADDFAVORITE="Thêm và o mục Ưa ThÃch"; 8136 RES_GADGETSENDTOFRIEND="Gá»i Äến má»t ngưá»i bạn"; 8137 RES_MONTHS = ['Tháng Má»t','Tháng Hai','Tháng Ba','Tháng Tư','Tháng NÄm','Tháng Sáu','Tháng Bảy','Tháng Tám','Tháng ChÃn','Tháng Mưá»i','Tháng Mưá»i Má»t','Tháng Mưá»i Hai']; 8138 RES_DAYS = ["Chá»§ nháºt","Thứ Hai","Thứ Ba","Thứ Tư","Thứ NÄm","Thứ sáu","Thứ Bảy"]; 8139 RES_CAL_HEADER="\"Hiá»n tháng lưu trữ\""; 8140 RES_CAL_PREM="\"Tháng liá»n trưá»c\""; 8141 RES_CAL_PREY="\"NÄm liá»n trưá»c\""; 8142 RES_CAL_NEXTM="\"Tháng kế tiếp\""; 8143 RES_CAL_NEXTY="\"NÄm kế tiếp\""; 8144 RES_NOTWORKING_IN_LOCAL="Sound will work once the website is online."; 8145 RES_FLVEveAct_Local="FlashVideo Event/Action will work once the website is online."; 8146 RES_ACCEPT_COOKIES="This page requires enabling cookies to provide the best experience. Click OK to accept them or Cancel to reject them. (Expires in 182 days)"; 8147 } 8148 else { 8149 MSG_QUIT = "Are you sure you want to quit?"; 8150 MSG_LINKNOTAVAILABLE = "Publish the site to check this feature."; 8151 RES_PASSTitleStr="Enter your User Name and Password<br>"; 8152 RES_PASSLoginStr="User Name :"; 8153 RES_PASSPasswordStr="Password :"; 8154 RES_PASSButOkStr=" Ok "; 8155 RES_PASSButCancelStr=" Cancel "; 8156 RES_VALIDDIGITALPHAMAIL="Only numbers, letters and email are allowed in the field"; 8157 RES_VALIDDIGITALPHA="Only numbers and letters are allowed in the field"; 8158 RES_VALIDDIGITMAIL="Only numbers and email are allowed in the field"; 8159 RES_VALIDALPHAMAIL="Only letters and email are allowed in the field"; 8160 RES_VALIDDIGIT="Only numbers allowed in the field"; 8161 RES_VALIDALPHA="Only letters allowed in the field"; 8162 RES_VALIDMAIL="Only email allowed in the field"; 8163 RES_VALIDBLANK="The field must not be blank"; 8164 RES_VALIDCONSENT = "Consent is mandatory. Please check the box."; 8165 RES_ADDFAVORITES="Firefox and Netscape users must bookmark the pages manually by hitting <Ctrl+D>"; 8166 RES_TIMEOUT="This Web page was created with an evaluation copy of LMSOFT Web Creator.\nTo discover or buy Web Creator go to www.lmsoft.com"; 8167 RES_GADGETHOME="Home"; 8168 RES_GADGETBACK="Back"; 8169 RES_GADGETQUIT="Quit"; 8170 RES_GADGETFOWARD="Forward"; 8171 RES_GADGETPRINT="Print current page"; 8172 RES_GADGETADDFAVORITE="Add to favorites"; 8173 RES_GADGETSENDTOFRIEND="Send to a friend"; 8174 RES_MONTHS = ['January','February','March','April','May','June','July','August','September','October','November','December']; 8175 RES_DAYS = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]; 8176 RES_CAL_HEADER="\"Show month archive\""; 8177 RES_CAL_PREM="\"Previous month\""; 8178 RES_CAL_PREY="\"Previous year\""; 8179 RES_CAL_NEXTM="\"Next month\""; 8180 RES_CAL_NEXTY="\"Next year\""; 8181 RES_NOTWORKING_IN_LOCAL="Sound will work once the website is online."; 8182 RES_FLVEveAct_Local="FlashVideo Event/Action will work once the website is online."; 8183 RES_ACCEPT_COOKIES="This page requires enabling cookies to provide the best experience. Click OK to accept them or Cancel to reject them. (Expires in 182 days)"; 8184 } 8185} 8186 8187function getURLParam(name){ 8188 var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href); 8189 if (results==null){ 8190 return null; 8191 } 8192 else{ 8193 return results[1] || 0; 8194 } 8195} 8196function LMText(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,branchlist,tooltip,param) 8197{ 8198 var LMText = new LMObject(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,branchlist,tooltip,param,true); 8199 8200 var tagdiv=document.getElementById(id); 8201 tagdiv.drawok=1; 8202 tagdiv.onmouseup=LMGlobalUp; 8203 tagdiv.onmousedown=LMGlobalDn; 8204 tagdiv.onmouseover=TagLMTextMouseOver; 8205 tagdiv.onmouseout=TagLMTextMouseOut; 8206 8207 LMText.GetTop=TagGetTop; 8208 LMText.GetWidth=TagGetWidth; 8209 LMText.GetHeight=TagGetHeight; 8210 LMText.SetLeft=TagSetLeft; 8211 LMText.SetTop=TagSetTop; 8212 LMText.SetWidth=TagSetWidth; 8213 LMText.SetHeight=TagSetHeight; 8214 8215 LMText.oriw=LMText.GetWidth(); 8216 LMText.orih=LMText.GetHeight(); 8217 8218 return LMText; 8219} 8220 8221function LMTextBrOver(id,idx) 8222{ 8223 LMGlobalOver(id); 8224 FireEvent(id+"_"+idx,"_OnMouseEnter"); 8225 8226 var LMObject=FindClassObjectFromId(id); 8227 if(!LMObject) return; 8228 8229 if(LMObject.BranchLst) { 8230 for (var i=0; i<LMObject.BranchLst.length; i++) { 8231 if(LMObject.BranchLst[i]==null) continue; 8232 if(LMObject.BranchLst[i].id == idx) { 8233 GadgetShowLink(LMObject.BranchLst[i]); 8234 break; 8235 } 8236 } 8237 } 8238} 8239 8240function LMTextBrOut(id,idx) 8241{ 8242 LMGlobalOver(-1); 8243 FireEvent(id+"_"+idx,"_OnMouseLeave"); 8244 8245 var LMObject=FindClassObjectFromId(id); 8246 if(!LMObject) return; 8247 if(LMObject.BranchLst) window.status=""; 8248} 8249 8250function LMTextBrDown(id,idx) 8251{ 8252 FireEvent(id+"_"+idx,"_OnMouseDown"); 8253} 8254 8255function LMTextBrUp(object_id,branch_id) 8256{ 8257 FireEvent(object_id+"_"+branch_id,"_OnMouseUp"); 8258 FireEvent(object_id+"_"+branch_id,"_OnClick"); 8259 8260 var LMObject=FindClassObjectFromId(object_id); 8261 if(!LMObject) return; 8262 if(!LMObject.BranchLst) return; 8263 for (var i = 0; i < LMObject.BranchLst.length;i++) { 8264 if(LMObject.BranchLst[i]==null) continue; 8265 if(LMObject.BranchLst[i].id == branch_id) { 8266 if(LMObject.BranchLst[i].where.indexOf('GADGET')!=-1 || LMObject.BranchLst[i].openinnewwindow) LMObjectClick(LMObject.id,i); 8267 break; 8268 } 8269 } 8270} 8271 8272function TagLMTextMouseOver(e) 8273{ 8274 if(e==null) var e=window.event; 8275 e.cancelBubble = true; 8276
8277 LMGlobalOver(this.id); 8278} 8279 8280function TagLMTextMouseOut(e) 8281{ 8282 if(e==null) var e=window.event; 8283 e.cancelBubble = true; 8284 8285 LMGlobalOver(-1); 8286} 8287 8288 8289//function LMTextMouseUp() 8290//{ 8291// LMObjectClick(this.id,0); 8292//} 8293 8294var gCapturedSlide= null; 8295 8296function LMGal(id,initvisible,displayenable,delais,delaisdisp,listphotos,interval,type,pathref,totalh,multipage,shownumbers,showdesc,autostart,showfrise,allowpopup,usehalves,fullpage,forceview,allowloop,allowstretch) 8297{ 8298 var LMGal = new LMObject(id,initvisible,displayenable,delais,null,delaisdisp,null,null,null,null,true); 8299 8300 var tagdiv=document.getElementById(id); 8301 tagdiv.drawok=1; 8302 8303 LMGal.InitObject=LMGalInit; 8304 LMGal.interval=interval; 8305 LMGal.listphotos=listphotos; 8306 LMGal.currentslide=0; 8307 LMGal.currentmosaic=0; 8308 LMGal.type=type; 8309 LMGal.pathref=pathref+"LMGal/"; 8310 LMGal.multipage= multipage; 8311 LMGal.autostart= autostart; 8312 LMGal.showdesc= showdesc; 8313 LMGal.totalh= totalh; 8314 LMGal.shownumbers= shownumbers; 8315 LMGal.showfrise= showfrise; 8316 8317 LMGal.allowpopup= allowpopup; 8318 LMGal.usehalves= usehalves; 8319 LMGal.fullpage= fullpage; 8320 LMGal.forceview= forceview; 8321 LMGal.allowloop= allowloop; 8322 LMGal.allowstretch= allowstretch; 8323 8324 //Pour ne pas effacer les images par le Cleaner 8325 var dump; 8326 dump="./LMGal/firstn.png"; 8327 dump="./LMGal/firsto.png"; 8328 dump="./LMGal/lastn.png"; 8329 dump="./LMGal/lasto.png"; 8330 dump="./LMGal/mbg.png"; 8331 dump="./LMGal/mbgp.png"; 8332 dump="./LMGal/mosn.png"; 8333 dump="./LMGal/moso.png"; 8334 dump="./LMGal/nextn.png"; 8335 dump="./LMGal/nexto.png"; 8336 dump="./LMGal/openn.png"; 8337 dump="./LMGal/openo.png"; 8338 dump="./LMGal/pausen.png"; 8339 dump="./LMGal/pauseo.png"; 8340 dump="./LMGal/playn.png"; 8341 dump="./LMGal/playo.png"; 8342 dump="./LMGal/prevn.png"; 8343 dump="./LMGal/prevo.png"; 8344 dump="./LMGal/sbg.png"; 8345 8346 return LMGal; 8347} 8348 8349function LMGalInit() 8350{ 8351 if(this.init==true) return; 8352 this.init=true; 8353 8354 if(this.type=='Slide') { 8355 var LMObject=FindClassObjectFromId(this.id); 8356 LMObject.play= this.autostart; 8357 8358 FillPhotosSlide(this.id,0); 8359 if (this.autostart) FillPhotosSlidePlay(this.id); 8360 } 8361 else FillPhotosMosaic(this.id,0); 8362 8363} 8364 8365function GalMiniBarMouseTrap(e) 8366{ 8367 if(e==null) e=window.event; 8368 8369 var scroll= getScrollXY(); 8370 posx = e.clientX + scroll[0]; 8371 posy = e.clientY + scroll[1]; 8372 8373 var layerparent=FindTagFromId(gCapturedSlide); 8374 if (layerparent == null) return; 8375 8376 var layer= FindTagFromId(gCapturedSlide + "Slide"); 8377 if (layer == null) return; 8378 8379 var backpanel=FindTagFromId("Page"); 8380 if (backpanel == null) return; 8381 8382 var oxstretch= backpanel.GetLeft(); 8383 var oystretch= backpanel.GetTop(); 8384 8385 if ( posx >= oxstretch + layer.offsetLeft + layerparent.offsetLeft - 3 && 8386 posx <= oxstretch + layer.offsetLeft + layerparent.offsetLeft + layer.offsetWidth + 2 && 8387 posy >= oystretch + layer.offsetTop + layerparent.offsetTop - 3 && 8388 posy <= oystretch + layer.offsetTop + layerparent.offsetTop + layer.offsetHeight + 2) 8389 { 8390 // rien 8391 } 8392 else 8393 { 8394 HideMinibar(gCapturedSlide,0); 8395 gCapturedSlide= null; 8396 } 8397} 8398 8399function Photo(thumbnail, url, imgw, imgh, title, effect) 8400{ 8401 this.thumbnail=thumbnail; 8402 this.url=url; 8403 this.imgw=imgw; 8404 this.imgh=imgh; 8405 this.title=title; 8406 this.effect=effect; 8407} 8408 8409function GalSetImage(tag,filename) 8410{ 8411 tag.src=filename; 8412} 8413 8414function GalSetPlayStopButton51(classid,over) { 8415 var LMObject=FindClassObjectFromId(classid); 8416 if(!LMObject) return; 8417 8418 var pathref=LMObject.pathref; 8419 8420 var but=document.getElementById(classid+"PausePlay"); 8421 if (but == null) return; 8422 if(LMObject.play==0) { 8423 if(over) but.src=pathref+"/playo.png"; 8424 else but.src=pathref+"/playn.png"; 8425 } 8426 else { 8427 if (over) but.src=pathref+"/pauseo.png"; 8428 else but.src=pathref+"/pausen.png"; 8429 } 8430} 8431 8432function FillPhotosSlidePause(classid) 8433{ 8434 var LMObject=FindClassObjectFromId(classid); 8435 if(!LMObject) return; 8436 8437 if(LMObject.timeid!=0) clearTimeout(LMObject.timeid); 8438 LMObject.play=0; 8439 GalSetPlayStopButton51(classid,0); 8440} 8441 8442function FillPhotosSlidePlay(classid) 8443{ 8444 var LMObject=FindClassObjectFromId(classid); 8445 if(!LMObject) return; 8446 if(LMObject.play==1) return; 8447 8448 if(LMObject.timeid!=0) clearTimeout(LMObject.timeid); 8449 8450 LMObject.play=1; 8451 GalSetPlayStopButton51(classid,0); 8452 8453 LMObject.currentslide++; 8454 LMObject.timeid=setTimeout("FillPhotosSlide('"+classid+"',"+LMObject.currentslide+")",LMObject.interval); 8455} 8456 8457function FillPhotosSlideTogglePause(classid) 8458{ 8459 var LMObject=FindClassObjectFromId(classid); 8460 if(!LMObject) return; 8461 8462 if(LMObject.play==1) { 8463 FillPhotosSlidePause(classid); 8464 } 8465 else { 8466 FillPhotosSlidePlay(classid); 8467 } 8468} 8469 8470function FillPhotosSetInterval(classid,value) 8471{ 8472 var LMObject=FindClassObjectFromId(classid); 8473 if(!LMObject) return; 8474 8475 LMObject.interval=value; 8476 8477 if(LMObject.timeid!=0) clearTimeout(LMObject.timeid); 8478 if(LMObject.play) LMObject.timeid=setTimeout("FillPhotosSlide('"+classid+"',"+LMObject.currentslide+")",LMObject.interval); 8479} 8480 8481function MapNext(classid) 8482{ 8483 var LMObject=FindClassObjectFromId(classid); 8484 if(!LMObject) return; 8485 FillPhotosSlide(classid, LMObject.currentslide + 1); 8486} 8487 8488function MapPrev(classid) 8489{ 8490 var LMObject=FindClassObjectFromId(classid); 8491 if(!LMObject) return; 8492 FillPhotosSlide(classid, LMObject.currentslide - 1); 8493} 8494 8495function ShowMinibar(classid,rendu) 8496{ 8497 if (rendu > 26) rendu= 26;
8498 8499 if (gCapturedSlide) return; 8500 8501 var tagminibar=document.getElementById(classid+"SlideControls"); 8502 if (tagminibar.sliding && rendu == 0) return; 8503 tagminibar.sliding= 1; 8504 tagminibar.style.display= 'block'; 8505 8506 tagminibar.style.top=rendu-26; 8507 if (rendu < 26) { 8508 rendu= rendu + 4; 8509 setTimeout("ShowMinibar('"+classid+"',"+rendu+")", 25); 8510 } 8511 else { 8512 tagminibar.sliding= 0; 8513 gCapturedSlide= classid; 8514 8515 $(document).bind('mousemove', GalMiniBarMouseTrap); 8516 } 8517} 8518 8519function HideMinibar(classid,rendu) 8520{ 8521 if (rendu > 26) rendu= 26; 8522 8523 document.onmousemove= null; 8524 var tagminibar=document.getElementById(classid+"SlideControls"); 8525 if (tagminibar == null) return; 8526 if (tagminibar.sliding && rendu == 0) return; 8527 tagminibar.sliding= 1; 8528 8529 tagminibar.style.top= -rendu; 8530 if (rendu < 26) { 8531 rendu= rendu + 4; 8532 setTimeout("HideMinibar('"+classid+"',"+rendu+")", 25); 8533 } 8534 else { 8535 tagminibar.sliding= 0; 8536 tagminibar.style.display= 'none'; 8537 gCapturedSlide= null; 8538 } 8539} 8540 8541function ContextSwitch(classid,slide) 8542{ 8543 var LMObject=FindClassObjectFromId(classid); 8544 if(!LMObject) return; 8545 8546 var taggrid=document.getElementById(classid+"Grid"); 8547 var taggridcontrols=document.getElementById(classid+"GridControls"); 8548 var tagslide=document.getElementById(classid+"Slide"); 8549 var tagslide2=document.getElementById(classid+"Slide2"); 8550 var tagslidedesc=document.getElementById(classid+"SlideDesc"); 8551 var tagslidefrise=document.getElementById(classid+"SlideFrise"); 8552 8553 if (slide) { 8554 taggrid.style.display= "none"; 8555 taggridcontrols.style.display= "none"; 8556 8557 tagslide.style.display= "block"; 8558 tagslide2.style.display= "block"; 8559 8560 if (LMObject.showdesc) tagslidedesc.style.display= "block"; 8561 else tagslidedesc.style.display= "none"; 8562 8563 if (LMObject.showfrise) tagslidefrise.style.display= "block"; 8564 else tagslidefrise.style.display= "none"; 8565 } 8566 else { 8567 taggrid.style.display= "block"; 8568 if (LMObject.multipage) taggridcontrols.style.display= "block"; 8569 else taggridcontrols.style.display= "none"; 8570 8571 tagslide.style.display= "none"; 8572 tagslide2.style.display= "none"; 8573 tagslidedesc.style.display= "none"; 8574 tagslidefrise.style.display= "none"; 8575 } 8576} 8577 8578function FillPhotosSlide(classid,start) 8579{ 8580 var string=""; 8581 var LMObject=FindClassObjectFromId(classid); 8582 if(!LMObject) return; 8583 8584 if (LMObject.type != "Slide") ContextSwitch(classid,1); 8585 8586 var LMPhoto=FindClassObjectFromId(classid+"Slide"); 8587 if(LMPhoto!=null) { 8588 if(LMPhoto.TagObject.drawingeffect==1) { 8589 if(LMObject.play) { 8590 if(LMObject.timeid!=0) clearTimeout(LMObject.timeid); 8591 LMObject.timeid=setTimeout("FillPhotosSlide('"+classid+"',"+LMObject.currentslide+")",LMObject.interval); 8592 } 8593 return; 8594 } 8595 } 8596 8597 var pathref=LMObject.pathref; 8598 var listphotos=LMObject.listphotos; 8599 if(start>=listphotos.length) start=0; 8600 if(start<0) start=listphotos.length-1; 8601 LMObject.currentslide=start; 8602 LMObject.type="Slide"; 8603 8604 var tagslide=document.getElementById(classid+"Slide"); 8605 var tagfrise=document.getElementById(classid+"SlideFrise"); 8606 //Thumbnail under galerie 8607 if(LMObject.showfrise) { 8608 if(tagfrise.innerHTML=="") { 8609 var w=tagfrise.offsetWidth-2; 8610 string="<div style='position:relative;overflow:auto;width:100%;height:75px;left:0px;top:0px;'>"; 8611 for(i=0; i<listphotos.length; i++) { 8612 var url_thumbnail=listphotos[i].thumbnail; 8613 string+="<a href=javascript:FillPhotosSlide('" + classid + "',"+i+")><img src='"+ url_thumbnail + "' border=0></a> "; 8614 } 8615 string+="</div>"; 8616 tagfrise.innerHTML=string; 8617 } 8618 } 8619 //~Thumbnail under galerie 8620 8621 8622 var title=listphotos[start].title; 8623 var url_img=listphotos[start].url; 8624 var imgw=listphotos[start].imgw; 8625 var imgh=listphotos[start].imgh; 8626 8627 var nDestWidth=tagslide.offsetWidth; 8628 var nDestHeight=tagslide.offsetHeight; 8629 8630 var fx = 0; 8631 var fy = 0; 8632 var fw = nDestWidth; 8633 var fh = nDestHeight; 8634 8635 if((nDestWidth/imgw) >= (nDestHeight/imgh)) { 8636 fw = nDestHeight * imgw / imgh; 8637 fx = (nDestWidth - fw) / 2; 8638 } 8639 else { 8640 fh = nDestWidth * imgh / imgw; 8641 fy = (nDestHeight - fh) / 2; 8642 } 8643 8644 if (LMObject.allowstretch) { 8645 fx= 0; 8646 fy= 0; 8647 fh= nDestHeight; 8648 fw= nDestWidth; 8649 } 8650 8651 var tagslidecontrols=document.getElementById(classid+"SlideControls"); 8652 8653 string="<div style='top:0px;width:100%;'>"; 8654 string+="<center><img src='" + pathref + "/sbg.png'></center>"; 8655 string+="<div style='position:absolute;width:100%;top:4px;'>"; 8656 8657 string+="<center>"; 8658 string+="<a href=javascript:FillPhotosSlide('" + classid + "',"+(start-1)+")><img src='"+pathref+"/prevn.png' onmouseover=GalSetImage(this,'"+pathref+"/prevo.png'); onmouseout=GalSetImage(this,'"+pathref+"/prevn.png') border=0 align=absmiddle></a>"; 8659 string+=" "; 8660 string+="<a href=javascript:FillPhotosSlide('" + classid + "',0)><img src='"+pathref+"/firstn.png' onmouseover=GalSetImage(this,'"+pathref+"/firsto.png'); onmouseout=GalSetImage(this,'"+pathref+"/firstn.png') border=0 align=absmiddle></a>"; 8661 8662 if (!LMObject.forceview) {
8663 string+="<a href=javascript:FillPhotosMosaic('" + classid + "',"+(start)+")>"+"<img src='"+pathref+"/mosn.png' onmouseover=GalSetImage(this,'"+pathref+"/moso.png'); onmouseout=GalSetImage(this,'"+pathref+"/mosn.png') border=0 align=absmiddle></a>"; 8664 } 8665 else { 8666 //string+="<DIV style='position:static; width:1px; height:1px;'>XXXXXX</DIV>"; 8667 8668 string+=" "; 8669 string+=" "; 8670 string+=" "; 8671 string+=" "; 8672 string+=" "; 8673 string+=" "; 8674 } 8675 8676 string+=" "; 8677 string+=" "; 8678 string+="<a href=javascript:FillPhotosSlideTogglePause('" + classid + "')><img id="+classid+"PausePlay src='' onmouseover=GalSetPlayStopButton51('"+classid+"',1); onmouseout=GalSetPlayStopButton51('"+classid+"',0); border=0 align=absmiddle></a>"; 8679 string+=" "; 8680 string+=" "; 8681 8682 if (LMObject.fullpage) { 8683 string+="<a href='" + url_img + "'><img src='"+pathref+"/openn.png' onmouseover=GalSetImage(this,'"+pathref+"/openo.png'); onmouseout=GalSetImage(this,'"+pathref+"/openn.png') border=0 align=absmiddle></a>"; 8684 } 8685 else { 8686 string+=" "; 8687 string+=" "; 8688 string+=" "; 8689 string+=" "; 8690 string+=" "; 8691 string+=" "; 8692 } 8693 8694 string+="<a href=javascript:FillPhotosSlide('" + classid + "',"+(listphotos.length-1)+")><img src='"+pathref+"/lastn.png' onmouseover=GalSetImage(this,'"+pathref+"/lasto.png'); onmouseout=GalSetImage(this,'"+pathref+"/lastn.png') border=0 align=absmiddle></a>"; 8695 string+=" "; 8696 string+="<a href=javascript:FillPhotosSlide('" + classid + "',"+(start+1)+")><img src='"+pathref+"/nextn.png' onmouseover=GalSetImage(this,'"+pathref+"/nexto.png'); onmouseout=GalSetImage(this,'"+pathref+"/nextn.png') border=0 align=absmiddle></a>"; 8697 8698 string+="</center>"; 8699 string+="</div>"; 8700 string+="</div>"; 8701 8702 tagslidecontrols.innerHTML=string; 8703 GalSetPlayStopButton51(classid,0); 8704 8705 8706 string="<DIV id="+classid+"CurSlide"; 8707 if (LMObject.allowpopup) { 8708 string+= " onmouseover=ShowMinibar('"+classid+"',0)"; 8709 } 8710 string+= " style='visibility:inherit;overflow:hidden;position:absolute;z-index:0;width:100%;height:100%;left:"+fx+"px;top:"+fy+"px;'>"; 8711 //if (Boolean(window.chrome)) { // Chrome a un bogue avec la combinaison de imagemap et evenement 8712// string+="<img id=" + classid + "SlideInner" + " src='" + url_img + "' border=0 WIDTH="+fw+" HEIGHT="+fh+" style='visibility:inherit'>"; 8713 //} 8714 //else { 8715 if (LMObject.usehalves) { 8716 string+="<MAP name="+classid+"SlideMap onmouseover=ShowMinibar('"+classid+"',0)>"; 8717 string+="<AREA href=javascript:MapPrev('" + classid + "'); shape='rect' coords='0,0," + fw/2 + "," + fh + "'>"; 8718 string+="<AREA href=javascript:MapNext('" + classid + "'); shape='rect' coords='" + fw/2 + ",0," + fw + "," + fh + "'>"; 8719 string+="</MAP>"; 8720 8721 string+="<img id=" + classid + "SlideInner" + " src='" + url_img + "' border=0 WIDTH="+fw+" HEIGHT="+fh+" style='visibility:inherit' USEMAP='#"+classid+"SlideMap'>"; 8722 } 8723 else { 8724 string+="<img id=" + classid + "SlideInner" + " src='" + url_img + "' border=0 WIDTH="+fw+" HEIGHT="+fh+" style='visibility:inherit'>"; 8725 } 8726 string+="</DIV>"; 8727 tagslide.innerHTML=string; 8728 8729 8730 string="<DIV id="+classid+"CurSlide"+" style='visibility:inherit;overflow:hidden;position:absolute;z-index:0;width:100%;height:100%;left:"+fx+"px;top:"+fy+"px;'>"; 8731 string+="<img id=" + classid + "SlideInner" + " src='" + url_img + "' border=0 WIDTH="+fw+" HEIGHT="+fh+" style='visibility:inherit'>"; 8732 string+="</DIV>"; 8733 tagslide.innerHTML2=string; 8734 8735 8736 if (LMObject.showdesc) { 8737 var tagslidedesc=document.getElementById(classid+"SlideDesc"); 8738 tagslidedesc.innerHTML=LMGalGenerateDescription(title); 8739 } 8740 8741 if(LMObject.play) { 8742 var curslide= FindTagFromId("LMImage" + classid + "Slide"); 8743 if(LMObject.timeid!=0) clearTimeout(LMObject.timeid); 8744 LMObject.currentslide++; 8745 var doloop= true; 8746 if(LMObject.currentslide>=listphotos.length) { 8747 if (!LMObject.allowloop) doloop= false; 8748 LMObject.currentslide=0; 8749 } 8750 if (doloop) LMObject.timeid=setTimeout("FillPhotosSlide('"+classid+"',"+LMObject.currentslide+")",LMObject.interval); 8751 } 8752 8753 if(LMPhoto==null) { 8754 var zi = z_index; 8755 LMObjects[objindex++] = LMImage(classid+"Slide",1,1,0,listphotos[start].effect,0,null,null,null,null,0); 8756 z_index = zi; 8757 LMPhoto=LMObjects[objindex-1]; 8758 } 8759 else { 8760 idx=FindIdxInLMObjects(classid+"Slide"); 8761 var zi = z_index; 8762 LMObjects[idx] = LMImage(classid+"Slide",1,1,0,listphotos[start].effect,0,null,null,null,null,0); 8763 z_index = zi; 8764 LMPhoto=LMObjects[idx]; 8765 } 8766 LMPhoto.LMObjectGalerie=LMObject; 8767 LMPhoto.EffectFinishEvent=LMGALEffectFinishEvent; 8768 LMPhoto.InitObject(); 8769 LMPhoto.ResizeObject=null; 8770 LMPhoto.TagObject.drawingeffect=1; 8771 LMPhoto.Effect(); 8772} 8773 8774function LMGalGenerateDescription(text) { 8775 var string= "<font face='Arial' style=\"font-size:14pt\">"; 8776 string+= "<div align=center style=\"margin-top:3px;\">"+text+"</div>"; 8777 string+= "</font>"; 8778 return string; 8779} 8780 8781function LMGALEffectFinishEvent(id) 8782{ 8783 var ImageSide=FindClassObjectFromId(id); 8784 8785 var tagslide=document.getElementById(ImageSide.LMObjectGalerie.id+"Slide"); 8786 var tagslide2=document.getElementById(ImageSide.LMObjectGalerie.id+"Slide2"); 8787 tagslide2.innerHTML= tagslide.innerHTML2; 8788} 8789 8790function FillPhotosMosaic(classid,start) 8791{ 8792 var LMObject=FindClassObjectFromId(classid); 8793 if(!LMObject) return; 8794 8795 HideMinibar(classid,0); 8796 ContextSwitch(classid,0); 8797 8798 var LMPhoto=FindClassObjectFromId(classid+"Slide"); 8799 if(LMPhoto!=null) { 8800 if(LMPhoto.TagObject.drawingeffect==1) { 8801 if(LMObject.play) { 8802 if(LMObject.timeid!=0) clearTimeout(LMObject.timeid); 8803 LMObject.timeid=setTimeout("FillPhotosSlide('"+classid+"',"+LMObject.currentslide+")",LMObject.interval); 8804 } 8805 return; 8806 } 8807 } 8808 8809 FillPhotosSlidePause(classid); 8810 8811 LMObject.currentmosaic=start; 8812 LMObject.type="Mosaic"; 8813 8814 var listphotos=LMObject.listphotos; 8815 8816 var pathref=LMObject.pathref; 8817 var string=""; 8818 var i,j; 8819 var tw=100+5; 8820 var th=75+5; 8821 8822 var w= $("#"+classid).width(); 8823 var col=w/tw; 8824 col=parseInt(col); 8825 var h= $("#"+classid+"Grid").height(); 8826 var line=(h+5)/th; 8827 line=parseInt(line); 8828 var max=col*line; 8829 8830 if(col<=0) { alert("error col"); return; } 8831 if(line<=0) { alert("error line"); return; } 8832 if(max<=0) { alert("error max"); return; } 8833
8834 var npages=Math.ceil(listphotos.length/max); 8835 8836 if(start<0) return; 8837 if(start>=npages*max) return; 8838 8839 var currentpage=Math.round(start/max+0.5); 8840 start=(currentpage-1)*max; 8841 8842 8843 var taggridcontrol=document.getElementById(classid+"GridControls"); 8844 if (LMObject.multipage && !LMObject.shownumbers) { 8845 string="<div style='width:100%'>"; 8846 string+="<center><img src='" + pathref + "/mbg.png' style='margin-top:4px;'></center>"; 8847 string+="<div style='position:absolute;width:100%;top:4px;'>"; 8848 string+="<center>"; 8849 string+="<a href=javascript:FillPhotosMosaic('" + classid + "',"+(start-max)+")><img src='"+pathref+"/prevn.png' onmouseover=GalSetImage(this,'"+pathref+"/prevo.png'); onmouseout=GalSetImage(this,'"+pathref+"/prevn.png') border=0 align=absmiddle></a>"; 8850 string+="<a href=javascript:FillPhotosMosaic('" + classid + "',0)><img src='"+pathref+"/firstn.png' onmouseover=GalSetImage(this,'"+pathref+"/firsto.png'); onmouseout=GalSetImage(this,'"+pathref+"/firstn.png') border=0 align=absmiddle></a>"; 8851 string+=" "; 8852 string+="<a href=javascript:FillPhotosMosaic('" + classid + "',"+(npages-1)*max+")><img src='"+pathref+"/lastn.png' onmouseover=GalSetImage(this,'"+pathref+"/lasto.png'); onmouseout=GalSetImage(this,'"+pathref+"/lastn.png') border=0 align=absmiddle></a>"; 8853 string+="<a href=javascript:FillPhotosMosaic('" + classid + "',"+(start+max)+")><img src='"+pathref+"/nextn.png' onmouseover=GalSetImage(this,'"+pathref+"/nexto.png'); onmouseout=GalSetImage(this,'"+pathref+"/nextn.png') border=0 align=absmiddle></a>"; 8854 string+="</center>"; 8855 string+="</div>"; 8856 string+="</div>"; 8857 taggridcontrol.innerHTML=string; 8858 } 8859 else if (LMObject.multipage && LMObject.shownumbers) { 8860 8861 string="<div style='width:100%'>"; 8862 string+="<center><img src='" + pathref + "/mbgp.png' style='margin-top:4px;'></center>"; 8863 8864 // Numeros de page START 8865 string+="<div style='position:absolute;width:100%;top:7px;'>"; 8866 string+="<center>"; 8867 string+="<font face='Arial' color=white style=\"font-size:10pt;\">"; 8868 if(currentpage>3) string+="... "; 8869 8870 var maxnumbers=3; 8871 if($("#"+classid).width() > 400) maxnumbers=4; 8872 8873 i=currentpage-3; 8874 if(i<0) i=0; 8875 for(count=0; i<npages && count<maxnumbers; i++) { 8876 if(count!=0) string+=" "; 8877 count++; 8878 8879 if(i+1==currentpage) { 8880 string+="<b>" + (i+1) + "</b>"; 8881 } 8882 else { 8883 string+="<a href=javascript:FillPhotosMosaic('" + classid + "',"+(i*max)+") style='color:lightgrey'>" + (i+1) + "</a>"; 8884 } 8885 } 8886 if(i<npages) string+=" ..."; 8887 8888 string+="</font>"; 8889 string+="</center>"; 8890 string+="</div>"; 8891 // Numeros de page FIN 8892 8893 // Boutons START 8894 string+="<div style='position:absolute;left:"+(w/2-120)+"px;top:4px;'>"; 8895 string+="<a href=javascript:FillPhotosMosaic('" + classid + "',"+(start-max)+")><img src='"+pathref+"/prevn.png' onmouseover=GalSetImage(this,'"+pathref+"/prevo.png'); onmouseout=GalSetImage(this,'"+pathref+"/prevn.png') border=0 align=absmiddle></a>"; 8896 string+="</div>"; 8897 string+="<div style='position:absolute;left:"+(w/2-94)+"px;top:4px;'>"; 8898 string+="<a href=javascript:FillPhotosMosaic('" + classid + "',0)><img src='"+pathref+"/firstn.png' onmouseover=GalSetImage(this,'"+pathref+"/firsto.png'); onmouseout=GalSetImage(this,'"+pathref+"/firstn.png') border=0 align=absmiddle></a>"; 8899 string+="</div>"; 8900 string+="<div style='position:absolute;left:"+(w/2+68)+"px;top:4px;'>"; 8901 string+="<a href=javascript:FillPhotosMosaic('" + classid + "',"+(npages-1)*max+")><img src='"+pathref+"/lastn.png' onmouseover=GalSetImage(this,'"+pathref+"/lasto.png'); onmouseout=GalSetImage(this,'"+pathref+"/lastn.png') border=0 align=absmiddle></a>";
8902 string+="</div>"; 8903 string+="<div style='position:absolute;left:"+(w/2+94)+"px;top:4px;'>"; 8904 string+="<a href=javascript:FillPhotosMosaic('" + classid + "',"+(start+max)+")><img src='"+pathref+"/nextn.png' onmouseover=GalSetImage(this,'"+pathref+"/nexto.png'); onmouseout=GalSetImage(this,'"+pathref+"/nextn.png') border=0 align=absmiddle></a>"; 8905 string+="</div>"; 8906 // Boutons FIN 8907 string+="</div>"; 8908 8909 taggridcontrol.innerHTML=string; 8910 } 8911 else { 8912 taggridcontrol.innerHTML=""; 8913 } 8914 8915 string="<div align=center>"; 8916 var yrendu= 0; 8917 var xrendu= 0; 8918 var marge= (w - (col * 105 - 5)) / 2; 8919 for(j=0,i=start; i<start+max && i<listphotos.length; i++) { 8920 var url_thumbnail=listphotos[i].thumbnail; 8921 var url_img=listphotos[i].url; 8922 8923 string+="<div style='position:absolute;width:100px;height:75px;top:"+yrendu+"px;left:"+(xrendu+marge)+"px'>"; 8924 string+="<center>"; 8925 string+="<a href=javascript:FillPhotosSlide('" + classid + "',"+i+")><img src='"+ url_thumbnail + "' border=0</a>"; 8926 string+="</center>"; 8927 string+="</div>"; 8928 xrendu+= 105; 8929 8930 var icol=i-start+1; 8931 if(!(icol%col)) { 8932 j++; 8933 if(j+1>line) break; 8934 xrendu= 0; 8935 yrendu+= 80; 8936 } 8937 } 8938 string+="</div>"; 8939 8940 var taggrid=document.getElementById(classid+"Grid"); 8941 taggrid.innerHTML=string; 8942} 8943function XMLFileParserSync(filename,fct) 8944{ 8945 try { 8946 if(window.ActiveXObject) { 8947 var xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); 8948 xmlDoc.async="false"; 8949 ret=xmlDoc.load(filename); 8950 if(ret==false) { 8951 //alert("Error loading XML file"); 8952 return; 8953 } 8954 fct(xmlDoc); 8955 } 8956 // code for Mozilla, Firefox, Opera, etc. 8957 else { 8958 var xmlhttp=new XMLHttpRequest(); 8959 xmlhttp.onreadystatechange=function() { 8960 try { 8961 if (xmlhttp.readyState==4) { 8962 if (xmlhttp.status==200 || xmlhttp.status==0) { 8963 fct(xmlhttp.responseXML); 8964 } 8965 else { 8966 alert("Problem retrieving XML data:" + xmlDoc.statusText); 8967 } 8968 } 8969 }catch(e) { 8970 } 8971 }; 8972 xmlhttp.open("GET",filename,true); 8973 xmlhttp.overrideMimeType('text/xml'); 8974 xmlhttp.send(null); 8975 } 8976 }catch(e) { 8977 //alert(e); 8978 } 8979} 8980 8981function XMLStringParser(string,fct) 8982{ 8983 if(window.ActiveXObject) { 8984 var xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); 8985 xmlDoc.async="false"; 8986 xmlDoc.loadXML(string); 8987 fct(xmlDoc); 8988 } 8989 // code for Mozilla, Firefox, Opera, etc. 8990 else { 8991 var parser=new DOMParser(); 8992 var xmlDoc=parser.parseFromString(string,"text/xml"); 8993 fct(xmlDoc); 8994 } 8995} 8996 8997function Blog(name,listners,path) { 8998 this.oxml=null; 8999 var curdate=new Date(); 9000 this.name = name; 9001 this.year = takeYear(curdate); 9002 this.month = curdate.getMonth(); 9003 this.date = 0; 9004 if(name) this.fct=new Function("ev","if(ev.currentTarget)"+name+".oxml=ev.currentTarget;else "+name+".oxml=ev;"+name+".Refresh();"); 9005 else this.fct=null; 9006 this.Listners = listners; 9007 this.Refresh=BlogRefresh; 9008 this.LoadRSS=BlogLoadRSS; 9009 this.IsHavingPost=BlogIsHavingPost; 9010 this.refpath=path; 9011 9012 var str="./lm_xml.png"; 9013} 9014 9015function BlogRefresh() 9016{ 9017 for(var i=0; i<this.Listners.length; i++) { 9018 var lmblog=FindClassObjectFromId(this.Listners[i]); 9019 lmblog.BlogRefresh(this); 9020 } 9021} 9022 9023function BlogIsHavingPost(date) 9024{ 9025 var oxml=this.oxml; 9026 if(oxml==null) return false; 9027 var oitems=oxml.getElementsByTagName("item"); 9028 9029 var string=""; 9030 for(var i=0; i<oitems.length; i++) { 9031 var tdate=""; 9032 oelem=oitems[i].getElementsByTagName("pubDate")[0]; 9033 if(oelem) tdate=oelem.firstChild.nodeValue; 9034 if(tdate=="") continue; 9035 9036 var ddate=new Date(tdate); 9037 if(ddate.getDate()==date && ddate.getMonth()==this.month && ddate.getYear()==this.year) return true; 9038 } 9039 9040 return false; 9041} 9042 9043function BlogLoadRSS() 9044{ 9045 if(this.name==null) return; 9046 this.oxml=null; 9047 XMLFileParserSync(this.refpath+this.name+"_"+leadingZero(this.month+1)+"_"+this.year+".xml",this.fct); 9048} 9049 9050function LMBlogViewer(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,blog, 9051 bkc_item,tc_date,tc_title,tc_description,tc_comment,
9051item_border,thumbnail_border, 9052 dateFaceName,datepoinsize,datebold,dateitalic, 9053 titleFaceName,titlepoinsize,titlebold,titleitalic, 9054 descFaceName,descpoinsize,descbold,descitalic, 9055 commentFaceName,commentpoinsize,commentbold,commentitalic, 9056 textcomment,mailto,showxml,param) 9057{ 9058 var LMBlogViewer = new LMObject(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,null,null,null,true); 9059 9060 var tagdiv=document.getElementById(id); 9061 tagdiv.drawok=1; 9062 9063 LMBlogViewer.BlogRefresh=LMBlogViewerDisplay; 9064 LMBlogViewer.Blog=blog; 9065 9066 LMBlogViewer.textcomment=textcomment; 9067 LMBlogViewer.mailto=mailto; 9068 LMBlogViewer.bkc_item=bkc_item; 9069 LMBlogViewer.tc_date=tc_date; 9070 LMBlogViewer.tc_title=tc_title; 9071 LMBlogViewer.tc_description=tc_description; 9072 LMBlogViewer.tc_comment=tc_comment; 9073 LMBlogViewer.item_border=item_border; 9074 LMBlogViewer.thumbnail_border=thumbnail_border; 9075 LMBlogViewer.dateFaceName=dateFaceName; 9076 LMBlogViewer.datepoinsize=datepoinsize; 9077 LMBlogViewer.datebold=datebold; 9078 LMBlogViewer.dateitalic=dateitalic; 9079 LMBlogViewer.titleFaceName=titleFaceName; 9080 LMBlogViewer.titlepoinsize=titlepoinsize; 9081 LMBlogViewer.titlebold=titlebold; 9082 LMBlogViewer.titleitalic=titleitalic; 9083 LMBlogViewer.descFaceName=descFaceName; 9084 LMBlogViewer.descpoinsize=descpoinsize; 9085 LMBlogViewer.descbold=descbold; 9086 LMBlogViewer.descitalic=descitalic; 9087 LMBlogViewer.commentFaceName=commentFaceName; 9088 LMBlogViewer.commentpoinsize=commentpoinsize; 9089 LMBlogViewer.commentbold=commentbold; 9090 LMBlogViewer.commentitalic=commentitalic; 9091 LMBlogViewer.showxml=showxml; 9092 9093 return LMBlogViewer; 9094} 9095 9096function LMBlogViewerDisplay(blog) 9097{ 9098var oelem; 9099var string=""; 9100 9101 var oxml=blog.oxml; 9102 if(oxml==null) { 9103 var tag=document.getElementById(this.id+"Inner"); 9104 tag.innerHTML=""; 9105 return; 9106 } 9107 9108 if(this.showxml) { 9109 string+="<a href='"+blog.refpath+blog.name+"_brss.xml'><img src='"+blog.refpath+"lm_xml.png' border=0></a><br><br>"; 9110 } 9111 9112 oitems=oxml.getElementsByTagName("item"); 9113 for(var i=0; i<oitems.length; i++) { 9114 var tdate=""; 9115 var ttitle=""; 9116 var tdesc=""; 9117 var tlink=""; 9118 var tphoto=""; 9119 var tphotoW="120"; 9120 var tphotoH="90"; 9121 9122 oelem=oitems[i].getElementsByTagName("pubDate")[0]; 9123 if(oelem) tdate=oelem.firstChild.nodeValue; 9124 9125 if(tdate!="" && blog.date!=0 && blog.month!=0 && blog.year!=0) { 9126 var ddate = new Date(tdate); 9127 var year = takeYear(ddate); 9128 var month = ddate.getMonth(); 9129 var date = ddate.getDate(); 9130 9131 if(date!=blog.date || month!=blog.month || year!=blog.year) continue; 9132 } 9133 9134 oelem=oitems[i].getElementsByTagName("title")[0]; 9135 if(oelem && oelem.firstChild) ttitle=oelem.firstChild.nodeValue; 9136 oelem=oitems[i].getElementsByTagName("description")[0]; 9137 if(oelem && oelem.firstChild) tdesc=oelem.firstChild.nodeValue; 9138 oelem=oitems[i].getElementsByTagName("link")[0]; 9139 if(oelem && oelem.firstChild) tlink=oelem.firstChild.nodeValue; 9140 oelem=oitems[i].getElementsByTagName("thumbnail")[0]; 9141 if(oelem && oelem.firstChild) tphoto=oelem.firstChild.nodeValue; 9142 oelem=oitems[i].getElementsByTagName("thumbnailW")[0]; 9143 if(oelem && oelem.firstChild) tphotoW=oelem.firstChild.nodeValue; 9144 oelem=oitems[i].getElementsByTagName("thumbnailH")[0]; 9145 if(oelem && oelem.firstChild) tphotoH=oelem.firstChild.nodeValue; 9146 9147 if(tdate!="") tdate=FormatTime(tdate); 9148 9149 var bkc_item=""; 9150 var border=""; 9151 var bold; 9152 var italic; 9153 9154 if(this.bkc_item!="") bkc_item="background-color:"+this.bkc_item+";"; 9155 if(this.item_border) border="border-top:"+this.item_border+"px solid #000000;border-bottom:"+this.item_border+"px solid #000000;"; 9156 var sdivitem ="style=\""+bkc_item+border+"\""; 9157 9158 var fontdate="font-family: "+this.dateFaceName+";"; 9159 var tc_date="color:"+this.tc_date+";"; 9160 bold=""; 9161 if(this.datebold) bold="font-weight:bold;"; 9162 italic=""; 9163 if(this.dateitalic) italic="font-style:italic;"; 9164 var sdate="style=\""+fontdate+bkc_item+tc_date+"font-size:"+this.datepoinsize+"pt;margin:0px;padding:0 0 2 0px;"+bold+italic+"\""; 9165 9166 var fonttitle="font-family: "+this.titleFaceName+";"; 9167 var tc_title="color:"+this.tc_title+";"; 9168 bold=""; 9169 if(this.titlebold) bold="font-weight:bold;"; 9170 italic=""; 9171 if(this.titleitalic) italic="font-style:italic;"; 9172 var stitle="style=\""+fonttitle+bkc_item+tc_title+"font-size:"+this.titlepoinsize+"pt;margin:0px;padding:0 0 2 0px;"+bold+italic+"\""; 9173 9174 var fontdesc="font-family: "+this.descFaceName+";"; 9175 var tc_desc="color:"+this.tc_description+";"; 9176 bold=""; 9177 if(this.descbold) bold="font-weight:bold;"; 9178 italic=""; 9179 if(this.descitalic) italic="font-style:italic;"; 9180 var sdesc="style=\""+fontdesc+bkc_item+tc_desc+"font-size:"+this.descpoinsize+"pt;margin:0px;padding:0 0 2 0px;"+bold+italic+"\""; 9181 9182 var fontcomment="font-family: "+this.commentFaceName+";"; 9183 var tc_comment="color:"+this.tc_comment+";"; 9184 bold=""; 9185 if(this.commentbold) bold="font-weight:bold;"; 9186 italic=""; 9187 if(this.commentitalic) italic="font-style:italic;"; 9188 var scomment="style=\""+fontcomment+bkc_item+tc_comment+"font-size:"+this.commentpoinsize+"pt;"+bold+italic+"\""; 9189 9190 var sphoto ="style=\"margin:0 0 5 0px;float:right;padding:0 5 0 0px\""; 9191
9192 string+="<div "+sdivitem+">"; 9193 if(tdate!="") string+="<p "+sdate+">" + tdate + "</p>"; 9194 9195 if(tphoto!="") { 9196 string+="<div "+sphoto+"><a target=blogphoto href='"+blog.refpath+tphoto+"'><img style=\"width:"+tphotoW+"px;height:"+tphotoH+"px;\" src='"+blog.refpath+tphoto+"' border="+this.thumbnail_border+"></a></div>"; 9197 } 9198 9199 if(tlink!="" && ttitle!="") string+="<p "+stitle+"><a href='"+tlink+"'>"+ ttitle +"</a></p>"; 9200 else if(ttitle!="") string+="<p "+stitle+">"+ ttitle + "</p>"; 9201 9202 if(tdesc!="") { 9203 string+="<br><p "+sdesc+">"+ tdesc +"</p>"; 9204 } 9205 else if (tphoto!="") { 9206 string+="<p> </p>"; 9207 } 9208 9209 string+="<br>"; 9210 9211 if(this.textcomment!="" && this.mailto!="") { 9212 string+="<a "+scomment+" href='mailto:"+this.mailto+"?subject="+ttitle+"'>"+this.textcomment+"</a>"; 9213 } 9214 9215 string+="</div><br>"; 9216 } 9217 9218 9219 var tag=document.getElementById(this.id+"Inner"); 9220 tag.innerHTML=string; 9221} 9222 9223function FormatMonth(ddate) 9224{ 9225 return RES_MONTHS[ddate.getMonth()]; 9226} 9227 9228function FormatTime(tdate) 9229{ 9230 9231 var ddate = new Date(tdate); 9232 var Year = takeYear(ddate); 9233 var Month = leadingZero(ddate.getMonth()+1); 9234 var MonthName = FormatMonth(ddate); 9235 var Day = ddate.getDate(); 9236 var Hours = leadingZero(ddate.getHours()); 9237 var Minutes = leadingZero(ddate.getMinutes()); 9238 var Seconds = leadingZero(ddate.getSeconds()); 9239 9240 var str= Day + " " + MonthName + " " + Year + " " + Hours + ":" + Minutes + ":" + Seconds; 9241 return str; 9242} 9243 9244function takeYear(theDate) 9245{ 9246 x = theDate.getYear(); 9247 var y = x % 100; 9248 y += (y < 38) ? 2000 : 1900; 9249 return y; 9250} 9251 9252function leadingZero(nr) 9253{ 9254 if (nr < 10) nr = "0" + nr; 9255 return nr; 9256} 9257 9258function LMBlogCalendar(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,blog,hf_bkc,hf_tc,c_bkc,c_tc) 9259{ 9260 var LMBlogCalendar = new LMObject(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,null,null,null,true); 9261 9262 LMBlogCalendar.oxml=null; 9263 LMBlogCalendar.hf_bkc=hf_bkc; 9264 LMBlogCalendar.hf_tc=hf_tc; 9265 LMBlogCalendar.c_bkc=c_bkc; 9266 LMBlogCalendar.c_tc=c_tc; 9267 9268 var tagdiv=document.getElementById(id); 9269 tagdiv.drawok=1; 9270 9271 LMBlogCalendar.BlogRefresh=LMBlogCalendarDisplay; 9272 if(blog=="") { 9273 var listners = new Array(); 9274 listners[0]=id; 9275 LMBlogCalendar.Blog=new Blog(null,listners); 9276 } 9277 else LMBlogCalendar.Blog=blog; 9278 9279 LMBlogCalendar.BlogRefresh(null); 9280 return LMBlogCalendar; 9281} 9282 9283function LMBlogBuildCalendarString(blog,day,today,id,fontf,c_bkc,c_tc) 9284{ 9285 var scell ="style=\""+fontf+c_bkc+c_tc+"font-size:10px;text-align:center;width:25px;height:22px;\""; 9286 var stoday="style=\""+fontf+c_bkc+c_tc+"font-size:10px;text-align:center;height:22px;border: 1px solid #000000;\""; 9287 var slinkcell="style=\""+fontf+c_bkc+c_tc+"font-size:10px;text-align:center;font-weight:bold;text-decoration:underline;\""; 9288 var slinkcelltoday="style=\""+fontf+c_bkc+c_tc+"font-size:10px;text-align:center;font-weight:bold;text-decoration:underline;border: 1px solid #000000;\""; 9289 9290 var string; 9291 if(blog && blog.IsHavingPost(day)) { 9292 if(day==today) string="<td "+scell+"><a "+slinkcelltoday+" href='javascript:LMBlogCalendarSetDate(\"" + id + "\"," + day + ");'>"+day+"</a></td>"; 9293 else string="<td "+scell+"><a "+slinkcell+" href='javascript:LMBlogCalendarSetDate(\"" + id + "\"," + day + ");'>"+day+"</a></td>"; 9294 } 9295 else { 9296 if(day==today) string="<td "+stoday+">"+day+"</td>"; 9297 else string="<td "+scell+">"+day+"</td>"; 9298 } 9299 return string; 9300} 9301 9302function LMBlogCalendarDisplay(blog) 9303{ 9304var today=0; 9305var ddate; 9306 9307 if(blog==null) { 9308 ddate=new Date(); 9309 } 9310 else { 9311 ddate=new Date(); 9312 ddate.setDate(1); 9313 ddate.setYear(blog.year); 9314 ddate.setMonth(blog.month); 9315 } 9316 9317 var datetoday = new Date(); 9318 if(datetoday.getYear()==ddate.getYear() && datetoday.getMonth()==ddate.getMonth()) today=datetoday.getDate(); 9319 9320 var datefirst = ddate; 9321 var year = takeYear(datefirst);
9322 var month = leadingZero(datefirst.getMonth()+1); 9323 datefirst.setDate(1); 9324 var daymod = datefirst.getDay(); 9325 9326 var timeA = new Date(year, month, 1); 9327 timeDifference = timeA - 86400000; 9328 var timeB = new Date(timeDifference); 9329 var daysInMonth = timeB.getDate(); 9330 9331 var fontf="font-family: verdana, arial, helvetica;"; 9332 var hf_bkc=""; 9333 var c_bkc=""; 9334 if(this.hf_bkc!="") hf_bkc="background-color:"+this.hf_bkc+";"; 9335 if(this.c_bkc!="") c_bkc="background-color:"+this.c_bkc+";"; 9336 var hf_tc="color:"+this.hf_tc+";"; 9337 var c_tc="color:"+this.c_tc+";"; 9338 var border="border:solid 0px #000000;"; 9339 9340 var stable="style=\"height:170px;font-size:11px;"+border+"width:100%;\""; 9341 var sheader="style=\""+hf_bkc+";"+border+"border-bottom:0;padding:2;\""; 9342 var sheaderday="style=\""+c_bkc+c_tc+"font-size:10px;"+fontf+"\""; 9343 var sfooter="style=\""+hf_bkc+"font-weight:bold;font-size:12px;padding:2;\""; 9344 var stdfooter="style=\"padding:2;border-top:solid 0px #000000;\""; 9345 var slinkheader="style=\""+fontf+hf_tc+"text-decoration:none;text-transform:uppercase;font-weight:bold;font-size:10px;"+"\""; 9346 var slinkfooter="style=\""+fontf+hf_tc+"font-weight:bold;font-size:9px;text-decoration:none;\""; 9347 9348 var string=""; 9349 string+="<table "+stable+" cellspacing=0>"+ 9350 "<caption "+sheader+"><a "+slinkheader+" href='javascript:LMBlogCalendarCurrentYearMonth(\"" + this.id + "\");' title="+RES_CAL_HEADER+">" + FormatMonth(ddate) + " " + year + "</a></caption>"+ 9351 "<thead><tr>"+ 9352 "<th "+sheaderday+">"+RES_DAYS[0]+"</th>"+ 9353 "<th "+sheaderday+">"+RES_DAYS[1]+"</th>"+ 9354 "<th "+sheaderday+">"+RES_DAYS[2]+"</th>"+ 9355 "<th "+sheaderday+">"+RES_DAYS[3]+"</th>"+ 9356 "<th "+sheaderday+">"+RES_DAYS[4]+"</th>"+ 9357 "<th "+sheaderday+">"+RES_DAYS[5]+"</th>"+ 9358 "<th "+sheaderday+">"+RES_DAYS[6]+"</th>"+ 9359 "</tr></thead>"+ 9360 "<tfoot "+sfooter+">"+ 9361 "<tr>"+ 9362 "<td colspan=3 "+stdfooter+"><a "+slinkfooter+" href='javascript:LMBlogCalendarPrevYear(\"" + this.id + "\");' title="+RES_CAL_PREY+"><<</a> <a "+slinkfooter+" href='javascript:LMBlogCalendarPrevMonth(\"" + this.id + "\");' title="+RES_CAL_PREM+"><</a></td>"+ 9363 "<td "+stdfooter+"> </td>"+ 9364 "<td colspan=3 align=right "+stdfooter+"><a "+slinkfooter+" href='javascript:LMBlogCalendarNextMonth(\"" + this.id + "\");' title="+RES_CAL_NEXTM+">></a> <a "+slinkfooter+" href='javascript:LMBlogCalendarNextYear(\"" + this.id + "\");' title="+RES_CAL_NEXTY+">>></a></td>"+ 9365 "</tr>"+ 9366 "</tfoot>"; 9367 9368 string+="<tr>"; 9369 day=1; 9370 for(var col=0; col<daymod; col++) string+="<td style=\""+c_bkc+"\"> </td>"; 9371 for(; col<7; col++) { 9372 string+=LMBlogBuildCalendarString(blog,day,today,this.id,fontf,c_bkc,c_tc); 9373 day++; 9374 } 9375 string+="</tr>"; 9376 9377 var scell ="style=\""+fontf+c_bkc+c_tc+"font-size:10px;text-align:center;width:25px;height:22px;\""; 9378 for(var row=1; row<6; row++) { 9379 string+="<tr>"; 9380 if(day>daysInMonth) break; 9381 for(var col=0; col<7; col++) { 9382 if(day<=daysInMonth) { 9383 string+=LMBlogBuildCalendarString(blog,day,today,this.id,fontf,c_bkc,c_tc); 9384 day++; 9385 } 9386 else { 9387 string+="<td "+scell+"> </td>"; 9388 } 9389 } 9390 string+="</tr>"; 9391 } 9392 9393 string+="</table>"; 9394 9395 var tag=document.getElementById(this.id+"Inner"); 9396 tag.innerHTML=string; 9397} 9398 9399function LMBlogCalendarSetDate(id,date) 9400{ 9401 var object=FindClassObjectFromId(id); 9402 if(!object) return; 9403 if(!object.Blog) return; 9404 9405 object.Blog.date=date; 9406 9407 object.Blog.LoadRSS(); 9408 object.Blog.Refresh(); 9409} 9410 9411function LMBlogCalendarPrevMonth(id) 9412{ 9413 var object=FindClassObjectFromId(id); 9414 if(!object) return; 9415 if(!object.Blog) return; 9416 9417 object.Blog.month--; 9418 if(object.Blog.month<0) { 9419 object.Blog.year--; 9420 object.Blog.month=11; 9421 } 9422 9423 object.Blog.LoadRSS(); 9424 object.Blog.Refresh(); 9425} 9426 9427function LMBlogCalendarNextMonth(id) 9428{ 9429 var object=FindClassObjectFromId(id); 9430 if(!object) return; 9431 if(!object.Blog) return; 9432 9433 object.Blog.month++; 9434 if(object.Blog.month>11) { 9435 object.Blog.year++; 9436 object.Blog.month=0; 9437 } 9438 9439 object.Blog.LoadRSS(); 9440 object.Blog.Refresh();
9441} 9442 9443function LMBlogCalendarPrevYear(id) 9444{ 9445 var object=FindClassObjectFromId(id); 9446 if(!object) return; 9447 if(!object.Blog) return; 9448 9449 object.Blog.year--; 9450 object.Blog.LoadRSS(); 9451 object.Blog.Refresh(); 9452} 9453 9454function LMBlogCalendarNextYear(id) 9455{ 9456 var object=FindClassObjectFromId(id); 9457 if(!object) return; 9458 if(!object.Blog) return; 9459 9460 object.Blog.year++; 9461 object.Blog.LoadRSS(); 9462 object.Blog.Refresh(); 9463} 9464 9465function LMBlogCalendarCurrentYearMonth(id) 9466{ 9467 var object=FindClassObjectFromId(id); 9468 if(!object) return; 9469 if(!object.Blog) return; 9470 9471 object.Blog.date=0; 9472 object.Blog.Refresh(); 9473} 9474 9475function LMObjWeb(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,branch,tooltip,param, _, content) 9476{ 9477 var BranchLst = null; 9478 if (branch) { 9479 BranchLst = new Array(branch); 9480 } 9481 9482 var LMObjWeb = new LMObject(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,BranchLst,tooltip,param,true); 9483 9484 var tagdiv=FindTagFromId(id); 9485 tagdiv.drawok=1; 9486 9487 LoadLMObjWeb(id, content); 9488 9489 return LMObjWeb; 9490} 9491 9492function LoadLMObjWeb(id, content) { 9493 setTimeout(() => { 9494 if (content && CookieAcceptation.isAccepted("ALL")) { 9495 $(atob(content)).appendTo(document.getElementById(id)); 9496 } 9497 }, 100); 9498} 9499 9500function LMFlashSnd(id,initvisible,displayenable,delais,delaisdisp,branch,param,filename,loop,loop_count) 9501{ 9502 var BranchLst = null; 9503 9504 if (branch) { 9505 BranchLst = new Array(branch); 9506 } 9507 9508 if(delaisdisp>0 && delais==0) delais=1; 9509 var LMFlashSound = new LMObject(id,initvisible,displayenable,delais,null,delaisdisp,null,BranchLst,null,param,true); 9510 9511 LMFlashSound.InitObject=LMFlashSoundInit; 9512 LMFlashSound.ShowObject=LMFlashSoundShow; 9513 LMFlashSound.HideObject=LMFlashSoundHide; 9514 LMFlashSound.Play=LMFlashSoundPlay; 9515 LMFlashSound.Stop=LMFlashSoundStop; 9516 LMFlashSound.TogglePlayState=LMFlashSoundTogglePlayState; 9517 LMFlashSound.RollIn=LMFlashSoundRollIn; 9518 LMFlashSound.RollOut=LMFlashSoundRollOut; 9519 9520 LMFlashSound.loop=loop; 9521 LMFlashSound.loop_count=loop_count; 9522 LMFlashSound.loop_curcount=0; 9523 LMFlashSound.Filename=filename; 9524 9525 LMFlashSound.TagObject.Play=TagPlay; 9526 LMFlashSound.TagObject.Stop=TagStop; 9527 LMFlashSound.TagObject.TogglePlayState=TagTogglePlayState; 9528 LMFlashSound.TagObject.RollIn=TagRollIn; 9529 LMFlashSound.TagObject.RollOut=TagRollOut; 9530 9531 var tagdiv=FindTagFromId(id); 9532 tagdiv.drawok=1; 9533 if(is.ie) tagdiv.style.visibility="hidden"; 9534 else { 9535 tagdiv.style.visibility="inherit"; 9536 } 9537 9538 9539 return LMFlashSound; 9540}; 9541 9542function LMFlashSoundInit() 9543{ 9544 var obj=FindTagFromId(this.id); 9545 if(obj==null) { return; } 9546 9547 if(obj.init==true) return; 9548 obj.init=true; 9549 9550 obj.objectid=this.id; 9551 this.object=obj; 9552 9553 var LMFlashSound=FindClassObjectFromId(this.id); 9554 if(LMFlashSound.visible) { 9555 LMFlashSound.Play(); 9556 } 9557}; 9558 9559function playerReady(obj) { 9560 LMFlashSndAddListeners(obj['id']); 9561}; 9562 9563function LMFlashSndAddListeners(playerid) { 9564 var player= document.getElementById(playerid); 9565 var playlist = player.getPlaylist(); 9566 if((playlist !== null) && (playlist !== undefined)) { 9567 player.addModelListener("STATE","LMFlashSoundPlayerStateChanged"); 9568 } 9569 else { 9570 setTimeout("LMFlashSndAddListeners("+playerid+");", 100); 9571 } 9572}; 9573 9574function LMFlashSoundPlayerStateChanged(evt) { 9575 if (evt.newstate != 'COMPLETED') return; 9576 9577 var lmid= evt['id'].substring(7); 9578 FireEvent(lmid, "_WhenSoundTerminate"); 9579 9580 var LMFlashSound=FindClassObjectFromId(lmid); 9581 if (!LMFlashSound) return; 9582 9583 var player= document.getElementById(evt['id']); 9584 if (!player) return; 9585 9586 LMFlashSound.loop_curcount++; 9587 9588 if (LMFlashSound.BranchLst && LMFlashSound.BranchLst.length && LMFlashSound.BranchLst[0]) { 9589 if (!LMFlashSound.loop || (LMFlashSound.loop && LMFlashSound.loop_curcount == LMFlashSound.loop_count)) { 9590 LMObjectClick(lmid,0); 9591 return; 9592 } 9593 } 9594 9595 if (LMFlashSound.loop) { 9596 try { 9597 player.sendEvent("PLAY","true"); 9598 }catch(e){} 9599 } 9600}; 9601 9602function LMFlashSoundShow() 9603{ 9604 if(!this.object) return; 9605 this.Play(); 9606}; 9607 9608function LMFlashSoundHide() 9609{ 9610 if(!this.object) return; 9611 this.Stop(); 9612}; 9613 9614function LMFlashSoundPlay() 9615{ 9616 var player= document.getElementById("LMSound" + this.id); 9617 try { 9618 player.sendEvent("PLAY", "true"); 9619 } 9620 catch(e) { 9621 alert(RES_NOTWORKING_IN_LOCAL); 9622 } 9623}; 9624 9625function LMFlashSoundStop() 9626{ 9627 var player= document.getElementById("LMSound" + this.id); 9628 try { 9629 player.sendEvent("STOP"); 9630 }catch(e){} 9631}; 9632 9633function LMFlashSoundTogglePlayState() 9634{ 9635 if(!this.object) return; 9636 var player= document.getElementById("LMSound" + this.id); 9637 if (player.getConfig().state != "PLAYING") { 9638 try { 9639 player.sendEvent("PLAY", "true"); 9640 }catch(e){} 9641 } 9642 else { 9643 try { 9644 player.sendEvent("STOP"); 9645 }catch(e){} 9646 } 9647}; 9648 9649function LMFlashSoundRollIn() 9650{ 9651 LMFlashSound=FindClassObjectFromId(this.id); 9652 if(!LMFlashSound) return; 9653 LMFlashSound.TagObject.Play(); 9654}; 9655 9656function LMFlashSoundRollOut() 9657{ 9658 LMFlashSound=FindClassObjectFromId(this.id); 9659 if(!LMFlashSound) return; 9660 LMFlashSound.TagObject.Stop(); 9661}; 9662 9663function LMGoogleMap(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,branch,tooltip,param,cursor) 9664{ 9665 LoadGoogleMaps(id); 9666 9667 var BranchLst = null; 9668 if (branch) { 9669 BranchLst = new Array(branch); 9670 } 9671 9672 var LMGoogleMap = new LMObject(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,BranchLst,tooltip,param,true); 9673 9674 var tagdiv=FindTagFromId(id); 9675 tagdiv.drawok=1; 9676 9677 var BranchLst = null; 9678 if (branch) { 9679 BranchLst = new Array(branch); 9680 } 9681 return LMGoogleMap; 9682} 9683function LoadGoogleMaps(id) { 9684 setTimeout(() => {
9685 if (CookieAcceptation.isAccepted("GOOGLE-MAPS")) { 9686 const iFrame = $("#"+id+" > iframe"); 9687 9688 iFrame.attr("src", iFrame.data("src")); 9689 } 9690 }, 100); 9691} 9692function InitGoogleMap(divid, places, options) 9693{ 9694 places = places == undefined ? [] : places; 9695 var center = options.hasOwnProperty('center') && options.center != undefined ? options.center : []; 9696 var zoom = options.hasOwnProperty('zoom') && options.zoom != undefined ? options.zoom : null; 9697 var enableStreetViewControl = options.hasOwnProperty('enableStreetViewControl') && options.enableStreetViewControl != undefined ? options.enableStreetViewControl : false; 9698 var enableMapTypeControl = options.hasOwnProperty('enableMapTypeControl') && options.enableMapTypeControl != undefined ? options.enableMapTypeControl : false; 9699 var options = { 9700 locations: places, 9701 map_div: "#"+divid, 9702 generate_controls: false, 9703 show_markers: places.length == 1, 9704 draggable: false, 9705 map_options: { 9706 streetViewControl: enableStreetViewControl, 9707 mapTypeControl: enableMapTypeControl, 9708 zoomControl: true, 9709 zoomControlOptions: { 9710 style: google.maps.ZoomControlStyle.SMALL }, 9711 mapTypeId : google.maps.MapTypeId.ROADMAP 9712 } 9713 }; 9714 if(zoom != null) 9715 options.map_options.zoom = zoom; 9716 if(center.length == 2) 9717 options.map_options.set_center = center; 9718 if(places.length > 1){ 9719 options['type'] = 'directions'; 9720 } 9721 return new Maplace(options).Load(); 9722} 9723 9724function ReGenerateGoogleMap(divid, locations, options) 9725{ 9726 $("#"+divid+" .canvas_map").remove(); 9727 InitGoogleMap(divid, locations, options); 9728} 9729var delay = (function(){ 9730 var timer = 0; 9731 return function(callback, ms){ 9732 clearTimeout (timer); 9733 timer = setTimeout(callback, ms); 9734 }; 9735})(); 9736 9737function BindAddressControl(divid) 9738{ 9739 $("#"+ divid + " > .gmap-address-control input.address").keypress(function(e){ 9740 var address = $(this).val(); 9741 var that = this; 9742 if(e.keyCode == 13){ 9743 var geocoder = new google.maps.Geocoder(); 9744 geocoder.geocode( { 'address': address}, function(results, status) { 9745 if (status == google.maps.GeocoderStatus.OK) { 9746 $(that).attr('data-latitude',results[0].geometry.location.lat()); 9747 $(that).attr('data-longitude',results[0].geometry.location.lng()); 9748 9749 var locations = []; 9750 var inputs = $("#"+ divid +" > .gmap-address-control input.address"); 9751 for(var i=0; i < inputs.length; i++) 9752 { 9753 if( $(inputs[i]).val() != ""){ 9754 locations.push({title: $(inputs[i]).val(), lat: $(inputs[i]).attr("data-latitude"), lon: $(inputs[i]).attr("data-longitude")}) 9755 } 9756 } 9757 ReGenerateGoogleMap(divid, locations, {}); 9758 } else { 9759 console.log("Geocode was not successful for the following reason: " + status); 9760 } 9761 }); 9762 } 9763 }); 9764 9765 $("#"+ divid + " > .gmap-address-control input.address").bind('focus',function(e){ 9766 $(this).parents('.gmap-address-control').addClass('focused'); 9767 }); 9768 $("#"+ divid + " > .gmap-address-control input.address").bind('blur',function(e){ 9769 $(this).parents('.gmap-address-control').removeClass('focused'); 9770 }); 9771 9772 $("#"+ divid + " > .gmap-address-control .my-coordonate").click(function(e){ 9773 if (navigator.geolocation) { 9774 var myPositionLabel = $(this).attr('placeholder'); 9775 navigator.geolocation.getCurrentPosition(function(position){ 9776 //console.log(position); 9777 var $input = $("#"+ divid + " > .gmap-address-control input.address:first"); 9778 $input.attr('data-latitude',position.coords.latitude); 9779 $input.attr('data-longitude',position.coords.longitude); 9780 $input.val(myPositionLabel); 9781 var locations = []; 9782 var inputs = $("#"+ divid +" > .gmap-address-control input.address"); 9783 for(var i=0; i < inputs.length; i++) 9784 { 9785 if( $(inputs[i]).val() != "" || ($(inputs[i]).attr("data-latitude") != "" && $(inputs[i]).attr("data-longitude") != "")){ 9786 locations.push({title: $(inputs[i]).val(), lat: $(inputs[i]).attr("data-latitude"), lon: $(inputs[i]).attr("data-longitude")}) 9787 } 9788 } 9789 ReGenerateGoogleMap(divid, locations, {}); 9790 }, function(err){ 9791 alert(err.message); 9792 }); 9793 } else { 9794 alert("Geolocation is not supported by this browser."); 9795 } 9796 }); 9797 } 9798 9799function LMGoogleTranslate(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,branch,tooltip,param,cursor) 9800{ 9801 setTimeout(() => {
9802 if (CookieAcceptation.isAccepted("GOOGLE-TRANSLATE")) { 9803 const script = document.createElement("script"); 9804 script.type = "text/javascript"; 9805 script.src = 'https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit'; 9806 var head = document.getElementsByTagName("head")[0]; 9807 head.appendChild(script); 9808 } 9809 }, 100); 9810 9811 var LMGoogleTranslate = new LMObject(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,null,tooltip,param,true); 9812 9813 var tagdiv=FindTagFromId(id); 9814 tagdiv.drawok=1; 9815 9816 return LMGoogleTranslate; 9817} 9818function LMDiv(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,branch,tooltip,param,cursor) 9819{ 9820 var BranchLst = null; 9821 if (branch) { 9822 BranchLst = new Array(branch); 9823 } 9824 9825 var LMDiv = new LMObject(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,BranchLst,tooltip,param,true); 9826 9827 var tagchilds=document.getElementById(id+"Childs"); 9828 if(tagchilds) { 9829 tagchilds.onmouseover=TagLMImageMouseOver; 9830 tagchilds.onmouseout=TagLMImageMouseOut; 9831 tagchilds.onmouseup=LMGlobalUp; 9832 tagchilds.onmousedown=LMGlobalDn; 9833 tagchilds.objectid=id; 9834 } 9835 9836 var tagdiv=document.getElementById(id); 9837 9838 if(tooltip) tagdiv.alt=tooltip; 9839 9840 tagdiv.SetWidth=TagSetWidth; 9841 tagdiv.SetHeight=TagSetHeight; 9842 tagdiv.onmouseover=TagLMDivMouseOver; 9843 tagdiv.onmouseout=TagLMDivMouseOut; 9844 tagdiv.onload=new Function("TagLMDivLoad(document.getElementById('"+tagdiv.id+"'));"); 9845 tagdiv.onmouseup=LMGlobalUp; 9846 tagdiv.onmousedown=LMGlobalDn; 9847 9848 LMDiv.MouseOver=LMDivMouseOver; 9849 LMDiv.MouseOut=LMDivMouseOut; 9850 LMDiv.MouseUp=LMDivMouseUp; 9851 LMDiv.InitObject=LMDivInit; 9852 LMDiv.init=false; 9853 9854 LMDiv.cursor=cursor; 9855 LMDiv.TagImg=tagdiv; 9856 tagdiv.objectid=id; 9857 tagdiv.onerror=TagLMDivError; 9858 tagdiv.drawok=1; 9859 9860 return LMDiv; 9861} 9862 9863function TagLMDivLoad(TagImg) 9864{ 9865 var LMObject=FindClassObjectFromId(TagImg.objectid); 9866 if(!LMObject) return; 9867 if(LMObject.init==false) return; 9868 9869 if(TagImg.complete==false) { 9870 setTimeout("TagLMDivLoad(FindTagFromId(\"" + TagImg.objectid + "\"))",100.); 9871 return; 9872 } 9873 9874 var tagdiv=FindTagFromId(TagImg.objectid); 9875 alert(tagdiv.drawok); 9876 tagdiv.drawok=1; 9877} 9878 9879function TagLMDivError() 9880{ 9881 var LMObject=FindClassObjectFromId(this.objectid); 9882 if(!LMObject) return; 9883 9884 var tagdiv=FindTagFromId(this.objectid); 9885 if(LMObject.init==true) { 9886 //alert("Image on error"); 9887 tagdiv.drawok=1; 9888 } 9889} 9890 9891function LMDivInit() 9892{ 9893 if(this.init==true) return; 9894 this.init=true; 9895} 9896 9897function TagLMDivMouseOver(e) 9898{ 9899 if(e==null) var e=window.event; 9900 e.cancelBubble = true; 9901 9902 LMGlobalOver(this.id); 9903} 9904 9905function TagLMDivMouseOut(e) 9906{ 9907 if(e==null) var e=window.event; 9908 e.cancelBubble = true; 9909 9910 LMGlobalOver(-1); 9911} 9912 9913function LMDivMouseUp() 9914{ 9915 LMObjectClick(this.id,0); 9916} 9917 9918function LMDivMouseOver() 9919{ 9920 if(this.cursor) this.TagImg.style.cursor = "pointer"; 9921 if(this.BranchLst) GadgetShowLink(this.BranchLst[0]); 9922} 9923 9924function LMDivMouseOut() 9925{ 9926 if(this.BranchLst) window.status=""; 9927} 9928 9929function LMVideoSound(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,branch,tooltip,param1,cursor,autostart,techno,param2) 9930{ 9931 var BranchLst = null; 9932 9933 if (branch) { 9934 BranchLst = new Array(branch); 9935 } 9936 9937 if(delaisdisp>0 && delais==0) delais=1; 9938 var LMVideoSound = new LMObject(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,BranchLst,null,param1,true); 9939 9940 LMVideoSound.InitObject=LMVideoSoundInit; 9941 LMVideoSound.ShowObject=LMVideoSoundShow; 9942 LMVideoSound.HideObject=LMVideoSoundHide; 9943 LMVideoSound.Play=LMVideoSoundPlay; 9944 LMVideoSound.Stop=LMVideoSoundStop; 9945 LMVideoSound.TogglePlayState=LMVideoSoundTogglePlayState; 9946 LMVideoSound.RollIn=LMVideoSoundRollIn; 9947 LMVideoSound.RollOut=LMVideoSoundRollOut; 9948 9949 LMVideoSound.autostart=autostart; 9950 LMVideoSound.playing=autostart; 9951 LMVideoSound.techno=techno; 9952 9953 LMVideoSound.TagObject.Play=TagPlay; 9954 LMVideoSound.TagObject.Stop=TagStop; 9955 LMVideoSound.TagObject.TogglePlayState=TagTogglePlayState; 9956 LMVideoSound.TagObject.RollIn=TagRollIn; 9957 LMVideoSound.TagObject.RollOut=TagRollOut; 9958 9959 var tagdiv=FindTagFromId(id); 9960 tagdiv.drawok=1; 9961 9962 return LMVideoSound; 9963} 9964 9965function LMVideoSoundInit() 9966{ 9967 var player=FindTagFromId(this.id+"Inner"); 9968 if(player==null) { return; } 9969 9970 if(player.init==true) return; 9971 player.init=true; 9972 9973 player.objectid=this.id; 9974 this.object=player; 9975} 9976 9977function LMVideoSoundShow() 9978{ 9979 if(!this.object) return;
9980 if(IsRunningLocally()==false) if(this.autostart) this.Play(); 9981} 9982 9983function LMVideoSoundHide() 9984{ 9985 if(!this.object) return; 9986 this.Stop(); 9987} 9988 9989function IsRunningLocally() 9990{ 9991 switch(window.location.protocol) { 9992 case 'http:': 9993 case 'https:': 9994 return false; 9995 break; 9996 case 'file:': 9997 return true; 9998 break; 9999 default: 10000 return false; 10001 } 10002} 10003 10004function LMVideoSoundPlay() 10005{ 10006 if(!this.object) return; 10007 10008 switch(this.techno) { 10009 case "WMP": 10010 this.object.controls.play(); 10011 break; 10012 case "QT": 10013 this.object.Play(); 10014 break; 10015 case "VideoFlash": 10016 this.object.sendEvent('PLAY','true'); 10017 break; 10018 case "HTML5Video": 10019 this.object.play(); 10020 break; 10021 } 10022 this.playing=true; 10023} 10024 10025function LMVideoSoundPause() 10026{ 10027 if(!this.object) return; 10028 10029 switch(this.techno) { 10030 case "WMP": 10031 this.object.controls.pause(); 10032 break; 10033 case "QT": 10034 this.object.Stop(); 10035 break; 10036 case "VideoFlash": 10037 this.object.sendEvent('PLAY','false'); 10038 break; 10039 case "HTML5Video": 10040 this.object.pause(); 10041 break; 10042 } 10043 this.playing=false; 10044} 10045 10046function LMVideoSoundStop() 10047{ 10048 if(!this.object) return; 10049 10050 switch(this.techno) { 10051 case "WMP": 10052 this.object.controls.stop(); 10053 break; 10054 case "QT": 10055 this.object.Stop(); 10056 this.object.Rewind(); 10057 break; 10058 case "VideoFlash": 10059 this.object.sendEvent('STOP'); 10060 break; 10061 case "HTML5Video": 10062 this.object.pause(); 10063 this.object.currentTime= 0; 10064 break; 10065 } 10066 this.playing=false; 10067} 10068 10069function LMVideoSoundTogglePlayState() 10070{ 10071 if(!this.object) return; 10072 if(this.playing==true) this.Stop(); 10073 else this.Play(); 10074} 10075 10076function LMVideoSoundRollIn() 10077{ 10078 LMVideoSound=FindClassObjectFromId(this.id); 10079 if(!LMVideoSound) return; 10080 LMVideoSound.TagObject.Show(); 10081} 10082 10083function LMVideoSoundRollOut() 10084{ 10085 LMVideoSound=FindClassObjectFromId(this.id); 10086 if(!LMVideoSound) return; 10087 LMVideoSound.TagObject.Hide(); 10088} 10089 10090function LMTabCtl(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,branch,tooltip,param,cursor,nbtabs,initialtab) 10091{ 10092 var BranchLst = null; 10093 if (branch) { 10094 BranchLst = new Array(branch); 10095 } 10096 10097 var LMTabCtl = new LMObject(id,initvisible,displayenable,delais,effect,delaisdisp,effectdisp,BranchLst,tooltip,param,true); 10098 10099 var tagdiv=document.getElementById(id); 10100 10101 if(tooltip) tagdiv.text=tooltip; 10102 10103 tagdiv.SetWidth=TagSetWidth; 10104 tagdiv.SetHeight=TagSetHeight; 10105 tagdiv.onmouseover=TagLMTabCtlMouseOver; 10106 tagdiv.onmouseout=TagLMTabCtlMouseOut; 10107 tagdiv.onmouseup=LMGlobalUp; 10108 tagdiv.onmousedown=LMGlobalDn; 10109 tagdiv.SetSelectedTab=LMTabCtl_SetSelectedTab; 10110 10111 LMTabCtl.nbtabs= nbtabs; 10112 10113 10114 var i; 10115 for (i=1; i<=nbtabs; i++) 10116 { 10117 var tabid= id + "_tab" + i; 10118 var divtab= document.getElementById(tabid); 10119 10120 divtab.isactive= false; 10121 divtab.onclick= LMTabCtl_tabClick; 10122 divtab.onmouseover=tabMouseOver; 10123 divtab.onmouseout=tabMouseOut; 10124 divtab.tabctl= LMTabCtl; 10125 divtab.idx= i; 10126 } 10127 10128 LMTabCtl.MouseUp=LMTabCtlMouseUp; 10129 LMTabCtl.MouseDn=LMTabCtlMouseDn; 10130 LMTabCtl.MouseOver=LMTabCtlMouseOver; 10131 LMTabCtl.MouseOut=LMTabCtlMouseOut; 10132 LMTabCtl.InitObject=LMTabCtlInit; 10133 LMTabCtl.init=false; 10134 LMTabCtl.SetSelectedTab=LMTabCtl_SetSelectedTab; 10135 10136 LMTabCtl.cursor=cursor; 10137 10138 LMTabCtl.TagDiv=tagdiv; 10139 10140 LMTabCtl.SetSelectedTab(initialtab); 10141 10142 var divtab= document.getElementById(id + "_tab" + initialtab); 10143 var atab= divtab.parentNode; 10144 10145 return LMTabCtl; 10146} 10147 10148function LMTabCtl_tabClick() 10149{ 10150 this.tabctl.SetSelectedTab(this.idx); 10151} 10152 10153function tabMouseOver(e) 10154{ 10155 if (this.isactive) return; 10156 10157 if(e==null) var e=window.event; 10158 e.cancelBubble = true; 10159 10160 this.className= this.id + "_active"; 10161} 10162 10163function tabMouseOut(e) 10164{ 10165 if (this.isactive) return; 10166 10167 if(e==null) var e=window.event; 10168 e.cancelBubble = true; 10169 10170 this.className= this.id + "_inactive"; 10171} 10172 10173function LMTabCtl_SetSelectedTab(idx) 10174{ 10175 var i; 10176 for (i=1; i<=this.nbtabs; i++) 10177 { 10178 var tabid= this.id + "_tab" + i; 10179 var divtab= document.getElementById(tabid); 10180 var canvas = document.getElementById(divtab.getAttribute('canvas')); 10181 10182 if (idx == i) { 10183 canvas.style.display = "block"; 10184 divtab.isactive= true; 10185 divtab.className= divtab.id + "_active"; 10186 } 10187 else { 10188 canvas.style.display = "none"; 10189 divtab.isactive= false; 10190 divtab.className= divtab.id + "_inactive"; 10191 } 10192 } 10193} 10194 10195function LMTabCtlInit() 10196{ 10197 if(this.init==true) return; 10198 this.init=true; 10199 10200 tagdiv=document.getElementById(this.id); 10201 tagdiv.drawok=1; 10202} 10203 10204function TagLMTabCtlMouseOver(e) 10205{ 10206 if(e==null) var e=window.event; 10207 e.cancelBubble = true; 10208
10209 LMGlobalOver(this.id); 10210} 10211 10212function TagLMTabCtlMouseOut(e) 10213{ 10214 if(e==null) var e=window.event; 10215 e.cancelBubble = true; 10216 10217 LMGlobalOver(-1); 10218} 10219 10220function LMTabCtlMouseUp() 10221{ 10222 FireEvent(this.id,"_WhenButtonUp"); 10223 LMObjectClick(this.id,0); 10224} 10225 10226function LMTabCtlMouseDn() 10227{ 10228 FireEvent(this.id,"_WhenButtonDown"); 10229} 10230 10231function LMTabCtlMouseOver() 10232{ 10233} 10234 10235function LMTabCtlMouseOut() 10236{ 10237}function SetBaseColor(r,g,b){}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.