function Photo_Gallery() { this.loaded = 0; this.queryitems = []; this.auto = 0; } function photo_gallery_initialize() { with (this) { if (Site.loaded == 1) { loaded = 1; root = "http://www.tripartiteforum.com/"; CompileQuery(); } else { window.setTimeout('Photos.Initialize()',10); } } } function photo_gallery_compilequery() { var fields; with (this) { if (loaded == 1) { fields = document.body.getElementsByTagName("INPUT"); for (i = 0; i < fields.length; i++) { if (fields[i].id != "" && fields[i].name != "") { if (fields[i].id.search(/s-/gi) != -1) { queryitems[fields[i].id] = new Array(fields[i].name,fields[i].value); } } } if (queryitems['s-auto']) { auto = queryitems['s-auto'][1]; auto = (auto == "1" || auto == "-1" ? auto : "-1"); } } } } function photo_gallery_addtoquery(item,value,s) { with (this) { if (loaded == 1) { if (item) { if (item.id.search(/s-/gi) != -1) { item.value = value; CompileQuery(); if (s == 1 && auto == "1") { SubmitQuery(); } } } } } } function photo_gallery_submitquery() { var query = "http://www.tripartiteforum.com/photos/?x=1&"; with (this) { if (loaded == 1) { for (i in queryitems) { if (queryitems[i][1] != "") { query += queryitems[i][0]+"="+queryitems[i][1]+"&"; } } query = query.substr(0,query.length-1); location.href = query; } } } function photo_gallery_keypress(e) { var evt = e || window.event; var key = evt.which || evt.keyCode; with (this) { if (key == 13) { SubmitQuery(); } } } function photo_gallery_addfileupload() { var field; var desc; var errors; var entries; var count; var i = 1; var x = 0; var div; var copy = ""; with (this) { field = $('photo_file_1'); desc = $('photo_desc_1'); errors = $('photo_errors_1'); entries = $('photo_entries'); count = $('photo_count'); if (field && desc && entries && errors && count) { while (x == 0) { if ($('photo_file_'+i)) { i++; } else { x = i; } } if (x < 11) { div = document.createElement("div"); div.id = "photo_file_"+x; copy = field.innerHTML.replace(/photo_desc_1/gi,"photo_desc_"+x); copy = copy.replace(/photo_errors_1/gi,"photo_errors_"+x); copy = copy.replace(/File #1/gi,"File #"+x); div.innerHTML = copy; entries.insertBefore(div,null); if ($('photo_errors_'+x)) { $('photo_errors_'+x).style.visibility = "hidden"; $('photo_errors_'+x).style.display = "none"; } count.innerHTML = x; } } } } Photo_Gallery.prototype.Initialize = photo_gallery_initialize; Photo_Gallery.prototype.CompileQuery = photo_gallery_compilequery; Photo_Gallery.prototype.AddToQuery = photo_gallery_addtoquery; Photo_Gallery.prototype.SubmitQuery = photo_gallery_submitquery; Photo_Gallery.prototype.KeyPress = photo_gallery_keypress; Photo_Gallery.prototype.AddFileUpload = photo_gallery_addfileupload; var Photos = new Photo_Gallery(); Photos.Initialize();