﻿function IGV_ShowLargeImage(ctrlID, imgUrl) {
    try {
        if (ctrlID == "") ctrlID = "imgctl";
        var imgCtrl = document.getElementById(ctrlID);
       
        if (imgCtrl != null)
            if (typeof (imgCtrl.src) != "undefined")
            imgCtrl.src = imgUrl;
        else
            imgCtrl.innerHTML = imgUrl;

       
    }
    catch (err) {
        txt = "There was an error on this page.\n\n";
        txt += "Error description: " + err.description + "\n\n";
        txt += "Click OK to continue.\n\n";
        alert(txt);
    }
}
function IGV_ShowVideo(ctrlID,videoParam) {
    try {
        if (ctrlID == "") ctrlID = "castupframe";
        var videoFrame = document.getElementById(ctrlID);
        
        if (videoFrame != null) {
            if (videoParam.toString().indexOf("clipurl") == 0)
                videoParam = videoParam.toString().substr(8, videoParam.length - 1);
            videoFrame.src = "http://switch5.castup.net/Customers/NRSA/v_gray_400x300/Design.asp?as=0&clipurl=" + videoParam;
        }
        
    }
    catch (err) {
        txt = "There was an error on this page.\n\n";
        txt += "Error description: " + err.description + "\n\n";
        txt += "Click OK to continue.\n\n";
        alert(txt);
    }
}
function IGV_ShowVideo(ctrlID, videoParam, videoTitle) {
    try {
        //alert(videoTitle);
        if (ctrlID == "") ctrlID = "castupframe";
        var videoFrame = document.getElementById(ctrlID);

        if (videoFrame != null) {
            if (videoParam.toString().indexOf("clipurl") == 0)
                videoParam = videoParam.toString().substr(8, videoParam.length - 1);
            videoFrame.src = "http://switch5.castup.net/Customers/NRSA/v_gray_400x300/Design.asp?as=0&clipurl=" + videoParam;
            //alert(videoTitle);
            videoFrame.title = videoTitle;
            //alert(videoFrame.title);
        }

    }
    catch (err) {
        txt = "There was an error on this page.\n\n";
        txt += "Error description: " + err.description + "\n\n";
        txt += "Click OK to continue.\n\n";
        alert(txt);
    }
}
function maxLengthPaste(field, maxChars, strError, strSymbol) {    
     event.returnValue = false;
    if ((field.value.length + window.clipboardData.getData("Text").length) > maxChars) {        
        alert(strError + " " + maxChars + " " + strSymbol);
        return false;
    }
    event.returnValue = true;
}

function maxLength(field, maxChars, strError, strSymbol) {
      if (field.value.length >= maxChars) {
        event.returnValue = false;
        alert(strError + " " + maxChars + " " + strSymbol);
        return false;
    }

}
function FPBtn_onclick() {
    try {
        var disp_setting = "toolbar=yes,location=no,directories=yes,menubar=yes,";
        disp_setting += "scrollbars=yes,width=850, height=600, left=100, top=25";
        var PHMC = document.getElementById("PlaceHolderMainContent");

        if (PHMC != null) {

            var content_vlue = PHMC.innerHTML;
            var docprint = window.open("", "", disp_setting);
            docprint.document.open();
            docprint.document.write('<html><head><title>GxMS Friendly Print</title>');
            docprint.document.write('</head><body onLoad="self.print()"><center>');
            docprint.document.write(content_vlue);
            docprint.document.write('</center></body></html>');
            docprint.document.close();
            docprint.focus();
        }
        else {
            window.print();
        }
    }
    catch (err) {
        txt = "There was an error on this page.\n\n";
        txt += "Error description: " + err.description + "\n\n";
        txt += "Click OK to continue.\n\n";
        alert(txt);
    }
}
function PBtn_onclick(ContentToPrint) {
    try {        
        var disp_setting = "toolbar=yes,location=no,directories=yes,menubar=yes,";
        disp_setting += "scrollbars=yes,width=850, height=600, left=100, top=25";
        var PHMC = document.getElementById(ContentToPrint);

        if (PHMC != null) {

            var content_vlue = PHMC.innerHTML;
            var docprint = window.open("", "", disp_setting);
            docprint.document.open();
            docprint.document.write('<html><head><title>GxMS Friendly Print</title>');
            docprint.document.write('</head><body onLoad="self.print()"><center>');
            docprint.document.write(content_vlue);
            docprint.document.write('</center></body></html>');
            docprint.document.close();
            docprint.focus();
        }
        else {
            window.print();
        }
    }
    catch (err) {
        txt = "There was an error on this page.\n\n";
        txt += "Error description: " + err.description + "\n\n";
        txt += "Click OK to continue.\n\n";
        alert(txt);
    }
}
//function Ratings(i) {
//    var srcempty = "emptystar.gif";
//    var srcfull = "fullstar.gif";
//    var grImg = "grImg";
//    var HiddenRating = "RatingValueFld";
//    try {

