var isIE=(navigator.appName.indexOf("Microsoft")!=-1);
var ActiveSubMenu = 0;
var animpos = 1;
var animstep = 1;
var NumSubMenus = 7;
cur="cursor:default;";

if (isIE && navigator.appVersion.indexOf("MSIE 6")!=-1){
  document.write('<style>body,td.i,td.j{cursor:url("res/arrow.cur")}'+
	         'a:hover{cursor:url("res/link.cur")}'+
	         'td.menu,td.submenu{cursor:url("res/link.cur")}</style>');
  cur="cursor:url(\"res/arrow.cur\");";
}

// Loading page - initialization
function BodyLoad(){
  if (self.parent.frames.length>0)
    self.parent.location=self.location;
}

// Displays the beginning of the page
function PageHeader(Title,ItemID){
	document.write('<a name="top"></a><table width=100% height=100% border=0 cellpadding=0'+
	               'cellspacing=0><tr><td align="center" valign="middle" height=60 class="i">');
	if (isIE){document.write('<div class="isanim">'+
	          '<div style="top:+1;left:0;color:#72B0F0" id="isout1">IstraSoft</div>'+
    				'<div style="top:-1;left:0;color:#72B0F0" id="isout2">IstraSoft</div>'+
    				'<div style="top:0;left:-1;color:#72B0F0" id="isout3">IstraSoft</div>'+
    				'<div style="top:0;left:+1;color:#72B0F0" id="isout4">IstraSoft</div>'+
    				'<div style="top:0;left:0;color:#1A1E2E" id="ismain">IstraSoft</div>'+
    				'</div><span class="isanim" style="color:#1A1E2E">IstraSoft</span>')}
	else {document.write('<span class="isanim" style="color:#72B0F0">IstraSoft</span>')};
	document.write('<br><font size=1 color=#72B0F0><b> O &nbsp;&nbsp; N &nbsp;&nbsp; L '+
	               '&nbsp;&nbsp; I &nbsp;&nbsp; N &nbsp;&nbsp; E </b></font></td>'+
     						 '<td width=2 bgcolor=#8E97B0 rowspan=2 style="font-size:1px">&nbsp;'+
								 '</td><td id="maincol" align="center"><div class="pganim"');
	if (!isIE){lft=screen.width/2-Title.length*9.2+15;
	          document.write(' style="top:9;left:'+lft+'"')};
  document.write('><div style="top:+1;left:0;color:#72B0F0" id="pgout1">-&nbsp; '+Title+' &nbsp;-</div>'+
    '<div style="top:-1;left:0;color:#72B0F0" id="pgout2">-&nbsp; '+Title+' &nbsp;-</div>'+
    '<div style="top:0;left:-1;color:#72B0F0" id="pgout3">-&nbsp; '+Title+' &nbsp;-</div>'+
    '<div style="top:0;left:+1;color:#72B0F0" id="pgout4">-&nbsp; '+Title+' &nbsp;-</div>'+
    '<div style="top:0;left:0;color:#1A1E2E" id="pgmain">-&nbsp; '+Title+' &nbsp;-</div>'+
    '</div><span class="pganim" style="color:#1A1E2E">-&nbsp; '+Title+' &nbsp;-</span>'+
	  '</td></tr><tr><td width="190" align="center" valign="top">');
	ActiveItem=ItemID;
	ActiveSubMenu=Math.floor(ItemID/100);
  document.write("<table cellpadding=0 border=0 width=150><tr><td bgcolor=#8E97B0 "+
	 							 "style='font-size:1px'>&nbsp;</td></tr></table>"+
	               "<table width=160 border=0 cellpadding=0 cellspacing=0>"+
								 "<tr><td height=10></td></tr>");

  NewMenuItem("Home","Return back to homepage",1,"index.html","");
  NewMenuItem("News","Something new on this website ?",2,"news.html","");
  NewMenuItem("Forum","",7,"http://membres.lycos.fr/istrasoft/alex/forum.php","");
  NewMenuItem("Software","",3,"","ToggleSubMenu(3)");
	StartSubMenu(3);
   	NewSubMenuItem("Browz 3D","Quick 3D model browser",301,"appbrowz3d.html","");
	NewSubMenuItem("Color Lines 3D","Cool board 3D game",304,"appcolorlines3d.html","");
	NewSubMenuItem("Screen savers","Several 3D screen savers",303,"appsavers.html","");
	NewSubMenuItem("Small apps","Various small programs",302,"appother.html","");
	EndSubMenu();
  NewMenuItem("Gaming","",4,"","ToggleSubMenu(4)");
	StartSubMenu(4);
   	NewSubMenuItem("Unreal Tournament","Various UT utilities",401,"gamunreal.html","");
	NewSubMenuItem("Other games","Various game utilities",402,"gamother.html","");
	EndSubMenu();
  NewMenuItem("Buggy Shots","",5,"","ToggleSubMenu(5)");
	StartSubMenu(5);
  NewSubMenuItem("General info","Buggy screenshots home page",501,"bughome.html","");
	NewSubMenuItem("Anachronox","Anachronox screenshots",502,"buganox.html","");
	NewSubMenuItem("Dungeon Siege","Dungeon Siege screenshots",503,"bugds.html","");
  NewSubMenuItem("Grand Theft Auto 3","Grand Theft Auto 3 screenshots",514,"buggta.html","");
	NewSubMenuItem("Medal Of Honor","Medal Of Honor : Allied Assault screenshots",504,"bugmohaa.html","");
	NewSubMenuItem("No One Lives Forever","No One Lives Forever : The Operative screenshots",505,"bugnolf.html","");
	NewSubMenuItem("The Nomad Soul","Omikron : The Nomad Soul screenshots",506,"bugnsoul.html","");
	NewSubMenuItem("Rally Championship","Rally Championship 2000 screenshots",507,"bugrc2000.html","");
  NewSubMenuItem("Severance","Severance : Blade Of Darkness screenshots",508,"bugsev.html","");
	NewSubMenuItem("Soldier Of Fortune 2","Soldier Of Fortune 2 : Double Helix screenshots",509,"bugsof2.html","");
	NewSubMenuItem("Tennis Masters","Tennis Master Series screenshots",510,"bugten.html","");
	NewSubMenuItem("Thief I - II","Thief I The Dark Project and Thief II The Metal Age screenshots",511,"bugthf.html","");
	NewSubMenuItem("Thievery UT","Thievery UT MOD screenshots",512,"bugtry.html","");
	NewSubMenuItem("MS Windows","Microsoft Windows screenshots",513,"bugwin.html","");
	NewSubMenuItem("Miscellaneous","Miscellaneous screenshots",515,"bugmisc.html","");
	EndSubMenu();
  NewMenuItem("InRaCi","",6,"","ToggleSubMenu(6)");
	StartSubMenu(6);
  	NewSubMenuItem("Cobol","ACU Cobol code sources",603,"irccobol.html","");
  	NewSubMenuItem("Delphi","Delphi code sources",601,"ircdelphi.html","");
  	NewSubMenuItem("Pascal","Console Delphi code sources",602,"ircpascal.html","");
  	NewSubMenuItem("Projects","Huge projects code sources",604,"ircproj.html","");
  	NewSubMenuItem("File org","File organization lab code sources",606,"ircfile.html","");
  	NewSubMenuItem("Exams","Previous years exam questions",608,"ircexams.html","");
  	NewSubMenuItem("Seminaries","Infomatic related docs",607,"ircsemin.html","");
  	NewSubMenuItem("Group Zips","Download many files groupped in zips",605,"ircall.html","");
	EndSubMenu();
  //NewMenuItem("Live cam","Check out my live webcam !",7,"cam.html","");
  //NewMenuItem("Live chat","Ask any questions here !",7,"chat.html","");

  document.write('</table></script></td><td align="center" valign="top" class="i"><table cellpadding=0 border=0 width=90%><tr>'+
			     '<td bgcolor=#8E97B0 style="font-size:1px">&nbsp;</td></tr></table><br>');
}

