window.log = function(){
  log.history = log.history || [];
  log.history.push(arguments);
  arguments.callee = arguments.callee.caller;  
  if(this.console) console.log( Array.prototype.slice.call(arguments) );
};

(function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();)b[a]=b[a]||c})(window.console=window.console||{});
(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
(function($){$.fn.delay = function(time, callback){jQuery.fx.step.delay = function(){};return this.animate({delay:1}, time, callback); }})(jQuery);
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type=="mouseenter"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.bind('mouseenter',handleHover).bind('mouseleave',handleHover)}})(jQuery);
(function($){$.extend($.fx.step, { backgroundPosition: function(fx) { if (fx.state === 0 && typeof fx.end == 'string') { if(navigator.appName == 'Microsoft Internet Explorer') {var start = $.curCSS(fx.elem,'backgroundPositionX'); start +=  ' '; start += $.curCSS(fx.elem,'backgroundPositionY'); } else { var start = $.curCSS(fx.elem,'backgroundPosition');} start = toArray(start); fx.start = [start[0],start[2]]; var end = toArray(fx.end); fx.end = [end[0],end[2]]; fx.unit = [end[1],end[3]]; }var nowPosX = []; nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0]; nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1]; function toArray(strg){ strg = strg.replace(/left|top/g,'0px'); strg = strg.replace(/right|bottom/g,'100%');strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2"); var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];}}});})(jQuery);
(function($){$.extend(jQuery.browser, { iOS : navigator.userAgent.toLowerCase().match(/iP(hone|ad|od)/i) } );})(jQuery);
(function(){var a=document.all,b="http://www.adobe.com/go/getflashplayer",c=typeof jQuery=="function",d=/(\d+)[^\d]+(\d+)[^\d]*(\d*)/,e={width:"100%",height:"100%",id:"_"+(""+Math.random()).slice(9),allowfullscreen:!0,allowscriptaccess:"always",quality:"high",version:[3,0],onFail:null,expressInstall:null,w3c:!1,cachebusting:!1};window.attachEvent&&window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){},__flash_savedUnloadHandler=function(){}});function f(a,b){if(b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function g(a,b){var c=[];for(var d in a)a.hasOwnProperty(d)&&(c[d]=b(a[d]));return c}window.flashembed=function(a,b,c){typeof a=="string"&&(a=document.getElementById(a.replace("#","")));if(a){typeof b=="string"&&(b={src:b});return new j(a,f(f({},e),b),c)}};var h=f(window.flashembed,{conf:e,getVersion:function(){var a,b;try{b=navigator.plugins["Shockwave Flash"].description.slice(16)}catch(c){try{a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"),b=a&&a.GetVariable("$version")}catch(e){try{a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"),b=a&&a.GetVariable("$version")}catch(f){}}}b=d.exec(b);return b?[b[1],b[3]]:[0,0]},asString:function(a){if(a===null||a===undefined)return null;var b=typeof a;b=="object"&&a.push&&(b="array");switch(b){case"string":a=a.replace(new RegExp("([\"\\\\])","g"),"\\$1"),a=a.replace(/^\s?(\d+\.?\d+)%/,"$1pct");return"\""+a+"\"";case"array":return"["+g(a,function(a){return h.asString(a)}).join(",")+"]";case"function":return"\"function()\"";case"object":var c=[];for(var d in a)a.hasOwnProperty(d)&&c.push("\""+d+"\":"+h.asString(a[d]));return"{"+c.join(",")+"}"}return String(a).replace(/\s/g," ").replace(/\'/g,"\"")},getHTML:function(b,c){b=f({},b);var d="<object width=\""+b.width+"\" height=\""+b.height+"\" id=\""+b.id+"\" name=\""+b.id+"\"";b.cachebusting&&(b.src+=(b.src.indexOf("?")!=-1?"&":"?")+Math.random()),b.w3c||!a?d+=" data=\""+b.src+"\" type=\"application/x-shockwave-flash\"":d+=" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"",d+=">";if(b.w3c||a)d+="<param name=\"movie\" value=\""+b.src+"\" />";b.width=b.height=b.id=b.w3c=b.src=null,b.onFail=b.version=b.expressInstall=null;for(var e in b)b[e]&&(d+="<param name=\""+e+"\" value=\""+b[e]+"\" />");var g="";if(c){for(var i in c)if(c[i]){var j=c[i];g+=i+"="+(/function|object/.test(typeof j)?h.asString(j):j)+"&"}g=g.slice(0,-1),d+="<param name=\"flashvars\" value='"+g+"' />"}d+="</object>";return d},isSupported:function(a){return i[0]>a[0]||i[0]==a[0]&&i[1]>=a[1]}}),i=h.getVersion();function j(c,d,e){if(h.isSupported(d.version))c.innerHTML=h.getHTML(d,e);else if(d.expressInstall&&h.isSupported([6,65]))c.innerHTML=h.getHTML(f(d,{src:d.expressInstall}),{MMredirectURL:location.href,MMplayerType:"PlugIn",MMdoctitle:document.title});else{c.innerHTML.replace(/\s/g,"")||(c.innerHTML="<h2>Flash version "+d.version+" or greater is required</h2><h3>"+(i[0]>0?"Your version is "+i:"You have no flash plugin installed")+"</h3>"+(c.tagName=="A"?"<p>Click here to download latest version</p>":"<p>Download latest version from <a href='"+b+"'>here</a></p>"),c.tagName=="A"&&(c.onclick=function(){location.href=b}));if(d.onFail){var g=d.onFail.call(this);typeof g=="string"&&(c.innerHTML=g)}}a&&(window[d.id]=document.getElementById(d.id)),f(this,{getRoot:function(){return c},getOptions:function(){return d},getConf:function(){return e},getApi:function(){return c.firstChild}})}c&&(jQuery.tools=jQuery.tools||{version:"@VERSION"},jQuery.tools.flashembed={conf:e},jQuery.fn.flashembed=function(a,b){return this.each(function(){$(this).data("flashembed",flashembed(this,a,b))})})})();
(function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){r||l(a());n()}).attr("src",r||"javascript:0").insertAfter("body")[0].contentWindow;h.onpropertychange=function(){try{if(event.propertyName==="title"){q.document.title=h.title}}catch(s){}}}};j.stop=k;o=function(){return a(q.location.href)};l=function(v,s){var u=q.document,t=$.fn[c].domain;if(v!==s){u.title=h.title;u.open();t&&u.write('<script>document.domain="'+t+'"<\/script>');u.close();q.location.hash=v}}})();return j})()})(jQuery,this);
(function($){jQuery.easing['jswing'] = jQuery.easing['swing'];jQuery.extend( jQuery.easing, {def: 'easeOutQuad',easeInQuad: function (x, t, b, c, d) {return c*(t/=d)*t + b;},easeOutQuad: function (x, t, b, c, d) {return -c *(t/=d)*(t-2) + b;},easeInOutQuad: function (x, t, b, c, d) {if ((t/=d/2) < 1) return c/2*t*t + b;return -c/2 * ((--t)*(t-2) - 1) + b;},easeInCubic: function (x, t, b, c, d) {return c*(t/=d)*t*t + b;},easeOutCubic: function (x, t, b, c, d) {return c*((t=t/d-1)*t*t + 1) + b;},easeInOutCubic: function (x, t, b, c, d) {if ((t/=d/2) < 1) return c/2*t*t*t + b;return c/2*((t-=2)*t*t + 2) + b;},easeInQuart: function (x, t, b, c, d) {return c*(t/=d)*t*t*t + b;},easeOutQuart: function (x, t, b, c, d) {return -c * ((t=t/d-1)*t*t*t - 1) + b;},easeInOutQuart: function (x, t, b, c, d) {if ((t/=d/2) < 1) return c/2*t*t*t*t + b;return -c/2 * ((t-=2)*t*t*t - 2) + b;},easeInQuint: function (x, t, b, c, d) {return c*(t/=d)*t*t*t*t + b;},easeOutQuint: function (x, t, b, c, d) {return c*((t=t/d-1)*t*t*t*t + 1) + b;},easeInOutQuint: function (x, t, b, c, d) {if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;return c/2*((t-=2)*t*t*t*t + 2) + b;},easeInSine: function (x, t, b, c, d) {return -c * Math.cos(t/d * (Math.PI/2)) + c + b;},easeOutSine: function (x, t, b, c, d) {return c * Math.sin(t/d * (Math.PI/2)) + b;},easeInOutSine: function (x, t, b, c, d) {return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;},easeInExpo: function (x, t, b, c, d) {return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;},easeOutExpo: function (x, t, b, c, d) {return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;},easeInOutExpo: function (x, t, b, c, d) {if (t==0) return b;if (t==d) return b+c;if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;},easeInCirc: function (x, t, b, c, d) {return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;},easeOutCirc: function (x, t, b, c, d) {return c * Math.sqrt(1 - (t=t/d-1)*t) + b;},easeInOutCirc: function (x, t, b, c, d) {if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;},easeInElastic: function (x, t, b, c, d) {var s=1.70158;var p=0;var a=c;if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;if (a < Math.abs(c)) { a=c; var s=p/4; }else var s = p/(2*Math.PI) * Math.asin (c/a);return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;},easeOutElastic: function (x, t, b, c, d) {var s=1.70158;var p=0;var a=c;if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;if (a < Math.abs(c)) { a=c; var s=p/4; }else var s = p/(2*Math.PI) * Math.asin (c/a);return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;},easeInOutElastic: function (x, t, b, c, d) {var s=1.70158;var p=0;var a=c;if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);if (a < Math.abs(c)) { a=c; var s=p/4; }else var s = p/(2*Math.PI) * Math.asin (c/a);if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;},easeInBack: function (x, t, b, c, d, s) {if (s == undefined) s = 1.70158;return c*(t/=d)*t*((s+1)*t - s) + b;},easeOutBack: function (x, t, b, c, d, s) {if (s == undefined) s = 1.70158;return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;},easeInOutBack: function (x, t, b, c, d, s) {if (s == undefined) s = 1.70158; if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;},easeInBounce: function (x, t, b, c, d) {return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;},easeOutBounce: function (x, t, b, c, d) {if ((t/=d) < (1/2.75)) {return c*(7.5625*t*t) + b;} else if (t < (2/2.75)) {return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;} else if (t < (2.5/2.75)) {return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;} else {return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;}},easeInOutBounce: function (x, t, b, c, d) {if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;}}); })(jQuery);

