<?php
function open_header(){
	$header='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
			<html xmlns="http://www.w3.org/1999/xhtml"  >
			<head>
   				 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    			 <meta name="viewport" content="width=device-width, initial-scale=1.0"/>';
	return $header;
	
}
function get_style(){
	$style='    <style type="text/css">
					body {
				        width:100% !important;
				        -webkit-text-size-adjust:100%;
				        -ms-text-size-adjust:100%;
				        margin:0;
				        padding:0;
				    }
				
				    body,table,td,p,a,li,blockquote{
				        -ms-text-size-adjust:100%;
				        -webkit-text-size-adjust:100%;
				    }
				
				    .ReadMsgBody{
				        width:100%;
				    }.ExternalClass {width:100%;}.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;}#backgroundTable {margin:0; padding:0; width:100% !important; line-height: 100% !important; background:#FFFFFF;}img {
				        outline:none;
				        text-decoration:none;
				        -ms-interpolation-mode: bicubic;
				    }
				    a img {border:none;}
				    .image_fix {display:block;}p {
				        font-family: "Arial";
				        font-size: 13px;
				        line-height: 150%;
				        margin: 1em 0;
				        padding: 0;
				    }h1,h2,h3,h4,h5,h6{
				        margin:0;
				        padding:0;
				    }h1 {
				        color:#000000 !important;
				        display:block;
				        font-family:Arial;
				        font-size:28px;
				        font-style:normal;
				        font-weight:normal;
				        line-height:125%;
				        letter-spacing:normal;
				        margin:0;
				        
				        text-align:left;
				    }h2 {
				        color:#009693 !important;
				        display:block;
				        font-family:Arial;
				        font-size:26px;
				        font-style:normal;
				        font-weight:normal;
				        line-height:125%;
				        letter-spacing:normal;
				        margin:0;
				        
				        text-align:left;
				    }
				    h3 {
				        color:#009693 !important;
				        display:block;
				        font-family:Arial;
				        font-size:18px;
				        font-style:normal;
				        font-weight:normal;
				        line-height:125%;
				        letter-spacing:normal;
				        margin:0;
				        
				        text-align:left;
				    }
				    table td {border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt;}table { border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; }a {
				        color:#009693;
				        word-wrap:break-word;
				    }
				    #outlook a {padding:0;}
				    .yshortcuts { color:#009693; }
				
				    #wysija_wrapper {
				        background:#FFFFFF;
				        color:#000000;
				        font-family:"Arial";
				        font-size:13px;
				        -webkit-text-size-adjust:100%;
				        -ms-text-size-adjust:100%;
				        
				    }
				
				    .wysija_header_container {
				        mso-border-right-alt: 0;
				        mso-border-left-alt: 0;
				        mso-border-top-alt: 0;
				        mso-border-bottom-alt: 0;
				        
				    }
				
				    .wysija_block {
				        mso-border-right-alt: 0;
				        mso-border-left-alt: 0;
				        mso-border-top-alt: 0;
				        mso-border-bottom-alt: 0;
				        background:white !Important;
				    }
				
				    .wysija_footer_container {
				        mso-border-right-alt: 0;
				        mso-border-left-alt: 0;
				        mso-border-top-alt: 0;
				        mso-border-bottom-alt: 0;
				          background:white !Important;
				    }
				       .wysija_content_container {
				     
				        
				    }
				
				    .wysija_viewbrowser_container, .wysija_viewbrowser_container a {
				        font-family: "Arial" !important;
				        font-size: 11px !important;
				        color: #000000 !important;
				    }
				    .wysija_unsubscribe_container, .wysija_unsubscribe_container a {
				        text-align:center;
				        color: #000000 !important;
				        font-size:12px;
				    }
				    .wysija_viewbrowser_container a, .wysija_unsubscribe_container a {
				        text-decoration:underline;
				    }
				    .wysija_list_item {
				        margin:0;
				    }@media only screen and (max-device-width: 480px), screen and (max-width: 480px) {a[href^="tel"], a[href^="sms"] {
				            text-decoration: none;
				            color: #009693;pointer-events: none;
				            cursor: default;
				        }
				
				        .mobile_link a[href^="tel"], .mobile_link a[href^="sms"] {
				            text-decoration: default;
				            color: #009693 !important;
				            pointer-events: auto;
				            cursor: default;
				        }body, table, td, p, a, li, blockquote { -webkit-text-size-adjust:none !important; }body{ width:100% !important; min-width:100% !important; }
				    }@media only screen and (min-device-width: 768px) and (max-device-width: 1024px), screen and (min-width: 768px) and (max-width: 1024px) {a[href^="tel"],
				        a[href^="sms"] {
				            text-decoration: none;
				            color: #009693;pointer-events: none;
				            cursor: default;
				        }
				
				        .mobile_link a[href^="tel"], .mobile_link a[href^="sms"] {
				            text-decoration: default;
				            color: #009693 !important;
				            pointer-events: auto;
				            cursor: default;
				        }
				    }
				
				    @media only screen and (-webkit-min-device-pixel-ratio: 2) {
				    }@media only screen and (-webkit-device-pixel-ratio:.75){}
				    @media only screen and (-webkit-device-pixel-ratio:1){}
				    @media only screen and (-webkit-device-pixel-ratio:1.5){}</style><!--[if IEMobile 7]>
				<style type="text/css">
				
				</style>
				<![endif]--><!--[if gte mso 9]>
				<style type="text/css">.wysija_image_container {
				        padding-top:0 !important;
				    }
				    .wysija_image_placeholder {
				        mso-text-raise:0;
				        mso-table-lspace:0;
				        mso-table-rspace:0;
				        margin-bottom: 0 !important;
				    }
				    .wysija_block .wysija_image_placeholder {
				        margin:2px 1px 0 1px !important;
				    }
				    p {
				        line-height: 110% !important;
				    }
				    h1, h2, h3 {
				        line-height: 110% !important;
				        margin:0 !important;
				        padding: 0 !important;
				    }
				</style>
				<![endif]-->
				
				<!--[if gte mso 15]>
				<style type="text/css">table { font-size:1px; mso-line-height-alt:0; line-height:0; mso-margin-top-alt:0; }
				    tr { font-size:1px; mso-line-height-alt:0; mso-margin-top-alt:1px; }
				</style>
				<![endif]-->';
	
	return $style;
	
}
function close_header(){
	$close_header='</head>';
	return $close_header;
}

