﻿function Rshowbubble(width,height,content,top,left,delayShow,delayHide,direction,relativeTo,displayTimes)
{

var chCookie =  $.cookie('alertPerson');



if (chCookie==null || chCookie=="")
{
chCookie = 0;
}

if (parseInt(chCookie)<displayTimes)
{

$.cookie('alertPerson', (parseInt(chCookie)+1),{expires:70});
var pos = $("#"+relativeTo).position();

	$('#bubbleMainContent').width(width+'px');	
	$('#bubbleTable').width(parseInt(width)+parseInt(38)+'px');
   $('#bubbleTable').height(parseInt(height)+parseInt(44)+'px');
	$('#bubbleMainContent').height(height+'px');
document.getElementById('bubbleMainContent').innerHTML=content;	
$('#bubbleDiv').css( { 
					left:(parseInt(pos.left)+parseInt(left))+'px', 
					top: (parseInt(pos.top)+parseInt(top))+'px' 
						});
if (direction=='up')
{
	document.getElementById('bubbleUpArrow').style.display='block';
}	
if (direction=='down')
{
	document.getElementById('bubbleBottomArrow').style.display='block';
}
setTimeout("showBubble("+delayHide+")",delayShow);
}

}
function showBubble(delayHide)
{
	$('#bubbleDiv').show("slow",function() 
		{
			setTimeout("HideBubble()",delayHide);									 
		});	
}
function HideBubble()
{
	$('#bubbleDiv').hide("slow");
}



function addToPersonNewsAlerts(memberGuid,personGuid)
{
	
if ($.cookie('tGuid')!=null && $.cookie('tGuid')!="")
  {
	  var a = "'";
		$.get("addPersonNewsAlert.asp", { memberGuid: memberGuid, personGuid: personGuid },
   			function(data){
						 if (data.indexOf("ok")>=0)
							 {
$('#personNewsAlert').html('<a href="/member_persons_news.asp"><img border="0" style="cursor:pointer" align="absmiddle" id="personRemoveEmailAlerts" src="images/personEmailremove.png" alt="Διαχείριση ενημερώσεων με email του προσώπου" title="Διαχείριση ενημερώσεων με email του προσώπου" /></a>');								
							 }
			   });
  }
else
	{

tb_show("caption", "login_popup_Rem.asp?height=210&width=600&modal=true");	
} 	


}



function addToWebTvInform(memberGuid,GrandGuid)
{
	if ($.cookie('tGuid')!=null && $.cookie('tGuid')!="")
	  {
		  $.get("webtvinform.asp", { memberGuid: memberGuid, GrandGuid: GrandGuid },
   			function(data){
					if (data.indexOf("ok")>=0)
						 {
							$('#webTvInform').html('<span><a href="/webTvInformPref.asp" style="color:black">Διαχείριση ενημερώσεων για τα webTv της σειράς</a></span>');							 
						 }
					else
						{
							$('#webTvInform').html('<span><a href="/webTvInformPref.asp" style="color:black">Διαχείριση ενημερώσεων για τα webTv της σειράς</a></span>');							 
						}	 
			})
	  }
	else
	  {
		tb_show("caption", "login_popup_Rem.asp?height=210&width=600&modal=true");	
	  } 		
}








function addToPersonNewsAlertsFromNews(memberGuid,personGuid,acounter)
{
	
if ($.cookie('tGuid')!=null && $.cookie('tGuid')!="")
  {
	  var a = "'";
		$.get("addPersonNewsAlert.asp", { memberGuid: memberGuid, personGuid: personGuid },
   			function(data){
						 if (data.indexOf("ok")>=0)
							 {
$('#personNewsAlert'+acounter).html('<a href="/member_persons_news.asp"><img border="0" height="15" style="cursor:pointer" align="absmiddle" id="personRemoveEmailAlerts" src="images/personEmailremove.png" alt="Διαχείριση ενημερώσεων με email του προσώπου" title="Διαχείριση ενημερώσεων με email του προσώπου" /></a>');								
							 }
			   });
  }
else
	{

tb_show("caption", "login_popup_Rem.asp?height=210&width=600&modal=true");	
} 	


}


function removePersonNewsAlerts(memberGuid,personGuid)
{
		  var a = "'";
if ($.cookie('tGuid')!=null && $.cookie('tGuid')!="")
  {
		$.get("removePersonNewsAlert.asp", { memberGuid: memberGuid, personGuid: personGuid },
   			function(data){
						 if (data.indexOf("ok")>=0)
							 {
$('#personNewsAlert').html('<img border="0" style="cursor:pointer" onclick="javascript:addToPersonNewsAlerts('+a+memberGuid+a+','+a+personGuid+a+')" align="absmiddle" id="personRemoveEmailAlerts" src="images/personEmail.png" alt="Ενημέρωση για ειδήσεις που αφορούν το πρόσωπο" title="Ενημέρωση για ειδήσεις που αφορούν το πρόσωπο" />');								
							 }
			   });
  }
else
	{
	//displayAddToFavoritesDiv('Πρέπει να κάνετε login για την υπηρεσία',2000);
tb_show("caption", "login_popup_Rem.asp?height=210&width=600&modal=true");	
} 	


}












