function openTickerPopup(ticker,market) {
  var url = "";
  url = "../symbol_stat.jsp?ticker="+ticker.toUpperCase() + "&market="+market;
  parent.location = url;
}

function openTickerNewsBody(id, market,ticker) {
  //alert("In openTickerNewsBody" + ticker);
  if (screen) {
    url = '../newsbody.jsp?id='+id + '&market='+market + '&ticker='+ticker;
    parent.location = url;
  }
}

function openTickerNewsBodyFromPopup(index, market, page) {
  //alert("In openTickerNewsBody");
  if (screen) {
    url = 'news_body.jsp?id='+index+'&page='+page;
    parent.location = url;
  }
}

function openLink(linkU) {
   if (screen) {
     url = linkU;
     sHeight = screen.height;
     sWidth = screen.width;
     wHeight = 530;    //new window height 730
     wWidth = 650;     //new window width
     wLeft = (sWidth - wWidth) / 2;  //left position
     wTop = (sHeight - wHeight) / 2; //top position
     //var win = window.open(url, "", "left=" + wLeft + ",top=" + wTop + ",width=" + wWidth + ",height=" + wHeight + ",scrollbars=yes,resizeable=yes");
     var win = window.open(url);
     win.focus();
   }
}

function openLinkSmWin(linkU) {
   if (screen) {
    url = linkU;
    sHeight = screen.height;
    sWidth = screen.width;
    wHeight = 530;    //new window height 730
    wWidth = 650;     //new window width
    wLeft = (sWidth - wWidth) / 2;  //left position
    wTop = (sHeight - wHeight) / 2; //top position
    var win = window.open(url, "", "left=" + wLeft + ",top=" + wTop + ",width=" + wWidth + ",height=" + wHeight + ",scrollbars=yes,resizeable=yes");
    win.focus();
   }
}

function openLinkSmWin(linkU,market) {
  if (screen) {
   url = linkU + '&market='+market;
   sHeight = screen.height;
   sWidth = screen.width;
   wHeight = 530;    //new window height 730
   wWidth = 650;     //new window width
   wLeft = (sWidth - wWidth) / 2;  //left position
   wTop = (sHeight - wHeight) / 2; //top position
   var win = window.open(url, "", "left=" + wLeft + ",top=" + wTop + ",width=" + wWidth + ",height=" + wHeight + ",scrollbars=yes,resizeable=yes");
   win.focus();
  }
}

function ClipBoard(){
  document.forms.form1.text_area.focus();
  document.forms.form1.text_area.select();
  Copied = document.forms.form1.text_area.createTextRange();
  Copied.execCommand("Copy");
}

function validateInputDate() {
  //alert("validateInputDate");
  var f = true;

  var text = /\w+/;
  var form = document.form1;

  if(form.date.value == "" || form.date.value.match(text) == null){
    //alert("Please enter date as YYYYMMDD");
    form.name.focus();
  }
  else
    form.submit();
}
