#!/usr/bin/perl

use strict;
use ZTab;

my $pwd = `pwd`;
chomp $pwd;

my $css = ZTab::make_css(
			tab=>{'background-color' => 'lightblue'},
			tabHover=>{'background-color'=> 'red' },
                      );

my $pwd = `pwd`;
chomp $pwd;
my $js = ZTab::make_js (
			jslib => 'jslib/tabs',
#			jslib => '<| /preview/www.dekanat.ru/jslib/tabs |>',
#			base => '<| /preview/www.dekanat.ru/login.html |>',
			base => 'file://'.$pwd.'/',
		     );


my $body_attr = ZTab::body_attr();

my $tab1 = ZTab->new();

$tab1->add_tab( tab => 'Common', content =>1 );
$tab1->add_tab( tab => 'Documents', content =>2 );
$tab1->add_tab( tab => 'Address', content =>3 );
$tab1->add_tab( tab => 'Education', content =>4 );
$tab1->add_tab( tab => 'Contract', content =>5 );
$tab1->add_tab( tab => 'Misc.', content =>'' );
$tab1->set_tab( 1, tab =>'CV', content =>'This tab replaced <b>"Document"</b> tab' ); # replace second tab

my $tab2 = ZTab->new();

$tab2->add_tab( tab => 'Motheboards', content => '
<select name="mb">
<option value="intel">Intel
<option value="asus">Asus
</select>
<input type=text name=text1 value="other">
<input type="SUBMIT" value="Choose">
');
$tab2->add_tab( tab => 'Status', content => '
<input type="radio" name="where" value="1" checked>Good
<input type="radio" name="where" value="-1">Broken
<input type="radio" name="where" value="0">No opinion
');

# Output =====================================================

print<<EOT;
<html>
<head>
$css
$js
</head>
<body $body_attr>
<h1>Using ZTab</h1>
<h2>Simple Tabs</h2>
<table border=0 bgcolor="#EEEEEE"><tr><td nowrap bgcolor="#DDDDDD">
EOT
print $tab1->get_tab(active=>3);
print "</td></tr><tr><td nowrap>\n";
print $tab1->get_content();

print<<EOT;
</td></tr></table>
<form action="">
<h2>Tab with form</h2>
<table border=0 bgcolor="lightblue"><tr><td nowrap>
EOT
print $tab2->get_tab();
print "</td></tr><tr><td nowrap>\n";
print $tab2->get_content();
print<<EOT;
</td></tr></table>
</form>
</body>
</html>
EOT
