<!--
rnd.today=new Date();
rnd.seed=rnd.today.getTime();
function rnd() {
        rnd.seed = (rnd.seed*9301+49297) % 233280;
        return rnd.seed/(233280.0);
};
function rand(number) {
        return Math.ceil(rnd()*number);
};
var ord = rand(100000000);

//OPEN NEW WINDOW AND CLOSE OLD SCRIPT
var NewWin, TrueWin;
var sw=0;
var sh=0;
browserVer=parseInt(navigator.appVersion);
browserName=navigator.appName;

	sw = screen.width; sh = screen.height;


function tellme(a,b,c,d) {
alert (a);
alert (b);
alert (c);
alert (d);
}
//###############################################################################
function open_new_window(W_SOURCE,W_NAME,W_WIDTH,W_HIGHT,W_SCROOL)
{
//new window top point
var cx = (sw - W_WIDTH)/2;
//new window left point
var cy = (sh - W_HIGHT)/2;
	if(TrueWin =="true" && !NewWin.closed)
	NewWin.close();
TrueWin = "true";
NewWin = window.open(W_SOURCE,W_NAME,'width='+W_WIDTH+',height='+W_HIGHT+', ScreenX='+cx+', left='+cx+', ScreenY='+cy+', top='+cy+', resizable=no,status=no,scrollbars='+ W_SCROOL);
}
//###############################################################################
function reports_description(descr){
	open_new_window('/research/reports/description/'+descr+'.php','REPORTS_DESCR',400,160,'no');
}
//###############################################################################
function pdf_pop(id, c)				// Nairit: Gets "Z330583", "A-POWER ENERGY"
{											// Nairit: Ultimately this executes: http://pdf.zacks.com/pdf/ZR/Z330583.PDF
open_new_window('/ZER/pdf_pop.php?r='+id+'&c='+c,'PDF_WINDOW','800','700','yes');
}
//###############################################################################
function pdf_pop_rd(id,c){
  open_new_window('/ZER/pdf_pop_rd.php?r='+id+'&c='+c,'PDF_WINDOW','800','700','yes');
}


function trimString (str) {
  str = this != window? this : str;
  return str.replace(/\s+/g, '');
}

function checkReportsForm(){
	//var v = document.reports_form1.searchby.options[document.reports_form1.searchby.options.selectedIndex].value;
	var s = document.reports_form1.search_string.value;
	//if(v != "industry" && v != "firm"){
		if(trimString(s) == ""){
			alert("Please enter search criteria!");
			document.reports_form1.search_string.focus();
			return false;
		}
	//}
	return true;
}

function ticker_lookup(form_desc,search){
	open_new_window('/research/lookup.php?show_as_popup='+form_desc+'&search='+search,'TICK_LOOKUO',700,600,'yes');
}
/*
img1a = new Image()
img1a.src = "/images/chart_tabs/chart_tabs_djia_on.gif"
img1b = new Image()
img1b.src = "http://prochart.zacks.com/JpG/1.11/intraday/$DJI_zcom_home_120x120_blue.png?"

img2a = new Image()
img2a.src = "/images/chart_tabs/chart_tabs_nasd_on.gif"
img2b = new Image()
img2b.src = "http://prochart.zacks.com/JpG/1.11/intraday/COMP_zcom_home_120x120_blue.png?"

img3a = new Image()
img3a.src = "/images/chart_tabs/chart_tabs_spx_on.gif"
img3b = new Image()
img3b.src = "http://prochart.zacks.com/JpG/1.11/intraday/SPX_zcom_home_120x120_blue.png?"

function imageChange(imgName,imgSrc){
document.images[imgName].src = eval(imgSrc +".src")
}

*/
function show_single_issue(issue_id,newsletter_id,newsletter_name){
	var path = 'http://www.zacks.com/experts/search/view_issue.php?issue_id='+issue_id+'&newsletter_id='+newsletter_id+'&newsletter_name='+escape(newsletter_name);
	if(zacks_login_done == 1)
		window.open(path,'ISSUE');
	else
		open_new_window('/login_popup.php?type=issues&continue_to='+escape(path)+'&issue_id='+issue_id+'&newsletter_id='+newsletter_id+'&newsletter_name='+escape(newsletter_name),'NISS',700,450,'no');
}


//zdavis 2/22/06
var popbackground="white" //specify backcolor or background image for pop window
var windowtitle="Zacks.com Quote Popup Window"  //pop window title

function detectexist(obj){
return (typeof obj !="undefined")
}

