﻿// JScript File

var XmlHttpGainer;
var XmlHttpAdvancesDeclines;
var XmlHttpLoser;
var XmlHttpGainerLoser;
var XmlHttpCommentry;
var XmlHttpVolumeValue;
var XmlHttpOutUnder;

//Creating object of XMLHTTP For AJAX Method
function CreateGainerXmlHttpNew()
	{
		//Creating object of XMLHTTP in IE
		try
		{
			XmlHttpGainer = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpGainer = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpGainer = null;	
			}
		}
		//Creating object of XMLHTTP in Mozilla and Safari 
		if(!XmlHttpGainer && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpGainer = new XMLHttpRequest();
		}
	}
	
	
	function CreateCommentryXmlHttpNew()
	{
		//Creating object of XMLHTTP in IE
		try
		{
			XmlHttpCommentry = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpCommentry = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpCommentry = null;	
			}
		}
		//Creating object of XMLHTTP in Mozilla and Safari 
		if(!XmlHttpCommentry && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpCommentry = new XMLHttpRequest();
		}
	}
	
	
function GetGainers()
{

CreateGainerXmlHttpNew();

var Group,Index;
var SelectedOption = document.getElementById("Gainers1_ddlGroup").options[document.getElementById("Gainers1_ddlGroup").selectedIndex].text;
var Period=document.getElementById("Dd_Type").value;

if(SelectedOption.indexOf("Group") >= 0)
{
Group = document.getElementById("Gainers1_ddlGroup").value;
Index = "";
}
else
{
Index = document.getElementById("Gainers1_ddlGroup").value;
Group = "";
}

document.getElementById("GainerTD").innerHTML ="<img src=../App_Themes/CommonTheme/Images/ajax-loader.gif>";
var requestUrl="AjaxGainerLosers.aspx?&Option=GAIN&Group="+Group+"&Index="+Index+"&Type="+Period;
//alert(requestUrl);

if(XmlHttpGainer)
	{
		//alert(requestUrl);
		XmlHttpGainer.onreadystatechange=function(){GetGainersMakeup();};
		XmlHttpGainer.open("GET",requestUrl,true);
		XmlHttpGainer.send(null);
	}
   	  
  
}

function GetGainersMakeup()
{

			
	if(XmlHttpGainer.readyState==4)
	{
	
		if(XmlHttpGainer.status == 200)
		{
		//alert(XmlHttpGainer.responseText);
		document.getElementById("GainerTD").innerHTML=XmlHttpGainer.responseText;
		
		}
	
	
	}
	
}





//Creating object of XMLHTTP For AJAX Method
function CreateLoserXmlHttpNew()
	{
		//Creating object of XMLHTTP in IE
		try
		{
			XmlHttpLoser = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpLoser = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpLoser = null;	
			}
		}
		//Creating object of XMLHTTP in Mozilla and Safari 
		if(!XmlHttpLoser && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpLoser = new XMLHttpRequest();
		}
	}
	
	
function GetLosers()
{

CreateLoserXmlHttpNew();

var Group,Index;
var SelectedOption = document.getElementById("Losers1_ddlGroup").options[document.getElementById("Losers1_ddlGroup").selectedIndex].text;
var PeriodL=document.getElementById("Dd_TypeL").value;
if(SelectedOption.indexOf("Group") >= 0)
{
Group = document.getElementById("Losers1_ddlGroup").value;
Index = "";
}
else
{
Index = document.getElementById("Losers1_ddlGroup").value;
Group = "";
}

document.getElementById("LoserTD").innerHTML ="<img src=../App_Themes/CommonTheme/Images/ajax-loader.gif>";
var requestUrl="AjaxGainerLosers.aspx?&Option=LOSE&Group="+Group+"&Index="+Index+"&Type="+PeriodL;
//alert(requestUrl);

if(XmlHttpLoser)
	{
		
		XmlHttpLoser.onreadystatechange=function(){GetLoserMakeup();};
		XmlHttpLoser.open("GET",requestUrl,true);
		XmlHttpLoser.send(null);
	}
   	  
  
}

function GetLoserMakeup()
{

			
	if(XmlHttpLoser.readyState==4)
	{
	
		if(XmlHttpLoser.status == 200)
		{
		//alert(XmlHttpLoser.responseText);
		document.getElementById("LoserTD").innerHTML=XmlHttpLoser.responseText;
		
		}
	
	
	}
	
}





