﻿var xmlHttp;
function GetXmlHttpObject()
{
    var xmlHttp=null;
    try
      {
          // Firefox, Opera 8.0+, Safari
          xmlHttp=new XMLHttpRequest();
      }
    catch (e)
      {
        // Internet Explorer
          try
           {
              xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
           }
          catch (e)
           {
              xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
      }
      return xmlHttp;
 }

function FunHitIncrease(documentID,moduleName)
{ 
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return false;
    }
//    alert(moduleName);
//    return false;
    var url=""; 
    if(moduleName=="tender")  
        url="/ajax/tenderdochits.ashx?docid=" + documentID + ""; 
    else if(moduleName=="career")
        url="/ajax/careerhits.ashx?docid=" + documentID + "";
    else if(moduleName=="PressReleases")
        url="/ajax/pressreleasehits.ashx?docid=" + documentID + "";
    else if(moduleName=="Resource")
        url="/ajax/resourcehits.ashx?docid=" + documentID + "";
    else
        url="/ajax/ShopBSMChequesHits.ashx?docid=" + documentID + "&module=" + moduleName;
      
    xmlHttp.onreadystatechange=funhitincrse;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function funhitincrse() 
{ 
    if (xmlHttp.readyState==4)
    { 
       
    }
}

function OpenPopup(pageURL, title, w, h) 
{
    var left = (screen.width/2)-(w/2);
    var top = (screen.height/2)-(h/2);
    var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no,width='+w+', height='+h+', top='+top+', left='+left);
    if (window.focus) {targetWin.focus();}
    return false;
}

function OpenPopupHitCount(pageURL, title, w, h, docID, modName) 
{
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return false;
    }        
    var url="/ajax/mediahits.ashx?docid=" + docID + "&module=" + modName + ""; 
    xmlHttp.onreadystatechange=funhitincrse;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
    
    var left = (screen.width/2)-(w/2);
    var top = (screen.height/2)-(h/2);
    var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no,width='+w+', height='+h+', top='+top+', left='+left);
    if (window.focus) {targetWin.focus();}
    return false;
}
