﻿//Textbox Watermark
function WMInit(textbox,mark) {
    
    if (textbox.value.replace(/^\s\s*/, '').replace(/\s\s*$/, '') == "") {
	    textbox.style.color = "rgb(129, 129, 129)";
	    textbox.value = mark;
	}
	else if (textbox.value==mark)
	{
	    textbox.style.color = "rgb(129, 129, 129)";
	    textbox.value = mark;
	}
}

function Focused(textbox) {
	
	if ((textbox.style.color == "rgb(129, 129, 129)") || (textbox.style.color == "rgb(129,129,129)")) {
		textbox.value = "";
		textbox.style.color = "";
	}
}
		
function Blurred(textbox,mark) { 
	if (textbox.value.replace(/^\s\s*/, '').replace(/\s\s*$/, '') == "") {
		textbox.style.color = "rgb(129, 129, 129)";
		textbox.value = mark;
	}
} 

function SignupBox()
{
        var emailMe = document.getElementById("emailMe");
      
       
        var emailMeMsg = document.getElementById("emailMeMsg");
        emailMeMsg.style.display = "";
        
        document.getElementById("ctl00_mainContent_txtEmail").value='';
        document.getElementById("ctl00_mainContent_txtPassword").value='';
        document.getElementById("ctl00_mainContent_txtPasswordAgain").value='';
        document.getElementById('imgload1').style.display='none';
        
        
          var myWidth = 0, myHeight = 0;
          if( typeof( window.innerWidth ) == 'number' ) {
            //Non-IE
            myWidth = window.innerWidth;
            myHeight = window.innerHeight;
          } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
            //IE 6+ in 'standards compliant mode'
            myWidth = document.documentElement.clientWidth;
            myHeight = document.documentElement.clientHeight;
          } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
            //IE 4 compatible
            myWidth = document.body.clientWidth;
            myHeight = document.body.clientHeight;
          }
         

        
        var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
 
  
  
        emailMe.style.top = scrOfY + ((myHeight/2)-113)+ "px";
        emailMe.style.left =scrOfX + ((myWidth/2)-190) + "px";

        emailMe.style.display = "";
        
        if (document.getElementById("backdrop") == null) {
            var backdrop = document.createElement("div");
            backdrop.id = "backdrop";
            emailMe.parentNode.appendChild(backdrop);
            
            document.getElementById("ctl00_mainContent_txtEmail").focus(); 
           
          }

}

  function closeSignup()
{
    var backdrop = document.getElementById("backdrop");
    backdrop.parentNode.removeChild(backdrop);
    document.getElementById("emailMe").style.display = "none";
}

function SigninBox()
{
        
        var emailMe = document.getElementById("SigninMe");
      
       
        var emailMeMsg = document.getElementById("SigninMeMsg");
        emailMeMsg.style.display = "";
        
        
        
          var myWidth = 0, myHeight = 0;
          if( typeof( window.innerWidth ) == 'number' ) {
            //Non-IE
            myWidth = window.innerWidth;
            myHeight = window.innerHeight;
          } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
            //IE 6+ in 'standards compliant mode'
            myWidth = document.documentElement.clientWidth;
            myHeight = document.documentElement.clientHeight;
          } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
            //IE 4 compatible
            myWidth = document.body.clientWidth;
            myHeight = document.body.clientHeight;
          }
         

        
        var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
 
  
  
        emailMe.style.top = scrOfY + ((myHeight/2)-113)+ "px";
        emailMe.style.left =scrOfX + ((myWidth/2)-190) + "px";

        emailMe.style.display = "";
        
        if (document.getElementById("backdrop1") == null) {
            var backdrop = document.createElement("div");
            backdrop.id = "backdrop1";
            emailMe.parentNode.appendChild(backdrop);
            
            document.getElementById("ctl00_mainContent_txtEmail1").focus(); 
           
          }

}


function LoadBox()
{
        
        var emailMe = document.getElementById("LoadMe");
      
       
        var emailMeMsg = document.getElementById("LoadMeMsg");
        emailMeMsg.style.display = "";
        
        
        
          var myWidth = 0, myHeight = 0;
          if( typeof( window.innerWidth ) == 'number' ) {
            //Non-IE
            myWidth = window.innerWidth;
            myHeight = window.innerHeight;
          } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
            //IE 6+ in 'standards compliant mode'
            myWidth = document.documentElement.clientWidth;
            myHeight = document.documentElement.clientHeight;
          } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
            //IE 4 compatible
            myWidth = document.body.clientWidth;
            myHeight = document.body.clientHeight;
          }
         

        
        var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
 
  
  
        emailMe.style.top = scrOfY + ((myHeight/2)-113)+ "px";
        emailMe.style.left =scrOfX + ((myWidth/2)-190) + "px";

        emailMe.style.display = "";
        
        if (document.getElementById("backdrop4") == null) {
            var backdrop = document.createElement("div");
            backdrop.id = "backdrop4";
            emailMe.parentNode.appendChild(backdrop);
            
            
           
          }

}


  function closeSignin()
{
    var backdrop = document.getElementById("backdrop1");
    backdrop.parentNode.removeChild(backdrop);
    document.getElementById("SigninMe").style.display = "none";
}