//        var oImag = document.getElementsByName(grImg + i);

//        if (oImag) {

//            for (var j = 1; j < 6; j++) {
//                var oImg = document.getElementsByName(grImg + j);

//                var sTpmSrc = oImg[0].src.toString().substr(0, oImg[0].src.toString().lastIndexOf('/') + 1);
//                if (j <= i)
//                    sTpmSrc += srcfull;
//                else
//                    sTpmSrc += srcempty;

//                oImg[0].src = sTpmSrc;

//            }
//            var sCtlID = oImag[0].id.toString().substr(0, oImag[0].id.toString().indexOf("grImg"));
//            //var sCtlID = oImag[0].id.toString().indexOf("grImg");

//            document.getElementById(sCtlID + HiddenRating).value = i;
//        }



//    }
//    catch (err) {
//        txt = "There was an error on this page.\n\n";
//        txt += "Error description: " + err.description + "\n\n";
//        txt += "Click OK to continue.\n\n";
//        alert(txt);
//    }
//}

function Ratings(i, ctlHiden) {

    var srcempty = "emptystar.gif";
    var srcfull = "fullstar.gif";
    var grImg = "grImg";

    try {

        var oImag = document.getElementsByName(grImg + i);

        if (oImag) {

            for (var j = 1; j < 6; j++) {
                var oImg = document.getElementsByName(grImg + j);

                var sTpmSrc = oImg[0].src.toString().substr(0, oImg[0].src.toString().lastIndexOf('/') + 1);
                if (j <= i)
                    sTpmSrc += srcfull;
                else
                    sTpmSrc += srcempty;

                oImg[0].src = sTpmSrc;

            }

            document.getElementById(ctlHiden).value = i;
        }



    }
    catch (err) {
        txt = "There was an error on this page.\n\n";
        txt += "Error description: " + err.description + "\n\n";
        txt += "Click OK to continue.\n\n";
        alert(txt);
    }
}

var oHidden;
function setHidden(lstItem)
{
    oHidden = lstItem;
}
function getHidden()
{
    return window.oHidden;
}
function Open_DDL_Link(bOpenInNewWindow)
    {
      
     try{
               
          var url = getHidden();             
          if(bOpenInNewWindow == 'true')
                window.open(url);
          else
               location.href = url;
        }
         catch (err) {
        txt = "There was an error on this page.\n\n";
        txt += "Error description: " + err.description + "\n\n";
        txt += "Click OK to continue.\n\n";
        alert(txt);
        }
   }
function Display_DDL_Link(bOpenInNewWindow,sWebPartId)

    {
      
     try{
          var ddlSlect = document.getElementById(sWebPartId);      
          var url = ddlSlect.options[ddlSlect.selectedIndex].value;      
          if(bOpenInNewWindow == 'true')
                window.open(url);
          else
               location.href = url;
        }
         catch (err) {
        txt = "There was an error on this page.\n\n";
        txt += "Error description: " + err.description + "\n\n";
        txt += "Click OK to continue.\n\n";
        alert(txt);
        }
   } 
   