function addToReminders()
{
if ($.cookie('tGuid')!=null && $.cookie('tGuid')!="")
  {
	$('.addToRemindersForm').submit();	
  }
else
	{
	//displayAddToFavoritesDiv('Πρέπει να κάνετε login για την υπηρεσία',2000);
tb_show("caption", "login_popup_Rem.asp?height=210&width=600&modal=true");	
}  		
}


function suggestFriend(guid,type)
{
if ($.cookie('tGuid')!=null && $.cookie('tGuid')!="")
  {
tb_show("caption", "suggestByEmail_popup.asp?height=360&width=600&modal=true&guid="+guid+"&type="+type);	
  }
else
	{
tb_show("caption", "login_popup_Rem.asp?height=210&width=600&modal=true");	
}  		
}




function addToFavorites(page)
{

if ($.cookie('tGuid')!=null && $.cookie('tGuid')!="")
  {
	$.post("pref_insert_ajax.asp", $("#addToFavoritesForm").serialize(),
 	 function(data){
   if (data.indexOf("ok")>=0)
	   {
	  // displayAddToFavoritesDiv('Η προσθήκη έγινε με επιτυχία',2000)
$('#hurtIcon').html("<img onclick=javascript:RedirToFavorites('"+page+"'); align='absmiddle' id='addtofav' class='addtofav' style='cursor:pointer' src='images/isFavorite.png' />")
	   }
   else
	   {
	   document.getElementById('GoToFavorites').style.display = 'block';
	   displayAddToFavoritesDiv('Η επιλογή σας είναι ήδη στα αγαπημένα σας',6000)
	   }
   
  });
}
else
{
// displayAddToFavoritesDiv('Πρέπει να κάνετε login για την υπηρεσία',2000);
tb_show("caption", "login_popup_Rem.asp?height=210&width=600&modal=true"); 
}


}

function displayAddToFavoritesDiv(content,timeout)
{
document.getElementById('addToFavorites').innerHTML = content;
$('.addToFavoritesB').show("fast");
t=setTimeout("HideAddToFavoritesDiv()",timeout);
}


function HideAddToFavoritesDiv()
{
$('.addToFavoritesB').hide("slow");
}





// kalei thn asp h opoia 8a treksei mono stous login xrhtses kai mono se ekeinous pou den  exoun to cookie  cookieFavorites
function changeHurtIcon(guid,page)
{

	if ($.cookie('tGuid')!=null && $.cookie('tGuid')!="")
	{
		$.get("checkFavCookie.asp", {guid:guid},
		  function(data){
			  if (data.indexOf("okGuid")>=0)
				   {
				   $('#hurtIcon').html("<img onclick=javascript:RedirToFavorites('"+page+"'); align='absmiddle' id='addtofav' class='addtofav' style='cursor:pointer' src='images/isFavorite.png' title='Εμφάνιση αγαπημένων' alt='Εμφάνιση αγαπημένων' />")
				   }
		  });	
	}
}



function changePersonAlertIcon(guid,memberGuid)
{
	var a="'";
	if ($.cookie('tGuid')!=null && $.cookie('tGuid')!="")
	{
	
		if($.cookie('PersonAlerts'))
			{
				if ($.cookie('PersonAlerts').indexOf(guid)>=0)
					{
						
						$('#personNewsAlert').html('<a href="/member_persons_news.asp"><img border="0" style="cursor:pointer" align="absmiddle" id="personRemoveEmailAlerts" src="images/personEmailremove.png" alt="Διαχείριση ενημερώσεων με email του προσώπου" title="Διαχείριση ενημερώσεων με email του προσώπου" /></a>');								

					}
			}
	}
}


function changePersonAlertIconFromNews(guid,memberGuid,aCounter)
{
	var a="'";
	if ($.cookie('tGuid')!=null && $.cookie('tGuid')!="")
	{
	
		if($.cookie('PersonAlerts'))
			{
				if ($.cookie('PersonAlerts').indexOf(guid)>=0)
					{
						
						$('#personNewsAlert'+aCounter).html('<a href="/member_persons_news.asp"><img height="15" border="0" style="cursor:pointer" align="absmiddle" id="personRemoveEmailAlerts" src="images/personEmailremove.png" alt="Διαχείριση ενημερώσεων με email του προσώπου" title="Διαχείριση ενημερώσεων με email του προσώπου" /></a>');								

					}
			}
	}
}




function RedirToFavorites(apage)
{

document.location.href = apage;	
}


function hideBanner()
{
document.getElementById('banner300x250').style.display='none';	
}
function displayBanner()
{
document.getElementById('banner300x250').style.display='block';	
}
