var secur_val = "4";
var step_val = "m15";

Securities = new Array();
Securities[Securities.length]=new newSecurity('1');
Securities[Securities.length]=new newSecurity('2');
Securities[Securities.length]=new newSecurity('3');
Securities[Securities.length]=new newSecurity('4');

function newSecurity(key) {	
	this.key = key;	
	return this;
}

function setSecurity(id,selected,unselected) {
	for (i=0; i<=Securities.length-1; i++) {
		if (Securities[i].key==id) {
			document.getElementById("secur_"+Securities[i].key).style.color=selected;
		} else {
			document.getElementById("secur_"+Securities[i].key).style.color=unselected;			
		}	
	}
}

function settype(t,style,selected,unselected) {
	setSecurity(t,selected,unselected);	
	secur_val = t;	
	show(secur_val,'',style);
}

Times = new Array();
Times[Times.length]=new newTime('m1');
Times[Times.length]=new newTime('m5');
Times[Times.length]=new newTime('m15');
Times[Times.length]=new newTime('m30');
Times[Times.length]=new newTime('h1');
Times[Times.length]=new newTime('h4');
Times[Times.length]=new newTime('h1');

function newTime(key) {	
	this.key = key;	
	return this;
}

function setTime(id,selected,unselected) {	
	for (i=0; i<=Times.length-1; i++) {
		if (Times[i].key==id) {
			document.getElementById("time_"+Times[i].key).style.color=selected;			
		} else {
			document.getElementById("time_"+Times[i].key).style.color=unselected;			
		}	
	}
}

function setstep(s,style,selected,unselected) {
	setTime(s,selected,unselected);	
	step_val = s;
	show('',step_val,style);
}

function show(security,period,style){
	if (!security) security = secur_val;	
	if (!period) period = step_val;	
	document.images['charts'].src = "http://www.dealing24.com/charts24/"+style+"/"+period+"-"+security+".png";	
}