function AddBox()
{
        
        var AddMe = document.getElementById("AddMe");
      

       
        var AddMeMsg = document.getElementById("AddMeMsg");
        AddMeMsg.style.display = "";
        
        
        
          var myWidth = 0, myHeight = 0;
          if( typeof( window.innerWidth ) == 'number' ) {
            //Non-IE
            myWidth = window.innerWidth;
            myHeight = window.innerHeight;
          } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
            //IE 6+ in 'standards compliant mode'
            myWidth = document.documentElement.clientWidth;
            myHeight = document.documentElement.clientHeight;
          } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
            //IE 4 compatible
            myWidth = document.body.clientWidth;
            myHeight = document.body.clientHeight;
          }
         

        
        var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
 
  
  
        AddMe.style.top = scrOfY + ((myHeight/2)-113)+ "px";
        AddMe.style.left =scrOfX + ((myWidth/2)-190) + "px";

        AddMe.style.display = "";
        
        if (document.getElementById("backdrop1") == null) {
            var backdrop = document.createElement("div");
            backdrop.id = "backdrop1";
            AddMe.parentNode.appendChild(backdrop);
            
            document.getElementById("ctl00_mainContent_txtAddress").focus(); 
           
          }

}

  function closeAdd()
{
    var backdrop = document.getElementById("backdrop1");
    backdrop.parentNode.removeChild(backdrop);
    document.getElementById("AddMe").style.display = "none";
}


       
function ForgotpasswordBox()
{
        
        var emailMe = document.getElementById("PasswordMe");
      
       
        var emailMeMsg = document.getElementById("PasswordMeMsg");
        emailMeMsg.style.display = "";
        
        
        
          var myWidth = 0, myHeight = 0;
          if( typeof( window.innerWidth ) == 'number' ) {
            //Non-IE
            myWidth = window.innerWidth;
            myHeight = window.innerHeight;
          } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
            //IE 6+ in 'standards compliant mode'
            myWidth = document.documentElement.clientWidth;
            myHeight = document.documentElement.clientHeight;
          } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
            //IE 4 compatible
            myWidth = document.body.clientWidth;
            myHeight = document.body.clientHeight;
          }
         

        
        var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
 
  
  
        emailMe.style.top = scrOfY + ((myHeight/2)-113)+ "px";
        emailMe.style.left =scrOfX + ((myWidth/2)-190) + "px";

        emailMe.style.display = "";
        
        if (document.getElementById("backdrop2") == null) {
            var backdrop = document.createElement("div");
            backdrop.id = "backdrop2";
            emailMe.parentNode.appendChild(backdrop);
            
            document.getElementById("ctl00_mainContent_txtEmail2").focus(); 
           
          }

}

  function closeForgotpasswordBox()
{
    var backdrop = document.getElementById("backdrop2");
    backdrop.parentNode.removeChild(backdrop);
    document.getElementById("PasswordMe").style.display = "none";
}

