﻿
function ShowHideSection(divid)
{
    // THIS SCRIPT USE FOR WHO USES PROLEADS.
    var tablewhouse = document.getElementById('tblwhouse');
    var divarray = tablewhouse.getElementsByTagName('div');
    
    for(i=0;i<divarray.length;i++)
    {
       if(divarray[i].id.indexOf('dvuse') > -1)
       {
            divarray[i].style.display = "none";
       }
    }
    document.getElementById('dvuse' + divid).style.display = "";
}

function ShowHide(Tr1Name,objSpan)
{
    if(document.getElementById(Tr1Name).style.display == '' || document.getElementById(Tr1Name).style.display == null)
    {
        document.getElementById(Tr1Name).style.display = 'none';
        document.getElementById(objSpan).innerHTML = "Expand";
    }
    else
    {
        document.getElementById(Tr1Name).style.display = '';
        document.getElementById(objSpan).innerHTML = "Collapse";
    }
}

/*
//Commented by Maya : 09.11.20 (Not Used AnyWhere)

function OpenPopup(strHiddenControlID, strSearchType)
{
    var hdnIDs = document.getElementById(strHiddenControlID).value;
    
    if(hdnIDs.length>0)
    {
        var strURL;
       
       if(strSearchType=='CompanySearch')
       {
            strURL= '../commonpages/SelectFavoriteCompanyGroup.aspx?Ids=' +hdnIDs;
       }
       else if(strSearchType=='ContactSearch')
       {
            strURL  ='../commonpages/SelectFavoriteContactGroup.aspx?Ids='  +hdnIDs;
       }
       else if(strSearchType=='ProjectSearch')
       {
            strURL= '../commonpages/SelectFavoriteProjectGroup.aspx?Ids=' +hdnIDs;
       } 
       else if(strSearchType=='NotifyFavoriteProjectGroup')
       {
            strURL= 'NotifyOnUpdatePopUp.aspx?Ids=' +hdnIDs+'&NotityOnUpdateSource='+strSearchType;
       }
       else if(strSearchType=='TendersSearch')
       {
            strURL= '../commonpages/SelectFavoriteTenderGroup.aspx?Ids=' +hdnIDs;
       }
       else if(strSearchType=='ContactProfile')
       {
            strURL= '../commonpages/SelectFavoriteContactGroup.aspx?Ids=' +hdnIDs;
       }
       else if(strSearchType=='CompanyProfile')
       {
            strURL= '../commonpages/SelectFavoriteCompanyGroup.aspx?Ids=' +hdnIDs;
       }
       else if(strSearchType=='ProjectProfile')
       {
            strURL= '../commonpages/SelectFavoriteProjectGroup.aspx?Ids=' +hdnIDs;
       }
       else if(strSearchType=='TendersProfile')
       {
            strURL= '../commonpages/SelectFavoriteTenderGroup.aspx?Ids=' +hdnIDs;
       }
       
       window.open(strURL,'Test','top=200,left=300,width=350,height=350,scrollbars=yes');
    }
    return false;
}
*/