function GetCommentry(Opt,secid,subsecid)
{
//alert();
//for(var i=1;i<=3;i++)
//{
//var TD = document.getElementById("TD"+i);

//if(i== Opt)
//{
//TD.className = "tabOn-innernew";
//}
//else
//{
//TD.className = "tabOFFF";
//}

//}

    var TrPre = document.getElementById("trPre");
    var TrMid = document.getElementById("trMid");
    var TrEnd = document.getElementById("trEnd");
    
    if(Opt == 1)
    {
        TrPre.style.display="inline" ;
        TrMid.style.display="none" ;
        TrEnd.style.display="none" ;
    }
    if(Opt == 2)
    {
        TrPre.style.display="none" ;
        TrMid.style.display="inline" ;
        TrEnd.style.display="none" ;
    }
    if(Opt == 3)
    {
        TrPre.style.display="none" ;
        TrMid.style.display="none" ;
        TrEnd.style.display="inline" ;
    }

 CreateCommentryXmlHttpNew();
 
 var requestUrl="AjaxCommentry.aspx?secid="+secid+"&subsecid="+subsecid;


	if(XmlHttpCommentry)
	{
		//alert(requestUrl);
		XmlHttpCommentry.onreadystatechange=function(){GetCommentryMakeUp();};
		XmlHttpCommentry.open("GET",requestUrl,true);
		XmlHttpCommentry.send(null);
	}

}


function GetCommentryMakeUp()
{

			
	if(XmlHttpCommentry.readyState==4)
	{
	
		if(XmlHttpCommentry.status == 200)
		{
		//alert(XmlHttpCommentry.responseText);
		document.getElementById("TDCommentry").innerHTML=XmlHttpCommentry.responseText;
		
		}
	
	
	}
	
}

    
 function MM_openWindow(theURL,winName,features)
 { 
  NewWin = window.open(theURL,winName,features);
  NewWin.focus();
  return (false);
 }





function CreateGainerLosersXmlHttpNew()
	{
		//Creating object of XMLHTTP in IE
		try
		{
			XmlHttpGainerLoser = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpGainerLoser = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpGainerLoser = null;	
			}
		}
		//Creating object of XMLHTTP in Mozilla and Safari 
		if(!XmlHttpGainerLoser && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpGainerLoser = new XMLHttpRequest();
		}
	}
	
	
	
	
	
function GetGainersLosers()
{

CreateGainerLosersXmlHttpNew();

var Group,Index,Option;
var SelectedOption = document.getElementById("GainersLosers1_ddlGroup").options[document.getElementById("GainersLosers1_ddlGroup").selectedIndex].text;
var Period=document.getElementById("Dd_TypeGL").value;
Option=document.getElementById("GainersLosers1_HdnOption").value;

if(SelectedOption.indexOf("Group") >= 0)
{
Group = document.getElementById("GainersLosers1_ddlGroup").value;
Index = "";
}
else
{
Index = document.getElementById("GainersLosers1_ddlGroup").value;
Group = "";
}
//alert(Option);
document.getElementById("GainerLosersTD").innerHTML ="<img src=../App_Themes/CommonTheme/Images/ajax-loader.gif>";
var requestUrl="AjaxGainerLosers.aspx?&Option="+Option+"&Group="+Group+"&Index="+Index+"&Type="+Period;
//alert(requestUrl);

if(XmlHttpGainerLoser)
	{
		//alert(requestUrl);
		XmlHttpGainerLoser.onreadystatechange=function(){GetGainersLosersMakeup();};
		XmlHttpGainerLoser.open("GET",requestUrl,true);
		XmlHttpGainerLoser.send(null);
	}
   	  
  
}

function GetGainersLosersMakeup()
{

			
	if(XmlHttpGainerLoser.readyState==4)
	{
	
		if(XmlHttpGainerLoser.status == 200)
		{
		//alert(XmlHttpGainer.responseText);
		document.getElementById("GainerLosersTD").innerHTML=XmlHttpGainerLoser.responseText;
		
		}
	
	
	}
	
}


//function SetOption(Option)
//{
////alert("SetOption");
//if(Option.toLowerCase() =="lose")
//{
////alert("Lose");
//document.getElementById("GainersLosers1_HdnOption").value = "LOSE";
//document.getElementById("TDGain").className = "tabOFFF";
//document.getElementById("TDLose").className = "tabOn-inn";
//}
//else
//{
////alert("Gain");
//document.getElementById("GainersLosers1_HdnOption").value = "GAIN";
//document.getElementById("TDGain").className = "tabOn-inn";
//document.getElementById("TDLose").className = "tabOFFF";
//}
//GetGainersLosers();
//}


