$(document).ready(function(){$("#nav > li").bind("mouseover",jsddm_open);$("#nav > li").bind("mouseout",jsddm_timer);checkTime();$(window).bind("scroll",checkTime);tooltip()});function checkTime(){$("img.live_time").each(function(a){if(!$.belowthefold($(this))){if(!$("#time_"+a).length){$(this).after($("<div/>").attr("id","time_"+a).addClass("camtime").addClass("statuscam").text("Loading..."));$.getJSON("http://json-head.appspot.com/?callback=?",{url:this.src},function(e){if(e.status_code==200){var d=Date.parse(e.headers["last-modified"]);var b=new Date(d);var c=Math.floor(new Date().getTime()/1000);var f=Math.floor(b.getTime()/1000);var g=c-f;if(g>172800){$("#time_"+a).css("color","red")}$("#time_"+a).text(b.ago());$("#time_"+a+":empty").fadeOut("slow")}else{$("#time_"+a).fadeOut("slow")}})}}})}$.belowthefold=function(b){var a=$(window).height()+$(window).scrollTop();return a<=$(b).offset().top-0};Date.prototype.ago=function(b){if(typeof(b)=="undefined"){b=Math.floor(new Date().getTime()/1000)}var c=Math.floor(this.getTime()/1000);var i=b-c;if(i<0){return"Live"}else{if(i==0){return"Live"}else{if(i<60){return"Live"}else{if(i<120){return"1 minut ago"}else{if(i<3600){var d=Math.floor(i/60);return d+" minutes ago"}else{if(i<7200){return"1 hour ago"}else{if(i<86400){var e=Math.floor(i/3600);return e+" hours ago"}else{if(i<172800){return"1 day ago"}else{if(i<1209600){var h=Math.floor(i/86400);return h+" days ago"}else{if(i<2592000){var a=Math.floor(i/604800);return a+" weeks ago"}else{if(i<5184000){return"1 month ago"}else{if(i<31536000){var f=Math.floor(i/2592000);return f+" months ago"}else{if(i<63072000){return"1 year ago"}else{var g=Math.floor(i/31536000);return""}}}}}}}}}}}}}};var var_timer=null;var iName=null;var iUrl=null;var play_count=null;var play_stop=null;refImg=new Image();refImg.src="http://www.checkcams.com/img/blank.gif";function playImage(a,b){stopImage();if($("#playing_"+b).length){$("#playing_"+b).remove()}$("#"+b).after($("<div/>").attr("id","playing_"+b).addClass("camrefresh").addClass("statuscam").text("Playing(0)"));play_count=null;play_stop=1;$("#play"+b).hide();$("#pause"+b).show();iName=b;iUrl=a;var_timer=setTimeout("stopImage();",90000);playingImage(a,b)}function playingImage(){if(play_stop!=null){$("#"+iName).image(iUrl+"?"+Math.random(),function(){if(play_stop!=null){play_count++;$("#playing_"+iName).text("Playing("+play_count+")");setTimeout("playingImage();",200)}})}}function stopImage(){clearTimeout(var_timer);$("#play"+iName).show();$("#pause"+iName).hide();$("#playing_"+iName).html("Stopped playing");removeDelay("#playing_"+iName);$("#"+iName).image(iUrl+"?"+Math.random(),function(){});play_stop=null}function refreshImage(a,b){if($("#refresh_"+b).length){$("#refresh_"+b).remove()}$("#"+b).after($("<div/>").attr("id","refresh_"+b).addClass("camrefresh").addClass("statuscam").text("Refreshing..."));document.getElementById(b).src=refImg.src;$("#"+b).image(a+"?"+Math.random(),function(){$("#refresh_"+b).text("Refreshed");removeDelay("#refresh_"+b)})}function removeDelay(a){setTimeout('$("'+a+'").fadeOut("slow");',1000)}$.fn.image=function(b,a){return this.each(function(){var c=new Image();c.src=b;c.onload=a;this.src=c.src})};this.tooltip=function(){xOffset=10;yOffset=20;$("a.tooltip").hover(function(a){this.t=this.title;this.title="";$("body").append("<div id='tooltip'>"+this.t+"</div>");$("#tooltip").css("top",(a.pageY-xOffset)+"px").css("left",(a.pageX+yOffset)+"px").fadeIn("fast")},function(){this.title=this.t;$("#tooltip").remove()});$("a.tooltip").mousemove(function(a){$("#tooltip").css("top",(a.pageY-xOffset)+"px").css("left",(a.pageX+yOffset)+"px")})};function bookmarksite(b,a){if(document.all){window.external.AddFavorite(a,b)}else{alert("Please Press Ctrl + D to bookmark this page")}}var timeout=500;var closetimer=0;var ddmenuitem=0;function jsddm_open(){jsddm_canceltimer();jsddm_close();ddmenuitem=$(this).find("ul").css("display","block")}function jsddm_close(){if(ddmenuitem){ddmenuitem.css("display","none")}}function jsddm_timer(){closetimer=window.setTimeout(jsddm_close,timeout)}function jsddm_canceltimer(){if(closetimer){window.clearTimeout(closetimer);closetimer=null}}document.onclick=jsddm_close;function menu(){}
