// JavaScript Document
$(document).ready(function(){

//$('#request_form').hide();

//$('#exclusive_signup').click(function(){
	//$('#request').hide();
	$('#request_form').show();
//});

$('#back_to_non_member').click(function(){
	$('#request').show();
	$('#request_form').hide();
});






$('.pic_room').css('opacity','.8');

/*
$('.pic_room').hover(function(){

	$(this).animate({
	width: '175px',
	height: '100px',
	}, 500, function() {
	// Animation complete.
	});

},function(){

	$(this).animate({
	width: '87px',
	height: '50px',
	}, 300, function() {
	// Animation complete.
	});

});
*/
	$("#quotes").html(quote);
	//$("#searchArtwork").val("SEARCH");
	$('#searchArtwork').css('background','#E7E7CE url(/images/design/search_bg.gif) no-repeat top left');


	$('#searchArtwork').each(function() {
		var default_value = "";
		$(this).focus(function() {
				$('#searchArtwork').css('background','#E7E7CE');
		});
		$(this).blur(function() {
			if(this.value == '') {
				$('#searchArtwork').css('background','#E7E7CE url(/images/design/search_bg.gif) no-repeat top left');
			}
		});
	});
	
	
	$('#exclEmail').css('background','#E7E7CE url(/images/design/exclEmail_bg.gif) no-repeat top left');

$('#exclEmail').each(function() {
		var default_value = "";
		$(this).focus(function() {
				$('#exclEmail').css('background','#E7E7CE');
		});
		$(this).blur(function() {
			if(this.value == '') {
				$('#exclEmail').css('background','#E7E7CE url(/images/design/exclEmail_bg.gif) no-repeat top left');
			}
		});
	});
	
	
	$('#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;
			}
		});
	});










//$('.room_boxes').hide();
//$('#room_hider').hide();


$('#roooms_unhide').click(function(){

	$('.room_boxes').each(function(e){
								   
	$this_room = $(this);

	if($(this).hasClass('active'))
	{
		$this_room.hide().removeClass('active');
		$('#room_hider').hide();

	}
	else
	{
		$this_room.fadeIn(1000).addClass('active');
		$('#room_hider').show();
	}
								   
   });



});



								   




















});



/**
 * @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);
    });
*/

    var cssObj = {
      'filter' : 'alpha(opacity=90)',
      '-moz-opacity' : '0.9',
      'opacity' : '0.9'
    }
    $("#disciplineNav ul li ul li").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");
$(".currencyPrice").highlight("Gallery Price", "tooltip-gallery");
$(".elite_sale_label").highlight("MFA SALE", "tooltip-sale");


$(".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"] 
});

/*
$(".prev_short").simpletip({
content: 'Click here to see more photos, documentation, and framing',
fixed: false,
position: 'right', offset: [30, 0] 
});
*/

$(".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"] 
});


var pricetip = $('#price_text_desc').html();

$(".tooltip-gallery").simpletip({
	content: pricetip,
	fixed: true, position:  ["0", "-54"] 
});

$('#price_text_desc').hide();




var saletip = $('#sale_text_desc').html();

$(".tooltip-sale").simpletip({
	content: saletip,
	fixed: true, position:  ["0", "-54"] 
});

$('#sale_text_desc').hide();





});

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");
	});
 
 
});
*/






	
	
