jQuery(document).ready(function(){


getForex();

function getForex()
{ 

  $url = "http://"+top.location.host+"/forex/MMRates.xml";

	$.ajax({
		type: "GET",
		url: $url,
		dataType: "xml",
		success: function(xml) {
			
			$update = jQuery(xml).find('update').text();
			$updatetime = jQuery(xml).find('updatetime').text();
			$update = $updatetime + " on " +$update;
			$output = '<strong class="title">Rates</strong>';
		    $output += '<p>Rates are quoted against Malaysian Ringgit.<br /><em>Updated at '+$update+'</em><br /></p>';
			$output += '<table width="520" border="0" cellpadding="5" cellspacing="1">';
			$output += '<tr><td width="326" height="50" align="left" valign="middle" bgcolor="#005aac"><strong style="color:#FFFFFF;">TENURE</strong></td><td width="96" height="25" align="center" valign="middle" bgcolor="#005aac"><strong style="color:#FFFFFF;">MMTD</strong></td><td width="94" height="25" align="center" valign="middle" bgcolor="#005aac"><strong style="color:#FFFFFF;">NID</strong></td></tr>';
			
	jQuery(xml).find('currency').each(function(){				
				  $tenure = jQuery(this).find('tenure').text();
				  $mmtd = jQuery(this).find('mmtd').text();
				  $nid = jQuery(this).find('nid').text();
				//  $fd = jQuery(this).find('fd').text();
				  //$less100k= jQuery(this).find('less100k').text();
				//  $more100k = jQuery(this).find('more100k').text();
				//  $more1mil= jQuery(this).find('more1mil').text();

					  
	$output +='</tr><tr><td width="326" height="25" align="left" valign="middle" bgcolor="#b4dff1">'+$tenure+'</td><td width="96" height="25" align="center" valign="middle" bgcolor="#b4dff1">'+$mmtd+'</td><td width="94" height="25" align="center" valign="middle" bgcolor="#b4dff1">'+$nid+'</td></tr>';				  	  				
				 // $link = '<a href = "'+$url+'">'+$title+'</a>';
				}); // end each
			
			$output += '</table><br /><em>The rates quoted herein are indicative only, and subject to change without notice at our sole discretion.<br><br>For more information, please contact our Treasury Dealing Hotline at +603 9207-2700 </em>';
			
			
			 $("#content_body").hide(1);
			 $("#content_body").html($output);
			 $("#content_body").fadeIn(2000);
				
		}
		

	});
		
}

function addJavascript(jsname,pos) {

var th = document.getElementsByTagName(pos)[0];
var s = document.createElement('script');
s.setAttribute('type','text/javascript');
s.setAttribute('src',jsname);
th.appendChild(s);

} 

});
