var yourGroupNumber = 0;
var period_element=new Array();
period_element[0]="H";
period_element[1]="He";
period_element[2]="Li";
period_element[3]="Be";
period_element[4]="B";
period_element[5]="C";
period_element[6]="N";
period_element[7]="O";
period_element[8]="F";
period_element[9]="Ne";
period_element[10]="Na";
period_element[11]="Mg";
period_element[12]="Al";
period_element[13]="Si";
period_element[14]="P";
period_element[15]="S";
period_element[16]="Cl";
period_element[17]="Ar";
period_element[18]="K";
period_element[19]="Ca";
period_element[20]="Sc";
period_element[21]="Ti";
period_element[22]="V";
period_element[23]="Cr";
period_element[24]="Mn";
period_element[25]="Fe";
period_element[26]="Co";
period_element[27]="Ni";
period_element[28]="Cu";
period_element[29]="Zn";
period_element[30]="Ga";
period_element[31]="Ge";
period_element[32]="As";
period_element[33]="Se";
period_element[34]="Br";
period_element[35]="Kr";
period_element[36]="Rb";
period_element[37]="Sr";
period_element[38]="Y";
period_element[39]="Zr";
period_element[40]="Nb";
period_element[41]="Mo";
period_element[42]="Tc";
period_element[43]="Ru";
period_element[44]="Rh";
period_element[45]="Pd";
period_element[46]="Ag";
period_element[47]="Cd";
period_element[48]="In";
period_element[49]="Sn";
period_element[50]="Sb";
period_element[51]="Te";
period_element[52]="I";
period_element[53]="Xe";
period_element[54]="Cs";
period_element[55]="Ba";
period_element[56]="La";
period_element[57]="Ce";
period_element[58]="Pr";
period_element[59]="Nd";
period_element[60]="Pm";
period_element[61]="Sm";
period_element[62]="Eu";
period_element[63]="Gd";
period_element[64]="Tb";
period_element[65]="Dy";
period_element[66]="Ho";
period_element[67]="Er";
period_element[68]="Tm";
period_element[69]="Yb";
period_element[70]="Lu";
period_element[71]="Hf";
period_element[72]="Ta";
period_element[73]="W";
period_element[74]="Re";
period_element[75]="Os";
period_element[76]="Ir";
period_element[77]="Pt";
period_element[78]="Au";
period_element[79]="Hg";
period_element[80]="Tl";
period_element[81]="Pb";
period_element[82]="Bi";
period_element[83]="Po";
period_element[84]="At";
period_element[85]="Rn";
period_element[86]="Fr";
period_element[87]="Ra";
period_element[88]="Ac";
period_element[89]="Th";
period_element[90]="Pa";
period_element[91]="U";
period_element[92]="Np";
period_element[93]="Pu";
period_element[94]="Am";
period_element[95]="Cm";
period_element[96]="Bk";
period_element[97]="Cf";
period_element[98]="Es";
period_element[99]="Fm";
period_element[100]="Md";
period_element[101]="No";
period_element[102]="Lw";

var atom_name=new Array();
atom_name[0] = "Hydrogen";
atom_name[1] = "Helium";
atom_name[2] = "Lithium";
atom_name[3] = "Beryllium";
atom_name[4] = "Boron";
atom_name[5] = "Carbon";
atom_name[6] = "Nitrogen";
atom_name[7] = "Oxygen";
atom_name[8] = "Fluorine";
atom_name[9] = "Neon";
atom_name[10] = "Sodium";
atom_name[11] = "Magnesium";
atom_name[12] = "Aluminium";
atom_name[13] = "Silicon";
atom_name[14] = "Phosphorus";
atom_name[15] = "Sulfur";
atom_name[16] = "Chlorine";
atom_name[17] = "Argon";
atom_name[18] = "Potassium";
atom_name[19] = "Calcium";
atom_name[20] = "Scandium";
atom_name[21] = "Titanium";
atom_name[22] = "Vanadium";
atom_name[23] = "Chromium";
atom_name[24] = "Manganese";
atom_name[25] = "Iron";
atom_name[26] = "Cobalt";
atom_name[27] = "Nickel";
atom_name[28] = "Copper";
atom_name[29] = "Zinc";
atom_name[30] = "Gallium";
atom_name[31] = "Germanium";
atom_name[32] = "Arsenic";
atom_name[33] = "Selenium";
atom_name[34] = "Bromine";
atom_name[35] = "Krypton";
atom_name[36] = "Rubidium";
atom_name[37] = "Strontium";
atom_name[38] = "Yttrium";
atom_name[39] = "Zirconium";
atom_name[40] = "Niobium";
atom_name[41] = "Molybdenum";
atom_name[42] = "Technetium";
atom_name[43] = "Ruthenium";
atom_name[44] = "Rhodium";
atom_name[45] = "Palladium";
atom_name[46] = "Silver";
atom_name[47] = "Cadmium";
atom_name[48] = "Indium";
atom_name[49] = "Tin";
atom_name[50] = "Antimony";
atom_name[51] = "Tellurium";
atom_name[52] = "Iodine";
atom_name[53] = "Xenon";
atom_name[54] = "Caesium";
atom_name[55] = "Barium";
atom_name[56] = "Lanthanum";
atom_name[57] = "Cerium";
atom_name[58] = "Praseodymium";
atom_name[59] = "Neodymium";
atom_name[60] = "Promethium";
atom_name[61] = "Samarium";
atom_name[62] = "Europium";
atom_name[63] = "Gadolinium";
atom_name[64] = "Terbium";
atom_name[65] = "Dysprosium";
atom_name[66] = "Holmium";
atom_name[67] = "Erbium";
atom_name[68] = "Thulium";
atom_name[69] = "Ytterbium";
atom_name[70] = "Lutetium";
atom_name[71] = "Hafnium";
atom_name[72] = "Tantalum";
atom_name[73] = "Tungsten";
atom_name[74] = "Rhenium";
atom_name[75] = "Osmium";
atom_name[76] = "Iridium";
atom_name[77] = "Platinum";
atom_name[78] = "Gold";
atom_name[79] = "Mercury";
atom_name[80] = "Thallium";
atom_name[81] = "Lead";
atom_name[82] = "Bismuth";
atom_name[83] = "Polonium";
atom_name[84] = "Astatine";
atom_name[85] = "Radon";
atom_name[86] = "Francium";
atom_name[87] = "Radium";
atom_name[88] = "Actinium";
atom_name[89] = "Thorium";
atom_name[90] = "Protactinium";
atom_name[91] = "Uranium";
atom_name[92] = "Neptunium";
atom_name[93] = "Plutonium";
atom_name[94] = "Americium";
atom_name[95] = "Curium";
atom_name[96] = "Berkelium";
atom_name[97] = "Californium";
atom_name[98] = "Einsteinium";
atom_name[99] = "Fermium";
atom_name[100] = "Mendelevium";
atom_name[101] = "Nobelium";
atom_name[102] = "Lawrencium";

var chinese_symble = new Array();
chinese_symble[0] = "Çâ";
chinese_symble[1] = "º¤";
chinese_symble[2] = "ï®";
chinese_symble[3] = "îë";
chinese_symble[4] = "Åð";
chinese_symble[5] = "Ì¼";
chinese_symble[6] = "µª";
chinese_symble[7] = "Ñõ";
chinese_symble[8] = "·ú";
chinese_symble[9] = "ÄÊ";
chinese_symble[10] = "ÄÆ";
chinese_symble[11] = "Ã¾";
chinese_symble[12] = "ÂÁ";
chinese_symble[13] = "¹è";
chinese_symble[14] = "Á×";
chinese_symble[15] = "Áò";
chinese_symble[16] = "ÂÈ";
chinese_symble[17] = "ë²";
chinese_symble[18] = "¼Ø";
chinese_symble[19] = "¸Æ";
chinese_symble[20] = "îÖ";
chinese_symble[21] = "îÑ";
chinese_symble[22] = "·°";
chinese_symble[23] = "¸õ";
chinese_symble[24] = "ÃÌ";
chinese_symble[25] = "Ìú";
chinese_symble[26] = "îÜ";
chinese_symble[27] = "Äø";
chinese_symble[28] = "Í­";
chinese_symble[29] = "Ð¿";
chinese_symble[30] = "ïØ";
chinese_symble[31] = "Õà";
chinese_symble[32] = "Éé";
chinese_symble[33] = "Îø";
chinese_symble[34] = "äå";
chinese_symble[35] = "ë´";
chinese_symble[36] = "ï¨";
chinese_symble[37] = "ïÈ";
chinese_symble[38] = "îÆ";
chinese_symble[39] = "ï¯";
chinese_symble[40] = "îê";
chinese_symble[41] = "îâ";
chinese_symble[42] = "ï½";
chinese_symble[43] = "îÉ";
chinese_symble[44] = "îî";
chinese_symble[45] = "îÙ";
chinese_symble[46] = "Òø";
chinese_symble[47] = "ïÓ";
chinese_symble[48] = "î÷";
chinese_symble[49] = "Îý";
chinese_symble[50] = "Ìà";
chinese_symble[51] = "íÚ";
chinese_symble[52] = "µâ";
chinese_symble[53] = "ë¯";
chinese_symble[54] = "ï¤";
chinese_symble[55] = "±µ";
chinese_symble[56] = "ïç";
chinese_symble[57] = "îæ";
chinese_symble[58] = "ïè";
chinese_symble[59] = "îÏ";
chinese_symble[60] = "îÞ";
chinese_symble[61] = "îÌ";
chinese_symble[62] = "îð";
chinese_symble[63] = "îÅ";
chinese_symble[64] = "ï«";
chinese_symble[65] = "ïá";
chinese_symble[66] = "îØ";
chinese_symble[67] = "îï";
chinese_symble[68] = "îû";
chinese_symble[69] = "ïî";
chinese_symble[70] = "ïå";
chinese_symble[71] = "îþ";
chinese_symble[72] = "îã";
chinese_symble[73] = "ÎÙ";
chinese_symble[74] = "ïª";
chinese_symble[75] = "ï°";
chinese_symble[76] = "Ò¿";
chinese_symble[77] = "²¬";
chinese_symble[78] = "½ð";
chinese_symble[79] = "¹¯";
chinese_symble[80] = "îè";
chinese_symble[81] = "Ç¦";
chinese_symble[82] = "îé";
chinese_symble[83] = "îÇ";
chinese_symble[84] = "íÁ";
chinese_symble[85] = "ë±";
chinese_symble[86] = "îÕ";
chinese_symble[87] = "ÀØ";
chinese_symble[88] = "ï¹";
chinese_symble[89] = "îÊ";
chinese_symble[90] = "ïä";
chinese_symble[91] = "ÓË";
chinese_symble[92] = "ïÕ";
chinese_symble[93] = "îÐ";
chinese_symble[94] = "ïÑ";
chinese_symble[95] = "ï¸";
chinese_symble[96] = "ïÂ";
chinese_symble[97] = "ï´";
chinese_symble[98] = "ïÍ";
chinese_symble[99] = "ïÐ";
chinese_symble[100] = "îÍ";
chinese_symble[101] = "ï»";
chinese_symble[102] = "ï©";

