function select_sector(){
	//String sector_id = royal.sector.value;
	//royal.action = "../home/index?p=1004&sector_id=" + royal.sector.value;
	//royal.submit();
		royal.action = "../home/index?p=1004";
	royal.method = "POST";
	royal.submit();
}

function select_trade(){
	//String sector_id = royal.sector.value;
	royal.action = "../home/index?p=1004";
	royal.method = "POST";
	royal.submit();
}

function select_letter(strletter){
	//String sector_id = royal.sector.value;
	//royal.action = "../home/index?p=1004&sector_id=" + royal.sector.value;
	//royal.submit();
	royal.letter.value = strletter;
	royal.action = "../home/index?p=1004";
	royal.method = "POST";
	royal.submit();
}

function timMCK(){
	royal.action = "../home/index?p=1004";
	royal.submit();
}
function timchungkhoan(flag){

	MCK=document.getElementById('statesinput').value;	
	KEY=document.getElementById('price').value;
	if(flag == 1 )
	{
		royal.action = "../home/index?p=1004&id=" + MCK;
		royal.submit();
	}
	else 
	{
		royal.action = "../home/index?p=1068&keysearch=" + KEY;
		royal.submit();
	}

}

function setupCalendar(strInputField, strButton) {
	Calendar.setup({
	  inputField    : strInputField,
	  daFormat 		: "%d/%m/%Y",	  
	  button        : strButton,
	  align         : "Lr"
	});
}
function setupVNCalendar(strInputField, strButton) {
	Calendar.setup({
	  inputField    : strInputField,
	  ifFormat 		: "%d/%m/%Y",
	  daFormat 		: "%d/%m/%Y",	  
	  button        : strButton,
	  align         : "Lr"
	});
}
function login ()
{
		document.royal.action = "../home/index?p=1001";	
      	document.royal.submit();
}

function build_chart(stock,lang)
{
	window.open("../home/Chart/chart/finance.php?TickerSymbol="+stock+"&lang="+lang,'', "scrollbars=yes,resizable=yes");
	
}

function build_chart_menu()
{
	window.open("../home/Chart/chart/finance.php",'', "scrollbars=yes,resizable=yes");
	
}
function CountryChange(cmbCountry,cmbProvince)
{
	
	var objCountry = document.getElementById(cmbCountry);
	var objProvince = document.getElementById(cmbProvince);
	if (objCountry.value=='vn')
	{
		objProvince.disabled=false;
	}
	else
	{
		objProvince.disabled=true;
	}
}
function VerifyEmailAddress(objmail)
{

	var checkStr = objmail.value;
	var ix = (checkStr.length - 4)
	var RC = true;
	var x = AtSignValid = DoublePeriod = PeriodValid = SpaceValid = ExtValid = RL = 0;
	for (i = 0;  i < checkStr.length;  i++)
	{
    	if (checkStr.charAt(i) == '@')
      		AtSignValid++;
    	else if (checkStr.charAt(i) == '.')
	    {
	    	if (x == (i-1))
	        	DoublePeriod++;
     	 	else
      		{

        		x = i;
		        PeriodValid++;
		    }
		}
	    else if (checkStr.charAt(i) == ' ')
	      SpaceValid ++;
	}
	if (checkStr.indexOf(".com", ix) > -1)
	    ExtValid++;
	else if (checkStr.indexOf(".edu", ix) > -1)
 		ExtValid++;
	else if (checkStr.indexOf(".net", ix) > -1)
    	ExtValid++;
  	else if (checkStr.indexOf(".org", ix) > -1)
    	ExtValid++;
  	else if (checkStr.indexOf(".gov", ix) > -1)
    	ExtValid++;
  	else if (checkStr.indexOf(".mil", ix) > -1)
    	ExtValid++;
  	else if (checkStr.indexOf(".cc", ix) > -1)
    	ExtValid++;
 	if (AtSignValid != 1)
		return false;
  	if (PeriodValid == 0)
	    return false;
  	if (SpaceValid > 0)
    	return false;
  	if (SpaceValid > 1)
	    return false;
  	if (checkStr.length > 120)
    	return false;
	return true;
}
function startclock()
{

var thetime=new Date();

var ndays = thetime.getDate();
var nmonths = thetime.getMonth()+1;
var nyears = thetime.getFullYear();
var nhours=thetime.getHours();
var nmins=thetime.getMinutes();
var nsecn=thetime.getSeconds();
var AorP=" ";
if(ndays<10)
	ndays = "0" + ndays;
if(nmonths<10)
	nmonths = "0" + nmonths;
if (nhours>=12)
    AorP="PM.";
else
    AorP="AM.";

if (nhours>=13)
    nhours-=12;

if (nhours==0)
 nhours=12;

if (nsecn<10)
 nsecn="0"+nsecn;

if (nmins<10)
 nmins="0"+nmins;
 var result = ndays + "-" + nmonths + "-" + nyears +",&nbsp;"+ nhours+":"+nmins+":"+nsecn+" "+AorP;
document.getElementById('spotclock').innerHTML = result;
/*document.royal.clockspot.value=ndays + "-" + nmonths + "-" + nyears +",&nbsp;"+ nhours+":"+nmins+":"+nsecn+" "+AorP;*/

setTimeout('startclock()',1000);

} 
function mypopup(url,w,h)
 {
  window.open (url,"mywindow","location=0,status=0,scrollbars=1,width="  + w + ",height=" + h);
 }
////


