// for showing active tab
function showactive(tabname)
{
    document.getElementById(tabname).className='activeTab'
}

 function jsBreadCrumb()
    {
        //alert('before')
       // alert(document.getElementById('ctl00_leftmenu_hdBreadCrumb').value);
        document.getElementById('ulbreadcrumb').innerHTML=document.getElementById('ctl00_leftmenu_hdBreadCrumb').value+"<div class=\"clearFloat\">&nbsp;</div>";
        //alert(document.getElementById('ctl00_TagNameLeft_hdBreadCrumb').value);
        //document.getElementById('ulbreadcrumb').innerHTML=document.getElementById('ctl00_TagNameLeft_hdBreadCrumb').value;
        //alert('after')
    }
    
function breadcrumb(str)
{
    var comstr;
//    alert(str);
     comstr="<li><a href=\"QuestionsAnswers.aspx\">home</a></li>";
     comstr= comstr+ "<li><a href='"+str+".aspx'>" + str + "</a></li>";
     //document.getElementById('ulbreadcrumb').innerHTML=comstr+"<div class=\"clearFloat\">&nbsp;</div>";
     document.getElementById('ctl00_leftmenu_hdBreadCrumb').value=comstr;
    // alert( document.getElementById('ctl00_leftmenu_hdBreadCrumb').value);
}


// function to manage internal menues
function ShowHideDiv(divid)
{
    var divObj1 = document.forms[0].getElementsByTagName('h5');      
    for (var i=1; i<divObj1.length;i++)
    { 
          var DivId  = divObj1[i];
          var id=DivId.id;
          if(id!="")
          {
                if(id.substring(0,6)=='htopic')  // hide div
                {
                   var tmpclass='htopic'+divid;
                   //alert(tmpclass)
                   //alert(id)
                   if(id==tmpclass) 
                      document.getElementById(id).className='activeTab'
                   else
                      document.getElementById(id).className=''
                    
                }
          }
    }
    var divObj = document.forms[0].getElementsByTagName('div');      
    for (var i=1; i<divObj.length;i++)
    { 
          var DivId  = divObj[i];
          var id=DivId.id;
          if(id!="")
          {
            if(id.substring(0,11)=='articlesdiv')  // hide div
            {
                var tmp='articlesdiv'+divid
                
               if(id==tmp) 
                    document.getElementById(id).style.display='Block'; 
               else
                    document.getElementById(id).style.display='none';
            }
          }
    }
}

  function showDiv(topic,subtopics)
    {
           var divObj = document.forms[0].getElementsByTagName('li');      
        for (var i=1; i<divObj.length;i++)
        {  
          var DivId  = divObj[i];
          var id=DivId.id;
          if(id!="")
          {
            if(id.substring(0,6)=='tabhea')  // hide div
            {
                 document.getElementById(id).className='deActiveTab';
            }
                document.getElementById(topic).className='activeTab';  
          }
        }        
         // for show hide divs
        var divObj = document.forms[0].getElementsByTagName('div');      
        for (var i=1; i<divObj.length;i++)
        {  
          var DivId  = divObj[i];
          var id=DivId.id;
          if(id!="")
          {
            if(id.substring(0,12)=='tabContainer')  // hide div
                 document.getElementById(id).style.display='none';
            document.getElementById(subtopics).style.display='Block';
          }
         }
    }
    
   
    
    
    
    // email popup function
    function mailIdValidation(sender,value)
     {
    
                    invalidChars = " /:,;"
                   var rtValue = true;
                  
                   if(value.Value.length!=0)
                   { 
                        for (i=0; i<invalidChars.length; i++) 
                        {
                            badChar = invalidChars.charAt(i)
                            if (value.Value.indexOf(badChar,0) > -1) 
                            {
                                value.IsValid = false;
                                rtValue = false;
                                //alert("There are some invalid characters in the \"Email\" field.");
                                //document.getElementById("Messagelbl").innerText="There are some invalid characters in the \"Email\" field.";
                                return ;
                            }
                        }
                    
                        atPos = value.Value.indexOf("@",1)
                    
                        if (atPos == -1)
                        {
                       
                            value.IsValid = false;
                             rtValue = false;
                             //alert("Please enter a value in a correct format in the \"Email\" field.");
                            //document.getElementById("Messagelbl").innerText="Please enter a value in a correct format in the \"Email\" field.";
                            return;
                        }
                        if (value.Value.indexOf("@",atPos+1) > -1)
                        {
                            value.IsValid = false;
                             rtValue = false;
                             //alert("Please enter a value in a correct format in the \"Email\" field.");
                            //document.getElementById("Messagelbl").innerText="Please enter a value in a correct format in the \"Email\" field.";
                            return;
                        }
                        periodPos = value.Value.indexOf(".",atPos)
                        if (periodPos == -1)
                        {
                            value.IsValid = false;
                             rtValue = false;
                             //alert("Please enter a value in a correct format in the \"Email\" field.");
                            //document.getElementById("Messagelbl").innerText="Please enter a value in a correct format in the \"Email\" field.";
                            return;
                        }
                        if (periodPos+3 > value.Value.length)
                        {
                            value.IsValid = false;
                             rtValue = false;
                             
                           return ;
                        }
                    
                     return rtValue;
                  }
                    value.IsValid = true;
    }
function numberValidation(sender,value)
  {
   
    var lwr     =   "1234567890";
    if(value.Value.length!=0)
            {
                for(i=0;i<value.Value.length;i++)
                {
                    if(lwr.indexOf(value.Value.charAt(i))==-1)
                    {
                        value.IsValid = false;
                       
                        return;
                    }
                 }
            }
        value.IsValid = true;
  }

            
                     
function getEmail()
{
           
             document.getElementById('EventDiv').style.left = 250;
             document.getElementById('EventDiv').style.top = 200;
            document.getElementById('EventDiv').style.visibility='visible';
           
            var divObj = document.getElementById('EventDiv');  
            Drag.init(divObj);
            }
           function invisiblediv()
            {
                 document.getElementById('EventDiv').style.visibility='hidden';
            }
            