function changeTab(Option)
{

    var TblGain= document.getElementById("tblGain");
    var TblLoss=  document.getElementById("tblLoss");
    var TblOut=  document.getElementById("tblOut");
    var TblUnder=  document.getElementById("tblUnder");
    var TblVolume=  document.getElementById("tblVolume");
    var TblValue=  document.getElementById("tblValue");
    
    if(Option.toLowerCase() =="lose")
    {
        document.getElementById("GainersLosers1_HdnOption").value = "LOSE";
        TblGain.style.display='none';
        TblLoss.style.display='inline';
        GetGainersLosers();
    }
    if(Option.toLowerCase() =="gain")
    {
        document.getElementById("GainersLosers1_HdnOption").value = "GAIN";
        TblGain.style.display='inline';
        TblLoss.style.display='none';
        GetGainersLosers();
    }
    if(Option.toLowerCase() == "out")
    {
        document.getElementById("OutUnderCtrl1_HdnOption").value = "O";
        TblOut.style.display='inline';
        TblUnder.style.display='none';
        GetOutUnderPerformers();
    }
    if(Option.toLowerCase() == "under")
    {
        document.getElementById("OutUnderCtrl1_HdnOption").value = "U";
        TblOut.style.display='none';
        TblUnder.style.display='inline';
        GetOutUnderPerformers();
    }
    if(Option.toLowerCase() =="value")
    {
        document.getElementById("VolumeValue1_HdnOption").value = "Value";
        TblVolume.style.display='none';
        TblValue.style.display='inline';
        GetVolumeValue();
    }
    if(Option.toLowerCase() == "volume")
    {
        document.getElementById("VolumeValue1_HdnOption").value = "Volume";
        TblVolume.style.display='inline';
        TblValue.style.display='none';
        GetVolumeValue();
    }
}



function CreateVolumeValueXmlHttpNew()
	{
		//Creating object of XMLHTTP in IE
		try
		{
			XmlHttpVolumeValue = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpVolumeValue = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpVolumeValue = null;	
			}
		}
		//Creating object of XMLHTTP in Mozilla and Safari 
		if(!XmlHttpVolumeValue && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpVolumeValue = new XMLHttpRequest();
		}
	}
	
	
	
	
	
function GetVolumeValue()
{

CreateVolumeValueXmlHttpNew();


var Group,Index,Option;
var SelectedOption = document.getElementById("VolumeValue1_ddlGroup").options[document.getElementById("VolumeValue1_ddlGroup").selectedIndex].text;
Option=document.getElementById("VolumeValue1_HdnOption").value;
//alert(SelectedOption);

if(SelectedOption.indexOf("Group") >= 0)
{
Group = document.getElementById("VolumeValue1_ddlGroup").value;
Index = "";
}
else
{
Index = document.getElementById("VolumeValue1_ddlGroup").value;
Group = "";
}
//alert(Option);
document.getElementById("VolumeValueTD").innerHTML ="<img src=../App_Themes/CommonTheme/Images/ajax-loader.gif>";
var requestUrl="AjaxVolumeValue.aspx?&Option="+Option+"&Group="+Group+"&Index="+Index;
//alert(requestUrl);

if(XmlHttpVolumeValue)
	{
		//alert(requestUrl);
		XmlHttpVolumeValue.onreadystatechange=function(){GetVolumevalueMakeup();};
		XmlHttpVolumeValue.open("GET",requestUrl,true);
		XmlHttpVolumeValue.send(null);
	}
   	  
  
}

function GetVolumevalueMakeup()
{

			
	if(XmlHttpVolumeValue.readyState==4)
	{
	
		if(XmlHttpVolumeValue.status == 200)
		{
		//alert(XmlHttpGainer.responseText);
		document.getElementById("VolumeValueTD").innerHTML=XmlHttpVolumeValue.responseText;
		
		}
	
	
	}
	
}

function SetVolumeValueOption(Option)
{


if(Option.toLowerCase() =="value")
{
document.getElementById("VolumeValue1_HdnOption").value = "Value";
document.getElementById("TDVolume").className = "tabOFFF";
document.getElementById("TDValue").className = "tabOn-inn";
}
else
{
document.getElementById("VolumeValue1_HdnOption").value = "Volume";
document.getElementById("TDVolume").className = "tabOn-inn";
document.getElementById("TDValue").className = "tabOFFF";
}
GetVolumeValue();

}



function CreateAdvanceDeclinneXmlHttpNew()
	{
		//Creating object of XMLHTTP in IE
		try
		{
			XmlHttpAdvancesDeclines = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpAdvancesDeclines = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpAdvancesDeclines = null;	
			}
		}
		//Creating object of XMLHTTP in Mozilla and Safari 
		if(!XmlHttpAdvancesDeclines && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpAdvancesDeclines = new XMLHttpRequest();
		}
	}
	
	
	
	
	
