function swon (imagename, cacheimage)
{
  document.images[imagename].src =  eval(cacheimage + ".src");                
}
function addBookmark(url, title) 
{
  if (window.sidebar) 
  {
    window.sidebar.addPanel(title, url,""); 
  } 
  else if( window.external ) 
  {
    window.external.AddFavorite(url, title);
  } 
  else if( window.opera && window.print ) 
  {
//    return true;
  }
}
function maximize ()
{
  window.moveTo(screen.availTop, screen.availLeft);
  window.resizeTo(screen.availWidth, screen.availHeight);
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
if(top.frames.length > 0) {top.location.href=self.location;}

var got = 0;
var agt=navigator.userAgent.toLowerCase(); 

var g_hasAll = (document.all);
var g_hasGetElement = (document.getElementById);

var is_ie   = (agt.indexOf("msie") != -1); 
var is_opera = (agt.indexOf("opera") != -1); 

if(!window.saveInnerWidth) {
  window.onresize = resizeIt;
  window.saveInnerWidth = window.innerWidth;
  window.saveInnerHeight = window.innerHeight;
}

function resizeIt() {
    if (saveInnerWidth < window.innerWidth || 
        saveInnerWidth > window.innerWidth || 
        saveInnerHeight > window.innerHeight || 
        saveInnerHeight < window.innerHeight ) 
    {
        window.history.go(0);
    }
}

function changeUrl(url)
{
    window.location.replace(url);
}

function getPageOffsetLeft(el) {

  var x = el.offsetLeft;
  if (el.offsetParent != null)
    x += getPageOffsetLeft(el.offsetParent);
  return x;
}
function checkPolls(formname) {
        var resx = 0;
        form = document.forms[formname];
        for(a = 0; a < form.length; a++) {
                if (form.elements[a].checked == true) resx = 1;
        }
        if (resx == 1) return true;
        else alert("Вы не выбрали ответ!");
        return false;
}
function LoadGraph( domen, interval, flag, text, timing, obj, position ) {
        var o = document.getElementById('c_graph');
        var bText = document.getElementById('box' + curr_id);
        var a = document.getElementById( obj );
        if (last1)
        {
          last_top_object = document.getElementById(last1);
          last1 = null;
        }
        if (last2)
        {
          last_bottom_object = document.getElementById(last2);
          last2 = null;
        }
        switch (position) {

            case 'top':
                if (last_top_object != null)
                {
                  last_top_object.style.color = '';
                  last_top_object.className = 'mmenu';
                }
                last_top_object = a;
            break;

            case 'bottom':
                if (last_bottom_object != null)
                {
                  last_bottom_object.style.color = '';
                  last_bottom_object.className = 'mmenu';
                }
                last_bottom_object = a;
            break;
        }
        a.className = 'mmenu_hover';
        a.style.color  = '#FF963B';

        var d = new Date();
        var temp = '';

        if (domen == '') domen = curr_domen;
        else curr_domen = domen;

        if (interval == '') interval = curr_ival;
        else curr_ival = interval;

        if (flag == '') flag = curr_flag;
        else curr_flag = flag;

        if (text == '') text = curr_text;
        else curr_text = text;

        if (timing == '') timing = curr_timing;
        else curr_timing = timing;


        bText.innerHTML = '<img src="/img/content/f_'+ flag +'.gif" width="14" height="10" border="0" alt="" />&nbsp; ' + pre_text + ' - ' + text;

        temp = '/img/charts/' + domen + interval + '250x145x4.gif?' + d.getMilliseconds();

        o.src = temp;
    }
function pop_up_open(symbol)
{
window.open('/exec/symbol.php?s='+symbol,'','left=200,top=100,width=650,height=350');
}
