function popup_Registrate(){
	Shadowbox.open({
                               player: 'iframe',
                               content: 'popup/registro.php',
                               width: 400,
                               height: 500 
                });
	
	}

function popup_Invita(pagina){
	Shadowbox.open({
                               player: 'iframe',
                               content: 'popup/invitaciones.php?pagina=' + pagina,
                               width: 400,
                               height: 500 
                });
	
	}	

function popup_Consulta(){
	Shadowbox.open({
                               player: 'iframe',
                               content: 'popup/consultas.php',
                               width: 400,
                               height: 500 
                });
	
	}

// JavaScript Document
function muestra_oculta(login,coments){
if (document.getElementById){ //se obtiene el id
var el = document.getElementById(login); //se define la variable "el" igual a nuestro div
var divComents = document.getElementById(coments);
el.style.display = (el.style.display == 'block') ? 'none' : 'block'; //damos un atributo display:none que oculta el div
divComents.style.height = (divComents.style.height=='204px') ? '394px' : '204px' ;
}
}
//window.onload = function(){/*hace que se cargue la función lo que predetermina que div estará oculto hasta llamar a la función nuevamente*/
//muestra_oculta('CommentsForm','CommentList');/* "contenido_a_mostrar" es el nombre que le dimos al DIV */
//}

function login(){		
		//alert("login");
		$.ajax({
			  url: "proccess/generateLogin.php?email=" + document.frmLogin.txtEmail.value + "&dni=" + document.frmLogin.txtDNI.value,
			  cache: false,
			  success: function(html){
							  $("#CommentsForm").html(html);      
			  }
				 
	});	
	
}
function insertComent(idUser){
	$.ajax({
			  url: "proccess/insertComentario.php",
			  cache: false,
			  type: 'post',
			  dataType: 'json',
			  data: "idUser=" + idUser + "&coment=" + document.frmLogin.coments.value,
			  
			  success: function(msg){
				  
				  if (msg.RESULT==1){
					  
				var strCOMENT="<li><span class='commName'>"+ msg.NOMBRE +"</span><span class='commDate'>" + msg.FECHA + "</span>";
				strCOMENT=strCOMENT + "<p>" + document.frmLogin.coments.value + "</p>";
				strCOMENT=strCOMENT + "<table cellspacing='0'><tr><td valign='middle' width='100'>";
				strCOMENT=strCOMENT + "<a href='http://facebook.com/share.php?u=http://origin-www.dove.com.pe/staging/CompartComent.php?idComentario=" + msg.IDCOMENT + "' ";
				strCOMENT=strCOMENT + "target='_blank'>";
				strCOMENT=strCOMENT + "<img src='images/productos/compartir.jpg' width='82' height='18' border='0' /></a></td>";
				strCOMENT=strCOMENT + "<td><iframe src='http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Forigin-www.dove.com.pe%2Fstaging%2FCompartComent.php%3FidComentario%3D" + msg.IDCOMENT ;
     				  strCOMENT=strCOMENT + "&amp;layout=standard&amp;show_faces=true&amp;width=500&amp;action=like&amp;colorscheme=light&amp;height=80'";
					  strCOMENT=strCOMENT + "scrolling='no' frameborder='0' style='border:none; ";
					  strCOMENT=strCOMENT + "overflow:hidden; width:500px; height:24px;' allowTransparency='true'></iframe></td></tr></table>";
					  strCOMENT=strCOMENT + "";					  					  					  					  
					  
					  $("#CommentList").prepend(strCOMENT);
					  $(".Error").html("");
					  document.frmLogin.coments.value="";
					  }
					  else{
						   $(".Error").html("<img src='images/ui/icon_error.jpg' /> Ingresa tu Comentario"); 
						  //alert("no se registro su comentario");
					  }
							  //$("#CommentsForm").html(html);      
			  }
				 
	});	
	}
	
function CargarEncuenta(){
	
	$.ajax({
			  url: "proccess/insertEncuesta.php",
			  cache: false,
			  type: 'post',
			  data: "Opcion=0",
			  			  
			  success: function(html){
				$("#Test").html(html);				  
				  
			 }	 
	});	
	
}
	
function votarEncuesta(){	
	var i 
   	for (i=0;i<document.Form2.optOpcion.length;i++){ 
      	 if (document.Form2.optOpcion[i].checked) 
         	 break; 
   	} 	

	var intIdOpcion=document.Form2.optOpcion[i].value;
	
	$.ajax({
			  url: "proccess/insertEncuesta.php",
			  cache: false,
			  type: 'post',
			  data: "Opcion=" + intIdOpcion,
			  
			  success: function(html){
				$("#Test").html(html);				  
				  
			 }	 
	});	
	
}
