/* Created by Micael N'Goran April 2009 */
function addScriptTag(id,url,callback){var scriptTag=document.createElement("script")
var noCacheIE='&noCacheIE='+(new Date()).getTime()
scriptTag.type="text/javascript"
scriptTag.src=url+"%26callback%3d"+callback+noCacheIE
scriptTag.id=id
$("head",document).append(scriptTag)}
function two(x){return((x>9)?"":"0")+x}
function time(ms){var t=ms
var sec=Math.floor(ms/1000)
ms=ms%1000
var min=Math.floor(sec/60)
sec=sec%60
t=two(sec)
var hr=Math.floor(min/60)
min=min%60
t=two(min)+":"+t
var day=Math.floor(hr/60)
hr=hr%60
if(hr!=0){t=two(hr)+":"+t}
return t}
function takeYear(theDate){x = theDate.getYear(); var y = x % 100; y += (y < 38) ? 2000 : 1900;	return y;}
function leadingZero(nr){if (nr < 10) nr="0" + nr;	return nr;}
function date(ms){var releaseDate = new Date(ms); var Year = takeYear(releaseDate); var Month = leadingZero(releaseDate.getMonth()+1);var Day = leadingZero(releaseDate.getDate()); return (Month + '/' + Day + '/' + Year);}
function noCount(data){if(data!=null){return data;}
else{return "New";}}
function changeContentHeight(){$("#videoSitemapLinks").css("height", "97.5%");
if($("#videoSitemapLinks").height() < $("#videoSitemapNav").height()){$("#videoSitemapLinks").css("height", $("#videoSitemapNav").height()+50);}}
function getVideoScreens(){
changeContentHeight()
screenshotPreview()
}
this.screenshotPreview = function(){xOffset = 20;
yOffset = 0;
$("#videoSitemapLinks a").hover(function(e){
this.title = "";
$("body").append("<p id='screenshot'><img src='"+ this.rel +"' width='120px' height='90px' alt='thumbnail'/></p>");
$("#screenshot").css("top",(e.pageY - yOffset) + "px").css("left",(e.pageX + xOffset) + "px").fadeIn("normal");},
function(){this.title = this.t;	
$("#screenshot").remove(); });	
$("#videoSitemapLinks a").mousemove(function(e){
$("#screenshot").css("top",(e.pageY - yOffset) + "px").css("left",(e.pageX + xOffset) + "px");}); }
function hideCategories(){$("#videoSitemapNav dd").hide(); $("#videoSitemapNav dt").removeClass("ddShow"); $("#videoSitemapNav dt").find(".spanHide").hide(); $("#videoSitemapNav dt").find(".spanShow").show(); changeContentHeight()}
function showFirstCategory(){$("#selectedCategory").nextAll("dd").toggle(); $("#selectedCategory").find(".spanShow,.spanHide").toggle(); $("#selectedCategory").addClass("ddShow"); changeContentHeight();}
function showHide(e){if($(e).hasClass("ddShow")){hideCategories();}else {hideCategories();$(e).nextAll("dd").show(); $(e).find(".spanShow").hide(); $(e).find(".spanHide").show(); $(e).addClass("ddShow"); changeContentHeight();}}
$(document).ready(function(){$("#videoSitemapNav dt:has(span)").addClass("dtCursor"); $(".spanCategory").after('<span class="spanHide">-</span><span class="spanShow">+</span>'); $("#videoSitemapNav dl dd:last-child").addClass("ddBottomBorder"); $("#videoSitemapNav dt").hover(function(){$(this).find(".spanCategory").addClass("dthover");},function(){$(this).find(".spanCategory").removeClass("dthover");}); $("#videoSitemapNav dt:has(span)").click(function(){showHide(this)}); showFirstCategory();});
