// JavaScript Document



var xmlHttpImag;
var DivIdForImag;



//fb login/reg

function GetStatusbyfbid(fbid,type)
    {   
   
      var url="AjaxRating1.aspx?Type="+type+"&id="+ fbid ; 
      //alert(url);
      xmlHttp=GetXmlHttpObject(stateChanged);
      xmlHttp.open("POST", url , true);
      xmlHttp.send(null);
    } 

 function AddFbUserHome(conentid,type)
    {     
  
      var url="AjaxRating1.aspx?Type="+type+"&id="+ conentid ;      
      xmlHttp=GetXmlHttpObject(stateChanged);
      xmlHttp.open("POST", url , true);
      xmlHttp.send(null);
    } 
   function AddFbUser(conentid,type)
    {     
  
      var url="../AjaxRating1.aspx?Type="+type+"&id="+ conentid ;     
      xmlHttp=GetXmlHttpObject(stateChanged);
      xmlHttp.open("POST", url , true);
      xmlHttp.send(null);
    } 
    
     function AddFbUserSocial(conentid,type)
    {     
  
      var url="../AjaxRating.aspx?Type="+type+"&id="+ conentid ;     
      xmlHttp=GetXmlHttpObject(stateChanged);
      xmlHttp.open("POST", url , true);
      xmlHttp.send(null);
    } 
    

    function AddTheme(userid,theme)
    {     
  
      var url="../AjaxRating.aspx?Type=theme"+"&id="+ userid + "&theme=" + theme ;     
      xmlHttp=GetXmlHttpObject(stateChanged);
      xmlHttp.open("POST", url , true);
      xmlHttp.send(null);
    } 
    
    
function FBlogout()
{
    var url="../AjaxRating.aspx?Type=Logout";     
      xmlHttp=GetXmlHttpObject(stateChanged);
      xmlHttp.open("POST", url , true);
      xmlHttp.send(null);
}

function FBlogoutHome()
{

    var url="AjaxRating.aspx?Type=Logout";     
      xmlHttp=GetXmlHttpObject(stateChanged);
      xmlHttp.open("POST", url , true);
      xmlHttp.send(null);
}


//change pass
function Passwdchange(type,oladpass,newpass)
    {     
    
      var url="../AjaxRating.aspx?Type="+type+"&Rate="+oladpass+"&newpass="+newpass+"&id=0" ;     
      xmlHttp=GetXmlHttpObject(stateChanged);
      xmlHttp.open("POST", url , true);
      xmlHttp.send(null);
    } 


// add to favourite
    
    function AddToFavorites(conentid,type)
    {     
    
      var url="../AjaxRating.aspx?Type="+type+"&Rate=1&id="+ conentid ;     
      xmlHttp=GetXmlHttpObject(stateChanged);
      xmlHttp.open("POST", url , true);
      xmlHttp.send(null);
    } 
    
    // content comment post
    
     function ContentCommentPost(conentid,Comments,type)
    {    
     
       var url="../AjaxRating.aspx?Type="+type+"&Rate="+Comments+"&id="+ conentid ;     
      xmlHttp=GetXmlHttpObject(stateChanged);
      xmlHttp.open("POST", url , true);
      xmlHttp.send(null);
    } 
    
    
    // article like page
  
   function ArticleLike(conentid,type)
  { 
  
  var url="../AjaxRating.aspx?Type="+type+"&Rate=1&id="+ conentid ;  
  xmlHttp=GetXmlHttpObject(stateChanged);
  xmlHttp.open("POST", url , true);
  xmlHttp.send(null);
  } 

//script to close div
function closeMe (id)
 {   
   	document.getElementById(id).style.left="-9999px";
 }
