﻿function switchImage(obj, state)
{
    var img = obj.src;
    var path;
    
    // Grab the end of the string
    x = img.substring(img.length-8,img.length);
    
    // Grab the path
    if (x=='over.gif')
    {
        path = img.substring(0,img.length-9);
    } else if (x == 'lick.gif') {
        path = img.substring(0,img.length-10);
    } else {
        path = img.substring(0,img.length-4);
    }
    
    // Based on the status, append the end
    switch (state) {
        case 0: 
            obj.src = path + '.gif';
            break;
        case 1: 
            obj.src = path + '_over.gif';
            break;
        case 2: 
            obj.src = path + '_click.gif';
            break;
    }
}