function OpenPopup(strHiddenControlID, strSearchType, strSelectionType)
{
    var hdnIDs = document.getElementById(strHiddenControlID).value;
    
    if(hdnIDs.length>0)
    {
        var strURL;
       
       if(strSearchType=='CompanySearch'&& strSelectionType=='AddToFavorite')
       {
            strURL= '../commonpages/SelectFavoriteCompanyGroup.aspx?Ids=' +hdnIDs;
       }
       else if(strSearchType=='ContactSearch' && strSelectionType=='AddToFavorite')
       {
            strURL  ='../commonpages/SelectFavoriteContactGroup.aspx?Ids='  +hdnIDs;
       }
       else if(strSearchType=='ProjectSearch' && strSelectionType=='AddToFavorite')
       {
            strURL= '../commonpages/SelectFavoriteProjectGroup.aspx?Ids=' +hdnIDs;
       } 
       else if(strSearchType=='NotifyFavoriteProjectGroup' && strSelectionType=='NotifyOnUpdate')
       {
            strURL= 'NotifyOnUpdatePopUp.aspx?Ids=' +hdnIDs+'&NotityOnUpdateSource='+strSearchType;
       }
       else if(strSearchType=='ProjectSearch'&& strSelectionType=='NotifyOnUpdate' )
       {
            strURL= 'NotifyOnUpdatePopUp.aspx?Ids=' +hdnIDs+'&NotityOnUpdateSource='+strSearchType;
       }
       else if(strSearchType=='TendersSearch')
       {
            strURL= '../commonpages/SelectFavoriteTenderGroup.aspx?Ids=' +hdnIDs;
       }
       else if(strSearchType=='CompanyProfile'&& strSelectionType=='AddToFavorite')
       {
            strURL= '../commonpages/SelectFavoriteCompanyGroup.aspx?Ids=' +hdnIDs;
       }
       else if(strSearchType=='ContactProfile' && strSelectionType=='AddToFavorite')
       {
            strURL  ='../commonpages/SelectFavoriteContactGroup.aspx?Ids='  +hdnIDs;
       }
       else if(strSearchType=='ProjectProfile' && strSelectionType=='AddToFavorite')
       {
            strURL= '../commonpages/SelectFavoriteProjectGroup.aspx?Ids=' +hdnIDs;
       } 
       else if(strSearchType=='TendersProfile' && strSelectionType=='AddToFavorite')
       {
            strURL= '../commonpages/SelectFavoriteTenderGroup.aspx?Ids=' +hdnIDs;
       }
        window.open(strURL,'Test','top=200,left=300,width=400,height=350,scrollbars=yes');
    }
   else
   {
        alert('Please select at least one item.');
   }
    return false;
} 


function OpenForRequestUpdate(strHiddenControlID, strSearchType)
{
    var hdnIDs = document.getElementById(strHiddenControlID).value;
    
    if(hdnIDs.length>0)
    {
        var strURL = RequestForUpdateURL + hdnIDs + '&SearchType=' + strSearchType;
        window.open(strURL, 'RequestUpdate','top=200,left=300,width=300,height=300,scrollbars=yes');
    }
    return false;
}


function OpenForHelp(ID,HelpURL)
{
    if(ID.length>0 && HelpURL.length > 0)
    {
        var strURL = HelpURL + ID;
        window.open(strURL, 'Help');
    }
    return false;
}


function OpenPopupWindow(strURL)
{
    window.open(strURL,'Test','top=200,left=300,width=300,height=300,scrollbars=yes');
    return false;
}

function CheckBoxOnOff(row,hdnField,hdnFieldValue,chkId,isAlternaeRow)
{
    try
    {
        var hdn = document.getElementById(hdnField);
        var chk = document.getElementById(chkId);
        
        if(chk.checked == true)
        {
            if(document.getElementById(row)!=null)
                document.getElementById(row).style.backgroundColor = "#ffffda";
            else    
                chk.parentElement.parentElement.style.backgroundColor = "#ffffda";
            hdn.value = hdn.value + hdnFieldValue;
        }
        else
        {
            if(isAlternaeRow=='False')
            {
                if(document.getElementById(row)!=null)
                {
                   document.getElementById(row).style.backgroundColor = "#ffffff";
                }
                else    
                {
                    chk.parentElement.parentElement.style.backgroundColor = "#ffffff";
                }
            }
            else
            {
                if(document.getElementById(row)!=null)
                   document.getElementById(row).style.backgroundColor = "#fafafa";
                 else
                    chk.parentElement.parentElement.style.backgroundColor = "#fafafa";  
            }
            hdn.value = hdn.value.replace(hdnFieldValue,'');
           
        }
    }
    catch(err)
    {
    }
}


function SelectAllToggle(gridName,control,hndIDs)
{
    var chk = document.getElementsByTagName("input");
    var jshndIDs = document.getElementById(hndIDs);
    jshndIDs.value = '';
    
    var flag = false;
    
    var flagzero = 0;
    if(document.all) //IE
    {
        for(j=0; j<chk.length; j++)
        {
            var count = chk[j].id.indexOf(gridName);
            if(count != -1 && chk[j].type == "checkbox")
            {
                chk[j].checked = !flag;
                if(chk[j].checked == true)
                {
                    chk[j].parentElement.parentElement.style.backgroundColor = "#ffffda";
                    chk[j].onclick(this,this.args);
                }
                else
                {
                    chk[j].parentElement.parentElement.style.backgroundColor = "#ffffff";
                    chk[j].onclick(this,this.args);
                }
            }
        }
    }
    else
    {
        for(j=0; j<chk.length; j++)
        {
            var count = chk[j].id.indexOf(gridName);
            if(count != -1 && chk[j].type == "checkbox")
            {
                chk[j].checked = !flag;
                if(chk[j].checked == true)
                {
                    chk[j].parentNode.parentNode.style.backgroundColor  = "#ffffda";
                    chk[j].onclick(this,this.args);
                }
                else
                {
                    chk[j].parentNode.parentNode.style.backgroundColor  = "#ffffff";
                    chk[j].onclick(this,this.args);
                }
            }
        }
    }
}


