function setup(){$("#loading").remove();var transitionEnd="TransitionEnd";if($.browser.webkit){vP="-webkit-";transitionEnd="webkitTransitionEnd";}else if($.browser.msie){vP="-ms-";}else if($.browser.mozilla){vP="-moz-";transitionEnd="transitionend";}else if($.browser.opera){vP="-o-";transitionEnd="oTransitionEnd";}
if(Modernizr.cssanimations){$("html").removeClass("setup").addClass("loaded");if(Modernizr.csstransforms3d){$(".loaded #badge").bind('animationend webkitAnimationEnd',function(){$(".loaded #badge").unbind('animationend webkitAnimationEnd');$("html").removeClass("loaded").addClass("complete");});}else{$("#main-content").bind(transitionEnd,function(){$("#main-content").unbind(transitionEnd);$("html").removeClass("loaded").addClass("complete");});}}else{$("html").removeClass("setup").addClass("loaded");device="small";width=window.innerWidth;if(width>=1024){device="large";}else{if(width>=450){device="medium";}
if(($.browser.msie)&&(parseInt($.browser.version,10)<9)){device="large";}}
$("#main-content").attr("id","main-"+device);$("#main-small").animate({marginTop:"0"},1000,function(){$("header, nav, #content, footer").animate({opacity:"1"},1000,function(){$("#main-small").attr("id","main-content");$("html").removeClass("loaded").addClass("complete");});});$("#main-medium").animate({marginLeft:"56px"},1000,function(){$("header, nav, #content, footer").animate({opacity:"1"},1000,function(){$("#main-medium").attr("id","main-content");$("html").removeClass("loaded").addClass("complete");});});$("#main-large").animate({marginLeft:"50%"},1000,function(){$("header, nav, #content, footer").animate({opacity:"1"},1000,function(){$("#main-medium").attr("id","main-content");$("html").removeClass("loaded").addClass("complete");});});}}
function getDevicePixelRatio(){if(window.devicePixelRatio===undefined){return 1;}
return window.devicePixelRatio;}
$(function(){$("html").addClass("setup");MBP.scaleFix();if(document.body.style['-webkit-mask-repeat']!==undefined){Modernizr.cssmasks=true;$('html').addClass('cssmasks');}else{Modernizr.cssmasks=false;$('html').addClass('no-cssmasks');}
if($.fn.placeholder){$('input,textarea').placeholder();}$("body").append("<div id='loading'>loading</div>");$("#img-logo").remove();if(getDevicePixelRatio()>1){$("#logo").append('<img id="badge" src="/img/assets/badge2x.png" />').append('<img id="ribbon" src="/img/assets/ribbon2x.png" />');}else{$("#logo").append('<img id="badge" src="/img/assets/badge.png" />').append('<img id="ribbon" src="/img/assets/ribbon.png" />');}});$(window).load(function(){window.setTimeout('setup()',1000);$(window).load(function(){window.setTimeout('setup()',1000);});$('button').live("click",function(){var name=$('input[name=name]');var email=$('input[name=email]');var message=$('textarea[name=message]');stopForm=0;if(name.val()==''){name.addClass('error');stopForm=1;}else name.removeClass('error');if(email.val()==''){email.addClass('error');stopForm=1;}else{var emailReg=/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;if(!emailReg.test(email.val())){email.addClass('error');stopForm=1;}else{email.removeClass('error');}}
if(message.val()==''){message.addClass('error');stopForm=1;}else message.removeClass('error');if(stopForm==1){return false;}
var data='name='+name.val()+'&email='+email.val()+'&message='+encodeURIComponent(message.val());$('input').attr('disabled','true');$('button').attr('disabled','true');$('button').after('<div class="sending"></div>');$.ajax({url:"support/process.php",type:"GET",data:data,cache:false,success:function(html){if(html==1){$('form').fadeOut('slow',function(){$("#contact-form").append("<p>Thank you, the message has been sent.</p>");$("#contact-form p").fadeIn('slow');});}else alert('Sorry, an error occurred. Please try again.');}});return false;});});
