/usr/share/doc/webmagick/icons/webmagick.js is in webmagick 2.02-11.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 | //
// $Id: webmagick.js,v 1.39 2001/11/24 21:29:03 ache Exp $
//
// JavaScript routines to display a set of images
// Part of the WebMagick package
// Copyright 1997, 1998, Bob Friesenhahn
//
// Start with first page (zero based)
var pageNumber = 0;
// Start with first image on page
var pageImageIndex = 0;
//
// Window size hints
var browserWindowWidth = 800;
var browserWindowHeight = 500;
// Netscape 4.X
if( parent.innerWidth && parent.innerHeight) {
browserWindowWidth = parent.innerWidth;
browserWindowHeight = parent.innerHeight;
}
//alert('Width: ' + browserWindowWidth + ' Height: ' + browserWindowHeight);
///////////////////////////////////////////////////
//
// Routines and variables for the master frame definition
//
///////////////////////////////////////////////////
// Define window names based on frame style option
var frameTargets = new Object();
var origFramestyle = htmlOpts["framestyle"];
var origColumns = htmlOpts["columns"];
var origRows = htmlOpts["rows"];
var today = new Date();
var expires_date = new Date(today.getYear() + 1,today.getMonth(),today.getDate(),0,0,0);
// for testing
//Set_Cookie('framestyle', '2', expires_date);
//Set_Cookie('columns', '2', expires_date);
//Set_Cookie('rows', '3', expires_date);
// Should check to see if all of these are needed
if (htmlOpts["config"] && htmlOpts["config"] != 0 && htmlOpts["tables"]) {
if (Get_Cookie('framestyle') != null) {
htmlOpts["framestyle"] = Get_Cookie('framestyle');
if (htmlOpts["framestyle"] != origFramestyle) {
// reset the cookie to increase the expiration
// should do something about the path, but I'm not sure what - one of our current options?
Set_Cookie('frameStyle', htmlOpts["framestyle"], expires_date);
}
}
if (Get_Cookie('rows') != null) {
htmlOpts["rows"] = Get_Cookie('rows');
if (htmlOpts["rows"] != origRows) {
Set_Cookie('rows', htmlOpts["rows"], expires_date);
}
}
if (Get_Cookie('columns') != null) {
htmlOpts["columns"] = Get_Cookie('columns');
if (htmlOpts["columns"] != origColumns) {
Set_Cookie('columns', htmlOpts["columns"], expires_date);
}
}
if ((htmlOpts["rows"] != origRows) || (htmlOpts["columns"] != origColumns)) {
var totalCount = 0;
for (i = 0; i < imageNames.length; i++) {
for (j = 0; j < imageNames[i].length; j++) {
totalCount++;
}
}
var perPage = htmlOpts["rows"] * htmlOpts["columns"];
var remainder = totalCount % perPage;
htmlOpts["numpages"] = Math.floor(totalCount / perPage);
if (remainder != 0) {
htmlOpts["numpages"]++;
}
imLabels = fixDoubleArray(imLabels, remainder);
thumbwidths = fixDoubleArray(thumbwidths, remainder);
thumbheights = fixDoubleArray(thumbheights, remainder);
imageNames = fixDoubleArray(imageNames, remainder);
// why does this run twice????
//alert ('imageNames ' + imageNames[0]);
}
}
// config only works with tables
if (htmlOpts["config"] && !htmlOpts["tables"]) {
htmlOpts["config"] = 0;
}
// Set number of display windows based on framestyle option
var numWindows = 3; // default for framestyle 1
if( htmlOpts["framestyle"] == 2 ||
htmlOpts["framestyle"] == 3 ||
htmlOpts["framestyle"] == 4) {
numWindows = 4;
}
// Set window names based on number of display windows
if( numWindows == 3 ) {
// One window plays triple duty when there are only two frames
frameTargets["dirview"] = 'dirview';
frameTargets["imageview"] = 'imageview';
frameTargets["navview"] = 'navview';
frameTargets["readmeview"] = 'imageview';
frameTargets["thumbview"] = 'imageview';
}
else if( numWindows == 4 ) {
// When there are four frames, only the README shares a window
frameTargets["dirview"] = 'dirview';
frameTargets["imageview"] = 'imageview';
frameTargets["navview"] = 'navview';
frameTargets["readmeview"] = 'imageview';
frameTargets["thumbview"] = 'thumbview';
}
function emptyHTML()
{
return '<HTML><HEAD></HEAD><BODY></BODY></HTML>';
}
function drawWindows()
{
var style = htmlOpts["framestyle"];
// Is README actually displayed?
if( ( htmlOpts["readmepresent"] == 1 && htmlOpts["numpages"] == 0 )
|| htmlOpts["readmevisible"] == 1 ) {
var showReadme = 1;
} else {
var showReadme = 0;
}
if( style == 1 ) {
displayResult(frameTargets["dirview"], returnDirectoryHTML());
displayResult(frameTargets["navview"], returnNavHTML(0));
if (showReadme != 1) {
displayResult(frameTargets["imageview"], returnThumbNailsHTML());
}
} else if (style == 2) {
displayResult(frameTargets["dirview"], returnDirectoryHTML());
displayResult(frameTargets["thumbview"], returnThumbNailsHTML());
displayResult(frameTargets["navview"], returnNavHTML(0));
if (showReadme != 1) {
displayResult(frameTargets["imageview"], returnImageHTML(0));
}
} else if (style == 3) {
displayResult(frameTargets["dirview"], returnDirectoryHTML());
displayResult(frameTargets["thumbview"], returnThumbNailsHTML());
displayResult(frameTargets["navview"], returnNavHTML(0));
if (showReadme != 1) {
displayResult(frameTargets["imageview"], returnImageHTML(0));
}
} else if (style == 4) {
displayResult(frameTargets["thumbview"], returnThumbNailsHTML());
displayResult(frameTargets["navview"], returnNavHTML(0));
displayResult(frameTargets["dirview"], returnDirectoryHTML());
if (showReadme != 1) {
displayResult(frameTargets["imageview"], returnImageHTML(0));
}
}
}
function displayResult(target, result)
{
var theFrame = open("", target);
theFrame.document.writeln(result);
theFrame.document.close();
}
function returnFrameHTML()
{
var style = htmlOpts["framestyle"];
// Is README actually displayed?
if( ( htmlOpts["readmepresent"] == 1 && htmlOpts["numpages"] == 0 )
|| htmlOpts["readmevisible"] == 1 ) {
var showReadme = 1;
} else {
var showReadme = 0;
}
// frame border definition
var frameBorderSize =
' FRAMEBORDER=' + htmlOpts["frameborder"] + ' BORDER=' + htmlOpts["framebordersize"];
// margin width definition
var marginBorderSize =
' MARGINWIDTH=' + htmlOpts["framemarginwidth"] + ' MARGINHEIGHT=' + htmlOpts["framemarginheight"];
// Javascript URLs to generate frame source
var srcDirectory = ' SRC="javascript:parent.emptyHTML();"';
var srcHidden = ' SRC="' + htmlOpts["jspageindex"] + '"';
var srcImageView = ' SRC="javascript:parent.emptyHTML();"';
var srcNavView = ' SRC="javascript:parent.emptyHTML();"';
var srcReadMe = ' SRC="' + htmlOpts["readme"] + '"';
var srcThumbnails = ' SRC="javascript:parent.emptyHTML();"';
// frame names
var nameDirView = ' NAME="' + frameTargets["dirview"] + '"';
var nameHidden = ' NAME="webmagick"';
var nameImageView = ' NAME="' + frameTargets["imageview"] + '"';
var nameNavView = ' NAME="' + frameTargets["navview"] + '"';
var nameThumbView = ' NAME="' + frameTargets["thumbview"] + '"';
var result =
'<HTML>\n' +
'<HEAD>\n' +
'<TITLE>' + htmlOpts["title"] + '</TITLE>\n';
if (htmlOpts["stylesheet"])
result += '<LINK REL="stylesheet" type="text/css" HREF="' + htmlOpts["stylesheet"] + '">\n';
result += '</HEAD>\n';
if( style == 1 ) {
// Three frame screen with directories listed in the
// top-left frame, navigation icons displayed in top right frame,
// and imagemap or README (dual-use) displayed in the bottom frame.
//
// -------------
// | | |
// |-------------|
// | |
// | |
// | |
// | |
// -------------
result +=
'<FRAMESET COLS="132,*"' + frameBorderSize + '>\n' +
' <FRAME' + srcDirectory + nameDirView + marginBorderSize + '>\n' +
' <FRAMESET ROWS="50,*,0"' + frameBorderSize + '>\n' +
' <FRAME' + srcNavView + nameNavView + ' MARGINHEIGHT="0" ' + 'SCROLLING="no" NORESIZE ' + '>\n';
if( showReadme == 1 ) {
result += ' <FRAME' + srcReadMe + nameImageView + marginBorderSize + '>\n';
} else {
result += ' <FRAME' + srcThumbnails + nameImageView + marginBorderSize + '>\n';
}
result +=
' <FRAME' + srcHidden + nameHidden + ' SCROLLING="no" NORESIZE >\n' +
' </FRAMESET>\n' +
'</FRAMESET>\n';
} else if ( style == 2 ) {
// Four frame screen with directories listed in top-left frame,
// image navigation icons in top right frame, imagemap displayed
// in bottom-left frame, and README/Images displayed in
// full-height right-hand frame.
// -------------
// | |----------|
// | | |
// |--| |
// | | |
// | | |
// | | |
// -------------
result +=
'<FRAMESET COLS="145,*,0"' + frameBorderSize + '>\n' +
' <FRAMESET ROWS="20%,*"' + frameBorderSize + '>\n' +
' <FRAME ' + srcDirectory + nameDirView + marginBorderSize + '>\n' +
' <FRAME ' + srcThumbnails + nameThumbView + marginBorderSize + '>\n' +
' </FRAMESET>\n' +
' <FRAMESET ROWS="50,*"' + frameBorderSize + '>\n' +
' <FRAME' + srcNavView + nameNavView + marginBorderSize + ' SCROLLING="no" NORESIZE ' + '>\n';
if( showReadme == 1 ) {
result += ' <FRAME' + srcReadMe + nameImageView + marginBorderSize + '>\n';
} else {
result += ' <FRAME ' + srcImageView + nameImageView + marginBorderSize + '>\n';
}
result +=
' </FRAMESET>\n' +
' <FRAME' + srcHidden + nameHidden + ' SCROLLING="no" NORESIZE >\n' +
'</FRAMESET>\n';
} else if ( style == 3 ) {
// Four frame screen with directories listed in left frame,
// imagemap displayed in top-right frame, and README/Images
// displayed in lower-right frame.
// -------------
// | | |
// |--+----------|
// |--+----------|
// | |
// | |
// | |
// -------------
result +=
'<FRAMESET ROWS="190,50,*"' + frameBorderSize + '>\n' +
' <FRAMESET COLS="132,*,0"' + frameBorderSize + '>\n' +
' <FRAME ' + srcDirectory + nameDirView + marginBorderSize + '>\n' +
' <FRAME ' + srcThumbnails + nameThumbView + marginBorderSize + '>\n' +
' <FRAME ' + srcHidden + nameHidden + ' SCROLLING="no" NORESIZE >\n' +
' </FRAMESET>\n' +
' <FRAME' + srcNavView + nameNavView + marginBorderSize + ' SCROLLING="no" NORESIZE ' + '>\n';
if( showReadme == 1 ) {
result += ' <FRAME' + srcReadMe + nameImageView + marginBorderSize + '>\n';
} else {
result += ' <FRAME ' + srcImageView + nameImageView + marginBorderSize + '>\n';
}
result +=
'</FRAMESET>\n';
} else if ( style == 4 ) {
// Four frame screen with imagemap displayed in top frame,
// directories in left-center frame, image navigation icons in
// right-center frame, and README/Images displayed in bottom
// frame.
// -------------
// | |
// |-------------|
// | | |
// |-------------|
// | |
// | |
// -------------
result +=
'<FRAMESET ROWS="172,50,*"' + frameBorderSize + '>\n' +
' <FRAME ' + srcThumbnails + nameThumbView + marginBorderSize + '>\n' +
' <FRAMESET COLS="132,*,0"' + frameBorderSize + '>\n' +
' <FRAME ' + srcDirectory + nameDirView + marginBorderSize + '>\n' +
' <FRAME ' + srcNavView + nameNavView + marginBorderSize + ' SCROLLING="no" NORESIZE ' + '>\n' +
' <FRAME ' + srcHidden + nameHidden + ' SCROLLING="no" NORESIZE >\n' +
' </FRAMESET>\n';
if( showReadme == 1 ) {
result += ' <FRAME ' + srcReadMe + nameImageView + marginBorderSize + '>\n';
} else {
result += ' <FRAME ' + srcImageView + nameImageView + marginBorderSize + '>\n';
}
result +=
'</FRAMESET>\n';
}
result += '</HTML>\n';
//alert(result);
return result;
}
///////////////////////////////////////////////////
//
// Routines and variables for the 'navview' frame
//
///////////////////////////////////////////////////
var navViewWindow;
function returnNavImageHTML()
{
var result = '<CENTER>\n';
// up arrow -- only displayed if three-frame style
if( htmlOpts["framestyle"] == 1 ) {
result +=
'<A HREF="javascript:parent.webmagick.displayThumbNails();"\n' +
' onMouseOver="status=\'' + htmlOpts["msg_up"] + '\'; return true;"\n' +
' onMouseOut="status=\'\';"\n' +
' ><IMG SRC="' + iconImageUrls["up"] + '" ' + iconImageSizes["up"] +
' ALT="' + htmlOpts["msg_up"] + '" BORDER=0></A>\n';
}
// if we have more than one image then display image nav buttons
if(imageNames[pageNumber].length > 1 || imageNames.length > 1) {
// preceding image arrow
// if not first page or first page and not first image in page
if( (pageNumber > 0) || (pageNumber == 0 && pageImageIndex > 0) ) {
result +=
'<A HREF="javascript:parent.webmagick.displayPrecedingImage();"\n' +
' onMouseOver="status=\'' + htmlOpts["msg_prev"] + '\'; return true;"\n' +
' onMouseOut="status=\'\';"\n' +
' ><IMG SRC="' + iconImageUrls["prev"] + '" ' + iconImageSizes["prev"] +
' ALT="' + htmlOpts["msg_prev"] + '" BORDER=0></A>\n';
} else {
result +=
'<IMG SRC="' + iconImageUrls["prev_gray"] + '" ' + iconImageSizes["prev_gray"] +
' ALT="" BORDER=0></A>\n';
}
// next image arrow
// if not last page or last page and not last image in page
if( (pageNumber < imageNames.length - 1) ||
(pageNumber == imageNames.length - 1 &&
pageImageIndex < imageNames[pageNumber].length - 1 ) ) {
result +=
'<A ' +
' HREF="javascript:parent.webmagick.displayNextImage();"\n' +
' onMouseOver="status=\''+ htmlOpts["msg_next"]+ '\'; return true;"\n' +
' onMouseOut="status=\'\';"\n' +
' ><IMG SRC="' + iconImageUrls["next"] + '" ' + iconImageSizes["next"] +
' ALT="' + htmlOpts["msg_next"] + '" BORDER=0></A>\n';
}else {
result +=
'<IMG SRC="' + iconImageUrls["next_gray"] + '" ' + iconImageSizes["next_gray"] +
' ALT="" BORDER=0></A>\n';
}
} // end of if we have one more image
result += '</CENTER>\n';
return result;
}
function returnNavThumbHTML()
{
var result = '';
// if no images then return empty page
if( imageNames[pageNumber].length == 0 ) {
return result;
}
if( htmlOpts["numpages"] > 1 ) {
// start of table
result += '<CENTER>\n<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=1>\n';
// start navigation row
result += '<TR ALIGN="center" VALIGN="top" NOWRAP>\n' ;
result += '<TD NOWRAP>\n';
// preceding page
if( pageNumber == 0 ) {
// first page + no preceding
result +=
'<IMG SRC="' + iconImageUrls["prev_gray"] + '" ' + iconImageSizes["prev_gray"] +
' ALT="" BORDER=0></A>\n';
} else {
// have preceding
result += '<A HREF="javascript:parent.webmagick.prevIndex();"\n' +
' TARGET="' + frameTargets["thumbview"] + '"\n' +
' onMouseOver="status=\'' + htmlOpts["msg_prev"] + '\'; return true;"\n' +
' onMouseOut="status=\'\';"\n' +
' ><IMG SRC="' + iconImageUrls["prev"] + '" ' + iconImageSizes["prev"] +
' ALT="' + htmlOpts["msg_prev"] + '" BORDER=0></A>\n';
}
result += '</TD>\n';
// select specific page
result += '<TD>\n';
result += '<FORM NAME="navcontrol">\n';
result += '<FONT SIZE=1>\n';
result += '<SELECT NAME="page"' +
' onChange="parent.webmagick.pageNumber=document.navcontrol.page.selectedIndex;parent.webmagick.pageImageIndex=0;parent.webmagick.displayThumbNails();">\n';
for( pageNum = 0; pageNum < htmlOpts["numpages"]; ++pageNum ) {
if( pageNum == pageNumber ) {
result += '<OPTION VALUE="' + pageNum + '" SELECTED>' + (pageNum + 1) + '</OPTION>\n';
} else {
result += '<OPTION VALUE="' + pageNum + '">' + (pageNum + 1) + '</OPTION>\n';
}
}
result += '</SELECT>\n';
result += '<FONT SIZE=3>\n';
result += '</FORM>\n';
result += '</TD>\n';
// next page
result += '<TD>\n';
if( pageNumber == htmlOpts["numpages"] - 1 ) {
// already on last page
result +=
'<IMG SRC="' + iconImageUrls["next_gray"] + '" ' + iconImageSizes["next_gray"] +
' ALT="" BORDER=0></A>\n';
} else {
// more to go
result +=
'<A HREF="javascript:parent.webmagick.nextIndex();"\n' +
' TARGET="' + frameTargets["thumbview"] + '"\n' +
' onMouseOver="status=\'' + htmlOpts["msg_next"] + '\'; return true;"\n' +
' onMouseOut="status=\'\';"\n' +
' ><IMG SRC="' + iconImageUrls["next"] + '" ' + iconImageSizes["next"] +
' ALT="' + htmlOpts["msg_next"] + '" BORDER=0></A>\n';
}
result +=
'</TD>\n'+
'</TR>\n' +
'</TABLE>\n' +
'</CENTER>\n<BR>\n';
} // End of code for multiple thumbnail pages
return result;
}
function returnNavHTML()
{
// page header
var result =
'<HTML>\n' +
'<HEAD>\n' ;
if (htmlOpts["stylesheet"])
{
result += '<LINK REL="stylesheet" type="text/css" HREF="' + htmlOpts["stylesheet"] + '">\n';
result += '</HEAD>\n<BODY>\n';
}
else
{
result += '</HEAD>\n' +
'<BODY\n' +
' TEXT="' + htmlOpts["colorfore"] + '"\n' +
' BGCOLOR="' + htmlOpts["colorback"] + '"\n';
if(iconImageUrls["background"]){
result +=' BACKGROUND="' + iconImageUrls["background"] + '"\n';
}
result +=' LINK="' + htmlOpts["colorlink"] + '"\n' +
' VLINK="' + htmlOpts["colorvlink"] + '"\n' +
' ALINK="' + htmlOpts["coloralink"] + '"\n' +
'>\n';
}
//alert('returnNavHTML(): thumbNailMode=' + thumbNailMode);
if( htmlOpts["framestyle"] == 1 && thumbNailMode == true) {
result += returnNavThumbHTML();
} else {
result += returnNavImageHTML();
}
result +=
'</BODY>\n' +
'</HTML>\n' ;
return result;
}
///////////////////////////////////////////////////
//
// Routines and variables for the 'imageview' frame
//
///////////////////////////////////////////////////
// Image descriptions for image extensions
var imageExtensions = new Object();
imageExtensions['avs'] = 'AVS X image file';
imageExtensions['bie'] = 'Joint Bi-level Image experts Group file interchange format';
imageExtensions['bmp'] = 'Microsoft Windows bitmap image file';
imageExtensions['cgm'] = 'Computer Graphics Metafile';
imageExtensions['dcm'] = 'DICOM Medical image file';
imageExtensions['dcx'] = 'ZSoft IBM PC multi-page Paintbrush file';
imageExtensions['dib'] = 'Microsoft Windows bitmap image file';
imageExtensions['dot'] = 'Graphviz (DOT) file';
imageExtensions['dvi'] = 'TeX DVI file';
imageExtensions['epdf'] = 'Encapsulated Portable Document Format';
imageExtensions['epi'] = 'Adobe Encapsulated PostScript Interchange format';
imageExtensions['eps'] = 'Adobe Encapsulated PostScript file';
imageExtensions['eps2'] = 'Adobe Level II Encapsulated PostScript file';
imageExtensions['epsf'] = 'Adobe Encapsulated PostScript file';
imageExtensions['epsi'] = 'Adobe Encapsulated PostScript Interchange format';
imageExtensions['ept'] = 'Adobe Encapsulated PostScript with TIFF preview';
imageExtensions['fax'] = 'Group 3 FAX';
imageExtensions['fig'] = 'Xfig file';
imageExtensions['fits'] = 'Flexible Image Transport System';
imageExtensions['fpx'] = 'FlashPix Format';
imageExtensions['g3'] = 'Group 3 FAX';
imageExtensions['gif'] = 'CompuServe graphics interchange format';
imageExtensions['gplt'] = 'GNUPLOT plot file';
imageExtensions['hdf'] = 'Hierarchical Data Format';
imageExtensions['hpgl'] = 'HP-GL plotter file';
imageExtensions['ico'] = 'Microsoft icon';
imageExtensions['im1'] = 'SUN Rasterfile (1 bit)';
imageExtensions['im24'] = 'SUN Rasterfile (24 bit)';
imageExtensions['im8'] = 'SUN Rasterfile (8 bit)';
imageExtensions['jbg'] = 'Joint Bi-level Image experts Group file interchange format';
imageExtensions['jbig'] = 'Joint Bi-level Image experts Group file interchange format';
imageExtensions['jpeg'] = 'Joint Photographic Experts Group JFIF format';
imageExtensions['jpg'] = 'Joint Photographic Experts Group JFIF format';
imageExtensions['m2v'] = 'Motion Picture Experts Group file interchange format';
imageExtensions['man'] = 'Manual page';
imageExtensions['miff'] = 'Magick image file format';
imageExtensions['mng'] = 'Multiple-image Network Graphics';
imageExtensions['mpeg'] = 'Motion Picture Experts Group file interchange format';
imageExtensions['mpg'] = 'Motion Picture Experts Group file interchange format';
imageExtensions['mtv'] = 'MTV Raytracing image format';
imageExtensions['p7'] = 'Xv thumbnail format';
imageExtensions['pbm'] = 'Portable bitmap format (black and white)';
imageExtensions['pcd'] = 'Photo CD';
imageExtensions['pcds'] = 'Photo CD';
imageExtensions['pcx'] = 'ZSoft IBM PC Paintbrush file';
imageExtensions['pdf'] = 'Portable Document Format';
imageExtensions['pgm'] = 'Portable graymap format (gray scale)';
imageExtensions['pic'] = 'Apple Macintosh QuickDraw/PICT file';
imageExtensions['pict'] = 'Apple Macintosh QuickDraw/PICT file';
imageExtensions['pix'] = 'Alias/Wavefront RLE image format';
imageExtensions['png'] = 'Portable Network Graphics';
imageExtensions['pnm'] = 'Portable anymap';
imageExtensions['pov'] = 'Persistance Of Vision file';
imageExtensions['ppm'] = 'Portable pixmap format (color)';
imageExtensions['ps'] = 'Adobe PostScript file';
imageExtensions['psd'] = 'Adobe Photoshop bitmap file';
imageExtensions['rad'] = 'Radiance image format';
imageExtensions['rla'] = 'Alias/Wavefront image file';
imageExtensions['rle'] = 'Utah Run length encoded image file';
imageExtensions['sgi'] = 'Irix RGB image file';
imageExtensions['sun'] = 'SUN Rasterfile';
imageExtensions['tga'] = 'Truevision Targa image file';
imageExtensions['tif'] = 'Tagged Image File Format';
imageExtensions['tiff'] = 'Tagged Image File Format';
imageExtensions['tim'] = 'PSX TIM file';
imageExtensions['ttf'] = 'TrueType font file';
imageExtensions['vicar'] = 'VICAR rasterfile format';
imageExtensions['viff'] = 'Khoros Visualization image file';
imageExtensions['xbm'] = 'X Windows system bitmap (black and white)';
imageExtensions['xpm'] = 'X Windows system pixmap file (color)';
imageExtensions['xwd'] = 'X Windows system window dump file (color)';
// return HTML to display image with corresponding index
function returnImageHTML(imageIndex)
{
pageImageIndex = imageIndex;
var result =
'<HTML>\n' +
'<HEAD>\n' ;
if (htmlOpts["stylesheet"])
{
result += '<LINK REL="stylesheet" type="text/css" HREF="' + htmlOpts["stylesheet"] + '">\n';
result += '</HEAD>\n<BODY>\n';
}
else
{
result += '</HEAD>\n' +
'<BODY\n' +
' TEXT="' + htmlOpts["colorfore"] + '"\n' +
' BGCOLOR="' + htmlOpts["colorback"] + '"\n';
if(iconImageUrls["background"]){
result +=' BACKGROUND="' + iconImageUrls["background"] + '"\n';
}
result +=' LINK="' + htmlOpts["colorlink"] + '"\n' +
' VLINK="' + htmlOpts["colorvlink"] + '"\n' +
' ALINK="' + htmlOpts["coloralink"] + '"\n' +
'>\n';
}
// only do work if image exists
if (imageNames[pageNumber][imageIndex] != null) {
result += ' <P ALIGN="center"><small>';
// if image title defined, then use it, otherwise, image name
if( imageLabels[imageNames[pageNumber][imageIndex]] != null ) {
result += imageLabels[imageNames[pageNumber][imageIndex]];
} else {
result += imageNames[pageNumber][imageIndex];
}
result +=
'</small></P>\n';
// Look for image file extension
var image = imageNames[pageNumber][imageIndex];
var delim = image.lastIndexOf('.');
var extension = '';
if ( delim > 0 ) {
extension = image.substring(delim + 1);
extension = extension.toLowerCase();
}
if( extension == 'gif' ||
extension == 'jpg' ||
extension == 'jpe' ||
extension == 'jpeg' ||
extension == 'xbm' ||
extension == 'png' ) {
// Browser supports displaying image in-line
result += '<P ALIGN="center"><IMG SRC="' + image + '" ALT=""></P>\n';
}
else {
// Browser requires an external helper program
result +=
'<P>Your browser may not have the capability to view files of format "' + imageExtensions[extension]
+ '" as an in-line image. View image via <A HREF="' + image + '">a link</A> instead.</P>\n';
}
// mod to get embedded mod files based on previews
var imageNoExtension = image.substr(0, image.length - (image.length - delim));
if (imageNoExtension.substr(imageNoExtension.length - 4, 4) == '.mov') {
// it's a Quicktime movie
result += '<CENTER><P><EMBED type="video/quicktime" src="' + imageNoExtension;
// it would be nice if we had the size here
result += '" PLUGINSPAGE="http://www.apple.com/quicktime/download/" width="240" height="196"></EMBED></P></CENTER>';
}
if(htmlOpts["anonymous"] == 0) {
result +=
'<BR><HR>\n' +
'<ADDRESS><CENTER>Produced by ' +
'<A HREF="http://webmagick.sourceforge.net/" target="_top">WebMagick</A> ' +
htmlOpts["version"] + '\nCopyright © Bob Friesenhahn</CENTER></ADDRESS>\n';
}
}
result +=
'</BODY>\n' +
'</HTML>\n';
return result;
}
// Display current image in named window
// Display image
// Display thumbnails in navview window if framestyle != 1
var imageViewWindow;
function displayImage()
{
//var targeturl = 'javascript:parent.webmagick.returnImageHTML(' + pageImageIndex + ');';
//imageViewWindow = window.open( targeturl, frameTargets["imageview"]);
displayResult(frameTargets["imageview"], returnImageHTML(pageImageIndex));
if( htmlOpts["framestyle"] == 1) {
thumbNailMode = false;
}
// alert('displayImage(): thumbNailMode=' + thumbNailMode);
//var targeturl = 'javascript:parent.webmagick.returnNavHTML();';
//navViewWindow = window.open( targeturl, frameTargets["navview"]);
displayResult(frameTargets["navview"], returnNavHTML());
}
// Display an image by index number (setting current image)
function displayImageByIndex(imageIndex)
{
pageImageIndex = imageIndex;
displayImage();
}
// Display the next image in a series
function displayNextImage()
{
// if not last image in current page, then increment index
if(pageImageIndex < imageNames[pageNumber].length - 1 ) {
++pageImageIndex;
displayImage(); // display new image
}
else {
// if not last page then increment page and set index to zero
if(pageNumber < imageNames.length - 1) {
++pageNumber;
pageImageIndex = 0;
if(htmlOpts["framestyle"] == 1) {
displayImage(); // display new image
} else {
displayThumbNails(); // display new thumbnails & image
}
}
}
}
// Display the preceding image in a series
function displayPrecedingImage()
{
// if not first image in current page, then decrement index
if( pageImageIndex > 0 ) {
--pageImageIndex;
displayImage(); // display new image
}
else {
// if not first page, then decrement page and set index to max index for page
if(pageNumber > 0) {
--pageNumber;
pageImageIndex = imageNames[pageNumber].length - 1;
if(htmlOpts["framestyle"] == 1) {
displayImage(); // display new image
} else {
displayThumbNails(); // display new thumbnails & image
}
}
}
}
///////////////////////////////////////////////////
//
// Routines and variables for the 'thumbview' frame
//
///////////////////////////////////////////////////
// Write out thumbnail index HTML into thumbview window
// and write navigation info to navview window.
// Display thumbnails
// Display thumbnail navigator in thumbview window if framestyle=1
// Display image if framestyle!=1
var thumbViewWindow;
var thumbNailMode=true;
function displayThumbNails()
{
//var targeturl = 'javascript:parent.webmagick.returnThumbNailsHTML();';
//thumbViewWindow = window.open( targeturl, frameTargets["thumbview"]);
displayResult(frameTargets["thumbview"], returnThumbNailsHTML());
if ( htmlOpts["framestyle"] == 1 ) {
thumbNailMode = true
//var targeturl = 'javascript:parent.webmagick.returnNavHTML();';
//navViewWindow = window.open( targeturl, frameTargets["navview"]);
displayResult(frameTargets["navview"], returnNavHTML());
} else {
thumbNailMode = true
displayImage();
}
}
// return HTML to display thumbnail selection
function returnThumbNailsHTML()
{
// page header
var result =
'<HTML>\n' +
'<HEAD>\n' ;
if (htmlOpts["stylesheet"])
{
result += '<LINK REL="stylesheet" type="text/css" HREF="' + htmlOpts["stylesheet"] + '">\n';
result += '</HEAD>\n<BODY>\n';
}
else
{
result += '</HEAD>\n' +
'<BODY\n' +
' TEXT="' + htmlOpts["colorfore"] + '"\n' +
' BGCOLOR="' + htmlOpts["colorback"] + '"\n';
if(iconImageUrls["background"]){
result +=' BACKGROUND="' + iconImageUrls["background"] + '"\n';
}
result +=' LINK="' + htmlOpts["colorlink"] + '"\n' +
' VLINK="' + htmlOpts["colorvlink"] + '"\n' +
' ALINK="' + htmlOpts["coloralink"] + '"\n' +
'>\n';
}
// if no images then return empty page
if( imageNames[pageNumber].length == 0 ) {
result +=
'</BODY>\n' +
'</HTML>\n' ;
return result;
}
// If not in framestyle 1, display thumbnail navigator
if ( htmlOpts["framestyle"] != 1 ) {
result += returnNavThumbHTML();
}
result +=
'<CENTER>\n';
if ( htmlOpts["tables"] == 1) {
result += '<TABLE WIDTH=90%>';
} else {
result +=
'<IMG SRC="' + montageImages[pageNumber] + '" ' +
montageImageSizes[pageNumber] +
' USEMAP="#thumbnails" BORDER=0>' +
'<MAP NAME="thumbnails">\n';
}
for( imageNum = 0; imageNum < imageNames[pageNumber].length; ++imageNum ) {
if ( htmlOpts["tables"] == 1) {
if (imageNum%htmlOpts["columns"] == 0) {
result += '<TR ALIGN=CENTER VALIGN=TOP>';
}
result += '<TD><A HREF="javascript:parent.webmagick.displayImageByIndex(' + imageNum + ');"\n' +
' onMouseOver="status=\'View ' + escapeJs(imageNames[pageNumber][imageNum]) + '\'; return true;" \n' +
' onMouseOut="status=\'\';">\n';
result += '<IMG BORDER=0 SRC="';
// if thumb width is 0, then there must not be a cachefile (original image is small enough)
if ( thumbwidths[pageNumber][imageNum] != 0) {
result += escapeURL(htmlOpts["cachedir"]) + '/';
}
result += escapeURL(imageNames[pageNumber][imageNum]) + '"';
if ( thumbwidths[pageNumber][imageNum] != 0) {
result += ' HEIGHT=' + thumbheights[pageNumber][imageNum] + ' WIDTH= ' + thumbwidths[pageNumber][imageNum];
}
result += '></A><BR>\n';
if (imLabels[pageNumber][imageNum]) {
result += '<FONT SIZE=-1>' + imLabels[pageNumber][imageNum] + '</FONT>\n';
}
result += '</TD>';
if (imageNum%htmlOpts["columns"] == (htmlOpts["columns"] - 1)) {
result += '</TR>';
}
} else {
result +=
' <AREA HREF="javascript:parent.webmagick.displayImageByIndex(' + imageNum + ');"\n' +
' onMouseOver="status=\'View ' + escapeJs(imageNames[pageNumber][imageNum]) + '\'; return true;"\n' +
' onMouseOut="status=\'\';"\n' +
' SHAPE=RECT COORDS="' + imageThumbCoords[pageNumber][imageNum] + '">\n';
}
}
if ( htmlOpts["tables"] == 1) {
result += '</TABLE>';
} else {
result +=
'</MAP>\n';
}
result += '</CENTER>\n<BR><ADDRESS>\n';
if (htmlOpts["address"] != '') {
result += htmlOpts["address"] + '<BR>\n';
}
result += '<FONT SIZE=-1>';
result += htmlOpts["dateText"] + '\n';
if(htmlOpts["anonymous"] == 0) {
result +=
'<BR><HR>\n' +
htmlOpts["msg_produced_by"] + ' ' +
'<NOBR><A HREF="http://webmagick.sourceforge.net/" target="_top">WebMagick</A> ' +
htmlOpts["version"] + '</NOBR>, <NOBR>' + htmlOpts["msg_copyright"] + '©</NOBR> <NOBR>Bob Friesenhahn</NOBR>\n';
}
result += '</FONT>\n</ADDRESS>\n';
result +=
'</BODY>\n' +
'</HTML>\n' ;
return result;
}
///////////////////////////////////////////////////
//
// Routines and variables for the 'dirview' frame
//
///////////////////////////////////////////////////
// Display directory listing in frame
var dirViewWindow;
function displayDirectory()
{
displayResult(frameTargets["dirview"], returnDirectoryHTML());
}
var configWindow;
function saveConfig()
{
newColumns = configWindow.document.aForm.columns.value;
newRows = configWindow.document.aForm.rows.value;
var newStyle;
for (var i = 0; i < configWindow.document.aForm.framestyle.length; i++) {
if (configWindow.document.aForm.framestyle[i].checked) {
newStyle=configWindow.document.aForm.framestyle[i].value;
}
}
// TODO: error checking
Set_Cookie('framestyle', newStyle, expires_date);
Set_Cookie('columns', newColumns, expires_date);
Set_Cookie('rows', newRows, expires_date);
configWindow.close();
parent.location.reload();
}
// display the window to allow configuration changes
function showConfig()
{
configWindow = open('', 'wmConfig', 'toolbar=no,dependent=yes,menubar=no,status=no,resizable=yes,width=550,height=575');
configWindow.document.open();
result = '<HTML><HEAD><TITLE>Configure Gallery</TITLE></HEAD><BODY>';
result += '<FORM NAME="aForm" ACTION="" ONSUBMIT="">';
result += '<P>Columns: <INPUT WIDTH=5 TYPE="text" NAME="columns" VALUE="' + htmlOpts["columns"] + '">\n';
result += ' Rows: <INPUT WIDTH=5 TYPE="text" NAME="rows" VALUE="' + htmlOpts["rows"] + '">\n';
result += '<INPUT TYPE="reset" VALUE="Reset"><INPUT TYPE="button" VALUE="Save" onclick="window.opener.parent.webmagick.saveConfig()">';
result += '<BR><TABLE BORDER=1><TR><TD><INPUT TYPE="radio" VALUE="1" NAME="framestyle"';
if (htmlOpts["framestyle"] == 1) {
result += ' checked ';
}
result += '><IMG SRC="' + iconImageUrls["frame-style-1"] + '" ' + iconImageSizes["frame-style-1"] + '></TD>\n';
result += '<TD><INPUT TYPE="radio" VALUE="2" NAME="framestyle"';
if (htmlOpts["framestyle"] == 2) {
result += ' checked ';
}
result += '><IMG SRC="' + iconImageUrls["frame-style-2"] + '" ' + iconImageSizes["frame-style-2"] + '></TD></TR>\n';
result += '<TR><TD><INPUT TYPE="radio" VALUE="3" NAME="framestyle"';
if (htmlOpts["framestyle"] == 3) {
result += ' checked ';
}
result += '><IMG SRC="' + iconImageUrls["frame-style-3"] + '" ' + iconImageSizes["frame-style-3"] + '></TD>\n';
result += '<TD><INPUT TYPE="radio" VALUE="4" NAME="framestyle"';
if (htmlOpts["framestyle"] == 4) {
result += ' checked ';
}
result += '><IMG SRC="' + iconImageUrls["frame-style-4"] + '" ' + iconImageSizes["frame-style-4"] + '></TD></TR></TABLE>\n';
result += '</FORM></BODY></HTML>';
configWindow.document.write(result);
configWindow.document.close();
}
// Navigate to directory
function changeDirectory(dirname)
{
// Redisplay complete frameset
top.window.location = escapeURL(dirname) + '/' + dirLinks[dirname];
}
// return HTML to display directory listing
function returnDirectoryHTML()
{
var result =
'<HTML>\n' +
'<HEAD>\n' ;
if (htmlOpts["stylesheet"])
{
result += '<LINK REL="stylesheet" type="text/css" HREF="' + htmlOpts["stylesheet"] + '">\n';
result += '</HEAD>\n<BODY>\n';
}
else
{
result += '</HEAD>\n' +
'<BODY\n' +
' TEXT="' + htmlOpts["colorfore"] + '"\n' +
' BGCOLOR="' + htmlOpts["colorback"] + '"\n';
if(iconImageUrls["background"]){
result +=' BACKGROUND="' + iconImageUrls["background"] + '"\n';
}
result +=' LINK="' + htmlOpts["colorlink"] + '"\n' +
' VLINK="' + htmlOpts["colorvlink"] + '"\n' +
' ALINK="' + htmlOpts["coloralink"] + '"\n' +
'>\n';
}
result +='<FONT SIZE=-1>\n';
// up arrow
result +=
'<A HREF="javascript:parent.webmagick.changeDirectory(\'..\');"\n' +
' onMouseOver="status=\'' + htmlOpts["msg_up"] + '\'; return true;"\n' +
' onMouseOut="status=\'\'; return true;"\n' +
' ><IMG SRC="' + iconImageUrls["up"] + '" ' + iconImageSizes["up"] +
' ALT="' + htmlOpts["msg_up"] + '" BORDER=0></A>\n';
// config
if( htmlOpts["config"] && (htmlOpts["config"] != 0)) {
result +=
'<A HREF="javascript:parent.webmagick.showConfig();"\n' +
' onMouseOver="status=\'configure your frames\'; return true;"\n' +
' onMouseOut="status=\'\';"\n' +
' ><IMG SRC="' + iconImageUrls["config"] + '" ' + iconImageSizes["config"] +
' ALT="Config" BORDER=0></A>\n';
}
// help
if( htmlOpts["readmepresent"] != 0 ) {
result +=
'<A HREF="' + htmlOpts["readme"] + '"\n' +
' TARGET="' + frameTargets["readmeview"] + '"\n' +
' onMouseOver="status=\'' + htmlOpts["msg_readme"] + '\'; return true;"\n' +
' onMouseOut="status=\'\';"\n' +
' ><IMG SRC="' + iconImageUrls["help"] + '" ' + iconImageSizes["help"] +
' ALT="' + htmlOpts["msg_readme"] + '" BORDER=0></A>\n';
}
// list out directory URLs
if( dirNames.length != 0 ) {
result += '<BR><B>' + htmlOpts["msg_directories"] + '</B><BR>\n';
for( dirNum = 0; dirNum < dirNames.length; ++dirNum ) {
// if we have directory title, then use it, else use directory name
var dirTitle = '';
if( dirTitles[dirNames[dirNum]] != null ) {
dirTitle = dirTitles[dirNames[dirNum]];
} else {
dirTitle = dirNames[dirNum];
}
result +=
'<NOBR><A HREF="javascript:parent.webmagick.changeDirectory(\'' + escapeJs(dirNames[dirNum]) + '\');"\n' +
' onMouseOver="status=\'change to directory: ' + escapeJs(dirTitle) + '\'; return true;"\n' +
' onMouseOut="status=\'\';"\n';
result += '>';
result += dirTitle;
result += '</A></NOBR><BR>\n';
}
}
result += '</BODY></HTML>\n' ;
return result;
}
///////////////////////////////////////////////////
//
// Routines and variables for the 'webmagick' frame
//
///////////////////////////////////////////////////
// display next index page
function nextIndex() {
if( pageNumber < htmlOpts["numpages"] ) {
++pageNumber;
pageImageIndex = 0;
displayThumbNails();
}
}
// display preceding index page
function prevIndex() {
if( pageNumber > 0 ) {
--pageNumber;
pageImageIndex = 0;
displayThumbNails();
}
}
// Display specific index page
function goToIndex(number)
{
pageNumber = number;
pageImageIndex = 0;
displayThumbNails();
}
///////////////////////////////////////////////////
//
// General purpose routines
//
///////////////////////////////////////////////////
// Escape characters in strings so they may be evaluated by JavaScript
function escapeJs(inString)
{
var outString = '';
//alert ('Inside escapeJs ' + inString);
//if (! defined(inString)) { return outString; }
for(pos = 0; pos < inString.length; pos++) {
c = inString.charAt(pos);
if(c == '\'' || c == '"' || c == '\n') {
outString += '\\';
}
outString += c;
}
return outString;
}
// Escape spaces in URLs
function escapeURL(inString)
{
var outString = '';
for (pos = 0; pos < inString.length; pos++)
{
c = inString.charAt(pos);
if (c == '%')
{
outString += '%25';
}
else if (c == ' ')
{
outString += '%20';
}
else if (c == '#')
{
outString += '%23';
}
else
{
outString += c;
}
}
return outString;
}
function Get_Cookie(name) {
var start = document.cookie.indexOf(name+"=");
var len = start+name.length+1;
if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
if (start == -1) return null;
var end = document.cookie.indexOf(";",len);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(len,end));
}
function Set_Cookie(name,value,expires,domain,secure) {
document.cookie = name + "=" +escape(value) +
( (expires) ? ";expires=" + expires.toGMTString() : "") +
";path=" + htmlOpts["prefixpath"] + "/" +
( (domain) ? ";domain=" + domain : "") +
( (secure) ? ";secure" : "");
}
function Delete_Cookie(name,path,domain) {
if (Get_Cookie(name)) document.cookie = name + "=" +
( (path) ? ";path=" + path : "") +
( (domain) ? ";domain=" + domain : "") +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
function fixDoubleArray(anArray, aRemainder) {
var counter = 0;
var perPage = htmlOpts["rows"] * htmlOpts["columns"];
// create new array
var tempArray = new Array(htmlOpts["numpages"]);
for (i = 0; i < htmlOpts["numpages"]; i++) {
if ((i == htmlOpts["numpages"] - 1) && (aRemainder != 0)) {
tempArray[i] = new Array(aRemainder);
} else {
tempArray[i] = new Array(perPage);
}
}
// handle empty directory
if (htmlOpts["numpages"] == 0) {
tempArray = new Array(1);
tempArray[0] = new Array(0);
}
for (i = 0; i < anArray.length; i++) {
for (j = 0; j < anArray[i].length; j++) {
tempArray[(Math.floor(counter / perPage))][(counter % perPage)] = anArray[i][j];
counter++;
}
}
//alert ('tempArray ' + tempArray[0]);
//anArray = tempArray;
return tempArray;
}
// indicate this file fully loaded
var WebMagickLoaded = 1;
|