function DeselectAllToggle(gridName,control,hndIDs)
{
    var chk = document.getElementsByTagName("input");
    
    var jshndIDs = document.getElementById(hndIDs);
    jshndIDs.value = '';
    
    var flag = true;
    
    var flagzero = 0;
    if(document.all) //IE
    {
        for(j=0; j<chk.length; j++)
        {
            var count = chk[j].id.indexOf(gridName);
            if(count != -1 && chk[j].type == "checkbox")
            {
                chk[j].checked = !flag;
                if(chk[j].checked == true)
                {
                    chk[j].parentElement.parentElement.style.backgroundColor = "#ffffda";
                    chk[j].onclick(this,this.args);
                }
                else
                {
                    chk[j].parentElement.parentElement.style.backgroundColor = "#ffffff";
                    chk[j].onclick(this,this.args);
                }
            }
        }
    }
    else
    {
        for(j=0; j<chk.length; j++)
        {
            var count = chk[j].id.indexOf(gridName);
            if(count != -1 && chk[j].type == "checkbox")
            {
                chk[j].checked = !flag;
                if(chk[j].checked == true)
                {
                    chk[j].parentNode.parentNode.style.backgroundColor  = "#ffffda";
                    chk[j].onclick(this,this.args);
                }
                else
                {
                    chk[j].parentNode.parentNode.style.backgroundColor  = "#ffffff";
                    chk[j].onclick(this,this.args);
                }
            }
        }
    }
}


// Removes leading whitespaces
function LTrim( value ) 
{
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
}

// Removes ending whitespaces
function RTrim( value ) 
{
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
}

// Removes leading and ending whitespaces
function trim( value ) 
{
	return LTrim(RTrim(value));
} 


//Date Validatoin
function ValidateDate(strdate)
{
    var str1  = strdate;
    
    if(check_date(str1)==true)
    {
        var mon1   = parseInt(str1.split("/")[0],10); 
        var dt1  = parseInt(str1.split("/")[1],10);
        var yr1   = parseInt(str1.split("/")[2],10); 
        var yr1   = (yr1    < 1000) ? yr1    + 1000 : yr1   ;
        var sourceDate  = new Date(mon1 + '/'+ dt1 +'/'+ yr1); 
        var leftDate  = new Date('01/01/1753');
        var rightDate  = new Date('12/31/9999');

        if((leftDate <= sourceDate) && (sourceDate<=rightDate))
        {
            return true;
        } 
        else 
        { 
            return false; 
        } 
    }
    else
    {
        return false; 
    }
}


function check_date(field)
{
    var checkstr = "0123456789";
    var DateField = field;
    var Datevalue = "";
    var DateTemp = "";
    var seperator = ".";
    var day;
    var month;
    var year;
    var leap = 0;
    var err = 0;
    var i;

    err = 0;
    DateValue = DateField;

    month = parseInt(DateField.split("/")[0],10); 
    day = parseInt(DateField.split("/")[1],10);
    year = parseInt(DateField.split("/")[2],10);
          
    //year = DateValue.substr(4,4);
    if (year == 0) 
    {
      err = 20;
    }

    /* Validation of month*/
    if ((month < 1) || (month > 12)) 
    {
      err = 21;
    }

    /* Validation of day*/
    if (day < 1) 
    {
     err = 22;
    }

    /* Validation leap-year / february / day */
    if ((year % 4 == 0) || (year % 100 == 0) || (year % 400 == 0)) 
    {
      leap = 1;
    }
    if ((month == 2) && (leap == 1) && (day > 29)) 
    {
      err = 23;
    }
    if ((month == 2) && (leap != 1) && (day > 28)) 
    {
      err = 24;
    }

    /* Validation of other months */
    if ((day > 31) && ((month == "01") || (month == "03") || (month == "05") || (month == "07") || (month == "08") || (month == "10") || (month == "12"))) 
    {
      err = 25;
    }
    if ((day > 30) && ((month == "04") || (month == "06") || (month == "09") || (month == "11"))) 
    {
      err = 26;
    }

    /* if 00 ist entered, no error, deleting the entry */
    if ((day == 0) && (month == 0) && (year == 00)) {
      err = 0; day = ""; month = ""; year = ""; seperator = "";
    }
          
    if (err == 0)  /* if no error, write the completed date to Input-Field (e.g. 13.12.2001) */
    {
      return true;
    }
    else /* Error-message if err != 0 */
    {
      return false;
    }
}


