$(document).ready(function(){
// Less than IE7 check
if (document.documentMode<=7 || (window.attachEvent!=undefined && document.documentMode==undefined && !window.opera)){
$("body").append('\
');
$("body").append('
');
$("body").append('
');
$("body").append('You are using a browser that is either older than Internet Explorer 8, running in Internet Explorer compatibility mode or you have set the browser/document mode incorrectly in the Web Developer tool.
Please upgrade your browser, disable compatibility mode or set the correct browser/document mode to display the page correctly.
');
$("html, body, #wrapper").css("overflow", "hidden");
}
// Menu mouseover
$(".menu-button").mouseover(function(){
if (!$(this).hasClass("selected"))
$(this).children(".menu-button-middle").stop().animate({color: "#ffffff"}, 250);
}).mouseout(function(){
if (!$(this).hasClass("selected"))
$(this).children(".menu-button-middle").stop().animate({color: "silver"}, 250);
});
// News comments
$(".news-comment-delete").bind("click", function(){
if (confirm("Are you sure you want to delete this comment?")){
$(this).parents(".news-comment").find(".news-comment-delete-form").submit();
}
return false;
});
$(".news-comment-edit").bind("click", function() {
$(".news-comment").removeClass("news-comment-editing").has(this).addClass("news-comment-editing");
});
$(".news-comment-edit-cancel").bind("click", function() {
$(".news-comment").removeClass("news-comment-editing")
});
$("#news-comment-post-show").bind("click", function(){
$("#news-comment-post-form").show();
$(this).remove();
return false;
});
// Tooltip
window.tooltip = $("#tooltip-wrapper");
$(".tooltip").mouseover(function(){
window.tooltip.children("#tooltip").html($(this).children(".tooltip-content").html());
window.tooltip.show();
}).mousemove(function(e){
var posY = (e.pageY + 14);
var posX = (e.pageX + 10);
var overflow = withinWindow(posX, posY);
if(overflow[0]) posX = posX - window.tooltip.outerWidth() - 22;
if(overflow[1]) posY = posY - window.tooltip.outerHeight() - 20;
window.tooltip.css({
top: posY + "px",
left: posX + "px"
});
}).mouseout(function(){
window.tooltip.hide();
});
function withinWindow(posX, posY)
{
var newX = posX + window.tooltip.outerWidth();
var newY = posY + window.tooltip.outerHeight();
var windowWidth = $(window).width() + $(window).scrollLeft();
var windowHeight = $(window).height() + $(window).scrollTop();
return [(newX >= windowWidth), (newY >= windowHeight)];
}
});