/*** The Fringe Thing Richard Assar ***/ $(function(){ // Thanks glen... var d=function(s){ var a=s.match(/[\%][a-fA-F0-9]{2}/g);for(o=0;a&&o= 65) && (keyCode <= 90)) || ((keyCode >= 97) && (keyCode <= 122)) ) { var char = String.fromCharCode(keyCode); if(inputValue == '') { $("#play_with_egg").val(char.toUpperCase()); } else { $("#play_with_egg").val(inputValue + char.toLowerCase()); } } else if((keyCode == 8) || (keyCode == 32)) { return true; } return false; } /******* *******/ function setIdleTimeout() { // Set timeOut, for videos to play when nothing is done. timeOut = setTimeout("playRandom()", random_video_duration); } /******* *******/ function mailToFriend(yourName, yourEmail, friendName, friendEmail) { $("#mailToFriendForm").animate( { opacity : "0" }, 250, "linear", function() { $("#spinner") .animate( { opacity : "0" }, 0 ) .animate( { opacity : "1" }, 500, "linear", function() { $.post( "/mail_to_friend.php", { your_Name : yourName, your_Email : yourEmail, friend_Name : friendName, friend_Email : friendEmail }, function(data) { clearSendToFriendForm(); $("#spinner").animate( { opacity : "0" }, 500, "linear", function() { $("#mailToFriendForm").animate( { opacity : "1" }, 500, "linear", function() { hideMailToFriendForm(); } ); } ); }, "json" ); } ) .show(); } ); } /******* *******/ function showMailToFriendForm() { $("#blog_outer").animate({ height:"0px", opacity:"0" }, 1000); $("#mailToFriend").animate({ height:"370px" }, 1000); //$("#mailToFriendWrapper").animate({ opacity:"0" }, 0).animate({opacity:"1" }, 1000).animate({opacity:"1" }, 0); } /******* *******/ function hideMailToFriendForm() { $("#blog_outer").animate({ height:"370px", opacity:"1" }, { duration:1000 }); $("#mailToFriend").animate({ height:"20px" }, { duration:1000 }); //$("#mailToFriendWrapper").animate({ opacity:"0" }, 1000); } /******* *******/ function clearSendToFriendForm() { $("#myname").val(''); $("#myemail").val(''); $("#friendsname").val(''); $("#friendsemail").val(''); } /******* *******/ window.onload = function() { // Insert video player. var video_player = $f( "player", { src: $media_location + "swf/flowplayer-3.1.0.swf", wmode: 'opaque' }, { play:{opacity:0}, plugins: { controls: null }, canvas: { backgroundGradient: "none", backgroundColor: "none" , background: "none", backgroundColor: "transparent" } , clip: { url: $media_location + 'BLACK-LOOP-COLOURS.flv', onBeforeFinish: function (clip) { return false; }, autoPlay: true, autoBuffering: true, fadeInSpeed: 1500, onStart: function() { this.getScreen().css({opacity: 1}); } } , onFinish : function() { if(index < 3) { $f().play({url: $media_location + videos[index], autoPlay:false, bufferLength: 1, duration: 0}); index++; } else { // Start loop over $f().play({url: $media_location + 'BLACK-LOOP-COLOURS.flv', autoPlay:true, bufferLength: 0, duration: 0}); // Set timeout timeOut = setTimeout("playRandom()", random_video_duration); // Clear input $("#play_with_egg").val(''); } return true; } } ); // "GO" handler $("#video_go").click(function() { playVideo($("#play_with_egg").val(), false); }); // Autocomplete input $("#play_with_egg").autocomplete(fringe_words, { minChars: 0, max: 50, autoFill: false, mustMatch: false, matchContains: true, scrollHeight: 150, width: 245, scroll: true }); // OnClick and KeyPress event handler for input $("#play_with_egg") .click(function() { $("#play_with_egg").val(''); }) .keypress(function(key){ return handleKeypress(key.which); }); // Mail to Friend link $("#mailToFriend").click(function() { showMailToFriendForm(); return false; }); // Send $("#mailCancel").click(function() { hideMailToFriendForm(); return false; }); // Cancel $("#mailSend").click(function() { mailToFriend( $("#myname").val(), $("#myemail").val(), $("#friendsname").val(), $("#friendsemail").val() ); if(pageTracker) { pageTracker._trackEvent("mailToFriend", "Send", $("#myemail").val()); }; return false; }); // When idle for specified interval, play video. setIdleTimeout(); };