function CV_ShowHideBody(source) {

       try {
           if (document.all) {

               var tr = source.parentElement.parentElement.nextSibling;
               if (tr.style.display == 'none')
                   tr.style.display = '';
               else
                   tr.style.display = 'none';
           }
           else {

               var tr = source.parentNode.parentNode.nextSibling;
               if (tr.style.display == 'none')
                   tr.style.display = '';
               else
                   tr.style.display = 'none'

           }
       }
       catch (err) {
           txt = "There was an error on this page.\n\n";
           txt += "Error description: " + err.description + "\n\n";
           txt += "Click OK to continue.\n\n";
           alert(txt);
       }
   }

   function Display_Internal_Content(sWebId, sListId, sItemID, sCustupUrl, sFileRef) {

       try {
           if (sCustupUrl != "") {
               IGV_ShowVideo("", sCustupUrl);
               DisplaywpRegistrationComment(sWebId, sListId, sItemID);
               DisplaywpRatings(sWebId, sListId, sItemID);
               DisplaywpCommentsViewer(sWebId, sListId, sItemID);
           }
       }

       catch (err) {
           txt = "There was an error on this page.\n\n";
           txt += "Error description: " + err.description + "\n\n";
           txt += "Click OK to continue.\n\n";
           alert(txt);
       }
   }
   function DisplaywpCommentsViewer(sWebId, sListId, sItemID) {
       try {
           //wpCommentsViewer

           var hcvWebId = document.getElementById("cvhiddenWebId");
           if (hcvWebId != null)
               hcvWebId.value = sWebId;
           var hcvLisId = document.getElementById("cvhiddenListId");
           if (hcvLisId != null)
               hcvLisId.value = sListId;
           var hcvItemId = document.getElementById("cvhiddenItemId");
           if (hcvItemId != null)
               hcvItemId.value = sItemID;

           var btncvTriger = document.getElementsByName("btncvTriger")[0];

           if (btncvTriger != null)
               btncvTriger.click();
       }
       catch (err) {
           txt = "There was an error on this page.\n\n";
           txt += "Error description: " + err.description + "\n\n";
           txt += "Click OK to continue.\n\n";
           alert(txt);
       }
   }
   function DisplaywpRatings(sWebId, sListId, sItemID) {
       try {
           //wpRatings
           var hraWebId = document.getElementById("rahiddenWebId");
           if (hraWebId != null)
               hraWebId.value = sWebId;
           var hraLisId = document.getElementById("rahiddenListId");
           if (hraLisId != null)
               hraLisId.value = sListId;
           var hraItemId = document.getElementById("rahiddenItemId");
           if (hraItemId != null)
               hraItemId.value = sItemID;
           var btnraTriger = document.getElementsByName("btnraTriger")[0];
           if (btnraTriger != null)
               btnraTriger.click();
       }
       catch (err) {
           txt = "There was an error on this page.\n\n";
           txt += "Error description: " + err.description + "\n\n";
           txt += "Click OK to continue.\n\n";
           alert(txt);
       }
   }
   function DisplaywpRegistrationComment(sWebId, sListId, sItemID) {
       try {
           //wpRegistrationComment
           var hWebId = document.getElementById("rghiddenWebId");
           if (hWebId != null)
               hWebId.value = sWebId;
           var hLisId = document.getElementById("rghiddenListId");
           if (hLisId != null)
               hLisId.value = sListId;
           var hItemId = document.getElementById("rghiddenItemId");
           if (hItemId != null)
               hItemId.value = sItemID;
       }
       catch (err) {
           txt = "There was an error on this page.\n\n";
           txt += "Error description: " + err.description + "\n\n";
           txt += "Click OK to continue.\n\n";
           alert(txt);
       }
   }


   //Surveys Part
   function BtnResponseSurvey(PartResponse, responseLink, trImgPoint, CountPoint, idRB, ListName, HiddenAjax, pageURL, IdTable, mone, message) {
       var RB = document.getElementsByName(idRB);
       var SurveyName = document.getElementById(ListName);
       var messageError = document.getElementById(message);
       var found_it
       if (!RB)
           return "";

       var radioLength = RB.length;
       if (radioLength == undefined)
           if (RB.checked)
           found_it = RB.value;
       else
           found_it = "";
       for (var i = 0; i < radioLength; i++) {
           if (RB[i].checked) {
               found_it = RB[i].nextSibling.nodeValue;
           }
       }
       if (found_it == undefined) {
           messageError.style.display = 'inline';
           return;
       }
       else {
           messageError.style.display = 'none';
           var PathList = SurveyName.innerText;
           var data = PathList + "|" + found_it + "|" + mone;
           AjaxSurvey(data, HiddenAjax, pageURL, IdTable, CountPoint, PartResponse);
           var link = document.getElementById(responseLink);
           link.style.display = 'none';
           ObjDisplay(PartResponse);
           ObjDisplay(trImgPoint);
       }

   }

   function ObjDisplay(idTr) {

       var trMore = document.getElementById(idTr);
       trMore.style.display = 'inline';
   }

   function QString(subject) {
       window.open("" + "?type=" + subject, "_parent");
   }


   function MoreInfoWithoutTh1(idImgOpen, idImgClose, idTr, NameSurvey, CountTR) {
       debugger
       var imgOpen = document.getElementById(idImgOpen);
       var imgClose = document.getElementById(idImgClose);
       var trMore = document.getElementById(idTr);
       var tdQues = document.getElementById(NameSurvey);
       //var LineImg=document.getElementById(trImg);


       if (imgOpen.className == 'toShow_noPrint' || imgOpen.className == '') {
           imgOpen.className = 'noShow_toPrint';
           imgClose.className = 'toShow_noPrint';
           trMore.className = 'toShow_toPrintFF';
           tdQues.className = 'txtLabel';
           tdQues.style.textAlign = 'right';
           //LineImg.className = 'toShow_toPrint';
       }
       else {
           imgOpen.className = 'toShow_noPrint';
           imgClose.className = 'noShow_toPrint';
           trMore.className = 'noShow_toPrint';
           tdQues.className = 'TrTitle';
           //LineImg.className = 'noShow_toPrint';
       }
   }

   function ExpandCollapseAllRowsSurvey(idTbl, trMore, idImgOpen, idImgClose, flag, Title, first, Last) {
       var indexTblArr = document.getElementsByName(idTbl);
       for (i = 0; i < indexTblArr.length; i++) {
           var count = ((indexTblArr[i].rows.length) - 2) / 2;
           if (count < 1)
               count = 1;

           i += 1;

           if (Last == "" && first == "") {
               k = 1;
               var CountK = (count + 1);
           }
           else {
               k = first;
               var CountK = parseInt(Last) + 1;
           }

           for (; k < CountK; k++) {
               var trId = document.getElementsByName(trMore + i + k);
               //var imgLineId = document.getElementsByName(lineID + i+k);
               var imgOpen = document.getElementsByName(idImgOpen + i + k);
               var imgClose = document.getElementsByName(idImgClose + i + k);
               var titleCss = document.getElementById(Title + i + k);
               if (flag == 0) {
                   trId[0].className = 'noShow_toPrint';
                   //imgLineId[0].className = 'noShow_toPrint';
                   imgOpen[0].className = 'toShow_noPrint';
                   imgClose[0].className = 'noShow_toPrint';
                   titleCss.className = 'TrTitle';
               }
               if (flag == 1) {
                   trId[0].className = 'toShow_toPrintFF';
                   //imgLineId[0].className = 'toShow_toPrint';
                   imgOpen[0].className = 'noShow_noPrint';
                   imgClose[0].className = 'toShow_toPrint';
                   titleCss.className = 'txtLabel';
               }
           }
           i -= 1;
       }
   }
   //End Surveys Part

   /////////////////////////////////////////////////////////////////////////////////
   //FORMS//
   /////////////////////////////////////////////////////////////////////////////////

   function ExpandCollapseAllRows(indexWP, idTr, idImgOpen, idImgClose, idContent, flag) {//debugger
       //alert("ExpandCollapseAllRows");
       try {
           var indexWPArr = document.getElementsByName(indexWP);
           var indexTableArr = document.getElementsByName("TopTable");
           for (i = 0; i < indexWPArr.length; i++) {
               var indexWP = indexWPArr[i].value;
               for (j = 0; j < indexTableArr.length; j++) {
                   for (x = 1; x <= indexTableArr[j].rows.length + 1; x++) {
                       var trMore = document.getElementById(idTr + indexWP + j + x);
                       var imgOpen = document.getElementById(idImgOpen + indexWP + j + x);
                       var imgClose = document.getElementById(idImgClose + indexWP + j + x);
                       var tdContent = document.getElementById(idContent + indexWP + j + x);

                       if (trMore != null) {
                           if (flag == 0) {
                               trMore.className = 'noShow_toPrint';
                               imgOpen.className = 'toShow';
                               imgClose.className = 'noShow';
                               tdContent.style.fontWeight = '';
                           }
                           if (flag == 1) {
                               trMore.className = 'toShow_toPrintFF';
                               imgOpen.className = 'noShow';
                               imgClose.className = 'toShow';
                               tdContent.style.fontWeight = 'bold';
                           }
                       }
                   }
               }
           }
       }
       catch (err) {
           txt = "There was an error on this page.\n\n";
           txt += "Error description: " + err.description + "\n\n";
           txt += "Click OK to continue.\n\n";
           alert(txt);
       }

   }
   // פונקציה להפעלת קליק בצד שרת ושליחת ערך ע"י hidden  
   function HiddenValueResponse(strData, inputHiddenId, sortButtonId,SortFlag) {

       try {
           //alert(SortFlag);
           document.getElementById(inputHiddenId).value = strData;
           document.getElementById(sortButtonId).click();
       }
       catch (err) {
           txt = "There was an error on this page.\n\n";
           txt += "Error description: " + err.description + "\n\n";
           txt += "Click OK to continue.\n\n";
           alert(txt);
       }
   }
   function MoreInfo(idImgOpen, idImgClose, idTr, idContent) {//debugger     
       //var index=parseInt((FindIndex(e.srcElement || e.target).rowIndex-3)/3);

       try {
           var imgOpen = document.getElementById(idImgOpen);
           var imgClose = document.getElementById(idImgClose);
           var trMore = document.getElementById(idTr);
           var tdContent = document.getElementById(idContent);

           if (imgOpen.className == 'toShow' || imgOpen.className == '') {
               imgOpen.className = 'noShow';
               imgClose.className = 'toShow';
               trMore.className = 'toShow_toPrintFF';
               tdContent.style.fontWeight = 'bold';
           }
           else {
               imgOpen.className = 'toShow';
               imgClose.className = 'noShow';
               trMore.className = 'noShow_toPrint';
               tdContent.style.fontWeight = '';
           }
       }
       catch (err) {
           txt = "There was an error on this page.\n\n";
           txt += "Error description: " + err.description + "\n\n";
           txt += "Click OK to continue.\n\n";
           alert(txt);
       }
   }

   function sortImgOut(currentImg) {
       if (currentImg.value == 0)
           currentImg.style.display = "none";
   }
   /////////////////////////////////////////////////////////////////////////////////
   //END FORMS//
   /////////////////////////////////////////////////////////////////////////////////

