#!/usr/bin/perl -T
use strict;
use warnings;
use RFC::RFCCGI qw(:cgi :html);
use CGI qw(:standard :netscape);

my $rig = param('rig');
my $file = '/celltest/png/rig_'.$rig.'_iv.png';
&print_header(" i-V curve for rig ".$rig,-onload=>'load_start()');
print RFC_start_html(-title=>" i-V curve ", -style=>{src=>'/celltest/RFCcontrol.css'});

print <<END;

<script language="javascript">

function load_start()
{
    load_isiv();
    reloadImage();
}

function reloadImage()
{
    img = document.main.measure_img;
    img.src = '$file?' + Math.random();
    setTimeout("reloadImage()", 2000);
}

function load_isiv()
{
    run_ajax('rig_ajax_run.cgi','&action=is_iv',set_iv);
    setTimeout("load_isiv()",10000);
}

function set_iv(res)
{
    if (res == 1)
    {
	return true;
    }
    else
    {
	self.close();
    }
}


</script>

END

    print start_form(-name=>'main');
print "<img name='measure_img' src='$file'>";
print end_form();
print end_html;