function ForgotpasswordBox1()
{


        
        var emailMe = document.getElementById("PasswordMe1");
      
       
        var emailMeMsg = document.getElementById("PasswordMeMsg1");
        emailMeMsg.style.display = "";
        
        
        
          var myWidth = 0, myHeight = 0;
          if( typeof( window.innerWidth ) == 'number' ) {
            //Non-IE
            myWidth = window.innerWidth;
            myHeight = window.innerHeight;
          } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
            //IE 6+ in 'standards compliant mode'
            myWidth = document.documentElement.clientWidth;
            myHeight = document.documentElement.clientHeight;
          } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
            //IE 4 compatible
            myWidth = document.body.clientWidth;
            myHeight = document.body.clientHeight;
          }
         

        
        var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
 
  
  
        emailMe.style.top = scrOfY + ((myHeight/2)-113)+ "px";
        emailMe.style.left =scrOfX + ((myWidth/2)-190) + "px";

        emailMe.style.display = "";
        
        if (document.getElementById("backdrop3") == null) {
            var backdrop = document.createElement("div");
            backdrop.id = "backdrop3";
            emailMe.parentNode.appendChild(backdrop);
            
             
           
          }

}

  function closeForgotpasswordBox1()
{
    var backdrop = document.getElementById("backdrop3");
    backdrop.parentNode.removeChild(backdrop);
    document.getElementById("PasswordMe1").style.display = "none";
}
       
       function toggleHeader(ctl,id,id1)
       {
          
           var pan=document.getElementById(id);
           
           if(pan.style.display == 'none')
           {
            pan.style.display = 'inline';
           
           }
           else
           {
             pan.style.display = 'none';
           } 
           
           toggleCategorySort(ctl,'',id1);
       }
       function doubleDigit(num)
       {
          var retNum=num;
          if(num<=9)
          {
            retNum='0' + num;
          }
          return retNum; 
       }
       
       function CheckAllCat(pid)
       {
          var mid='';
          var id;
          var pCount=document.getElementById('ctl00_mainContent_hdPCount').value;
          var cCount;
          var flag;
                  
          for(oLoop=0;oLoop<=pCount-1;oLoop++)
          {
            id='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_hdPID';
            
            if(document.getElementById(id).value==pid)
            {
            
                flag=document.getElementById('ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_hdFlagID').value;
                if(flag=='1')
                {
                  document.getElementById('ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_hdFlagID').value='0';
                  document.getElementById('ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_lnkOnly').innerHTML='Check All';
                }
                else if(flag=='0')
                {
                  document.getElementById('ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_hdFlagID').value='1';
                  document.getElementById('ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_lnkOnly').innerHTML='Remove All';
                    
                }
                id='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_hdCCount';
                cCount=document.getElementById(id).value;
                for(iLoop=0;iLoop<=cCount-1;iLoop++)
                {
                   
                    if(flag=='1') //mark it uncheck 
                    {
                      
                        id='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_rptChildItems_ctl' + doubleDigit(iLoop) + '_chkCategory'
                        document.getElementById(id).checked=false;
                        id='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_rptChildItems_ctl' + doubleDigit(iLoop) + '_hdMID'
                        var m_id=document.getElementById(id).value;
                        id='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_rptChildItems_ctl' + doubleDigit(iLoop) + '_hdFeedMID'
                        var fm_id=document.getElementById(id).value;
                        var val=m_id + ',' + fm_id; 
                          var splitRemove=val.split(',');
                          for(i = 0; i < splitRemove.length; i++)
                          { 
                            document.getElementById('ctl00_mainContent_hdIDs').value = FilterIDs(document.getElementById('ctl00_mainContent_hdIDs').value, splitRemove[i]);     
                          }        
                    }
                    else if(flag=='0') //mark it check
                    {
                       id='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_rptChildItems_ctl' + doubleDigit(iLoop) + '_chkCategory'
                       document.getElementById(id).checked=true;
                       id='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_rptChildItems_ctl' + doubleDigit(iLoop) + '_hdMID'
                       if(document.getElementById(id).value!='')
                       {
                         mid=mid+document.getElementById(id).value + ',';
                       }
                       id='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_rptChildItems_ctl' + doubleDigit(iLoop) + '_hdFeedMID'
                       if(document.getElementById(id).value!='')
                       {
                         mid=mid+document.getElementById(id).value + ',';
                       }
                    }
           
               } 
            }
          
          }
          
                    if(flag=='0') //mark it check 
                    {
                        document.getElementById('ctl00_mainContent_hdIDs').value=document.getElementById('ctl00_mainContent_hdIDs').value + "," + mid;
                        //alert(document.getElementById('ctl00_mainContent_hdIDs').value);
                    }
                    else if(flag=='1')
                    {
                        //alert(document.getElementById('ctl00_mainContent_hdIDs').value);
                    }
       }
     
     
       function CheckAllCity(pid)
       {
          var mid='';
          var id;
          var pCount=document.getElementById('ctl00_mainContent_hdPCount').value;
          var cCount;
          var flag;
                  
          for(oLoop=0;oLoop<=pCount-1;oLoop++)
          {
            id='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_hdPID';
            
            if(document.getElementById(id).value==pid)
            {
            
                flag=document.getElementById('ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_hdFlagID').value;
                if(flag=='1')
                {
                  document.getElementById('ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_hdFlagID').value='0';
                  document.getElementById('ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_lnkOnly').innerHTML='Check All';
                }
                else if(flag=='0')
                {
                  document.getElementById('ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_hdFlagID').value='1';
                  document.getElementById('ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_lnkOnly').innerHTML='Remove All';
                    
                }
                id='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_hdCCount';
                cCount=document.getElementById(id).value;
                for(iLoop=0;iLoop<=cCount-1;iLoop++)
                {
                   
                    if(flag=='1') //mark it uncheck 
                    {
                      
                        id='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_rptChildItems_ctl' + doubleDigit(iLoop) + '_chkCity'
                        document.getElementById(id).checked=false;
                        id='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_rptChildItems_ctl' + doubleDigit(iLoop) + '_hdCID'
                        var m_id=document.getElementById(id).value;
                       
                        var val=m_id;  
                          var splitRemove=val.split(',');
                          for(i = 0; i < splitRemove.length; i++)
                          { 
                            document.getElementById('ctl00_mainContent_hdIDs').value = FilterIDs(document.getElementById('ctl00_mainContent_hdIDs').value, splitRemove[i]);     
                          }        
                    }
                    else if(flag=='0') //mark it check
                    {
                       id='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_rptChildItems_ctl' + doubleDigit(iLoop) + '_chkCity'
                       document.getElementById(id).checked=true;
                       id='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_rptChildItems_ctl' + doubleDigit(iLoop) + '_hdCID'
                       if(document.getElementById(id).value!='')
                       {
                         mid=mid+document.getElementById(id).value + ',';
                       }
                       
                    }
           
               } 
            }
          
          }
          
                    if(flag=='0') //mark it check 
                    {
                        document.getElementById('ctl00_mainContent_hdIDs').value=document.getElementById('ctl00_mainContent_hdIDs').value + "," + mid;
                        //alert(document.getElementById('ctl00_mainContent_hdIDs').value);
                    }
                    else if(flag=='1')
                    {
                        //alert(document.getElementById('ctl00_mainContent_hdIDs').value);
                    }
       }
       
       
       function CategoryDisplayItem()
       {
       
          var ids=document.getElementById('ctl00_mainContent_hdIDs').value; 
          var split = ids.split(',');
          for(i = 0; i < split.length; i++)
          {
            Mark('chkCategory',split[i],'hdMID');
          }
       }
       
       function CitiesDisplayItem(ids)
       {
          var ids=document.getElementById('ctl00_mainContent_hdIDs').value; 
          var split = ids.split(',');
          for(i = 0; i < split.length; i++)
          {
            Mark('chkCity',split[i],'hdCID');
          }
       }
       
       function Mark(ctlid,id,hid)
       {
          var id1;
          var pCount=document.getElementById('ctl00_mainContent_hdPCount').value;
          var cCount;
          for(oLoop=0;oLoop<=pCount-1;oLoop++)
          {
            id1='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_hdCCount';
            cCount=document.getElementById(id1).value;
            for(iLoop=0;iLoop<=cCount-1;iLoop++)
            {
               
               id1='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_rptChildItems_ctl' + doubleDigit(iLoop) + '_' + hid;
               
               if(document.getElementById(id1).value==id)
               {
                
                id1='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_rptChildItems_ctl' + doubleDigit(iLoop) + '_' + ctlid;
                document.getElementById(id1).checked=true;
               }
//               else
//               {
//                id1='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_rptChildItems_ctl' + doubleDigit(iLoop) + '_' + ctlid;
//                document.getElementById(id1).checked=false;
//               }
            } 
          }
          
          //document.getElementById('ctl00_mainContent_hdIDs').value=mid;
       }
       
       function CheckAll()
       {
          var mid;
          var id;
          var pCount=document.getElementById('ctl00_mainContent_hdPCount').value;
          var cCount;
          for(oLoop=0;oLoop<=pCount-1;oLoop++)
          {
            id='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_hdCCount';
            cCount=document.getElementById(id).value;
            for(iLoop=0;iLoop<=cCount-1;iLoop++)
            {
               id='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_rptChildItems_ctl' + doubleDigit(iLoop) + '_chkCategory'
               document.getElementById(id).checked=true;
               id='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_rptChildItems_ctl' + doubleDigit(iLoop) + '_hdMID'
               if(document.getElementById(id).value!='')
               {
                 mid=mid+document.getElementById(id).value + ',';
               }
               id='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_rptChildItems_ctl' + doubleDigit(iLoop) + '_hdFeedMID'
               if(document.getElementById(id).value!='')
               {
                 mid=mid+document.getElementById(id).value + ',';
               }
            } 
          }
          
          document.getElementById('ctl00_mainContent_hdIDs').value=mid;
       }
       
       function UnCheckAll()
       {
          var id;
          var pCount=document.getElementById('ctl00_mainContent_hdPCount').value;
          var cCount;
          for(oLoop=0;oLoop<=pCount-1;oLoop++)
          {
            id='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_hdCCount';
            cCount=document.getElementById(id).value;
            for(iLoop=0;iLoop<=cCount-1;iLoop++)
            {
               id='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_rptChildItems_ctl' + doubleDigit(iLoop) + '_chkCategory'
               document.getElementById(id).checked=false;
            } 
          }
          document.getElementById('ctl00_mainContent_hdIDs').value='';
       }
       function toggleCheck(id)
       {
         UnCheckAll();
         var ctl=document.getElementById(id);
           
         if(ctl.checked==true)
         {
           //ctl.checked =false;
         }
         else
         {
           ctl.checked =true;
         } 
       }
       
       
       
       function CheckAll1()
       {
          var mid;
          var id;
          var pCount=document.getElementById('ctl00_mainContent_hdPCount1').value;
          
          for(oLoop=0;oLoop<=pCount-1;oLoop++)
          {
            
               id='ctl00_mainContent_rptItems1_ctl' + doubleDigit(oLoop) + '_chkSource'
               document.getElementById(id).checked=true;
               id='ctl00_mainContent_rptItems1_ctl' + doubleDigit(oLoop) + '_hdPID1'
               if(document.getElementById(id).value!='')
               {
                 mid=mid+document.getElementById(id).value + ',';
               }
             
          }
          
          document.getElementById('ctl00_mainContent_hdIDs1').value=mid;
       }
       
       
        function UnCheckAll1()
       {
          var id;
          var pCount=document.getElementById('ctl00_mainContent_hdPCount1').value;
          var cCount;
          for(oLoop=0;oLoop<=pCount-1;oLoop++)
          {
            
               id='ctl00_mainContent_rptItems1_ctl' + doubleDigit(oLoop)+ '_chkSource'
               document.getElementById(id).checked=false;
             
          }
          document.getElementById('ctl00_mainContent_hdIDs1').value='';
       }
       function setCount(value,sdc,sc,name)
       {
         
         document.getElementById('ctl00_mainContent_searchCount').innerHTML=value;
         document.getElementById('ctl00_mainContent_sdc').innerHTML=sdc;
         document.getElementById('ctl00_mainContent_sc').innerHTML=sc;
         document.getElementById('ctl00_mainContent_cityhead').innerHTML=name + ' Daily Deals';
       }
       function toggleCheck1(id)
       {
         UnCheckAll1();
         var ctl=document.getElementById(id);
           
         if(ctl.checked==true)
         {
           //ctl.checked =false;
         }
         else
         {
           ctl.checked =true;
         } 
       }
         function CheckOne(catname)
       {
          var id;
          var pCount=document.getElementById('ctl00_mainContent_hdPCount').value;
          var cCount;
          var ctl; 
          for(oLoop=0;oLoop<=pCount-1;oLoop++)
          {
            id='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_hdCCount';
            cCount=document.getElementById(id).value;
            for(iLoop=0;iLoop<=cCount-1;iLoop++)
            {
               id='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_rptChildItems_ctl' + doubleDigit(iLoop) + '_chkCategory';
               id1='ctl00_mainContent_rptItems_ctl' + doubleDigit(oLoop) + '_rptChildItems_ctl' + doubleDigit(iLoop) + '_hdCName';
               
                 ctl= document.getElementById(id1);
                 if(ctl.value==catname)
                 {
                     document.getElementById(id).checked=true;
                 }
                 else
                 {
                     document.getElementById(id).checked=false;
                 }
             } 
          }
          document.getElementById('ctl00_mainContent_hdIDs').value='';
       }
       function FilterCategory(id,nm)
       {
          CheckOne(nm);
          document.getElementById('ctl00_mainContent_hdIDs').value=id;
          document.getElementById('ctl00_mainContent_lnkFilterCategory').click();
       }
      
       function CheckMeZipcode(ctl,val)
       {
          
          var pCount=document.getElementById('ctl00_mainContent_hdZipCodeCount').value;
         
          for(oLoop=0;oLoop<=pCount-1;oLoop++)
          {
            id='ctl00_mainContent_rptAddress_ctl' + doubleDigit(oLoop) + '_chkAddress';
            
            ctl1= document.getElementById(id);
           
            ctl1.checked =false;
          }
         
          ctl.checked=true;
           
          document.getElementById('ctl00_mainContent_hdZipIDs').value= val;
           
          document.getElementById('ctl00_mainContent_lnkZipchk').click();
       }
      
       function CheckMe(ctl,val)
       {
          
          if(ctl.checked==true)
          {
           
            document.getElementById('ctl00_mainContent_hdIDs').value=document.getElementById('ctl00_mainContent_hdIDs').value + val + ',';
          }
          else
          {
              
              var split = val.split(',');
              for(i = 0; i < split.length; i++)
              {
                document.getElementById('ctl00_mainContent_hdIDs').value = FilterIDs(document.getElementById('ctl00_mainContent_hdIDs').value, split[i]);
              }
           
          }
          document.getElementById('ctl00_mainContent_lnkChk').click();
       }
       
       function DeleteAddress(val)
       {
         document.getElementById('ctl00_mainContent_hdIDValue').value=val; //Address ID
         return confirm("Are you sure you want to delete this address?");
       }
       function EditAddress(add,zip,nick,op,val)
       {
        document.getElementById("ctl00_mainContent_txtAddress").value=add;
       document.getElementById("ctl00_mainContent_txtZipcode").value=zip;
       document.getElementById("ctl00_mainContent_txtNickname").value=nick;
         document.getElementById('ctl00_mainContent_hdOperation').value=op;
         document.getElementById('ctl00_mainContent_hdIDValue').value=val; //Address ID
         AddBox();
       }
       function AddAddress(op,val)
       {
         document.getElementById("ctl00_mainContent_txtAddress").value='';
       document.getElementById("ctl00_mainContent_txtZipcode").value='';
       document.getElementById("ctl00_mainContent_txtNickname").value='';
         document.getElementById('ctl00_mainContent_hdOperation').value=op;
         document.getElementById('ctl00_mainContent_hdIDValue').value=val; //City ID
         
         AddBox();
       }
     
       function CheckMeCity(ctl,val)
       {
          
          if(ctl.checked==true)
          {
           
            document.getElementById('ctl00_mainContent_hdIDs').value=document.getElementById('ctl00_mainContent_hdIDs').value + val + ',';
          }
          else
          {
              
              var split = val.split(',');
              for(i = 0; i < split.length; i++)
              {
                document.getElementById('ctl00_mainContent_hdIDs').value = FilterIDs(document.getElementById('ctl00_mainContent_hdIDs').value, split[i]);
              }
           
          }
          document.getElementById('ctl00_mainContent_lnkChk').click();
       }
     
       
       function CheckMe1(ctl,val)
       {
          
          if(ctl.checked==true)
          {
           
            document.getElementById('ctl00_mainContent_hdIDs1').value=document.getElementById('ctl00_mainContent_hdIDs1').value + val + ',';
          }
          else
          {
           document.getElementById('ctl00_mainContent_hdIDs1').value = FilterIDs(document.getElementById('ctl00_mainContent_hdIDs1').value, val.toString());
          }
          document.getElementById('ctl00_mainContent_lnkChk1').click();
       }
       
       function FilterIDs(strId, strRemove)
       {
          var split = strId.split(',');
           var strReturn='';
           for(j = 0; j < split.length; j++)
           {
             
              if(split[j] == strRemove || split[j] == '')
              {
              }
              else
              {
                strReturn = strReturn + split[j] + ',';
              }
            }
            
            return strReturn;
       }
       
       function FilterIDsEx(strId, strRemove)
       {
          var split = strId.split(',');
           var strReturn='';
            var splitRemove=strRemove.split(',');
              for(i = 0; i < splitRemove.length; i++)
              {  
                   for(j = 0; j < split.length; j++)
                   {
                     
                          if(split[j] == splitRemove[i] || split[j] == '')
                          {
                          }
                          else
                          {
                            strReturn = strReturn + split[j] + ',';
                          }
                        
                    }
            }
            return strReturn;
       }
             
       function toggleCategorySort(ctl,caption,id)
       {
       
         ctl1=document.getElementById(id);
         if(ctl.title=='Open')
         {
           ctl1.innerHTML = '<span class="arrow-up" style="padding:0px;font-weight:bold;font-size:20px;color:#7193CA;"> &nbsp; </span>';
           
           ctl.title='Close';
         }
         else if(ctl.title=='Close')
         {
           ctl1.innerHTML = '<span class="arrow-down" style="padding:0px;font-weight:bold;font-size:20px;color:#7193CA;"> &nbsp; </span>';
           ctl.title='Open';
         }
       }
       
       function toggleSort(ctl,caption,id)
       {
         
         ctl1=document.getElementById(id);
         if(ctl.title=='Asc')
         {
          if(id=='ltTimeLeft')
          {
          ctl1.innerHTML = '<span class="sort-down" style="font-weight:bold;font-size:18px;color:#7193CA;"> &nbsp; </span>&nbsp;';
          }
          else{
          
           ctl1.innerHTML = '<span class="sort-down" style="font-weight:bold;font-size:18px;color:#7193CA;"> &nbsp; </span>';
          } 
           ctl.title='Desc';
         }
         else if(ctl.title=='Desc')
         {
           if(id=='ltTimeLeft')
           {
           ctl1.innerHTML = '<span class="sort-up" style="font-weight:bold;font-size:18px;color:#7193CA;"> &nbsp; </span>&nbsp;';
           }
           else
           {
           ctl1.innerHTML = '<span class="sort-up" style="font-weight:bold;font-size:18px;color:#7193CA;"> &nbsp; </span>';
           }
           ctl.title='Asc';
         }
         
         if(id=='ltNew')
         {
            document.getElementById('ltPrice').innerHTML='<span style="width:48px;font-weight:bold;font-size:18px;color:#7193CA;"> &nbsp; </span>';
            document.getElementById('ltDiscount').innerHTML='<span style="width:48px;font-weight:bold;font-size:18px;color:#7193CA;"> &nbsp; </span>';
            document.getElementById('ltTimeLeft').innerHTML='<span style="width:48px;font-weight:bold;font-size:18px;color:#7193CA;"> &nbsp; </span>&nbsp;';
         }
         else if(id=='ltPrice')
         {
            document.getElementById('ltNew').innerHTML='<span style="width:48px;font-weight:bold;font-size:18px;color:#7193CA;"> &nbsp; </span>';
            document.getElementById('ltDiscount').innerHTML='<span style="width:48px;font-weight:bold;font-size:18px;color:#7193CA;"> &nbsp; </span>';
            document.getElementById('ltTimeLeft').innerHTML='<span style="width:48px;font-weight:bold;font-size:18px;color:#7193CA;"> &nbsp; </span>&nbsp;';
         }
         else if(id=='ltDiscount')
         {
            document.getElementById('ltNew').innerHTML='<span style="width:48px;font-weight:bold;font-size:18px;color:#7193CA;"> &nbsp; </span>';
            document.getElementById('ltPrice').innerHTML='<span style="width:48px;font-weight:bold;font-size:18px;color:#7193CA;"> &nbsp; </span>';
            document.getElementById('ltTimeLeft').innerHTML='<span style="width:48px;font-weight:bold;font-size:18px;color:#7193CA;"> &nbsp; </span>&nbsp;';
         }
         else if(id=='ltTimeLeft')
         {
            document.getElementById('ltNew').innerHTML='<span style="width:48px;font-weight:bold;font-size:18px;color:#7193CA;"> &nbsp; </span>';
            document.getElementById('ltPrice').innerHTML='<span style="width:48px;font-weight:bold;font-size:18px;color:#7193CA;"> &nbsp; </span>';
            document.getElementById('ltDiscount').innerHTML='<span style="width:48px;font-weight:bold;font-size:18px;color:#7193CA;"> &nbsp; </span>';
            
         }
       }
       
         function loginUser()
         {
               var uid=document.getElementById('ctl00_mainContent_txtEmail1').value;
               var pass=document.getElementById('ctl00_mainContent_txtPassword1').value;
               document.getElementById('ctl00_mainContent_lblErr').innerHTML='';
               document.getElementById('imgload').style.display='inline';
               PageMethods.LoginUser(uid,pass,callSuccBind1,callFailBind1);
         
         }
         function VerifySignup()
         {
             var patt1 = /\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/i;
             document.getElementById('r0').innerHTML='';
             document.getElementById('r1').innerHTML='';
             document.getElementById('r2').innerHTML='';
             document.getElementById('r3').innerHTML='';
             var uid=document.getElementById('ctl00_mainContent_txtEmail').value;
             
             if(uid=='sample@email.com' || uid=='')
             {
               document.getElementById('r0').innerHTML='Please input valid email address.';
               return;
             }
            else
            {
                if(uid.match(patt1)==null)
                {
                 document.getElementById('r0').innerHTML='Please input valid email address.';
                return;
                }
                               
                document.getElementById('ctl00_mainContent_lblError2').innerHTML='';
                
            }
            
           if( document.getElementById("ctl00_mainContent_txtPassword").value=='')
           {
             document.getElementById('r1').innerHTML='Please enter password.';
             return;
           }
           else
           {
             document.getElementById('ctl00_mainContent_lblError2').innerHTML='';
           }
         
            if( document.getElementById("ctl00_mainContent_txtPasswordAgain").value=='')
           {
             document.getElementById('r2').innerHTML='Please enter a password again.';
             return;
           }
           else
           {
             document.getElementById('ctl00_mainContent_lblError2').innerHTML='';
           }
         
           if( document.getElementById("ctl00_mainContent_txtPassword").value==document.getElementById("ctl00_mainContent_txtPasswordAgain").value)
           {
             document.getElementById('imgload1').style.display='inline';
             document.getElementById('ctl00_mainContent_lblError2').innerHTML='';
             var uid=document.getElementById('ctl00_mainContent_txtEmail').value;
             
             if(uid=='sample@email.com' || uid=='')
             {
               document.getElementById('imgload1').style.display='none';
               document.getElementById('ctl00_mainContent_lblError2').innerHTML='Please input valid email address.';
               return;
             }
             PageMethods.PageValidateForm(uid,callSuccBind2,callFailBind2);
           } 
           else
           {
             document.getElementById('ctl00_mainContent_lblError2').innerHTML='';
             document.getElementById('r3').innerHTML='Passwords don\'t match.';
           }
           
           
          
         }
         var uuid='';
          function VerifyForgotPassword()
         {
           
           
             document.getElementById('imgload3').style.display='inline';
             document.getElementById('ctl00_mainContent_lblError3').innerHTML='';
             var uid=document.getElementById('ctl00_mainContent_txtEmail2').value;
             
             if(uid=='sample@email.com' || uid=='')
             {
               document.getElementById('imgload3').style.display='none';
               document.getElementById('ctl00_mainContent_lblError3').innerHTML='Please input valid email address.';
               return;
             }
             uuid=uid;
             PageMethods.ForgotPassValidateForm(uid,callSuccBind3,callFailBind3);
         
            
         }
         function callSuccBind3(result, context, methodname) 
         {
          
           if(result!=null)
           {
           
              //var split = result.split('|');
              if(result.toString()=="1")
              {
                document.getElementById('imgload3').style.display='none';
                document.getElementById('ctl00_mainContent_lblError3').innerHTML='Oops, this email does not exist. <a href="javascript:;" onclick="javascript:clearMsg1();closeForgotpasswordBox();SignupBox();"> Click here</a> to signup.';
                    
              }
              else if(result.toString()=="0")
              {
                
                  PageMethods.ForgotPassEmailSent(uuid,callSuccBind4,callFailBind3);
                 //document.getElementById('ctl00_mainContent_btnPost').click();
              }
           }
           
         }
         
         function callSuccBind4(result, context, methodname) 
         {
           if(result!=null)
           {
             document.getElementById('imgload3').style.display='none';
             if(result.toString()=="1")//success
              {
                closeForgotpasswordBox();
                ForgotpasswordBox1();
              }
              else if(result.toString()=="0")//failure
              {
                alert('Email does not send due to some error.');
              }  
           }
         }
        
         function clearMsg()
         {
           document.getElementById('ctl00_mainContent_lblError2').innerHTML='';
         }
         function clearMsg1()
         {
           document.getElementById('ctl00_mainContent_lblError3').innerHTML='';
         }
          function callSuccBind2(result, context, methodname) 
         {
          
           if(result!=null)
           {
           
              //var split = result.split('|');
              if(result.toString()=="1")
              {
                document.getElementById('imgload1').style.display='none';
                document.getElementById('ctl00_mainContent_lblError2').innerHTML='Oops, this email is already signed up. <a href="javascript:;" onclick="javascript:clearMsg();closeSignup();SigninBox();"> Click here</a> to login.';
                    
              }
              else if(result.toString()=="0")
              {
                  document.getElementById('imgload1').style.display='none';
                 document.getElementById('ctl00_mainContent_btnPost').click();
              }
           }
           
         }
         
         function callSuccBind1(result, context, methodname) 
         {
          
           if(result!=null)
           {
              var split = result.split('|');
              if(split[0].toString()=="0")
              {
                document.getElementById('ctl00_mainContent_lblErr').innerHTML='';
               
                window.location.href = '/account/categories';
                
              }
              else  if(split[0].toString()=="2")
              {
                document.getElementById('ctl00_mainContent_lblErr').innerHTML='';
               
                window.location.href = '/changepassword';
                
              }
             
              else if(split[0].toString()=="1")
              {
                document.getElementById('ctl00_mainContent_lblErr').innerHTML='The email and/or password you entered aren\'t correct.';
                document.getElementById('imgload').style.display='none';    
              }
           }
           
         }
        
        function callFailBind1(result, context, methodname) 
         {
            document.getElementById('imgload').style.display='none';
           alert(result.get_message());
       }
       function callFailBind2(result, context, methodname) 
         {
            document.getElementById('imgload1').style.display='none';
           alert(result.get_message());
       }
       function callFailBind3(result, context, methodname) 
         {
            document.getElementById('imgload3').style.display='none';
           alert(result.get_message());
       }
       function getSoldQty(city,flag,cid,dealid,sqty)
         {
         
               PageMethods.GetSoldQuantity(city,flag,cid,dealid,sqty,callSuccBind,callFailBind);
         
         }
         function callSuccBind(result, context, methodname) 
         {
          
           if(result!=null)
           {
           
               var split = result.split('|');
               
      
               document.getElementById(split[1]).innerHTML=split[0];
               
           }
         }
         function callFailBind(result, context, methodname) 
         {
   //        alert(result.get_message());
       }
   