//CQWP display description function
  function displayCurrDescription(idImgOpen, idImgClose, currDesc, currTR)
        {
           
            try
            {
                
                //wpCQWPDisplayDescription
                     var imgOpen = document.getElementById(idImgOpen);
                      var imgClose = document.getElementById(idImgClose);
                      var divMore = document.getElementById(currDesc);
                      var trCurrent = document.getElementById(currTR);    
                                   
                  if(imgOpen != null )
                  {
                         
                          if(imgOpen.style.display == 'block' || imgOpen.style.display == '')
                          {                                    
                                    imgOpen.style.display = 'none';
                                if(imgClose != null)
                                    imgClose.style.display= '';
                                if(divMore != null)
                                    divMore.style.display = '';
                                if(trCurrent != null)
                                    trCurrent.style.fontWeight = 'bold';
                          }
                          else
                          {
                                  
                                    imgOpen.style.display = '';
                                if(imgClose != null)
                                    imgClose.style.display = 'none';
                                if(divMore != null)
                                    divMore.style.display = 'none';
                                if(trCurrent != null)
                                    trCurrent.style.fontWeight = 'normal';
                          }
                      }
                   }
                   catch (err) {
           txt = "There was an error on this page.\n\n";
           txt += "Error description: " + err.description + "\n\n";
           txt += "Click OK to continue.\n\n";
           alert(txt);
         }
     }
     //CQWP display description function seclected
     function displayCurrDescriptionSelected(idImgOpen, idImgClose, currDesc, currTR, borderStyle) {

         try {

             //wpCQWPDisplayDescription
             var imgOpen = document.getElementById(idImgOpen);
             var imgClose = document.getElementById(idImgClose);
             var divMore = document.getElementById(currDesc);
             var trCurrent = document.getElementById(currTR);


             if (imgOpen != null) {

                 if (imgOpen.style.display == 'block' || imgOpen.style.display == '') {
                     imgOpen.style.display = 'none';
                     if (imgClose != null)
                         imgClose.style.display = '';
                     if (divMore != null)
                         divMore.style.display = '';
                     if (trCurrent != null) {
                         trCurrent.style.fontWeight = 'bold';
                         trCurrent.className = 'trSelected';
                         document.getElementById(currTR).firstChild.style.borderRight = borderStyle;
                         document.getElementById(currTR).lastChild.style.borderLeft = borderStyle;
                         document.getElementById(currDesc).lastChild.style.borderLeft = borderStyle;
                     }
                 }
                 else {

                     imgOpen.style.display = '';
                     if (imgClose != null)
                         imgClose.style.display = 'none';
                     if (divMore != null)
                         divMore.style.display = 'none';
                     if (trCurrent != null) {
                         trCurrent.style.fontWeight = 'normal';
                         trCurrent.className = 'trNoSelected';
                         document.getElementById(currTR).firstChild.style.borderRight = "none";
                         document.getElementById(currTR).lastChild.style.borderLeft = "none";
                         document.getElementById(currDesc).lastChild.style.borderLeft = "none";
                     }
                 }
             }
         }
         catch (err) {
             txt = "There was an error on this page.\n\n";
             txt += "Error description: " + err.description + "\n\n";
             txt += "Click OK to continue.\n\n";
             alert(txt);
         }
     }
        
       function displayDes(tblID,Display,NewDisplay,ImgOpen,ImgClose)
        {
            try {
                //wpCQWPDisplayAllDescription
                var tbl = document.getElementById(tblID);
                var trs = tbl.getElementsByTagName('TR');
                var IDiv2 = 1;
                for (var i = 0; i < trs.length; i++) {
                    if (trs[i].style.display == Display) {
                        if (Display == "none") {
                            trs[i - 1].style.fontWeight = 'bold';                                                      
                        }
                        else {
                            trs[i - 1].style.fontWeight = 'normal';                            
                            trs[i].style.display = 'none';
                        }
                        if (NewDisplay == 'block')
                            trs[i].style.display = '';
                        else
                            trs[i].style.display = 'none';
                        var imgs = trs[i - 1].getElementsByTagName("Img");
                        for (j = 0; j < imgs.length; j++) {
                            if (imgs[j].name == ImgOpen)
                                imgs[j].style.display = Display;
                            if (imgs[j].name == ImgClose)
                                imgs[j].style.display = NewDisplay;
                        }
                    }
                    else {
                        if (i > 0) {
                            if (Display == 'block') {
                                if (IDiv2 == 0) {
                                    trs[i - 1].style.fontWeight = 'normal';                                   
                                    trs[i].style.display = 'none';
                                    IDiv2 = 1;
                                    var imgs = trs[i - 1].getElementsByTagName("Img");
                                    for (j = 0; j < imgs.length; j++) {
                                        if (imgs[j].name == ImgOpen)
                                            imgs[j].style.display = Display;
                                        if (imgs[j].name == ImgClose)
                                            imgs[j].style.display = NewDisplay;
                                    }
                                }
                                else {
                                    IDiv2 = 0;
                                }
                            }
                        }
                    }

                }

            }
            catch (err) {
                txt = "There was an error on this page.\n\n";
                txt += "Error description: " + err.description + "\n\n";
                txt += "Click OK to continue.\n\n";
                alert(txt);
            }
     }
     //display description with box around it
     function displayDesSelected(tblID, Display, NewDisplay, ImgOpen, ImgClose, borderStyle) {
         try {
             //wpCQWPDisplayAllDescription
             var tbl = document.getElementById(tblID);
             var trs = tbl.getElementsByTagName('TR');
             var IDiv2 = 1;
             for (var i = 0; i < trs.length; i++) {
                 if (trs[i].style.display == Display) {
                     if (Display == "none") {
                         trs[i - 1].style.fontWeight = 'bold';
                         trs[i - 1].className = 'trSelected';
                         trs[i - 1].firstChild.style.borderRight = borderStyle;
                         trs[i - 1].lastChild.style.borderLeft = borderStyle;
                         trs[i].lastChild.style.borderLeft = borderStyle;
                     }
                     else {
                         trs[i - 1].style.fontWeight = 'normal';
                         trs[i - 1].className = 'trNoSelected';
                         trs[i - 1].firstChild.style.borderRight = "none";
                         trs[i - 1].lastChild.style.borderLeft = "none";
                         trs[i].lastChild.style.borderLeft = "none";
                         trs[i].style.display = 'none';
                     }
                     if (NewDisplay == 'block')
                         trs[i].style.display = '';
                     else
                         trs[i].style.display = 'none';
                     var imgs = trs[i - 1].getElementsByTagName("Img");
                     for (j = 0; j < imgs.length; j++) {
                         if (imgs[j].name == ImgOpen)
                             imgs[j].style.display = Display;
                         if (imgs[j].name == ImgClose)
                             imgs[j].style.display = NewDisplay;
                     }
                 }
                 else {
                     if (i > 0) {
                         if (Display == 'block') {
                             if (IDiv2 == 0) {
                                 trs[i - 1].style.fontWeight = 'normal';
                                 trs[i - 1].className = 'trNoSelected';
                                 trs[i - 1].firstChild.style.borderRight = "none";
                                 trs[i - 1].lastChild.style.borderLeft = "none";
                                 trs[i].lastChild.style.borderLeft = "none";
                                 trs[i].style.display = 'none';
                                 IDiv2 = 1;
                                 var imgs = trs[i - 1].getElementsByTagName("Img");
                                 for (j = 0; j < imgs.length; j++) {
                                     if (imgs[j].name == ImgOpen)
                                         imgs[j].style.display = Display;
                                     if (imgs[j].name == ImgClose)
                                         imgs[j].style.display = NewDisplay;
                                 }
                             }
                             else {
                                 IDiv2 = 0;
                             }
                         }
                     }
                 }

             }

         }
         catch (err) {
             txt = "There was an error on this page.\n\n";
             txt += "Error description: " + err.description + "\n\n";
             txt += "Click OK to continue.\n\n";
             alert(txt);
         }
     }
        function displayCurrDes(idImgOpen, idImgClose, currDesc, currTR)
        {

            try
            {

                //wpCQWPDisplayDescription
                     var imgOpen = document.getElementById(idImgOpen);
                      var imgClose = document.getElementById(idImgClose);
                      var divMore = document.getElementById(currDesc);
                      var trCurrent = document.getElementById(currTR);

                  if(imgOpen != null )
                  {
                          if(imgOpen.style.display== '')
                          {

                                    imgOpen.style.display = 'none';
                                if(imgClose != null)
                                    imgClose.style.display= '';
                                if(divMore != null)
                                    divMore.style.display = '';
                                if(trCurrent != null)
                                    trCurrent.style.fontWeight = 'bold';
                          }
                          else
                          {
                                    imgOpen.style.display = '';

                                if(imgClose != null)
                                    imgClose.style.display = 'none';
                                if(divMore != null)
                                    divMore.style.display = 'none';
                                if(trCurrent != null)
                                    trCurrent.style.fontWeight = 'normal';
                          }
                      }
                   }
                   catch (err) {
           txt = "There was an error on this page.\n\n";
           txt += "Error description: " + err.description + "\n\n";
           txt += "Click OK to continue.\n\n";
           alert(txt);
         }
        }
        function displayAllDes(idImgOpen, idImgClose, currDesc, numRows,currTR)
        {
            try
            {
                //wpCQWPDisplayAllDescription                
                var imgOpen,imgClose,divMore,trCurrent;
                
                for(var j=1;j<=numRows;j++)


                {
                     imgOpen = idImgOpen + "_" + j;
                     imgClose = idImgClose + "_" + j;
                     divMore = currDesc + "_" + j;
                     trCurrent = currTR + "_" + j;
                     imgOpen = document.getElementById(imgOpen);
                     imgClose = document.getElementById(imgClose);
                     divMore = document.getElementById(divMore);
                     trCurrent = document.getElementById(trCurrent);
                    if (imgOpen != null)
                    {
                        if(imgOpen.style.display== '')
                        {
                            imgOpen.style.display = 'none';
                            if (imgClose != null)
                             imgClose.style.display= '';
                            if (divMore != null)
                             divMore.style.display = '';
                            if(trCurrent != null)
                              trCurrent.style.fontWeight = 'bold';
                        }    
                    }               



                }

           }
                   catch (err) {
           txt = "There was an error on this page.\n\n";
           txt += "Error description: " + err.description + "\n\n";
           txt += "Click OK to continue.\n\n";
           alert(txt);
         }
        }