function open_body(){
	$body='<body bgcolor="#FFFFFF" yahoo="fix">
    <span style="margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;display:block;background:#FFFFFF;">
    <table width="100%" cellpadding="0" cellspacing="0" border="0" id="wysija_wrapper">
        <tr>
            <td valign="top" align="center">
                <table width="600" cellpadding="0" cellspacing="0" border="0" align="center"> 
                    <tr>
                        <td width="600" style="min-width:600px;" valign="top" align="center"   ></td>
                    </tr>
                    
                    <tr>
                        <td width="600" style="min-width:600px;" valign="top" align="center">';
	return $body;
}
function get_logo_table(){
	$logo_table='<table class="wysija_header" style="border: 0;border-collapse: collapse;mso-table-lspace: 0pt; mso-table-rspace: 0pt;clear: both;border: 0;min-width: 100%;" width="100%" cellspacing="0" cellpadding="0" border="0" align="center">
 					<tr>
 						<td height="1" align="right" class="wysija_header_container" style="font-size:1px;line-height:1%;mso-line-height-rule:exactly;border: 0;min-width: 100%;border: 0;" >
 					 </td>
 					</tr>
				</table>';
	
	return $logo_table;
}
function get_after_logo_table(){
	$after_logo_table='		</td>
                       </tr>
                       <tr>
                       		<td width="600" style="min-width:600px;" valign="top" align="left">
 								<table class="wysija_block" style="border: 0;border-collapse: collapse;mso-table-lspace: 0pt; mso-table-rspace: 0pt;clear: both;border: 0;min-width: 100%;" width="100%" cellspacing="0" cellpadding="0" border="0" align="left">
 									<tr>
 										<td class="wysija_content_container center" style="border: 0;border-collapse: collapse;background-color: #FFFFFF;border: 0;padding-top: 10px;padding-right: 17px;padding-bottom: 10px;padding-left: 17px;" align="left" >
 											<div class="wysija_text_container"></div>
 										</td>
 
 									</tr>
								</table>';
	
	return $after_logo_table;
}
function get_header_picture_table(){
	$header_picture_table='<table class="wysija_block" style="border: 0;border-collapse: collapse;mso-table-lspace: 0pt; mso-table-rspace: 0pt;clear: both;border: 0;min-width: 100%;" width="100%" cellspacing="0" cellpadding="0" border="0" align="left">
 								<tr>
 									<td class="wysija_content_container left" style="border: 0;border-collapse: collapse;background-color: #FFFFFF;border: 0;padding-top: 10px;padding-right: 17px;padding-bottom: 10px;padding-left: 17px;" align="left" >
 										<table style="border: 0;border-collapse: collapse;mso-table-lspace: 0pt; mso-table-rspace: 0pt;clear: both;" width="1%" height="129" cellspacing="0" cellpadding="0" border="0" align="left">
 											<tr style="font-size:1px; mso-line-height-alt:0; mso-margin-top-alt:1px;">
 												<td class="wysija_image_container left" style="border: 0;border-collapse: collapse;border: 1px solid #FFFFFF;display: block;margin-top: 0;margin-right: 0;margin-bottom: 0;margin-left: 0;padding-top: 0;padding-right: 10px;padding-bottom: 0;padding-left: 0;" width="1%" height="129" valign="top">
 													<div align="left" class="wysija_image_placeholder left" style="height:129px;width:185px;border: 0;display: block;margin-top: 0;margin-right: 10px;margin-bottom: 0;margin-left: 0;padding-top: 0;padding-right: 0;padding-bottom: 0;padding-left: 0;" >
 												</div>
 												</td>
 											</tr>
 										</table>';
	
	return $header_picture_table;
}
function get_after_header_picture_table($user_name){
	$title='Este boletín contiene las últimas noticias de interés para '.$user_name.' filtradas por sus conceptos personalizados ';
	$after_header_picture_table='				 <div class="wysija_text_container">
													<h3 style="font-family: Arial, \'Helvetica Neue\', Helvetica, sans-serif;font-size: 18px;color: #009693;color: #009693 !important;background-color: #FFFFFF;border: 0;font-weight: normal;font-style: normal;letter-spacing: normal;mso-line-height-rule: exactly;-mso-line-height-rule: exactly;line-height: 125%;margin-top: 0;margin-right: 0;margin-bottom: 0;margin-left: 0;padding-top: 0;padding-right: 0;padding-bottom: 0;padding-left: 0;">&nbsp;</h3><h3 style="font-family: Arial, \'Helvetica Neue\', Helvetica, sans-serif;font-size: 18px;color: #009693;color: #009693 !important;background-color: #FFFFFF;border: 0;font-weight: normal;font-style: normal;letter-spacing: normal;mso-line-height-rule: exactly;-mso-line-height-rule: exactly;line-height: 125%;margin-top: 0;margin-right: 0;margin-bottom: 0;margin-left: 0;padding-top: 0;padding-right: 0;padding-bottom: 0;padding-left: 0;"><em><span style="color: #333333;"><strong>'.$title.'</strong></span></em>
													</h3>
											 	</div>
			 							</td>			 
			 						</tr>
								</table>';
	return $after_header_picture_table;
	
}
function get_divider_table(){
	$divider_table='<table class="wysija_block" style="border: 0;border-collapse: collapse;mso-table-lspace: 0pt; mso-table-rspace: 0pt;clear: both;border: 0;min-width: 100%;" width="100%" cellspacing="0" cellpadding="0" border="0" align="left">
 						<tr style="font-size:1px; mso-line-height-alt:0; mso-margin-top-alt:1px;">
 							<td width="100%" valign="middle" class="wysija_divider_container" style="height:9px;background-color: #FFFFFF;border: 0;padding-top: 15px;padding-right: 17px;padding-bottom: 15px;padding-left: 17px;" align="left">
 								<div align="center">
 									<img src="http://www.food-alert.com/foodalert2.0/wp-content/uploads/wysija/dividers/cafe.png" border="0" width="560" height="9" alt="---" class="image_fix" style="width:560px; height:9px;text-decoration: none;outline: 0;border: 0;display: block;-ms-interpolation-mode: bicubic;" />
 								</div>
 							</td>
 						</tr>
					</table>';
	
	return $divider_table;
}
function get_alerta_left ($link,$titulo,$cuerpo){
	//url: http://www.food-alert.com/foodalert2.0/index.php/alertas/2018-02-12-2018-0237-aflatoxins-b1-3-8-tot-4-4-g-kg-ppb-in-groundnuts-from-china/
	//titulo: 2018.0237 aflatoxins (B1 = 3.8; Tot. = 4.4 µg/kg - ppb) in groundnuts from China
	//cuerpo:Reference: 2018.0237 Notification type: food - border rejection - border control - 
	//consignment detained Notification date: 29/01/2018 Action taken: re-dispatch Last update: 12/02/2018 
	//Distribution status: product not (yet) placed on the market Notification from: Cyprus (CY) Product: groundnuts 
	//Classification: Información no proporcionada por la fuente Product category: nuts, nut products and seeds Risk decision: Información no proporcionada por la fuente &hellip;
	$alerta='<table class="wysija_block" style="border: 0;border-collapse: collapse;mso-table-lspace: 0pt; mso-table-rspace: 0pt;clear: both;border: 0;min-width: 100%;" width="100%" cellspacing="0" cellpadding="0" border="0" align="left">
 				<tr>
 					<td class="wysija_content_container left" style="border: 0;border-collapse: collapse;background-color: transparent;border: 0;padding-top: 10px;padding-right: 17px;padding-bottom: 10px;padding-left: 17px;" align="left" >
 						<div class="wysija_text_container">
 							<h2 class="align-left" style="font-family: Arial, \'Helvetica Neue\', Helvetica, sans-serif;font-size: 26px;color: #009693;color: #009693 !important;background-color: transparent;border: 0;font-weight: normal;font-style: normal;letter-spacing: normal;mso-line-height-rule: exactly;-mso-line-height-rule: exactly;line-height: 125%;margin-top: 0;margin-right: 0;margin-bottom: 0;margin-left: 0;padding-top: 0;padding-right: 0;padding-bottom: 0;padding-left: 0;border: 0;text-align: left;" >
 								<a style="color: #009693;color: #009693 !important;background-color: transparent;text-decoration: none;border: 0;word-wrap: break-word;" href="'.$link.'" target="_blank">'.$titulo.'</a>
 							</h2>
 							<p style="font-family: Arial, \'Helvetica Neue\', Helvetica, sans-serif;font-size: 13px;color: #000000;color: #000000 !important;background-color: transparent;border: 0;letter-spacing: normal;mso-line-height-rule: exactly;-mso-line-height-rule: exactly;line-height: 150%;margin-top: 1em;margin-right: 0;margin-bottom: 1em;margin-left: 0;padding-top: 0;padding-right: 0;padding-bottom: 0;padding-left: 0;vertical-align: top;word-wrap: break-word;">'.
								$cuerpo.
 							'</p>
							<p style="font-family: Arial, \'Helvetica Neue\', Helvetica, sans-serif;font-size: 13px;color: #000000;color: #000000 !important;background-color: transparent;border: 0;letter-spacing: normal;mso-line-height-rule: exactly;-mso-line-height-rule: exactly;line-height: 150%;margin-top: 1em;margin-right: 0;margin-bottom: 1em;margin-left: 0;padding-top: 0;padding-right: 0;padding-bottom: 0;padding-left: 0;vertical-align: top;word-wrap: break-word;"><a style="color: #009693;color: #009693 !important;background-color: transparent;text-decoration: none;border: 0;word-wrap: break-word;" href="'.$link.'" target="_blank">Leer más</a></p>
						</div>
 					</td>
 				</tr>
			</table>';
		
								return $alerta;
								
}
function get_alerta_right($link, $titulo, $cuerpo){
	/* cuerpo: Reference: 2018.0258 Notification type: food - alert - monitoring of media Notification date: 31/01/2018 Action taken: recall from consumers 
	 * Last update: 12/02/2018 Distribution status: product traded online Notification from:
	 *  Switzerland (CH) Product: food supplement Classification: Información no proporcionada por la fuente Product 
	 *  category: dietetic foods, food supplements, fortified foods Risk decision: Información no proporcionada por la fuente Hazards Substance / &hellip; */
	// url: http://www.food-alert.com/foodalert2.0/index.php/alertas/2018-02-12-2018-0258-high-content-of-zinc-50-mg-item-in-food-supplement-from-unknown-origin/
	// titulo: 2018.0258 high content of zinc (50 mg/item) in food supplement from unknown origin
	$alerta='<table class="wysija_block" style="border: 0;border-collapse: collapse;mso-table-lspace: 0pt; mso-table-rspace: 0pt;clear: both;border: 0;min-width: 100%;" width="100%" cellspacing="0" cellpadding="0" border="0" align="left">
 				<tr>
 					<td class="wysija_content_container right" style="border: 0;border-collapse: collapse;background-color: transparent;border: 0;padding-top: 10px;padding-right: 17px;padding-bottom: 10px;padding-left: 17px;" align="left" >
 						<div class="wysija_text_container">
 							<h2 class="align-left" style="font-family: Arial, \'Helvetica Neue\', Helvetica, sans-serif;font-size: 26px;color: #009693;color: #009693 !important;background-color: transparent;border: 0;font-weight: normal;font-style: normal;letter-spacing: normal;mso-line-height-rule: exactly;-mso-line-height-rule: exactly;line-height: 125%;margin-top: 0;margin-right: 0;margin-bottom: 0;margin-left: 0;padding-top: 0;padding-right: 0;padding-bottom: 0;padding-left: 0;border: 0;text-align: left;" >
 								<a style="color: #009693;color: #009693 !important;background-color: transparent;text-decoration: none;border: 0;word-wrap: break-word;" href="'.$link.'" target="_blank">'.$titulo.'</a>
 							</h2>
 							<p style="font-family: Arial, \'Helvetica Neue\', Helvetica, sans-serif;font-size: 13px;color: #000000;color: #000000 !important;background-color: transparent;border: 0;letter-spacing: normal;mso-line-height-rule: exactly;-mso-line-height-rule: exactly;line-height: 150%;margin-top: 1em;margin-right: 0;margin-bottom: 1em;margin-left: 0;padding-top: 0;padding-right: 0;padding-bottom: 0;padding-left: 0;vertical-align: top;word-wrap: break-word;">'
								.$cuerpo.
							'</p>
							<p style="font-family: Arial, \'Helvetica Neue\', Helvetica, sans-serif;font-size: 13px;color: #000000;color: #000000 !important;background-color: transparent;border: 0;letter-spacing: normal;mso-line-height-rule: exactly;-mso-line-height-rule: exactly;line-height: 150%;margin-top: 1em;margin-right: 0;margin-bottom: 1em;margin-left: 0;padding-top: 0;padding-right: 0;padding-bottom: 0;padding-left: 0;vertical-align: top;word-wrap: break-word;"><a style="color: #009693;color: #009693 !important;background-color: transparent;text-decoration: none;border: 0;word-wrap: break-word;" href="'.$link.'" target="_blank">Leer más</a></p>
						</div>
 					</td>
 				</tr>
			</table>';
	
			return $alerta;
}
function inicio_categorias_suscritas($titulo_tabla){
	$cat_suscritas=' <table class="wysija_block" style="border: 0;border-collapse: collapse;mso-table-lspace: 0pt; mso-table-rspace: 0pt;clear: both;border: 0;min-width: 100%;" width="100%" cellspacing="0" cellpadding="0" border="0" align="left">
 						<tbody>
 							<tr>
							<td class="wysija_content_container center" style="border: 0;border-collapse: collapse;background-color: #FFFFFF;border: 0;padding-top: 10px;padding-right: 17px;padding-bottom: 10px;padding-left: 17px;" align="left" >
 						<div class="wysija_text_container"><p style="font-family: Arial, \'Helvetica Neue\', Helvetica, sans-serif;font-size: 13px;color: #000000;color: #000000 !important;background-color: #FFFFFF;border: 0;letter-spacing: normal;mso-line-height-rule: exactly;-mso-line-height-rule: exactly;line-height: 150%;margin-top: 1em;margin-right: 0;margin-bottom: 1em;margin-left: 0;padding-top: 0;padding-right: 0;padding-bottom: 0;padding-left: 0;vertical-align: top;word-wrap: break-word;">'.$titulo_tabla.'</p>';
	
	return $cat_suscritas;

}
function elem_cat_suscritas($nombre_categoría){
	$cat_suscritas='
<p class="wysija_list_item align-left" style="font-family: Arial, \'Helvetica Neue\', Helvetica, sans-serif;font-size: 13px;color: #000000;color: #000000 !important;background-color: #FFFFFF;border: 0;letter-spacing: normal;mso-line-height-rule: exactly;-mso-line-height-rule: exactly;line-height: 150%;margin-top: 1em;margin-right: 0;margin-bottom: 1em;margin-left: 0;padding-top: 0;padding-right: 0;padding-bottom: 0;padding-left: 0;vertical-align: top;word-wrap: break-word;border: 0;text-align: left;background-color: #FFFFFF;border: 0;margin-top: 0;margin-right: 0;margin-bottom: 0;margin-left: 0;" >
&bull;&nbsp;'.$nombre_categoría.'</p>';
	
	return $cat_suscritas;
}
function get_end(){
	$end=' 			</td>
 				 </tr>
			</table>
                        </td>
                    </tr>
                    <tr>
                        <td width="600" style="min-width:600px;" valign="top" align="center"   >                            
							<table class="wysija_footer" style="border: 0;border-collapse: collapse;mso-table-lspace: 0pt; mso-table-rspace: 0pt;clear: both;border: 0;min-width: 100%;" width="100%" cellspacing="0" cellpadding="0" border="0" align="center">
 								<tr>
 									<td height="1" align="right" class="wysija_footer_container" style="font-size:1px;line-height:1%;mso-line-height-rule:exactly;border: 0;min-width: 100%;background-color: white;border-top: 2px solid #009693;padding-top:5px;" >
 										<img width="126" height="42" src="http://www.observatoriodelenvase.com/noticias/wp-content/themes/ainia_bloggr_child_ecoembes/logos/Logo_observatorio.png" border="0" alt="" class="image_fix" style="width:126px; height:42px;text-decoration: none;outline: 0;border: 0;display: block;-ms-interpolation-mode: bicubic;" />
 									</td>
 							</tr>
				</table>
                        </td>
                    </tr>
                    
                    <tr>
                        <td width="600" style="min-width:600px;" valign="top" align="center"  ></td>
                    </tr>                    
                </table>
            </td>
        </tr>
    </table>
    </span>
</body>
</html>	';
	return $end;
}
	