// ##LOG:
// -----------------------------------------------------------------------------------------------
// 17/12/03 bkel Created.
// -----------------------------------------------------------------------------------------------
// ##TEMPLATE:
// -----------------------------------------------------------------------------------------------
// This file contains a function that provides graphic rollover code.
// -----------------------------------------------------------------------------------------------


// [rollImg]
function rollImg ( theImg )
{
 // Work out the file extention we are working with.
 imageExtArray = theImg.src.split( '.' );
 getVal = imageExtArray.length - 1;
 imageExt = imageExtArray[getVal];


 // Split the image source on '/' so we can figure out the image name.
 nameArray = theImg.src.split( '/' );

 // If nameArray has some elements.
 if ( nameArray.length > 0 )
 {
 // Figure out the current name of the image.
 getVal = nameArray.length - 1;
 imageName = nameArray[getVal];

 // Figure out the image location.
 getVal = ( theImg.src.length - imageName.length);
 imageLoc = theImg.src.substring( 0, getVal );

 // Roll Image On
 if ( imageName.indexOf('_over') != -1 )
 {
 theImageName = imageName.substring(0 , ( imageName.length - ( 6 + imageExt.length ) ) ) + '.' + imageExt;

 // mainGraphic Image On
 try
 {
 theImg.src = imageLoc + theImageName;
 } catch (e) { }

 }
 // Roll Image Off
 else
 {
 theImageName = imageName.substring(0 , ( imageName.length - 4 ) ) + '_over.' + imageExt;

 // mainGraphic Image Off
 try
 {

 theImg.src = imageLoc + theImageName;
 } catch (e) { }

 }

 }

}


function PNGswap ( myID )
{
 var strOver = "";
 var strOff = "_over";
 var oSpan = document.getElementById ( myID );
 var theImg = oSpan.filters(0);

 // Work out the file extention we are working with.
 imageExtArray = theImg.src.split( '.' );
 getVal = imageExtArray.length - 1;
 imageExt = imageExtArray[getVal];

 // Split the image source on '/' so we can figure out the image name.
 nameArray = theImg.src.split( '/' );

 // If nameArray has some elements.
 if ( nameArray.length > 0 )
 {
 // Figure out the current name of the image.
 getVal = nameArray.length - 1;
 imageName = nameArray[getVal];

 // Figure out the image location.
 getVal = ( theImg.src.length - imageName.length);
 imageLoc = theImg.src.substring( 0, getVal );


 // Roll Image On
 if ( imageName.indexOf('_over') != -1 )
 {
 theImageName = imageName.substring(0 , ( imageName.length - ( 6 + imageExt.length ) ) ) + '.' + imageExt;

 // mainGraphic Image On
 try
 {
 theImg.src = imageLoc + theImageName;
 } catch (e) { }

 }
 // Roll Image Off
 else
 {
 theImageName = imageName.substring(0 , ( imageName.length - 4 ) ) + '_over.' + imageExt;

 // mainGraphic Image Off
 try
 {

 theImg.src = imageLoc + theImageName;
 } catch (e) { }

 }

 }

 /*if (currentAlphaImg.indexOf(strOff) != -1)
 {
 oSpan.filters(0).src = currentAlphaImg.replace(strOff,strOver);

 }
 else
 oSpan.filters(0).src = currentAlphaImg.replace(strOver,strOff);
 }*/
}

