<? /* 
JIF:241209 Cambios para nuevo redisenio en todo el look&feel
*/
error_reporting(0);
include("/desarrollo/interactivos/external/votaciones/fechas_espaniol.php");
$v_id_votacion=$_POST['p_id_votacion']; if(!$v_id_votacion){ $v_id_votacion=$_GET['p_id_votacion']; }
/*$v_ysc=$_POST['p_ysc']; if(!$v_ysc){ $v_ysc=$_GET['p_ysc']; }if(!$v_ysc){ $v_ysc=0; }*/
/*$v_solores=$_POST['p_solores']; if(!$v_solores){ $v_solores=$_GET['p_solores']; }if(!$v_solores){ $v_solores=0; } */ // Ya no se usa, era para definir si solo se mostraba o se procesaba algo más.
$mensaje = $_GET['m'];

$vv_mes = strtr(date("F"),$trad);
$fecha = date("d")." de ".$vv_mes." del ".date("Y");
$año = date("Y");
include("/desarrollo/interactivos/external/conexion.php");
$link=conectarse();

$sel_vot=mysql_query("select nombre, pregunta from VOT_VOTACION where id=$v_id_votacion;",$link);
$dat_vot=mysql_fetch_array($sel_vot);	
mysql_free_result($sel_vot);

$sel_tot_vot=mysql_query("select sum(numero_votos) numero_votos from VOT_VOTOSXDIA where id_votacion=$v_id_votacion;",$link);
$dat_tot_vot=mysql_fetch_array($sel_tot_vot);	
mysql_free_result($sel_tot_vot);

//apariencia (28 para English)
$sel_ap=mysql_query("SELECT id_apariencia FROM VOT_VOTACION WHERE id = $v_id_votacion;",$link);
$dat_ap=mysql_fetch_array($sel_ap);	
mysql_free_result($sel_ap);

$resultados="Resultados de la votaci&oacute;n";
$respuestas="respuestas";
$votos="total de votos";
$envia='<a href="javascript:despliega(\'http://interactivo.eluniversal.com.mx/interactivos/external/votaciones/votaciones_envios_envia_a_un_amigo.php?p_id_votacion='.$v_id_votacion.'\',330,320);"><img src="../img/enviar01.jpg" width="125" height="20" border="0"></a>';
if($dat_ap[0]==28) {
	$resultados="Results";
	$respuestas="answers";
	$votos="votes";
	$vv_mes = date("F");
$fecha = date("d")." ".$vv_mes." ".date("Y");
$envia='';
}


/* codigo comscore y google analytics  */
//limpia cabeza para comscore 
include_once("/desarrollo/interactivos/external/votaciones/v3/limpia_cabeza.php");
$var_cabeza_limpia=limpia_cabeza(utf8_encode($dat_vot[1]));

