if(document.all){ //IE
	ffstr  = "scrollamount=1";
	sdelay = 35;
	}
else{
	ffstr = "";
	sdelay = 95;
	}
	
document.write('<style>.t{font-size:10px; font-family:Verdana; font-weight:bold;} .x{text-align:center;font-weight:bold;font-size:13px;font-family:Arial;} #r{color:#FF0000;} #g{color:#00AA33;} #gr{color:#777777;}</style>');
document.write('<map name="currency_Map"><area shape="rect" coords="30,0,45,14" href="javascript:currency_goup();" alt="Speed Up"><area shape="rect" coords="15,0,30,14" href="javascript:currency_godirection();" alt="Change Direction"><area shape="rect" coords="0,0,15,14" href="javascript:currency_godown();" alt="Slow Down"></map>')
document.write('<table width=100% border=0 cellspacing=0 cellpadding=0>\
	<td width="50"><img src="http://www.cbj.gov.jo/images/icon2.gif" width="45" height="14" border="0" usemap="#currency_Map"></td>\
	<td style="height: 38px;" valign="middle" >&nbsp;<marquee direction="left" id="currency_tickerMarquee" truespeed '+ ffstr +' scrolldelay='+sdelay+' width="100%"  style="vertical-align: top"><span style="color:#656365;font-family:Verdana;font-size:10px;font-style:normal;font-weight:normal;text-align:justify;text-decoration:none;">Please Wait ... loading data</span></marquee></td>\
	<td id="indexDivCurrency" width=100 align=right></td>\
</table>');
	


function currency_getData()
	{
	var Obj= new Date;
	includeCounter =Obj.getTime();
	var e = document.createElement("script");
	//e.src = "http://exchange.jo/ticker_data/data.js?"+includeCounter;
    e.src = "http://www.cbj.gov.jo/data.php?"+includeCounter;
	e.type="text/javascript";
	document.getElementsByTagName("head")[0].appendChild(e); 	
	}
	

function currency_updateTicker()
	{

	if(_s[0]=='')
		{
		document.all.currency_tickerMarquee.innerHTML = "";
		return;
		}
		
	var temp = -1;
	if(temp == -1)
		{
		var temp = new Array();
		for(i=0;i < _s.length;i++) temp[i] = i;
		}

	var string	=	'<table cellpadding=0 cellspacing=0 border=0 style="font-family:Arial;font-size:13px;font-weight:bold;text-align:center;"><tr>';
	if(temp.length)
	for(i=0;i< temp.length;i++)
		{ 
		
		
		var id='gr';	
		var symbol	= _s[temp[i]];
		var price	= '<sub id='+id+' style="padding-bottom: 5px">'+_p[temp[i]]+'</sub>';
		
		
		string	+=	'<td nowrap>&nbsp; '+symbol+' '+price+' '+' &nbsp;</td>';
		}
	else 
		{ 
		 
		 
			 
		var symbol	= _s[temp];
		var price	= '<sub id='+id+' style="padding-bottom: 5px">'+_p[temp]+'</sub>';
		 
		
		string	+=	'<td nowrap>&nbsp; '+symbol+' '+price+' '+' &nbsp;</td>';
			
			
		}
	string	+=	'<tr></table>';
	   document.all.currency_tickerMarquee.innerHTML = string;
	    
	}


function searchTicker()
	{
	if(trimString(document.all.search_string.value)=='') return -1;
	var count = 0;
	var temp = new Array();
	var array = document.all.search_string.value.split(',');
	if(array.length)
		for(i=0;i<array.length;i++)
			{
			array[i] = trimString(array[i]).toUpperCase();
			for(x=0;x<_s.length;x++)
				{
				if(_s[x]==array[i]) 
					{
					temp[count]=x;
					count++;
					}
				}
		
			}
	else
		{
			array = trimString(array).toUpperCase();
			for(x=0;x<_s.length;x++)
				{
				if(_s[x]==array) 
					{
					temp[count]=x;
					count++;
					}
				}			
		}
	if(count==0) 
		return -1;

	return temp;
	}

function trimString (str) {
  str = this != window? this : str;
  return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}

function currency_godirection()
	{
	if(document.all.currency_tickerMarquee.direction=='right')
		document.all.currency_tickerMarquee.direction='left';
	else 	document.all.currency_tickerMarquee.direction='right';
	}	

function currency_goup()
	{
	m = document.getElementById("currency_tickerMarquee");
	
	if(m.scrollDelay<=5) return;
	
	v = parseInt(m.scrollDelay);
	v -= 5;
	m.scrollDelay = v;
	}

function currency_godown()
	{
	m = document.getElementById("currency_tickerMarquee");
	
	if(m.scrollDelay<=5) return;
	
	v = parseInt(m.scrollDelay);
	v += 5;
	m.scrollDelay = v;
	}
	
	
currency_getData();