User:BorisTM/SynOrganicBoxInfo.js

//

function build_synInfoBox {

vr_Str=obj.innerHTML; /* obj=document.getElementById('synChemInfoBox'); */ if (obj.attributes.length < 3 && document.getElementById('synChemInfoBox')) { // Get the data ip=vr_Str.indexOf('^^',vr_Str.indexOf('theBoxInfo')); if (ip > 0) { tb_nf=(na_ua.indexOf("Netscape") >= 0 || na_ua.indexOf("Firefox") >= 0)?true:false; if (tb_nf) vr_Str=vr_Str.substring((ip-(-2)),vr_Str.lastIndexOf('</p',vr_Str.lastIndexOf('<A HREF="); inf['image']=vr_Str.substring(ip,(vr_Str.indexOf(" ALT=",ip)-1)); inf['path']=vr_Str.substring((ip_2-(-10)),(vr_Str.indexOf(" CLASS=",ip_2)-1)); }	}

// Sets the TABLE's attributes obj.style.margin="0 0 0.5em 0.5em"; obj.style.backgroundColor="RoyalBlue"; obj.style.borderWidth="0px"; obj.style.borderCollapse="separate"; obj.style.padding="0px"; obj.style.fontSize="95%"; obj.style.float="right"; obj.setAttribute("align","right"); obj.cellPadding="2"; obj.cellSpacing="1"; obj.setAttribute("border","0"); obj.setAttribute("width","326"); obj=obj.firstChild;

while (obj.firstChild) obj.removeChild(obj.firstChild);

// Builds the NAME header if (!inf['name'] || inf['name']=="") { vr_Str=document.title; firstIndex=vr_Str.indexOf(":")>0?vr_Str.indexOf(":")+1:0; inf['name']=vr_Str.substring(firstIndex,vr_Str.indexOf(" - Wikipedia, the free encyclopedia")); }	build_TR(document.createTextNode(inf['name']),"4","#dfefff");

// Builds the IMAGE section build_TR("","4"); _html = ""; new_TD.innerHTML=_html;

/* ---         Builds the GENERAL header --- */	build_TR(document.createTextNode("General"),"4","#dfefff");

// Builds the IUPAC NAME section if (!inf['IUPAC'] || inf['IUPAC']=="") inf['IUPAC']="?"; build_TR(build_wiki_A("IUPAC_nomenclature","IUPAC_nomenclature","Chemical name"),"4"); build_TR("","4"); new_TD.innerHTML=inf['IUPAC'];

// Builds the SYNONYMS section if (inf['synonyms'] && !(inf['synonyms']=="")) { build_TR(build_wiki_A("Synonyms","Synonyms","Synonyms"),"4"); build_TR("","4"); if (!(inf['num_syn'] == undefined)) { if (inf['num_syn'] == "small") new_TD.innerHTML=inf['synonyms']; else build_the_synonyms(inf['synonyms']); }	}

// Builds the ABBREVIATION section if (inf['abbreviations'] && !(inf['abbreviations']=="")) { build_TR(build_wiki_A("Abbreviations","Abbreviations","Abbreviations"),"2"); build_TD(""); new_TD.innerHTML=inf['abbreviations']; new_TD.setAttribute("verticalAlign","top"); }

// Builds the FORMULA section if (!inf['formula'] || inf['formula']=="") inf['formula']="?"; build_TR(build_wiki_A("Chemical formula","Chemical formula","Chemical formula"),"2"); new_TD.setAttribute("verticalAlign","top"); new_TD.setAttribute("whiteSpace","nowrap"); new_TD.setAttribute("width","50%"); build_TD(""); new_TD.innerHTML=inf['formula']; new_TD.setAttribute("width","50%");

/* ---   Builds the PHYSICAL PROPERTIES header --- */	build_TR(document.createTextNode("Physical properties"),"4","#dfefff");

// Builds the MAS, DENSITY, and TEMPERATURES sections new_TR=document.createElement("TR"); obj.appendChild(new_TR); if (!inf['mass'] || inf['mass']=="") inf['mass']="?"; build_TD_phys("undefinedM (g/mol)undefined","Molecular_mass","Molecular_mass","id_M"); if (!inf['density'] || inf['density']=="") inf['density']="?"; build_TD_phys("undefined&rho; (g/cm3)undefined","Density","Density","id_rho"); if (!inf['Tm'] || inf['Tm']=="") inf['Tm']="?"; build_TD_phys("undefinedTm (&deg;C)undefined","Melting_point","Melting point","id_Tm"); if (!inf['Td']) { build_TD_phys("undefinedTb (&deg;C)undefined","Boiling_point","Boiling point","id_Tb"); t_CritVal=(!inf['Tb'] || inf['Tb']=="")?'?':inf['Tb']; }	else { build_TD_phys("undefinedTd (&deg;C)undefined","Decomposition_temperature","Decomposition temperature","id_Td"); t_CritVal=(!(inf['Td']==""))?inf['Td']:'?'; }	new_TR=document.createElement("TR"); obj.appendChild(new_TR); build_TD_phys(inf['mass']); build_TD_phys(inf['density']); build_TD_phys(inf['Tm']); build_TD_phys(t_CritVal);

/* ---   Builds the CHEMICAL PROPERTIES header --- */	build_TR(document.createTextNode("Chemical properties"),"4","#dfefff");

// Builds the pKi section build_acid_base("pI","Isoelectric_point","Isoelectric point","pI");

// Builds the pKa section build_acid_base("pKa","Acid_dissociation_constant","Acid dissociation constant","pKa");

// Builds the H-BOND ACCEPTOR section build_H_bond("h_bond_acceptor"," acceptors");

// Builds the H-BOND DONOR section build_H_bond("h_bond_donor"," donors");

// Builds the TAUTOMERS section if (inf['tautomers'] && !(inf['tautomers']=="")) { build_TR(build_wiki_A("Tautomers","Tautomer","Tautomers"),"2"); build_TD(document.createTextNode(inf['tautomers'])); }

/* ---      Builds the MISCELLANEOUS header --- */	build_TR(document.createTextNode("Miscellaneous"),"4","#dfefff");

// Builds the CAS section if (!inf['CAS'] || inf['CAS']=="") inf['CAS']="?"; build_TR(build_wiki_A("CAS_registry_number","CAS registry number","CAS"),"2"); build_TD(build_ref_A(inf['CAS']));

// Builds the EINECS section if (inf['EINECS'] && !(inf['EINECS']=="")) { build_TR(build_wiki_A("EINECS_number","EINECS","EINECS"),"2"); build_TD(document.createTextNode(inf['EINECS'])); }

// Builds the PubChem section if (!inf['PubChem'] || inf['PubChem']=="") inf['PubChem']="?"; build_TR(build_wiki_A("PubChem","PubChem","PubChem"),"2"); build_TD(build_ref_A(inf['PubChem']));

/* Builds the SMILES section if (!inf['SMILES'] || inf['SMILES']=="") inf['SMILES']="?"; build_TR(build_wiki_A("SMILES","SMILES","SMILES"),"4"); build_TR(document.createTextNode(inf['SMILES']),"4");

}

//