//echo($var_cabeza_limpia);
$comscore='<!-- Begin Digital Analytix Tag  1.1302.13 -->
<script type="text/javascript">
  function udm_(e){var t="comScore=",n=document,r=n.cookie,i="",s="indexOf",o="substring",u="length",a=2048,f,l="&ns_",c="&",h,p,d,v,m=window,g=m.encodeURIComponent||escape;if(r[s](t)+1)for(d=0,p=r.split(";"),v=p[u];d<v;d++)h=p[d][s](t),h+1&&(i=c+unescape(p[d][o](h+t[u])));e+=l+"_t="+ +(new Date)+l+"c="+(n.characterSet||n.defaultCharset||"")+"&c8="+g(n.title)+i+"&c7="+g(n.URL)+"&c9="+g(n.referrer),e[u]>a&&e[s](c)>0&&(f=e[o](0,a-8).lastIndexOf(c),e=(e[o](0,f)+l+"cut="+g(e[o](f+1)))[o](0,a)),n.images?(h=new Image,m.ns_p||(ns_p=h),h.src=e):n.write("<","p","><",\'img src="\',e,\'" height="1" width="1" alt="*"\',"><","/p",">")};
  udm_(\'http://b.scorecardresearch.com/b?c1=2&c2=6906641&ns_site=el-universal&name=votacion.voto.resultado.'.$var_cabeza_limpia.'.'.$v_id_votacion.'\');
</script>
<noscript><p><img src="http://b.scorecardresearch.com/p?c1=2&amp;c2=6906641&amp;ns_site=el-universal&amp;name=votacion.voto.resultado.'.$var_cabeza_limpia.'.'.$v_id_votacion.'" height="1" width="1" alt="*"></p></noscript>
<!-- End Digital Analytix Tag -->';

$comscore2='<script src="http://b.scorecardresearch.com/c2/6906641/cs.js"></script>';

$google_analytics='<script>var _gaq = _gaq || [];_gaq.push(["_setAccount", "UA-5566785-1"]);_gaq.push(["_trackPageview"]);(function() {var ga = document.createElement("script");ga.type = "text/javascript";ga.async = true;ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";var s = document.getElementsByTagName("script")[0];s.parentNode.insertBefore(ga, s);})();</script>';

/*  */

/* Redi2009 */

/**************************/
$codigo='
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<style>
.arrojo11b,.hora{font-family:Arial,Helvetica,sans-serif;font-size:11px;color:#900;font-weight:bold}
.arrojo15b{font-family:Arial,Helvetica,sans-serif;font-size:12px;color:#900;font-weight:bold}
.arnegro10{font-family:Arial,Helvetica,sans-serif;font-size:10px;color:#000}
.arnegro13{font-family:Arial, Helvetica, sans-serif;font-size:13px;color:#333;font-weight:normal}

.geoazul85bi{font-family:Georgia,"Times New Roman",Times,serif;font-size:8.5pt;color: #4477A5;font-weight:bold;font-style:italic}
.geoGris15{font-family:Georgia,"Times New Roman",Times,serif;font-size:15px;color:#556576;font-weight:lighter}
.geoazul7 { font-size: 18px; color: #003366; font-family: Georgia, "Times New Roman", Times, serif; letter-spacing: -0.3px; line-height: 16px; }

.a14a{font-family:Arial,Helvetica,sans-serif;font-size:14px;color:#5074A0;font-weight:bold;font-style:normal}
.hv11rojo {font-family: Arial, Helvetica, sans-serif;font-size: 11px; font-weight: normal; text-transform: uppercase; color: #990000; }

.txt-opinion1{font-family:Georgia,"Times New Roman",Times,serif;font-size:8.5pt;color: #4477A5;font-weight:bold;font-style:italic}
.txt-promo-gris1{font-family:Arial,Helvetica,sans-serif;font-size:12px;font-weight:bold;color:#8C99A8}

.tbazul10{font-family:"trebuchet ms",Arial,Helvetica,sans-serif;font-size:10px;color:#369;text-transform:uppercase;word-spacing:-1px}

.numAzul9{font-family:Arial,Helvetica,sans-serif;font-size:9pt;font-weight:bold;color:#556576}
</style>
<script language="JavaScript"> 
function despliega(variable,ancho,alto,barr) {
if (!barr) v_bar=0;
else v_bar=1;
window.open(variable,"Online","scrollbars="+v_bar+",resizable=yes,width="+ancho+",height="+alto);
}
</script>
'.$google_analytics.'
</head>
<body bgcolor="#e4eaf1">'.$comscore.'
		<div align="center">
			<table width=600 border="0" cellspacing=0 cellpadding=0 bgcolor="white">
				<tr height="40">
					<td colspan="7" height="40"><img src="img/cabezal.gif" alt="" height="40" width="600" border="0"></td>
				</tr>
				<tr height="10">

					<td width="10" height="10"></td>
					<td width="1" height="10"></td>
					<td width="10" height="10"></td>
					<td height="10"></td>
					<td width="10" height="10"></td>
					<td width="1" height="10"></td>
					<td width="10" height="10"></td>
				</tr>
				<tr height="1">

					<td width="10" height="1"></td>
					<td bgcolor="#cdd6dd" width="1" height="1"></td>
					<td bgcolor="#cdd6dd" width="10" height="1"></td>
					<td bgcolor="#cdd6dd" height="1"></td>
					<td bgcolor="#cdd6dd" width="10" height="1"></td>
					<td bgcolor="#cdd6dd" width="1" height="1"></td>
					<td width="10" height="1"></td>
				</tr>
				<tr height="10">

					<td width="10" height="10"></td>
					<td bgcolor="#cdd6dd" width="1" height="10"></td>
					<td width="10" height="10"></td>
					<td height="10"></td>
					<td width="10" height="10"></td>
					<td bgcolor="#cdd6dd" width="1" height="10"></td>
					<td width="10" height="10"></td>
				</tr>
				<tr>

					<td width="10"></td>
					<td bgcolor="#cdd6dd" width="1"></td>
					<td width="10"></td>
					<td>
';

 if($mensaje) {
  $codigo.= "<table width=\"603\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">
  <tr class=\"txt-top\">
    <td align=\"center\" valign=\"middle\" class=\"txtvecasas\">$mensaje</td>
  </tr>
</table>";
  }

$codigo.='

						<table width="558" border="0" cellspacing="0" cellpadding="0">
                                                        <tr height="16">
                                                                <td valign="top" width="150px" height="16px"><div align="left" span class="tbazul10">'.$dat_vot[0].'</div></td>
                                                                <td valign="top" width="20px" height="16px"><div id="tm_box" margin-left: -100px;"></div></td><td valign="top" width="20px" height="16px"><div id="tm_box_twitter" style="margin-left: 20px;"><a href="https://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="El_Universal_Mx" data-lang="es">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div></td>
                                                                <td valign="top" width="269px" height="16px"> <div align="right"> <span class="hv11rojo"> '.$fecha.'</span></div> </td>
                                                        </tr>
                                                </table>
						<table width="558" border="0" cellspacing="0" cellpadding="0">

							<tr height="2">
								<td bgcolor="#cdd6dd" width="269" height="2"></td>
								<td bgcolor="#cdd6dd" width="20" height="2"></td>

								<td bgcolor="#cdd6dd" width="269" height="2"></td>
							</tr>
							<tr height="8">
								<td width="269" height="8"></td>
								<td width="20" height="8"></td>
								<td width="269" height="8"></td>
							</tr>
							<tr>
								<td colspan="3" width="558">

									<div align="center">
										<span class="geoazul7"><em>'.$dat_vot[1].'</em></span></div>
								</td>
							</tr>
							<tr height="6">
								<td width="269" height="6"></td>
								<td width="20" height="6"></td>
								<td width="269" height="6"></td>

							</tr>
							<tr>
								<td colspan="3" width="558">
									<div align="center">
										<span class="arnegro13">
										'.$resultados.'<span></div>
								</td>
							</tr>

							<tr>
								<td width="269"><span class="tbazul10">'.$respuestas.'</span></td>
								<td width="20"></td>
								<td width="269">
									<div align="right">
										<span class="tbazul10">'.$votos.' :</span> <span class="hv11rojo">'.$dat_tot_vot[0].'</span></div>
								</td>

							</tr>
							<tr height="1">
								<td bgcolor="#cdd6dd" width="269" height="1"></td>
								<td bgcolor="#cdd6dd" width="20" height="1"></td>
								<td bgcolor="#cdd6dd" width="269" height="1"></td>
							</tr>
							<tr height="4">
								<td width="269" height="4"></td>
								<td width="20" height="4"></td>

								<td width="269" height="4"></td>
							</tr>
						</table>
						<!-- your comment here -->
						<table width=558 border=0 cellpadding=0 cellspacing=0 bordercolor=#F2F2F2>

';

 $cont_col=1;
 $colortr='#F9F9F9';
 $sel_graf=mysql_query("select id_opcion,respuesta from VOT_OPCIONES where id_votacion=$v_id_votacion order by id_opcion asc;",$link);
 while($dat_graf=mysql_fetch_array($sel_graf)) {
  $sel_opc=mysql_query("select ifnull(sum(numero_votos),0) numero_votos from VOT_VOTOSXDIA where id_votacion=$v_id_votacion and id_opcion=$dat_graf[0];",$link);
  $dat_opc=mysql_fetch_array($sel_opc);
  $totvotdec1=($dat_opc[0]/$dat_tot_vot[0])*100;
  $totvotdec = sprintf ("%01.2f", $totvotdec1);

  if ($dat_opc[0]==0) {
   $totvotdec2=floor((0.001/$dat_tot_vot[0])*196);
  } else {
   $totvotdec2=floor(($dat_opc[0]/$dat_tot_vot[0])*196);
  }

  if ($colortr=='#f0f3f4') $colortr='#FFFFFF';
  else $colortr='#f0f3f4';

  if ($imggraf=='b2.gif') $imggraf='b1.gif';
  else $imggraf='b2.gif';

$codigo.='

							<tr height="36">
								<td bgcolor="'.$colortr.'" height="36">
									<div align=left>
										<table width=558 border=0 cellpadding=0 cellspacing=0>

											<tr>
												<td width=8>
													<div align=center></div>
												</td>
												<td width=269><span class="arnegro13">'.$dat_graf[1].'</span></td>
												<td width=10>
													<div align=center></div>

												</td>
												<td width="269">
													<div align=center>
														<table width=115 border=0 align=left cellpadding=1 cellspacing=0>
															<tr>
																<td width=11 valign=top>
																	<div align=left>
																		<img src="img/'.$imggraf.'" width='.$totvotdec2.' height=20></div>
																</td>

																<td width=8 valign=top>
																	<div align=left></div>
																</td>
																<td width=90>
																	<div align=left>
																		<span class="numAzul9">	'.$totvotdec.'%</span></div>
																</td>
															</tr>

														</table>
													</div>
												</td>
											</tr>
										</table>
									</div>
								</td>
							</tr>

';

}



$codigo.='

						</table>

					</td>
					<td width="10"></td>
					<td bgcolor="#cdd6dd" width="1"></td>
					<td width="10"></td>
				</tr>
				<tr height="10">
					<td width="10" height="10"></td>
					<td bgcolor="#cdd6dd" width="1" height="10"></td>
					<td width="10" height="10"></td>

					<td height="10"></td>
					<td width="10" height="10"></td>
					<td bgcolor="#cdd6dd" width="1" height="10"></td>
					<td width="10" height="10"></td>
				</tr>
				<tr height="1">
					<td width="10" height="1"></td>
					<td bgcolor="#cdd6dd" width="1" height="1"></td>
					<td bgcolor="#cdd6dd" width="10" height="1"></td>

					<td bgcolor="#cdd6dd" height="1"></td>
					<td bgcolor="#cdd6dd" width="10" height="1"></td>
					<td bgcolor="#cdd6dd" width="1" height="1"></td>
					<td width="10" height="1"></td>
				</tr>
				<tr height="10">
					<td width="10" height="10"></td>
					<td width="1" height="10"></td>
					<td width="10" height="10"></td>

					<td height="10"></td>
					<td width="10" height="10"></td>
					<td width="1" height="10"></td>
					<td width="10" height="10"></td>
				</tr>
			</table>
			<table width="600" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td bgcolor="#fafafa" width="10"> </td>

					<td bgcolor="#fafafa"><span class="arnegro10">&copy; '.$año.' Copyright El Universal-El Universal Online, M&eacute;xico.</span></td>
					<td align="right" bgcolor="#fafafa"><a href="javascript:despliega(\'http://interactivo.eluniversal.com.mx/interactivos/external/votaciones/votaciones_envios_envia_a_un_amigo.php?p_id_votacion='.$v_id_votacion.'\',330,320);"><img src="../img/enviar01.jpg" width="125" height="20" border="0"></a></td>
					<td align="right" bgcolor="#fafafa" width="10"></td>
				</tr>
			</table>
		</div>
<script type="text/javascript"  src="http://www.eluniversal.com.mx/js/v3_shareButtonsinteractivos.js"></script>
'.$comscore2.'
	</body></html>
';



/***************************/


//cierra la conexión de bd
if ($link){mysql_close($link);}

/* FIN CÓDIGO DE APLICACIÓN */

//include('limpia.inc');
//$codigo = removeEmptyLines($codigo);
echo("$codigo");
 	
?>
