﻿
function PrintContent4Div(dvClientID) {
    //Print Content of the Div in a New Blank Window  
    var disp_setting = "toolbar=no,location=no,directories=no,menubar=no,";
    disp_setting += "scrollbars=yes,left=0,top=0,resizable=yes,width=900, height=650,";
    var content_vlue = document.getElementById(dvClientID).innerHTML;
    var docprint = window.open("", "", disp_setting);
    docprint.document.open();
    docprint.document.write('<html><head><title></title>');
    docprint.document.write('</head><body onLoad="self.print()">');
    docprint.document.write(content_vlue);
    docprint.document.write("</body></html>");
    docprint.document.close();
    docprint.focus();
    return false;
}

function ShowImgeLarge(imgPath) {
    var disp_setting = "toolbar=no,location=no,directories=no,menubar=no,";
    disp_setting += "scrollbars=yes,left=0,top=0,resizable=yes,width=900, height=650,";
    var content_vlue = "<img src='" + imgPath + "'/>";
    var docprint = window.open("", "", disp_setting);
    docprint.document.open();
    docprint.document.write('<html><head><title></title>');
    docprint.document.write('</head><body>');
    docprint.document.write(content_vlue);
    docprint.document.write("</body></html>");
    docprint.document.close();
    docprint.focus();
    return false;
}

function RefreshCurrentPage() {
    location.reload(true);
}

function MoveItem(ctrlSource, ctrlDestination, Type, Hidden, Message) {

    var Source = document.getElementById(ctrlSource);
    var Destination = document.getElementById(ctrlDestination);

    if ((Source != null) && (Destination != null)) {
        if (Source.options.selectedIndex < 0) {
            alert(Message);
        }
        while (Source.options.selectedIndex >= 0) {
            //var newOption = new Option(); // Create a new instance of ListItem
            var strText, strValue;

            strText = Source.options[Source.options.selectedIndex].text;
            strValue = Source.options[Source.options.selectedIndex].value;

            //                 newOption.text = Source.options[Source.options.selectedIndex].text;
            //                 newOption.value = Source.options[Source.options.selectedIndex].value;
            //                
            //                Destination.options[Destination.length] = newOption; //Append the item in Destination


            var newOpt;
            newOpt = document.createElement("OPTION");
            newOpt = new Option(strText, strValue);
            newOpt.id = strValue;

            Destination.options.add(newOpt);

            Source.remove(Source.options.selectedIndex);  //Remove the item from Source
        }
    }
    if (Type == "Add")
        UpdateHiddenField(ctrlDestination, Hidden);
    else
        UpdateHiddenField(ctrlSource, Hidden);
}

function UpdateHiddenField(realDestination, Hidden) {

    var Destination = document.getElementById(realDestination);
    hdnDestinationlist = document.getElementById(Hidden)
    hdnDestinationlist.value = "";

    var len = Destination.length

    if (len > 0) {
        for (var i = 0; i < len; ++i) {
            if (i == 0)
                hdnDestinationlist.value = Destination[i].value;
            else
                hdnDestinationlist.value = hdnDestinationlist.value + "," + Destination[i].value;
        }
    }
}

function DeleteRow(ConfirmMsg, SelectMsg, CheckBoxName) {
    var boolChkBox = false;
    var boolfoo = false;
    var elem;
    for (i = 0; i <= document.forms[0].length; i++) {
        elem = document.forms[0].elements[i];
        if (elem != null)
            if ((elem.type == 'checkbox')) {
            if (elem.name.indexOf(CheckBoxName) > -1)
                if (elem.checked) {
                boolChkBox = true;
                break;
            }
        }
    }
    if (boolChkBox) {
        boolfoo = confirm(ConfirmMsg);
    }
    else {
        alert(SelectMsg);
        boolfoo = false;
    }
    return boolfoo;
}

function Confirm2(ConfirmMsg, SelectMsg, CheckBoxName) {
    var boolChkBox = false;
    var boolfoo = false;
    var elem;
    for (i = 0; i <= document.forms[0].length; i++) {
        elem = document.forms[0].elements[i];
        if (elem != null)
            if ((elem.type == 'checkbox')) {
            if (elem.name.indexOf(CheckBoxName) > -1)
                if (elem.checked) {
                boolChkBox = true;
                break;
            }
        }
    }
    if (boolChkBox) {
        boolfoo = confirm(ConfirmMsg);
    }
    else {
        alert(SelectMsg);
        boolfoo = false;
    }
    return boolfoo;
}


function ViewHideTabs(viewTab, viewLink, hideTab2, hideLink2, hideTab3, hideLink3) {
            viewTab = document.getElementById(viewTab);
            hideTab2 = document.getElementById(hideTab2);
            hideTab3 = document.getElementById(hideTab3);

            viewLink = document.getElementById(viewLink);
            hideLink2 = document.getElementById(hideLink2);
            hideLink3 = document.getElementById(hideLink3);

            viewTab.style.display = "block";
            hideTab2.style.display = "none";
            hideTab3.style.display = "none";

            viewLink.className = "tabon";
            hideLink2.className = "taboff";
            hideLink3.className = "taboff";
        }

function ConfirmMessage(ConfirmMsg) {
    var boolfoo = false;
    boolfoo = confirm(ConfirmMsg);
    return boolfoo;
}

//community 




           function HideComment(obj) {

               var div = document.getElementById(obj);
               div.style.display = "none";


           }



           function switchViews(obj, row) {

               var div = document.getElementById(obj);

               if (div.style.display == "none") {
                   div.style.display = "inline";
               }
               else {
                   div.style.display = "none";
               }
           }
