
wls = window.location.search;
//alert(wls);
/*
if (parent.location.href == self.location.href && wls.length > 1)
{
	link = window.location.pathname+wls;
	link = link.replace("?", "%3F").replace("&", "%26").replace("=", "%3d");
	parent.location.href = "/cgi-bin/oicgi.exe/inet_redirect?link="+link;
}
*/
/*if (parent.frames.length == 0)
{
	pn = window.location.pathname;
	if (pn.substring(pn.length-8, pn.length) != 'help.htm')
		window.location.reload("/cgi-bin/oicgi.exe/inet_redirect?link="+pn);
}*/

var rootdir = '/web/';

/* are we in a frame? */
/*if (parent.location.href == self.location.href)
{
	oloc = parent.location.href;
	if (oloc.substring(0,7) == "http://")
	{
		s = oloc.indexOf('/', 7);
		oloc = oloc.substring(s, oloc.length);
	}
	if (oloc == '/web/v_spick.htm')
		window.location.href = 'default_spick.htm';
}*/

function textsubmit()
{
	document.forum.submit();
}
function toggle()
{
	var a = toggle.arguments;
	var id = a[0];
	var ul = "div_" + id;
    var img = "img_" + id;
    var icon = "icon_" + id;
	var ulElement = document.getElementById(ul);
    var imgElement = document.getElementById(img);
    var iconElement = document.getElementById(icon);
	if (ulElement)
	{
		if (ulElement.className == "closed")
		{
			ulElement.className = "open";
			if (imgElement)
				if (a.length > 2)
					imgElement.src = a[2];
				else
					imgElement.src = rootdir + "images/hide.gif";
			if (iconElement)
				iconElement.src = rootdir + "images/tsc_" + id + "_green.jpg";
		}
		else
		{
			ulElement.className = "closed";
			if (imgElement)
				if (a.length > 1)
					imgElement.src = a[1];
				else
					imgElement.src = rootdir + "images/more.gif";
			if (iconElement)
				iconElement.src = rootdir + "images/tsc_" + id + "_grey.jpg";
			window.location = "#" + id;
        }
    }
}
function toggle2(id)
{
	ul = "div_" + id;
    img = "img_" + id;
    icon = "icon_" + id;
	ulElement = document.getElementById(ul);
    imgElement = document.getElementById(img);
    iconElement = document.getElementById(icon);
	if (ulElement)
	{
		if (ulElement.className == 'closed')
		{
			ulElement.className = "open";
			imgElement.src = rootdir + "images/helpless.gif";
			if (iconElement)
				iconElement.src = rootdir + "images/tsc_" + id + "_green.jpg";
		}
		else
		{
			ulElement.className = "closed";
			imgElement.src = rootdir + "images/helpmore.gif";
			if (iconElement)
				iconElement.src = rootdir + "images/tsc_" + id + "_grey.jpg";
        }
    }
}
var mmwindow;
function MM_openBrWindow(theURL,winName,features) { //v2.0
	mmwindow = window.open(theURL,winName,features);
	if (window.focus) {mmwindow.focus();}
}
function locationcheck(oloc, nloc)
{
	// remove http(s)://domain part
	s = oloc.indexOf('//', 0);
	if (s > 0)
	{
		s = oloc.indexOf('/', s+2);
		oloc = oloc.substring(s, oloc.length);
	}
	return (oloc == nloc);
}
function randomString(string_length) {
	var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
	var randomstring = '';
	for (var i=0; i<string_length; i++) {
		var rnum = Math.floor(Math.random() * chars.length);
		randomstring += chars.substring(rnum,rnum+1);
	}
	return randomstring;
}
function pageload()
{
	if (parent.frames.length == 2)
		parent.frames.item(0).check()
	if (parent.frames.length == 4)
	{
		if (window.mymenu)
		{
			loc = rootdir + mymenu + ".htm";
			if (typeof(parent.menu.location.href) == "string")
				if (!locationcheck(parent.menu.location.href, loc))
					parent.menu.location.href=loc;
			switch (mybanner)
			{
			case "1": case 1: bloc = 'home'; break;
			case "2": case 2: bloc = 'invest'; break;
			case "3": case 3: bloc = 'research'; break;
			case "4": case 4: bloc = 'learn'; break;
			//default: bloc = 'home'; break;
			}
			loc = rootdir + "tsc_" + bloc + "_banner.htm";
			if (typeof(parent.banner.location.href) == "string")
				if (!locationcheck(parent.banner.location.href, loc))
					parent.banner.location.href=loc;
		}
		if (getCookie("tschome") == "")
		{
			document.cookie = "tschome=" + escape(randomString(10)) + "; path=/";
		}
		if (!locationcheck(window.location.href, "/web/v_spick.htm"))
			if (window.focus) {window.focus();}
	}
}

