﻿function display(text,dv)
{
document.getElementById(dv).innerHTML = text;

}
function displaycontent(text,dv)
{
document.getElementById(dv).innerHTML = text;
}


function showtr(tr,img)
 {
var img = document.getElementById(img);


var e = document.getElementById(tr);
if(e.style.display == 'none')
{
e.style.display = 'block';
img.src="calendar/minus.gif"
}
else
{
e.style.display = 'none';
img.src="calendar/plus.gif"
}
}
function visibility(sp) {

sp.style.color='#FF6600';

}
function novisibility(sp) {

sp.style.color='black';


}

function displaybody(text,dv)
{
document.getElementById(dv).innerHTML = text;
}
function retupgn(form) {
A = form.A.value * 1;
B = form.B.value * 1;

  dist=Math.round((B-A)*Math.pow(10,4))/10000;
ret1=Math.round((B-0.125*dist)*Math.pow(10,4))/10000;
ret2=Math.round((B-0.25*dist)*Math.pow(10,4))/10000;
ret3=Math.round((B-0.37*dist)*Math.pow(10,4))/10000;
ret4=Math.round((B-0.50*dist)*Math.pow(10,4))/10000;
ret5=Math.round((B-0.625*dist)*Math.pow(10,4))/10000;
ret6=Math.round((B-1.75*dist)*Math.pow(10,4))/10000;
ret7=Math.round((B-1.875*dist)*Math.pow(10,4))/10000;


form.result1.value = ret1;
form.result2.value = ret2;
form.result3.value = ret3;
form.result4.value = ret4;
form.result5.value = ret5;
form.result6.value = ret6;
form.result7.value = ret7;
}
function retup(form) {
A = form.A.value * 1;
B = form.B.value * 1;


dist=Math.round((B-A)*Math.pow(10,4))/10000;
ret1=Math.round((B-0.236*dist)*Math.pow(10,4))/10000;
ret2=Math.round((B-0.382*dist)*Math.pow(10,4))/10000;
ret3=Math.round((B-0.5*dist)*Math.pow(10,4))/10000;
ret4=Math.round((B-0.618*dist)*Math.pow(10,4))/10000;
ret5=Math.round((B-0.786*dist)*Math.pow(10,4))/10000;
ret6=Math.round((B-1.382*dist)*Math.pow(10,4))/10000;
ret7=Math.round((B-1.618*dist)*Math.pow(10,4))/10000;


form.result1.value = ret1;
form.result2.value = ret2;
form.result3.value = ret3;
form.result4.value = ret4;
form.result5.value = ret5;
form.result6.value = ret6;
form.result7.value = ret7;
}

