
if(PG==undefined)var PG={};PG=Object.extend(PG,{advertisementTimeout:undefined,searchParams:["MOSTPOPULAR","VIDEO","0"],mediaEndpointURL:'/apps/pagedata/mmindex.aspx?',currentVideoPage:0,currentVideoPosition:0,videoTimeRemaining:0,currentPlayerMode:0,getAudioListForParams:function(params){if(typeof params=="undefined")params=PG.searchParams;var endpointURL=PG.mediaEndpointURL;var browseBy=params[0];var typeOf=params[1];var categoryId=params[2];if(categoryId=="0"||typeof categoryId=="undefined"){endpointURL+='intMode=0&intSortMode=0';new Ajax.Request(endpointURL,{method:'get',onSuccess:PG.populateAudioBrowseList});}else{endpointURL+='intMode=1&intSortMode=0&intCategory='+categoryId;new Ajax.Request(endpointURL,{method:'get',onSuccess:PG.populateAudioBrowseList});}},getVideoListForParams:function(params){if(typeof params=="undefined")params=PG.searchParams;var endpointURL=PG.mediaEndpointURL;var browseBy=params[0];var typeOf=params[1];var categoryId=params[2];if(categoryId=="0"||typeof categoryId=="undefined"){endpointURL+='intMode=0&intSortMode=0';new Ajax.Request(endpointURL,{method:'get',onSuccess:PG.populateBrowseList});}else{endpointURL+='intMode=1&intSortMode=0&intCategory='+categoryId;new Ajax.Request(endpointURL,{method:'get',onSuccess:PG.populateBrowseList});}},firstLoad:true,populateBrowseList:function(playlistResult){if(PG.firstLoad){PG.firstLoad=false;}else{PG.flipTab('tab_br');}
try{var playlist=eval(playlistResult.responseText);}catch(e){alert(e);}
var totalPages=Math.ceil(playlist.size()/9);if(playlist.size()<=9){totalPages=1;}
var browseBox=$('current_page');var pageBox=$('browse_pagenumber');$$('#current_page div').each(function(val,index){if(val.id!="current_page")val.remove();});pageBox.innerHTML='Page:';for(var x=0;x<totalPages;x++){var newSpan=document.createElement('SPAN');newSpan.innerHTML=x+1;pageBox.appendChild(newSpan);$(newSpan).addClassName('page_number');Event.observe(newSpan,'click',PG.browsePage);Event.observe(newSpan,'mouseover',function(event){var span=Event.element(event);span.addClassName('page_over');});Event.observe(newSpan,'mouseout',function(event){var span=Event.element(event);span.removeClassName('page_over');});}
for(var i=0;i<=totalPages;i++){var page=document.createElement("DIV");if(i==0){page.style.display='block';}
page.id="browse_page_"+i;browseBox.appendChild(page);$(page).addClassName("browse_page");var currentVideo=0;while(playlist.size()>0){currentItem=playlist.shift();if(currentVideo%3==0){var row=document.createElement("DIV");page.appendChild(row);$(row).addClassName('video_thumbnail_row');}
var option=document.createElement("DIV");row.appendChild(option);$(option).addClassName('video_thumbnail');if((currentVideo+1)%3==0){$(option).setStyle({marginRight:"0px"});}
Event.observe(option,'mouseover',PG.thumbnailOver);var imageLink=document.createElement("A");imageLink.id="thumbnailimage_"+currentVideo+"_"+i;option.appendChild(imageLink);var tempList=currentItem.url;var wrappedAdUrl=currentItem.adUrl;if(typeof currentItem.adUrl!="undefined"){wrappedAdUrl="'"+wrappedAdUrl+"'";}else{wrappedAdUrl='undefined';}
imageLink.href="/multimedia/?videoid="+currentItem.id;var thumb=document.createElement("IMG");thumb.src=currentItem.thumb;if(currentItem.thumb==""||currentItem.thumb=='thumb.png'){thumb.src='/includes/2007design/images/video/placeholder.png';}
thumb.width=148;thumb.height=84;imageLink.appendChild(thumb);option.appendChild(document.createElement("BR"));var titleLink=document.createElement("A");titleLink.id="thumbnail_"+currentVideo+"_"+i;option.appendChild(titleLink);$("thumbnail_"+currentVideo+"_"+i).innerHTML=currentItem.title;titleLink.href=imageLink.href;var timeSpan=document.createElement("SPAN");if(currentItem.length!='00:00:00'){timeSpan.innerHTML="<br/>"+currentItem.length;option.appendChild(timeSpan);}
if((currentVideo+1)%9==0){break;}
currentVideo++;}}},thumbnailOver:function(e){if(Event.element(e).tagName=="DIV"){var selected=$('container_br').getElementsBySelector('div.video_thumbnail_selected')[0];if(selected)selected.removeClassName('video_thumbnail_selected');Event.element(e).addClassName('video_thumbnail_selected');}
if(Event.element(e).tagName=="IMG"){var selected=$('container_br').getElementsBySelector('div.video_thumbnail_selected')[0];if(selected)selected.removeClassName('video_thumbnail_selected');Event.element(e).up('div').addClassName('video_thumbnail_selected');}},getVideoDetailInfo:function(videoid){var endpointURL=PG.mediaEndpointURL;endpointURL+='intMode=2&lngItemID='+videoid;new Ajax.Request(endpointURL,{method:'get',onSuccess:PG.displayDetailInfo});},displayDetailInfo:function(detailResult){try{var detailDoc=eval(detailResult.responseText);}catch(e){}
var detailObj=detailDoc[0];var productionInfo=$('video_production_info');var productionString="";$('videoID').innerHTML=detailObj.id;if(detailObj.p1!=""){productionString+="Producer: "+detailObj.p1+"<br/>";}
if(detailObj.p2!=""){productionString+="Producer: "+detailObj.p2+"<br/>";}
if(detailObj.p3!=""){productionString+="Producer: "+detailObj.p3+"<br/>";}
if(detailObj.v1!=""){productionString+="Videographer: "+detailObj.v1+"<br/>";}
if(detailObj.v2!=""){productionString+="Videographer: "+detailObj.v2+"<br/>";}
if(detailObj.v3!=""){productionString+="Videographer: "+detailObj.v3+"<br/>";}
productionInfo.innerHTML=productionString;var captionText=detailObj.caption;$('video_detail_description').innerHTML=captionText;if(captionText.indexOf("<nfldisclaimer>")>0){var nflDisclaimer="<p><b>Please note:</b> The NFL restricts the amount of time Post-Gazette videos may focus on any league employee, "+"which includes all players and coaches with the Pittsburgh Steelers. For more information, contact the "+"National Football League, 280 Park Avenue, New York, NY 10017.</p>";$('video_detail_description').innerHTML=$('video_detail_description').innerHTML.replace("<nfldisclaimer>",nflDisclaimer);}
var pubDate=new Date(detailObj.pubDate);var niceDate=(pubDate.getMonth()+1)+"/"+(pubDate.getDate())+"/"+pubDate.getFullYear();$('story_first_published').innerHTML=niceDate;$('movie_title').innerHTML=detailObj.title;if(detailObj.length!='00:00:00'){$('movie_time').innerHTML=detailObj.length;}},swf:undefined,flipAd:function(){PG.showAd=true;PG.currentInterval=-1;},showAd:true,currentInterval:-1,currentVideoId:'',generatePlayer:function(newFile,newId,controls){PG.swf=new SWFObject("/multimedia/mediaplayer.swf","mediaplayer","500","300","7");PG.swf.addParam("allowfullscreen","true");PG.swf.addParam("allowScriptAccess","true");if(controls>0){PG.swf.addVariable('shownavigation','true');}else{PG.swf.addVariable('shownavigation','false');}
if(newId!=''){PG.swf.addVariable("id",newId);}
PG.swf.addVariable("file",newFile);PG.swf.addVariable("width",500);PG.swf.addVariable("height",300);PG.swf.addVariable("overstretch","fit");PG.swf.addVariable("autostart","true");PG.swf.addVariable("showicons","false");PG.swf.addVariable("enablejs","true");PG.swf.addVariable("javascriptid","mediaplayer");PG.swf.write("gddflvplayer");},setVideo:function(videoUrl,adUrl,id){var newFile=videoUrl.substring(0,videoUrl.indexOf('PostGazetteFLV'));var newId=videoUrl.substring(videoUrl.indexOf('PostGazetteFLV'),videoUrl.length-4);PG.currentVideoUrl=videoUrl;if(PG.currentInterval==-1&&(typeof adUrl!="undefined")){if(adUrl.indexOf('http')==0){PG.currentInterval=setInterval("PG.flipAd()",300000);PG.showAd=false;PG.generatePlayer(adUrl,'',0);}else{newFile=adUrl.substring(0,adUrl.indexOf('PostGazetteFLV'));newId=adUrl.substring(adUrl.indexOf('PostGazetteFLV'),adUrl.length-4);PG.currentInterval=setInterval("PG.flipAd()",300000);PG.showAd=false;PG.generatePlayer(newFile,newId,0);}}else{PG.currentVideoUrl='';PG.generatePlayer(newFile,newId,19);}
PG.flipTab($("tab_np"));PG.getVideoDetailInfo(id);PG.currentVideoPosition=0;PG.videoTimeRemaining=0;PG.currentPlayerMode=0;},setupVideoParamControls:function(){var allParams=document.getElementsByClassName("media_param_container_choice");for(var i=0;i<allParams.size();i++){Event.observe(allParams[i],'click',PG.adjustVideoParams);}
var allSelParams=document.getElementsByClassName("media_param_container_choice_selected");for(var i=0;i<allSelParams.size();i++){Event.observe(allSelParams[i],'click',PG.adjustVideoParams);}},adjustVideoParams:function(e){var clicked=Event.element(e);var paramType=clicked.id.substring(0,clicked.id.indexOf('_'));var paramVal=clicked.id.substring(clicked.id.indexOf('_')+1,clicked.id.length);switch(paramType){case("browse"):{break;}
case("type"):{break;}
case("cat"):{var selected=$('cat_params').getElementsBySelector('div.media_param_container_choice_selected')[0];selected.removeClassName('media_param_container_choice_selected');selected.addClassName('media_param_container_choice');clicked.addClassName('media_param_container_choice_selected');clicked.removeClassName('media_param_container_choice');PG.searchParams[2]=paramVal;break;}}
PG.getVideoListForParams(PG.searchParams);},browsePage:function(event){var span=Event.element(event);var pageNo=span.innerHTML-1;$('browse_page_'+PG.currentVideoPage).setStyle({display:'none'});$('browse_page_'+pageNo).setStyle({display:'block'});PG.currentVideoPage=pageNo;},populateAudioBrowseList:function(playlistResult){try{var playlist=eval(playlistResult.responseText);}catch(e){alert(e);}
var totalPages=Math.ceil(playlist.size()/9);if(playlist.size()<=9){totalPages=1;}
var browseBox=$('current_page');var pageBox=$('browse_pagenumber');$$('#current_page div').each(function(val,index){if(val.id!="current_page")val.remove();});pageBox.innerHTML='Page:';for(var x=0;x<totalPages;x++){var newSpan=document.createElement('SPAN');newSpan.innerHTML=x+1;newSpan.addClassName('page_number');pageBox.appendChild(newSpan);Event.observe(newSpan,'click',PG.browsePage);Event.observe(newSpan,'mouseover',function(event){var span=Event.element(event);span.addClassName('page_over');});Event.observe(newSpan,'mouseout',function(event){var span=Event.element(event);span.removeClassName('page_over');});}
for(var i=0;i<=totalPages;i++){var page=document.createElement("DIV");page.addClassName("browse_page");if(i==0){page.style.display='block';}
page.id="browse_page_"+i;browseBox.appendChild(page);var currentVideo=0;while(playlist.size()>0){currentItem=playlist.pop();if(currentVideo%3==0){var row=document.createElement("DIV");page.appendChild(row);$(row).addClassName('video_thumbnail_row');}
var option=document.createElement("DIV");row.appendChild(option);$(option).addClassName('video_thumbnail');if((currentVideo+1)%3==0){$(option).setStyle({marginRight:"0px"});}
Event.observe(option,'mouseover',PG.thumbnailOver);var imageLink=document.createElement("A");imageLink.id="thumbnailimage_"+currentVideo+"_"+i;option.appendChild(imageLink);var tempList='<playlist><item><filename>'+currentItem.url+'</filename><artist>PG Now Video</artist><title>'+currentItem.title+'</title></item></playlist>';imageLink.href="javascript:PG.setVideo('"+tempList+"', "+currentItem.adUrl+", "+currentItem.id+");";var thumb=document.createElement("IMG");thumb.src=currentItem.thumb;if(currentItem.thumb==""||currentItem.thumb=='thumb.png'){thumb.src='http://pg.dev.deeplocal.com/includes/2007design/images/video/placeholder.png';}
imageLink.appendChild(thumb);option.appendChild(document.createElement("BR"));Event.observe(thumb,'mouseover',PG.thumbnailOver);var titleLink=document.createElement("A");titleLink.id="thumbnail_"+currentVideo+"_"+i;option.appendChild(titleLink);$("thumbnail_"+currentVideo+"_"+i).innerHTML=currentItem.title;titleLink.href="javascript:PG.setVideo('"+tempList+"', "+currentItem.adUrl+", "+currentItem.id+");";var timeSpan=document.createElement("SPAN");timeSpan.innerHTML="<br/>"+currentItem.length;option.appendChild(timeSpan);if((currentVideo+1)%9==0){break;}
currentVideo++;}}}});function swfEvent(typ,prm){PG.swf.sendEvent(typ,prm);}
function getUpdate(typ,pr1,pr2,swf){if(typ=='time'){if(PG.currentVideoPosition==1){try{}catch(e){}}
PG.currentVideoPosition=pr1;PG.videoTimeRemaining=pr2;}
if(typ=='state'){PG.currentPlayerMode=pr1;if(pr1==0){if(PG.currentVideoUrl!=''){thisMovie('mediaplayer').sendEvent('playpause');}
try{}catch(e){}}
if(pr1==3){try{}catch(e){}
if(PG.currentVideoUrl!=''){var newFile=PG.currentVideoUrl.substring(0,PG.currentVideoUrl.indexOf('PostGazetteFLV'));var newId=PG.currentVideoUrl.substring(PG.currentVideoUrl.indexOf('PostGazetteFLV'),PG.currentVideoUrl.length-4);PG.currentVideoUrl='';PG.generatePlayer(newFile,newId,19);}}}}
function thisMovie(swf){if(navigator.appName.indexOf("Microsoft")!=-1){return window[swf];}else{return document[swf];}}
