function startGallery(id){ AjaxRequest.open("GET", "/ajax/galleri.asp?id="+id+"", true); AjaxRequest.onreadystatechange = function(){startGallery2()}; AjaxRequest.send(null); } function startGallery2(){ if(AjaxRequest.readyState==4 || AjaxRequest.readyState=='complete'){ _id('galleryContent').innerHTML = AjaxRequest.responseText; LBsetLightbox(); //alert(AjaxRequest.responseText); _id('t_1').firstChild.style.display = 'none'; oldPic = _id('t_1').firstChild.id.replace('thumb_', ''); _id('galleryPicText_1').style.display = 'block'; oldMargin = 0; oldPicCount = 1; Cufon.refresh(); } } function LBsetLightbox2() { var h = 500; var w = 1000; if(_id('Lightbox')) { _id('Lightbox').style.display = 'block'; } else { newE = document.createElement("div"); newE.id = 'Lightbox'; newE.style.position = 'absolute'; newE.style.top = '0px'; newE.style.left = '0px'; newE.style.height = '' + document.documentElement.scrollHeight + 'px'; newE.style.width = '100%'; newE.style.cursor = 'pointer'; newE.style.zIndex = '999'; newE.style.backgroundColor = '#000000'; newE.style.filter = 'alpha(opacity=70)'; newE.style.opacity = '.70'; document.body.insertBefore(newE, document.body.firstChild); } if(_id('LightboxContent')) { e1 = _id('LightboxContent'); e1.style.display = 'block'; e1.style.top = '40px'; e1.style.left = '' + (((document.documentElement.offsetWidth / 2) - parseInt(w / 2)) - document.documentElement.scrollLeft) + 'px'; } else { newA = document.createElement("div"); newA.id = 'LightboxContent'; newA.style.position = 'absolute'; newA.style.top = '40px'; newA.style.left = '' + (((document.documentElement.offsetWidth / 2) - parseInt(w / 2)) - document.documentElement.scrollLeft) + 'px'; newA.style.height = '' + h + 'px'; newA.style.width = '' + w + 'px'; newA.style.zIndex = '1001'; newA.style.background = 'url(/bilder/design/lightBoxBG2.png)'; document.body.insertBefore(newA, document.body.firstChild); } _id('LightboxContent').innerHTML = _id('lightKarta').innerHTML; if(navigator.appName == "Microsoft Internet Explorer") { _id('Lightbox').attachEvent('onclick', LBcloseLightbox); } else { _id('Lightbox').addEventListener('click', LBcloseLightbox,false); } } function LBcloseLightbox2() { _id('Lightbox').style.display = 'none'; _id('LightboxContent').style.display = 'none'; _id('LightboxContent').innerHTML = ''; if (document.getElementById('flashcontent')) { document.getElementById('flashcontent').style.visibility = 'visible'; } } function LBsetLightbox() { var h = 807; var w = 906; if(_id('Lightbox')) { _id('Lightbox').style.display = 'block'; } else { newE = document.createElement("div"); newE.id = 'Lightbox'; newE.style.position = 'absolute'; newE.style.top = '0px'; newE.style.left = '0px'; newE.style.height = '' + document.documentElement.scrollHeight + 'px'; newE.style.width = '100%'; newE.style.cursor = 'pointer'; newE.style.zIndex = '999'; newE.style.backgroundColor = '#000000'; newE.style.filter = 'alpha(opacity=70)'; newE.style.opacity = '.70'; document.body.insertBefore(newE, document.body.firstChild); } if(_id('LightboxContent')) { e1 = _id('LightboxContent'); e1.style.display = 'block'; e1.style.top = '60px'; e1.style.left = '' + (((document.documentElement.offsetWidth / 2) - parseInt(w / 2)) - document.documentElement.scrollLeft) + 'px'; } else { newA = document.createElement("div"); newA.id = 'LightboxContent'; newA.style.position = 'absolute'; newA.style.top = '60px'; newA.style.left = '' + (((document.documentElement.offsetWidth / 2) - parseInt(w / 2)) - document.documentElement.scrollLeft) + 'px'; newA.style.height = '' + h + 'px'; newA.style.width = '' + w + 'px'; newA.style.zIndex = '1001'; newA.style.background = 'url(/bilder/design/lightBoxBG2.png)'; document.body.insertBefore(newA, document.body.firstChild); } _id('LightboxContent').innerHTML = _id('galleryContent').innerHTML; if(navigator.appName == "Microsoft Internet Explorer") { _id('Lightbox').attachEvent('onclick', LBcloseLightbox); } else { _id('Lightbox').addEventListener('click', LBcloseLightbox,false); } } function LBcloseLightbox() { _id('Lightbox').style.display = 'none'; _id('LightboxContent').style.display = 'none'; _id('LightboxContent').innerHTML = ''; if (document.getElementById('flashcontent')) { document.getElementById('flashcontent').style.visibility = 'visible'; } } var oldPic = ''; var oldMargin = 0; var oldPicCount = 1; function thumbClick(e, m){ _id('thumb_'+oldPic+'').style.display = 'block'; _id('pic_'+oldPic+'').style.zIndex = '99990'; _id('galleryPicText_'+_id('thumb_'+oldPic+'').parentNode.id.replace('t_', '')+'').style.display = 'none'; SetOpacity(_id(''+e.id.replace('thumb_', 'pic_')+''),100); if(oldMargin <= m){moveMarginLeft(oldMargin, m, e);} else {moveMarginRight(oldMargin, m, e);} _id('galleryPicText_'+e.parentNode.id.replace('t_', '')+'').style.display = 'block'; fadeOutPic(_id('pic_'+oldPic+''), 100); oldPic = e.id.replace('thumb_', ''); oldMargin = m; oldPicCount = e.parentNode.id.replace('t_', ''); } function LBNext() { if(_id('t_'+(parseInt(oldPicCount) + 1)+'')) { thumbClick(_id('t_'+(parseInt(oldPicCount) + 1)+'').firstChild, (parseInt(oldPicCount) * 79)); } } function LBPrev() { if(_id('t_'+(parseInt(oldPicCount) - 1)+'')) { thumbClick(_id('t_'+(parseInt(oldPicCount) - 1)+'').firstChild, ((parseInt(oldPicCount) * 79) - 158)); } } function moveMarginLeft(m,m2,e2){var e = _id('galleryThumbMover'); if(m>=m2){e.style.marginLeft='-'+m2+'px';e2.style.display='none';} else{e.style.marginLeft='-'+m+'px';m=m+79;setTimeout(function(){moveMarginLeft(m,m2,e2)},40);} } function moveMarginRight(m,m2,e2){var e = _id('galleryThumbMover'); if(m<=m2){e.style.marginLeft='-'+m2+'px';e2.style.display='none';} else{e.style.marginLeft='-'+m+'px';m=m-79;setTimeout(function(){moveMarginRight(m,m2,e2)},40);} } function fadeOutPic(e,f){if(f<=0){SetOpacity(e,0);e.style.zIndex=1;}else{SetOpacity(e,f);f-=15;setTimeout(function(){fadeOutPic(e,f)},30);}}