(function($){$.fn.newsHeadline=function(options){var defaults={xml_path:"/xml/default.asp",maxNews:10,uniqueListID:"",linkPhotoToDetail:0,charHeadline:999,charBrief:9999,charLong:9999,getMedia:0,mediaCallback:null,callback:null};var options=$.extend(defaults,options);return this.each(function(){var obj=$(this),groupid=obj.attr("nid"),news=new Array();if(groupid.length>0){$.ajax({type:"GET",url:options.xml_path+"?sid="+JavaScriptSchoolID+"&type=news&useCDATA=false&id="+groupid,dataType:"xml",success:function(xml){var ncount=0;$(xml).find('item').each(function(){news[ncount++]={title:$(this).find("title").text(),newsID:$(this).find("title").attr("newsID"),numPhoto:$(this).find("title").attr("numPhoto"),url:$(this).find("url").text(),brief:$(this).find("brief").text(),pubDate:$(this).find("pubDate").text(),longDesc:$(this).find("full").text(),thumbnail:$(this).find("image").find("tpath").text(),thumbHeight:$(this).find("image").find("tpath").attr("height"),thumbWidth:$(this).find("image").find("tpath").attr("width"),fullImage:$(this).find("image").find("path").text(),fullHeight:$(this).find("image").find("path").attr("height"),fullWidth:$(this).find("image").find("path").attr("width"),imageCap:$(this).find("image").find("cap").text(),hasVideo:$(this).find("video").text(),hasAudio:$(this).find("audio").text(),hasSlideshow:$(this).find("photo").text()}})},error:function(request,tStatus,eThrown){if(window.console&&window.console.firebug){console.log("newsHeadline plugin error: request='"+request+"', tStatus='"+tStatus+"', eThrown='"+eThrown+"'")}},complete:function(){if(news.length>0){$AllHeadlines=$("<ul></ul>").attr("id",options.uniqueListID+"headlines"+groupid).addClass("newsReturn");for(var i=0;i<news.length&&i<options.maxNews;i++){$NewsItem=$("<li></li>").attr("id","story"+news[i].newsID).attr("numPhoto",news[i].numPhoto).addClass("newsItem").addClass("storyNum_"+(i+1));$Images=$("<div></div>").addClass("imageDiv");$Thumb=$("<img/>").attr("src",news[i].thumbnail).attr("height",(news[i].thumbHeight.length>0)?news[i].thumbHeight:"").attr("width",(news[i].thumbWidth.length>0)?news[i].thumbWidth:"").attr("border","0").attr("alt",news[i].imageCap).addClass("thumb");$Full=$("<img/>").attr("src",news[i].fullImage).attr("height",(news[i].fullHeight.length>0)?news[i].fullHeight:"").attr("width",(news[i].fullWidth.length>0)?news[i].fullWidth:"").attr("border","0").attr("alt",news[i].imageCap).addClass("full");if(options.linkPhotoToDetail>0){$("<a></a>").attr("href",news[i].url).html($Thumb).appendTo($Images);$("<a></a>").attr("href",news[i].url).html($Full).appendTo($Images)}else{$Thumb.appendTo($Images);$Full.appendTo($Images)}$("<p></p>").addClass("imageCaption").html(news[i].imageCap).appendTo($Images);$Images.appendTo($NewsItem);$("<div></div>").html(news[i].pubDate).addClass("pubDate").appendTo($NewsItem);$("<div></div>").html(news[i].title).fSplit({maxChar:options.charHeadline}).addClass("headlineNoLink").appendTo($NewsItem);$("<a></a>").attr("href",news[i].url).html(news[i].title).fSplit({maxChar:options.charHeadline}).addClass("headlineLink").appendTo($NewsItem);$("<p></p>").addClass("newsBrief").html(news[i].brief).fSplit({maxChar:options.charBrief}).appendTo($NewsItem);$("<p></p>").addClass("newsLong").html(news[i].longDesc).fSplit({maxChar:options.charLong}).appendTo($NewsItem);if(options.getMedia>0&&(news[i].hasPhoto>0||news[i].hasAudio>0||news[i].hasVideo>0)){$("<div></div>").addClass("media").attr("storyID",news[i].newsID).appendTo($NewsItem)}$("<div></div>").css("clear","both").appendTo($NewsItem);$NewsItem.appendTo($AllHeadlines)}obj.html($AllHeadlines)}else{if(window.console&&window.console.firebug){console.log("newsHeadline plugin error: news array empty")}}if($.isFunction(options.callback)){options.callback(options.uniqueListID+"headlines"+groupid)}if(options.getMedia>0){$("#"+options.uniqueListID+"headlines"+groupid+" .media").getNewsMedia({mediaCallback:options.mediaCallback})}}})}else{if(window.console&&window.console.firebug){console.log("newsHeadline plugin error: no or bad group id passed")}}})}})(jQuery);(function($){$.fn.fSplit=function(options){var defaults={maxChar:999999},options=$.extend(defaults,options);return this.each(function(){var strDummy=this.innerHTML,strOut="",strArray=strDummy.split(" ");if(strDummy.length>options.maxChar){for(var i=0;i<strArray.length;i++){if((strOut.length+strArray[i].length+1)<options.maxChar){if(i==0){strOut=strArray[0]}else{strOut=strOut+" "+strArray[i]}}else{strOut=strOut+"...";i=9999999}}}else{strOut=strDummy}$(this).html(strOut)})}})(jQuery);(function($){$.fn.getNewsMedia=function(options){var defaults={xml_path:"/xml/default.asp",mediaCallback:null};var options=$.extend(defaults,options);return this.each(function(){var obj=$(this),groupid=obj.attr("storyID"),media={};if(groupid.length>0){$.ajax({type:"GET",url:options.xml_path+"?sid="+JavaScriptSchoolID+"&type=storymedia&useCDATA=false&id="+groupid,dataType:"xml",success:function(xml){media={mediaID:$(xml).find("media").find("id").text(),fileID:$(xml).find("media").find("file_id").text(),title:$(xml).find("media").find("title").text(),mediaType:$(xml).find("media").find("mediatype").text(),albumName:$(xml).find("media").find("album").text(),numViews:$(xml).find("media").find("num_views").text(),coverTitle:$(xml).find("media").find("cover_title").text(),coverURL:$(xml).find("media").find("cover_filename").text(),coverWidth:$(xml).find("media").find("cover_width").text(),coverHeight:$(xml).find("media").find("cover_height").text(),coverCaption:$(xml).find("media").find("cover_caption").text(),mainURL:$(xml).find("media").find("filename").text(),width:$(xml).find("media").find("width").text(),height:$(xml).find("media").find("height").text(),thumb:$(xml).find("media").find("thumb_filename").text(),thumbWidth:$(xml).find("media").find("thumb_width").text(),thumbHeight:$(xml).find("media").find("thumb_height").text()}},error:function(request,tStatus,eThrown){if(window.console&&window.console.firebug){console.log("getNewsMedia plugin error: request='"+request+"', tStatus='"+tStatus+"', eThrown='"+eThrown+"'")}},complete:function(){if(media){switch(media.mediaType){case 167:mediaType="photos";break;case 165:mediaType="audio";break;default:mediaType="video";break}var $MediaContainer=$("<div></div>").attr("numViews",media.numViews).attr("albumID",media.mediaID).attr("fileID",media.fileID).attr("mediaType",mediaType);var $CoverArt=$("<div></div>").addClass("cover");$("<img />").attr("src",media.coverURL).attr("height",media.coverHeight).attr("width",media.coverWidth).attr("alt",media.coverCaption).appendTo($CoverArt);$("<p></p>").addClass("coverTitle").html(media.coverTitle).appendTo($CoverArt);$CoverArt.appendTo($MediaContainer);$("<a></a>").attr("href","/podium/tools/"+((mediaType=="audio")?"AudioPlay":"SlideShow")+".aspx?a="+media.mediaID+"&ttl="+media.title.replace(" ","+")).addClass("playerLink").html(media.albumName).appendTo($MediaContainer);$("<a></a>").attr("href","/podium/default.aspx?t=52562&a="+media.albumID).addClass("detailLink").html(media.albumName).appendTo($MediaContainer);var $TheMediaEmbed=$("<div></div>").addClass("mediaEmbed").attr("filename",media.mainURL);if(media.height>0){$TheMediaEmbed.attr("mediaHeight",media.height)}if(media.width>0){$TheMediaEmbed.attr("mediaWidth",media.width)}$TheMediaEmbed.appendTo($MediaContainer);obj.html($MediaContainer)}else{if(window.console&&window.console.firebug){console.log("getNewsMedia plugin error: media array empty")}}if($.isFunction(options.mediaCallback)){options.mediaCallback(obj)}}})}else{if(window.console&&window.console.firebug){console.log("getNewsMedia plugin error: no or bad story id")}}})}})(jQuery);