﻿function DisplayHideSection(sectionId)
{
    if(document.getElementById(sectionId).style.display == 'block')
    {
        document.getElementById(sectionId).style.display = 'none';
        if(sectionId.search('CommentPostId')!=-1 || sectionId.search('QuestionComment')!=-1 || sectionId.search('AnswerComment')!=-1)
        {
            elt = document.getElementById("Div"+sectionId);
            if(elt!=null)
                elt.className="headerHidden";          
        }            
    }
    else
    {
        document.getElementById(sectionId).style.display = 'block'            
        if(sectionId.search('CommentPostId')!=-1 || sectionId.search('QuestionComment')!=-1 || sectionId.search('AnswerComment')!=-1)
        {
            elt = document.getElementById("Div"+sectionId);                
            if(elt!=null)
                elt.className="headerShown";
        }
    }
    return false;                
}

function ConfirmDelete()
{
    return confirm("Are You sure?");
}


function getPrint(print_area, print_area2)
{ 
    //Creating new pagevar 

    pp = window.open();
    //Adding HTML opening tag with <HEAD> … </HEAD> portion 
    pp.document.writeln('<HTML><HEAD>');
    //pp.document.writeln('<LINK href="/style/master.css" type="text/css" rel="stylesheet">');
    //pp.document.writeln('<LINK href="<%=CssStyle.Href%>" type="text/css" rel="stylesheet" media="print">')
    pp.document.writeln('<base target="_self"></HEAD>');
    //Adding Body Tag
    pp.document.writeln('<body MS_POSITIONING="GridLayout" bottomMargin="0"');
    pp.document.writeln(' leftMargin="0" topMargin="0" rightMargin="0">');
    //Adding form Tag
    pp.document.writeln('<form method="post">');
    //Creating two buttons Print and Close within a HTML table
    //pp.document.writeln('<TABLE width=100%><TR><TD></TD></TR><TR><TD align=right>');
    //pp.document.writeln('<DIV id="divPrint"><INPUT ID="PRINT" type="button" value="Print" ');
    //pp.document.writeln('onclick="javascript:document.getElementById(\'divPrint\').style.visibility = \'hidden\';window.print();javascript:location.reload(true); "></DIV>');
    //pp.document.writeln('<INPUT ID="CLOSE" type="button" value="Close" onclick="window.close();">');
    //pp.document.writeln('</TD></TR><TR><TD></TD></TR></TABLE>');
    //Writing print area of the calling page
    pp.document.writeln(document.getElementById(print_area).innerHTML);
    pp.document.writeln('<scr' + 'ipt language="javascript" type=text/javascript>window.print(); </scr' + 'ipt>');
    //Ending Tag of </form>, </body> and </HTML>
    pp.document.writeln('</form></body></HTML>'); 
}

getSilverlight = function () {
    var SLVersion;
    function version() {
        try {
            try {

                var control = new ActiveXObject('AgControl.AgControl');

                if (control.IsVersionSupported("3.0"))
                    SLVersion = 3;
                else
                    if (control.IsVersionSupported("2.0"))
                        SLVersion = 2;
                    else
                        SLVersion = 1;
                control = null;
            }

            catch (e) {
                var plugin = navigator.plugins["Silverlight Plug-In"];

                if (plugin) {

                    if (plugin.description === "1.0.30226.2")
                        SLVersion = 2;

                    else
                        SLVersion = parseInt(plugin.description[0]);
                }
                else
                    SLVersion = 0;
            }
        }

        catch (e) {
            SLVersion = 0;
        }
        return SLVersion;
    }
    return {
        Version: version
    }
} ();
