$(document).ready(function() { $.ajax({ url: '/ajax/flickr.asp', cache: false, dataType: "html", async: true, success: function(data) { $("#flickr .content").html(data); makeFlickrLinks(); }, error: function() { $("#flickr .content .information").html("Begäran gjorde timeout"); } }); $.ajax({ url: '/ajax/youtube.asp', cache: false, dataType: "html", async: true, success: function(data) { $("#youtube .content").html(data); makeYoutubeLinks(); }, error: function() { $("#youtube .content .information").html("Begäran gjorde timeout"); } }); $.ajax({ url: '/ajax/bloggar.asp', cache: false, dataType: "html", async: true, success: function(data) { $("#bloggar .content").html(data); }, error: function() { $("#bloggar .content .information").html("Begäran gjorde timeout"); } }); makeYoutubeLinks(); makeFlickrLinks(); makeSMNavigation(); }); function makeYoutubeLinks() { $(".lightbox_youtube").colorbox({ inline: false, iframe:true, innerWidth:"640px", innerHeight:"480px", close: "Stäng" }); } function makeFlickrLinks() { $('.flickrlink').each(function(i){ $(this).colorbox({ inline: true, href: ".userdata:eq(" + i + ")", initialWidth: "320", initialHeight: "280", opacity: 0.9, speed: 400, transition: "elastic", rel: "flickr", current: "{current} av {total}", next: ">", previous: "<", close: "Stäng" }); }); } function makeSMNavigation() { $(".btn_prev").click(function() { var target = "#" + $(this).parent().parent().attr("id"); $(target + " .content .data:first").hide(); var movePost = $(target + " .content .data:last"); $(target + " .content .data:last").remove(); $(movePost).prependTo($(target + " .content")); $(target + " .content .data:first").show(); makeFlickrLinks(); makeYoutubeLinks(); }); $(".btn_next").click(function() { var target = "#" + $(this).parent().parent().attr("id"); var movePost = $(target + " .content .data:first"); $(target + " .content .data:first").remove(); $(movePost).appendTo($(target + " .content")); $(target + " .content .data:last").hide(); $(target + " .content .data:first").show(); makeFlickrLinks(); makeYoutubeLinks(); }); } 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('bannerleft').style.display = 'none'; _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; } } 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 = '100px'; 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 = '100px'; 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/gallery/lightbox_bg.gif)'; 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('bannerleft').style.display = 'block'; _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 = 667; var w = 806; 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 = '100px'; 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 = '100px'; 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/gallery/lightbox_bg.gif)'; 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);}} function visaKonferensFormular() { $('#indexFormular').slideUp("slow", function() { $('#indexFormularHeaderP2').hide(); $('#indexFormularHeaderP1').show(); $('#indexFormularBody2').hide(); $('#indexFormularBody').show(); $('#link_konferens').hide(); $('#link_ring').show(); $('#indexFormular').slideDown("slow"); }); } function visaRingFormular() { $('#indexFormular').slideUp("slow", function() { $('#indexFormularHeaderP1').hide(); $('#indexFormularHeaderP2').show(); $('#indexFormularBody').hide(); $('#indexFormularBody2').show(); $('#link_ring').hide(); $('#link_konferens').show(); $('#indexFormular').slideDown("slow"); }); } function visaKonferensFormular2() { $('#infoFormular').slideUp("slow", function() { $('#infoFormularHeaderP2').hide(); $('#infoFormularHeaderP1').show(); $('#infoFormularBody2').hide(); $('#infoFormularBody').show(); $('#link_konferens').hide(); $('#link_ring').show(); $('#infoFormular').slideDown("slow"); }); } function visaRingFormular2() { $('#infoFormular').slideUp("slow", function() { $('#infoFormularHeaderP1').hide(); $('#infoFormularHeaderP2').show(); $('#infoFormularBody').hide(); $('#infoFormularBody2').show(); $('#link_ring').hide(); $('#link_konferens').show(); $('#infoFormular').slideDown("slow"); }); }