function selectAndGo(urlInfo)
{
	var urlElements;
	
			
	if (urlInfo != "")
	{
		urlElements = urlInfo.split("~");
		
		if (urlElements.length == 1)
		{
			self.name = "ADMIS";
			window.open(urlElements[0], "ADMIS");
		}
		else if (urlElements.length == 2)
		{
			if (urlElements[1] == "_blank" )
			{	
				window.open(urlElements[0]);	
			}
			else if (urlElements[1] == "_self")
			{
				self.name = "ADMIS";
				self.open(urlElements[0],"ADMIS");
			}
			else
			{
				window.open(urlElements[0], urlElements[1]);
			}
		}
		else if (urlElements.length == 3)
		{
			if (urlElements[1] = "_blank" )
			{
				
				window.open(urlElements[0], "", urlElements[2]);
			}
			else
			{
				self.name = "ADMIS";
				self.open(urlElements[0], self.name);
			}	
		}	
	}
}

function Cookie(document, name, hours, path, domain, secure)
{
	this.$document = document;
	this.$name = name;
	if (hours) 
		this.$expiration = new Date((new Date()).getTime() + hours * 3600000);
	else
		this.$expiration = null;
	if (path) 
		this.$path = path; 
	else
		this.$path = null;
	if (domain)
		this.$domain = domain;
	else
		this.$domain = null;
	if (secure)
		this.$secure = true;
	else
		this.$secure = false;
}

			
Cookie.prototype.store = function () {
	var cookieval = "";
	for(var prop in this)
	{
		if ((prop.charAt(0) == '$') || ((typeof this[prop]) == 'function'))
			continue;
		if (cookieval != "") cookieval += '&';
		cookieval += prop + ':' + escape(this[prop]);
	}
		
	var cookie = this.$name + '=' + cookieval;
	if (this.$expiration)
		cookie += '; expires=' + this.$expiration.toGMTString();
	if (this.$path) cookie += '; path=' + this.$path;
	if (this.$domain) cookie += '; domain=' + this.$domain;
	if (this.$secure) cookie += '; secure';
		
	this.$document.cookie = cookie;
}		
	
Cookie.prototype.load = function () {
	var allcookies = this.$document.cookie;
	if (allcookies == "") return false;
					
	var start = allcookies.indexOf(this.$name + '=');
	if (start == -1) return false;
	start += this.$name.length + 1;
	var end = allcookies.indexOf(';', start);
	if (end == -1) end = allcookies.length;
	var cookieval = allcookies.substring(start, end);
	
	var a = cookieval.split('&');
	for (var i=0; i < a.length; i++)
		a[i] = a[i].split(':');
	
	for (var i=0; i < a.length; i++)
		this[a[i][0]] = unescape(a[i][1]);
	
	return true;
}
	
Cookie.prototype.remove = function() {
	var cookie;
	cookie = this.$name + '=';
	if (this.$path) cookie += '; path=' + this.$path;
	if (this.$domain) cookie += '; domain' + this.$domain;
	cookie += '; expires=Fri, 02-Jan-1970 00:00:00 GMT';
	
	this.$document.cookie = cookie;
	
}

function getQuote(quotesURL, symbols)
{
	var url = quotesURL;
	url += symbols;	
	url += '&amp;title=Your%20Quote%20Board';
	url += '~_blank~toolbar=yes,location=no,directories=no,status=no,menubar=yes,width=785,height=350,resizable=yes,scrollbars=yes,copyhistory=no';

	selectAndGo( url );
}
	
function loadSymbolList(symbolsName, monthsName)
{				
	var symbolList = new Cookie(document, "symbolList", 20000);
	if(symbolList.load()) 
	{
		document.all[symbolsName].value = symbolList.symbols;
		document.all[monthsName].value = symbolList.months;
	}
	else
	{
		document.all[symbolsName].value = "s,c,cl,gc";
	}
}

function saveSymbolList(symbols, months)
{
	var symbolList = new Cookie(document, "symbolList", 20000);
	symbolList.symbols = symbols;
	symbolList.months = months;
	symbolList.store();
}

function stopTimer () {
    var timer = document.getElementById('timerID').value;
    clearTimeout(timer);
}				

function findPos(obj) {
	var curleft = curtop = curwidth = 0;
	if (obj.offsetParent) {
	curleft = obj.offsetLeft
	curtop = obj.offsetTop
	curwidth = obj.offsetWidth;
	while (obj = obj.offsetParent) {
		curleft += obj.offsetLeft
		curtop += obj.offsetTop
		}
	}
	return [curleft,curtop,curwidth];
}			

function horizontalMenuPopup (subMenu, mainMenu) {
    stopTimer();
    var mainMenuCoors=findPos(document.getElementById(mainMenu));
    document.getElementById(subMenu).style.position = 'absolute';
    document.getElementById(subMenu).style.left = mainMenuCoors[0] + 'px';
    mainMenuCoors[1] += 29;
    document.getElementById(subMenu).style.top = mainMenuCoors[1] + 'px';				
    document.getElementById(subMenu).style.display = 'Inline';
}

function menuShow (menu) {
    stopTimer();
    document.getElementById(menu).style.display = 'Inline';
}

function menuhide (menu) {
    stopTimer();
    document.getElementById(menu).style.display = 'None';
}

function verticalMenuPopup (subMenu, menuItem) {
    stopTimer();
    var coors=findPos(document.getElementById(menuItem));
    document.getElementById(subMenu).style.position = 'absolute';
    document.getElementById(subMenu).style.left = coors[0] + 'px';
    var offsetHeight = coors[1];
    coors[1] += 22;
    document.getElementById(subMenu).style.top = coors[1] + 'px';				
    document.getElementById(subMenu).style.display = 'Inline';
}