var QueryLoader = {overlay: "",loadBar: "",preloader: "",items: new Array(),doneStatus: 0,doneNow: 0,selectorPreload: "body",ieLoadFixTime: 2000,ieTimeout: "",init: function() {if (navigator.userAgent.match(/MSIE (\d+(?:\.\d+)+(?:b\d*)?)/) == "MSIE 6.0,6.0") {return false;}if (QueryLoader.selectorPreload == "body") {QueryLoader.spawnLoader();QueryLoader.getImages(QueryLoader.selectorPreload);QueryLoader.createPreloading();} else {$(document).ready(function() {QueryLoader.spawnLoader();QueryLoader.getImages(QueryLoader.selectorPreload);QueryLoader.createPreloading();});}QueryLoader.ieTimeout = setTimeout("QueryLoader.ieLoadFix()", QueryLoader.ieLoadFixTime);},ieLoadFix: function() {var ie = navigator.userAgent.match(/MSIE (\d+(?:\.\d+)+(?:b\d*)?)/);if (ie[0].match("MSIE")) {while ((100 / QueryLoader.doneStatus) * QueryLoader.doneNow < 100) {QueryLoader.imgCallback();}}},imgCallback: function() {QueryLoader.doneNow ++;QueryLoader.animateLoader();},getImages: function(selector) {var everything = $(selector).find("*:not(script)").each(function() {var url = "";if ($(this).css("background-image") != "none") {var url = $(this).css("background-image");} else if (typeof($(this).attr("src")) != "undefined" && $(this).attr("tagName").toLowerCase() == "img") {var url = $(this).attr("src");}url = url.replace("url(\"", "");url = url.replace("url(", "");url = url.replace("\")", "");url = url.replace(")", "");if (url.length > 0){QueryLoader.items.push(url);}});},createPreloading: function(){QueryLoader.preloader = $("<div></div>").appendTo(QueryLoader.selectorPreload);$(QueryLoader.preloader).css({height:"0px",width:"0px",overflow:"hidden"});var length = QueryLoader.items.length; QueryLoader.doneStatus = length;for (var i = 0; i < length; i++) {var imgLoad = $("<img></img>");$(imgLoad).attr("src", QueryLoader.items[i]);$(imgLoad).unbind("load");$(imgLoad).bind("load", function() {QueryLoader.imgCallback();});$(imgLoad).appendTo($(QueryLoader.preloader));}},spawnLoader: function() {if (QueryLoader.selectorPreload == "body") {var height = $(window).height();var width = $(window).width();var position = "fixed";} else {var height = $(QueryLoader.selectorPreload).outerHeight();var width = $(QueryLoader.selectorPreload).outerWidth();var position = "absolute";}var left = $(QueryLoader.selectorPreload).offset()['left'];var top =  $(QueryLoader.selectorPreload).offset()['top'];QueryLoader.overlay = $("<div></div>").appendTo($(QueryLoader.selectorPreload));$(QueryLoader.overlay).addClass("QOverlay");$(QueryLoader.overlay).css({position: position,top: top,left: left,width: width + "px",height: height + "px"});QueryLoader.loadBar = $("<div></div>").appendTo($(QueryLoader.overlay));$(QueryLoader.loadBar).addClass("QLoader");var t;if(jQuery.browser.mozilla){t = 8;}else{t = 4;}$(QueryLoader.loadBar).css({position: "relative",top: t,width: "0%"});$("body").addClass("bg");},animateLoader: function() {var perc = (100 / QueryLoader.doneStatus) * QueryLoader.doneNow;if (perc > 99) {$(QueryLoader.loadBar).stop().animate({width: perc + "%"}, 500, "linear", function() {QueryLoader.doneLoad();});} else {$(QueryLoader.loadBar).stop().animate({width: perc + "%"}, 500, "linear", function() { }); }}, doneLoad: function() { clearTimeout(QueryLoader.ieTimeout); if (QueryLoader.selectorPreload == "body") { var height = $(window).height(); } else { var height = $(QueryLoader.selectorPreload).outerHeight(); } $(QueryLoader.loadBar).animate({ height: height + "px" }, 500, "linear", function() { $(QueryLoader.overlay)
    .delay(500).fadeOut(1500, function(){ $(QueryLoader.preloader).remove(); }); $("#wrapper").css("visibility","visible");$("footer").css("visibility","visible");});}}

