﻿    function RefreshRatings(objRate)
    {
        var objId =objRate.id;//  btnRateThisVenue 
        var strVenueId= objId.replace("btnRateThisVenue","hdnVenueId");     
        var venueid=document.getElementById(strVenueId).value
        document.getElementById('ctl00_AssignRatingsToVenuedialog_hdnVenueId').value=venueid
    }
    
    
    function RefreshRatings2()
    {
        document.getElementById('ctl00_AssignRatingsToVenuedialog_lbRefresh').click();
    }
    
    function OpenRatingsDialog(objThis)
    {
        RefreshRatings(objThis);
        if(window['AssignRatingsToVenueDialog'].get_isShowing())
        {
            window['AssignRatingsToVenueDialog'].Close();
        }
        else
        {   window['AssignRatingsToVenueDialog'].Show();
        }
        RefreshRatings2();
        return false;
    }
    
     function fnAddUserCheckinDialogClick(isfriend,objThis)
    {
    var objId = objThis.id;
     var strVenueId= objId.replace("btnInviteFriends","hdnVenueId");
     var venueid=document.getElementById(strVenueId).value
        var param = '2' + "+" + isfriend+"+"+ venueid;
        addUserCheckinDialog.set_value(param);
        if(addUserCheckinDialog.get_isShowing())
        {addUserCheckinDialog.Close();}
        else{addUserCheckinDialog.Show();} 
        return false;
    }
    
    
    function fnAddUserCheckinDialogClick(isfriend)
    {
        var param = '2' + "+" + isfriend;
        addUserCheckinDialog.set_value(param);
        if(addUserCheckinDialog.get_isShowing())
        {addUserCheckinDialog.Close();}
        else{addUserCheckinDialog.Show();} 
        return false;
    }   
    
     
     function Dialog_close()
    {
        addUserCheckinDialog.Close();
    }


  
       function RemoveSearch(strid) {
        var strfinalid = strid.replace('_srchvenues', '_textcell');
        var divSearchBox = document.getElementById(strfinalid);
        divSearchBox.setAttribute("class", "searchblank"); 
        divSearchBox.setAttribute("className", "searchblank"); 
       }
       function AddSearch(strid) {
        if (document.getElementById(strid).value.length<1){
         var strfinalid = strid.replace('_srchvenues', '_textcell');
         var divSearchBox = document.getElementById(strfinalid);
         divSearchBox.setAttribute("class", "searchvenues"); 
         divSearchBox.setAttribute("className", "searchvenues");
        }
       }
            
       function RemoveSearch2(strid) {
        var strfinalid = strid.replace('_srchpeople', '_textcell2');
        var divSearchBox = document.getElementById(strfinalid);
        divSearchBox.setAttribute("class", "searchblank"); 
        divSearchBox.setAttribute("className", "searchblank"); 
       }
       function AddSearch2(strid) {
        if (document.getElementById(strid).value.length<1){
         var strfinalid = strid.replace('_srchpeople', '_textcell2');
         var divSearchBox = document.getElementById(strfinalid);
         divSearchBox.setAttribute("class", "searchpeople"); 
         divSearchBox.setAttribute("className", "searchpeople");
        }
       }
            
       function RemoveSearch3(strid) {
        var strfinalid = strid.replace('_srchevents', '_textcell3');
        var divSearchBox = document.getElementById(strfinalid);
        divSearchBox.setAttribute("class", "searchblank"); 
        divSearchBox.setAttribute("className", "searchblank"); 
       }
       function AddSearch3(strid) {
        if (document.getElementById(strid).value.length<1){
         var strfinalid = strid.replace('_srchevents', '_textcell3');
         var divSearchBox = document.getElementById(strfinalid);
         divSearchBox.setAttribute("class", "searchevents"); 
         divSearchBox.setAttribute("className", "searchevents");
        }
       }
     

       function fnGetClientId(strid)
    {
        var count=document.forms[0].length ;
        var i = 0 ;
        var eleName;
        for (i = 0 ;  i < count ;  i++ )
        {
            eleName = document.forms[0].elements[ i ].id;
            pos=eleName.indexOf(strid) ;
            if(pos >= 0)  break;           
        }
        return eleName;
    }         
    function addUserCheckin_dialogshow(dialog)
    {
        addUserCheckin_renderControl(addUserCheckinDialog.get_value());
    //  document.getElementById('showclose').value = 'Close Dialog';
    //  document.getElementById('showclose').disabled = false;
    }
    
    function addUserCheckin_dialogclose()
    {
        addUserCheckinDialog.Close("dialog closed by user");
        return false;
    }
    function addUserCheckin_renderControl(param)
    {
        AddUserCheckin.callback(param);
    }

    function AddEventCallBack_Load(sender, eventArgs)
    {
//     setTimeout("addevent_renderControl('0')", 500);
    }