var atom_weight=new Array();
atom_weight[0]=1.00794;
atom_weight[1]=4.002602;
atom_weight[2]=6.941;
atom_weight[3]=9.012182;
atom_weight[4]=10.811;
atom_weight[5]=12.0107;
atom_weight[6]=14.0067;
atom_weight[7]=15.9994;
atom_weight[8]=18.9984032;
atom_weight[9]=20.1797;
atom_weight[10]=22.98977;
atom_weight[11]=24.3050;
atom_weight[12]=26.981538;
atom_weight[13]=28.0855;
atom_weight[14]=30.973761;
atom_weight[15]=32.065;
atom_weight[16]=35.453;
atom_weight[17]=39.948;
atom_weight[18]=39.0983;
atom_weight[19]=40.078;
atom_weight[20]=44.955910;
atom_weight[21]=47.867;
atom_weight[22]=50.9415;
atom_weight[23]=51.9961;
atom_weight[24]=54.938049;
atom_weight[25]=55.845;
atom_weight[26]=58.933200;
atom_weight[27]=58.6934;
atom_weight[28]=63.546;
atom_weight[29]=65.409;
atom_weight[30]=69.723;
atom_weight[31]=72.64;
atom_weight[32]=74.9216;
atom_weight[33]=78.96;
atom_weight[34]=79.904;
atom_weight[35]=83.798;
atom_weight[36]=85.4678;
atom_weight[37]=87.62;
atom_weight[38]=88.90585;
atom_weight[39]=91.224;
atom_weight[40]=92.90638;
atom_weight[41]=95.94;
atom_weight[42]=98.9082;
atom_weight[43]=101.07;
atom_weight[44]=102.9055;
atom_weight[45]=106.42;
atom_weight[46]=107.8682;
atom_weight[47]=112.411;
atom_weight[48]=114.818;
atom_weight[49]=118.710;
atom_weight[50]=121.760;
atom_weight[51]=127.60;
atom_weight[52]=126.90447;
atom_weight[53]=131.293;
atom_weight[54]=132.90545;
atom_weight[55]=137.327;
atom_weight[56]=138.9055;
atom_weight[57]=140.116;
atom_weight[58]=140.90765;
atom_weight[59]=144.24;
atom_weight[60]=147;
atom_weight[61]=150.36;
atom_weight[62]=151.964;
atom_weight[63]=157.25;
atom_weight[64]=158.92534;
atom_weight[65]=162.50;
atom_weight[66]=164.93032;
atom_weight[67]=167.259;
atom_weight[68]=168.93421;
atom_weight[69]=173.04;
atom_weight[70]=174.967;
atom_weight[71]=178.49;
atom_weight[72]=180.9479;
atom_weight[73]=183.84;
atom_weight[74]=186.207;
atom_weight[75]=190.23;
atom_weight[76]=192.217;
atom_weight[77]=195.078;
atom_weight[78]=196.96655;
atom_weight[79]=200.59;
atom_weight[80]=204.3833;
atom_weight[81]=207.2;
atom_weight[82]=208.98038;
atom_weight[83]=209;
atom_weight[84]=210;
atom_weight[85]=222;
atom_weight[86]=223;
atom_weight[87]=226.0254;
atom_weight[88]=227;
atom_weight[89]=232.0381;
atom_weight[90]=231.03588;
atom_weight[91]=238.02891;
atom_weight[92]=237.0482;
atom_weight[93]=242;
atom_weight[94]=243;
atom_weight[95]=247;
atom_weight[96]=247;
atom_weight[97]=249;
atom_weight[98]=254;
atom_weight[99]=253;
atom_weight[100]=256;
atom_weight[101]=254;
atom_weight[102]=257;

var atom_mass=new Array();
atom_mass[0] = 1.007825035;
atom_mass[1] = 4.00260324;
atom_mass[2] = 7.0160030;
atom_mass[3] = 9.0121822;
atom_mass[4] = 11.0093054;
atom_mass[5] = 12.0000;
atom_mass[6] = 14.003074002;
atom_mass[7] = 15.99491463;
atom_mass[8] = 18.99840322;
atom_mass[9] = 19.9924356;
atom_mass[10] = 22.9897677;
atom_mass[11] = 23.9850423;
atom_mass[12] = 26.9815386;
atom_mass[13] = 27.9769271;
atom_mass[14] = 30.9737620;
atom_mass[15] = 31.97207070;
atom_mass[16] = 34.968852721;
atom_mass[17] = 39.9623837;
atom_mass[18] = 38.9637074;
atom_mass[19] = 39.9625906;
atom_mass[20] = 44.9559100;
atom_mass[21] = 47.9479473;
atom_mass[22] = 50.9439617;
atom_mass[23] = 51.9405098;
atom_mass[24] = 54.9380471;
atom_mass[25] = 55.9349393;
atom_mass[26] = 58.9331976;
atom_mass[27] = 57.9353462;
atom_mass[28] = 62.9295989;
atom_mass[29] = 63.9291448;
atom_mass[30] = 68.925580;
atom_mass[31] = 73.9211774;
atom_mass[32] = 74.9215942;
atom_mass[33] = 79.9165196;
atom_mass[34] = 78.9183361;
atom_mass[35] = 83.911507;
atom_mass[36] = 84.911794;
atom_mass[37] = 87.9056188;
atom_mass[38] = 89.905849;
atom_mass[39] = 89.9047026;
atom_mass[40] = 92.9063772;
atom_mass[41] = 97.9054073;
atom_mass[42] = 97.907216;
atom_mass[43] = 101.9043485;
atom_mass[44] = 102.905500;
atom_mass[45] = 105.903478;
atom_mass[46] = 106.905092;
atom_mass[47] = 113.903357;
atom_mass[48] = 114.903882;
atom_mass[49] = 119.9021991;
atom_mass[50] = 120.9038212;
atom_mass[51] = 129.906229;
atom_mass[52] = 126.904473;
atom_mass[53] = 131.904144;
atom_mass[54] = 132.905429;
atom_mass[55] = 137.905232;
atom_mass[56] = 138.906347;
atom_mass[57] = 139.905433;
atom_mass[58] = 140.907647;
atom_mass[59] = 141.907719;
atom_mass[60] = 144.912743;
atom_mass[61] = 151.91972;
atom_mass[62] = 152.921225;
atom_mass[63] = 157.924019;
atom_mass[64] = 158.925342;
atom_mass[65] = 163.929171;
atom_mass[66] = 164.930319;
atom_mass[67] = 165.930290;
atom_mass[68] = 168.934212;
atom_mass[69] = 173.938859;
atom_mass[70] = 174.940770;
atom_mass[71] = 179.9465457;
atom_mass[72] = 180.947992;
atom_mass[73] = 183.950928;
atom_mass[74] = 186.955744;
atom_mass[75] = 191.961467;
atom_mass[76] = 192.962917;
atom_mass[77] = 194.964766;
atom_mass[78] = 196.966543;
atom_mass[79] = 201.970617;
atom_mass[80] = 204.974401;
atom_mass[81] = 207.976627;
atom_mass[82] = 208.980374;
atom_mass[83] = 208.982415;
atom_mass[84] = 209.987131;
atom_mass[85] = 222.017570;
atom_mass[86] = 223.019731;
atom_mass[87] = 226.025403;
atom_mass[88] = 227.027747;
atom_mass[89] = 232.0381;
atom_mass[90] = 231.03588;
atom_mass[91] = 238.0507847;
atom_mass[92] = 237.048167;
atom_mass[93] = 244.064198;
atom_mass[94] = 243.061373;
atom_mass[95] = 247.070374;
atom_mass[96] = 247.070299;
atom_mass[97] = 251.079580;
atom_mass[98] = 252.08297;
atom_mass[99] = 257.095099;
atom_mass[100] = 258.0984;
atom_mass[101] = 259.1010;
atom_mass[102] = 262.1097;