function setUrlVars(url){var vars = [], hash;var hashes = url.slice(url.indexOf('?') + 1).split('&');for(var i = 0; i < hashes.length; i++){hash = hashes[i].split('=');vars.push(hash[0]);vars[hash[0]] = hash[1];}

    window.videoWidth   = vars['width'];
    window.videoHeight  = vars['height'];
    window.videoPath    = vars['source'];

    return vars;
}



var timerSplash, actualSplash, maxSplash;
var alternativeImage = new Image();
var jash;



$(document).ready(function(){
    
    jQuery.easing.def = "easeOutQuart";

    flashembed("flash-icon", {src: "_swf/tooltip.swf", wmode: 'transparent'});

    //--------------------------------------------------------------------------------------------------
    // IE png hack
    (function(){        
        var i;
        for (i in document.images) {
            if (document.images[i].src) {
                var imgSrc = document.images[i].src;
                if (imgSrc.substr(imgSrc.length-4) === '.png' || imgSrc.substr(imgSrc.length-4) === '.PNG') {
                    document.images[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='crop',src='" + imgSrc + "')";
                }
            }
        }
    })();
    
    //-------------------------------------------------------------------------------------------------
    
    if($('body').hasClass('homepage')){
                
        if($('body').hasClass('loaded')){
            
            $("body").addClass("bg");
            $("#wrapper").css("visibility","visible");
            $("footer").css("visibility","visible");
            
        }else{
            
            // site preloader
            QueryLoader.init();
        }
        
    }else{
        
        $("body").addClass("bg");
        $("#wrapper").css("visibility","visible");
        $("footer").css("visibility","visible");
        
    }
    
    var timer = setInterval(function(){        
        $('#bottom ul li a').eq(1).fadeTo(500, 0, function(){
            $(this).html() == "¿sabias que?" ? $(this).html("did you know?") : $(this).html("¿sabias que?");
            $(this).delay(50).fadeTo(500,1);
        });
    }, 6000);
    
    //-------------------------------------------------------------------------------------------------
    
    // homepage
    (function(){
        
        if($('body').hasClass('homepage')){
            
            var promo,caption,corner;
            var slider = $('.slider');
            var opened = false;
            
            slider.click(function(){
                window.location.href = $(this).find('a').eq(0).attr('href');
                return;
            });
            
            function show(s){             
                promo = s.find('.promo-content');
                caption = s.find('.slider-caption');
                corner = s.find('.corner-tiny');

                promo
                    .stop()
                    .fadeTo(0,0)
                    .show()
                    .fadeTo(1000,.9);

                caption.stop().animate({ width:11 },500, function(){
                    corner.fadeTo(250,0);
                    caption.fadeTo(200,0);
                });
            }
            
            function hide(s){
                corner.fadeTo(100,1);

                caption.stop().animate({ width:308, opacity:1 },500);
                
                if($.browser.iOS){                   
                    s.find('.promo-content').fadeTo(500,0, function(){
                        $(this).hide();
                    });
                }else{
                    promo.fadeTo(1500,0, function(){
                        $(this).hide();
                    });
                }
            }
            
            if($.browser.iOS){
                slider.click(function() {
                    if(!opened){
                        opened = true;
                        show($(this));
                    }else{
                        hide($(this).parent());
                        opened = false;
                    }
                });
            }else{
                slider.hoverIntent({
                    over: function(){ 
                        show($(this));
                    },
                    out: function(){
                        hide($(this));
                    }, 
                    timeout: 20, 
                    interval:50                    
                });
            }
            
            // splashes
            var lis = $('#buttons li');
            maxSplash = lis.size();
            var splashes = []; var obj;
            
            var _title = $('#caption #title h1');
            var _description = $('#caption #description');
            var _brand = $('#brand');
            var _splash = $('#splash');
            
            var PLAYER_PATH = "_swf/videoplayer.swf";
            var wasVideoPlayed = false;
            var wasVideoContentSwitched = false;
            var DEFAULT_TIME = 500;
            
            if($('body').hasClass('loaded')){ wasVideoPlayed = true; }
            
            alternativeImage.src = lis.eq(0).find('span.flash').attr('title');
            
            _description.slideToggle(0);
            
            //$('#buttons').fadeOut(0);
            
            lis.each(function(n){
                splashes.push({
                    title       : $(this).find(".title").html(),
                    description : $(this).find(".description").html(),
                    brand       : $(this).find(".brand").html(),
                    content     : $(this).find(".content").hasClass("flash") ? $(this).find(".content").text() : $(this).find(".content").html() 
                });
            });
            
            function putContent(id){
               _title.html(splashes[id].title);

               _description
                    .find('p')
                    .html('')
                    .append(splashes[id].description)
                    .end()
                    .slideToggle(750);

                _brand.html(splashes[id].brand).delay(DEFAULT_TIME).fadeIn(100,function(){
                    _splash.find('img').fadeTo(DEFAULT_TIME, 1, function(){ });
                });

                if(!$.browser.iOS){ $('#caption').fadeTo(DEFAULT_TIME, 1);}
                
                if(jQuery.browser.msie){ _description.fadeTo(0, .9);}
                
                if($.browser.iOS && id==0){
                    splashes[id].content = alternativeImage;
                }else if(wasVideoPlayed){
                    if(!wasVideoContentSwitched){
                        wasVideoContentSwitched = true;
                        splashes[0].content = alternativeImage;
                    }
                }
                
                _splash
                    .html(splashes[id].content)
                    .find('img')
                    .fadeTo(0,0);
            }
            
            function hideSplash(n){
                _brand.fadeOut(DEFAULT_TIME*.5);
                
                $('#caption #description').fadeOut(DEFAULT_TIME*.5, function(){                  
                    _title.fadeTo(DEFAULT_TIME*.5, 1, function(){
                        if(_splash.find('img').html() == null){
                            wasVideoPlayed = true;
                            
                            _splash.find('object').remove().end().append('<img>');
                            
                            putContent(n);
                        }else{                            
                            _splash.find('img').fadeTo(DEFAULT_TIME,0, function(){
                                putContent(n);
                            });
                        }                        
                    });                    
                });                
            }
            
            lis.each(function(n){           
                $(this).click(function(e){
                    stopTimer();
                    
                    actualSplash = n;

                    lis.fadeTo(0,1);

                    $(this).fadeTo(0,.4)
                    
                    e.preventDefault();
                    
                    if(!wasVideoPlayed){
                        if(n==0){                        
                            if(!$.browser.iOS){                            
                                $('#caption').fadeTo(DEFAULT_TIME, 0);

                                _splash.find('img').fadeTo(DEFAULT_TIME+200,0, function(){                                
                                    flashembed("splash", PLAYER_PATH, { path: 'video1.flv' });
                                });

                                return;                            
                            }
                        }
                    }
                    
                    hideSplash(n);
                    
                    timerSplash = setInterval("loadNext()",12000);
                });
            });
            
            lis.eq(0).click();   
        }        
    })();
    
    //-------------------------------------------------------------------------------------------------
    
    // bottom boxes
    (function(){

        if($('#boxes-holder').size()>0){
            
            var actual0 = -1;
            var actual1 = -1;
            var actual2 = -1;
            var z = 500;
            var items0 = $('.box').eq(0).find('img').size();
            var items1 = $('.box').eq(1).find('img').size();
            var items2 = $('.box').eq(2).find('img').size();
                    
            changePicture = function(){    
                actual0<items0-1 ? actual0++ : actual0 = 0; actual1<items1-1 ? actual1++ : actual1 = 0; actual2<items2-1 ? actual2++ : actual2 = 0;
                
                if(items0>1){$('.box').eq(0).find('img').fadeTo(500, 0);$('.box').eq(0).find('img').eq(actual0).css({"z-index": z+actual0}).fadeTo(1000, 1);}
                if(items1>1){$('.box').eq(1).find('img').fadeTo(600, 0);$('.box').eq(1).find('img').eq(actual1).css({"z-index": z+actual1}).fadeTo(1100, 1);}
                if(items2>1){$('.box').eq(2).find('img').fadeTo(700, 0);$('.box').eq(2).find('img').eq(actual2).css({"z-index": z+actual2}).fadeTo(1200, 1);}
                
                setTimeout(changePicture, 8000);
            }    
            
            changePicture();   
        }
    })();
    
    //-------------------------------------------------------------------------------------------------

    //landing nav hover
    (function(){

        if( $('body').hasClass('landing') || $('body').hasClass('sales') || $('body').hasClass('content')  ){
            
            var target = $('#landing-sales-collateral, #landing-content', '#landing-left')
            
            target.hoverIntent({              
                over: function(){ 
                    if(!$(this).hasClass('selected')){
                        $(this).addClass('landing-hover').find('h3').animate({paddingLeft:36},250);
                    }
                },
                out: function(){
                    if(!$(this).hasClass('selected')){
                        $(this).removeClass('landing-hover').find('h3').animate({paddingLeft:30},250);
                    }
                }, 
                timeout: 50, 
                interval:100
                
            });
            
            // iternal slideshow
            
            (function(){
                
                var buttons = $('#landing-buttons-holder li');
                var len = buttons.size();
                var idx, clicked, img;
                var actual = 0;
                var timer;
                
                $('#landing-buttons').css('width', len*22);
                
                if(len==1){ buttons.hide();}
                
                buttons.hide();
                
                $(buttons, $('#landing-buttons-holder')).click(function(e){
                    e.preventDefault();
                    
                    clicked = $(this);
                    
                    buttons.fadeTo(0,1);
                
                    if(timer){ clearTimeout(timer); }
                
                    idx = buttons.index($(this));
                
                    actual = idx;
                    
                    if(len > 1){
                        buttons.fadeTo(0,1);
                        buttons.eq(idx).fadeTo(200,.4);
                    }
                
                    img = new Image(); 
                    img.src = clicked.find('img').eq(1).attr('src');

                    $('#landing-splash').html(img).fadeTo(0,0, function(){                    
                        $(this).fadeTo(2000, 1);
                        
                        if(len!=1){                        
                            timer = setTimeout(function(){
                                actual < len-1 ? actual+=1 : actual = 0;
                        
                                buttons.eq(actual).click();                        
                            },7000);                        
                        }
                    });
                });
                
                buttons.eq(0).click();
                
            })();          
        }
    })();
    
    //-------------------------------------------------------------------------------------------------
    
    //sales collateral vertical tabs
    (function(t){
        var t = $(t); var tabs = $('#content section .right div.tab');
        
        t.click(function(e) {
            e.preventDefault();
            
            t.removeClass('selected');

            $(this).addClass("selected");
            
            tabs.removeClass('visible');
            tabs.eq(t.index($(this))).addClass('visible');
        });
    })('#content section .left ul li');
    
    //-------------------------------------------------------------------------------------------------
    // content categories
    (function(){
        
        if( $('body').hasClass('content') ){
                        
            var context = $('#categories');
            var categories = $('.category', '#categories-wrapper').hide();
            var menuContext = $('.nav')
            var menuEntries = $('li', menuContext);
            var sections = $('.contents');
            var items = $('.item').hide();
            var i = 0;
            var sectionId, itemId;
            var mustDisableNavigation = false;;
            
            if( $('body').hasClass('no-navigation') ){ mustDisableNavigation = true; }
            
            $(window).hashchange( function(){
                
                jash = location.hash;
                
                if(jash == ""){
                    menuEntries.eq(i).click();
                }else{
                    $('.category ul li a').each(function(n){                        
                        if("#" + $(this).text() == unescape(jash)){
                            $(this).click();
                        }
                    });
                }
            });
            
            $(window).hashchange();
            
            sections.hide();
           
            categories.eq(0).show();

            menuEntries.click(function(e){
                if(!mustDisableNavigation){
                    e.preventDefault();

                    window.location.hash = $(this).text();

                    if($(this).hasClass('selected')){
                        return;
                    }else{
                        menuEntries.removeClass('selected');
                        $(this).addClass('selected');
                        sections.eq(i).show().find('.item').hide().end().find('.item').eq(menuEntries.index($(this))).show(0)
                    }
                }else{
                    // force first content
                    sections.eq(0).show().find('.item').show();
                }      
            });
            
            if(window.location.hash == ""){
                menuEntries.eq(i).click();
            }else{
                $('.category ul li a').each(function(n){
                    if("#" + $(this).text() == unescape(jash)){
                        $(this).click();
                    }
                });
            }
        } 
    })();
    
    
    //-------------------------------------------------------------------------------------------------
    // fancybox
    
    $(".programming-grid, .colorbox").colorbox({"scrolling":false});
    
    //-------------------------------------------------------------------------------------------------
    // videoplayer
    $("a.videoplayer").colorbox({"scrolling":false});
        
    $('a.videoplayer').click(function(e){ setUrlVars($(this).attr('href')); });
    
    //-------------------------------------------------------------------------------------------------
    // fox creative solutions
    
    if($('body').hasClass("fox-creative-solutions")){
        
        var items = $('.item');var tops = items.find('.top').css('opacity',.9);var topButton = $('#buttons .up a');var downButton = $('#buttons .down a');var columns = $('#container .creative-column');var itemHeight = $('.item').eq(0).height();var maxHeight;var TIME = 600;var DELAY = 100;var EASE = "easeOutQuart";var isAnimating = false;
        
        if(columns.eq(0).height() > columns.eq(1).height()){maxHeight = columns.eq(0).height();}else{maxHeight = columns.eq(1).height();}
        
        items.hoverIntent({
            over: function(){ 
                $(this).find('.top').slideToggle(500);
            },
            out: function(){
                $(this).find('.top').slideToggle(500);
            }, 
            timeout: 20, 
            interval:50
        });
        
        topButton.click(function(e){
            
            e.preventDefault();
            e.stopPropagation();
            
            if(!isAnimating){                
                isAnimating = true;
                
                jQuery.easing.def = EASE;
            
                if(columns.eq(0).css("margin-top") == "0px"){
                    isAnimating = false;
                    return;
                }else{
                    columns.eq(0).animate({
                        marginTop:"+=273px"
                    },TIME);

                    columns.eq(1).animate({
                        marginTop:"+=273px"
                    },TIME+DELAY, function(){
                        isAnimating = false;
                        jQuery.easing.def = "easeOutQuart";
                    });
                
                }
            }
        });
        
        downButton.click(function(e){        
            e.preventDefault();
            e.stopPropagation();
            
            if(!isAnimating){
                isAnimating = true;
            
                jQuery.easing.def = EASE;
            
                if(columns.eq(0).css("margin-top") == "-" + (maxHeight-itemHeight-30) + "px"){
                    isAnimating = false;
                    return;
                }else{
                    columns.eq(0).animate({
                        marginTop:"-=273px"
                    },TIME);

                    columns.eq(1).animate({
                        marginTop:"-=273px"
                    },TIME+DELAY, function(){
                        isAnimating = false;
                        jQuery.easing.def = "easeOutQuart";
                    });
                }
            }
        });
        
        var overlay = $('#overlay');
        
        $('a.ajax').bind('click', function(e){e.preventDefault();$('#buttons').hide(0);;$.ajax({url: $(this).attr('href'),context: document.body,success: function(data){overlay.fadeTo(300,1).append(data)}});});
        
        $('body').delegate('a.casestudy-back','click', function(e){e.preventDefault();overlay.fadeTo(500,0, function(){$(this).html("").hide();$('#buttons').delay(100).show(200);});});
        
    }
    
    
    //-------------------------------------------------------------------------------------------------
    // sabias que
    
    if($('body').hasClass('sabias')){
        
        var container = $('#question-container');
        var items = $('.question-item');
        var timer;
        
        if (jQuery.browser.msie){
            
            $('#sabias-shadow').show();
            
            items.eq(0).addClass("active");

            timer = setInterval(function(){
                items = $('.question-item');

                items.eq(0).slideUp(1000, function(){
                    $(this).appendTo(container).hide().removeClass("active").slideDown(0);
                });

                items.eq(1).addClass("active");

            }, 10000);
        }else{
            items.fadeTo(0,0);items.eq(0).fadeTo(200, 1).addClass("active");
            items.eq(1).fadeTo(200, .6);items.eq(2).fadeTo(200, .3);items.eq(3).fadeTo(200, 0);

            timer = setInterval(function(){
                items = $('.question-item');

                items.eq(0).slideUp(1000, function(){
                    $(this).fadeTo(0, .2).appendTo(container).hide().removeClass("active").slideDown(0);
                });

                items.eq(1).fadeTo(0, 1).addClass("active");items.eq(2).fadeTo(0,.6);items.eq(3).fadeTo(0,.3);items.eq(4).fadeTo(0, 0);

            }, 10000);
        }
        
    }
    
    
    //-------------------------------------------------------------------------------------------------
    // internal bottom boxes image transitions
    
    /*
    var boxes = $('.box');
    var pics0 = [];
    var pics1 = [];
    var pics2 = [];
    
    
    boxes.find('img').fadeTo(0,0);
    
    boxes.eq(0).find('img').each(function(n){ pics0[n] = $(this); });
    boxes.eq(1).find('img').each(function(n){ pics1[n] = $(this); });
    boxes.eq(2).find('img').each(function(n){ pics2[n] = $(this); });
    
    $(pics0[0]).delay(500).fadeTo(1000,.85);
    $(pics1[0]).delay(600).fadeTo(1000,.85);
    $(pics2[0]).delay(700).fadeTo(1000,.85);
    
    */
    
    //-------------------------------------------------------------------------------------------------
    // scatter section slider
    if( $('.scatter-data').size() > 0 ){
        
        var datas = $('.scatter-data');
        var images = $('#scatter-images img');
        var timer, actual = 0;
        var buttons = $('#scatter-buttons ul li a');
        
        datas.hide();
        images.fadeTo(0,0);
        
        buttons.click(function(e){
            e.preventDefault();
            
            clearTimeout(timer);
            
            buttons.removeClass("selected");
            
            $(this).addClass("selected");
            
            changeContents(buttons.index($(this)));
        });
        
        changeContents = function(idx){
            
            actual = idx;
            
            $('#scatter-data').fadeOut(500, function(){
                $('#scatter-images').fadeOut(500, function(){
                    datas.fadeTo(0,0).hide();
                    images.fadeTo(0,0).hide();
                    
                    images.eq(actual).fadeTo(0,1);
                    datas.eq(actual).fadeTo(0,1);

                    $('#scatter-images').fadeIn(500);

                    $('#scatter-images').fadeIn(500, function(){
                        
                        $('#scatter-data').fadeIn(500);
                        
                        timer = setTimeout(function(){                            
                            if(actual < buttons.size()-1){ actual++; buttons.eq(actual).click();
                            }else{ actual = 0; buttons.eq(actual).click();}
                            
                        }, 8000);
                    });
                });
            });            
        }
        
        buttons.eq(0).click();
        
    }
    
    
    
    //-------------------------------------------------------------------------------------------------
    // bottom boxes hover subtle fx
    
    //$('#boxes-holder .box').mouseenter(function(){ $(this).css({border : "3px solid #f57142"}).find('img').animate({opacity:1},{queue:false,duration:500}); });
    
    //$('#boxes-holder .box').mouseleave(function(){ $(this).css({border : "3px solid #E7561F"}).find('img').animate({opacity:.85},{queue:false,duration:500}); });
    
    
    //-------------------------------------------------------------------------------------------------
    
    //-------------------------------------------------------------------------------------------------
    
    //-------------------------------------------------------------------------------------------------
    
    //-------------------------------------------------------------------------------------------------
    
    //-------------------------------------------------------------------------------------------------
    
});

//-------------------------------------------------------------------------------------------------

function loadNext(){

    stopTimer();
    
    if(actualSplash >= maxSplash-1){
        
        actualSplash = 0;
        
    }else{
        
        actualSplash++;
        
    }

    $('#buttons li').eq(actualSplash).click();
    
}

function stopTimer(){
    
    clearInterval(timerSplash);
    
}