function CheckSelection(sender,args)
{
    var Company= document.getElementById("ctl00_CPH_objQuickSearch_chkCompany");
    var Contact= document.getElementById("ctl00_CPH_objQuickSearch_chkContact");
    var Project= document.getElementById("ctl00_CPH_objQuickSearch_chkProject");
    
 	try
 	{
        if(Company.checked ==false  && Contact.checked ==false && Project.checked ==false )
        {
                sender.errormessage="Please select Company or Contact or Project";
	            args.IsValid=false;
	            return;
        }
            args.IsValid=true;
    }
    catch(err)
    {
         sender.errormessage="Please select Company or Contact or Project";
        args.IsValid=false;
    }
}

function NotValidUser(a)
{
    alert(a);
    return false;
}


/******************************/
/* Treeview Script */
/***************************/

function TNC(evt)
{
    var src = window.event != window.undefined ? window.event.srcElement : evt.target;
    var isChkBoxClick = (src.tagName.toLowerCase() == "input" && src.type == "checkbox");
    if(isChkBoxClick)
    {
        var parentTable = GetParentByTagName("table", src);
        var nxtSibling = parentTable.nextSibling;
        //check if nxt sibling is not null & is an element node
        if(nxtSibling && nxtSibling.nodeType == 1)
        {
            if(nxtSibling.tagName.toLowerCase() == "div") //if node has children
            {
                //check or uncheck children at all levels
                CheckUncheckChildren(parentTable.nextSibling, src.checked);
            }
        }
        //check or uncheck parents at all levels
        CheckUncheckParents(src, src.checked);
    }
}

function CheckUncheckChildren(childContainer, check)
{
    var childChkBoxes = childContainer.getElementsByTagName("input");
    var childChkBoxCount = childChkBoxes.length;
    for(var i=0;i<childChkBoxCount;i++)
    {
        childChkBoxes[i].checked = check;
    }
}

function CheckUncheckParents(srcChild, check)
{
    var parentDiv = GetParentByTagName("div", srcChild);
    var parentNodeTable = parentDiv.previousSibling;
    if(parentNodeTable)
    {
        var checkUncheckSwitch;
        if(check) //checkbox checked
        {
            var isAllSiblingsChecked = AreAllSiblingsChecked(srcChild);
            if(isAllSiblingsChecked)
                checkUncheckSwitch = true;
            else
                checkUncheckSwitch = false;
            //do not need to check parent if any(one or more) child not checked
        }
        else //checkbox unchecked
        {
            checkUncheckSwitch = false;
        }
        var inpElemsInParentTable = parentNodeTable.getElementsByTagName("input");
        if(inpElemsInParentTable.length > 0)
        {
            var parentNodeChkBox = inpElemsInParentTable[0];
            parentNodeChkBox.checked = checkUncheckSwitch;
            //do the same recursively
        CheckUncheckParents(parentNodeChkBox, checkUncheckSwitch);
        }
    }
}

function AreAllSiblingsChecked(chkBox)
{
    var parentDiv = GetParentByTagName("div", chkBox);
    var childCount = parentDiv.childNodes.length;
    for(var i=0;i<childCount;i++)
    {
        if(parentDiv.childNodes[i].nodeType == 1)
        {
            //check if the child node is an element node
            if(parentDiv.childNodes[i].tagName.toLowerCase() == "table")
            {
                var prevChkBox = parentDiv.childNodes[i].getElementsByTagName("input")[0];
                //if any of sibling nodes are not checked, return false
                if(!prevChkBox.checked)
                {
                    return false;
                }
            }
        }
    }
    return true;
}