var aaFormula = new Array();
aaFormula[0] = "C2H5O2N";
aaFormula[1] = "C3H7O2N";
aaFormula[2] = "C5H11O2N";
aaFormula[3] = "C6H13O2N";
aaFormula[4] = "C6H13O2N";
aaFormula[5] = "C3H7O3N";
aaFormula[6] = "C4H9O3N";
aaFormula[7] = "C3H7O2NS";
aaFormula[8] = "C5H11O2NS";
aaFormula[9] = "C5H9O2N";
aaFormula[10] = "C4H7O4N";
aaFormula[11] = "C4H8O3N2";
aaFormula[12] = "C5H9O4N";
aaFormula[13] = "C5H10O3N2";
aaFormula[14] = "C6H9O2N3";
aaFormula[15] = "C6H14O2N2";
aaFormula[16] = "C6H14O2N4";
aaFormula[17] = "C9H11O2N";
aaFormula[18] = "C9H11O3N";
aaFormula[19] = "C11H12O2N2";
aaFormula[20] = "C2H3O";
aaFormula[21] = "C4H5O2";
aaFormula[22] = "C2H3O";
aaFormula[23] = "C3H6NO";
aaFormula[24] = "C10H15O";
aaFormula[25] = "H2O";
aaFormula[26] = "C10H8N2";
aaFormula[27] = "C7H5O";
aaFormula[28] = "C2B10H10";
aaFormula[29] = "C5H9O2";
aaFormula[30] = "C8H9O";
aaFormula[31] = "C8H6BrO2";
aaFormula[32] = "C6H4BrSO2";
aaFormula[33] = "C4H9";
aaFormula[34] = "C5H11O";
aaFormula[35] = "C7H7";
aaFormula[36] = "C7H7O";
aaFormula[37] = "C8H7O2";
aaFormula[38] = "C6H11O";
aaFormula[39] = "C8H6ClO2";
aaFormula[40] = "C5H5";
aaFormula[41] = "C6H11";
aaFormula[42] = "[2H]";
aaFormula[43] = "C12H12NSO2";
aaFormula[44] = "O2H13C10";
aaFormula[45] = "C12H17";
aaFormula[46] = "C9H11O2";
aaFormula[47] = "C6H3N2O4";
aaFormula[48] = "C24H16N2";
aaFormula[49] = "C4H9O";
aaFormula[50] = "C2H8N2";
aaFormula[51] = "C2H5";
aaFormula[52] = "C15H11O2";
aaFormula[53] = "CHO";
aaFormula[54] = "C6H13";
aaFormula[55] = "C4H9";
aaFormula[56] = "C10H17O";
aaFormula[57] = "C3H7";
aaFormula[58] = "C14H21O2";
aaFormula[59] = "C15H15O2";
aaFormula[60] = "CH3";
aaFormula[61] = "C8H9";
aaFormula[62] = "C4H9O2";
aaFormula[63] = "C8H9O";
aaFormula[64] = "C9H11";
aaFormula[65] = "C20H17O";
aaFormula[66] = "C2H5O";
aaFormula[67] = "C7H7O";
aaFormula[68] = "CH3SO2";
aaFormula[69] = "S1O3H19C14";
aaFormula[70] = "C2H5S";
aaFormula[71] = "C10H13O3S";
aaFormula[72] = "C9H11O2S";
aaFormula[73] = "C20H17";
aaFormula[74] = "C10H7";
aaFormula[75] = "C5H3O2N2S";
aaFormula[76] = "C6H4NO5S";
aaFormula[77] = "C20H26NO3";
aaFormula[78] = "S1O3H17C13";
aaFormula[79] = "C2H4O";
aaFormula[80] = "C5H11";
aaFormula[81] = "C6H5";
aaFormula[82] = "C12H8N2";
aaFormula[83] = "C8H4O4";
aaFormula[84] = "C5H9O";
aaFormula[85] = "C14H19O3S";
aaFormula[86] = "C7H7O";
aaFormula[87] = "C3H7";
aaFormula[88] = "C4H9";
aaFormula[89] = "C6H15OSi";
aaFormula[90] = "C5H11";
aaFormula[91] = "[3H]";
aaFormula[92] = "C6H12NO";
aaFormula[93] = "C6H15Si";
aaFormula[94] = "C16H19Si";
aaFormula[95] = "C6H15Si";
aaFormula[96] = "C27H59Si6";
aaFormula[97] = "C4H9";
aaFormula[98] = "C4H9O";
aaFormula[99] = "C4H9S";
aaFormula[100] = "C6H12O2";
aaFormula[101] = "C6H15Si";
aaFormula[102] = "CF3SO2";
aaFormula[103] = "C2F3O";
aaFormula[104] = "C10H13N2O5";
aaFormula[105] = "C6H13";
aaFormula[106] = "C5H9O2";
aaFormula[107] = "C9H21Si";
aaFormula[108] = "C3H9Si";
aaFormula[109] = "C7H7";
aaFormula[110] = "C7H7O2S";
aaFormula[111] = "C20H13";
aaFormula[112] = "C3H2Cl3O2";
aaFormula[113] = "C19H15";
aaFormula[114] = "C7H7SO2";
aaFormula[115] = "C13H9O";
aaFormula[116] = "C8H7O2";


var GroupName = new Array();
GroupName[0] = "Gly";
GroupName[1] = "Ala"; 
GroupName[2] = "Val"; 
GroupName[3] = "Leu"; 
GroupName[4] = "Ile"; 
GroupName[5] = "Ser"; 
GroupName[6] = "Thr"; 
GroupName[7] = "Cys"; 
GroupName[8] = "Met"; 
GroupName[9] = "Pro"; 
GroupName[10] = "Asp"; 
GroupName[11] = "Asn"; 
GroupName[12] = "Glu"; 
GroupName[13] = "Gln"; 
GroupName[14] = "His"; 
GroupName[15] = "Lys"; 
GroupName[16] = "Arg"; 
GroupName[17] = "Phe"; 
GroupName[18] = "Tyr"; 
GroupName[19] = "Trp";  
GroupName[20] = "Ac";
GroupName[21] = "Acac";
GroupName[22] = "Acet";
GroupName[23] = "Acm";
GroupName[24] = "Adao";
GroupName[25] = "Aq";
GroupName[26] = "Bipy";
GroupName[27] = "Bn";
GroupName[28] = "Bo";
GroupName[29] = "Boc";
GroupName[30] = "Bom";
GroupName[31] = "Brz";
GroupName[32] = "Bs";
GroupName[33] = "Bu";
GroupName[34] = "Bum";
GroupName[35] = "Bzl";
GroupName[36] = "Bzlo";
GroupName[37] = "Cbz";
GroupName[38] = "Chxo";
GroupName[39] = "Clz";
GroupName[40] = "Cp";
GroupName[41] = "Cy";
GroupName[42] = "D";
GroupName[43] = "Dan";
GroupName[44] = "Dde";
GroupName[45] = "Dip";
GroupName[46] = "Dmb";
GroupName[47] = "Dnp";
GroupName[48] = "Dpphen";
GroupName[49] = "Ee";
GroupName[50] = "En";
GroupName[51] = "Et";
GroupName[52] = "Fmoc";
GroupName[53] = "For";
GroupName[54] = "Hex";
GroupName[55] = "Ibu";
GroupName[56] = "Ipc";
GroupName[57] = "Ipr";
GroupName[58] = "Ivdde";
GroupName[59] = "Mbh";
GroupName[60] = "Me";
GroupName[61] = "Mebzl";
GroupName[62] = "Mem";
GroupName[63] = "Meobzl";
GroupName[64] = "Mes";
GroupName[65] = "Mmt";
GroupName[66] = "Mom";
GroupName[67] = "Mpm";
GroupName[68] = "Ms";
GroupName[69] = "Mtc";
GroupName[70] = "Mtm";
GroupName[71] = "Mtr";
GroupName[72] = "Mts";
GroupName[73] = "Mtt";
GroupName[74] = "Naph";
GroupName[75] = "Npys";
GroupName[76] = "Ns";
GroupName[77] = "Odmab";
GroupName[78] = "Pbf";
GroupName[79] = "Peg";
GroupName[80] = "Pent";
GroupName[81] = "Ph";
GroupName[82] = "Phen";
GroupName[83] = "Phth";
GroupName[84] = "Piv";
GroupName[85] = "Pmc";
GroupName[86] = "Pmp";
GroupName[87] = "Prop";
GroupName[88] = "Sbu";
GroupName[89] = "Sem";
GroupName[90] = "Sia";
GroupName[91] = "T";
GroupName[92] = "Tacm";
GroupName[93] = "Tbdms";
GroupName[94] = "Tbdps";
GroupName[95] = "Tbs";
GroupName[96] = "Tbt";
GroupName[97] = "Tbu";
GroupName[98] = "Tbuo";
GroupName[99] = "Tbuthio";
GroupName[100] = "Teg";
GroupName[101] = "Tes";
GroupName[102] = "Tf";
GroupName[103] = "Tfa";
GroupName[104] = "Thd";
GroupName[105] = "Thex";
GroupName[106] = "Thp";
GroupName[107] = "Tips";
GroupName[108] = "Tms";
GroupName[109] = "Tol";
GroupName[110] = "Tos";
GroupName[111] = "Tpt";
GroupName[112] = "Troc";
GroupName[113] = "Trt";
GroupName[114] = "Ts";
GroupName[115] = "Xan";
GroupName[116] = "Z";


