(function($){function History()
{this._curHash='';this._callback=function(hash){};};$.extend(History.prototype,{init:function(callback){this._callback=callback;this._curHash=location.hash;if($.browser.msie){if(this._curHash==''){this._curHash='#';}
$("body").prepend('<iframe id="jQuery_history" style="display: none;"></iframe>');var iframe=$("#jQuery_history")[0].contentWindow.document;iframe.open();iframe.close();iframe.location.hash=this._curHash;}
else if($.browser.safari){this._historyBackStack=[];this._historyBackStack.length=history.length;this._historyForwardStack=[];this._isFirst=true;this._dontCheck=false;}
this._callback(this._curHash.replace(/^#/,''));setInterval(this._check,100);},add:function(hash){this._historyBackStack.push(hash);this._historyForwardStack.length=0;this._isFirst=true;},_check:function(){if($.browser.msie){var ihistory=$("#jQuery_history")[0];var iframe=ihistory.contentDocument||ihistory.contentWindow.document;var current_hash=iframe.location.hash;if(current_hash!=$.history._curHash){location.hash=current_hash;$.history._curHash=current_hash;$.history._callback(current_hash.replace(/^#/,''));}}else if($.browser.safari){if(!$.history._dontCheck){var historyDelta=history.length-$.history._historyBackStack.length;if(historyDelta){$.history._isFirst=false;if(historyDelta<0){for(var i=0;i<Math.abs(historyDelta);i++)$.history._historyForwardStack.unshift($.history._historyBackStack.pop());}else{for(var i=0;i<historyDelta;i++)$.history._historyBackStack.push($.history._historyForwardStack.shift());}
var cachedHash=$.history._historyBackStack[$.history._historyBackStack.length-1];if(cachedHash!=undefined){$.history._curHash=location.hash;$.history._callback(cachedHash);}}else if($.history._historyBackStack[$.history._historyBackStack.length-1]==undefined&&!$.history._isFirst){if(document.URL.indexOf('#')>=0){$.history._callback(document.URL.split('#')[1]);}else{$.history._callback('');}
$.history._isFirst=true;}}}else{var current_hash=location.hash;if(current_hash!=$.history._curHash){$.history._curHash=current_hash;$.history._callback(current_hash.replace(/^#/,''));}}},load:function(hash){var newhash;if($.browser.safari){newhash=hash;}else{newhash='#'+hash;location.hash=newhash;}
this._curHash=newhash;if($.browser.msie){var ihistory=$("#jQuery_history")[0];var iframe=ihistory.contentWindow.document;iframe.open();iframe.close();iframe.location.hash=newhash;this._callback(hash);}
else if($.browser.safari){this._dontCheck=true;this.add(hash);var fn=function(){$.history._dontCheck=false;};window.setTimeout(fn,200);this._callback(hash);location.hash=newhash;}
else{this._callback(hash);}}});$(document).ready(function(){$.history=new History();});})(jQuery);;document.write('<link rel=\"StyleSheet\" href=\"/inc/corejs.css\" type=\"text/css\" media=\"screen\" />')
var backgroundTimeout;var backgroundIndex=0;var backgroundInterval=2000;var backgroundFadeSpeed=3000;var ajaxLoaderTimeout;var currentpage="";var MP3PlayerState="play";google.setOnLoadCallback(function(){$(document).ready(function(){ajaxLinks();newWindowLinks();defaultText();setLasers();backgroundInit();$.history.init(ajaxLoadPage);gallery();playLinks();commentform();mailinglistform();pageJSExecute();});});function getFlashMovie(movieName){if(document.getElementById(movieName)){var isIE=navigator.appName.indexOf("Microsoft")!=-1;return(isIE)?window[movieName]:document[movieName];}else{return false;}}
function selectTrack(selected_mp3_file,selected_mp3_title){if(f=getFlashMovie("flashmp3player")){f.heyFlashSelectTrackFromUser(selected_mp3_file,selected_mp3_title);}}
function pauseTheTrack(){if(f=getFlashMovie("flashmp3player")){f.heyFlashPause();}}
function playTheTrack(){if(f=getFlashMovie("flashmp3player")){f.heyFlashPlay();}}
function setPlayerState(state){MP3PlayerState=state;}
function playLinks(){$(".playMP3").live("click",function(){var mp3=$(this).attr("href");var title=$(this).attr("title");selectTrack(mp3,title);return false;});}
function brightcove(){var flashvars={};var params={};var attributes={id:"brightcoveFlash"};swfobject.embedSWF("/inc/brightcove.swf","brightcoveTarget","551","335","8.0.0.0",null,flashvars,params,attributes);}
function brightcoveEmbed(){if(bc=document.getElementById("brightcoveTarget")){setTimeout("pauseTheTrack()",500);var params={};params.playerID="71225415001";params.publisherID="62612235001";params["@videoList"]="70871958001";params.autoStart="true";params.bgcolor="#4f4262";params.width="550";params.height="630";params.wmode="transparent";params.isVid="true";params.isUI="true";params.optimizedContentLoad="true";params.cacheAMFURL="http://services.brightcove.com/services/messagebroker/amf";var player=brightcove.createElement("object");player.id="playerName";var parameter;for(var i in params){parameter=brightcove.createElement("param");parameter.name=i;parameter.value=params[i];player.appendChild(parameter);}
brightcove.createExperience(player,bc,true);}}
function pageJSExecute(){brightcoveEmbed();var flashvars={xml_file:"/inc/flashplayer/tracks.xml",play_on_load:mp3AutoPlay};var params={wmode:"transparent"};var attributes={id:"flashmp3player"};swfobject.embedSWF("/inc/flashplayer/player.swf","mp3target","500","30","8.0.0.0",null,flashvars,params,attributes);if($("#videoLink").size()>0){swfobject.embedSWF("/inc/anim.swf","videoLink","160","106","9.0.0",null,null,params);}
if($("#clipHolder").size()>0){setTimeout("pauseTheTrack()",500);var flashvars={imagePath:"/inc/clipplayer/video.jpg",videoPath:"http://del.interoute.com/?id=2b24936f-3231-43fe-a045-04115d119316",delivery:"download",autoStart:"true",autoHide:"false",autoHideTime:"2",hideLogo:"true",volAudio:"100",newWidth:"550",newHeight:"389",soundBarColor:"0xB6B6B6",barColor:"0xB6B6B6",barShadowColor:"0xB6B6B6",subbarColor:"0xffffff"};var params={allowFullScreen:"true"};swfobject.embedSWF("/inc/clipplayer/video.swf","clipHolder","550","389","9.0.0",null,flashvars,params);}}
function defaultText(){$(".defaultText").unbind("focus,blur").focus(function(){if($(this).val()==$(this)[0].defaultValue){$(this).val("");}}).blur(function(){if($(this).val()==""){$(this).val($(this)[0].defaultValue);}});}
function newWindowLinks(){$('a.pop').live("click",function(){window.open($(this).attr('href'));return false;});}
function fnE(inarr,text){inarr=inarr.split(",");var out="";for(i=inarr.length-1;i>=0;i--){out+=inarr[i];}
if(text==false||text==""||text==undefined){text=out;}
document.write('<a href="mailto:'+out+'">'+text+'</a>');}
var laserSpeedIn=200;var laserSpeedOut=200;function setLasers(){$("#header").append('<div id="lW1"><b></b></div><div id="lW2"><b></b></div><div id="lW3"><b></b></div><div id="lW4"><b></b></div><div id="lW5"><b></b></div><div id="lW6"><b></b></div><div id="lW7"><b></b></div><div id="lW8"><b></b></div>');$("#header #topNav a.nv1,#header #topNav a.nv2,#header #topNav a.nv3").hover(function(i){var i=$("#header #topNav a").index(this)+1;$("#lW"+i+" b").stop(true,true).animate({top:"350px",left:"350px"},laserSpeedIn);},function(){var i=$("#header #topNav a").index(this)+1;$("#lW"+i+" b").stop(true,true).animate({top:"0px",left:"0px"},laserSpeedOut);});$("#header #topNav a.nv5,#header #topNav a.nv6,#header #topNav a.nv7,#header #topNav a.nv8").hover(function(i){var i=$("#header #topNav a").index(this)+1;$("#lW"+i+" b").stop(true,true).animate({top:"350px",left:"-350px"},laserSpeedIn);},function(){var i=$("#header #topNav a").index(this)+1;$("#lW"+i+" b").stop(true,true).animate({top:"0px",left:"0"},laserSpeedOut);});$("#header #topNav a.nv4").hover(function(i){$("#lW4 b").stop(true,true).animate({top:"350px"},laserSpeedIn);},function(){$("#lW4 b").stop(true,true).animate({top:"0px"},laserSpeedOut);});}
var backgroundImages=new Array('/backgrounds/1.jpg','/backgrounds/2.jpg','/backgrounds/3.jpg','/backgrounds/4.jpg','/backgrounds/5.jpg');function backgroundInit(){$("#clouds").append('<img src="backgrounds/1.jpg" alt="" id="cloudBtm" /><img src="backgrounds/1.jpg" alt="" id="cloudTop" />');backgroundTimeout=setTimeout('background()',backgroundInterval);}
function background(){backgroundIndex++;if(backgroundIndex>backgroundImages.length-1){backgroundIndex=0;}
var newBackground=backgroundImages[backgroundIndex];loadBackground(newBackground,true);}
function loadBackground(src,setLoop){imageObj=new Image();imageObj.onload=function(){$("#cloudTop").hide().attr("src",imageObj.src).fadeIn(backgroundFadeSpeed,function(){$("#cloudBtm").attr("src",imageObj.src);if(setLoop){backgroundTimeout=setTimeout('background()',backgroundInterval);}})}
imageObj.src=src;}
function ajaxLinks(){preloader=new Image();preloader.src="/inc/ajax-loader.png";$("#content").prepend('<div id="ajaxLoader"></div>');$("a.internal,.internal a").live("click",function(){var href=$(this).attr("href");$.history.load(href.replace(/^.*#/,''));return false;});}
function ajaxLoadPage(href){if($("#flashmp3player").size()>0&&MP3PlayerState=="play"){playTheTrack();}
if(/gallery/.test(href)){loadGallery(parseInt(href.split("gallery/")[1]));}else if(href!=currentpage){currentpage=href
var scrollto=scrollto||false;var content=$("#ajaxTarget");content.hide();showLoader();$.ajax({type:"GET",url:href,dataType:'json',data:"mode=ajax",success:function(json){hideLoader();var title=json['title'];var text=json['content'];document.title="Goldfrapp * "+title;if(/(Error)/.test(text)){content.fadeIn();}else{content.html(text).fadeIn();defaultText();pageJSExecute();}}});}else{$("#ajaxTarget").fadeIn();}}
function showLoader(){$("#ajaxLoader").fadeIn(500,function(){$(this).fadeOut(500);ajaxLoaderTimeout=setTimeout("showLoader()",1000);});}
function hideLoader(){clearTimeout(ajaxLoaderTimeout);$("#ajaxLoader").stop().fadeOut(100,function(){$(this).hide();});}
function gallery(){$("body").append('<div id="galleryViewer"><a href="/" id="galleryBack">Back</a><div id="galleryViewerInner"><div id="galleryLoader"></div><div id="galleryViewerInnerTarget"></div></div></div>');$("#galleryBack").live("click",function(){closeGallery();return false;});$("#galleryOverview").live("click",function(){var page=parseInt($(this).attr("href").split("/")[2])
loadGalleryThumbs(page);return false;})
$("#galleryThumbs a").live("click",function(){var i=$(this).attr("href").split("index=")[1];var imgsrc=$(this).attr("href");$("#galleryViewerInnerTarget").fadeOut(500,function(){loadGalleryLargeImages(imgsrc,i);})
$("#galleryViewer").fadeIn();return false;});$("#galleryLargeImages a").live("click",function(){var i=$("#galleryLargeImages a").index(this);$("#currentImage").html(i+1);$("#galleryLargeImages a").removeClass("prev next");$("#galleryLargeImages a:eq("+(i-1)+")").addClass("prev");$("#galleryLargeImages a:eq("+(i+1)+")").addClass("next");$("#galleryLargeImages a:eq("+(i-1)+") img").animate({opacity:"0.3"});$("#galleryLargeImages a:eq("+(i+1)+") img").animate({opacity:"0.3"}).addClass("next");$("#galleryLargeImages a:gt("+(i+1)+") img,#galleryLargeImages a:lt("+(i-1)+") img").animate({opacity:"0"});$("img",this).animate({opacity:"1"});var position=$(this).position();var imageWidth=parseInt($(this).css("width").split("px")[0]);var leftMargin=position.left+(imageWidth/2);$("#galleryLargeImages").animate({marginLeft:-leftMargin+"px"});return false;});}
function loadGallery(page){var page=page||1;$("#cloudTop").stop(true,true);clearTimeout(backgroundTimeout);loadBackground('/backgrounds/6.jpg',false);$("#content").fadeOut(200,function(){$("#header").fadeOut(200,function(){$("#darkClouds").fadeOut(100,function(){document.title="Goldfrapp * Gallery";loadGalleryThumbs(page);});});});}
function closeGallery(){$("#galleryViewer").fadeOut(500,function(){$("#ajaxTarget").show();$("#content,#header,#darkClouds").fadeIn(500);loadBackground('/backgrounds/1.jpg',true);$("#galleryViewerInnerTarget").html("");});}
function loadGalleryThumbs(page){$("#galleryViewer").fadeIn(500,function(){$.ajax({type:"GET",url:"/gallery/"+page,data:"mode=ajax",dataType:'json',success:function(json){$("#galleryLoader").fadeOut(500,function(){$("#galleryViewerInnerTarget").hide().html(json['content']).fadeIn();})}});});}
function loadGalleryLargeImages(selectedImage,i){$.ajax({type:"GET",url:selectedImage,data:"mode=ajax",dataType:'json',success:function(json){$("#galleryLoader").fadeOut(500,function(){$("#galleryViewerInnerTarget").hide().html(json['content']).fadeIn();$("#galleryLargeImages a:eq("+i+")").click()})}});}
function captchacode(){$("#captcha").attr("src",'/securimage/securimage_show.php?'+Math.random());$("#captcha_code").val("");}
function commentform(){$("#refeshcaptcha").live("click",function(){captchacode();return false})
$("#commentform").live("submit",function(){var action=$(this).attr("action");var data=$(this).serialize();$.ajax({type:"POST",url:action+"?mode=ajax",data:data,success:function(msg){if(/(Error)/.test(msg)){alert(msg);captchacode();}else{ajaxLoadPage(action);}}});return false;})}
function mailinglistform(){$("#mailinglistblock").live("submit",function(){var email=$("#email").val();if(email!=null&&email!=""&&/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/.test(email)){var action=$(this).attr("action");ajaxLoadPage(action+"/"+email);}else{alert("Please enter a valid email address");}
return false;});}