

/* Pop Up Window to download Mil Specs */

function FreeDownload(id,data)
{
    var loc = 'http://www.ili-info.com/cgi-bin/freedl/Show';
    loc += '/' + data;
    loc += '/' + id;
    loc += '/xx';
    var opts = 'resizable,scrollbars,width=400,height=200';
    var win = window.open(loc,'freedl',opts);
    win.focus();
    return false;
}

/* Functions to show/hide tooltips */

function showtip(current,e,text){
    if (document.all){
        thetitle=text.split('<br>')
        if (thetitle.length>1){
        thetitles=''
        for (i=0;i<thetitle.length;i++)
            thetitles+=thetitle[i]
            current.title=thetitles
        }
    else
        current.title=text
    }
    else if (document.layers){
        document.linktips.document.write('<layer bgColor="yellow" style="border:1px solid black;font-family:arial;font-size:12px;">'+text+'</layer>')
        document.linktips.document.close()
        document.linktips.left=e.pageX+5
        document.linktips.top=e.pageY+5
        document.linktips.visibility="show"
    }
}

function hidetip(){
    if (document.layers)
    document.linktips.visibility="hidden"
}
function checkAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = true ;
}

function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}

function checkNSN() {
    document.batchform.fsc.checked = !document.batchform.fsc.checked;
    document.batchform.inc.checked = !document.batchform.inc.checked;
    document.batchform.itemname.checked = !document.batchform.itemname.checked;
    document.batchform.criticality.checked = !document.batchform.criticality.checked;
    document.batchform.typeofitem.checked = !document.batchform.typeofitem.checked;
    document.batchform.rpdmrc.checked = !document.batchform.rpdmrc.checked;
    document.batchform.demil.checked = !document.batchform.demil.checked;
    document.batchform.hmic.checked = !document.batchform.hmic.checked;
    document.batchform.esdc.checked = !document.batchform.esdc.checked;
    document.batchform.pmic.checked = !document.batchform.pmic.checked;
    document.batchform.adp.checked = !document.batchform.adp.checked;
    document.batchform.isc.checked = !document.batchform.isc.checked;
}
function checkMCRL() {
    document.batchform.cage.checked = !document.batchform.cage.checked;
    document.batchform.partno.checked = !document.batchform.partno.checked;
    document.batchform.rnfc.checked = !document.batchform.rnfc.checked;
    document.batchform.rncc.checked = !document.batchform.rncc.checked;
    document.batchform.rnvc.checked = !document.batchform.rnvc.checked;
    document.batchform.rnaac.checked = !document.batchform.rnaac.checked;
    document.batchform.rnsc.checked = !document.batchform.rnsc.checked;
    document.batchform.rnjc.checked = !document.batchform.rnjc.checked;
    document.batchform.dac.checked = !document.batchform.dac.checked;
    document.batchform.sadc.checked = !document.batchform.sadc.checked;
    document.batchform.hcc.checked = !document.batchform.hcc.checked;
    document.batchform.msds.checked = !document.batchform.msds.checked;
}
function checkMLC() {
    document.batchform.sa.checked = !document.batchform.sa.checked;
    document.batchform.sos.checked = !document.batchform.sos.checked;
    document.batchform.usc.checked = !document.batchform.usc.checked;
    document.batchform.aac.checked = !document.batchform.aac.checked;
    document.batchform.qup.checked = !document.batchform.qup.checked;
    document.batchform.ui.checked = !document.batchform.ui.checked;
    document.batchform.uicf.checked = !document.batchform.uicf.checked;
    document.batchform.uprice.checked = !document.batchform.uprice.checked;
    document.batchform.slc.checked = !document.batchform.slc.checked;
    document.batchform.ciic.checked = !document.batchform.ciic.checked;
    document.batchform.rep.checked = !document.batchform.rep.checked;
    document.batchform.mgmntcontrol.checked = !document.batchform.mgmntcontrol.checked;
    document.batchform.phrasecode.checked = !document.batchform.phrasecode.checked;
    document.batchform.phrase.checked = !document.batchform.phrase.checked;
    document.batchform.qpa.checked = !document.batchform.qpa.checked;
    document.batchform.umc.checked = !document.batchform.umc.checked;
    document.batchform.oou.checked = !document.batchform.oou.checked;
    document.batchform.jtc.checked = !document.batchform.jtc.checked;
}
function checkCHAR() {
    document.batchform.mrc.checked = !document.batchform.mrc.checked;
    document.batchform.require.checked = !document.batchform.require.checked;
    document.batchform.response.checked = !document.batchform.response.checked;
}
function checkPurchase() {
    document.batchform.purchasecage.checked = !document.batchform.purchasecage.checked;
    document.batchform.purchasedate.checked = !document.batchform.purchasedate.checked;
    document.batchform.purchasepiin.checked = !document.batchform.purchasepiin.checked;
    document.batchform.purchaseclin.checked = !document.batchform.purchaseclin.checked;
    document.batchform.purchaseqty.checked = !document.batchform.purchaseqty.checked;
    document.batchform.purchaseuprice.checked = !document.batchform.purchaseuprice.checked;
    document.batchform.purchasetprice.checked = !document.batchform.purchasetprice.checked;
}
function checkNavyWUC() {
    document.batchform.wuc_tec.checked = !document.batchform.wuc_tec.checked;
    document.batchform.wuc.checked = !document.batchform.wuc.checked;
    document.batchform.wuc_wucname.checked = !document.batchform.wuc_wucname.checked;
    document.batchform.wuc_cage.checked = !document.batchform.wuc_cage.checked;
    document.batchform.wuc_partno.checked = !document.batchform.wuc_partno.checked;
    document.batchform.wuc_price.checked = !document.batchform.wuc_price.checked;
    document.batchform.wuc_smr.checked = !document.batchform.wuc_smr.checked;
}
function checkNavyMRIL() {
    document.batchform.mril_cog.checked = !document.batchform.mril_cog.checked;
    document.batchform.mril_mcc.checked = !document.batchform.mril_mcc.checked;
    document.batchform.mril_smic.checked = !document.batchform.mril_smic.checked;
    document.batchform.mril_repair.checked = !document.batchform.mril_repair.checked;
    document.batchform.mril_sec.checked = !document.batchform.mril_sec.checked;
    document.batchform.mril_rip.checked = !document.batchform.mril_rip.checked;
    document.batchform.mril_scc.checked = !document.batchform.mril_scc.checked;
    document.batchform.mril_recover.checked = !document.batchform.mril_recover.checked;
    document.batchform.mril_lrc.checked = !document.batchform.mril_lrc.checked;
    document.batchform.mril_mod.checked = !document.batchform.mril_mod.checked;
    document.batchform.mril_fgc.checked = !document.batchform.mril_fgc.checked;
    document.batchform.mril_frc.checked = !document.batchform.mril_frc.checked;
    document.batchform.mril_shipcode.checked = !document.batchform.mril_shipcode.checked;
    document.batchform.mril_mpd.checked = !document.batchform.mril_mpd.checked;
    document.batchform.mril_src.checked = !document.batchform.mril_src.checked;
    document.batchform.mril_demil.checked = !document.batchform.mril_demil.checked;
    document.batchform.mril_lsi.checked = !document.batchform.mril_lsi.checked;
    document.batchform.mril_pica.checked = !document.batchform.mril_pica.checked;
    document.batchform.mril_note.checked = !document.batchform.mril_note.checked;
}
function checkNavyLIRSH() {
    document.batchform.lirsh_docid.checked = !document.batchform.lirsh_docid.checked;
    document.batchform.lirsh_mcc.checked = !document.batchform.lirsh_mcc.checked;
    document.batchform.lirsh_smic.checked = !document.batchform.lirsh_smic.checked;
    document.batchform.lirsh_cog.checked = !document.batchform.lirsh_cog.checked;
    document.batchform.lirsh_transdate.checked = !document.batchform.lirsh_transdate.checked;
    document.batchform.lirsh_slc.checked = !document.batchform.lirsh_slc.checked;
    document.batchform.lirsh_scc.checked = !document.batchform.lirsh_scc.checked;
    document.batchform.lirsh_smcc.checked = !document.batchform.lirsh_smcc.checked;
    document.batchform.lirsh_demil.checked = !document.batchform.lirsh_demil.checked;
    document.batchform.lirsh_slac.checked = !document.batchform.lirsh_slac.checked;
}
function checkNavyNMDF() {
    document.batchform.nmdf_cog.checked = !document.batchform.nmdf_cog.checked;
    document.batchform.nmdf_mcc.checked = !document.batchform.nmdf_mcc.checked;
    document.batchform.nmdf_smic.checked = !document.batchform.nmdf_smic.checked;
    document.batchform.nmdf_qup.checked = !document.batchform.nmdf_qup.checked;
    document.batchform.nmdf_slc.checked = !document.batchform.nmdf_slc.checked;
    document.batchform.nmdf_slac.checked = !document.batchform.nmdf_slac.checked;
    document.batchform.nmdf_uprice.checked = !document.batchform.nmdf_uprice.checked;
    document.batchform.nmdf_ui.checked = !document.batchform.nmdf_ui.checked;
    document.batchform.nmdf_iss.checked = !document.batchform.nmdf_iss.checked;
    document.batchform.nmdf_aac.checked = !document.batchform.nmdf_aac.checked;
    document.batchform.nmdf_scc.checked = !document.batchform.nmdf_scc.checked;
    document.batchform.nmdf_dl_uicf.checked = !document.batchform.nmdf_dl_uicf.checked;
    document.batchform.nmdf_uicf.checked = !document.batchform.nmdf_uicf.checked;
    document.batchform.nmdf_mpc.checked = !document.batchform.nmdf_mpc.checked;
    document.batchform.nmdf_sos.checked = !document.batchform.nmdf_sos.checked;
    document.batchform.nmdf_smcc.checked = !document.batchform.nmdf_smcc.checked;
    document.batchform.nmdf_changecode.checked = !document.batchform.nmdf_changecode.checked;
    document.batchform.nmdf_demil.checked = !document.batchform.nmdf_demil.checked;
    document.batchform.nmdf_effdatechange.checked = !document.batchform.nmdf_effdatechange.checked;
    document.batchform.nmdf_pubcycle.checked = !document.batchform.nmdf_pubcycle.checked;
    document.batchform.nmdf_pubindicator.checked = !document.batchform.nmdf_pubindicator.checked;
    document.batchform.nmdf_typestorage.checked = !document.batchform.nmdf_typestorage.checked;
    document.batchform.nmdf_netcube.checked = !document.batchform.nmdf_netcube.checked;
    document.batchform.nmdf_netprice.checked = !document.batchform.nmdf_netprice.checked;
    document.batchform.nmdf_phic.checked = !document.batchform.nmdf_phic.checked;
    document.batchform.nmdf_adpe.checked = !document.batchform.nmdf_adpe.checked;
    document.batchform.nmdf_old_ui.checked = !document.batchform.nmdf_old_ui.checked;
    document.batchform.nmdf_entrydate.checked = !document.batchform.nmdf_entrydate.checked;
    document.batchform.nmdf_netweight.checked = !document.batchform.nmdf_netweight.checked;
    document.batchform.nmdf_hazardous.checked = !document.batchform.nmdf_hazardous.checked;
    document.batchform.nmdf_grossweight.checked = !document.batchform.nmdf_grossweight.checked;
    document.batchform.nmdf_grosscube.checked = !document.batchform.nmdf_grosscube.checked;
}