// Displays the ending of the page
function PageFooter(){
  document.write('</td></tr><tr><td align="center" valign="middle" colspan=3 class="i">'+
		             '<br><table cellpadding=0 border=0 width=90%><tr><td bgcolor=#8E97B0 '+
								 'style="font-size:1px">&nbsp;</td></tr></table><br> = &nbsp; <a href="'+
								 'index.html">www.istrasoft.net</a> &nbsp; = &nbsp; IstraSoft Online '+
								 '2002 &nbsp; = &nbsp; <a href="mailto:info@istrasoft.net">info'+
								 '@istrasoft.net</a> &nbsp; =<br><br></td></tr></table>');
	if (isIE){
	  AnimTitles();
	  document.all["maincol"].style.width=screen.availWidth-150};
}

// Animates the DHTML titles
function AnimTitles(){
  var timeout=80;
	ismain.style.color=1711662+395533*animpos;
	col=7516400-395533*animpos;
	isout1.style.color=col;
  isout2.style.color=col;
  isout3.style.color=col;
  isout4.style.color=col;
  if(animpos==15){animstep=-1;timeout=1000};
  if(animpos==0){animstep=1;timeout=1000};
  animpos=animpos+animstep;
  setTimeout("AnimTitles()",timeout);
}

// Adds a menu item
function NewMenuItem(Caption,Status,Id,HRef,Script){
  var clickScript=Script;
	var itemTags="<tr><td id='mnu"+Id+"' align='left' valign='middle' class='menu' height=25 ";
	if (HRef!="")
	  clickScript="document.location.href=\""+HRef+"\"";
  subMenu=clickScript.substr(clickScript.indexOf("ToggleSubMenu(")+14,1);
 	isHdr=clickScript.indexOf("ToggleSubMenu")!=-1;
	if ((!isHdr && Id!=ActiveItem) || (isHdr && ActiveSubMenu!=subMenu)){
    itemTags=itemTags+"onclick='"+clickScript+"' ";
	  if (isIE){itemTags=itemTags+
		  "onmouseout='mnu"+Id+".background=\"\";window.status=\"\"' "+
      "onmouseover='mnu"+Id+".background=\"pix/mnuhover.gif\""+
      ";window.status=\""+Status+"\";return \"true\"'"}
		else{
		  if (isHdr){itemTags=itemTags+"style='cursor:default;";}}}
	else {
		if (!isHdr && Id==ActiveItem)
	    itemTags=itemTags+"style='color:#72B0F0;"+cur+"' background='pix/mnuactive.gif"
	  if (isHdr && ActiveSubMenu==subMenu)
			itemTags=itemTags+"style='"+cur}
	itemTags=itemTags+"'>&nbsp; &nbsp; "+Caption+"</td></tr>";
	document.write(itemTags);
}