function GetAdvancesDeclines()
{

CreateAdvanceDeclinneXmlHttpNew();


var Group,Index,Option;
var SelectedOption = document.getElementById("AdvanceDecline1_ddlGroup").options[document.getElementById("AdvanceDecline1_ddlGroup").selectedIndex].text;
Option=document.getElementById("AdvanceDecline1_HdnOption").value;

if(SelectedOption.indexOf("Group") >= 0)
{
Group = document.getElementById("AdvanceDecline1_ddlGroup").value;
Index = "";
}
else
{
Index = document.getElementById("AdvanceDecline1_ddlGroup").value;
Group = "";
}
//alert(Option);
document.getElementById("AdvanceDeclineTD").innerHTML ="<img src=../App_Themes/CommonTheme/Images/ajax-loader.gif>";
var requestUrl="AjaxAdvanceDecline.aspx?&Option="+Option+"&Group="+Group+"&Index="+Index;
//alert(requestUrl);

if(XmlHttpAdvancesDeclines)
	{
		//alert(requestUrl);
		XmlHttpAdvancesDeclines.onreadystatechange=function(){GetAdvancesDeclinesMakeup();};
		XmlHttpAdvancesDeclines.open("GET",requestUrl,true);
		XmlHttpAdvancesDeclines.send(null);
	}
   	  
  
}

function GetAdvancesDeclinesMakeup()
{

			
	if(XmlHttpAdvancesDeclines.readyState==4)
	{
	
		if(XmlHttpAdvancesDeclines.status == 200)
		{
		//alert(XmlHttpGainer.responseText);
		document.getElementById("AdvanceDeclineTD").innerHTML=XmlHttpAdvancesDeclines.responseText;
		
		}
	
	
	}
	
}

function SetAdvanceDeclineOption(Option)
{


if(Option.toLowerCase() =="advance")
{
document.getElementById("AdvanceDecline1_HdnOption").value = "Advance";
document.getElementById("TDDecline").className = "tabOFFF";
document.getElementById("TDAdvance").className = "tabOn-inn";
}
else
{
document.getElementById("AdvanceDecline1_HdnOption").value = "Decline";
document.getElementById("TDDecline").className = "tabOn-inn";
document.getElementById("TDAdvance").className = "tabOFFF";
}
GetAdvancesDeclines();

}






function CreateOutUnderPerformersXmlHttpNew()
	{
		//Creating object of XMLHTTP in IE
		try
		{
			XmlHttpOutUnder = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpOutUnder = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpOutUnder = null;	
			}
		}
		//Creating object of XMLHTTP in Mozilla and Safari 
		if(!XmlHttpOutUnder && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpOutUnder = new XMLHttpRequest();
		}
	}
	
	
	
	
	
function GetOutUnderPerformers()
{

CreateOutUnderPerformersXmlHttpNew();


var Index,Option;
var SelectedOption = document.getElementById("OutUnderCtrl1_ddlGroup").options[document.getElementById("OutUnderCtrl1_ddlGroup").selectedIndex].text;
Option=document.getElementById("OutUnderCtrl1_HdnOption").value;
var Period=document.getElementById("Dd_TypeOU").value;


Index = document.getElementById("OutUnderCtrl1_ddlGroup").value;

//alert(Option);
document.getElementById("OutUnderTD").innerHTML ="<img src=../App_Themes/CommonTheme/Images/ajax-loader.gif>";
var requestUrl="AjaxOutUnderPerformers.aspx?&Option="+Option+"&Type="+Period+"&Index="+Index;
//alert(requestUrl);

if(XmlHttpOutUnder)
	{
		//alert(requestUrl);
		XmlHttpOutUnder.onreadystatechange=function(){GetOutUnderMakeup();};
		XmlHttpOutUnder.open("GET",requestUrl,true);
		XmlHttpOutUnder.send(null);
	}
   	  
  
}

function GetOutUnderMakeup()
{

			
	if(XmlHttpOutUnder.readyState==4)
	{
	
		if(XmlHttpOutUnder.status == 200)
		{
		//alert(XmlHttpGainer.responseText);
		document.getElementById("OutUnderTD").innerHTML=XmlHttpOutUnder.responseText;
		
		}
	
	
	}
	
}

//function SetOutUnderPerformers(Option)
//{


//if(Option.toLowerCase() == "out")
//{
//document.getElementById("OutUnderCtrl1_HdnOption").value = "O";
//document.getElementById("TDUnder").className = "tabOFFF";
//document.getElementById("TDOut").className = "tabOn-inn";
//}
//else
//{
//document.getElementById("OutUnderCtrl1_HdnOption").value = "U";
//document.getElementById("TDUnder").className = "tabOn-inn";
//document.getElementById("TDOut").className = "tabOFFF";
//}

//GetOutUnderPerformers();

//}








