﻿var nps;
function onLoad()
{
	nps = new npssort( 0, "/brokers/brokerajax.aspx?cmd=nps&id=" );
}

function showdescriptionl( id )
{
	window.location.href = "#posdescriptionl";
    showdescriptionl2( id );
}

function updateprices()
{
	ajaxrequest( "defaultajax.aspx?cmd=updateprices", doContents);
	function doContents( str )
	{
		getobj( "divprices" ).innerHTML = str;
		getobj( "tdtime" ).innerHTML = datetimeFormat( new Date(), "hh:mm:ss" );
		playsound();
	}
}

function showdescriptionl2( id )
{
	getobj( "descriptionl" ).innerHTML = "<br /><br />Loading ...";

	ajaxrequest( "defaultajax.aspx?cmd=showdescriptionl&id=" + id, "descriptionl");
}

function mostread( days )
{
	getobj( "idnews3" ).innerHTML = "<br /><br />Loading ...";
	ajaxrequest( "defaultajax.aspx?cmd=mostread&days=" + days, doContents);
	function doContents( str )
	{
		getobj( "idnews3" ).innerHTML = str;
		setLocalTime( getobj("idnews3"), "hh:mm" );
		if( days == 1 )
		{
			getobj( "idlast1" ).className = "sty12";
			getobj( "idlast3" ).className = "sty13";
		}
		else
		{
			getobj( "idlast1" ).className = "sty13";
			getobj( "idlast3" ).className = "sty12";
		}
	}
}

function onclickprice( pair )
{
	pricepair = pair;
	getobj( "pricechart" ).src = "/images/prices/small_" + pair + ".png";
	getobj( "pricename" ).innerHTML = pair;
	getobj( "charttime" ).innerHTML = "Last Update: " + datetimeFormat( getUtcDate(), "hh:mm" ) + " GMT";
}

var pricepair = "EURUSD";
function showbigchart()
{
	window.open( "bigprice.htm?&pair=" + pricepair, pricepair, 
		"directories=no,location=no,menubar=no,resizable=no," +
		"scrollbars=no,status=no,toolbar=no,width=930,height=550" );
}

function playsound()
{
	////var a = getobj("soundnum").value;
	////if( a.length > 5 )
	////	getobj(a).play();
}

function onchangedetail()
{
	var obj1 = getobj("Select1");
	var obj2 = getobj("Select2");
	var obj3 = getobj("Select3");

	window.location = "/brokers/brokercomparedetail.aspx?sel1=" + obj1.value + "&sel2=" + obj2.value + "&sel3=" + obj3.value;
}