function exporttext()
{
	var text = document;
	print(text);
}
var newwindow;
function pophelp(url)
{
	newwindow = window.open(url,'name','height=185,width=300');
	if (window.focus) {newwindow.focus();}
}

function pophelp2(url)
{
	newwindow = window.open(url,'name','height=600,width=640,scrollbars=yes');
	if (window.focus) {newwindow.focus();}
}

var digitalwin;
function popdigital(site, path)
{
	if (site == "d")
		url = 'http://sharecentre.digitallook.com/cgi-bin/digitalcorporate/sharecentre/security.cgi?ticker=' + path;
	else
		url = site + path;
	digitalwin = window.open(url,'digital');
	if (window.focus) {digitalwin.focus();}
}

function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return "";
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}
function setCookie (name, value, expires, path, domain, secure) {
	document.cookie = name + "=" + escape(value) +
//	((expires) ? "; expires=" + expires : "") +
	((path) ? "; path=" + path : "") +
	((domain) ? "; domain=" + domain : "") +
	((secure) ? "; secure" : "");
}

function putFocus(formInst, elementInst) {
	if (document.forms.length > 0) {
		document.forms[formInst].elements[elementInst].focus();
	}
}

function trash(limit)
{
	if (document.forms.length > 0)
	{
		form = document.forms[0];
		for (i = 0; i < form.elements.length; i++)
		{
			el = form.elements[i].name;
			if (el.substring(0,3) == limit+"_")
			{
				form.elements[i].value = "";
			}
		}
	}
}
function checkselected(add_list)
{
	if (add_list.item.value == false )
	{
		alert('Please Select an option.')
		return false;
	}
	else
return true;
}
function checkrequiredjoin(which) {
	formx = document.forms[0];
	pw1 = formx.requiredpassword.value;
	pw2 = formx.requiredpasswordcheck.value;
	var invalid = " "; // Invalid character is a space
	var minLength = 8; // Minimum length
	var pass=true;
	if (document.images) {
		for (i=0;i<which.length;i++) {
			var tempobj=which.elements[i];
			if (tempobj.name.substring(0,8)=="required") {
				if (((tempobj.type=="text"||tempobj.type=="password"||tempobj.type=="textarea")&&
						tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
						tempobj.selectedIndex==0)) {
					pass=false;
					break;
				}
			}
		}
	}
	if (!pass) {
		shortFieldName=tempobj.name.substring(8,30).toUpperCase();
		alert("Please make sure the "+shortFieldName+" field was properly completed.");
		return false;
	}
	else
		if (formx.requiredpassword.value.length < minLength) {
		alert('Your password must be at least ' + minLength + ' characters long. Try again.');
		return false;
	}
	else
		if (formx.requiredpassword.value.indexOf(invalid) > -1) {
		alert("Sorry, spaces are not allowed.");
		return false;
	}
	else
	if (pw1 != pw2) {
		alert ("\nYou did not enter the same new password twice. Please re-enter your password.")
		return false;
	}
	else
		return true;
}
function checkrequiredapply(which) {
	formx = document.forms[0];
	var invalid = " "; // Invalid character is a space
	var minLength = 8; // Minimum length
	var pass=true;
	if (document.images) {
		for (i=0;i<which.length;i++) {
			var tempobj=which.elements[i];
			if (tempobj.name.substring(0,8)=="required") {
				if (((tempobj.type=="text"||tempobj.type=="password"||tempobj.type=="textarea")&&
						tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
						tempobj.selectedIndex==0)) {
					pass=false;
					break;
				}
			}
		}
	}
	if (!pass) {
		shortFieldName=tempobj.name.substring(8,30).toUpperCase();
		alert("Please make sure the "+shortFieldName+" field was properly completed.");
		return false;
	}
	else
		return true;
}
function rndad()
{
	var a = rndad.arguments;
	var r = Math.round(Math.random()*(a.length-1));
	if (r+1 == a.length)
		r = r-1;
	var link = a[0];
	m = link.indexOf("|")
	if (m >= 0)
	{
		alt = link.substring(m+1,link.length);
		link = link.substring(0,m);
	}
	else
		alt = "";
	if (link == "")
		document.write('<img src="' + rootdir + 'images/' + a[r+1] + '" border="0" alt="' + alt + '">');
	else
	{
		if (link.indexOf(".pdf") > 0)
			tar = ' target="_blank"';
		else
			tar = '';
		document.write('<a href="' + link + '"' + tar + '><img src="' + rootdir + 'images/' + a[r+1] + '" border="0" alt="' + alt + '"></a>');
	}
}
function rndpick()
{
	var r = Math.round(Math.random()*6);
	if (rndpick.arguments.length == 0)
		document.write('<table width="100%" cellpadding="0" cellspacing="2">');
	switch (r)
	{
	case 0: return "123";
	case 1: return "231";
	case 2: return "312";
	case 3: return "321";
	case 4: return "213";
	case 5: return "132";
	}
	return "132";
}
// strval, strpos, link, graphic_link, ...
function rndad2()
{
	var r, p, tar;
	var a = rndad2.arguments;
	p = a[1];
	if (a[0].length < p)
		p = a[0].length - 1;
	if (p < 0)
		return;
	document.write('<tr><td>')
	var r = a[0].substring(p,p+1)*1 + 2;
	var link = a[2];
	m = link.indexOf("|")
	if (m >= 0)
	{
		alt = link.substring(m+1,link.length);
		link = link.substring(0,m);
	}
	else
		alt = "";
	if (r >= a.length)
		r = a.length - 1;
	if (link == "")
		document.write('<img src="' + rootdir + 'images/' + a[r] + '" border="0" alt="' + alt + '">');
	else
	{
		if (link.indexOf(".pdf") > 0)
			tar = ' target="_blank"';
		else
			tar = '';
		document.write('<a href="' + link + '"' + tar + '><img src="' + rootdir + 'images/' + a[r] + '" border="0" alt="' + alt + '"></a>');
	}
	document.write('</td></tr>');
}
function rndad3()
{
	var r, p, tar;
	var a = rndad3.arguments;
	p = a[1];
	if (a[0].length < p)
		p = a[0].length - 1;
	if (p < 0)
		return;
	var r = a[0].substring(p,p+1)*1 + 2;
	var link = a[2];
	m = link.indexOf("|")
	if (m >= 0)
	{
		alt = link.substring(m+1,link.length);
		link = link.substring(0,m);
	}
	else
		alt = "";
	if (r >= a.length)
		r = a.length - 1;
	if (link == "")
		document.write('<img src="' + rootdir + 'images/' + a[r] + '" border="0" alt="' + alt + '">');
	else
	{
		if (link.indexOf(".pdf") > 0)
			tar = ' target="_blank"';
		else
			tar = '';
		document.write('<a href="' + link + '"' + tar + '><img src="' + rootdir + 'images/' + a[r] + '" border="0" alt="' + alt + '"></a>');
	}
}
function rndadend()
{
	document.write('</table>');
}
function performance()
{
	cookie = getCookie("session");
	if (cookie != "" && cookie.substring(0, 4) != "you ")
	{
		s = cookie.indexOf('-', 7);
		ac = cookie.substring(s+1, s+2);
		if (s < 0 || ac != "0")
		{
			url = 'http://sharecentre.digitallook.com/cgi-bin/digitalcorporate/sharecentre/share_filter.cgi?'  
			var newwindow = window.open(url,'filter');
			parent.main.location.href = "/web/v_spick.htm";
			if (window.focus && newwindow) {newwindow.focus();}
		}
		else
		{
			parent.main.location.href = "/web/byperformance.htm";
		}
	}
	else
	{
		parent.main.location.href = "/web/byperformance.htm";
	}
}
function salchange()
{
var ulElement = document.getElementById("sal_other");
var ival = document.details.salutation.options[document.details.salutation.selectedIndex].value;
	if (ival == "other")
	{
		ulElement.className = "xopen";
	}
	else
	{
		ulElement.className = "xclosed";
	}
}