function hideAllDes(idImgOpen, idImgClose, currDesc, numRows, currTR)
        {
            try
            {
                //wpCQWPHideAllDescription                
                var imgOpen,imgClose,divMore,trCurrent;
                
                for(var j=1;j<=numRows;j++)
                {
                     imgOpen = idImgOpen + "_" + j;
                     imgClose = idImgClose + "_" + j;
                     divMore = currDesc + "_" + j;
                     trCurrent = currTR + "_" + j;
                     imgOpen = document.getElementById(imgOpen);
                     imgClose = document.getElementById(imgClose);
                     divMore = document.getElementById(divMore);
                     trCurrent = document.getElementById(trCurrent);
                    if (imgOpen != null)
                    {
                        if(imgOpen.style.display== 'none')
                        {
                            imgOpen.style.display = '';
                            if (imgClose != null)
                            imgClose.style.display = 'none';
                            if (divMore != null)                    
                            divMore.style.display = 'none';
                            if(trCurrent != null)
                              trCurrent.style.fontWeight = 'normal';
                        }     
                    }              

                }
           }
                   catch (err) {
           txt = "There was an error on this page.\n\n";
           txt += "Error description: " + err.description + "\n\n";
           txt += "Click OK to continue.\n\n";
           alert(txt);
         }
     }
     //ABCD "all result" button
     function SetRedirect(sUrl) {
         
         window.location = sUrl;
     }

    // wpTabsAjax
     function LoadAvents(tabContainer, activeTab) {
         try {
             _tabContainer = tabContainer;
             _activeTab = activeTab;
             if (window.addEventListener) { // Mozilla, Netscape, Firefox

                 window.addEventListener('load', ChooseTab, false);
             }
             else { // IE
                 window.attachEvent('onload', ChooseTab);

             }
         }
         catch (err) {
             txt = "There was an error on this page.\n\n";
             txt += "Error description: " + err.description + "\n\n";
             txt += "Click OK to continue.\n\n";
             alert(txt);
             return true;
         }
     }
     function DisplayCtlUrlExist(strInUrl, ctl) {
     try{
         var sUrl = window.location;
         var nPos = sUrl.toString().toLowerCase().indexOf(strInUrl.toString().toLowerCase());
         if (nPos != -1)
             ObjDisplay(ctl);
             }
             catch (err) {
                 txt = "There was an error on this page.\n\n";
                 txt += "Error description: " + err.description + "\n\n";
                 txt += "Click OK to continue.\n\n";
                 alert(txt);
                 
             }

         }

         function DrawRatingStars(countRating) {//debugger 
             try {
                 //alert(countRating);
                 var number = countRating; // Replace with the number you wish to round
                 var rounding = 0.5;   // Replace this with whatever you want to round to
                 var rounded = Math.round(number / rounding) * rounding;
                 //alert(rounded);
                 if (rounded > 0 && rounded < 5)
                     document.write("<img src='/SiteCollectionImages/stars/" + rounded + ".gif' / ><br/>");
                 else
                     document.write("No Rating");
             }
             catch (err) {
                 txt = "There was an error on this page.\n\n";
                 txt += "Error description: " + err.description + "\n\n";
                 txt += "Click OK to continue.\n\n";
                 alert(txt);
             }

         }

         /********SDC TAG*************/

         function dcsVar() {
             var dCurrent = new Date();
             WT.tz = dCurrent.getTimezoneOffset() / 60 * -1;
             if (WT.tz == 0) {
                 WT.tz = "0";
             }
             WT.bh = dCurrent.getHours();
             WT.ul = navigator.appName == "Netscape" ? navigator.language : navigator.userLanguage;
             if (typeof (screen) == "object") {
                 WT.cd = navigator.appName == "Netscape" ? screen.pixelDepth : screen.colorDepth;
                 WT.sr = screen.width + "x" + screen.height;
             }
             if (typeof (navigator.javaEnabled()) == "boolean") {
                 WT.jo = navigator.javaEnabled() ? "Yes" : "No";
             }
             if (document.title) {
                 WT.ti = document.title;
             }
             WT.js = "Yes";
             if (typeof (gVersion) != "undefined") {
                 WT.jv = gVersion;
             }
             DCS.dcsdat = dCurrent.getTime();
             DCS.dcssip = window.location.hostname;
             DCS.dcsuri = window.location.pathname;
             if (window.location.search) {
                 DCS.dcsqry = window.location.search;
             }
             if ((window.document.referrer != "") && (window.document.referrer != "-")) {
                 if (!(navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) < 4)) {
                     DCS.dcsref = window.document.referrer;
                 }
             }
         }

         function A(N, V) {
             return "&" + N + "=" + dcsEscape(V);
         }

         function dcsEscape(S) {
             if (typeof (RE) != "undefined") {
                 var retStr = new String(S);
                 for (R in RE) {
                     retStr = retStr.replace(RE[R], R);
                 }
                 return retStr;
             }
             else {
                 return escape(S);
             }
         }

         function dcsCreateImage(dcsSrc) {
             if (document.images) {
                 gImages[gIndex] = new Image;
                 gImages[gIndex].src = dcsSrc;
                 gIndex++;
             }
             else {
                 document.write('<IMG BORDER="0" NAME="DCSIMG" WIDTH="1" HEIGHT="1" SRC="' + dcsSrc + '">');
             }
         }

         function dcsMeta() {
             var myDocumentElements;
             if (document.all) {
                 myDocumentElements = document.all.tags("meta");
             }
             else if (document.documentElement) {
                 myDocumentElements = document.getElementsByTagName("meta");
             }
             if (typeof (myDocumentElements) != "undefined") {
                 for (var i = 1; i <= myDocumentElements.length; i++) {
                     myMeta = myDocumentElements.item(i - 1);
                     if (myMeta.name) {
                         if (myMeta.name.indexOf('WT.') == 0) {
                             WT[myMeta.name.substring(3)] = myMeta.content;
                         }
                         else if (myMeta.name.indexOf('DCSext.') == 0) {
                             DCSext[myMeta.name.substring(7)] = myMeta.content;
                         }
                         else if (myMeta.name.indexOf('DCS.') == 0) {
                             DCS[myMeta.name.substring(4)] = myMeta.content;
                         }
                     }
                 }
             }
         }

         function dcsTag() {
             var P = "http" + (window.location.protocol.indexOf('https:') == 0 ? 's' : '') + "://" + gDomain + (gDcsId == "" ? '' : '/' + gDcsId) + "/dcs.gif?";
             for (N in DCS) {
                 if (DCS[N]) {
                     P += A(N, DCS[N]);
                 }
             }
             for (N in WT) {
                 if (WT[N]) {
                     P += A("WT." + N, WT[N]);
                 }
             }
             for (N in DCSext) {
                 if (DCSext[N]) {
                     P += A(N, DCSext[N]);
                 }
             }
             if (P.length > 2048 && navigator.userAgent.indexOf('MSIE') >= 0) {
                 P = P.substring(0, 2040) + "&WT.tu=1";
             }
             dcsCreateImage(P);
         }

         /********END SDC TAG*************/         