<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<?php /*<!--[if lte IE 8]>
			<script type="text/javascript" src="<?php echo asset('iframe-resizer/ie8.polyfils.min.js'); ?>"></script>
		<![endif]-->*/ ?>
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
		<meta name="description" content="Sume Clientes">
		<meta name="keywords" content="sumeclientes, sume, sume clientes, formulario">
		<link rel="shortcut icon" href="<?php echo asset('SysWeb/SumeClientes/favicon.ico'); ?>" type="image/x-icon">
		<link rel="icon" href="<?php echo asset('SysWeb/SumeClientes/favicon.ico'); ?>" type="image/x-icon">
		<link rel="icon" type="image/png" sizes="16x16" href="<?php echo asset('favicon.ico'); ?>">

		<title> Formulario diseñado en la plataforma Sume Clientes </title>
		<?php /* HTML::style('WebPro/bootstrap/css/bootstrap.min.css') */ ?>
		<?php /* HTML::style('WebPro/css/font-awesome.min.css') */ ?>
		<?php /* HTML::style('SysWeb/SumeClientes/BootstrapMod.css') */ ?>
		<?php echo HTML::style('SysWeb/SumeClientes/bootstrap-all-min.css'); ?>

		<?php echo HTML::style('SysWeb/SumeClientes/EditorDeFormularios.css'); ?>

		<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
		<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
		<!--[if lt IE 9]>
			<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
			<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
		<![endif]-->
		<link id="Adamia" href="https://fonts.googleapis.com/css?family=Adamina" rel="stylesheet" type="text/css">
		<link id="DancingScript" href="https://fonts.googleapis.com/css?family=Dancing+Script" rel="stylesheet" type="text/css">
		<link id="DroidSans" href="https://fonts.googleapis.com/css?family=Droid+Sans" rel="stylesheet" type="text/css">
		<link id="JustAnotherHand" href="https://fonts.googleapis.com/css?family=Just+Another+Hand" rel="stylesheet" type="text/css">
		<link id="LobsterTwo" href="https://fonts.googleapis.com/css?family=Lobster+Two" rel="stylesheet" type="text/css">
		<link id="Montserrat" href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet" type="text/css">
		<link id="NixieOne" href="https://fonts.googleapis.com/css?family=Nixie+One" rel="stylesheet" type="text/css">
		<link id="OpenSans" href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css">
		<link id="Oswald" href="https://fonts.googleapis.com/css?family=Oswald" rel="stylesheet" type="text/css">
		<link id="Pacifico" href="https://fonts.googleapis.com/css?family=Pacifico" rel="stylesheet" type="text/css">
		<link id="ShadowsIntoLightTwo" href="https://fonts.googleapis.com/css?family=Shadows+Into+Light+Two" rel="stylesheet" type="text/css">
		<link id="TheGirlNextDoor" href="https://fonts.googleapis.com/css?family=The+Girl+Next+Door" rel="stylesheet" type="text/css">
		<link id="BubblegumSans" href="https://fonts.googleapis.com/css?family=Bubblegum+Sans" rel="stylesheet" type="text/css">
		<link id="LondrinaSolid" href="https://fonts.googleapis.com/css?family=Londrina+Solid" rel="stylesheet" type="text/css">
		<link id="RockSalt" href="https://fonts.googleapis.com/css?family=Rock+Salt" rel="stylesheet" type="text/css">
	</head>
	<!--<body id="CuerpoFull" onresize="CambiarAlto()">-->
	<body id="CuerpoFull">
		<div class="container-fluid">
			<form id="frmSuscripcion">
				<?php echo trim($Formulario->codigo_html); ?>

				<input type="hidden" value="" id="fuente_suscripcion" name="fuente_suscripcion"></input>
			</form>
		</div>
		<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
		<?php echo HTML::script('WebPro/js/jquery-2.0.2.min.js'); ?>

		<!-- Include all compiled plugins (below), or include individual files as needed -->
		<?php echo HTML::script('WebPro/bootstrap/js/bootstrap.min.js'); ?>

		<?php echo HTML::script('iframe-resizer/iframeResizer.contentWindow.min.js'); ?>

		<script type="text/javascript">
			function LimpiarEventos(){
				$("#frmSuscripcion :input").each(function(){ $(this).removeAttr("onclick"); $(this).prop("onclick", null); });
				$("#frmSuscripcion").find("p").each(function(){ $(this).removeAttr("onclick"); $(this).prop("onclick", null); });
			}
			function inIframe () { try { return window.self !== window.top; } catch (e) { return true; } }
			/*function CambiarAlto(){ if( inIframe() ){ var Alto = $("#CuerpoFull").height(); postAlto(Alto); } }
			function postAlto(height){
				var height = height; var json = { "Mensaje":"Alto", "Frm":"<?php echo str_replace('-', '', $Formulario->token); ?>", "height": height };
				var target = parent.postMessage ? parent : (parent.document.postMessage ? parent.document : undefined);
				if(typeof target != "undefined" && document.body.scrollHeight){ target.postMessage(json, "*"); }
			}*/
			function postDisenho(){
				if($("#Orden").hasClass("Vertical")){
					var json = { "Mensaje":"Disenho", "Disenho": "V" };
				}
				else if($("#Orden").hasClass("Horizontal")){
					var json = { "Mensaje":"Disenho", "Disenho": "H" };
				}
				var target = parent.postMessage ? parent : (parent.document.postMessage ? parent.document : undefined);
				if(typeof target != "undefined" && document.body.scrollHeight){ target.postMessage(json, "*"); }
			}
			$(document).ready(function(){
				$("#fuente_suscripcion").val(document.referrer);
				postDisenho();
				//CambiarAlto();
				LimpiarEventos();
				$("#btnSubmit").click(function(){
					$.post(
						"<?php echo URL::route('SysWebEmailMarketingFormulario', array($Formulario->token)); ?>",
						$("#frmSuscripcion").serialize(),
						function(data){
							$('[id^="err"]').html("");
							if(data.success){
								if(data.pagina_agradecimiento != ""){
									if( inIframe() ){ window.top.location.href = data.pagina_agradecimiento; }
									else{ window.location.href = data.pagina_agradecimiento; }
								}
								else{
									if( inIframe() ){ window.top.location.reload(); }
									else{ window.location.reload(); }
								}
							}
							else{
								$.each(data.errMensajes, function(key, value){ if(value != ''){ $("#err"+key).html(value); } else{ $("#err"+key).html(""); } });
								//CambiarAlto();
							}
						},
						"json"
					);
				});
			});
		</script>
	</body>
</html>