// Opens the submenu table
function StartSubMenu(Id){
	//SubMenus++;
	var styl=" style='display:none'";
	if (ActiveSubMenu==Id || !isIE)
	  styl="";
  document.write("<tr><td align='right' valign='middle'><table id=sub"+Id+
								 styl+" width=135 border=0 cellpadding=0 cellspacing=0>");
}

// Closes the submenu table
function EndSubMenu(){
  document.write("</table></td></tr>");
}

// Adds a menu subitem
function NewSubMenuItem(Caption,Status,Id,HRef,Script){
  var clickScript;
  var itemTags="<tr><td id='sub"+Id+"' align='left' valign='middle' class='submenu' height=22 ";
	if (HRef!=""){clickScript="document.location.href=\""+HRef+"\""}else{clickScript=Script};
  if (Id!=ActiveItem){
	  itemTags=itemTags+"onclick='"+clickScript+"' ";
	  if (isIE){itemTags=itemTags+
		  "onmouseout='sub"+Id+".background=\"\";window.status=\"\"' "+
      "onmouseover='sub"+Id+".background=\"pix/mnuhover.gif\""+
      ";window.status=\""+Status+"\";return \"true\"'"}}
  else{itemTags=itemTags+"style='"+cur+"color:#72B0F0' background='pix/mnuactive.gif'"};
	itemTags=itemTags+"> &nbsp; &nbsp; "+Caption+"</td></tr>";
	document.write(itemTags);
}

// Shows-hides the submenu with the subX ID where X = Id parameter
function ToggleSubMenu(Id){
	if (!isIE || Id==ActiveSubMenu)
		return;
  for (i=1;i<NumSubMenus;i++){
    if (i!=Id && i!=ActiveSubMenu)
	  if (document.all["sub"+i]!=null)
	    document.all["sub"+i].style.display="none"};
  var submenu=document.all["sub"+Id];
  if (submenu!=null){
    if (submenu.style.display=="none")
      submenu.style.display=""
    else
      submenu.style.display="none"
  }
}

