﻿//var g_cbn = '#1d1d1d';	
var g_cbn = '#ffffff';	
var g_cbs = '#444444';	
var g_cbh = '#aaaaaa';	
var g_change = new Date().getTime()
//var g_cbh2 = '#1d1d1d'; 
var g_cbh2 = '#FFFFBA';
var g_cbhrc = '#555555'; 			
var g_cbhrt = 'rgb(85, 85, 85)'; 	
var g_thbu = 1000;		
var g_thau = 1000;	
function Left(str, n)
{
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}


function Right(str, n)
{
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}
//function getColor(str){
//    if (Left(str,1) == "+"){
//   // getColor = "u";
//    return "u";
//    }
//     if (Left(str,1) == "-"){
//    //getColor = "d";
//    return "d";
//    }
//    getColor="";
//}
function getColor(str){
    if (Left(str,1) == "+"){
   // getColor = "u";
    return "u";
    }
     if (Left(str,1) == "-"){
    //getColor = "d";
    return "d";
    }
    return "";
}
function UpdateCell(o,v)
{
try{
	if (!o)return false;
	if (o.innerHTML.replace('&amp;','&')==v) return false;
	if (v=='')return false;
	if (v=='0') v='';
	var bg=(g_cbn);
	g_change = new Date().getTime()
	//alert (o.innerHTML + "     " + v);
	o.style.backgroundColor=g_cbh;
	setTimeout(function(){if(v!='z')o.innerHTML=v;o.style.backgroundColor=g_cbh2;
		setTimeout(function(){o.removeAttribute('style');o.id = getColor(v);}, g_thau)
		//setTimeout(function(){o.style=""}, g_thau)o.style.backgroundColor=bg;
		}, g_thbu);
}
catch(e){}
		
}

function UpdateCell_DowOilGold(o,v)
{
	if (!o)return false;
	if (o.innerHTML.replace('&amp;','&')==v) return false;
	if (v=='')return false;
	if (v=='0') v='';
	var bg=(g_cbn);
	//alert (o.innerHTML + "     " + v);
	o.style.backgroundColor=g_cbh;
	//alert(v);
	setTimeout(function(){if(v!='z')o.innerHTML=v;o.style.backgroundColor=g_cbh2;
		setTimeout(function(){o.removeAttribute('style');o.className = getColor(v);}, g_thau)
		//setTimeout(function(){o.style=""}, g_thau)o.style.backgroundColor=bg;
		}, g_thbu);
}

function popup(url) 
{
 var width  = 650;
 var height = 650;
 var left   = (screen.width  - width)/2;
 var top    = (screen.height - height)/2;
 var params = 'width='+width+', height='+height;
 params += ', top='+top+', left='+left;
 params += ', directories=no';
 params += ', location=no';
 params += ', menubar=no';
 params += ', resizable=no';
 params += ', scrollbars=yes';
 params += ', status=no';
 params += ', toolbar=no';
 params += ', addressbar=no';
 newwin=window.open(url,'windowname5', params);
 if (window.focus) {newwin.focus()}
 return false;
}