//       function fnGetClientId(strid)
//    {
//        var count=document.forms[0].length ;
//        var i = 0 ;
//        var eleName;
//        for (i = 0 ;  i < count ;  i++ )
//        {
//            eleName = document.forms[0].elements[ i ].id;
//            pos=eleName.indexOf(strid) ;
//            if(pos >= 0)  break;           
//        }
//        return eleName;
//    }         
//    function addUserCheckin_dialogshow(dialog)
//    {
//        addUserCheckin_renderControl(addUserCheckinDialog.get_value());
//    //  document.getElementById('showclose').value = 'Close Dialog';
//    //  document.getElementById('showclose').disabled = false;
//    }
//    
//    function addUserCheckin_dialogclose()
//    {
//        addUserCheckinDialog.Close("dialog closed by user");
//        return false;
//    }
//    function addUserCheckin_renderControl(param)
//    {
//        AddUserCheckin.callback(param);
//    }

//    function AddEventCallBack_Load(sender, eventArgs)
//    {
////     setTimeout("addevent_renderControl('0')", 500);
//    }


 function fnShowAll(id)
    {
    if(id==0)
    
    {
        document.getElementById("lnkShowAll").style.display='none'
        document.getElementById("spnShowAll").style.display='';
   
        }
    else{
    document.getElementById("spnShowAll").style.display='none';
    document.getElementById("lnkShowAll").style.display='';
   
    }    
    
    }
    
        function fnGetClientIdALL(strid)
    {
        var count=document.all.length ;
        var i = 0 ;
        var eleName;
        for (i = 0 ;  i < count ;  i++ )
        {
            eleName = document.all[ i ].id;
            pos=eleName.indexOf(strid) ;
            if(pos >= 0)
            {
                break;
            }           
        }
        return eleName;
    }
     
    
     function PickerFrom_OnDateChange(sender, eventArgs)
    {
        var fromDate = PickerFrom.getSelectedDate();
        var toDate = PickerTo.getSelectedDate();
        if (fromDate > toDate)
        {
            PickerTo.setSelectedDate(fromDate);
        }
    }
    function PickerTo_OnDateChange(sender, eventArgs)
    {
        var fromDate = PickerFrom.getSelectedDate();
        var toDate = PickerTo.getSelectedDate();
        if (fromDate > toDate)
        {
            PickerFrom.setSelectedDate(toDate);
        }
    }
   
   function SetImageEditSpecial()
    {
        if(document.images)
        {
            var ddIconsEditSpecial = document.getElementById('<%= ddIconsEditSpecial.ClientID %>');
            if(ddIconsEditSpecial.selectedIndex!=-1)
            {document.images['widgeteditspecial'].src=ddIconsEditSpecial.options[ddIconsEditSpecial.selectedIndex].value;}
            if(document.images['widgeteditspecial'].src== 'http://<%= ConfigurationManager.AppSettings("WeezatDomain") %>/' || document.images['widgeteditspecial'].src=="http://localhost:4218/weezat/" || document.images['widgeteditspecial'].src=="")
            {document.images['widgeteditspecial'].style.display="none";}
            else
            {document.images['widgeteditspecial'].style.display="";}                
        }
    }
   
    function fnRecurrencePatternEditSpecial()
    {    
        var rdRecurrencePattern0 = document.getElementById('<%= rdRecurrencePattern.ClientID %>'+"_0");
        var rdRecurrencePattern1 = document.getElementById('<%= rdRecurrencePattern.ClientID %>'+"_1");
        var rdRecurrencePattern2 = document.getElementById('<%= rdRecurrencePattern.ClientID %>'+"_2");
        var rdRecurrencePattern3 = document.getElementById('<%= rdRecurrencePattern.ClientID %>'+"_3");
        var rdRecurrencePattern4 = document.getElementById('<%= rdRecurrencePattern.ClientID %>'+"_4");
        var tbRecurrencePattern = document.getElementById('<%= rdRecurrencePattern.ClientID %>');
        var trDaily = document.getElementById('<%= trDaily.ClientID %>');
        var trWeekly = document.getElementById('<%= trWeekly.ClientID %>');
        var trMonthly1 = document.getElementById('<%= trMonthly1.ClientID %>');
        var trMonthly2 = document.getElementById('<%= trMonthly2.ClientID %>');
        var trYearly1 = document.getElementById('<%= trYearly1.ClientID %>');
        var trYearly2 = document.getElementById('<%= trYearly2.ClientID %>');
        /*
        if(document.getElementById("ctl00_body_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_rdRecurrencePattern_0") != null)
        {
        var rdRecurrencePattern0 = document.getElementById("ctl00_body_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_rdRecurrencePattern_0") ;
        }
        else
        {
        var rdRecurrencePattern0 = document.getElementById("ctl00_body_ucUHome_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_rdRecurrencePattern_0") ;
        }
        
        if(document.getElementById("ctl00_body_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_rdRecurrencePattern_1") != null)
        {
            var rdRecurrencePattern1 = document.getElementById("ctl00_body_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_rdRecurrencePattern_1") ;
        }
        else
        {
            var rdRecurrencePattern1 = document.getElementById("ctl00_body_ucUHome_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_rdRecurrencePattern_1") ;
        }
        if(document.getElementById("ctl00_body_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_rdRecurrencePattern_2") != null)
        {
            var rdRecurrencePattern2 = document.getElementById("ctl00_body_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_rdRecurrencePattern_2");    
        }
        else
        {
            var rdRecurrencePattern2 = document.getElementById("ctl00_body_ucUHome_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_rdRecurrencePattern_2");
        }
        if(document.getElementById("ctl00_body_ucEventDialog_ucEditEventDialog_ucEditEvent_rdRecurrencePattern_3") != null)
        {
            var rdRecurrencePattern3 = document.getElementById("ctl00_body_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_rdRecurrencePattern_3") ;
        }
        else
        {
            var rdRecurrencePattern3 = document.getElementById("ctl00_body_ucUHome_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_rdRecurrencePattern_3") ;
        }
        if(document.getElementById("ctl00_body_ucEventDialog_ucEditEventDialog_ucEditEvent_rdRecurrencePattern_4") != null)
        {
            var rdRecurrencePattern4 = document.getElementById("ctl00_body_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_rdRecurrencePattern_4") ;
        }
        else
        {
            var rdRecurrencePattern4 = document.getElementById("ctl00_body_ucUHome_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_rdRecurrencePattern_4") ;
        }
        
        if(document.getElementById("ctl00_body_ucEventDialog_ucEditEventDialog_ucEditEvent_tbRecurrencePattern") != null)
        {
            var tbRecurrencePattern = document.getElementById("ctl00_body_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_tbRecurrencePattern") ;
        }
        else
        {
            var tbRecurrencePattern = document.getElementById("ctl00_body_ucUHome_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_tbRecurrencePattern") ;
        }
        if(document.getElementById("ctl00_body_ucEventDialog_ucEditEventDialog_ucEditEvent_trDaily") != null)
        {
            var trDaily =document.getElementById("ctl00_body_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_trDaily");
        }
        else
        {
            var trDaily =document.getElementById("ctl00_body_ucUHome_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_trDaily");
        }
        if(document.getElementById("ctl00_body_ucEventDialog_ucEditEventDialog_ucEditEvent_trWeekly") != null)
        {
            var trWeekly =document.getElementById("ctl00_body_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_trWeekly");
        }
        else
        {
            var trWeekly =document.getElementById("ctl00_body_ucUHome_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_trWeekly");
        }
        if(document.getElementById("ctl00_body_ucEventDialog_ucEditEventDialog_ucEditEvent_trMonthly1") != null)
        {
            var trMonthly1 =document.getElementById("ctl00_body_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_trMonthly1");
        }
        else
        {
            var trMonthly1 =document.getElementById("ctl00_body_ucUHome_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_trMonthly1");
        }
        if(document.getElementById("ctl00_body_ucEventDialog_ucEditEventDialog_ucEditEvent_trMonthly1") != null)
        {
            var trMonthly2 =document.getElementById("ctl00_body_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_trMonthly2");
        }
        else
        {
            var trMonthly2 =document.getElementById("ctl00_body_ucUHome_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_trMonthly2");
        }
        if(document.getElementById("ctl00_body_ucEventDialog_ucEditEventDialog_ucEditEvent_trMonthly1") != null)
        {
            var trYearly1 = document.getElementById("ctl00_body_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_trYearly1");
        }
        else
        {
            var trYearly1 = document.getElementById("ctl00_body_ucUHome_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_trYearly1");
        }
        if(document.getElementById("ctl00_body_ucEventDialog_ucEditEventDialog_ucEditEvent_trYearly2") != null)
        {
            var trYearly2 = document.getElementById("ctl00_body_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_trYearly2");
        }
        else
        {
            var trYearly2 = document.getElementById("ctl00_body_ucUHome_ucEventDialog_ucEditEventDialogSpecial_ucEditEventSpecial_trYearly2");
        }
        */
        if (rdRecurrencePattern1.checked == true)
        {   
            trDaily.style.display = '' ;
            trWeekly.style.display = 'none' ;
            trMonthly1.style.display = 'none' ;
            trMonthly2.style.display = 'none' ;
            trYearly1.style.display = 'none' ;
            trYearly2.style.display = 'none';
        }
        else if (rdRecurrencePattern2.checked == true)
        {
            trDaily.style.display = 'none' ;
            trWeekly.style.display = '' ;
            trMonthly1.style.display = 'none' ;
            trMonthly2.style.display = 'none' ;
            trYearly1.style.display = 'none' ;
            trYearly2.style.display = 'none';
        }
        else if (rdRecurrencePattern3.checked == true)
        {
            trDaily.style.display = 'none' ;
            trWeekly.style.display = 'none' ;
            trMonthly1.style.display = '' ;
            trMonthly2.style.display = '' ;
            trYearly1.style.display = 'none' ;
            trYearly2.style.display = 'none';
            
        }
        else if (rdRecurrencePattern4.checked == true)
        {
            trDaily.style.display = 'none' ;
            trWeekly.style.display = 'none' ;
            trMonthly1.style.display = 'none' ;
            trMonthly2.style.display = 'none' ;
            trYearly1.style.display = '' ;
            trYearly2.style.display = '';
        }
        else if (rdRecurrencePattern0.checked == true)
        {
            trDaily.style.display = 'none' ;
            trWeekly.style.display = 'none' ;
            trMonthly1.style.display = 'none' ;
            trMonthly2.style.display = 'none' ;
            trYearly1.style.display = 'none' ;
            trYearly2.style.display = 'none';
        }
    }
  
   function AddVenue()
    {
        var id=document.getElementById(fnGetClientIdALLSpecial("txtIDs")).value;
        var pageno=document.getElementById(fnGetClientIdALLSpecial("hfPageNo")).value;
        cbVenue.callback("Add-"+id+"-"+pageno);
    }
    function RemoveVenue(id)
    {
        var pageno=document.getElementById(fnGetClientIdALLSpecial("hfPageNo")).value;
        cbVenue.callback("Remove-"+id+"-"+pageno);
    }
    function PrevVenue()
    {
        var pageno=document.getElementById(fnGetClientIdALLSpecial("hfPageNo")).value;
        cbVenue.callback("Prev-"+pageno);
    }
    function NextVenue()
    {    
        var pageno=document.getElementById(fnGetClientIdALLSpecial("hfPageNo")).value;
        cbVenue.callback("Next-"+pageno);
    }
    
     function dialogcloseAssignRatings()
    {
        window['AssignRatingsToVenueDialog'].Close("dialog closed by user");
        return false;
    }
    function RatingsSaved()
    {
        alert('Ratings Saved');
        dialogcloseAssignRatings();
    }
    
    
    
    function get_value_text(v,m,r) {
   var n = Math.floor((v / m) * 10) ;
   return "Rated " + String(n) + " out of 10" + r;
}

  function textLimit(field, maxlen)
    {
//        if (field.value.length > maxlen + 1)
//                alert('your input has been truncated!');
        if (field.value.length > maxlen)
                field.value = field.value.substring(0, maxlen);
    }


    function charcount(field )
    {
      var x=(300- Number ( field.value.length))-1;

      var y=document.getElementById('chrcnt').rows[0].cells;
      y[0].innerHTML=x;

      if(x<0)
      { y[0].innerHTML=0;}

    }

    function askDel()
   {
       if(confirm("Are you sure you want to remove this friend?", "Yes", "No"))
      { return true; }
      else
      { return false; }
   }
   function askDecline()
   {
       if(confirm("Are you sure you want to decline this friend request?", "Yes", "No"))
      { return true; }
      else
      { return false; }
   }
    function askDelTF()
   {
      if(confirm("Are you sure you want to remove this friend as top friend?", "Yes", "No"))
      { return true; }
      else
      { return false; }
   }

    function fnAddDialogClick(ToUserId)
    {
        addnudgeDialog.set_value(ToUserId);
        if(addnudgeDialog.get_isShowing())
        {
            addnudgeDialog.Close();}
        else
        {
            addnudgeDialog.Show();
        }
        return false;
    }
    function NudgeDialog_close()
    {
        addnudgedialog.Close();
    }