function quotepop_OLD(ticker,textdescription){

var wlocation = escape(window.location);

function getpos(){
popwidth=430
popheight=480

leftpos=(detectexist(window.screenLeft))? screenLeft+document.body.clientWidth/2-popwidth/2 : detectexist(window.screenX)? screenX+innerWidth/2-popwidth/2 : 0
toppos=(detectexist(window.screenTop))? screenTop+document.body.clientHeight/2-popheight/2 : detectexist(window.screenY)? screenY+innerHeight/2-popheight/2 : 0
if (window.opera){
leftpos-=screenLeft
toppos-=screenTop
}
}

getpos()
var winattributes='width='+popwidth+',height='+popheight+',resizable=ye,scrollbars=yes,left='+leftpos+',top='+toppos
if (typeof jkpopwin=="undefined" || jkpopwin.closed)
jkpopwin=window.open("","",winattributes)
else{
jkpopwin.resizeTo(popwidth, popheight+30)
}
jkpopwin.document.open()
jkpopwin.document.write('<head><title>Zacks.com Quote - Popup: '+ticker+'</title><META HTTP-EQUIV="REFRESH" CONTENT="0; URL=http://web2.zacks.com/research/quotepop.php?t='+ticker+'&location='+wlocation+'"></head><body>Please wait....</body></html>')
jkpopwin.document.close()
jkpopwin.focus()
}

function quotepop(tick,desc) {
	open_new_window('http://www.zacks.com/research/qp.php?t='+tick,'PQ','550','405','NO');
}

// top10 quotepop
function quotepop_top10(tick,desc) {
	open_new_window('http://www.zacks.com/research/qptop10.php?t='+tick,'PQ','550','380','NO');
}

// jward add this

//-----------------------------------------------------------------------------
// sortTable(id, col, rev)
//
//  id  - ID of the TABLE, TBODY, THEAD or TFOOT element to be sorted.
//  col - Index of the column to sort, 0 = first column, 1 = second column,
//        etc.
//  rev - If true, the column is sorted in reverse (descending) order
//        initially.
//
//-----------------------------------------------------------------------------

function sortTable(id, col, rev) {

  // Get the table or table section to sort.
  var tblEl = document.getElementById(id);

  // The first time this function is called for a given table, set up an
  // array of reverse sort flags.
  if (tblEl.reverseSort == null) {
    tblEl.reverseSort = new Array();
    // Also, assume the team name column is initially sorted.
    tblEl.lastColumn = 1;
  }

  // If this column has not been sorted before, set the initial sort direction.
  if (tblEl.reverseSort[col] == null)
    tblEl.reverseSort[col] = rev;

  // If this column was the last one sorted, reverse its sort direction.
  if (col == tblEl.lastColumn)
    tblEl.reverseSort[col] = !tblEl.reverseSort[col];

  // Remember this column as the last one sorted.
  tblEl.lastColumn = col;

  // Set the table display style to "none" - necessary for Netscape 6
  // browsers.
  var oldDsply = tblEl.style.display;
  tblEl.style.display = "none";

  // Sort the rows based on the content of the specified column using a
  // selection sort.

  var tmpEl;
  var i, j;
  var minVal, minIdx;
  var testVal;
  var cmp;

  for (i = 0; i < tblEl.rows.length - 1; i++) {

    // Assume the current row has the minimum value.
    minIdx = i;
    minVal = getTextValue(tblEl.rows[i].cells[col]);

    // Search the rows that follow the current one for a smaller value.
    for (j = i + 1; j < tblEl.rows.length; j++) {
      testVal = getTextValue(tblEl.rows[j].cells[col]);
      cmp = compareValues(minVal, testVal);
      // Negate the comparison result if the reverse sort flag is set.
      if (tblEl.reverseSort[col])
        cmp = -cmp;
      // Sort by the second column (team name) if those values are equal.
      if (cmp == 0 && col != 1)
        cmp = compareValues(getTextValue(tblEl.rows[minIdx].cells[1]),
                            getTextValue(tblEl.rows[j].cells[1]));
      // If this row has a smaller value than the current minimum, remember its
      // position and update the current minimum value.
      if (cmp > 0) {
        minIdx = j;
        minVal = testVal;
      }
    }

    // By now, we have the row with the smallest value. Remove it from the
    // table and insert it before the current row.
    if (minIdx > i) {
      tmpEl = tblEl.removeChild(tblEl.rows[minIdx]);
      tblEl.insertBefore(tmpEl, tblEl.rows[i]);
    }
  }

  // Make it look pretty.
  makePretty(tblEl, col);

  // Set team rankings.
  //setRanks(tblEl, col, rev);

  // Restore the table's display style.
  tblEl.style.display = oldDsply;

  return false;
}

