﻿var MDAjaxApiPath = strSiteRoot + "market/defaultapi.aspx";

function MDAjaxApi()
{
    this.GetGraph = MDAjaxApi.GetGraph;
    this.GetStockMovements = MDAjaxApi.GetStockMovements;
    this.GetWorldIndices = MDAjaxApi.GetWorldIndices;
    this.GetMarketMovements = MDAjaxApi.GetMarketMovements;
    this.GetIndexes = MDAjaxApi.GetIndexes;
    this.GetNews = MDAjaxApi.GetNews;
    this.GetIPOs = MDAjaxApi.GetIPOs;
    //21.may/2010
    this.GetIntermediateData = MDAjaxApi.GetIntermediateData;
    this.GetCompanyDetails = MDAjaxApi.GetCompanyDetails;
    
     this.GetIndexGraph = MDAjaxApi.GetIndexGraph;
     this.FetchContributors = MDAjaxApi.FetchContributors;
     this.GetGainerSector = MDAjaxApi.GetGainerSector;
     this.GetGainerStock = MDAjaxApi.GetGainerStock;
     this.GetMarketMap = MDAjaxApi.GetMarketMap;
     this.GetLoserStock = MDAjaxApi.GetLoserStock;
     this.GetLoserSector = MDAjaxApi.GetLoserSector;
     this.GetGlobalIndices = MDAjaxApi.GetGlobalIndices;
     this.GetMostActiveStock = MDAjaxApi.GetMostActiveStock;
     this.GetResearchReports = MDAjaxApi.GetResearchReports;
     this.GetStrategyReports = MDAjaxApi.GetStrategyReports;
     this.GetHeatMap = MDAjaxApi.GetHeatMap;
     this.GetCircuitBreaker = MDAjaxApi.GetCircuitBreaker;
     this.GetSectorHeatMap = MDAjaxApi.GetSectorHeatMap;
     //By Amit Rathod - 29 Dec 2011
     this.ValidateEWCode = MDAjaxApi.ValidateEWCode;
};
MDAjaxApi.GetGraph = function(res, strExchange)
{
    var MDCon = new edel_communication();
    var inputparam = "f=getgraph&e="+strExchange;
    MDCon.send_request(res,MDAjaxApiPath, "POST", null, inputparam);
};
MDAjaxApi.GetStockMovements = function(res,strType, strExchange,strIndex)
{
    var MDCon = new edel_communication();
    var inputparam = "f=getstockmovements&e="+strExchange + "&t=" + strType + "&i=" + strIndex;
    MDCon.send_request(res,MDAjaxApiPath, "POST", null, inputparam);
};
MDAjaxApi.GetWorldIndices = function(res)
{
    var MDCon = new edel_communication();
    var inputparam = "f=getworldindices";
    MDCon.send_request(res, MDAjaxApiPath, "POST", null, inputparam);
};
MDAjaxApi.GetMarketMovements = function(res,strType, strExchange)
{
    var MDCon = new edel_communication();
    var inputparam = "f=getmarketmovements&e="+strExchange + "&t=" + strType;
    MDCon.send_request(res, MDAjaxApiPath, "POST", null, inputparam);
};
MDAjaxApi.GetIndexes = function(res,strExchange)
{
    var MDCon = new edel_communication();
    var inputparam = "f=getindexes&e="+strExchange;
    MDCon.send_request(res, MDAjaxApiPath, "POST", null, inputparam);
};
MDAjaxApi.GetNews = function(res,strCat)
{
    var MDCon = new edel_communication();
    var inputparam = "f=getnews&c="+strCat;
    MDCon.send_request(res, MDAjaxApiPath, "POST", null, inputparam);
};
MDAjaxApi.GetIPOs = function(res,type)
{
    var MDCon = new edel_communication();
    var inputparam = "f=getipos&t="+type;
    MDCon.send_request(res, MDAjaxApiPath, "POST", null, inputparam);
};

MDAjaxApi.GetIntermediateData = function(res, strSearchText)
{
    var MDCon = new edel_communication();
    var inputparam = "f=getintermediatedata&s="+strSearchText;
    MDCon.send_request(res,MDAjaxApiPath, "POST", null, inputparam);
};
MDAjaxApi.GetCompanyDetails = function(res, strSearchText)
{
    var MDCon = new edel_communication();
    var inputparam = "f=getcompanydetails&s="+strSearchText;
    MDCon.send_request(res,MDAjaxApiPath, "POST", null, inputparam);
};

// 21.Sep.10 - new layout (devlopment)
MDAjaxApi.GetIndexGraph = function(res, strExchange)
{
    var MDCon = new edel_communication();
    var inputparam = "f=getindexgraph&e="+strExchange;
    MDCon.send_request(res,MDAjaxApiPath, "POST", null, inputparam);
};
MDAjaxApi.FetchContributors = function(res, strExchange,strIndex,strType)
{
    var MDCon = new edel_communication();
    var inputparam = "f=showposnegcontributors&e="+strExchange + "&i=" + strIndex +"&t="+ strType ;
    MDCon.send_request(res,MDAjaxApiPath, "POST", null, inputparam);
};

