var _gPics = []; _gPics['clients'] = [ 'pelican', 'laoplife', 'northlake', 'covla', 'cbt', 'joshkelley', 'commonwealth', 'jd', 'hometown', 'kappas', 'aubert', 'superchec', 'swagelok' ]; var _gCaptions = []; _gCaptions['clients'] = [ 'Pelican Pictures, Inc.', 'LA Operation Lifesaver', 'Northlake Insurance', 'City of Covington, LA', 'Citizens Bank and Trust', 'Josh Kelley', 'Commonwealth Investments', 'JD Real Estate Group', 'Hometown Construction', 'Kappa Alpha Psi, S.U. Chapter', 'Aubert Insurance', 'Superchec', 'Capital Valve & Fittings' ]; _gPics['animation'] = [ 'dragonphy', 'balldrop', 'carspin', 'jagroom' ]; _gPics['sites'] = [ 'college', 'lamar', 'pennington', 'southern' ]; _gPics['print'] = [ 'envtoxicology', 'su_museumofart', 'powerup', 'centerforwellness', 'womensnutrition', 'masscommunications', 'designsymbols', 'deborahluke', 'joshkelley', 'issues', 'dochyde', 'digitalportfolio', 'xpondezign', 'checo' ]; _gPics['imaging'] = [ 'imagery', 'lattice', 'enhance', 'modichips', 'perspective', 'lava1', 'cosmicbilliards', 'timegate', 'planetenhance', 'phazic', 'newdimension', 'finalfrontier', 'eyi' ]; _gPics['logos'] = [ 'homebuilders', 'topnotch', 'joshkelley', 'aubert', 'trsl', 'obrien', 'storytime', 'lpca', 'sus', 'superchec', 'foxlink' ]; /* after instantiation -- MUST set dimensions */ _galleryImageCount = 0; _galleryImageDeclared = 0; _gallery_countLoaded = function() { _galleryImageCount++; // window.status = window.defaultStatus = _galleryImageCount; // trace(_galleryImageCount); } function galleryBuilder(parent) { this.layer = parent; this.rendered = false; this.leftInset = 0; this.topInset = 0; this.interImageDistance = 32; this.images = []; this.caption = []; this.linkAction = []; // point to specific external function // each image can have its own handler this.imagePath = []; this.innerLayer = null; this.imageLayer = []; this.captionLayer = []; this.imageHeight = 133; // default for this instance this.imageWidth = 200; this.imageBorderColor = "white"; this.imageBGColor = null; this.captionFont = "Verdana, sans-serif"; this.captionSize = "9px"; this.captionColor = "white"; this.captionWeight = "normal"; this.dataTemplate = null; this.dataLabels = []; this.totalHeight = 0; this.imageObjects = []; this.addImage = function(url) { _galleryImageDeclared++; this.images[this.images.length] = url; var img = new Image(); //preload //img.onload = _gallery_countLoaded; img.src = url; //img.onload = document.all ? "_gallery_countLoaded()" : _gallery_countLoaded; // this.imageObjects[this.imageObjects.length] = img; } this.setImageWidth = function(w) { this.imageWidth = w; } this.setImageHeight = function(h) { this.imageHeight = h; } this.setImageSize = function(w, h) { this.setImageWidth(w); this.setImageHeight(h); } this.setLinkAction = function(proc,path) { var indx = this.linkAction.length; this.linkAction[indx] = proc; this.imagePath[indx] = path; } this.setLinkActionForImage = function(index, proc, path) // remember this is 1-based indexing -- for user { this.linkAction[index -1] = proc; this.imagePath[index - 1] = path; } this.addLink = function(func, path) { this.setLinkAction(func, path); } this.addCaption = function(str) { this.caption[this.caption.length] = str; } this.setCaptionForImage = function(indx, str) // index here is 1-based converted -- for user { this.caption[indx - 1] = str; //expect number base to be 1 } this.setLocation = function(left, top) { this.top = top; this.left = left; } this.setDimension = function(w, h) { this.width = w; this.height = h; } this.setWidth = function(w) { this.width = w; } this.setLeftInset = function(i) { this.leftInset = i; } this.setTopInset = function(i) { this.topInset = i; } this.show = function() { this.layer.style.visibility = "visible"; } this.hide = function() { this.layer.style.visibility = "hidden"; } this.set_zIndex = function(v) { this.layer.style.zIndex = v; } /* okay == the plan we have labels we need data each record is new keyvalue hashtable record[dataLabel[i] ] = fillstr; */ this.db = []; // this is the database object prototype this.dbLabelFont = "Verdana, sans-serif"; this.dbLabelColor = "red"; this.dbLabelSize = "10px"; this.dbLabelWeight = "bold"; this.dbTextFont = "Verdana, sans-serif"; this.dbTextColor = "white"; this.dbTextSize = "9px"; this.dbTextWeight = "normal"; this.addRecord = function() { var data = arguments; var record = []; for(var i = 0; i < this.dataLabels.length; i++) record[this.dataLabels[i]] = data[i] || ""; this.db[this.db.length] = record; } this.addRecordForImage = function(index) { var data = arguments; var record = []; for(var i = 0; i < this.dataLabels.length; i++) record[this.dataLabels[i]] = data[i + 1] || ""; this.db[index - 1] = record; } this.setDataDelimiter = function(str) { this.dataDelimiter = str; } this.setDataLabels = function() { for(var i = 0; i < arguments.length; i++) this.dataLabels[i] = arguments[i]; } ///////// renderAsHTML this.renderAsHTML = function() { var ref = this; var runningSpace = 0; var html = ""; // need copy of dimensions // just figure that all relative to parent layer [this.layer] //html += "
" html += "
"; for(var i = 0; i < this.images.length; i++) { html += "
"; var content = ""; if(this.linkAction[i]) content += "" content += ""; if(this.linkAction[i]) content += ""; html += content; html += "
"; // ------------- if(this.db[i]) { var lstyl = "style='position: relative; font-family: " + ref.dbLabelFont + "; " + "color: " + ref.dbLabelColor + "; " + "font-weight: " + ref.dbLabelWeight + "; " + "font-size: " + ref.dbLabelSize + ";'"; var tstyl = "style='position: relative; font-family: " + ref.dbTextFont + "; " + "color: " + ref.dbTextColor + "; " + "font-weight: " + ref.dbTextWeight + "; " + "font-size: " + ref.dbTextSize + ";'"; html += "
"; var content = ""; var rec = this.db[i]; for(var a in rec) { content += "
" + a + ref.dataDelimiter + "" + rec[a] + "
"; // + i } html += "" + content + ""; html += "
"; /* this section used to calc height -- move this out of this loop only need 1 dummy dec and reuse innerHTML */ var dummy = document.createElement("DIV"); dummy.style.visibility = "hidden"; dummy.style.width = ref.imageWidth; dummy.innerHTML = "" + content + ""; document.body.appendChild(dummy); //document.body.appendChild(dummy); runningSpace += dummy.offsetHeight + ref.interImageDistance; } else if(this.caption[i]) { var use_pinline = false; var pl_color = 0; var pl_width = 0; var pl_align = 0; var pl_leftoffset = 0; var pl_use_width = 0; if(this.caption[i].indexOf("pinLine") != -1) { var parts = this.caption[i].split(","); pl_width = parts[1]; pl_align = parts[2]; pl_color = parts[3]; use_pinline = true; if(pl_width.indexOf("%") != -1) pl_use_width = Math.round(ref.width * parseInt(pl_width)/100); else pl_use_width = parseInt(pl_width); switch(pl_align) { case "center": // width will either be % or pixels pl_leftoffset = Math.round(ref.width/2 - pl_use_width/2); break; case "right": pl_leftoffset = ref.width - pl_use_width; break; // default and left has leftoffset at zero, which it already is } } /* -- trouble area -- */ html += "
"; if(this.caption[i].indexOf("pinLine") == -1) html += "" + this.caption[i] + ""; html += "
"; /* end trouble area */ } //-------------------------------------------- } html += "
"; html += "
"; // end contentarea //html += "
"; this.rendered = true; this.totalHeight = 45 + ref.topInset + (this.images.length-1) * (ref.imageHeight + ref.interImageDistance) + ref.imageHeight + 2 + runningSpace; return html; } } // end galleryBuilder