function checkMOE() {
    document.batchform.moe_rule.checked = !document.batchform.moe_rule.checked;
    document.batchform.moe_amc.checked = !document.batchform.moe_amc.checked;
    document.batchform.moe_amsc.checked = !document.batchform.moe_amsc.checked;
    document.batchform.moe_nimsc.checked = !document.batchform.moe_nimsc.checked;
    document.batchform.moe_imc.checked = !document.batchform.moe_imc.checked;
    document.batchform.moe_imca.checked = !document.batchform.moe_imca.checked;
    document.batchform.moe_dsorc.checked = !document.batchform.moe_dsorc.checked;
    document.batchform.moe_aac.checked = !document.batchform.moe_aac.checked;
    document.batchform.moe_suppcollab.checked = !document.batchform.moe_suppcollab.checked;
    document.batchform.moe_supprecv.checked = !document.batchform.moe_supprecv.checked;
    document.batchform.moe_formermoe.checked = !document.batchform.moe_formermoe.checked;
    document.batchform.moe_effdate.checked = !document.batchform.moe_effdate.checked;
}

function checkSTD() {
    document.batchform.std_isc.checked = !document.batchform.std_isc.checked;
    document.batchform.std_originator.checked = !document.batchform.std_originator.checked;
    document.batchform.std_date.checked = !document.batchform.std_date.checked;
    document.batchform.std_status.checked = !document.batchform.std_status.checked;
    document.batchform.std_replacementfsc.checked = !document.batchform.std_replacementfsc.checked;
    document.batchform.std_replacementniin.checked = !document.batchform.std_replacementniin.checked;
}
function checkAPL() {
    document.batchform.apl_number.checked = !document.batchform.apl_number.checked;
    document.batchform.apl_name.checked = !document.batchform.apl_name.checked;
}

