var cookieList=function(cookieName){var cookie=$.cookie(cookieName);var items=cookie?cookie.split(/,/):new Array;return{"add":function(val){items.push(val);$.cookie(cookieName,items,{path:"/"})},"clear":function(){$.cookie(cookieName,null)},"items":function(){return items}}};
$(document).ready(function(){if($.cookie("event-shortlist")){var x=$.cookie("event-shortlist");var newcookie=x.split(/,/);$("a.shortlist-event").each(function(index){var currentId=$(this).attr("rel");if($.inArray(currentId,newcookie)>-1){$(this).addClass("added-shortlist");var str="Remove from shortlist";$(this).html(str)}})}$("#events div.shortlist-listing a.shortlist-remove").click(function(){$(this).parent().remove();$("div#content-main div.shortlist-listing").not(":has(div.article-summary)").append('<p>There are no more items in your events shortlist. To view or add more events or things to do, please visit our <a href="http://www.sydneyolympicpark.com.au/whats_on">events</a> page.')});
$("a.shortlist-event").click(function(){var currentId=$(this).attr("rel");var list=new cookieList("event-shortlist");var list=list.items();if(jQuery.inArray(currentId,list)>-1){arrayPosition=jQuery.inArray(currentId,list);var x=$.cookie("event-shortlist");var y=x.split(/,/);x=$.grep(y,function(value){return value!=currentId});var list=cookieList("event-shortlist");list.clear();$.cookie("event-shortlist",x,{path:"/"});x=$.cookie("event-shortlist");if(x==null){var str="Add to my venue shortlist";$(this).html(str);
return false}var newcookie=x.split(/,/);$("a.shortlist-event").each(function(index){var currentId=$(this).attr("rel");if($.inArray(currentId,newcookie)>-1){$(this).addClass("added-shortlist");var str="Remove from shortlist";$(this).html(str)}else{$(this).removeClass("added-shortlist");var str="Add to shortlist";$(this).html(str)}})}else{var currentId=$(this).attr("rel");var list=new cookieList("event-shortlist");list.add(currentId);var x=$.cookie("event-shortlist");var y=x.split(/,/);$("a.shortlist-event").each(function(index){var currentId=
$(this).attr("rel");if($.inArray(currentId,y)>-1){$(this).addClass("added-shortlist");var str="Remove from shortlist";$(this).html(str)}})}})});
