// JavaScript Document
$(document).ready(function(){

	$("#quotes").html(quote);
	$("#searchArtwork").val("Search for artwork");

	$('#searchArtwork').each(function() {
		var default_value = "Search for artwork";
		$(this).focus(function() {
			if(this.value == default_value) {
				this.value = '';
				
			}
		});
		$(this).blur(function() {
			if(this.value == '') {
				this.value = default_value;
			}
		});
	});
	
	
	$('#searchArtist').each(function() {
	var default_value = "1. Type last name";
	
		$(this).focus(function() {
			if(this.value == default_value) {
				this.value = '';
			}
		});
		$(this).blur(function() {
			if(this.value == '') {
				this.value = default_value;
			}
		});
	});



















								   




















});



/**
 * @author Alexander Farkas
 * v. 1.02
 */
(function($) {
	$.extend($.fx.step,{
	    backgroundPosition: function(fx) {
            if (fx.state === 0 && typeof fx.end == 'string') {
                var start = $.curCSS(fx.elem,'backgroundPosition');
                start = toArray(start);
                fx.start = [start[0],start[2]];
                var end = toArray(fx.end);
                fx.end = [end[0],end[2]];
                fx.unit = [end[1],end[3]];
			}
            var nowPosX = [];
            nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
            nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];
            fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];

           function toArray(strg){
               strg = strg.replace(/left|top/g,'0px');
               strg = strg.replace(/right|bottom/g,'100%');
               strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
               var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
               return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
           }
        }
	});
})(jQuery);


$(function(){

	$('.subnav li a')
		.css( {backgroundPosition: "0 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0 -250px)"}, {duration:1})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(0 0)"}, {duration:1000})
		})
		

});



$(document).ready(function(){
						   
						   
					$('#slidehead .kwicks').kwicks({
						max: 250,
						spacing:  0
					});


					$('#slidehead-cg .kwicks-cg').kwicks({
						max: 772,
						spacing:  0
					});

 $("#disciplineNav li").hover(function () {
      $(this).css({
	'background' : 'transparent url(/images/button_on_r.gif) no-repeat right top',
        'color' : '#000'
});
    }, function () {
      var cssObj = {
	'background' : 'transparent url(/images/button_off_r.gif) no-repeat right top',
        'color' : '#000'
      }
      $(this).css(cssObj);
    });



 $("#disciplineNav li a").hover(function () {
      $(this).css({
	'background' : 'transparent url(../images/button_on_l.gif) no-repeat left top',
        'color' : '#000'
});
    }, function () {
      var cssObj = {
	'background' : 'transparent url(../images/button_off_l.gif) no-repeat left top',
        'color' : '#000'
      }
      $(this).css(cssObj);
    });






$(".piece_specs_data_medium").highlight("Original", "tooltip-original");
$(".piece_specs_data_medium").highlight("Lithograph", "tooltip-lithograph");
$(".piece_specs_data_medium").highlight("Linocut", "tooltip-linocut");


$(".tooltip-original").simpletip({
content: '<b>Original</b>: The artist of the design has worked on the creation of the work him/herself, as opposed to reproductions that occur without the artist\'s involvement&hellip; <a href="http://www.masterworksfineart.com/art/glossary.html#O" target=\"_blank\">more</a>',
 fixed: true, position:  ["0", "-54"] 
});

$(".tooltip-lithograph").simpletip({
content: '<b>Lithograph</b>: design drawn on the flat surface of a stone with a greasy crayon or ink&hellip; <a href="http://www.masterworksfineart.com/art/printmaking.html#2-lithograph" target=\"_blank\">more</a>',
 fixed: true, position:  ["0", "-54"] 
});

$(".tooltip-linocut").simpletip({
content: '<b>Linocut</b>: material is cut with small pen-like tools, and the relief parts of the block are then inked and rubbed onto the paper using a pad known as a tampon&hellip; <a href="http://www.masterworksfineart.com/art/printmaking.html#4-linocut" target=\"_blank\">more</a>',
 fixed: true, position:  ["0", "-54"] 
});




});

jQuery.fn.highlight = function (str, className)
{
    var regex = new RegExp(str, "g");

    return this.each(function ()
    {
        this.innerHTML = this.innerHTML.replace(regex, "<span class=\"" + className + "\">" + str + "</span>");
    });
};


/*
$(document).ready(function(){
 
	$(".rss-popup a").hover(function() {									 
	$(this).next("em").stop(true, true).animate({opacity: "show", left: "55"}, "slow");
	}, function() {
	$(this).next("em").animate({opacity: "hide", left: "-70"}, "medium");
	});
 
 
});
*/