MDAjaxApi.GetGainerSector = function(res, strExchange,strIndex,strDisplayFlag, strPeriod, strGainFlag)
{
    var MDCon = new edel_communication();
    var inputparam = "f=getsector&e="+strExchange + "&i=" + strIndex +"&t="+ strDisplayFlag+"&p="+ strPeriod +"&g="+ strGainFlag;
    MDCon.send_request(res,MDAjaxApiPath, "POST", null, inputparam);
};

MDAjaxApi.GetGainerStock = function(res, strExchange, strIndex, strPeriod, strGainFlag)
{
    var MDCon = new edel_communication();
    var inputparam = "f=getstock&e="+strExchange + "&i=" + strIndex +"&p="+ strPeriod +"&g="+ strGainFlag;
    MDCon.send_request(res,MDAjaxApiPath, "POST", null, inputparam);
};

MDAjaxApi.GetMarketMap = function(res, strExchange)
{
    var MDCon = new edel_communication();
    var inputparam = "f=getmarketmap&e="+strExchange ;
    MDCon.send_request(res,MDAjaxApiPath, "POST", null, inputparam);
};

MDAjaxApi.GetLoserStock = function(res, strExchange,strIndex, strPeriod, strGainFlag)
{
    var MDCon = new edel_communication();
    var inputparam = "f=getstock&e="+strExchange + "&i=" + strIndex +"&p="+ strPeriod +"&g="+ strGainFlag;
    MDCon.send_request(res,MDAjaxApiPath, "POST", null, inputparam);
};

MDAjaxApi.GetLoserSector = function(res, strExchange,strIndex,strDisplayFlag, strPeriod, strGainFlag)
{
    var MDCon = new edel_communication();
    var inputparam = "f=getsector&e="+strExchange + "&i=" + strIndex +"&t="+ strDisplayFlag+"&p="+ strPeriod +"&g="+ strGainFlag;
    MDCon.send_request(res,MDAjaxApiPath, "POST", null, inputparam);
};

MDAjaxApi.GetGlobalIndices = function(res, strMarket, strDisplayFlag,sortColumn, sortType, PageNo, PageSize)
{
    var MDCon = new edel_communication();
    var inputparam = "f=getglobalindices&e="+strMarket + "&t="+ strDisplayFlag +"&c="+sortColumn+ "&d="+ sortType+"&n="+PageNo+ "&s="+PageSize;    
    MDCon.send_request(res,MDAjaxApiPath, "POST", null, inputparam);
};

MDAjaxApi.GetMostActiveStock = function(res, strExchange, strIndex, strPeriod, strFlag)
{
    var MDCon = new edel_communication();
    var inputparam = "f=getmostactivestock&e="+strExchange + "&i=" + strIndex +"&p="+ strPeriod +"&t="+ strFlag;
    MDCon.send_request(res,MDAjaxApiPath, "POST", null, inputparam);
};

MDAjaxApi.GetResearchReports = function(res, strReportType)
{
    var MDCon = new edel_communication();
    var inputparam = "f=getresearchreports&e="+strReportType ;
    MDCon.send_request(res,MDAjaxApiPath, "POST", null, inputparam);
};

MDAjaxApi.GetStrategyReports = function(res, strReportType)
{
    var MDCon = new edel_communication();
    var inputparam = "f=getstrategyreports&e="+strReportType ;
    MDCon.send_request(res,MDAjaxApiPath, "POST", null, inputparam);
};
MDAjaxApi.GetHeatMap = function(res, strExchange, strSector)
{
    var MDCon = new edel_communication();
    var inputparam = "f=getheatmap&e="+strExchange+"&i="+strSector;
    MDCon.send_request(res,MDAjaxApiPath, "POST", null, inputparam);
};

MDAjaxApi.GetCircuitBreaker = function(res, strExchange, strIndex, strPeriod, strCBType)
{
    var MDCon = new edel_communication();
    var inputparam = "f=getcircuitbreaker&e="+strExchange + "&i=" + strIndex +"&p="+ strPeriod +"&g="+ strCBType;
    MDCon.send_request(res,MDAjaxApiPath, "POST", null, inputparam);
};

MDAjaxApi.GetSectorHeatMap = function(res, strExchange)
{
    var MDCon = new edel_communication();
    var inputparam = "f=getsectorheatmap&e="+strExchange;
    MDCon.send_request(res,MDAjaxApiPath, "POST", null, inputparam);
};

MDAjaxApi.ValidateEWCode = function(res, strEWCode)
{
    var MDCon = new edel_communication();
    var inputparam = "f=ValidateEWCode&e="+strEWCode;
    MDCon.send_request(res,MDAjaxApiPath, "POST", null, inputparam);
};