var GroupName1 = new Array();
GroupName1[0] = "Glycine";
GroupName1[1] = "Alanine"; 
GroupName1[2] = "Valine"; 
GroupName1[3] = "Leucine"; 
GroupName1[4] = "Isoleucine"; 
GroupName1[5] = "Serine"; 
GroupName1[6] = "Threonine"; 
GroupName1[7] = "Cysteine"; 
GroupName1[8] = "Methionine"; 
GroupName1[9] = "Proline"; 
GroupName1[10] = "Aspartic acid"; 
GroupName1[11] = "Asparagine"; 
GroupName1[12] = "Glutamic acid"; 
GroupName1[13] = "Glutamine"; 
GroupName1[14] = "Histidine"; 
GroupName1[15] = "Lysine"; 
GroupName1[16] = "Arginine"; 
GroupName1[17] = "Phenylalanine"; 
GroupName1[18] = "Tyrosine"; 
GroupName1[19] = "Tryptophan";  
GroupName1[20] = "Acetyl";
GroupName1[21] = "Acetoacetyl (AcAc)";
GroupName1[22] = "Acetyl (usually Ac)";
GroupName1[23] = "Acetamidomethyl";
GroupName1[24] = "Adamantyloxy";
GroupName1[25] = "Aqua (water, as ligand)";
GroupName1[26] = "2,2'-Bipyridyl (also bpy; as ligand)";
GroupName1[27] = "Benzoyl (ChemCalc uses Bz)";
GroupName1[28] = "Boron cage - 2H";
GroupName1[29] = "tert-Butoxycarbonyl";
GroupName1[30] = "Benzyloxymethyl";
GroupName1[31] = "2-Bromobenzyloxycarbonyl";
GroupName1[32] = "Brosyl (4-bromobenzenesulfonyl)";
GroupName1[33] = "n-Butyl";
GroupName1[34] = "tert-Butoxymethyl";
GroupName1[35] = "Benzyl (also Bn)";
GroupName1[36] = "Benzyloxy";
GroupName1[37] = "Benzyloxycarbonyl (Z in ChemCalc)";
GroupName1[38] = "Cyclohexyloxy";
GroupName1[39] = "2-Chlorobenzyloxycarbonyl";
GroupName1[40] = "Cyclopentadienyl";
GroupName1[41] = "Cyclohexyl";
GroupName1[42] = "Deuterium";
GroupName1[43] = "Dansyl";
GroupName1[44] = "Dde";
GroupName1[45] = "2,6-Diisopropylphenyl";
GroupName1[46] = "2,6-Dimethoxybenzyl";
GroupName1[47] = "2,4-Dinitrophenyl";
GroupName1[48] = "4,7-Diphenly-1,10-phenanthroline (as ligand)";
GroupName1[49] = "1-Ethoxyethyl (EE)";
GroupName1[50] = "Ethylenediamine (en; as ligand)";
GroupName1[51] = "Ethyl";
GroupName1[52] = "Fluorenylmethoxycarbonyl";
GroupName1[53] = "Formyl";
GroupName1[54] = "n-Hexyl";
GroupName1[55] = "iso-Butyl (usually i-Bu)";
GroupName1[56] = "Isopinocamphenyl";
GroupName1[57] = "iso-Propyl (usually i-Pr)";
GroupName1[58] = "1-[4,4-dimethyl-2,6-dioxocyclohexylidene]3-methylbutyl";
GroupName1[59] = "4,4'-Dimethoxybenzhydryl";
GroupName1[60] = "Methyl";
GroupName1[61] = "4-Methylbenzyl";
GroupName1[62] = "2-Methoxyethoxymethyl";
GroupName1[63] = "4-Methoxybenzyl1-[4,4-dimethyl-2,6-dioxocyclohexylidene]3-methylbutyl";
GroupName1[64] = "Mesityl (2,4,6-trimethylphen-1-yl)";
GroupName1[65] = "4-Methoxytrityl";
GroupName1[66] = "Methoxymethyl";
GroupName1[67] = "para-Methoxyphenylmethyl";
GroupName1[68] = "Mesyl (methanesulphonyl)";
GroupName1[69] = "2,2,5,7,8-pentamethylchroman-6-sulphonyl";
GroupName1[70] = "Methylthiomethyl";
GroupName1[71] = "4-Methoxy-2,3,6-trimethylbenzenesulphonyl";
GroupName1[72] = "Mesitylene-2-sulphonyl";
GroupName1[73] = "4-Methyltrityl";
GroupName1[74] = "Naphtyl (also Np)";
GroupName1[75] = "3-Nitro-2-pyridinesulphenyl";
GroupName1[76] = "para-Nitrobenzenesulphonyl";
GroupName1[77] = "Odmab (2-(ethylhexyl)-4-(dimethylamino)benzoate)";
GroupName1[78] = "2,2,4,6,7-pentamethyldihydrobenzofurane-5-sulfonyl";
GroupName1[79] = "-Polyethyleneglycol fragment-";
GroupName1[80] = "n-Pentyl";
GroupName1[81] = "Phenyl";
GroupName1[82] = "1,10-Phenanthroline (phen; as ligand)";
GroupName1[83] = "Phthaloyl (2-; 1,2-benzenedicarboxyl)";
GroupName1[84] = "Pivaloyl (trimethylacetyl; also Pv)";
GroupName1[85] = "2,2,5,7,8-Pentamethylchroman-6-sulphonyl";
GroupName1[86] = "para-Methoxyphenyl";
GroupName1[87] = "n-Propyl (usually Pr)";
GroupName1[88] = "sec-Butyl (usually s-Bu)";
GroupName1[89] = "2-(Trimethylsilyl)ethoxymethyl";
GroupName1[90] = "Siamyl (3-methyl-2-butyl)";
GroupName1[91] = "Tritium";
GroupName1[92] = "Trimethylacetamidomethyl";
GroupName1[93] = "tert-Butyldimethylsilyl (also Tbs)";
GroupName1[94] = "tert-Butyldiphenylsilyl";
GroupName1[95] = "tert-Butyldimethylsilyl (also Tbdms)";
GroupName1[96] = "2,4,6-tris[bis(trimethylsilyl)methyl]phenyl";
GroupName1[97] = "tert-Butyl (usually t-Bu)";
GroupName1[98] = "tert-Butoxy";
GroupName1[99] = "tert-Butylthio";
GroupName1[100] = "-Triethyleneglycol fragment-";
GroupName1[101] = "Triethylsilyl";
GroupName1[102] = "Triflate, triflyl (trifluoromethanesulfonyl)";
GroupName1[103] = "Trifluoroacetyl";
GroupName1[104] = "Thymidine - 2H";
GroupName1[105] = "Thexyl (2,3-dimethyl-2-butyl) (also Thx)";
GroupName1[106] = "Tetrahydropyranyl";
GroupName1[107] = "Triisopropylsilyl";
GroupName1[108] = "Trimethylsilyl";
GroupName1[109] = "p-Tolyl";
GroupName1[110] = "Tosyl (also Ts)";
GroupName1[111] = "Tryptyl";
GroupName1[112] = "Trichloroethyloxycarbonyl";
GroupName1[113] = "Trityl (also Tr, Try)";
GroupName1[114] = "Tosyl";
GroupName1[115] = "Xanthyl";
GroupName1[116] = "Benzyloxycarbonyl";

GROUPNUMBER = 117;
function getRealArray(array,length)
{
	var return_array=new Array();
	for(var i=0;i< length;i++)
		return_array[i]=array[i]
	return return_array;
}
function isalpha(letter)
{
	if (letter != letter.toUpperCase()||letter != letter.toLowerCase())
		return true;
	return false;
}

function isupper(letter)
{
	if(isalpha(letter))
		if (letter==letter.toUpperCase())
			return true;
	return false;
}

function islower(letter)
{
	if(isalpha(letter))
		if (letter==letter.toLowerCase())
			return true;
	return false;
}

function isdigit(letter)
{
	if(letter=="0"||letter=="1"||letter=="2"||letter=="3"||letter=="4"||letter=="5"||letter=="6"||letter=="7"||letter=="8"||letter=="9")
		return true;
	return false;
}

function issymble(letter)
{
	if(!isalpha(letter)&&!isdigit(letter))
		return true;
	return false;
}

function SetAt(input,i,subchar)
{
	var return_string="";
	for (var j=0;j < input.length; j++)
		{
			if (j==i)
				{
					return_string += subchar;
					j++;
				}
			return_string += input.substring(j,j+1);
		}
	return return_string;	
}

function InsertAt(input,i,subchar)
{
	var return_string="";
	for (var j=0;j < input.length; j++)
		{
			if (j==i)
				{
					return_string += subchar;
				}
			return_string += input.substring(j,j+1);
		}
	return return_string;	
}

function convertRound(number, radix)
{
	var havePoint=false;
	var return_value="";
	number=Math.round( number*Math.pow(10,radix))/Math.pow(10,radix);
	number=""+number;
	for(i=0;i<number.length;i++)
	{
		if(number.charAt(i)==".")
			havePoint =true;
	}
	if(havePoint)
	{
		if (number.length - number.indexOf(".",0) - 1 < radix)
		{
			var number_length=(radix - (number.length - number.indexOf(".",0)-1))
			for(i=1;i <= number_length ;i++)
			{
				number=number + "0";
			}
			return number;
		}
		else if (number.length - number.indexOf(".",0)-1==radix)
			return number;
		else
		{
			return(number.substring(0,radix + number.indexOf(".",0)+1));
		}
	}
	else
	{
		number += "."
		for(i=0;i< radix;i++)
			number+="0";
		return number;
	}		
}

function RemoveSpace(input) //remove the space in the string
{
	var i=0;
	var mf="";
	for(i=0; i < input.length; i++)
	{
		if(input.charAt(i) != " ")
			{
				mf += input.charAt(i);
			}
	}	
	return mf;
}

function getMinMass(element)
{
	var array=new Array();
	array=element.isotope_mw;
	return array[0];
}

function getMax(a)
{
	var max_value=0;
	max_value=a[0];
	for(i=0;i<a.length;i++)
	{
		max_value=Math.max(a[i],max_value);
	}
	return max_value;
}

function getArray(a,b)
{
	var i=0, j=0, m=b.length-1;
	var c=new Array();
	for(i=a.length-1;i >= 0;i --)	
	{
		if (i!=a.length - 1)
		{
			for(var n=c.length;n > 0; n--)
			{
				c[n]=c[n-1];
			}
			c[0]=0;
			m=b.length - 1;
		}
		for(j=b.length-1;j>=0;j--)
		{		
			if(i==a.length-1)
			{
				c[m]=a[i]*b[j]*0.01;
				m--;
			}
			else
			{
				c[m]=c[m]+a[i]*b[j]*0.01;
				m--;
			}
		}
	}	
	return c;
}

var HighAbundance = new Array();
var HighMass = new Array();
function HighResolution(HighAbundance,HighMass)
{
	this.HighMass=HighMass;
	this.HighAbundance=HighAbundance;
}

var HighResolutionAbundance = new Array();
var HighResolutionMass = new Array();
function getHighResolutionAbundanceAndMass(a,b,c,d)
{
	var i=0, j=0, m=0;
	var a_length=a.length;
	var b_length=b.length;
	var Abundance = new Array();
	var Mass = new Array();
	for(i=0;i<=a_length-1;i++)
	{
		if(a[i]==0)
			continue;
		for(j=0;j<=b_length-1;j++)		
		{
			if(b[j]==0)
				continue;
			if( a[i]*b[j]*0.01 >= MinAbundance())
			{
				Abundance[m] = a[i]*b[j]*0.01;
				Mass[m] = c[i] + d[j];
				m++;
			}
		}	
	}
	var TempArray = new HighResolution(Abundance, Mass);	
	TempArray = SortType(TempArray);
	TempArray = AddSameMassType(TempArray);
	TempArray = CutArrayToShort(TempArray);
	HighResolutionAbundance = TempArray.HighAbundance;
	HighResolutionMass = TempArray.HighMass;
}

