function write_dstimeall()
        {
        var dsmin, dshour, dssec, out_time;
        dshour=Math.floor(dstimeall/3600);
        dsmin=Math.floor((dstimeall-dshour*3600)/60);
        dssec=Math.floor(dstimeall-dsmin*60-dshour*3600);
        if (dsmin<0) dsmin=0;
        if (dshour<0) dshour=0;
        if (dssec<0) dssec=0;
        out_time='';
        out_time+=dshour+':';
        if (dsmin<10){out_time+= '0'}
        out_time+=dsmin+':';
        if (dssec<10){out_time+= '0'}
        out_time+=dssec;
        document.all.dstimeall.innerHTML=out_time;
        dstimeall=dstimeall+1;
        if (dstimeall>=86400) dstimeall=0;
        setTimeout('write_dstimeall()', 1000);
        }
function getPageOffsetTop(el) {

  var y;

  // Return the x coordinate of an element relative to the page.

  y = el.offsetTop;
  if (el.offsetParent != null)
    y += getPageOffsetTop(el.offsetParent);

  return y;
}

function getPageOffsetLeft(el) {

  var x;

  // Return the x coordinate of an element relative to the page.

  x = el.offsetLeft;
  if (el.offsetParent != null)
    x += getPageOffsetLeft(el.offsetParent);

  return x;
}

function GetTimeByVal(){
  var timex=1;
  if (gr_form.r1.checked){timex=1;}
  else{
  	if(gr_form.r2.checked){timex=2;}
  	else{
  		if(gr_form.r3.checked){timex=3;}
  		else{
  			if(gr_form.r4.checked){timex=4;}
	  		else{
					if(gr_form.r5.checked){timex=5;}
        }
  		}
  	}
  }
  return timex;
}

function BuildGraphix(lang,md){
	var s1='',s2='',s3='';
	var val=false;
	var timex=GetTimeByVal();
	var fund=gr_form.fund_x.value;
	if (md==''){
		s3=gr_form.m_y.value+'-'+gr_form.m_m.value+'-'+gr_form.m_d.value;
	}else{
    s3=md;
  }
	if(timex==5){
    s1=gr_form.p_y1.value+'-'+gr_form.p_m1.value+'-'+gr_form.p_d1.value;
    s2=gr_form.p_y2.value+'-'+gr_form.p_m2.value+'-'+gr_form.p_d2.value;
    document.graphix.src='../graph/scha_graph_date.php?lang='+lang+'&sx=400&sy=400&fund='+fund+'&time='+timex+'&d1='+s1+'&d2='+s2+'&d3='+s3;
	}else{
	  document.graphix.src='../graph/scha_graph_date.php?lang='+lang+'&sx=400&sy=400&fund='+fund+'&time='+timex+'&d3='+s3;
  }
}
