
$(document).ready(function(){$("#datepickerInput").datepicker({changeMonth:true,changeYear:true});$("#datepicker").click(function(){$("#datepickerInput").datepicker("show");})
$("#datepickerInput").change(function(){var s=$("#datepickerInput").val().split("/",3);var date=s[2].toString()+"-"+s[0].toString()+"-"+s[1].toString();window.location=window.location.pathname+"?dtmDate="+date;})})
$(document).ready(function(){var left;var top;$('.sectionList').mouseover(function(){top=$('.sectionList').offset().top+20;left=$('.sectionList').offset().left;$('.sectionsMenu').remove();$('body').append('<div class="sectionsMenu" style="z-index:1000;position:absolute;top:'+top+'px;left:'+left+'px;">'+$('.sectList').html()+'</div>');$('body').append('<iframe class="shim" width="150" height="200" src="javascript:void(0);" style="z-index:999;position:absolute;top:'+top+'px;left:'+left+'px;"></iframe>');$('.shim').css('opacity',0.01);$('div.sectionsMenu').mouseover(function(){$('#page').mouseover(function(){$('.sectionsMenu').remove();$('.shim').remove();});});$('div.ad').mouseover(function(){$('.sectionsMenu').remove();$('.shim').remove();});$('div.main_menu_wrap').mouseover(function(){$('.sectionsMenu').remove();$('.shim').remove();});});$('body').click(function(){$('.sectionsMenu').remove();$('.shim').remove();});});$(document).ready(function(){var tabs=$('div.plTabContainer > div');$('div.popularList div.header-block ul li a').click(function(){tabs.hide();$(this.hash).fadeIn('slow');$('div.popularList div.header-block ul li a').removeClass('selected');$(this).addClass('selected');return false;}).filter(':first').click();})
$(document).ready(function(){var tabs=$('div#tabContainer > div');$('div#latestNewsCats a').click(function(){tabs.hide();$(this.hash).fadeIn('slow');$('div#latestNewsCats a').removeClass('selected');$(this).addClass('selected');return false;}).filter(':first').click();})
$(document).ready(function(){$(".increaseFont").click(function(){$('.storyContent .body *').css('font-size',"1.4em");$('.storyContent .body *').css('line-height',"1");$('.storyContent .prologue *').css('font-size',"1.4em");$('.storyContent .prologue *').css('line-height',"1");});$(".decreaseFont").click(function(){$('.storyContent .body *').css('line-height',"");$('.storyContent .body *').css('font-size',"1.1em");$('.storyContent .prologue *').css('line-height',"");$('.storyContent .prologue *').css('font-size',"1.1em");});});$(document).ready(function(){var tabs=$('div#newsBoxContainer > div');var noOfItems=tabs.size()
$('span.slide-dots a').click(function(){tabs.hide();$(this.hash).fadeIn('slow');$('span.slide-dots a').removeClass('active-dot');if($('.type'+$(this).attr('class')).html()=="advertorial"){$('.section').html("");$('.itemUrl'+$(this).attr('class')).attr('href',$('.advertorialurl'+$(this).attr('class')).html());$('.articleHeaderDefault'+$(this).attr('class')).attr('href',$('.advertorialurl'+$(this).attr('class')).html());}else{$('.section').html($('.sec'+$(this).attr('class')).html());}
$(this).addClass('active-dot');var bottom=$(this.hash).children('.fade-slide').height()+11;$(this.hash).children('.fade-slide').css("bottom",bottom+"px");return false;}).filter(':first').click();$('div.slide-nav a.lfArrow').click(function(){var hash=$('span.slide-dots a.active-dot').attr('href');var currentItem=parseInt(hash.replace('#box-',''));currentItem=currentItem-1;if(currentItem<1){currentItem=noOfItems;}
$("span.slide-dots a[href='#box-"+currentItem+"']").click();})
$('div.slide-nav a.rtArrow').click(newsBoxSlide);function newsBoxSlide(){var hash=$('span.slide-dots a.active-dot').attr('href');var currentItem=parseInt(hash.replace('#box-',''));currentItem=currentItem+1;if(currentItem>noOfItems){currentItem=1;}
$("span.slide-dots a[href='#box-"+currentItem+"']").click();}
if($('#news247-teaser').length>0){setInterval(newsBoxSlide,5000);}})
function initNSThumbNavSlider(){var o={cntrWidth:$('#hpNsThumbSlider').outerWidth(),itemWidth:$('#hpNsThumbSlider ul li:last').outerWidth(),noOfItems:$('#hpNsThumbSlider ul > *').size(),noOfItemsPerScreen:$('#hpNsThumbSlider').outerWidth()/$('#hpNsThumbSlider ul li:last').outerWidth(),ul:$('#hpNsThumbSlider ul')};if(o.noOfItems>o.noOfItemsPerScreen){$('div.nav span.next a').click(function(){slideNsTo("next",o);});$('div.nav span.prev a').click(function(){slideNsTo("prev",o);});enableNsBtn("next",o);disableNsBtn("prev",o);}else{disableNsBtn("prev",o);disableNsBtn("next",o);}}
function slideNsTo(where,o){var firstItemInList=returnItemPositionInListN(returnUlPosition(o.ul),o.itemWidth);switch(where)
{case'prev':var noOfPreviousItems=firstItemInList-1;var goLeft=0;if(noOfPreviousItems>=o.noOfItemsPerScreen){goLeft=o.noOfItemsPerScreen*o.itemWidth;}
else{goLeft=noOfPreviousItems*o.itemWidth;}
goLeft=(returnUlPosition(o.ul))+goLeft;break;case'next':var noOfNextItems=o.noOfItems-firstItemInList;var goRight=0;if(noOfNextItems>=(o.noOfItemsPerScreen*2)){goRight=o.noOfItemsPerScreen*o.itemWidth;}
else{var s=(noOfNextItems+1)-o.noOfItemsPerScreen;goRight=s*o.itemWidth;}
goRight=(returnUlPosition(o.ul))-goRight;goLeft=goRight;break;}
if(goLeft==0){disableNsBtn("prev",o);}else{enableNsBtn("prev",o)}
var afterSlideFirstItemPosition=returnItemPositionInListN(goLeft,o.itemWidth);if((o.noOfItems-afterSlideFirstItemPosition)>=o.noOfItemsPerScreen){enableNsBtn("next",o);}else{disableNsBtn("next",o);}
$('#hpNsThumbSlider ul:not(:animated)').animate({'left':goLeft},500,function(){});}
function enableNsBtn(which,o){$('div.nav span.'+which+' a').show();$('div.nav span.'+which+' span').hide();}
function disableNsBtn(which,o){$('div.nav span.'+which+' a').hide();$('div.nav span.'+which+' span').show();$('div.nav span.'+which).css("cursor","default");}
function returnUlPosition(ul){return parseInt(ul.css('left').replace("px",""));}
$(document).ready(function(){$("#dialog-form").dialog("destroy");$("#dialog-form").dialog({autoOpen:false,height:350,width:350,modal:true,resizable:false,closeOnEscape:true,buttons:{'Αποστολή σε φίλο/η':function(){$('#emailform').submit();},'Άκυρο':function(){$("#dialog-form").dialog("close");}},close:function(){$('#emailform')[0].reset();}});$('#emailShare').click(function(){$('#dialog-form').dialog('open');});$('#emailShareIcon').click(function(){$('#dialog-form').dialog('open');});});function dialogClose(){$("#dialog-form").dialog("close");}
function initializeNewspaperNavSlider(o){if(o.noOfItems>o.noOfItemsPerScreen){var goLeft=0;if(o.selectedItem<=o.noOfItemsPerScreen){goLeft=0;enableBtn("next",o);}else if((o.noOfItems-o.selectedItem)>=o.noOfItemsPerScreen){var noOfPreviousItems=o.selectedItem-1;goLeft=noOfPreviousItems*o.itemWidth;enableBtn("prev",o);enableBtn("next",o);}else{goLeft=(o.noOfItems-o.noOfItemsPerScreen)*o.itemWidth;enableBtn("prev",o);}
o.ul.css({'left':'-'+goLeft+'px'});}
$("#newspaperSlider ul li#ns_"+o.selectedItem+" img ").css("border-color","#000");}
function slideTo(where,o){var firstItemInList=returnItemPositionInListN(o.ul.position().left,o.itemWidth);switch(where)
{case'prev':var noOfPreviousItems=firstItemInList-1;var goLeft=0;if(noOfPreviousItems>=o.noOfItemsPerScreen){goLeft=o.noOfItemsPerScreen*o.itemWidth;}
else{goLeft=noOfPreviousItems*o.itemWidth;}
goLeft=(o.ul.position().left)+goLeft;break;case'next':var noOfNextItems=o.noOfItems-firstItemInList;var goRight=0;if(noOfNextItems>=(o.noOfItemsPerScreen*2)){goRight=o.noOfItemsPerScreen*o.itemWidth;}
else{var s=(noOfNextItems+1)-o.noOfItemsPerScreen;goRight=s*o.itemWidth;}
goRight=(o.ul.position().left)-goRight;goLeft=goRight;break;}
if(goLeft==0){disableBtn("prev",o);}else{enableBtn("prev",o)}
var afterSlideFirstItemPosition=returnItemPositionInListN(goLeft,o.itemWidth);if((o.noOfItems-afterSlideFirstItemPosition)>=o.noOfItemsPerScreen){enableBtn("next",o);}else{disableBtn("next",o);}
$('#newspaperSlider ul:not(:animated)').animate({'left':goLeft},500,function(){});}
function enableBtn(which,o){$('#newspaperSliderCntr div.'+which).unbind('click');$('#newspaperSliderCntr div.'+which).click(function(){slideTo(''+which+'',o);});$('#newspaperSliderCntr div.'+which).css("cursor","pointer");}
function disableBtn(which,o){$('#newspaperSliderCntr div.'+which).unbind('click');$('#newspaperSliderCntr div.'+which).css("cursor","default");}
function returnItemPositionInListN(pos,itemWidth){return(Math.abs(pos)+itemWidth)/itemWidth;}
function returnLiMarginRight(){return parseInt($('.photostorySliderWrapper .slider ul li').css('margin-right').replace("px",""));}
function initializePhotostorySlider(){var o={cntrWidth:$('.photostorySliderWrapper .slider').outerWidth(),itemWidth:$('.photostorySliderWrapper .slider ul li:last').outerWidth()+returnLiMarginRight(),noOfItems:$('.photostorySliderWrapper .slider ul > *').size(),noOfItemsPerScreen:$('.photostorySliderWrapper .slider').outerWidth()/($('.photostorySliderWrapper .slider ul li:last').outerWidth()+returnLiMarginRight()),ul:$('.photostorySliderWrapper .slider ul')};if(o.noOfItems>o.noOfItemsPerScreen){$('div.nav span.next a').click(function(){slideTo("next",o);});$('div.nav span.prev a').click(function(){slideTo("prev",o);});enableButton("next",o);disableButton("prev",o);}else{disableButton("prev",o);disableButton("next",o);}}
$(window).load(function(){if($('.photostorySliderWrapper .slider').length>0){initializePhotostorySlider();}});$(document).ready(function(){$(".slider ul li").click(function(){var thisId="caption_"+$(this).attr("id").substring(15);var thisCaption=$("#"+thisId).html();$("#gallery-caption span").html(thisCaption);});$("a#prev-img").click(function(){goToPhoto("prev");});$("a#next-img").click(function(){goToPhoto("next");});$("a#photo-info").click(function(){var pos=parseInt($('div#gallery-controls').css('bottom').replace("px",""));if(pos<50){$('div#gallery-controls').animate({"bottom":"+=50px","height":"+=50px"},"slow");$('span#captionArr').html("Κρύψε Περιγραφή ↓");}else{$('div#gallery-controls').animate({"bottom":"-=50px","height":"-=50px"},"slow");$('span#captionArr').html("Δες Περιγραφή ↑");}});});function goToPhoto(where){var array=$("div.slider ul > li");var liIdValue="";$.each(array,function(index,value){liIdValue=$(value).attr("id").replace("photoStoryItem_","");array[index]=parseInt(liIdValue);});var id=$('#iframe').contents().find('#imgHiddenId').html();var imgVersion=$('#iframe').contents().find('#imgVersion').html();var iframePath=publicationUrl+"template/widgets/photostoryContent/view/helpers/imageFrame.jsp?id=";id=parseInt(id);var pos=$.inArray(id,array);var nextPhotoId="";if(where=="next"){nextPhotoId=array[pos+1];if(nextPhotoId==null){nextPhotoId=array[0];}}else{nextPhotoId=array[pos-1];if(nextPhotoId==null){nextPhotoId=array[array.size()-1];}}
iframePath=iframePath+nextPhotoId+"&imgversion="+imgVersion;$('#iframe').attr("src",iframePath);$('#gallery-caption span').html($('#caption_'+nextPhotoId).html());}
function slide(where,o){var firstItemInList=returnItemPositionInListN(returnUlPosition(o.ul),o.itemWidth);switch(where)
{case'prev':var noOfPreviousItems=firstItemInList-1;var goLeft=0;if(noOfPreviousItems>=o.noOfItemsPerScreen){goLeft=o.noOfItemsPerScreen*o.itemWidth;}
else{goLeft=noOfPreviousItems*o.itemWidth;}
goLeft=(returnUlPosition(o.ul))+goLeft;break;case'next':var noOfNextItems=o.noOfItems-firstItemInList;var goRight=0;if(noOfNextItems>=(o.noOfItemsPerScreen*2)){goRight=o.noOfItemsPerScreen*o.itemWidth;}
else{var s=(noOfNextItems+1)-o.noOfItemsPerScreen;goRight=s*o.itemWidth;}
goRight=(returnUlPosition(o.ul))-goRight;goLeft=goRight;break;}
if(goLeft==0){disableButton("prev",o);}else{enableButton("prev",o)}
var afterSlideFirstItemPosition=returnItemPositionInListN(goLeft,o.itemWidth);if((o.noOfItems-afterSlideFirstItemPosition)>=o.noOfItemsPerScreen){enableButton("next",o);}else{disableButton("next",o);}
$('.photostorySliderWrapper .slider ul:not(:animated)').animate({'left':goLeft},500);}
function enableButton(which,o){$('.photostorySliderWrapper .'+which).unbind('click');$('.photostorySliderWrapper .'+which).click(function(){slide(''+which+'',o);});$('.photostorySliderWrapper .'+which).css("cursor","pointer");}
function disableButton(which,o){$('.photostorySliderWrapper .'+which).unbind('click');$('.photostorySliderWrapper .'+which).css("cursor","default");}
$(document).ready(function(){var cfhtml=$("<div></div>").load("/template/framework/generic/contactForm.jsp");var $contactForm=$("<div id='dialog-contact-form'></div>").html(cfhtml).dialog({autoOpen:false,title:'Επικοινωνία',height:480,width:350,resizable:false,closeOnEscape:true,modal:true,buttons:{'Αποστολή':function(){$('#contact-form').submit();},'Καθαρισμός':function(){$('#contact-form')[0].reset();}},close:function(){$('#contact-form')[0].reset();}});$('#contactAnchor').click(function(){$contactForm.dialog('open');});$('#advertiseAnchor').click(function(){$contactForm.dialog('open');$('#contact-form select option:selected').removeAttr('selected');$('#contact-form select  option[value=Advertise]').attr('selected','selected');});})
function dialogContactClose(){$('#dialog-contact-form').dialog("close");}
var emailAddressFilter=/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9])+(\.[a-zA-Z0-9_-]+)+$/;var bylineFieldErrorId="comment-form-byline-error";var emailFieldErrorId="comment-form-email-error";var titleFieldErrorId="comment-form-title-error";var bodyFieldErrorId="comment-form-body-error";var bylineFieldErrorMessage="Το όνομα δεν μπορεί να είναι κενό!";var emailFieldErrorMessage="Το email δεν είναι σωστό!";var titleFieldErrorMessage="Ο τίτλος δεν μπορεί να είναι κενός!";var bodyFieldErrorMessage="Το μήνυμα δεν μπορεί να είναι κενό!";function isEmpty(form,fieldName){var value=form[fieldName].value;return value==null||value=="";}
function validateEmailAddress(form,fieldName,errorElementId,emailFieldErrorMessage){return validateField(form,fieldName,errorElementId,emailFieldErrorMessage,emailAddressFilter);}
function validateField(form,fieldName,errorElementId,errorMessage,filter){var field=form[fieldName];var value=field.value;if(filter.test(value)){return true;}
field.focus();var errorElement=getElementById(errorElementId);errorElement.innerHTML=errorMessage;errorElement.style.display='block';field.style.border='1px solid red';return false;}
function validateEmptyField(form,fieldName,errorElementId,errorMessage){var field=form[fieldName];var errorElement=getElementById(errorElementId);if(isEmpty(form,fieldName)){field.focus();errorElement.innerHTML=errorMessage;errorElement.style.display='block';field.style.border='1px solid red';return false;}
else{return true;}}
function revertToNormalField(form,fieldName,errorElementId){var field=form[fieldName];var errorElement=getElementById(errorElementId);if(errorElement){errorElement.innerHTML="";errorElement.style.display='none';field.style.border='1px solid #999';}}
function validateCommentForm(form){var titleFieldSuccess=true;var bodyFieldSuccess=true;var emailFieldSuccess=true;var bylineFieldSuccess=true;if(validateEmptyField(form,'body',bodyFieldErrorId,bodyFieldErrorMessage)){revertToNormalField(form,'body',bodyFieldErrorId);bodyFieldSuccess=true;}
else{bodyFieldSuccess=false;}
if(form['title'].type=='hidden'){titleFieldSuccess=true;}
else if(validateEmptyField(form,'title',titleFieldErrorId,titleFieldErrorMessage)){revertToNormalField(form,'title',titleFieldErrorId);titleFieldSuccess=true;}
else{titleFieldSuccess=false;}
if(form['email'].type=='hidden'){emailFieldSuccess=true;}
else if(validateEmailAddress(form,'email',emailFieldErrorId,emailFieldErrorMessage)){revertToNormalField(form,'email',emailFieldErrorId);emailFieldSuccess=true;}
else{emailFieldSuccess=false;}
if(form['field(byline)'].type=='hidden'){bylineFieldSuccess=true;}
else if(validateEmptyField(form,'field(byline)',bylineFieldErrorId,bylineFieldErrorMessage)){revertToNormalField(form,'field(byline)',bylineFieldErrorId);bylineFieldSuccess=true;}
else{bylineFieldSuccess=false;}
return(titleFieldSuccess&&bodyFieldSuccess&&emailFieldSuccess&&bylineFieldSuccess);}
function init(containerID,lClickURL,rClickURL,position,width,height,debug){container=$(containerID);coords=container.offset();position=(position==undefined)?"absolute":position;width=(width==undefined)?130:width;height=(height==undefined)?130:height;leftArea=$('<div>').css({"position":position,"left":coords.left-width,"top":coords.top,"width":width+"px","cursor":"pointer","height":height+"px"});var rightArea=$('<div>').css({"position":position,"left":coords.left+container.outerWidth(),"top":coords.top,"width":width+"px","cursor":"pointer","height":height+"px"});$(rightArea).click(function(){window.open(rClickURL);});$(leftArea).click(function(){window.open(lClickURL);});$('body').append(leftArea);$('body').append(rightArea);if(debug){leftArea.css("background-color","#990");rightArea.css("background-color","#990");}}
