// JavaScript Document



var xmlHttpImag;
var DivIdForImag;

//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="../Experts/GetFaqData.aspx?CategoryId=" + categoryid ;
  xmlHttp=GetXmlHttpObject(stateChanged);
  xmlHttp.open("POST", url , true);
  xmlHttp.send(null);
  } 
  
  // Video page ratings 
  
   function UserRating(videoid,Ratedval)
  { 
  
  var url="../Experts/AjaxRating.aspx?Type=Video&Rate="+Ratedval+"&id="+ videoid ;
  xmlHttp=GetXmlHttpObject(stateChanged);
  xmlHttp.open("POST", url , true);
  xmlHttp.send(null);
  } 
  
// article listing page rate
  
   function ArticleRating(Articleid,Ratedval)
  { 
  
  var url="../Experts/AjaxRating.aspx?Type=Article&Rate="+Ratedval+"&id="+ Articleid ;
  xmlHttp=GetXmlHttpObject(stateChanged);
  xmlHttp.open("POST", url , true);
  xmlHttp.send(null);
  } 
  
  
  // trends rating
  
   function TrendsRating(Articleid,Ratedval)
  { 
  
  var url="../Experts/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="../Experts/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="../Experts/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="../Experts/AjaxRating.aspx?Type=VideoTrack&Rate=0&id="+ videoid ;
      xmlHttp=GetXmlHttpObject(stateChanged);
      xmlHttp.open("POST", url , true);
      xmlHttp.send(null);
    } 
    
    // add to fav video
    
    function AddToFavorites(videoid)
    { 
      var url="../Experts/AjaxRating.aspx?Type=VideoFav&Rate=0&id="+ videoid ;
      xmlHttp=GetXmlHttpObject(stateChanged);
      xmlHttp.open("POST", url , true);
      xmlHttp.send(null);
    } 
    
    // content comment post
    
     function ContentCommentPost(Comments)
    {    
     
       var url="../User/Experts/AjaxRating.aspx?Type=ContentComment&Rate=0&id="+ Comments ;
      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))
      {
      document.getElementById('faqpopup1').innerHTML=null;
      document.getElementById('faqpopup1').innerHTML=xmlHttp.responseText;
      xmlHttp.responseText=="";
       $('#scrollBlock').jScrollPane({animateTo:true, animateInterval:50, animateStep:5, showArrows:true});
       
      }
      else
      {
            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;
                alert(msg);    
              //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
  }
  } 
  
  