function getHighResolutionSort()
{
	var i=0,j=0;
	var temp;	
	for(i=0;i<=HighResolutionMass.length-1;i++)
		for(j=0; j<=HighResolutionMass.length-i; j++)
		{
			if(HighResolutionMass[j]>HighResolutionMass[j+1])
			{
				temp = HighResolutionAbundance[j];
				HighResolutionAbundance[j] = HighResolutionAbundance[j+1];
				HighResolutionAbundance[j+1] = temp;
				temp = HighResolutionMass[j];
				HighResolutionMass[j] = HighResolutionMass[j+1];
				HighResolutionMass[j+1] = temp;
			}
		}
}

function AddSameMass()
{
	var i=0;
	for(i=0;i<=HighResolutionAbundance.length-2;i++)
	{
		if(convertRound(HighResolutionMass[i],6)==convertRound(HighResolutionMass[i+1],6))
		{
			HighResolutionAbundance[i+1] += HighResolutionAbundance[i];
			HighResolutionAbundance[i]=0;
			HighResolutionMass[i] = 0;
		}
	}
}

function AddSameMassType(a)
{
	var i=0;
	var b = new Array();
	var c = new Array()
	b = a.HighMass;	
	c = a.HighAbundance;
	for(i=0;i<=b.length-2;i++)
	{
		if(convertRound(b[i],6)==convertRound(b[i+1],6))
		{
			c[i+1] += c[i];
			c[i]=0;
			b[i] = 0;
		}
	}
	var temp = new HighResolution(c,b);
	return temp;
}

function SortArray(a)
{
	var i=0,j=0;
	var temp;
	var b = new Array();
	b = a;	
	for(i=0;i<=b.length-1;i++)
		for(j=0; j<=b.length-i; j++)
		{
			if(b[j]>b[j+1])
			{
				temp = b[j];
				b[j] = b[j+1];
				b[j+1] = temp;
			}
		}
	return b;
}

function SortType(a)
{
	var i=0,j=0;
	var temp;
	var b = new Array();
	var c = new Array()
	b = a.HighMass;	
	c = a.HighAbundance;
	for(i=0;i<=b.length-1;i++)
		for(j=0; j<=b.length-i; j++)
		{
			if(b[j]>b[j+1])
			{
				temp = b[j];
				b[j] = b[j+1];
				b[j+1] = temp;
				temp = c[j];
				c[j] = c[j+1];
				c[j+1] = temp;				
			}
		}
	var temp = new HighResolution(c,b);
	return temp;
}

function CutArrayToShort(HighResolutionArray)
{
	var i=0,j=0;
	var a = new Array();
	var b = new Array();
	for(i = 0; i<HighResolutionArray.HighAbundance.length; i++)
	{
		if(HighResolutionArray.HighAbundance[i]!=0)
		{
			a[j]=HighResolutionArray.HighAbundance[i];
			b[j]=HighResolutionArray.HighMass[i];
			j++;
		}
	}
	var temp = new HighResolution(a,b);
	return temp;
}

function getShortArray(array,index,max_value)
{
	var i=0;
	while(convertRound((array[i]/max_value)*100,index)==0)
		i++;
	var j=array.length;
	while(convertRound((array[j-1]/max_value)*100,index)==0)
		j--;
	var return_array=new Array(j-i+2);
	return_array[0]=0;
	return_array[j-i+1]=0;
	var k=j-i+1;
	for(var m=1; m < k; m++)
		{
			return_array[m]=array[i]
			i++;
		}
	return return_array;
}

function getMinMass1(array,index,max_value,min_mass)
{
	var i=0;
	while(convertRound((array[i]/max_value)*100,index)==0)
		i++;
	return (min_mass+i-1);
}

function getMultiGroupFormula(groupName,groupNumber)
{
	var temp="";
	for(var i=1;i<=groupNumber;i++)
		temp+=groupName;
	return temp;
}

function isGroupName(tempName)
{
	for(var i=0;i<GROUPNUMBER + yourGroupNumber;i++)
		if(tempName==GroupName[i])
		{
			return aaFormula[i];
		}
	return "";
}

function GetNormalFormula(Formula)
{
	var BeginMid=0,EndMid=0,i=0;
	var Element = "";
	var isDigit = false;
	var temp="";
	var temp1="";
	for(i=0;i<Formula.length;i++)		
	{	
	if(isupper(Formula.charAt(i)))
	{
		BeginMid = i;
		while(islower(Formula.charAt(i+1)))
			i++;
		EndMid=i+1;		
		Element=Formula.substring(BeginMid,EndMid);
		isDigit = false;
		while(isdigit(Formula.charAt(i+1)))
		{
			i++;
			isDigit=true;
		}
		if(isDigit)
		{
			temp = Formula.substring(EndMid,i+1);
		}
		if(isGroupName(Element)!="")
		{
			if(isDigit)
			{	
				temp1 =getMultiGroupFormula(isGroupName(Element),temp);
				Formula = Formula.substring(0,BeginMid)+temp1+Formula.substring(i+1,Formula.length);
				i=i + temp1.length - Element.length-1;
			}
			else
			{
				temp1 = isGroupName(Element);
				Formula = Formula.substring(0,BeginMid)+temp1+Formula.substring(EndMid,Formula.length);				
				i=i + temp1.length - Element.length;
			}	
		}	
	}
	}
	return Formula;
	
}

function getAbundanceRound()
{
	if(document.formula.D2.selectedIndex==0)
		return 0;
	else if(document.formula.D2.selectedIndex==1)
		return 1;
	else if(document.formula.D2.selectedIndex==2)
		return 2;
	else if(document.formula.D2.selectedIndex==3)
		return 3;
	else if(document.formula.D2.selectedIndex==4)
		return 4;
	else 
		return 6;
}

function MinAbundance()
{
	if(document.formula.D2.selectedIndex==0)
		return 0.01;
	else if(document.formula.D2.selectedIndex==1)
		return 0.001;
	else if(document.formula.D2.selectedIndex==2)
		return 0.0001;
	else if(document.formula.D2.selectedIndex==3)
		return 0.00001;
	else if(document.formula.D2.selectedIndex==4)
		return 0.000001;
	else 
		return 0.0000001;
}

var ExactMass_x = 0;
var ExactMass_y = 0;
function getXY()
{
	if(navigator.platform=="Win32")
	{
		if (navigator.appName == 'Microsoft Internet Explorer')
		{
			ExactMass_x = 20;
			ExactMass_y = 422-44;			
		}
		else if(navigator.appName == 'Netscape')
		{
			ExactMass_x = 18;
			ExactMass_y = 416-44;						
		}
	}
	else if(navigator.platform=="MacPPC")
	{
		if (navigator.appName == 'Microsoft Internet Explorer')
		{
			ExactMass_x = 20;
			ExactMass_y = 411-35;			
		}
		else if(navigator.appName == 'Netscape')
		{
			ExactMass_x = 18;
			ExactMass_y = 361-5;						
		}			
	}
	else
		{
			ExactMass_x = 18;
			ExactMass_y = 388;
		}		
}

function setCookies()
{
	now=new Date();
	now.setTime(now.getTime() + 1000*60*60*24*365);
	document.cookie = "offsetValue=" + document.formula.offset.value + "#n" +document.formula.x_offset.value + ";expires="+ now.toGMTString();
}

function getCookies()
{
	if(WM_readCookie("offsetValue")!="false")
	{
		var cookieTemp = WM_readCookie("offsetValue");
		var cookieXY = cookieTemp.split("#n");
		document.formula.offset.value = cookieXY[0];
		if(cookieXY[1]=="")
			document.formula.x_offset.value = 100;
		else
			document.formula.x_offset.value = cookieXY[1];		
	}
}