// Displays a download file table with full info
function AddDownloadFile(Lang,Title,Year,Size,ZipLink,Comment,ScrLink,ScrW,ScrH){
	if (Lang=="FR"){
		tTit ="Titre";
		tYear="Année";
		tSize="Taille";
		tComm="Description";
		tScr ="Capture d'écran"
		tDL  ="Télécharger"}
	else {
		tTit ="Title";
		tYear="Year";
		tSize="Size";
		tComm="Comments";
		tScr ="Screenshot"
		tDL  ="Download"}
	var itemTags='<table cellpadding=0 border=0 width=90%><tr><td bgcolor=#4C5678 style="font-'+
	    'size:1px">&nbsp;</td></tr></table><br><table border=0 cellpadding=5 cellspacing=0 '+
			'width=85%><tr><td class="i"><u>'+tTit+'</u></td><td class="i" width=80%><b>'+Title+
  		'</b></td><td align="center" valign="middle" rowspan=3><a style="font-size:10px" href'+
			'="'+ZipLink+'"><img src="pix/dl.jpg" width=31 height=46 border=0><br>'+tDL+'</a></td>'+
			'</tr><tr><td class="i"><u>'+tSize+'</u></td><td class="i">'+Size+'</td></tr>';
	if (Year!="")
		itemTags=itemTags+'<tr><td class="i"><u>'+tYear+'</u></td><td class="i">'+Year+'</td></tr>';
	if (Comment!="")
    itemTags=itemTags+'<tr><td class="i"><u>'+tComm+'</u></td><td colspan=2>&nbsp;</td></tr><tr>'+
		'<td class="i" colspan=3 style="text-align:justify">'+Comment+'</td></tr>';
	if (ScrLink!="")
    itemTags=itemTags+'<tr><td colspan=3 class="i"><u>'+tScr+'</u></td></tr>';
	document.write(itemTags+'</table>');
	if (ScrLink!="")
	  document.write('<br><center><img src="scr/'+ScrLink+'" border=0 height='+
		               ScrH+' width='+ScrW+'></center>');
	document.write('<br><table border=0 width=95%><tr><td align="right"><a href="#top"><img '+
								 'src="pix/top.jpg" border=0 width=16 height=14></a></td></tr></table><br>');
}


// Displays a news entry
function AddNewsEntry(Date,Contents){
	document.write('<table width=85% border=0><tr><td class="i" align="left"><font color="#72B0F0"><b><u>'+
								 Date+'<u/></b></font><br><br></td></tr><tr><td class="i" style="text-align:justify">'+
								 Contents+'</td></tr></table><br><br>');
}

// Opens the screenshot in a new browser window
function OpenShot(imgUrl){
  prv=window.open("","","menubar=no,personalbar=no,status=no,titlebar=no,toolbar=no,scrollbars=no,width=820,height=620");
  prv.document.write('<head><title>IstraSoft - Buggy Screenshot</title></head><body bgcolor="#8E97B0" leftmargin="0" topmargin="0">'+
                     '<table border="0" cellpadding="8" width="100%"><tr><td align="center"><img src="'+imgUrl+
		  							 '" border="0"></td></tr></table></body>');
}

// Adds a buggy screenshot
function AddBuggyShot(Title,PicName,PicID,Comment){
document.write('<table cellpadding="0" border="0" width="90%"><tr><td bgcolor="#4C5678" style="font-size:1px">&nbsp;</td></tr></table>'+
'<br><table width="85%" border="0" cellpadding="5" cellspacing="0"><tr><td class="i"><u>Title :</u></td><td width="80%" class="i"><b>'+
Title+'</b></td><td align="center" valign="top" rowspan="3" class="i"><a href="javascript:OpenShot(\'bugs/'+PicName+'/'+PicName+'_'+PicID+
'.jpg\')"><img src="bugs/thumbs/'+PicName+'_'+PicID+'.jpg" border="0" height="100"></a></td></tr><tr>'+
'<td class="i"><u>Comments :</u></td><td class="i">&nbsp;</td></tr><tr><td class="i" colspan="2">'+Comment+'</td></tr></table><br>'+
'<table border=0 width=95%><tr><td align="right"><a href="#top"><img src="pix/top.jpg" border=0 width=16 height=14></a></td></tr></table><br>');
}

