
// Javascript - CMAX 2.5 
// Author : D. Moodie

 var lastUpdate = "12th September 2005"; 
 var emailAddress = "davechanX_XartX@XyahooX.XcoX.Xuk";

 // Artwork Database
 
 var ai = 1;
 var aName = new Array();
 var aPath = new Array();
 var aType = new Array();
 var aText = new Array();
 
 aName[ai] = "catS";    aText[ai++] = "Mascot Art";
 aName[ai] = "cie01";   aPath[ai] = "img/mascot/davechan.jpg";	aType[ai] = "mascot art";  aText[ai++] = "'Cie' by Davechan";
 aName[ai] = "cie02";   aPath[ai] = "img/mascot/spike.jpg";   	aType[ai] = "mascot art";  aText[ai++] = "'Cie' by Spike631";
 aName[ai] = "cie03";   aPath[ai] = "img/mascot/andrew.jpg";	aType[ai] = "mascot art";  aText[ai++] = "'Cie' by Andrew";
 aName[ai] = "cie04";   aPath[ai] = "img/mascot/mercedes.jpg";	aType[ai] = "mascot art";  aText[ai++] = "'Cie' by Mercedes";
 aName[ai] = "cie05";   aPath[ai] = "img/mascot/kerrygib.jpg";	aType[ai] = "mascot art";  aText[ai++] = "'Cie' by Kerry Gibbons";
 aName[ai] = "cie06";   aPath[ai] = "img/mascot/roy.jpg";		aType[ai] = "mascot art";  aText[ai++] = "'Cie' by Roy";
 aName[ai] = "cie07";   aPath[ai] = "img/mascot/kutaly.jpg";	aType[ai] = "mascot art";  aText[ai++] = "'Cie' by Kutaly";
 aName[ai] = "cie08";   aPath[ai] = "img/mascot/davecha2.jpg";	aType[ai] = "mascot art";  aText[ai++] = "'Cie' by Davechan";
 aName[ai++] = "catE";   

 // Artwork + Detail Loader 
 
 function show_art(thisArt)
 {
   var divRef = document.getElementById("artwork");
   var imgRef = document.getElementById("art_img");
   var txtRef = document.getElementById("art_txt");
   
   for (var i = 1; i < ai; i++)
   {
     if (thisArt == aName[i]) 
     {
       imgRef.setAttribute("src", aPath[i]);
       imgRef.setAttribute("alt", thisArt);
       txtRef.innerHTML = aName[i] + " [" + aType[i] + "] : " + aText[i];
       divRef.className = "show";  

       break;
     }
   }  
 }


 // Detail Caption

 function show_detail(txtId, thisArt)
 {
   var txtRef = document.getElementById(txtId);
   
   for (var i = 1; i < ai; i++)
   {
     if (thisArt == aName[i]) 
     {
       txtRef.innerHTML = aName[i] + " [" + aType[i] + "] : " + aText[i];  

       break;
     }
   }
 }


 // All Works List

 function show_all_details()
 {
   var ic;
 
   for (var i = 1; i < ai; i++)
   {
     switch (aName[i])
     {
       case "catS" :
         document.writeln("<h3>" + aText[i] + "</h3>");
         document.writeln("<table id=" + String.fromCharCode(34) + "details" + String.fromCharCode(34) + ">");
         document.writeln(" <tr>");
         ic = 0;
       break;

       case "catE" :
         for (ic; ic < 3; ic++)
           document.writeln("  <td>&nbsp;</td>");
 
         document.writeln(" </tr>");
         document.writeln("</table>");
         document.writeln("<p>&nbsp;</p>");
       break;

       default:       
         document.writeln("  <td><a href=" + String.fromCharCode(34) + aPath[i] + String.fromCharCode(34) + ">" 
                          + aName[i] + "</a> : " + aText[i] + "</td>");
         ic++;

         if (ic % 3 == 0)
         {
           document.writeln(" </tr>");
           document.writeln(" <tr>");
         }  
     } 
   }
 }


 // ----------------------
 // General Site Functions
 // ----------------------

 function last_updated()
 {
   document.write("Updated: " + lastUpdate + " - ");
 }

 function contact_details()
 {
   var eAddr = "";
   var rgEx  = /X/g;

   eAddr  = 'Please send all requests to:\n';
   eAddr += emailAddress.replace(rgEx, '') + '\n';
   eAddr += 'With \'CMAX\' in the subject line.';

   alert(eAddr);
 }
