// JavaScript Document var IeAlpha; var IsRuning; var FadeIn; IeAlpha = 100; $(document).ready(function() { $.ajax({ url: '/ajax/facebook.asp', cache: false, dataType: "html", async: true, success: function(data) { $("#facebook .content").html(data); }, error: function() { $("#youtube .content .information").html("Begäran gjorde timeout"); } }); $.ajax({ url: '/ajax/flickr.asp', cache: false, dataType: "html", async: true, success: function(data) { $("#flickr .content").html(data); makeFlickrLinks(); }, error: function() { $("#youtube .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() { $("#youtube .content .information").html("Begäran gjorde timeout"); } }); makeSMNavigation(); }); function submitThisForm(e) { var resultat = testForm(e,attTestas) if (resultat) { document.getElementById("verifyFrm").value = "verified"; e.action = window.location; } return resultat; } function FadeImage(e) { var avskaladURL = document.getElementById('storbild').src; if(IsRuning != 1) { if(document.getElementById('storbild').src.substring(avskaladURL.length-e.length, avskaladURL.length) != e) { IsRuning = 1; document.getElementById('storbild').style.opacity = "1"; t=setInterval("fade('"+e+"')", 10); } } } function fade(e) { if(FadeIn != 1) { IeAlpha-=10; document.getElementById('storbild').style.filter = "alpha(opacity=" + IeAlpha + ")"; currentAlpha = parseFloat(document.getElementById('storbild').style.opacity); document.getElementById('storbild').style.opacity = currentAlpha-0.1; } else { IeAlpha+=10; document.getElementById('storbild').style.filter = "alpha(opacity=" + IeAlpha + ")"; currentAlpha = parseFloat(document.getElementById('storbild').style.opacity); document.getElementById('storbild').style.opacity = currentAlpha+0.1; if(parseFloat(document.getElementById('storbild').style.opacity) == 1) { FadeIn = 0; clearInterval(t); IsRuning = 0; } if(IeAlpha == 100) { FadeIn = 0; clearInterval(t); IsRuning = 0; } } if(parseFloat(document.getElementById('storbild').style.opacity) == 0) { document.getElementById('storbild').src = e; FadeIn = 1; } if(IeAlpha == 0) { document.getElementById('storbild').src = e; FadeIn = 1; } } function makeYoutubeLinks() { $(".lightbox_youtube").colorbox({ inline: false, iframe:true, initialWidth: "320", initialHeight: "280", width:"500px", height:"400px", innerWidth:"500px", innerHeight:"400px" }); } 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: "Nästa", previous: "Förra", 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(); }); }