function openModal(width,height){var marginWidth=width/2;var marginHeight=height/2;if(document.createElement("input").webkitSpeech!==undefined){$('#modalSquare').css('display','block');$('#modalSquare').css('width',width+'px');$('#modalSquare').css('height',height+'px');$('#modalSquare').css('margin','-'+marginHeight+'px -'+marginWidth+'px 0 0');$('#modalSquare').css('right','-'+((marginWidth*1)+2)+'px');$('#backgroundHover').delay('500').fadeIn('500','linear');$('#modalSquare').delay('1000').animate({right:'50%'},'slow');}else{$('#modalSquare').css('display','block');$('#modalSquare').css('width',width+'px');$('#modalSquare').css('height',height+'px');$('#modalSquare').css('margin','-'+marginHeight+'px -'+marginWidth+'px 0 0');$('#modalSquare').css('right','-'+((marginWidth*1)+2)+'px');$('#backgroundHover').delay('500').fadeIn('500','linear');$('#modalSquare').delay('1000').animate({right:'50%'},{"duration":1000,"easing":"easeOutBounce"});}}
function closeModal(width,height){if(document.createElement("input").webkitSpeech!==undefined){$('#modalSquare').delay('1000').animate({right:'none',left:'-'+((width*1)+2)+'px'},'slow').fadeOut('100');$('#backgroundHover').delay('1000').fadeOut('500','linear');}else{$('#modalSquare').delay('1000').animate({right:'none',left:'-'+((width*1)+2)+'px'},{"duration":1000,"easing":"easeInQuart"}).fadeOut('100');$('#backgroundHover').delay('1000').fadeOut('500','linear');}}
$(document).ready(function(){openModal(boxWidth,boxHeight);$('#backgroundHover').click(function(){closeModal(boxWidth,boxHeight);});$('#closeButton').click(function(){closeModal(boxWidth,boxHeight);});$(document).keypress(function(which){if(which.keyCode==27){closeModal(boxWidth,boxHeight);}});setTimeout(function(){closeModal(boxWidth,boxHeight);},10000);});
