
(function($,Edge,compId){var Composition=Edge.Composition,Symbol=Edge.Symbol;
//Edge symbol: 'stage'
(function(symbolName){Symbol.bindElementAction(compId,symbolName,"document","compositionReady",function(sym,e){var todayDate;var nextDate;function getToday(){todayDate=new Date();nextDate=new Date(todayDate.getDate()+1);}
getToday();var headline;var standfirst;var calDate;var noDate;var mainPic=sym.$("otdImg0");var globe=sym.$("globe");var year;var string;var month;var months;var day;var string2;var days;var mm;var dd;var picturetxt;var picture;var thumbRow=0;var thumbRowMax=3;function newDay(){year=todayDate.getYear();month=todayDate.getMonth();day=todayDate.getDate();mm=(month+1<10)?"0"+(month+1):(month+1)+"";dd=(day<10)?"0"+day:day+"";}
newDay();function closestNum(num,arr){var curr=arr[0];var diff=Math.abs(num-curr);for(var i=0;i<arr.length;i++){if(num<=arr[i]){var newdiff=Math.abs(num-arr[i]);if(newdiff<diff){diff=newdiff;curr=arr[i];}}}
return curr;}
function mainXml(){$.ajax({type:"GET",url:"GN30789.xml",dataType:"xml",success:function(xml){string=$(xml).find('monthnames').text();months=string.split(",");picturetxt=$(xml).find('picture').text();headline=$(xml).find('headline').text();sym.$("headlineTxt").html(headline);standfirst=$(xml).find('standfirst').text();sym.$("standfirstTxt").html(standfirst+" "+months[month]+" "+(todayDate.getFullYear()));sym.getSymbol("calendar").$("calDateTxt").html(months[month]+" "+(todayDate.getFullYear()));noDate=$(xml).find('noDate').text();sym.$("noDateTxt").html(noDate);}});}
mainXml();var picNo=0;var eventPix=[];var eventDates=[];var txtHeight;var dayPics;var totalPics;function getDay(){$.ajax({type:"GET",url:mm+"/GN30789_"+mm+".xml",dataType:"xml",success:function(xml){sym.$("textBox").empty();sym.$("textBox").css({'top':597,'height':'auto'});eventPix.length=0;var thumbRowPic;var thumbCount=[];$(xml).find("day").each(function(){var $eventdate=$(this);eventPix.push($eventdate);if(parseInt(dd,10)<=eventDates[eventDates.length-1]){var todaydd=closestNum(parseInt(dd,10),eventDates);dd=(todaydd<10)?"0"+todaydd:todaydd+"";if($eventdate.attr("date")==dd+"-"+mm){if(picNo>0){var t="_"+picNo;var order=picNo;}else{var t="";var order=0;}
var globeSrc=(picNo>0)?mm+"/globe"+mm+"_"+dd+"_"+picNo+".png":mm+"/globe"+mm+"_"+dd+".png";globe.attr("src",mm+"/globe"+mm+"_"+dd+t+".png");mainPic.fadeOut(0);mainPic.attr("src",mm+"/"+mm+"_"+dd+t+".jpg");mainPic.fadeIn(600);var $events=$eventdate.find('event');$events.each(function(){var $event=$(this);thumbCount.push($event);if($event.attr("order")==order){var cap=$event.find('caption').text();var picCap=$event.find('picture').text();var html="<div style='float:left; font-family:pragmatica-web,sans-serif; font-size:16px; padding-left:10px; padding-right:10px; padding-top:5px; padding-bottom:8px'>"+cap+" <span style='font-size:12px'>/ "+picCap+"</span></div>";sym.$("textBox").append(html);sym.$("eventTxtCount").html((order+1)+"/");txtHeight=sym.$("textBox").height();sym.$("textBox").stop().animate({top:532,height:85},500);}});$('#mm'+(parseInt(mm,10)-1)+'dd'+parseInt(dd,10)).addClass('dayNow');$('.thumb'+mm+dd).addClass('thumbselect');$(".thumbselect").css({'border':'solid 0.2em rgb(255,0,0)','opacity':'1.0'});$(".dayNow").css({'color':'rgb(255,255,255)','background-color':'rgb(255,0,0)'});thumbRowPic=eventPix.indexOf($eventdate);thumbRow=Math.floor(thumbRowPic/3);}}else{todayDate.setMonth(todayDate.getMonth()+1);todayDate.setDate(1);getCalendar();newDay();}});dayPics=thumbCount.length;sym.$("eventTxtCount").append(thumbCount.length);if(thumbCount.length>1){sym.$('eventTxtCount').fadeIn(0);if(picNo==0){sym.$('eventBtnTopBack').fadeOut(0);sym.$('arrowleft').fadeOut(0);}else if(picNo>0){sym.$('eventBtnTopBack').fadeIn(0);sym.$('arrowleft').fadeIn(0);}
if(picNo+1<thumbCount.length){sym.$('eventBtnTopNext').fadeIn(0);sym.$('arrowright').fadeIn(0);}else if(picNo+1==thumbCount.length){sym.$('eventBtnTopNext').fadeOut(0);sym.$('arrowright').fadeOut(0);}}else{sym.$('eventTxtCount').fadeOut(0);sym.$('eventBtnTopNext').fadeOut(0)
sym.$('eventBtnTopBack').fadeOut(0)
sym.$('arrowright').fadeOut(0);sym.$('arrowleft').fadeOut(0);}
thumbRowMax=Math.ceil((eventPix.length)/3)+1;if(thumbRow<thumbRowMax-3||thumbRowMax<3){sym.getSymbol('thumbBtnsMc').$('thumbBox').stop().animate({'top':thumbRow*-101+'px'},400);}else{sym.getSymbol('thumbBtnsMc').$('thumbBox').stop().animate({'top':(thumbRowMax-3)*-101+'px'},400);}},error:function(){todayDate.setMonth(todayDate.getMonth()+1);todayDate.setDate(1);getCalendar();newDay();}});}
function getMonth(){sym.getSymbol('thumbBtnsMc').$("thumbBox").empty();eventDates.length=0;$.ajax({type:"GET",url:mm+"/GN30789_"+mm+".xml",dataType:"xml",success:function(xml){todayDate.setYear(todayDate.getFullYear());$(xml).find("day").each(function(){var $eventdate=$(this);var ddselect=$eventdate.attr("date").substr(0,2);var mmselect=$eventdate.attr("date").substr(3,2);eventDates.push(parseInt(ddselect,10));$('#mm'+(parseInt(mmselect,10)-1)+'dd'+parseInt(ddselect,10)).addClass('select');$('#mm'+(parseInt(mmselect,10)-1)+'dd'+parseInt(ddselect,10)).on("click touchstart",calDate($eventdate.attr("date"),todayDate.getFullYear(),0));var $events=$eventdate.find('event');var thumbCount=[];$events.each(function(){var $event=$(this);thumbCount.push($event);var thumbNo=(thumbCount.indexOf($event)>0)?"_"+thumbCount.indexOf($event):"";var thumbTable="<div style='background-image:url("+mmselect+"/"+mmselect+"_"+ddselect+thumbNo+".jpg)' id='th"+mmselect+ddselect+thumbNo+"' class='thumbBtns thumb"+mmselect+ddselect+"'>";sym.getSymbol('thumbBtnsMc').$("thumbBox").append(thumbTable);$('#th'+mmselect+ddselect+thumbNo).on("click touchstart",calDate($eventdate.attr("date"),todayDate.getFullYear(),thumbCount.indexOf($event)));});$(".select").css({'background-color':'rgb(200,230,255)','cursor':'pointer'});$(".thumbBtns").css({'float':'left','border':'solid 0.2em rgb(255,255,255)','cursor':'pointer','opacity':'0.6','background-position':'center','background-size':'148px 95px','width':'95px','height':'95px'});});getDay();}});}
var calDate=function(dateselect,yrC,thumbno){return function(e){$('.thumbBtns').removeClass('thumbselect');$('.monthNow').removeClass('dayNow');$(".monthNow").css({'color':'rgb(0,0,0)','background-color':'rgb(255,255,255)'});$('.thumbBtns').css({'border':'solid 0.2em rgb(255,255,255)','opacity':'0.6'});$('.select').css({'color':'rgb(0,0,0)','background-color':'rgb(200,230,255)'});var dayC=parseInt(dateselect.substr(0,2),10);var monthC=parseInt(dateselect.substr(3,2),10)-1;todayDate=new Date(yrC,monthC,dayC);picNo=thumbno;newDay();getDay();e.preventDefault();};};var showPlus=0;sym.$('noDateBtn').click(function(){if(showPlus==0){sym.getSymbol("noDateBtn").$("plus").fadeOut(60);thumbRow=thumbRowMax-3;sym.getSymbol('thumbBtnsMc').$('thumbBox').stop().animate({'top':thumbRow*-101+'px'},600);showPlus=1;}else{sym.getSymbol("noDateBtn").$("plus").fadeIn(60);thumbRow=0;sym.getSymbol('thumbBtnsMc').$('thumbBox').stop().animate({'top':thumbRow*-101+'px'},600);showPlus=0;}});var thumbsCount=0;sym.$("arrowleft").css({'cursor':'pointer'});sym.$("arrowright").css({'cursor':'pointer'});sym.$("eventBtnTopBack").on("click touchstart",eventChange);sym.$("arrowleft").on("click touchstart",eventChange);sym.$("eventBtnTopBack").mouseover(function(){sym.getSymbol("eventBtnTopBack").$("btnOut").fadeOut(0);});sym.$("eventBtnTopBack").mouseout(function(){sym.getSymbol("eventBtnTopBack").$("btnOut").fadeIn(0);});sym.$("eventBtnTopNext").on("click touchstart",eventChange);sym.$("arrowright").on("click touchstart",eventChange);sym.$("eventBtnTopNext").mouseover(function(){sym.getSymbol("eventBtnTopNext").$("btnOut").fadeOut(0);});sym.$("eventBtnTopNext").mouseout(function(){sym.getSymbol("eventBtnTopNext").$("btnOut").fadeIn(0);});function eventChange(){var selected=$(this).attr("id");if(selected=="Stage_eventBtnTopNext"||selected=="Stage_arrowright"){picNo=picNo+1;}else if(selected=="Stage_eventBtnTopBack"||selected=="Stage_arrowleft"){picNo=picNo-1;}
getDay();}
thumbNav=[];for(var h=0;h<2;h++){var thumbBtnSymbols=sym.getSymbol("thumbNav"+h);thumbBtnSymbols.setVariable("thumbId",h);thumbNav.push(thumbBtnSymbols);}
$.each(thumbNav,function(count,thumbInTheArray){var thumbBtnElement=thumbInTheArray.getSymbolElement();thumbBtnElement.on("click touchstart",{thumbId:count},thumbBtnClick);thumbBtnElement.on("mouseover",{thumbId:count},thumbShow);thumbBtnElement.on("mouseout",{thumbId:count},thumbHide);})
function thumbBtnClick(e){var thumb_id=(e.data.thumbId);if(thumb_id==0){if(thumbRow>0){thumbRow--;}}else{if(thumbRow<(thumbRowMax-3)){thumbRow++;}else{thumbRow=thumbRowMax-3;}}
sym.getSymbol('thumbBtnsMc').$('thumbBox').stop().animate({'top':thumbRow*-101+'px'},400);}
function thumbShow(e){var thumb_id=(e.data.thumbId);sym.getSymbol("thumbNav"+thumb_id).$("btnOut").fadeOut(0);}
function thumbHide(e){var thumb_id=(e.data.thumbId);sym.getSymbol("thumbNav"+thumb_id).$("btnOut").fadeIn(0);}
function getCalendar(){$.ajax({type:"GET",url:"GN30789.xml",dataType:"xml",success:function(xml){string=$(xml).find('monthnames').text();months=string.split(",");string2=$(xml).find('daynames').text();days=string2.split(",");sym.getSymbol("calendar").$("calTxt").empty();var yrC=todayDate.getFullYear();var monthC=todayDate.getMonth();var leap;if(monthC==1){leap=((parseInt(yrC)%4==0)&&(parseInt(yrC)%100!=0)||(parseInt(yrC)%400==0))?"true":"false";var febDays=(leap=="true")?29:28;}
var daysPerMonth=["31",febDays,"31","30","31","30","31","31","30","31","30","31"];var nextMonthC=monthC+1;var prevMonthC=monthC-1;var firstOfMonth=new Date(yrC,monthC,1);var weekdays=firstOfMonth.getDay();var weekdays2=weekdays;var numOfDays=daysPerMonth[monthC];var calContent="";var calendarBody="";var counter=1;while(weekdays>0){calContent+="<td class='monthPre'></td>";weekdays--;}
while(counter<=numOfDays){if(weekdays2>6){weekdays2=0;calContent+="</tr><tr height='48px'>";}
calContent+="<td id='mm"+monthC+"dd"+counter+"' class='monthNow'>"+counter+"</td>";weekdays2++;counter++;}
calendarBody+="<table class='calendar' width='100%'><tr class='daysOfWeek'><td>"+days[0]+"</td><td>"+days[1]+"</td><td>"+days[2]+"</td><td>"+days[3]+"</td><td>"+days[4]+"</td><td>"+days[5]+"</td><td>"+days[6]+"</td></tr>";calendarBody+="<tr height='48px'>";calendarBody+=calContent;calendarBody+="</tr></table>";sym.getSymbol("calendar").$("calTxt").append(calendarBody);$(".calendar").css({'font-family':'Times New Roman,Times,serif','font-size':'30px','width':'100%','border-collapse':'collapse'});$(".monthNow").css({'color':'rgb(0,0,0)','background-color':'rgb(255,255,255)','text-align':'center','border':'0.1em solid rgb(255,255,255)'});$(".daysOfWeek td").css({'font-family':'pragmatica-web,arial,sans-serif','width':'14%','color':'rgb(100,100,100)','text-align':'center'});sym.getSymbol("calendar").$("calDateTxt").text(months[monthC]+" "+(yrC));var testDate=new Date();if(testDate>=todayDate){sym.getSymbol("calendar").$("monthBtn0").fadeOut(0);}else{sym.getSymbol("calendar").$("monthBtn0").fadeIn(0);}
getMonth();}});}
getCalendar();var calArray=["monthBtn0","monthBtn1"];for(var i=0;i<2;i++){sym.getSymbol("calendar").$("monthBtn"+i).on("click",changeMonth);sym.getSymbol("calendar").$("monthBtn"+i).on("mouseover",calOver);sym.getSymbol("calendar").$("monthBtn"+i).on("mouseout",calOut);sym.getSymbol("calendar").$("monthBtn"+i).css({"cursor":"pointer"});}
function changeMonth(){var selected_id=$(this).attr("id");if(selected_id=="Stage_calendar_monthBtn0"){todayDate.setMonth(todayDate.getMonth()-1);todayDate.setDate(1);}else if(selected_id=="Stage_calendar_monthBtn1"){todayDate.setMonth(todayDate.getMonth()+1);todayDate.setDate(1);}
newDay();getCalendar();}
function calOver(){var selected_id=$(this).attr("id");$("#"+selected_id+"_btnOut").fadeOut(0);}
function calOut(){var selected_id=$(this).attr("id");$("#"+selected_id+"_btnOut").fadeIn(0);}});
//Edge binding end 

// VIDEO BTN 1 =========================================================

// VIDEO BTN 2 =========================================================
})("stage");
//Edge symbol end:'stage'

//=========================================================

//Edge symbol: 'handMc'
(function(symbolName){})("handMc");
//Edge symbol end:'handMc'

//=========================================================

//Edge symbol: 'styleMc'
(function(symbolName){})("styleMc");
//Edge symbol end:'styleMc'

//=========================================================

//Edge symbol: 'rollBtn'
(function(symbolName){})("rollBtn");
//Edge symbol end:'rollBtn'

//=========================================================

//Edge symbol: 'rollBtn_1'
(function(symbolName){})("rollBtn_1");
//Edge symbol end:'rollBtn_1'

//=========================================================

//Edge symbol: 'StyleBase'
(function(symbolName){})("StyleBase");
//Edge symbol end:'StyleBase'

//=========================================================

//Edge symbol: 'eventBtnTop'
(function(symbolName){})("eventBtnTop");
//Edge symbol end:'eventBtnTop'

//=========================================================

//Edge symbol: 'arrowBtn'
(function(symbolName){})("arrowBtn");
//Edge symbol end:'arrowBtn'

//=========================================================

//Edge symbol: 'picNavBtn'
(function(symbolName){})("picNavBtn");
//Edge symbol end:'picNavBtn'

//=========================================================

//Edge symbol: 'noDateBtn'
(function(symbolName){})("noDateBtn");
//Edge symbol end:'noDateBtn'

//=========================================================

//Edge symbol: 'thumbBtnsMc'
(function(symbolName){})("thumbBtnsMc");
//Edge symbol end:'thumbBtnsMc'

//=========================================================

//Edge symbol: 'calendar'
(function(symbolName){})("calendar");
//Edge symbol end:'calendar'
})(jQuery,AdobeEdge,"GraphicNews30789");