function GetParentByTagName(parentTagName, childElementObj)
{
    var parent = childElementObj.parentNode;
    while(parent.tagName.toLowerCase() != parentTagName.toLowerCase())
    {
        parent = parent.parentNode;
    }
    return parent;
}

function fnSetFocus(clientID)
{
   	setTimeout("setFocus('"+clientID+"')",500);
}

function setFocus(clientID)
{
    eval("document.getElementById('"+clientID+"').focus()");
}

function validatelimit(control, maxchar)
{
        var obj=document.getElementById(control)
        var remaningChar = maxchar - obj.value.length;
        
         if (remaningChar <= 0)
        {
           obj.value = obj.value.substring(maxchar,0);
           return false;
        }
         else
        {
        return true;
        }
}

function AppendChildToCheckboxList(ChklistID,Index,Value,Text)
{
    var Chklist = document.getElementById(ChklistID);

    var tb = parent.document.createElement("TBODY");
    var tr = parent.document.createElement("tr");
    var td = parent.document.createElement("td");
    var span = parent.document.createElement("SPAN");


    var cb = document.createElement('input');
    cb.type = 'checkbox';
    cb.id = ChklistID + "_" + Index;
    cb.name = ChklistID + "$" + Index;
    cb.value = Value;
    cb.checked = false;

    var label= document.createElement('label');
    label.htmlFor = cb.id;
    label.innerHTML = Text;

    span.alt = Value;
    span.appendChild(cb);
    span.appendChild(label);

    td.appendChild(span);

    tr.appendChild(td);
    tb.appendChild(tr)

    Chklist.appendChild(tb);
}
    
function RemoveChildFromCheckboxList(ChkListClientID,CompanyIDClientID,CompanyNameClientID,CompanyTextClientID)
{
    if(SelectedChildCount(ChkListClientID,CompanyIDClientID,CompanyNameClientID)>0)
    {
        if(confirm('Are you sure you want to remove selected companies?'))
        {
            RemoveChild(ChkListClientID,CompanyIDClientID,CompanyNameClientID);
            RemoveCompanyIDAndCompanyName(ChkListClientID,CompanyIDClientID,CompanyNameClientID,CompanyTextClientID);
        }
    }
    return false;
}

function SelectedChildCount(ChkListClientID,CompanyIDClientID,CompanyNameClientID)
{
      var Chklist = document.getElementById(ChkListClientID); 
   
     var chkinput =  Chklist.getElementsByTagName('input');
     var chkspan =  Chklist.getElementsByTagName('label');
     var chkTR =  Chklist.getElementsByTagName('tr');
     var chkTD =  Chklist.getElementsByTagName('td');
     var chkTBODY =  Chklist.getElementsByTagName('TBODY');
     
     if(chkinput.length <=0)
        return 0;
       
       var count=0;
       for(j=0;j<chkinput.length;j++)
       {
             var option = chkinput[j];
            
             if(option.checked==true)
             {
                count=count+1;
             }
       }
       return count;
}
    
function RemoveChild(ChkListClientID,CompanyIDClientID,CompanyNameClientID)
{
    var Chklist = document.getElementById(ChkListClientID); 
    var chkinput =  Chklist.getElementsByTagName('input');
    var chkspan =  Chklist.getElementsByTagName('label');
    var chkTR =  Chklist.getElementsByTagName('tr');
    var chkTD =  Chklist.getElementsByTagName('td');
    var chkTBODY =  Chklist.getElementsByTagName('TBODY');

    if(chkinput.length <=0)
    return false;

    for(j=0;j<chkinput.length;j++)
    {
         var option = chkinput[j];
         var optionTR = chkTR[j]
        
         if(option.checked==true)
         {
            var optiontTBODY = chkTBODY[j+1];
           
            if(navigator.appName == "Microsoft Internet Explorer")
            {
                if(optiontTBODY != undefined)
                    optiontTBODY.removeNode(true);
                else     
                    optionTR.removeNode(true);
            }
            else 
            {
                if(optiontTBODY != null)
                    optiontTBODY.parentNode.removeChild(optiontTBODY);
                else     
                    optionTR.parentNode.removeChild(optionTR);
            }
                
            RemoveChild(ChkListClientID,CompanyIDClientID,CompanyNameClientID)
         }
    }
    return false;
}

