if(parameters.effects){ if(parameters.effects.constructor == Array) for(var i = 0; i < parameters.effects.length; i++) addEffect(parameters.effects[i]); else addEffect(parameters.effects); } if(!effects.length) effects = array_copy(globalEffects); //OPTIONS var display = parameters.display || {}; display.width = parameters.width; display.height = parameters.height; var loading = display.loading || {}; var description = display.description || null; var navigation = display.navigation || null; var buttons = display.buttons || null; var styleDef = {width: display.width, height: display.height, position: 'absolute', top: 0, left: 0, display: 'block'}; var mainCont = document.getElementById(parameters.container); addElementEvent(mainCont, 'onmouseover', function(){isHover = true; if(buttons && buttons.hide) show(buttonsCont.style); if(description && description.hide && !contentmode) show(descriptionCont.style); if(display.pause) autoplay(false); }); addElementEvent(mainCont, 'onmouseout', function(){isHover = false; if(buttons && buttons.hide) hide(buttonsCont.style); if(description && description.hide && !contentmode) hide(descriptionCont.style); if(display.pause) autoplay(true); }); //GET CONTENT if(contentmode){ for(var i = 0; i < mainCont.childNodes.length; i++){ if(mainCont.childNodes[i].nodeType == 1){ images.push(mainCont.childNodes[i].cloneNode(true)); hide(mainCont.childNodes[i].style); } } }else{ for(var i = 0; i < mainCont.childNodes.length; i++){ if(mainCont.childNodes[i].nodeType == 1){ if(mainCont.childNodes[i].tagName == 'A'){ var img = mainCont.childNodes[i].getElementsByTagName('IMG'); if(img.length){ images.push(img[0].src); links[images.length-1] = mainCont.childNodes[i]; }else descriptions[images.length-1] = mainCont.childNodes[i]; }else if(mainCont.childNodes[i].tagName == 'IMG'){ images.push(mainCont.childNodes[i].src); if(mainCont.childNodes[i].useMap){ var maps = document.getElementsByTagName('MAP'), map; if(maps.length){ for(var m = 0; m < maps.length; m++){ if(maps[m].name && mainCont.childNodes[i].useMap.replace(/^[^#]*#/, '') == maps[m].name) map = maps[m]; } } if(map) links[images.length-1] = map; } }else if(mainCont.childNodes[i].tagName == 'MAP') continue; else descriptions[images.length-1] = mainCont.childNodes[i]; hide(mainCont.childNodes[i].style); } } for(var i = 0; i < images.length; i++) loadImage(images[i]); } //CONTAINERS var sliderCont = newElement('DIV', {width: display.width, height: display.height, position: 'relative'}); mainCont.appendChild(sliderCont); var imagesCont = newElement('DIV', styleDef); sliderCont.appendChild(imagesCont); //var partsCont = newElement('DIV', styleDef); sliderCont.appendChild(partsCont); partsCont = sliderCont; //LINKS if(contentmode) var linkUpd = ef; else{ var lnk = newElement('DIV', styleDef); partsCont.appendChild(lnk); var linkUpd = function(){ lnk.innerHTML = ''; value = links[current]; if(value){ if(value.tagName == 'MAP'){ var a = newElement('IMG', styleDef); a.src = images[current]; a.useMap = '#'+value.name; }else{ var a = newElement('A', styleDef); a.href = value.href; a.target = value.target; } setStyles(a.style, {opacity: 0, background: '#000000'}) a.onfocus = function(){this.blur();}; lnk.appendChild(a); } } } //LOADING if(contentmode) var showLoading = ef; else{ var loadingCont = newElement('DIV'); partsCont.appendChild(loadingCont); if(loading.background){ var loadingBgStyle = array_copy(styleDef); loadingBgStyle.background = loading.background; if(loading.opacity) loadingBgStyle.opacity = loading.opacity; loadingCont.appendChild(newElement('DIV', loadingBgStyle)); } if(loading.image){ var loadingImgStyle = array_copy(styleDef); loadingImgStyle.background = 'url('+(loading.image)+') no-repeat center center'; loadingCont.appendChild(newElement('DIV', loadingImgStyle)); } var showLoading = function(a){ if(a) show(loadingCont.style); else hide(loadingCont.style); status = a ? 'loading' : 'free'; } } //DESCRIPTION if(description && !contentmode){ var descriptionCont = newElement('DIV'); partsCont.appendChild(descriptionCont); if(description.hide) hide(descriptionCont.style); var descriptionStl = {position: 'absolute', overflow: 'hidden', textAlign: 'left'}; if(!description) description = []; description.position = validateOption(description.position, 'top,left,right,bottom') descriptionStl.background = description.background || 'white'; descriptionStl.opacity = description.opacity || 0.5; descriptionStl.width = description.position == 'top' || description.position == 'bottom' ? display.width : description.width || display.width*0.2; descriptionStl.height = description.position == 'left' || description.position == 'right' ? display.height : description.height || display.height*0.2; descriptionStl[description.position == 'bottom'?'bottom':'top'] = 0; descriptionStl[description.position == 'right'?'right':'left'] = 0; var descBg = newElement('DIV', descriptionStl); descriptionCont.appendChild(descBg); descriptionStl.opacity = 1; descriptionStl.background = ''; var desc = newElement('DIV', descriptionStl); descriptionCont.appendChild(desc); var descriptionShow = function(){ desc.innerHTML = ''; setStyle(descriptionCont.style, 'visibility', 'hidden'); var value = descriptions[current]; if(value){ setStyle(descriptionCont.style, 'visibility', 'visible'); value = value.cloneNode(true); show(value.style); desc.appendChild(value); if(isHover) show(descriptionCont.style); } } }else var descriptionShow = ef //BUTTONS if(buttons){ var buttonsCont = newElement('DIV'); partsCont.appendChild(buttonsCont); if(buttons.hide) hide(buttonsCont.style); var btnPrev = newElement('A'); buttonsCont.appendChild(btnPrev); btnPrev.href = 'javascript:void(0);'; var btnNext =