max-kk
4/25/2016 - 2:48 PM

extra_lp.js

jQuery.cachedScript = function( url, options ) {
 
  // Allow user to set any option except for dataType, cache, and url
  options = $.extend( options || {}, {
    dataType: "script",
    cache: true,
    url: url
  });
 
  // Use $.ajax() since it is more flexible than $.getScript
  // Return the jqXHR object so we can chain callbacks
  return jQuery.ajax( options );
};

  var swal_loaded = false;
	
	function swal_load() {
		if ( !swal_loaded ) {
			jQuery.cachedScript("https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.js");
			var swal_stylesheet = document.createElement('link')
			swal_stylesheet.setAttribute('rel', 'stylesheet')
			swal_stylesheet.setAttribute('type', 'text/css')
			swal_stylesheet.setAttribute('href', "https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css")
			document.getElementsByTagName('head')[0].appendChild(swal_stylesheet);			
			swal_loaded = true;
		}				
	}
	swal_load();
	function show_message(title, message, type) {
		if ( type == undefined ) {
			type = "success";
		}
		if ( typeof swal != "undefined" ) {
			swal(title, message, type);
		} else {
			alert(title + message);
		}			
	}		
	
	
	show_message("Отправлено!", "Спасибо за заявку! Скоро с Вами свяжется наш менеджер.");