function getDocHeight(doc) {
    var docHt = 0, sh, oh;
    if (doc.height) docHt = doc.height;
    else if (doc.body) {
	    if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
	    if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
	    if (sh && oh) docHt = Math.max(sh, oh);
    }
    return docHt
}

function setIframeHeight(iframeName) {
    var iframeWin = window.frames[iframeName];
    var iframeEl = document.getElementById? document.getElementById(iframeName): document.all? document.all[iframeName]: null;
    if (iframeEl && iframeWin) {
	iframeEl.style.height = "auto";
	var docHt = getDocHeight(iframeWin.document);
	if (docHt) iframeEl.style.height = docHt + 20 + "px";
    }
}

function submitEnter(myfield,e)
{
    var keycode;
    if (window.event) keycode = window.event.keyCode;
    else if (e) keycode = e.which;
    else return true;
    if (keycode == 13)
    {
        //document.search.submit();
        myfield.form.submit();
        return false;
    }
    else
        return true;
}

	function MM_preloadImages() { //v3.0
	  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}

	function MM_swapImgRestore() { //v3.0
	  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}

	function MM_findObj(n, d) { //v4.01
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}

	function MM_swapImage() { //v3.0
	  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
        
function changeSupp() {
 box = document.forms[0].method;
 destination = box.options[box.selectedIndex].value;
 if (destination) location.href=destination;
}

function getSID(c_name)
{
    if (document.cookie.length>0)
    {
        c_start=document.cookie.indexOf(c_name + "=")
        if (c_start!=-1)
        {
            c_start=c_start + c_name.length+1
            c_end=document.cookie.indexOf(";",c_start)
            if (c_end==-1) c_end=document.cookie.length
            return unescape(document.cookie.substring(c_start,c_end))
        }
    }
    return ""
    
}
