
// *** Browser detection ***
// NS is true when the browser is Netscape 4 or higher
// IE  is true when the browser is Explorer 4 or higher
// V3 is true when the browser isn't a 4th generation browser

    var ag = navigator.userAgent.toLowerCase(); 
    var vr = parseInt(navigator.appVersion); 
    var NS = ((ag.indexOf('mozilla')!=-1) && (ag.indexOf('spoofer')==-1) && (ag.indexOf('compatible') == -1) && (ag.indexOf('opera')==-1) && (ag.indexOf('webtv')==-1)
&& (vr >= 4));
    var IE = ((ag.indexOf("msie") != -1) && (vr >= 4)); 
    var V3 = !IE&&!NS
	
// *** Menu general ***

function writemnu(prefix,fld,stattitle,showstat){
document.writeln('<div align="center"><center><table border="0" cellpadding="0" cellspacing="0" bordercolor="#000080"><tr><td height="3">&nbsp;</td></tr><tr>');
additem(prefix+"index.html",fld,"hom","Go back to the homepage ...");
addspace();
additem(prefix+"prg/index.html",fld,"prg","Try the programs I created ...");
additem(prefix+"windowshome.html",fld,"win","Enhance your OS ...");
additem(prefix+"metawizard.html",fld,"wiz","Define your <META> tags easily ...");
additem(prefix+"fnt/index.html",fld,"fnt","43 fancy fonts for you ...");
additem(prefix+"mid/index.html",fld,"mid","46 famous tunes for your site ...");
addspace();
additem(prefix+"sch/index.html",fld,"sch","Find what you need on my website ...");
additem(prefix+"linktous.html",fld,"lnk","And we will link to you ...");
additem(prefix+"contactus.html",fld,"cnt","Wanna write to us ?");
document.writeln('<td align="center"><br><br><br><br><div id=stat style="visibility:show">');
if(showstat==1){
document.writeln('<a href="http://www.estat.com/getstats?serial=13901526299"><img src="http://perso.estat.com/cgi-bin/perso/13901526299?page='+stattitle+'" border=0></a>');
}
document.writeln('</div></td></tr></table></center></div>');
}

// *** Menu add item and space ***

function additem(lnk,fld1,nam,desc){
document.writeln('<td><a href="'+lnk+'"><img src="'+fld1+'b0_'+nam+'.gif" width="119" height="29" border="0" name='+nam+' onmouseover="b_1(\''+nam+'\',\''+fld1+'\'); window.status=\''+desc+'\'; return true" onmouseout="b_0(\''+nam+'\',\''+fld1+'\'); window.status=\'\';return true"></a></td></tr><tr>');
}
function addspace(){
document.writeln('<td>&nbsp;</td></tr><tr>');
}

// *** Menu rollover ***

function b_1(nm,fld2){
document.images[nm].src=fld2+'b1_'+nm+'.gif'
}
function b_0(nm,fld2){
document.images[nm].src=fld2+'b0_'+nm+'.gif'
}

// *** Link colors ***

    document.writeln('<style><!-- a:hover{color:2255FF;text-decoration:underline} a{color:darkblue;text-decoration:none}; --></style>')


// *** E-mail checking script ***

var mailVal="user@host.domain";
var subjVal="Write the subject here";
var nameVal="Write your name or nickname here";
var cntrVal="Write your country here";
var langVal="Write your language here";
function test(){
   var mail=document.Mailer.from.value;
   var sbj=document.Mailer.Subject;
   var nm=document.Mailer.Name_;
   var sx=document.Mailer.Gender;
   var age=document.Mailer.Age;
   var cnt=document.Mailer.Country;
   var lang=document.Mailer.Language;
   var seng=document.Mailer.searchEngine;
   var eng=document.Mailer.otherEngine;
   var homep=document.Mailer.Perso;
   var txt=document.Mailer.Text;
// * Testing form fields *
// Email test
if(mail==mailVal||mail.length<9||mail.indexOf("@")==-1||mail.indexOf(".")==-1||mail.indexOf("..")!=-1||mail.indexOf(" ")!=-1||mail.indexOf(",")!=-1||mail.indexOf(":")!=-1||mail.indexOf("?")!=-1){
   if(IE){document.Mailer.from.style.border="double"}
	 alert("Please write a valid email.");
	 return false};
// Subject test
if(sbj.value==subjVal||sbj.value==""||sbj.value.length<4){
   if(IE){sbj.style.border="double"}
	 alert("Please fill the subject field correctly.");
	 return false};
// Name test
if(nm.value==nameVal||nm.value==""||nm.value.length<4){
   if(IE){nm.style.border="double"}
	 alert("If you don't want to give your real name, please write a nickname.");
	 return false};
// Gender test
if(sx.value!="M"&&sx.value!="m"&&sx.value!="F"&&sx.value!="f"){
   if(IE){sx.style.border="double"}
	 alert("Please use M for male and F for female");
	 return false};
// Age test
if(age.value==null||age.value.length!=2||age.value==0){
   if(IE){age.style.border="double"}
	 alert("Please type your age correctly.");
	 return false};	 
// Country test
if(cnt.value==cntrVal||cnt.value==""||cnt.value.length<5){
   if(IE){cnt.style.border="double"}
	 alert("Please fill the country field correctly.");
	 return false};
// Language test
if(lang.value==langVal||lang.value==""||lang.value.length<5){
   if(IE){lang.style.border="double"}
	 alert("Please fill the language field correctly.");
	 return false};
// Engine test
if(document.Mailer.comeFrom[0].checked&&(seng.value=="bzz"||(seng.value=="bz"&&(eng.value==""||eng.value.length<5)))){
   if(IE){eng.style.border="double"}
	 alert("Please fill the search engine field correctly or choose another option.");
	 return false};
// Homepage test
if(document.Mailer.comeFrom[1].checked&&(homep.value==""||homep.value.length<9)){
   if(IE){homep.style.border="double"}
	 alert("Please fill the personal homepage URL field correctly or choose another option.");
	 return false};
// Text test
if(txt.value==""||txt.value.length<21){
   if(IE){txt.style.border="double"}
	 alert("Don't you forget to write the email itself ?");
	 return false}; 
}

// *** End of script ***
