/*
Copyright © 2009 VReplay Studio.
*/

function vreplay_main_ini(){$("#footer").after('<span id="after-footer-preload" style="display: none;"><img src="/content/images/common/indicator.gif" alt="" style="display: none;" /><img src="/content/images/popup/indicator.gif" alt="" style="display: none;" /></span>');$("#after-footer-preload").hide();var g="html, body";$("html, body").each(function(){var j=$(this).attr("scrollTop");$(this).attr("scrollTop",j+1);if($(this).attr("scrollTop")==j+1){g=this.nodeName.toLowerCase();$(this).attr("scrollTop",j);return false}});function b(j){if(e==0){$(g).stop().animate({scrollTop:0},500);if(j.length>0){var k=$("#"+j).attr("href")+" .popup-rlo"}else{var k=$(this).attr("href")+" .popup-rlo"}if(typeof document.body.style.maxHeight==="undefined"){$("html, body").css({height:"100%"});$("html").css({"overflow-x":"hidden"})}$("#popup-background").show();$("#popup").append('<div id="popup-loader"><img src="/content/images/popup/indicator.gif" alt="One moment please..." /></div><div id="popup-content"></div>');$("#popup-close").css({visibility:"hidden"});$("#popup-close,#popup-content").hide();$("#popup").css({height:"56px"});$("#popup").slideDown("fast",function(){$("#popup-content").load(k,"",function(){$("#popup-loader").fadeOut("slow",function(){$("#popup").animate({height:"440px"},"normal",function(){$("#popup-close").css({visibility:"visible"});$("#popup-close,#popup-content").fadeIn("slow");e=1;$(".magic-opa").mouseenter(function(){$(this).stop().animate({opacity:0.3},500)}).mouseleave(function(){$(this).stop().animate({opacity:1},500)});$('a[href$="#contact"]').click(function(){f();a();return false});$(".oitp").click(function(){var l=$(this).attr("href")+" #popup-content-entry";$("#popup-right").load(l,"",function(){$(".magic-opa").mouseenter(function(){$(this).stop().animate({opacity:0.3},500)}).mouseleave(function(){$(this).stop().animate({opacity:1},500)});$('a[href$="#contact"]').click(function(){f();a();return false})});return false})})})})})}return false}function f(){if(e==1){$("#popup-loader,#popup-content").remove();$("#popup-background").hide();$("#popup").fadeOut("slow",function(){e=0});if(typeof document.body.style.maxHeight==="undefined"){$("html, body").css({height:"auto"});$("html").css({"overflow-x":""})}}return false}function a(){$("#contact-form").slideDown("slow",function(){$(g).stop().animate({scrollTop:$("#contact").offset().top},500)})}$(".oiad, .oiad a").attr("target","_blank");$("body").append('<div id="popup-background"></div><div id="popup"><a id="popup-close" href="#"><img src="/content/images/popup/close.gif" alt="Close" /></a></div>');$("#popup-background").hide();$("#popup").hide();var e=0;$(".go-popup").click(b);$("#popup-close,#popup-background").click(f);var c=window.location.hash.substr(1);if(c=="terms-of-service"||c=="privacy-policy"||c=="wpw"){b(c)}$("#contact").css({border:"none"});$("#contact-details").wrap('<div id="contact-details-wrapper"></div>');$("#contact-form").hide();$('a[href="#contact"]').click(function(){a();return false});$("#contact-trigger").click(function(){$("#contact-form").slideToggle("slow",function(){if($("#contact-form").is(":visible")){$(g).stop().animate({scrollTop:$("#contact").offset().top},500)}});return false});if(c=="contact"){a()}if(($(":input#fo-message").val().length==0)&&($("input#fo-name").val()=="")){$("#fo-g-2 input").css({visibility:"hidden"});$("#fo-g-2").hide()}else{$("#contact-aside").css({opacity:"0.05"})}$(":input#fo-message").focus(function(){if(!$("#fo-g-2").is(":visible")){$("#contact-aside").animate({opacity:0.05},500,function(){$("#fo-g-2 input").css({visibility:"visible"});$("#fo-g-2").slideDown("slow")})}});$("#fo-submit-wrapper").append('<span id="fo-submit-wait"><img src="/content/images/common/indicator.gif" alt="One moment please..." /></span><span id="fo-submit-result"></span>');$("#fo-submit-wait,#fo-submit-result").hide();var i={target:"#fo-submit-result",beforeSubmit:h,success:d,url:"/contact-form-processor"};$("#contact-form").ajaxForm(i);function h(){$("#fo-submit-result").hide();$("#fo-submit-wait").show()}function d(){$("#fo-submit-wait").hide();$("#fo-submit-result").fadeIn("slow");$(":input").click(function(){if($("#fo-submit-result").is(":visible")){$("#fo-submit-result").fadeOut("fast")}});if($("#fo-submit-result span").attr("id")=="fo-submit-ok"){$("#contact-form").slideUp("slow")}}$(".showcase img").attr("title","");$(".showcase a").tooltip({bodyHandler:function(){var k,j;k=$(this).find("img");j=k.attr("src").substr(0,k.attr("src").length-5)+"t.jpg";return'<img src="'+j+'" alt="Screenshot of project '+k.attr("alt")+'" />'},delay:500,extraClass:"showcase-tooltip",showURL:false,track:true});$(".magic-opa-showcase img").css({opacity:"0.3"});$(".magic-opa-showcase img").mouseenter(function(){$(this).stop().animate({opacity:1},500)}).mouseleave(function(){$(this).stop().animate({opacity:0.3},500)});$(".magic-opa").mouseenter(function(){$(this).stop().animate({opacity:0.3},500)}).mouseleave(function(){$(this).stop().animate({opacity:1},500)})}$(document).ready(vreplay_main_ini);
