if (document.all) {
IE=1; NN=0;
//document.onselectstart=new Function ("return false");
}
else if (document.getElementById) {
NN=1; IE=0;
//document.onmousedown=function(e) {return false;};
//document.onclick=function() {return false;};
}
else {
IE=0;NN=0
};
/*Browser specific functions */
function ith_getElementById(id) {
if (NN) return document.getElementById(id);
else if (IE) return document.all[id];
}
function myDiagram(data, datadate)
{
this.datas = data;
this.date = datadate;
this.day = this.date.getUTCDay();
this.days = this.date.getUTCDate();
this.month = this.date.getMonth();
this.year = this.date.getUTCFullYear();
this.RoundUp = 100;
this.setPosition=function(top, left)
{
this.PositionTop = top;
this.PositionLeft = left;
}
this.setCoordinate=function (x,y) {
var divtext="", PosTop;
this.x = x;
this.y = y;
PosTop = y + this.PositionTop;
divtext="
";
document.write(divtext);
divtext="";
document.write(divtext);
return(this);
}
this.xtitle=function(str_xtitle){
var divtext="", xs_lpos, xs_tpos;
xs_lpos = parseFloat(ith_getElementById(this.id+'x').style.width) + this.PositionLeft + 10;
xs_tpos = parseFloat(ith_getElementById(this.id+'y').style.height) + this.PositionTop;
divtext=""+str_xtitle+"
"
document.write(divtext);
return(this);
}
this.xscale=function(str_xscale, languageId){
var divtext="", i, ii, xs_lpos, d, xs_tpos, xs_width, counter = 0, realday = 0, realmonth = (this.month + 1), prevmonthdays, realmonthdays;
if (str_xscale=="month")
{
var tmp_date = this.date.addDays(-30);
tmp_date = tmp_date.addDays(1);
counter = tmp_date.getDate();
for (i=1; i<=30; i++)
{
xs_lpos = ((parseFloat(ith_getElementById(this.id+'x').style.width) / 30) * i) + this.PositionLeft - parseFloat(ith_getElementById(this.id+'x').style.width) / 30;
xs_tpos = (parseFloat(ith_getElementById(this.id+'y').style.height) + this.PositionTop);
xs_width = parseFloat(ith_getElementById(this.id+'x').style.width) / 30;
if (tmp_date.getUTCDay() == 5 || tmp_date.getUTCDay() == 6) {
divtext=""+counter+"
";
document.write(divtext);
}
else {
divtext=""+counter+"
";
document.write(divtext);
}
tmp_date = tmp_date.addDays(1); //this.date.addDays(-30 + i);
counter = tmp_date.getDate();
}
for (i=0; i<=30; i++)
{
xs_lpos = ((parseFloat(ith_getElementById(this.id+'x').style.width) / 30) * i) + this.PositionLeft;
xs_tpos = (parseFloat(ith_getElementById(this.id+'y').style.height) + this.PositionTop - 5);
divtext="";
document.write(divtext);
}
}
if (str_xscale=="week")
{
switch(languageId)
{
case 0 :
ii = new Array("Vasárnap", "Hétfő", "Kedd", "Szerda", "Csütörtök", "Péntek", "Szombat")
break
case 1 :
ii = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")
break
default :
ii = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")
break
}
var tmp_date = this.date.addDays(-7);
tmp_date = tmp_date.addDays(1);
realday = tmp_date.getDay();
for (i=0; i<=ii.length-1; i++)
{
if (realday > 6) realday = realday - 7;
counter++;
xs_lpos = ((parseFloat(ith_getElementById(this.id+'x').style.width) / ii.length) * counter) + this.PositionLeft - parseFloat(ith_getElementById(this.id+'x').style.width) / ii.length;
xs_tpos = (parseFloat(ith_getElementById(this.id+'y').style.height) + this.PositionTop);
xs_width = parseFloat(ith_getElementById(this.id+'x').style.width) / ii.length;
if (realday == 6 || realday == 0) {
divtext=""+ii[realday]+"
";
document.write(divtext);
}
else {
divtext=""+ii[realday]+"
";
document.write(divtext);
}
realday = tmp_date.getDay() + counter
}
for (i=0; i<=ii.length; i++)
{
xs_lpos = ((parseFloat(ith_getElementById(this.id+'x').style.width) / ii.length ) * i) + this.PositionLeft;
xs_tpos = (parseFloat(ith_getElementById(this.id+'y').style.height) + this.PositionTop - 5);
divtext="";
document.write(divtext);
}
}
if (str_xscale=="year")
{
switch(languageId)
{
case 0 :
ii = new Array("Jan", "Feb", "Már", "Ápr", "Máj", "Jún", "Júl", "Aug", "Szept", "Okt", "Nov", "Dec")
break
case 1 :
ii = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec")
break
default :
ii = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec")
break
}
for (i=0; i<=ii.length-1; i++)
{
if (realmonth > 11) realmonth = realmonth - 12;
counter++;
xs_lpos = ((parseFloat(ith_getElementById(this.id+'x').style.width) / ii.length) * counter) + this.PositionLeft - parseFloat(ith_getElementById(this.id+'x').style.width) / ii.length;
xs_tpos = (parseFloat(ith_getElementById(this.id+'y').style.height) + this.PositionTop);
xs_width = parseFloat(ith_getElementById(this.id+'x').style.width) / ii.length;
divtext=""+ii[realmonth]+"
";
document.write(divtext);
realmonth = (this.month + 1) + counter
}
for (i=0; i<=ii.length; i++)
{
xs_lpos = ((parseFloat(ith_getElementById(this.id+'x').style.width) / ii.length ) * i) + this.PositionLeft;
xs_tpos = (parseFloat(ith_getElementById(this.id+'y').style.height) + this.PositionTop - 5);
divtext="";
document.write(divtext);
}
} return(this);
}
this.yscale=function(yscale, fullwidth, linecolor)
{
var divtext="", ys_lpos, ys_tpos, i, ys_width, yt_tpos, yl_pos, maxyscale, yscaletitle;
var max = this.datas[0];
for (i = 1; i <= data.length; i++) {
if (max < data[i]) {max = data[i]}
}
if (fullwidth)
{
ys_width = parseFloat(ith_getElementById(this.id+'x').style.width) + 5;
for (i=0; i<=yscale; i++)
{
ys_lpos = this.PositionLeft - 5;
ys_tpos = ((parseFloat(ith_getElementById(this.id+'y').style.height) / yscale) * i) + this.PositionTop;
divtext="";
document.write(divtext);
}
}
ys_width = 11;
for (i=0; i<=yscale; i++)
{
ys_lpos = this.PositionLeft - 5;
ys_tpos = ((parseFloat(ith_getElementById(this.id+'y').style.height) / yscale) * i) + this.PositionTop;
divtext="";
document.write(divtext);
}
for (i=0; i<=yscale; i++)
{
yt_lpos = this.PositionLeft - 38;
yt_tpos = ((parseFloat(ith_getElementById(this.id+'y').style.height) / yscale) * i) + this.PositionTop - 8;
maxyscale = (Math.round(((max) / this.RoundUp) + 0.5) * this.RoundUp);
yscaletitle = Math.round((maxyscale / yscale) * (yscale - i))
this.ymax = maxyscale;
divtext=""+yscaletitle+"
";
document.write(divtext);
}
return(this);
}
this.DrawBox = function(boxwidth, boximg1, boximg2)
{
var divtext="", box_top, box_left, i, box_height, box_width, counter=0, pre, nex;
var oneUnit = parseFloat(ith_getElementById(this.id+'y').style.height) / this.ymax;
var max = this.datas[0];
for (i = 1; i <= data.length; i++) {
if (max < data[i]) {max = data[i]}
}
for (i = 0; i <= this.datas.length-1; i++)
{
counter++
pre = this.id+"xscaleline"+i
nex = this.id+"xscaleline"+counter
box_left = parseFloat(ith_getElementById(pre).style.left);
img_left = (((parseFloat(ith_getElementById(nex).style.left) - parseFloat(ith_getElementById(pre).style.left)) - boxwidth) / 2) + box_left;
box_height = (oneUnit * this.datas[i]);
box_top = Math.round(this.y - box_height + 0.5);
box_width = Math.round(parseFloat(ith_getElementById(this.id+'x').style.width) / this.datas.length);
if (i%2==0)
divtext="";
else
divtext="";
document.write(divtext);
}
return(this);
}
this.setBackGround = function(bgpic)
{
var divtext="", img_top, img_left, img_height, img_width;
img_top = this.PositionTop;
img_left = this.PositionLeft + 1;
img_height = ith_getElementById(this.id+'y').style.height;
img_width = ith_getElementById(this.id+'x').style.width;
divtext="";
document.write(divtext);
return(this);
}
this.DiagramTitle = function(Dtitle)
{
var divtext="", title_left = this.PositionLeft + 1, title_top = this.PositionTop - 20;
divtext="" + Dtitle + "
";
document.write(divtext);
return(this);
}
}