
//for new high and new low in Equity home page
function HighLow(val)
{  	
	if(val =="H")
	{
		document.getElementById("td_high").style.display = "inline";
		document.getElementById("td_low").style.display = "none";				
	}
	else
	{
		document.getElementById("td_high").style.display = "none";
		document.getElementById("td_low").style.display = "inline";				
	}
}

//for Volume and Value in Equity Home Page
function EquityVolVal(opt)
{
	
	if(opt=="Vol")
	{
		document.getElementById("td_bseVol").style.display = "inline";
		document.getElementById("td_bseVal").style.display = "none";		
	}
	else
	{
		document.getElementById("td_bseVal").style.display = "inline";
		document.getElementById("td_bseVol").style.display = "none";	
	}
	
}

// Functions for showing and hiding divs

 var tempX = 0;
 var tempY = 0;
 var m_show = 0;
 var f_sc_id = "";
 var f_sc_dispid = "";
 var f_sc_comp = "";
 var f_topic_id = 0;
 var f_buy_id =0;

 //setInterval("hide_popup1()",1000);
 
 var IE = document.all?true:false
 
 if (!IE) document.captureEvents(Event.MOUSEMOVE)
 document.onmousemove = getMouseXY;
 
 function getMouseXY(e) 
 {
 	if(IE)
 	{
 	    tempX = event.clientX + document.body.scrollLeft;
 		tempY = event.clientY + document.body.scrollTop;
 	}
 	else
 	{
 		tempX = e.pageX;
 	    tempY = e.pageY;
 	}
 	return true;
 }
 
 function show_popup1(m_im_id, m_im_shortdesc, m_im_desc, m_ff_desc, m_ff_id, m_fundclass)
 { 
 	f_im_id = m_im_id;
 	f_im_shortdesc = m_im_shortdesc;
 	f_im_desc = m_im_desc;
 	f_ff_desc = m_ff_desc;
 	f_ff_id = m_ff_id;
 	f_fundclass = m_fundclass;

 	//document.getElementById("head1").innerHTML = " Company Profile " ;
 	document.getElementById("popup").style.left = tempX + "px";
 	document.getElementById("popup").style.top = tempY + "px";
 	document.getElementById("popup").style.visibility = "visible";
 	m_show = 1;
 }
 
 function hide_popup1()
 {
 	if(m_show == 0)
 	{
 		document.getElementById("popup").style.visibility = "hidden";
 	}
 }
 //Corporateinfo/CompSearch.aspx?id=BSR1&
 // smart quotes/buy/ sell/company snapshot/compan/ news/financial summary/chartin
 var m_urls = Array('../Corporateinfo/CompSearch.aspx?id=GQR1','../Corporateinfo/CompSearch.aspx?id=BSR1','../Corporateinfo/CompSearch.aspx?id=RES1','../Corporateinfo/CompSearch.aspx?id=SPR1','../Company_Info/ScripSearch.aspx?id=33','../profile/FinanceSummary.aspx?mno=4&index=0&id=16','../Technical_Research/Adv_Decline.aspx');

 function id_click(m_id)
 {
 	//alert(m_urls[m_id-1] + "+" + f_im_id + "+" + f_im_desc + "+" + f_ff_desc + "+" + f_ff_id + "+" + f_fundclass);
 	//return false;

 	if(m_id == 1)
 		window.location = m_urls[m_id-1] +"&cocode=" + f_im_id;
 	else if(m_id == 2) 	    
 	    window.location = m_urls[m_id-1] +"&cocode=" + f_im_id;
 	else if(m_id == 3)
 		window.location = m_urls[m_id-1] +"&cocode=" + f_im_id;
 	else if(m_id == 4)
 		window.location = m_urls[m_id-1] +"&cocode=" + f_im_id;
 	else if(m_id == 5)
 		window.location = m_urls[m_id-1] +"&cocode=" + f_im_id;
	else if(m_id == 6)
 		window.location = m_urls[m_id-1] +"&cocode=" + f_im_id;	
	else if(m_id == 7)
 		window.location = m_urls[m_id-1] +"?id=9&cocode=" + f_im_id;
	else if(m_id == 8)
 		window.location = m_urls[m_id-1] +"&code=" + f_im_id;
	else if(m_id == 9)
 		window.location = m_urls[m_id-1] +"&code=" + f_im_id;
	else if(m_id == 10)
 		//window.location = m_urls[m_id-1] +"&code=" + f_im_id;	
 		window.location = m_urls[m_id-1];
 	else
 		window.location = m_urls[m_id-1] + f_im_id;
  	
 }

 //This is for bulletin
 function ShowA2Z(redUrl_,Index){
 	var A2ZIndexId = document.getElementById("A2ZTd");
	if(A2ZIndexId.innerHTML==""){
		var A2Z="";A2ZClass ="";
			for(i=65; i<=90; i++)
				
				{
				var Alpha = String.fromCharCode(i);
				A2ZClass = (Index==Alpha) ? "IndexLinkSel" : "IndexLink";
				A2Z += "<a href='"+redUrl_+"&Index="+ Alpha +"' class="+ A2ZClass+ ">"+ Alpha +"</a>";
			}
			A2ZClass = (Index=="0-9") ? "IndexLinkSel" : "IndexLink";	
			A2ZIndexId.innerHTML = A2Z + "<a href='"+redUrl_+"&Index=0-9' class="+ A2ZClass +">0-9</a>";
	}
	else
		A2ZIndexId.innerHTML = "";			
}