function getPattern()
{
	var j=0,num1=0,num2=0,BeginMid=0,EndMid=0,MidNum=0,n=0,waterNumber=0;
	var MidString,MidNumString,mfCopy,FormulaTemp,Midstring="";
	var mf=document.formula.mf.value;
	if(isNaN(document.formula.fromMass.value)&&RemoveSpace(document.formula.fromMass.value)!="")
	{
		alert(msg13);
		document.formula.fromMass.focus();
		return;
	}
	if(isNaN(document.formula.toMass.value)&&RemoveSpace(document.formula.toMass.value)!="")
	{
		alert(msg13);
		document.formula.toMass.focus();
		return;
	}

	if(isNaN(document.formula.offset.value))
	{
		alert(msg10);
		document.formula.offset.focus();
		return;
	}
	if(isNaN(document.formula.x_offset.value))
	{
		alert(msg12);
		document.formula.x_offset.focus();
		return;
	}
	var fromValue = RemoveSpace(document.formula.fromMass.value);
	var toValue = RemoveSpace(document.formula.toMass.value);
	if(fromValue=="")
		fromValue = 0;
	if(toValue=="")
		toValue = 0;
	setCookies();
	getXY();
	readCookiesData("yourGroup");
	if(document.formula.calcuResult.value != "")
		document.formula.calcuResult.value = "";
	ExactMass_y = ExactMass_y + parseInt(document.formula.offset.value) -100;
	ExactMass_x = ExactMass_x + parseInt(document.formula.x_offset.value) -100;
	mf=RemoveSpace(mf);
	if (mf.length==0)
		{
			alert(msg1);
			document.formula.mf.focus();
			return;
		}
	mf = GetNormalFormula(mf);
	var Formula_length=mf.length;
	for(var i=0;i<Formula_length;i++)
	{
		if(mf.charAt(i)=='(')
			num1++;
		if(mf.charAt(i)=='-')
			waterNumber++;
	}
	for(i=0;i<Formula_length;i++)
		if(mf.charAt(i)==')')
			num2++;	
	if(num1!=num2)
	{
		alert(msg2);	 
		document.formula.mf.focus();
		return;
	}
	num1=0,num2=0;
	for(i=0;i<Formula_length;i++)
		if(mf.charAt(i)=='[')
			num1++;
	for(i=0;i<Formula_length;i++)
		if(mf.charAt(i)==']')
			num2++;	
	if(num1!=num2)
	{
		alert(msg11);	 
		document.formula.mf.focus();
		return;
	}
	for(i=0;i<mf.length;i++)
	{
		if(mf.charAt(i)=='-')
		{
			mf = mf.substring(0,i)+mf.substring(i+1,mf.length);
			i--;
		}
	}
	if(isdigit(mf.charAt(0)))
		mf = "." + mf;
	Formula_length=mf.length;
	for(i=0;i<mf.length;i++)
	{
		if(mf.charAt(0)=='[')
			mf=InsertAt(mf,0,"(")
		else if(mf.charAt(i)=='['&&mf.charAt(i-1)!='(')
			mf=InsertAt(mf,i,'(')
		if(mf.charAt(mf.length-1)==']')
			mf=mf+')';
		else if(mf.charAt(i)==']'&&mf.charAt(i+1)!=')')
			mf=InsertAt(mf,i+1,')')
	}
	FormulaTemp="";	
	Formula_length=mf.length;
	for(i=0;i<Formula_length;i++)
		if(mf.charAt(i)=='(')
		{
			BeginMid=i;
			while(mf.charAt(i+1)!=')')
				i++;
			EndMid=i;
			MidString=mf.substring(BeginMid+1,EndMid+1);
			for(j=BeginMid;j<=EndMid+1;j++)
			{
				mf=SetAt(mf,j," ");
			}
			if(isalpha(mf.charAt(i+2))||i+2==mf.length||mf.charAt(i+2)=='(')
			{
				MidNumString=1;
	 		}
	 		else if(isdigit(mf.charAt(i+2)))
			{
				BeginMid=i+2;
	 			while(isdigit(mf.charAt(i+2)))
		 			i++;
				EndMid=i+1;
  	 			MidNumString=mf.substring(BeginMid,EndMid+1);
	 			for(j=BeginMid;j<=EndMid;j++)
		 			mf=SetAt(mf, j,' ');		 			
	 		}
			for(j=1;j<=MidNumString;j++)
				FormulaTemp+=MidString;
		}
	for(i=0;i<Formula_length;i++)
		if(mf.charAt(i)==".")
		{
	 		mf=SetAt(mf, i," ");
	  		if(isalpha(mf.charAt(i+1)))
				MidNumString="1";
			else if(isdigit(mf.charAt(i+1)))
	 		{
				BeginMid=i+1;
				while(isdigit(mf.charAt(i+1)))
		 			i++;
	 			EndMid=i;
	 			MidNumString=mf.substring(BeginMid,EndMid+1);
	 			for(j=BeginMid;j<=EndMid;j++)
		 			mf=SetAt(mf, j," ");
	 		}
		 	BeginMid=i+1;
	 		while((i+1)!=mf.length &&mf.charAt(i+1)!="."&&mf.charAt(i+1)!='(')
				i++;
			EndMid=i;
	 		MidString=mf.substring(BeginMid,EndMid+1);
	 		for(j=BeginMid;j<=EndMid;j++)
		 		mf=SetAt(mf, j,' ');
			for(j=1;j<=MidNumString;j++)
		 		FormulaTemp+=MidString; 
		 }
	mf=RemoveSpace(mf);
	Formula=mf.substring(0,mf.length)+FormulaTemp;	   	
	Formula=RemoveSpace(Formula);
	Formula_length=Formula.length;
	for(i=0;i<Formula_length;i++)
	{
		if((isalpha(Formula.charAt(i))&&(isupper(Formula.charAt(i+1))||Formula.charAt(i+1)=='['))||(Formula.charAt(i)==']'&&!isdigit(Formula.charAt(i+1))))
			Formula=InsertAt(Formula,i+1,'1');
		Formula_length=Formula.length;
	}
	if(isalpha(Formula.charAt(Formula_length-1))||Formula.charAt(Formula_length-1)==']')
	{
		Formula=Formula + "1";
	}
	var Element=new Array(1000);
	var ElementNum=new Array(1000);
	BeginMid=0;
	var NUM=0;
	for(i=0;i<Formula.length;i++)
	{
		if(Formula.charAt(i)=='[')
		{
			BeginMid = i;
			while(Formula.charAt(i)!=']')
				i++;
			EndMid=i+1;
			Element[NUM]=Formula.substring(BeginMid,EndMid);
 			NUM++;
 			BeginMid=EndMid;
		}
		else
		{
		if((isalpha(Formula.charAt(i))&&isdigit(Formula.charAt(i+1)))||((isupper(Formula.charAt(i+1))||Formula.charAt(i+1)=='[')&&isdigit(Formula.charAt(i))))	
		{
			EndMid=i+1;
			Element[NUM]=Formula.substring(BeginMid,EndMid);
 			NUM++;
 			BeginMid=EndMid;
		}
		}
  	}
	Element[NUM]=Formula.substring(BeginMid,Formula.length);
	var isC = false;
	var isH = false;
	var isN = false;
	var isO = false;
	var temp_exchange = "";
	if(Element[0] == "C")
	{
		isC = true;
	}
	if(Element[2] == "H")
	{
		isH = true;
	}
	if(Element[4] == "N")
	{
		isN = true;
	}
	if(Element[6] == "O")
	{
		isO = true;
	}
	for(i=0;i<=NUM-1;i+=2)
	{	
		if(Element[i] == "C" && !isC)
		{
			temp_exchange = Element[0];
			Element[0] = Element[i];
			Element[i] = temp_exchange;
			temp_exchange = Element[1];
			Element[1] = Element[i+1];
			Element[i+1] = temp_exchange;
			isC = true;
		}
		if(Element[i] == "H" && !isH && i>3)
		{
			temp_exchange = Element[2];
			Element[2] = Element[i];
			Element[i] = temp_exchange;
			temp_exchange = Element[3];
			Element[3] = Element[i+1];
			Element[i+1] = temp_exchange;
			isH = true;
		}
		if(Element[i] == "N" && !isN && i > 5)
		{
			temp_exchange = Element[4];
			Element[4] = Element[i];
			Element[i] = temp_exchange;
			temp_exchange = Element[5];
			Element[5] = Element[i+1];
			Element[i+1] = temp_exchange;
			isN = true;
		}
		if(Element[i] == "O" && !isO && i > 7)
		{
			temp_exchange = Element[6];
			Element[6] = Element[i];
			Element[i] = temp_exchange;
			temp_exchange = Element[7];
			Element[7] = Element[i+1];
			Element[i+1] = temp_exchange;
			isO = true;
		}
	}
	for(i=1;i<=NUM;i+=2)
	{ 
		ElementNum[(i-1)/2]=Element[i];
	}
	var GetElement=new Array(50);
  	var PerElementWeight=new Array(50);
  	var PerElementMass=new Array(50);
  	var MolecularWeight=0,MolecularMass=0;
	var PerElementNum=new Array(50);
	var GetNum=0,aa_flag=0,aa_num=0,first_aa=0,end_aa=0;
	for(j=0;j<103;j++)
	{
		if(Element[0]==period_element[j])
			first_aa=1;
	 	if(Element[NUM-1]==period_element[j])
	 		end_aa=1;
	}
	var returnArray= new Array();
	var a=new Array();
	var b=new Array();
	var element_x=new element_data();
	var min_mass=0;	
	var minusH = false, minusO = false;	
	var just_isotope = true;
	for(i=0;i<=NUM-1;i+=2)
	{
		if(waterNumber!=0)
		{
			if(Element[i]=="H"&&minusH==false)
			{
				ElementNum[i/2] -= 2*waterNumber;
				minusH = true;
			}
			if(Element[i]=="O"&&minusO==false)
			{
				ElementNum[i/2] -= waterNumber;
				minusO = true;
			}
		}
		for(j=i+2;j<=NUM-1;j+=2)
   		if(Element[i]==Element[j]&&i!=j)
			{
				ElementNum[i/2]=parseInt(ElementNum[i/2]) + parseInt(ElementNum[j/2]);
	 			ElementNum[j/2]=0;
			}
	}
			if(waterNumber!=0)
			{
				if(!minusH)
				{
					alert(msg3);
					document.formula.mf.focus();
					return;
				}
				if(!minusO)
				{
					alert(msg4);
					document.formula.mf.focus();
					return;
				}
			}
	var isotopes_mass = 0;
	for(i=0;i<(NUM+1)/2;i++)
		if(ElementNum[i]!=0)
		{
			if(ElementNum[i]<0)
			{
				alert(msg5);
				document.formula.mf.focus();
				return;
			}
			var flag=0;
			if(Element[2*i].charAt(0)=='[')
			{
				var ii=Element[2*i].length;
				var is_isotope=false;
				var is_isotope_mass=false;
				var jj=0, begin_num=0, element_name="", element_mass="";
				while(!isalpha(Element[2*i].charAt(jj+1)))
					jj++;
				element_mass = parseInt(Element[2*i].substring(1,jj+1));
				begin_num = jj+2;
				element_name = Element[2*i].substring(jj+1,ii-1);
				for(ii=0;ii<103;ii++)
				{
					if(element[ii].name==element_name)
					{	
						is_isotope = true;
						for(jj=0;jj<element[ii].isotope_number;jj++)
						{
							if(element[ii].isotope_mw[jj]==element_mass)
							{
								is_isotope_mass=true;
								min_mass += element_mass*ElementNum[i];
								GetElement[GetNum]= "<font color=#FF0000><sup>"+element_mass+"</sup>"+element_name+"</font>";
								PerElementNum[GetNum]=ElementNum[i];
 								PerElementWeight[GetNum]=ElementNum[i]*element[ii].atom_mass[jj];
 								PerElementMass[GetNum]=ElementNum[i]*element[ii].atom_mass[jj];
								if(document.formula.R1[1].checked)
									isotopes_mass += ElementNum[i]*element[ii].atom_mass[jj];
								GetNum++;
								continue;
							}
						}
					}
				}			
				if(!is_isotope)
				{
					alert(msg6+element_name+msg7);
					document.formula.mf.focus();
					return;
				}
				if(!is_isotope_mass)
				{
					alert(msg6+Element[2*i]+msg7);
					document.formula.mf.focus();
					return;
				}				
			}
			else
			{
				just_isotope = false;
				for(j=0;j<103;j++)
				if(Element[2*i]==period_element[j])
				{
					flag=1;
					element_x=element[j];
					GetElement[GetNum]= element_x.name;
					if(document.formula.R1[1].checked)
					{
						var HighResolutionArray = new HighResolution(element[j].abundance,element[j].atom_mass);
						HighResolutionArray = CutArrayToShort(HighResolutionArray);
					}
					if(i==0)
					{
						if(document.formula.R1[1].checked)
						{
							HighResolutionAbundance = HighResolutionArray.HighAbundance;
							HighResolutionMass = HighResolutionArray.HighMass;
						}
						if(ElementNum[i]==1&&document.formula.R1[0].checked)
						{
							var a=new Array(element_x.isotope_number);
							a=element[j].abundance;
							min_mass=getMinMass(element[j]);
						}
						else
						{
							if(document.formula.R1[0].checked)
							{
								a=element[j].abundance;
								b=element[j].abundance;
								min_mass=getMinMass(element[j]);
							}
							for(var w=0; w < ElementNum[i]-1; w++)
							{
								if(document.formula.R1[0].checked)
								{
									a=getArray(a,b);
									min_mass += getMinMass(element[j]);
								}
								else
									getHighResolutionAbundanceAndMass(HighResolutionAbundance,HighResolutionArray.HighAbundance,HighResolutionMass,HighResolutionArray.HighMass);
							}							
						}
					}
					else
					{			
						for(var w=0; w < ElementNum[i]; w++)
						{
							if(document.formula.R1[0].checked)
							{
								b=element_x.abundance;
								a=getArray(a,b);
								min_mass += getMinMass(element[j]);
							}
							else
								getHighResolutionAbundanceAndMass(HighResolutionAbundance,HighResolutionArray.HighAbundance,HighResolutionMass,HighResolutionArray.HighMass);
						}
					}
					PerElementNum[GetNum]=ElementNum[i];
 					PerElementWeight[GetNum]=ElementNum[i]*atom_weight[j];
 					PerElementMass[GetNum]=ElementNum[i]*atom_mass[j];
					GetNum++;
					if(j>=103)
					{
						aa_flag=1;
						aa_num+=ElementNum[i];
					}
					break;
				}
				if(flag==0)
				{
			 		alert(msg8+Element[2*i]+msg9);
	 				document.formula.mf.focus();
			 		return;
			 	}
			}
		}
		if(document.formula.R1[1].checked)
		{
			if(just_isotope)
			{	HighResolutionMass[0] = isotopes_mass;
				HighResolutionMass.length = 1;
				HighResolutionAbundance[0] = 100;
				HighResolutionAbundance.length = 1;
			}
			else
			{
				getHighResolutionSort();
				AddSameMass();
				if(is_isotope)
					for(i=0;i<HighResolutionMass.length;i++)
					{
						HighResolutionMass[i]+=isotopes_mass;
					}
			}
		}
		Formula = Formula1;
		Formula += Formula2;
		for(i=0;i<GetNum;i++)
		{
			if(PerElementNum[GetNum]!=0)
			{
				MolecularWeight+=PerElementWeight[i];
				MolecularMass+=PerElementMass[i];
				Formula+=GetElement[i];
				if (PerElementNum[i]!=1)
					Formula+="<sub>"+PerElementNum[i]+"</sub>";
			}
		}
		Formula += "</font></td> </tr>";
		Formula=Formula + Formula3+convertRound(MolecularWeight,6)+Formula4;
		Formula=Formula + Formula5+convertRound(MolecularMass,6)+Formula6;
	if (document.formula.R1[0].checked)
	{
		var output_form="<table table border=1 width=24% cellspacing=0 bordercolorlight=#808000 bordercolordark=#FFFFFF cellpadding=0 height=170 width=21%><tr><td width=50% bgcolor=#C0C0C0><b><font color=#800000>Mass</font></b></td><td width=50% align=right bgcolor=#C0C0C0><b><font color=#800000>%</font></b></td></tr>";
		var bottom_line="<tr><td width=40 height=1 align=center><p align=center><img src=line.gif border=0 width=40 height=2 align=bottom></td>";
		var image_sample="<tr><td width=40 valign=bottom align=center height=144><p align=center><img src=line.gif border=0 width=2 height=200 align=left></p></td>";
		var mass_value="<tr><td width=40 align=center height=21><font size=2>Mass</font></td>";
		var max_value=getMax(a);
		if (getAbundanceRound()!=9)
		{
			min_mass=getMinMass1(a,getAbundanceRound(),max_value,min_mass);
			a=getShortArray(a,getAbundanceRound(),max_value);
		}
		var imagefile="";
		Formula += "<br><table border=0 width=1 cellspacing=0 cellpadding=0 height=170><tr><td width=40 valign=bottom align=center height=21><font color=#008000 size=2><b>%</b></font></td><td width=40 valign=bottom align=center height=21><font color=#008000 size=2>";
		if(just_isotope)
		{			
			a[0] = 100;
			max_value = 100;
			if(document.formula.R1[0].checked)
				min_mass++;
		}
		for(i= 0;i< a.length; i++ )
		{	
			if((fromValue > min_mass + i) || (toValue < min_mass + i) && toValue > fromValue) continue;
			output_form += "<tr><td width=50%>";			
			if((min_mass+i)==convertRound(MolecularMass,0))
			{
				output_form += "<font color = '#ff0000'><b>";
				output_form += (min_mass+i);
				output_form += "</b></font></td><td width=50% align=right><font color = '#ff0000'><b>";
				output_form += convertRound((a[i]/max_value)*100,getAbundanceRound());
				output_form += "</b></font></td></tr>";
			}
			else if(a[i]==max_value)
			{
				output_form += "<font color = '#0000ff'><b>";
				output_form += (min_mass+i);
				output_form += "</b></font></td><td width=50% align=right><font color = '#0000ff'><b>";
				output_form += convertRound((a[i]/max_value)*100,getAbundanceRound());
				output_form += "</b></font></td></tr>";
			}
			else
			{
				output_form += (min_mass+i);
				output_form += "<font></td><td width=50% align=right>";
				output_form += convertRound((a[i]/max_value)*100,getAbundanceRound());
				output_form += "</td></tr>";
			}
			Formula += convertRound((a[i]/max_value)*100,1);
			Formula += "</font></td><td width=40 valign=bottom height=21 align=center><font color=#008000 size=2>";
			if((min_mass+i)==convertRound(MolecularMass,0))
				imagefile = "red.gif";
			else if(a[i]==max_value)
				imagefile = "blue.gif";
			else
				imagefile = "line.gif";
			image_sample=image_sample + "<td width=40 valign=bottom align=center height=144><img src='"+imagefile+"' border=0 width=1 height=";
			image_sample += (convertRound((a[i]/max_value)*100,1)*2+1);
			image_sample += " align=bottom></td>";
			bottom_line += "<td width=40 height=1 align=center><img src='line.gif' border=0 width=40 height=2 align=bottom></td>";
			mass_value += "<td width=40 align=center height=21><font size=2>";
			mass_value += (min_mass+i);
			mass_value += "</font></td>";
		}
		output_form += "</table>";
		Formula += "</tr>";
		image_sample += "</tr>";
		bottom_line += "</tr>";
		mass_value += "</tr>";
		Formula=Formula + image_sample + bottom_line + mass_value +"</table>"+"<br>"+"<br>"+output_form;
	}
	else
	{
		var max_value=getMax(HighResolutionAbundance);
		var step = 0;
		var output_form="<table border=1 width=24% cellspacing=0 bordercolorlight=#808000 bordercolordark=#FFFFFF cellpadding=0 height=170 width=21%><tr><td width=50% bgcolor=#C0C0C0><b><font color=#800000>Exact Mass</font></b></td><td width=50% align=right bgcolor=#C0C0C0><b><font color=#800000>%</font></b></td></tr>";
		var table_head = "<table border=0 width=8 cellspacing=0 cellpadding=0><tr><td width=50 align=center valign=bottom></td><td width=50 align=center valign=bottom><p align=left><font size=2>%</font></td>";
		var table_head_1 = "</td><td width=50 align=center></td>";
		var graph_head = "<tr><td width=50 align=center valign=bottom><img border=0 src=line.gif width=2 height=200 hspace=2 align=left></td><td width=50 align=center valign=bottom><p align=center>";
		var graph_head_1 = table_head_1;
		var graph_bottom = "<tr><td width=50><p align=center><img border=0 src=line.gif width=6 height=2></td><td width=50><p align=center><img border=0 src=line.gif width=50 height=2></p></td>";
		var graph_bottom_1 = "</td></tr>";
		var graph_data = "<tr><td width=50 align=center><img border=0 src=line.gif width=1 height=3 hspace=2 align=top><img border=0 src=line.gif width=1 height=3 hspace=2 align=top><img border=0 src=line.gif width=1 height=3 hspace=2 align=top><img border=0 src=line.gif width=1 height=3 hspace=2 align=top><img border=0 src=line.gif width=1 height=6 hspace=2 align=top>";
		var graph_data_1 = "<td width=50 align=left></td></tr>";
		var graph_mark = "<tr><td width=50 align=center valign=bottom></td><td width=50 align=center><img border=0 src=line.gif width=1 height=3 hspace=2 align=top><img border=0 src=line.gif width=1 height=3 hspace=2 align=top><img border=0 src=line.gif width=1 height=3 hspace=2 align=top><img border=0 src=line.gif width=1 height=3 hspace=2 align=top><img border=0 src=line.gif width=1 height=6 hspace=2 align=top><img border=0 src=line.gif width=1 height=3 hspace=2 align=top><img border=0 src=line.gif width=1 height=3 hspace=2 align=top><img border=0 src=line.gif width=1 height=3 hspace=2 align=top><img border=0 src=line.gif width=1 height=3 hspace=2 align=top><img border=0 src=line.gif width=1 height=3 hspace=2 align=top></td>";
		var graph_mark_1 = "</td></tr>";
		var graph_mass = "<tr><td width=50 align=center valign=bottom></td><td width=50 align=center><p align=left><font size=2>Mass</font></td>";
		var graph_mass_1 = "<td width=50 align=center></td></tr></table>";
		var loop_number = 0, graph_show_min_mass=0;				
		var getLoop = false;
		var last_loop_number = 0;
		var IncreaseMass = 0;
		var AddTableMark = 0;
		var ExactMassLabel = "";
		var BiggestAbundanceNumber = 0;
		var ExactMassNumber = 0;
		for(i=0; i<HighResolutionMass.length; i++)
		{
			HighResolutionAbundance[i] = (HighResolutionAbundance[i]/max_value)*100;
			if(HighResolutionAbundance[i]==100)
				BiggestAbundanceNumber = i;
			if(convertRound(HighResolutionMass[i],6)==convertRound(MolecularMass,6))
				ExactMassNumber = i;
		}
		var ShowBiggestAbundance = false;
		var ShowExactMass = false;

		for(i=0; i<HighResolutionMass.length; i++)
		{
			if((fromValue > HighResolutionMass[i]) || (toValue < HighResolutionMass[i]) && toValue > fromValue) continue; // && toValue > HighResolutionMass[HighResolutionMass.length - 1]&& fromValue < HighResolutionMass[0]
			if(HighResolutionAbundance[i] >= MinAbundance()*100)
			{
				if(!getLoop)
				{
					loop_number = HighResolutionMass[HighResolutionMass.length-1] - HighResolutionMass[i] - 1;
					graph_show_min_mass = Math.floor(HighResolutionMass[i]);
					IncreaseMass = graph_show_min_mass - 0.4;
					getLoop = true;
				}							
				for(j=last_loop_number; j<= (loop_number+3)*10; j++)
				{
					var AbundanceMax = 0;
					var ExactMassForAbundanceMax = 0;
					if(convertRound(HighResolutionMass[i],1)==convertRound(IncreaseMass,1))
					{						
						while(convertRound(HighResolutionMass[i],1)==convertRound(IncreaseMass,1))
						{
							if(AbundanceMax < HighResolutionAbundance[i])
							{
								AbundanceMax = HighResolutionAbundance[i];
								ExactMassForAbundanceMax = HighResolutionMass[i];
							}
							if(document.formula.D3.selectedIndex == 0)
								ExactMassLabel += "<font size=1 color=000000 style=\"position: absolute;left:"+ExactMass_x+"px;top:"+convertRound((ExactMass_y - 2*HighResolutionAbundance[i]),1)+"px\">"+convertRound(HighResolutionMass[i],4)+"("+convertRound(HighResolutionAbundance[i],1)+"%)</font>";
							else if(document.formula.D3.selectedIndex == 1)
								ExactMassLabel += "<font size=1 color=000000 style=\"position: absolute;left:"+ExactMass_x+"px;top:"+convertRound((ExactMass_y - 2*HighResolutionAbundance[i]),1)+"px\">"+convertRound(HighResolutionMass[i],4)+"</font>";
							else if(document.formula.D3.selectedIndex == 2)
								ExactMassLabel += "<font size=1 color=000000 style=\"position: absolute;left:"+ExactMass_x+"px;top:"+convertRound((ExactMass_y - 2*HighResolutionAbundance[i]),1)+"px\">"+convertRound(HighResolutionAbundance[i],1)+"%</font>";
							if(i == ExactMassNumber)
							{
								ShowExactMass = true;
								
							}
							else if(i == BiggestAbundanceNumber)
							{
								ShowBiggestAbundance = true;
								
							}
							
								
							i++;							
						}
						i--;
						if(document.formula.D3.selectedIndex == 3)	
							ExactMassLabel += "<font size=1 style=\"position:absolute; left:"+ExactMass_x+"px;top:"+convertRound((ExactMass_y - 2*AbundanceMax),1)+"px\">"+convertRound(ExactMassForAbundanceMax,4)+"</font>";					
						if(ShowExactMass)
						{
							graph_head += "<img border=0 src='red.gif' width=1 height="+2*AbundanceMax+" hspace=2 align=absbottom>";
							ShowExactMass = false;
						}
						else if(ShowBiggestAbundance)
						{
							graph_head += "<img border=0 src='blue.gif' width=1 height="+2*AbundanceMax+" hspace=2 align=absbottom>";
							ShowBiggestAbundance = false;
						}
						else
							graph_head += "<img border=0 src=line.gif width=1 height="+2*AbundanceMax+" hspace=2 align=absbottom>";
						IncreaseMass += 0.1;
						AddTableMark++;
						ExactMass_x += 5;
						if(AddTableMark%10==0)
							graph_head += "</p></td><td width=50 align=center valign=bottom><p align=center>";
						break;
					}
					else 
					{
						graph_head += "<img border=0 src=noshow.gif width=1 height=1 hspace=2 align=absbottom>";
						IncreaseMass += 0.1;
						AddTableMark++;
						ExactMass_x += 5;
						if(AddTableMark%10==0)
							graph_head += "</p></td><td width=50 align=center valign=bottom><p align=center>";
					}						
				}
				last_loop_number = j+1;
			}
		}
		for(i=0; i<HighResolutionMass.length; i++)
		{
			if((fromValue > HighResolutionMass[i]) || (toValue < HighResolutionMass[i]) && toValue > fromValue) continue;			
			if(HighResolutionAbundance[i] >= MinAbundance()*100)
			{
				if(i == ExactMassNumber)
					output_form += "<tr><td width=50%><font color='#ff0000'><b>"+convertRound(HighResolutionMass[i],document.formula.D1.selectedIndex)+"</b></font></td><td width=50% align=right><font color='#ff0000'><b>"+convertRound(HighResolutionAbundance[i],getAbundanceRound())+"</b></font>";
				else if(i == BiggestAbundanceNumber)
					output_form += "<tr><td width=50%><font color='#0000ff'><b>"+convertRound(HighResolutionMass[i],document.formula.D1.selectedIndex)+"</b></font></td><td width=50% align=right><font color='#0000ff'><b>"+convertRound(HighResolutionAbundance[i],getAbundanceRound())+"</b></font>";
				else
					output_form += "<tr><td width=50%>"+convertRound(HighResolutionMass[i],document.formula.D1.selectedIndex)+"<font></td><td width=50% align=right>"+convertRound(HighResolutionAbundance[i],getAbundanceRound());
			}
			else
			{
				output_form += "<tr><td width=50%><font color = '#808000'>"+convertRound(HighResolutionMass[i],document.formula.D1.selectedIndex)+"</font></td><td width=50% align=right><font color = '#808000'>"+convertRound(HighResolutionAbundance[i],getAbundanceRound())+"</font>";
			}						
		}
		if(AddTableMark%10 !=0)
		{
			for(var k=0; k < 10 - AddTableMark%10;k++)
			graph_head += "<img border=0 src=noshow.gif width=1 height=1 hspace=2 align=absbottom>";
		}
		var minusMarkNumber = 0;
		if(toValue < HighResolutionMass[HighResolutionMass.length-1] && toValue > fromValue)
			minusMarkNumber = HighResolutionMass[HighResolutionMass.length-1] - toValue + 1;
		for(i=0; i < loop_number+2 - minusMarkNumber; i++)
		{
			
			table_head += "<td width=50 align=center valign=bottom></td>";
			graph_bottom += "<td width=50><p align=center><img border=0 src=line.gif width=50 height=2></p></td>";
			graph_mark +="<td width=50 align=center><img border=0 src=line.gif width=1 height=3 hspace=2 align=top><img border=0 src=line.gif width=1 height=3 hspace=2 align=top><img border=0 src=line.gif width=1 height=3 hspace=2 align=top><img border=0 src=line.gif width=1 height=3 hspace=2 align=top><img border=0 src=line.gif width=1 height=6 hspace=2 align=top><img border=0 src=line.gif width=1 height=3 hspace=2 align=top><img border=0 src=line.gif width=1 height=3 hspace=2 align=top><img border=0 src=line.gif width=1 height=3 hspace=2 align=top><img border=0 src=line.gif width=1 height=3 hspace=2 align=top><img border=0 src=line.gif width=1 height=3 hspace=2 align=top></td>";
			graph_mass += "<td width=50 align=center><p align=center><font size=2>";
			graph_mass += (graph_show_min_mass + 1 + i);
			graph_mass += "</font></td>";
		}
		output_form += "</td></tr></table>";
		Formula = Formula + table_head + table_head_1 + graph_head + graph_head_1 + graph_bottom + graph_bottom_1 + graph_mark + graph_mark_1 + graph_mass + graph_mass_1+"<br>"+output_form + ExactMassLabel;
	}
	Formula+=Formula7;
	Formula+=right_declaim;
	document.formula.calcuResult.value = Formula;
	openWindow("");
	return;
}
function openWindow(content)
{
	var win1 = window.open(windowName,"","scrollbars,menubar,resizable,width="+(screen.width-10)+",height="+(screen.height-90)+ "screenx=0, screeny=0, left = 0, top = 0");
	win1.focus();
	return;
}
function openwindow( url, winName, width, height) 
{
	var xposition=0, yposition=0, theproperty = "";
	if ((parseInt(navigator.appVersion) >= 4 ))
	{
		xposition = (screen.width - width) - 20;
		yposition = 100;
	}
	theproperty = "width=" + width + "," + "height=" + height + "," + "location=0," + "menubar=1," + "resizable=1," + "scrollbars=1,"+ "status=0," + "titlebar=0,"+ "toolbar=0,"+ "hotkeys=0,";
	theproperty = theproperty + "screenx=" + xposition + ",";
	theproperty = theproperty + "screeny=" + yposition + ",";
	theproperty = theproperty + "left=" + xposition + ",";
	theproperty = theproperty + "top=" + yposition;
	window.open( url,winName,theproperty );
}
