var YTmovie;function subscribe(){$("#subsc input").each(function(){$(this).data('defaultValue', $(this).val());});$("#subsc input").focus(function(){if (isDefault(this)){$(this).val('');}$('#subsc .msg').hide();});$("#subsc input").blur(function(){if (!$(this).val()){$(this).val($(this).data('defaultValue'));}});$("#subsc input").keypress(function(event){if (event.which == 13){event.preventDefault();send();}});$("#subsc button").click(function(){send();});function send(){var s_email = $("#subscribe_email").val();if (!valMail(s_email)|| isDefault($("#subscribe_email"))){showMsg(1);} else {var dataString = new Object();dataString.email = s_email.toLowerCase();var postdata = {"data" : JSON.stringify(dataString)};$.post("/subscribe", postdata, function(data){$('.msg').hide();if (data == "success"){showMsg(0);} else {showMsg(2);}});}}function valMail(v){var r = new RegExp(/^\s*[\w\-\+_]+(?:\.[\w\-\+_]+)*\@[\w\-\+_]+\.[\w\-\+_]+(?:\.[\w‌​\-\+_]+)*\s*$/);var m = r.exec(v);if (m != null){return true;}return false;}function isDefault(o){if ($(o).val()== $(o).data('defaultValue')){return true;}return false;}function showMsg(t){if (t == 1){$('#subsc .msg').html('E-mail address is not valid, please try again!');} else {if (t == 2){$('#subsc .msg').html('Network problem, please try again!');} else {$('#subsc .msg').html('Your information has been submitted.');}}$('#subsc .msg').fadeIn(200).show();}}function clickMovie(){var w, h, img_m;if(!mobileDevice){w = 1000;h = 563;img_m = 960;}else{w = 420;h = 274;img_m = 430;}$('#movie').click(function(){$('#YT-video').show();$('#overlay div').html('