// function for MF Snapshot Chart
function showSnapChart(code,period)
{
	var period;
	var periodVal = period.substr(0,1);
	var period = period.substr(1,1)
	document.getElementById("SnapChart").src= "mfchart.aspx?sch="+ code +"&Period="+ period +"&periodval="+periodVal;
}

function showAssetChart(code,opt)
{
	var opt;
	document.getElementById("AssetChart").src= "AssetChart.aspx?sch="+ code +"&opt="+opt;
	//document.getElementById("SectorChart").src= "Sector_Chart.aspx?sch="+ code +"&opt="+opt;
}

//For Top Value/Volume
function ChangeTab(val,EXCHG,Group)
{
	
	if(val=="Value")
	{
	    window.location="MarketInnerPage.aspx?id=3&Type=T&Option=VAL&EXCHG="+EXCHG+"&Group="+Group+"&PageType=Value";
		//document.getElementById("Value").style.display="inline";
		//document.getElementById("Volume").style.display="none";
		//document.getElementById("ValTab").style.display="inline";
		//document.getElementById("VolTab").style.display="none";
	}
	else
	{
	    window.location="MarketInnerPage.aspx?id=3&Type=T&Option=VOL&EXCHG="+EXCHG+"&Group="+Group+"&PageType=Volume";
		//document.getElementById("Volume").style.display="inline";
		//document.getElementById("Value").style.display="none";
	    //document.getElementById("VolTab").style.display="inline";
		//document.getElementById("ValTab").style.display="none";
	}
	
}


//Clock


	var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
	var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
		function getthedate()
			{
				var mydate=new Date()
				var year=mydate.getYear()
				if (year < 1000)
					year+=1900
					var day=mydate.getDay()
					var month=mydate.getMonth()
					var daym=mydate.getDate()
				if (daym<10)
					daym="0"+daym
					var hours=mydate.getHours()
					var minutes=mydate.getMinutes()
					var seconds=mydate.getSeconds()
					var dn="AM"
				if (hours>=12)
					dn="PM"
				if (hours>12)
					{
					hours=hours-12
					}
				if (hours==0)
					hours=12
				if (minutes<=9)
					minutes="0"+minutes
				if (seconds<=9)
					seconds="0"+seconds
				//change font size here
				var cdate=""+hours+":"+minutes+":"+seconds+" "+dn   //"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+"
				
				if 
					(document.all)
					document.all.clock.innerHTML=cdate
				else if 
					(document.getElementById)
					document.getElementById("clock").innerHTML=cdate
				else
					document.write(cdate)
			}
				if 
					(!document.all&&!document.getElementById)
					getthedate()
			function goforit()
				{
					if(document.all||document.getElementById)
					setInterval("getthedate()",1000)
				}
function TelCheck(evt) {
    if (evt.keyCode > 31 && (evt.keyCode < 43 || evt.keyCode > 57)) 
	{
        return false;
    }
}
function Validate()
{   
	 
	var str1=document.getElementById("TxtEmail1").value
	var filter2=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
	 
	if(document.getElementById("TxtName1").value=="")
	{
	 alert("Please Fill Name");
	 document.getElementById("TxtName1").focus();
	 return false;
	}
	 
	if(document.getElementById("TxtEmail1").value=="")
	{
	alert("Please Fill Email Id");
	document.getElementById("TxtEmail1").focus();
	return false;
	}
	if (!filter2.test(str1))
	{  
	 alert("Invalid E-mail Address! Please re-enter.");
	 document.getElementById("TxtEmail1").focus();
	 return (false);
	} 
	if(document.getElementById("TxtCity1").value=="")
	{
	alert("Please Fill City Name");
	document.getElementById("TxtCity1").focus();
	return false;
	}
	
	if(document.getElementById("TxtNo1").value=="")
	{
	alert("Please Fill Contact No");
	document.getElementById("TxtNo1").focus();
	return false;
	}

	Online.action="../PostMail.aspx";
	Online.submit();
	return true;
}


//For Loading Data for Home page Popup in Platinum
	function HomePopup()
	{	
		var NewsWin = document.getElementById("cm_windowPopup").style.display='inline';		
		
	}

function EventKeyPress(e,id)
{
{
		if(e.keyCode==13)	
		{
			//var Scripid = document.getElementById(id);
			var boolval = SearchPage();
			if(boolval)
			return true;
			else
			return false;
		}
	}
}


