﻿$(document).ready(function() {
	//$.preloadImages('/Content/images/loading_bg.gif');

	$("#cpf").click(function() {
		if ($("#cpf").val() == "Informe o seu CPF ou CNPJ") {
			$("#cpf").val("");
		}
	});

	$("#newsletter-email").click(function() {
		if ($("#newsletter-email").val() == "seu e-mail aqui") {
			$("#newsletter-email").val("");
		}
	});
	
});

jQuery.preloadImages = function() {
    for (var i = 0; i < arguments.length; i++) {
        jQuery("<img>").attr("src", arguments[i]);
    }
   }

   function ShowModal(url, container) {
   	$('#' + container).jqm({
   		ajax: url,
   		ajaxText: "<div style=\"display:block; margin:200px auto 0 auto; padding:60px 0; background:url(/Content/images/modal_loadingbg.gif) no-repeat; width:238px; height:40px\"><img style=\"display:block; margin:0 auto;\" src=\"/Content/images/loading.gif\" /></div>",
   		onShow: function(hash) {
   			var scrollY = (document.all ? document.documentElement.scrollTop : window.pageYOffset);
   			hash.w.css("top", (100 + scrollY));
   			hash.w.fadeIn(300);
   			$("#modal-iframe").css("top", (100 + scrollY));
   			$("#modal-iframe").css("margin-left", $("#" + container).css("margin-left"));
   			$("#modal-iframe").width(hash.w.width());
   			setTimeout(function() { $("#modal-iframe").height($("#" + container).height()); }, 400);
   			$("#modal-iframe").show();
   		},
   		onHide: function(hash) {
   			hash.w.fadeOut(300);
   			hash.o.fadeOut(300);
   			$("#modal-iframe").hide();
   		}
   	});
	$('#' + container).jqmShow();
}
