﻿function ShowRatingBox()
{
    $get("RatingBox").style.display = "block";
    $get("ctl00_txtRating").focus();
    return false;
}

function HideRatingBox()
{
    $get("RatingBox").style.display = "none";
    return false;
}

function DoCheckOver(eventElement)
{
    if($get("RatingBox").style.display != "block")
    {
        ShowRatingBox();
    }
}

function DoCheckOut(eventElement)
{
    var element = $get("RatingBox");
    var bounds = Sys.UI.DomElement.getBounds(element);
    
    var isOutOfBounds =
        eventElement.clientX <= (1 + bounds.x) ||
        eventElement.clientY <= (1 + bounds.y) ||
        eventElement.clientX > (bounds.x + bounds.width - 1) ||
        eventElement.clientY > (bounds.y + bounds.height - 1);

    if(eventElement.target.id == "RatingBox" && isOutOfBounds)
    {
        HideRatingBox();
    }
}

function Contains(parent, child)
{
    if(window.event)
    {
        return parent.contains(child);
    }
    else
    {
        return (parent.compareDocumentPosition(child) & 16) != 0;
    }
}