// clicking on FAQ Keyword 

 function GetFaq(id,categoryid)
  {  
 
  //$('#faqpopup1').show().jScrollPane().show();
//  $('#scrollBlock').jScrollPane();
  document.getElementById(id).style.left="0";
  var url="../meetgurus/GetFaqData.aspx?CategoryId=" + categoryid ;
  xmlHttp=GetXmlHttpObject(stateChanged);
  xmlHttp.open("POST", url , true);
  xmlHttp.send(null);
  } 
  
  // Video page ratings 
  
   function UserRating(videoid,Ratedval)
  { 
  
  var url="../AjaxRating.aspx?Type=Video&Rate="+Ratedval+"&id="+ videoid ;
  xmlHttp=GetXmlHttpObject(stateChanged);
  xmlHttp.open("POST", url , true);
  xmlHttp.send(null);
  } 
  

  
  
  // trends rating
  
   function TrendsRating(Articleid,Ratedval)
  { 
  
  var url="../AjaxRating.aspx?Type=Trends&Rate="+Ratedval+"&id="+ Articleid ;
  xmlHttp=GetXmlHttpObject(stateChanged);
  xmlHttp.open("POST", url , true);
  xmlHttp.send(null);
  } 
  
  
  
  
  
  //Fact Listing Rate
  
  
    function FactRating(Articleid,Ratedval)
  { 
  
  var url="../AjaxRating.aspx?Type=FactFile&Rate="+Ratedval+"&id="+ Articleid ;
  xmlHttp=GetXmlHttpObject(stateChanged);
  xmlHttp.open("POST", url , true);
  xmlHttp.send(null);
  } 
  
  // expert search rate
  
   function ExpertSearchRating(Expertid,Ratedval)
  {   
  var url="../AjaxRating.aspx?Type=Expert&Rate="+Ratedval+"&id="+ Expertid ;
  xmlHttp=GetXmlHttpObject(stateChanged);
  xmlHttp.open("POST", url , true);
  xmlHttp.send(null);
  } 
    
  // Video tracking
  
    function VideoTrack(videoid)
    {
       var url="../AjaxRating.aspx?Type=VideoTrack&Rate=0&id="+ videoid ;
      xmlHttp=GetXmlHttpObject(stateChanged);
      xmlHttp.open("POST", url , true);
      xmlHttp.send(null);
    } 
    
    
    //
    
    function Usrlogin(email,pass)
    {
   
      var url="AjaxRating.aspx?Type=UsrLogin&id=0&Rate="+email+"&pass="+ pass ;
      xmlHttp=GetXmlHttpObject(stateChanged);
      xmlHttp.open("POST", url , true);
      xmlHttp.send(null);
    }
    
      function Usrlogininner(email,pass)
    {
   
      var url="../AjaxRating.aspx?Type=UsrLoginInner&id=0&Rate="+email+"&pass="+ pass ;
      xmlHttp=GetXmlHttpObject(stateChanged);
      xmlHttp.open("POST", url , true);
      xmlHttp.send(null);
    }
    
    function AddFbUser(conentid,type)
    {     
  
      var url="../AjaxRating.aspx?Type="+type+"&id="+ conentid ;     
      xmlHttp=GetXmlHttpObject(stateChanged);
      xmlHttp.open("POST", url , true);
      xmlHttp.send(null);
    } 
    
    
      function UsrlogininnerNew(email,pass,pgnm)
    {
  
      var url="../AjaxRating.aspx?Type=UsrLoginInnerNew&id=0&Rate="+email+"&pagename="+pgnm+"&pass="+ pass ;     
      xmlHttp=GetXmlHttpObject(stateChanged);
      xmlHttp.open("POST", url , true);
      xmlHttp.send(null);
    }
    
    function AddFbUserNew(conentid,type,pgnm)
    {     
  
      var url="../AjaxRating.aspx?Type="+type+"&pagename="+pgnm+"&id="+ conentid ;     
      xmlHttp=GetXmlHttpObject(stateChanged);
      xmlHttp.open("POST", url , true);
      xmlHttp.send(null);
    } 
    
  
 
  function stateChanged() 
  { 
   
      if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
      {
      
                
      if((xmlHttp.responseText.length>100) || (xmlHttp.responseText.length==0))
      {
          if(document.getElementById('faqpopup1'))
          {
          document.getElementById('faqpopup1').innerHTML=xmlHttp.responseText;
          xmlHttp.responseText=="";
          }    
       
      }
      
      
      
      else if(xmlHttp.responseText=="Index1.aspx") 
      {
         window.location.href="Index1.aspx";
      }
      
       else if(xmlHttp.responseText=="../Index1.aspx") 
      {
         window.location.href="../Index1.aspx";
      }
      
        else if((xmlHttp.responseText=="Logged out."))

            {
                // no resonse to display for tracker
            }
      
       
      //password change message
      
      else if((xmlHttp.responseText=="Your password changed successfully.") ||(xmlHttp.responseText=="Your old password is invalid."))
      {
         document.getElementById('infomsg').innerHTML=xmlHttp.responseText;
      }
      else if((xmlHttp.responseText=="Your Rating posted successfully."))
      {
      
      if(document.getElementById('infomsg1'))
         document.getElementById('infomsg1').innerHTML= parseInt(document.getElementById('infomsg1').innerHTML)+1;
         
         if(document.getElementById('infomsg2'))
         document.getElementById('infomsg2').innerHTML= parseInt(document.getElementById('infomsg2').innerHTML)+1;
         
         if(document.getElementById('infomsg3'))
         document.getElementById('infomsg3').innerHTML= parseInt(document.getElementById('infomsg3').innerHTML)+1;
         
          if(document.getElementById('infomsg4'))
         document.getElementById('infomsg4').innerHTML= parseInt(document.getElementById('infomsg4').innerHTML)+1;
              
      
      
        if(document.getElementById('ctl00_ContentPlaceHolder1_DataList2_ctl00_infomsg'))
        {
        document.getElementById('ctl00_ContentPlaceHolder1_DataList2_ctl00_infomsg').innerHTML= parseInt(document.getElementById('ctl00_ContentPlaceHolder1_DataList2_ctl00_infomsg').innerHTML)+1;
        }
        else
        {      
         document.getElementById('ctl00_ContentPlaceHolder1_infomsg').innerHTML= parseInt(document.getElementById('ctl00_ContentPlaceHolder1_infomsg').innerHTML)+1;
         }
           alert(xmlHttp.responseText);
      }
      
     
      
      else if(xmlHttp.responseText=="Invalid UserName or Password.") 
      {
         document.getElementById('infomsg').innerHTML=xmlHttp.responseText;ctl00_infomsg        
      }
       else if(xmlHttp.responseText=="Invalid UserName or Password") 
      {        
         document.getElementById('ctl00_infomsg').innerHTML=xmlHttp.responseText;
      }
      
    
      
      
       else if(xmlHttp.responseText=="MyProfile/MyProfile.aspx") 
      {
         window.location.href="MyProfile/MyProfile.aspx";
      }
     
       else if(xmlHttp.responseText=="../MyProfile/MyProfile.aspx") 
      {
         window.location.href="../MyProfile/MyProfile.aspx";
      }
      
        else if(xmlHttp.responseText=="../MyProfile/MyProfileFinal.aspx") 
      {
         window.location.href="../MyProfile/MyProfileFinal.aspx";
      }
      
         else if(xmlHttp.responseText=="MyProfile/MyProfileFinal.aspx") 
      {
         window.location.href="MyProfile/MyProfileFinal.aspx";
      }
      
      else if(xmlHttp.responseText=="MyProfileFinal.aspx") 
      {
         window.location.href="MyProfileFinal.aspx";
      }
       else if(xmlHttp.responseText=="MyProfile.aspx") 
      {
         window.location.href="MyProfile.aspx";
      }
      
      else if(xmlHttp.responseText.substr(xmlHttp.responseText.lastIndexOf('.'),5)==".aspx") 
      {
       window.location.href=xmlHttp.responseText;
      }
      
      else
      {
          
            alert(xmlHttp.responseText);
           // alert(xmlHttp.responseText.substr(xmlHttp.responseText.lastIndexOf('.'),5));
    
            if(xmlHttp.responseText=="Please Login.")
            {
                //alert("Please Register/Login to Rate.");
               // callModal();
            }
            else if(xmlHttp.responseText=="Video Tracked")
            {
                // no resonse to display for tracker
            }
           
            else
            { 
                var msg = xmlHttp.responseText;
                
              //document.getElementById('errormsg').innerHTML=null;
              //document.getElementById('errormsg').innerHTML=xmlHttp.responseText;      
              xmlHttp.responseText=="";
            }
           //$('#scrollBlock').jScrollPane({animateTo:true, animateInterval:50, animateStep:5, showArrows:false});          
       
      }
//          if(xmlHttp.responseText.contains("video|"))
//          {
//          document.getElementById('lblFav').innerHTML=xmlHttp.responseText;
//          }
//          else
//          {
//          document.getElementById('faqpopup1').innerHTML=xmlHttp.responseText;
//          }
      }
  } 
  
  function GetXmlHttpObject(handler)
  { 
  var objXmlHttp=null
  if (navigator.userAgent.indexOf("MSIE")>=0)
  { 
  var strName="Msxml2.XMLHTTP"
  if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
  {
  strName="Microsoft.XMLHTTP"
  } 
  try
  { 
  objXmlHttp=new ActiveXObject(strName)
  objXmlHttp.onreadystatechange=handler 
  return objXmlHttp
  } 
  catch(e)
  { 
  alert("Error. Scripting for ActiveX might be disabled") 
  return 
  } 
  } 
  if (navigator.userAgent.indexOf("Mozilla")>=0)
  {
  objXmlHttp=new XMLHttpRequest()
  objXmlHttp.onload=handler
  objXmlHttp.onerror=handler 
  return objXmlHttp
  }
  } 
  
  








