/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
$(document).ready(function(){
	
	$("div#options").fadeTo("slow", 0.8);
    $("div#options").hover(function(){
    $(this).fadeTo("slow", 1.0);
    },function(){
    $(this).fadeTo("slow", 0.8);
    });	
	
	$("div#options img").fadeTo("slow", 1.0);
    $("div#options img").hover(function(){
    $(this).fadeTo("slow", 0.4);
    },function(){
    $(this).fadeTo("slow", 1.0);
    });	
	
});

//var a = $(this), text = 'Loading&#8230;', img = $('#featured img')[0];
//a.html('Loading&#8230;');
//img.onload = function() {
//    a.html(text);
//};
//img.src = a.attr(path);


$(function() {
    $.preloadImage = function(path) {
        $("#featured img").attr("src", path);
        
    }

    $('div#options  img').click(function() {
    	
        $('div img').removeClass('selected');
        $(this).addClass('selected');

        var thumbPath = $(this).attr('src');
        var imageName = $(this).attr('alt');
        var imagePath =thumbPath.replace("tn/", "resizedimages/");
        var largePath = $('#featured img').attr("src");
        $.preloadImage(imagePath);
        
       
       

        var chopped = imageName.split('.');
        $('#featured div').remove();
        $('#featured')
		 .prepend('<div id="desc"><h3 class="description">&nbsp;&nbsp;Picture Name: ' + chopped[0] + '</h3></div>').children('div').fadeIn(500).fadeTo(500, 1);
        
        
        
        
    });

    $('div#options  a').click(function() {

        return false;

   });
});


