﻿function ShowServiceMenu(e)
{
	var serviceMenu  = document.getElementById("divServiceMenu");
	var t=e.offsetTop;
	var l=e.offsetLeft;
	while(e=e.offsetParent)
	{
		t+=e.offsetTop;
		l+=e.offsetLeft;
	}
	serviceMenu.style.display	=	"";
	serviceMenu.style.top		=	(t+12)+"px";
	serviceMenu.style.left		=	l+"px";
	serviceMenu.style.position	=	"absolute";
}

function CloseServiceMenu()
{
	var serviceMenu=document.getElementById("divServiceMenu");
	serviceMenu.style.display="none";
}

function FocusMenu(src)
{
	src.className = "MouseOverMenu";
	src.setAttribute("class", "MouseOverMenu");
}

function BlurMenu(src)
{
	src.className = "MouseOutMenu";
	src.setAttribute("class", "MouseOutMenu");
}

var ExpandState = false;
function ChangeViewForList(oid) {
    if (oid) {
        var src = $("#p" + oid);
        var icon = $("#li" + oid);
        if (src.css("display") == "none") {
            src.css({ display: "inline-block" });
            icon.css({ background: "url('/images/Help/features/features_open.png') 0 6px no-repeat"});
        }
        else {
            src.css({ display: "none" });
            icon.css({ background: "url('/images/Help/features/features_close.png') 4px 6px no-repeat"});
        }
    }
}
function ControlAll() {
    $("#featruesIndexUl li").each(function(i) {

        var src = $("#p" + (i + 1));
        var icon = $("#li" + (i + 1));
        if (!ExpandState) {
            src.css({ display: "inline-block" });
            icon.css({ background: "url('/images/Help/features/features_open.png') 0 6px no-repeat"});
        }
        else {
            src.css({ display: "none" });
            icon.css({ background: "url('/images/Help/features/features_close.png') 4px 6px no-repeat"});
        }
    });

    var buttonContent = "Expand All";

    if (ExpandState) {
        buttonContent = "Expand All";
        ExpandState = false;
    }
    else {
        buttonContent = "Collapse All";
        ExpandState = true;
    }
    $("#ControlButton").html(buttonContent);
}

/***** for Support Control ******/
function ChangeViewForSupport() {
    var SupportDiv = $("#EmailSupportDiv");
    if (SupportDiv.css("display") == "none") {
        SupportDiv.slideDown(700);
        $("#SupportTriangle").css({ backgroundImage: "url('/images/Help/support_open.png')" });
    } else {
        SupportDiv.slideUp(700);
        $("#SupportTriangle").css({ backgroundImage: "url('/images/Help/support_close.png')" });
    }
}

function checkSupportEmailNull() {
    var clock = true;
    $("#EmailSupportDiv input[type='text']").each(function(i) {
        if ($(this).attr("value") == "") {
            $("#ErrorNull").css({ display: "" });
            $(this).css({ borderColor: "red" });
            clock = false;
            return false;
        }
    });
    $("#EmailSupportDiv textarea").each(function(i) {
        if ($(this).attr("value") == "") {
            $("#ErrorNull").css({ display: "" });
            $(this).css({ borderColor: "red" });
            clock = false;
            return false;
        }
    });
    return clock;
}

function checkControlNull(op) {
    if (op.value == "") {
        op.style.borderColor = "red";
    } else {
        op.style.borderColor = "#8D96A4";
    }
}