//-----------------------------------------------------------------------------
// Functions to get and compare values during a sort.
//-----------------------------------------------------------------------------

// This code is necessary for browsers that don't reflect the DOM constants
// (like IE).
if (document.ELEMENT_NODE == null) {
  document.ELEMENT_NODE = 1;
  document.TEXT_NODE = 3;
}

function getTextValue(el) {

  var i;
  var s;

  // Find and concatenate the values of all text nodes contained within the
  // element.
  s = "";
  for (i = 0; i < el.childNodes.length; i++)
    if (el.childNodes[i].nodeType == document.TEXT_NODE)
      s += el.childNodes[i].nodeValue;
    else if (el.childNodes[i].nodeType == document.ELEMENT_NODE &&
             el.childNodes[i].tagName == "BR")
      s += " ";
    else
      // Use recursion to get text within sub-elements.
      s += getTextValue(el.childNodes[i]);

  return normalizeString(s);
}

function compareValues(v1, v2) {

  var f1, f2;

  // If the values are numeric, convert them to floats.

  f1 = parseFloat(v1);
  f2 = parseFloat(v2);
  if (!isNaN(f1) && !isNaN(f2)) {
    v1 = f1;
    v2 = f2;
  }

  // Compare the two values.
  if (v1 == v2)
    return 0;
  if (v1 > v2)
    return 1
  return -1;
}

// Regular expressions for normalizing white space.
var whtSpEnds = new RegExp("^\\s*|\\s*$", "g");
var whtSpMult = new RegExp("\\s\\s+", "g");

function normalizeString(s) {

  s = s.replace(whtSpMult, " ");  // Collapse any multiple whites space.
  s = s.replace(whtSpEnds, "");   // Remove leading or trailing white space.

  return s;
}

//-----------------------------------------------------------------------------
// Functions to update the table appearance after a sort.
//-----------------------------------------------------------------------------

// Style class names.
var rowClsNm = "alternateRow";
var colClsNm = "sortedColumn";
//var colClsNm = "alternateRow";

// Regular expressions for setting class names.
var rowTest = new RegExp(rowClsNm, "gi");
var colTest = new RegExp(colClsNm, "gi");

function makePretty(tblEl, col) {

  var i, j;
  var rowEl, cellEl;

  // Set style classes on each row to alternate their appearance.
  for (i = 0; i < tblEl.rows.length; i++) {
   rowEl = tblEl.rows[i];
   rowEl.className = rowEl.className.replace(rowTest, "");
    if (i % 2 != 0)
      rowEl.className += " " + rowClsNm;
    rowEl.className = normalizeString(rowEl.className);
    // Set style classes on each column (other than the name column) to
    // highlight the one that was sorted.
    for (j = 0; j < tblEl.rows[i].cells.length; j++) {
      cellEl = rowEl.cells[j];
      cellEl.className = cellEl.className.replace(colTest, "");
      //if (j == col)
        cellEl.className += " " + colClsNm;
      cellEl.className = normalizeString(cellEl.className);
    }
  }

  // Find the table header and highlight the column that was sorted.
//  var el = tblEl.parentNode.tHead;
//  rowEl = el.rows[el.rows.length - 1];
   //Set style classes for each column as above.
//  for (i = 2; i < rowEl.cells.length; i++) {
//    cellEl = rowEl.cells[i];
//    cellEl.className = cellEl.className.replace(colTest, "");
    // Highlight the header of the sorted column.
//    if (i == col)
//      cellEl.className += " " + colClsNm;
//      cellEl.className = normalizeString(cellEl.className);
//  }
}

