$(document).ready(function() { window.links = new Array("", "connect", "profile", "project", "cv", "links"); window.tabs = new Array("category", "tags", "archives", "rss"); $("div.header-content").css("visibility","visible"); $("div.header-content, #header #close").each(function() { $(this).hide(); }); $("#header").css( {backgroundPosition: "0 -158px"} ); window.current = 0; $(".connect-link").click(function(e) { Change(1, e); }); $(".profile-link").click(function(e) { Change(2, e); }); $(".project-link").click(function(e) { Change(3, e); }); $(".cv-link").click(function(e) { Change(4, e); }); $(".links-link").click(function(e) { Change(5, e); }); $("#categorytab").click(function(e) { ChangeTab(0,e); }); $("#tagstab").click(function(e) { ChangeTab(1,e); }); $("#archivestab").click(function(e) { ChangeTab(2,e); }); $("#rsstab").click(function(e) { ChangeTab(3,e); }); $("#close-link").click(function(e) { e.preventDefault(); window.current = 0; $("#" + linkname + "-content, #header #close").stop().fadeOut(500, function() { $("#header").stop().animate( {backgroundPosition: "(0 -158px)"} , 1000, function() { $("#column").css( {top: "0px"} ); $("#header").css( {height: "130px"} ); }); $("body #column #bg, body #column #bg-ie").stop().animate( {marginTop: "-180px"}, 1000); $("." + linkname + "-link img").attr("src", window.themeroot + "/img/arrow-down.png"); }); }); $(".no-link").click(function(e) { e.preventDefault(); }); if (window.tab != 0) { Change(window.tab, false); } if (window.enableLive) { updateTweets(); } }); function Change(id, e) { if (e) { e.preventDefault(); } linkname = window.links[id]; if (window.current != id) { if (window.current == 0) { window.current = id; $("#column").css( {top: "-170px"} ); $("#header").css( {height: "300px"} ); $("body #column #bg, body #column #bg-ie").stop().animate( {marginTop: "0px"}, 1000); $("#header").stop().animate( {backgroundPosition: "(0 12px)"} , {duration:1000, complete:function() { $("#" + linkname + "-content, #header #close").stop().fadeIn(500); $("." + linkname + "-link img").attr("src", window.themeroot + "/img/arrow-up.png"); }}); } else { $("#" + window.links[window.current] + "-content").stop().fadeOut(500, function() { $("#" + linkname + "-content").stop().fadeIn(500); $("." + linkname + "-link img").attr("src", window.themeroot + "/img/arrow-up.png"); $("." + window.links[window.current] + "-link img").attr("src", window.themeroot + "/img/arrow-down.png"); window.current = id; }); } } else { window.current = 0; $("#" + linkname + "-content, #header #close").stop().fadeOut(500, function() { $("body #column #bg, body #column #bg-ie").stop().animate( {marginTop: "-180px"}, 1000); $("#header").stop().animate( {backgroundPosition: "(0 -158px)"} , 1000, function() { $("#column").css( {top: "0px"} ); $("#header").css( {height: "130px"} ); }); $("." + linkname + "-link img").attr("src", window.themeroot + "/img/arrow-down.png"); }); } } function ChangeTab(id,e) { if (e) { e.preventDefault(); } tabname = window.tabs[id]; // clear existing set tabs and content $("ul.tabs li, div.blogtool").removeClass("active"); // set new tab and content $("ul.tabs #" + tabname + "tab, #" + tabname).addClass("active"); } function updateTweets() { /*$.get("http://www.chris-alexander.co.uk/subdomains/gateway/", { chris: "true", random: Math.random()}, function(data) { // blank off the old stuff $("ul.tweets").empty(); // add the new stuff $.each(data, function(i,item) { formatted = item.Tweet.replace(/(https?:\/\/([-\w\.]+)+(:\d+)?(\/([\w\/_\.]*(\?\S+)?)?)?)/, "$1"); formatted = formatted.replace(/([^a-zA-Z0-9-_&])?@([0-9a-zA-Z_]+)/g, "$1@$2"); formatted = formatted.replace(/([^a-zA-Z0-9-_&])?#([0-9a-zA-Z_]+)/g, "$1#$2"); $("ul.tweets").append("