function RemoveCompanyIDAndCompanyName(ChkListClientID,CompanyIDClientID,CompanyNameClientID,CompanyTextClientID)
{
    var Chklist = document.getElementById(ChkListClientID); 
    var chkinput =  Chklist.getElementsByTagName('input');
    var chklabel =  Chklist.getElementsByTagName('label');
    var chkSPAN =  Chklist.getElementsByTagName('SPAN');
    var CompanyID = ",";
    var CompanyName = ",";
    var CompanyText = "";

    CompanyText = "<table   style='background-color:#dfedf8;text-align: left' width='100%' cellpading='0' cellspecing = '0'><tr class='grid_header'><td >Selected Company</td></tr></table>";

    if(chkinput.length <=0)
    {
        document.getElementById(CompanyIDClientID).value = CompanyID;
        document.getElementById(CompanyNameClientID).value = CompanyName;
        document.getElementById(CompanyTextClientID).value = CompanyText;
        return false;
    }

    for(j=0;j<chkinput.length;j++)
    {
        var option = chkinput[j];
        var option1 = chklabel[j];
        var optionSPAN = chkSPAN[j];
        var SpanAlt = '';
        SpanAlt = optionSPAN.alt;
        if(SpanAlt == undefined && navigator.appName != "Microsoft Internet Explorer")
        {
            SpanAlt = optionSPAN.attributes.item(0).firstChild.nodeValue
        }
        if(option.checked==false)
        {
            if(option1.innerHTML != "0" && SpanAlt != undefined)
            {
                CompanyID = CompanyID + SpanAlt + ",";   
                CompanyName = CompanyName + option1.innerHTML + ",|";   
                var TempText = "<table style='text-align: left' id='" + SpanAlt +  "' width='100%' cellpading='0' cellspecing = '0'><tr><td>" + option1.innerHTML + "</td></tr></table>";
                CompanyText = CompanyText  + TempText;
            }
        }   
    }
    document.getElementById(CompanyIDClientID).value = CompanyID;
    document.getElementById(CompanyNameClientID).value = CompanyName;
    document.getElementById(CompanyTextClientID).value = CompanyText; 
}

function RemoveAllChildFromCheckboxList(ChkListClientID)
{
    var Chklist = document.getElementById(ChkListClientID); 
    var chkinput =  Chklist.getElementsByTagName('input');
    var chkspan =  Chklist.getElementsByTagName('label');
    var chkTBODY =  Chklist.getElementsByTagName('TBODY');
    var chkTR =  Chklist.getElementsByTagName('tr');

    if(chkinput.length <=0)
        return false;

    for(j=0;j<chkinput.length;j++)
    {
        var option = chkinput[j];
        var option1 = chkspan[j];
        var optionTR = chkTR[j];

        if(navigator.appName == "Microsoft Internet Explorer")
        {
            option.removeNode(true);
            option1.removeNode(true);
            optionTR.removeNode(true);

            if(chkTBODY.length > j+1)
            {
                var optionTBODY = chkTBODY[j+1];
                optionTBODY.removeNode(true);
            }
        }
        else
        {
            option.parentNode.removeChild(option);
            option1.parentNode.removeChild(option1);
            optionTR.parentNode.removeChild(optionTR);

            if(chkTBODY.length > j+1)
            {
                var optionTBODY = chkTBODY[j+1];
                if(optionTBODY != null)
                optionTBODY.parentNode.removeChild(optionTBODY);
            }
        }
        RemoveAllChildFromCheckboxList(ChkListClientID);
    }
}


function CreateCompanyList(ChkListName,CompanyID,CompanyName)
{
    var ArrCompanyID = CompanyID.split(",");
    var ArrCompanyName = CompanyName.split(",|");

    RemoveAllChildFromCheckboxList(ChkListName)

    var Chklist = ChkListName; 

    var count=0;
    for(j=0;j<ArrCompanyID.length;j++)
    {
        if(ArrCompanyID[j] != '')
        {
            AppendChildToCheckboxList(Chklist,count,ArrCompanyID[j],ArrCompanyName[j]);
            count++;
        }
    }
    return false;
}