function setRanks(tblEl, col, rev) {

  // Determine whether to start at the top row of the table and go down or
  // at the bottom row and work up. This is based on the current sort
  // direction of the column and its reversed flag.

  var i    = 0;
  var incr = 1;
  if (tblEl.reverseSort[col])
    rev = !rev;
  if (rev) {
    incr = -1;
    i = tblEl.rows.length - 1;
  }

  // Now go through each row in that direction and assign it a rank by
  // counting 1, 2, 3...

  var count   = 1;
  var rank    = count;
  var curVal;
  var lastVal = null;

  // Note that this loop is skipped if the table was sorted on the name
  // column.
  while (col > 1 && i >= 0 && i < tblEl.rows.length) {

    // Get the value of the sort column in this row.
    curVal = getTextValue(tblEl.rows[i].cells[col]);

    // On rows after the first, compare the sort value of this row to the
    // previous one. If they differ, update the rank to match the current row
    // count. (If they are the same, this row will get the same rank as the
    // previous one.)
    if (lastVal != null && compareValues(curVal, lastVal) != 0)
        rank = count;
    // Set the rank for this row.
    tblEl.rows[i].rank = rank;

    // Save the sort value of the current row for the next time around and bump
    // the row counter and index.
    lastVal = curVal;
    count++;
    i += incr;
  }

  // Now go through each row (from top to bottom) and display its rank. Note
  // that when two or more rows are tied, the rank is shown on the first of
  // those rows only.

  var rowEl, cellEl;
  var lastRank = 0;

  // Go through the rows from top to bottom.
  for (i = 0; i < tblEl.rows.length; i++) {
    rowEl = tblEl.rows[i];
    cellEl = rowEl.cells[0];
    // Delete anything currently in the rank column.
    while (cellEl.lastChild != null)
      cellEl.removeChild(cellEl.lastChild);
    // If this row's rank is different from the previous one, Insert a new text
    // node with that rank.
    if (col > 1 && rowEl.rank != lastRank) {
      cellEl.appendChild(document.createTextNode(rowEl.rank));
      lastRank = rowEl.rank;
    }
  }
}
// end of jward add








var login_is_open = false;
function js_login(){
	if(login_is_open){
		login_is_open = false;
		hideDiv('login_div');
	}else{
		login_is_open = true;
		showDiv('login_div');
	}
}


//div functions
function error_message(){
	alert('Your browser isn\'t supported!');
}

function getRefToDiv(divID) {
	if( document.layers ) { //Netscape layers
		return document.layers[divID]; }
	if( document.getElementById ) { //DOM; IE5, NS6, Mozilla, Opera
		return document.getElementById(divID); }
	if( document.all ) { //Proprietary DOM; IE4
		return document.all[divID]; }
	if( document[divID] ) { //Netscape alternative
		return document[divID]; }
	return false;
}

//Shows the div
function showDiv(divID_as_a_string) {
	//get a reference as above ...
	myReference = getRefToDiv(divID_as_a_string);
	if( !myReference ) {
		error_message();
		return false; //don't go any further
		//return anything would work,
		//but I am using false to show failure
	}
	//now we have a reference to it
	if( myReference.style ) { //DOM & proprietary DOM
		myReference.style.visibility = 'visible';
		myReference.style.display='block';
	} else {
		if( myReference.visibility ) { //Netscape
			myReference.visibility = 'show';
			myReference.style.display='block';
		} else {
			error_message();
			return false; //don't go any further
		}
	}
	return true;
}
//Hides the div
function hideDiv(divID_as_a_string) {
	//get a reference as above ...
	myReference = getRefToDiv(divID_as_a_string);
	if( !myReference ) {
		//window.alert('Nothing works in this browser');
		return false; //don't go any further
		//return anything would work,
		//but I am using false to show failure
	}
	//now we have a reference to it
	if( myReference.style ) { //DOM & proprietary DOM
		myReference.style.visibility = 'hidden';
		myReference.style.display='none';
	} else {
		if( myReference.visibility ) { //Netscape
			myReference.visibility = 'hide';
			myReference.style.display='none';
		} else {
			//window.alert('Nothing works in this browser');
			return false; //don't go any further
		}
	}
	return true;
}

function writeToDiv(div_name,t){
	var menuobj=document.getElementById? document.getElementById(div_name) : document.all? eval('document.all.'+div_name) : document.layers? eval('document.'+div_name+'.document.'+div_name) : "";
	if (document.getElementById||document.all)
		menuobj.innerHTML=t;
	else if (document.layers){
		menuobj.document.write(t);
		menuobj.document.close();
	}
}


function countdown(toDate, locn)
{
	today = new Date();
	todayTime = today.getTime();

	targ = new Date(toDate);
	targetTime = targ.getTime();

	days = targetTime - todayTime;

	daysL = days / 86400000;
	days %= 86400000;
	hrsL = days / 3600000;
	days %= 3600000;
	minsL = days / 60000;
	days %= 60000;
	secL = days / 1000;

	if (Math.floor(daysL)>1) {

		dStr = "Only " + Math.floor(daysL) + " Days Left!";
	
	} else {
		//dStr = "Only " + Math.floor(hrsL) + " Hour" + ( Math.floor(hrsL)>1?"s":"") + " Left!";
	}
			
	
	if(days <= 0) dStr = "Free Preview Period Has Ended!";

	document.getElementById(locn).value = dStr;

	ID = window.setTimeout("countdown('" + toDate + "', '" + locn + "')", 1000);
}



//-->
