﻿
function onBefore() {
    jQuery('#caption').html(this.title + "<img src='/images/arrow-down.gif' class='deco-arrow' />");
}
jQuery(document).ready
(
	function() {

	    jQuery('#images').after('<div id="nav" class="nav"></div>')
			.cycle({
			    fx: 'fade',
			    speed: 'fast',
			    timeout: 0,
			    pager: '#nav',
			    before: onBefore
			});

	    jQuery('#images a').fancybox();

	    jQuery('.lowercontent table').addClass("producttable");
	    jQuery('.producttable tr:even').addClass("alt");
	    /*Text Boxes*/
	    var aryTxt = jQuery('.textbox_default');

	    aryTxt.each
	    (
	        function() {
	            var txt = jQuery(this);
	            txt.data("default", txt.val());
	        }
	    );

	    aryTxt.focus
	    (
	        function() {
	            var txt = jQuery(this);
	            if (txt.data('default') && txt.val() == txt.data('default'))
	                txt.val('');
	        }
	    );

	    aryTxt.blur
	    (
	        function() {
	            var txt = jQuery(this);

	            if (txt.data('default') && txt.val() == "")
	                txt.val(txt.data('default'));

	        }
	    );


	    /*Nav*/

	    jQuery('img[activeclass]').each
		(
		    function() {
		        var img = jQuery(this);

		        if (img.hasClass(img.attr('activeclass')) && img.attr('active'))
		            img.attr('src', img.attr('active'));
		    }
		);

	    jQuery('img[hover]').mouseover
		(
			function() {
			    var img = jQuery(this);
			    var bDoHover = !(img.attr('activeclass') && img.hasClass(img.attr('activeclass')));

			    if (bDoHover)
			        img.attr('src', img.attr('hover'));
			}
		);

	    jQuery('img[rest]').mouseout
		(
			function() {
			    var img = jQuery(this);

			    var bDoOut = !(img.attr('activeclass') && img.hasClass(img.attr('activeclass')));

			    if (bDoOut)
			        img.attr('src', img.attr('rest'));
			}
		);
	}
);