function projup(form) {
A = form.A.value * 1;
B = form.B.value * 1;
C = form.C.value * 1;

dist=Math.round((B-A)*Math.pow(10,4))/10000;
ret1=Math.round((C+0.618*dist)*Math.pow(10,4))/10000;
ret2=Math.round((C+1*dist)*Math.pow(10,4))/10000;
ret3=Math.round((C+1.382*dist)*Math.pow(10,4))/10000;
ret4=Math.round((C+1.618*dist)*Math.pow(10,4))/10000;
ret5=Math.round((C+2*dist)*Math.pow(10,4))/10000;
ret6=Math.round((C+2.618*dist)*Math.pow(10,4))/10000;


form.result1.value = ret1;
form.result2.value = ret2;
form.result3.value = ret3;
form.result4.value = ret4;
form.result5.value = ret5;
form.result6.value = ret6;
}
function projdown(form) {
A = form.A.value * 1;
B = form.B.value * 1;
C = form.C.value * 1;

dist=Math.round((A-B)*Math.pow(10,4))/10000;
ret1=Math.round((C-0.618*dist)*Math.pow(10,4))/10000;
ret2=Math.round((C-1*dist)*Math.pow(10,4))/10000;
ret3=Math.round((C-1.382*dist)*Math.pow(10,4))/10000;
ret4=Math.round((C-1.618*dist)*Math.pow(10,4))/10000;
ret5=Math.round((C-2*dist)*Math.pow(10,4))/10000;
ret6=Math.round((C-2.618*dist)*Math.pow(10,4))/10000;


form.result1.value = ret1;
form.result2.value = ret2;
form.result3.value = ret3;
form.result4.value = ret4;
form.result5.value = ret5;
form.result6.value = ret6;
}
function retdowngn(form) {
A = form.A.value * 1;
B = form.B.value * 1;

dist=Math.round((A-B)*Math.pow(10,4))/10000;
ret1=Math.round((B+0.125*dist)*Math.pow(10,4))/10000;
ret2=Math.round((B+0.25*dist)*Math.pow(10,4))/10000;
ret3=Math.round((B+0.37*dist)*Math.pow(10,4))/10000;
ret4=Math.round((B+0.50*dist)*Math.pow(10,4))/10000;
ret5=Math.round((B+0.625*dist)*Math.pow(10,4))/10000;
ret6=Math.round((B+1.75*dist)*Math.pow(10,4))/10000;
ret7=Math.round((B+1.875*dist)*Math.pow(10,4))/10000;


form.result1.value = ret1;
form.result2.value = ret2;
form.result3.value = ret3;
form.result4.value = ret4;
form.result5.value = ret5;
form.result6.value = ret6;
form.result7.value = ret7;
}
function retdown(form) {
A = form.A.value * 1;
B = form.B.value * 1;

dist=Math.round((A-B)*Math.pow(10,4))/10000;
ret1=Math.round((B+0.236*dist)*Math.pow(10,4))/10000;
ret2=Math.round((B+0.382*dist)*Math.pow(10,4))/10000;
ret3=Math.round((B+0.5*dist)*Math.pow(10,4))/10000;
ret4=Math.round((B+0.618*dist)*Math.pow(10,4))/10000;
ret5=Math.round((B+0.786*dist)*Math.pow(10,4))/10000;
ret6=Math.round((B+1.382*dist)*Math.pow(10,4))/10000;
ret7=Math.round((B+1.618*dist)*Math.pow(10,4))/10000;


form.result1.value = ret1;
form.result2.value = ret2;
form.result3.value = ret3;
form.result4.value = ret4;
form.result5.value = ret5;
form.result6.value = ret6;
form.result7.value = ret7;
}
function pivots(form) {
high1 = form.high.value * 1;
low1 = form.low.value * 1;
close1 = form.close.value * 1;

pivot = Math.round(((high1 + low1 + close1) / 3) * Math.pow(10,4)) / 10000;
r1 = Math.round((2 * pivot - low1) * Math.pow(10,4)) / 10000;
s1 = Math.round((2 * pivot - high1) * Math.pow(10,4)) / 10000;
r2 = Math.round((pivot - s1 + r1) * Math.pow(10,4)) / 10000;
s2 = Math.round((pivot - (r1 - s1)) * Math.pow(10,4)) / 10000;
r3 = Math.round((2 * (pivot - low1) + high1) * Math.pow(10,4)) / 10000;
s3 = Math.round((low1 - (2 * (high1 - pivot))) * Math.pow(10,4)) / 10000;

form.result6.value = r3;
form.result.value = r2;
form.result2.value = r1;
form.result3.value = pivot;
form.result4.value = s1;
form.result5.value = s2;
form.result7.value = s3;
}


function cal()
{

RM.value=(R.value*B.value)/100;
OL.value=(R.value*B.value)/(S.value*P.value*100);
CE.value=(B.value-RM.value);

}
function resetall()
{

B.value=0;
R.value=0;
S.value=0;
P.value=10;
OL.value=0;
RM.value=0;
CE.value=0;

}

function cal1()
{

RP.value=(S1.value*NL.value*P1.value)*100/B1.value;
RM1.value=(RP.value*B1.value)/100;
CE1.value=(B1.value-RM1.value);

}
function resetall1()
{

B1.value=0;
RP.value=0;
S1.value=0;
P1.value=10;
NL.value=0;
RM1.value=0;
CE1.value=0;

}
function cal2()
{

OL2.value=(B2.value*RP2.value)/(P2.value*NL2.value*100);
RM2.value=(RP2.value*B2.value)/100;
CE2.value=(B2.value-RM2.value);

}
function resetall2()
{

B2.value=0;
RP2.value=0;
NL2.value=0;
P2.value=10;
OL2.value=0;
RM2.value=0;
CE2.value=0;

}
function cal3()
{

RR.value=(LPP.value-OP.value)/(OP.value-SLP.value);


}
function resetall3()
{

RR.value=0;
LPP.value=0;
OP.value=0;
SLP.value=0;


}
function clearfield(field)
{
field.value="";

}

