$().ready(function() {  

	$('#Offers').cycle({ 
	fx:    'fade',
	speed:  2000,
	timeout: 6000
	});

  $('a.tip_link').cluetip({
    splitTitle: '|',
	activation: 'hover',
	positionBy: 'fixed',
	topOffset: -10,
	leftOffset: 180,
	showTitle: false // hide the clueTip's heading
  });

	var gallery = $('#gallery').galleriffic('#thumbs', {
        delay:                  4000,
        numThumbs:              5,
        preloadAhead:           40, // Set to -1 to preload all images
        enableTopPager:         false,
        enableBottomPager:      true,
        imageContainerSel:      '#mainImg',
        controlsContainerSel:   '',
        captionContainerSel:    '',
        loadingContainerSel:    '',
        renderSSControls:       true,
        renderNavControls:      true,
        playLinkText:           'Play',
        pauseLinkText:          'Pause',
        prevLinkText:           'Previous',
        nextLinkText:           'Next',
        nextPageLinkText:       'Next &rsaquo;',
        prevPageLinkText:       '&lsaquo; Prev',
        enableHistory:          false,
        autoStart:              true,
        onChange:               undefined, // accepts a delegate like such: function(prevIndex, nextIndex) { ... }
        onTransitionOut:        undefined, // accepts a delegate like such: function(callback) { ... }
        onTransitionIn:         undefined, // accepts a delegate like such: function() { ... }
        onPageTransitionOut:    undefined, // accepts a delegate like such: function(callback) { ... }
        onPageTransitionIn:     undefined  // accepts a delegate like such: function() { ... }
    });

	$('#Offers img').click(function(evt) {
		$('#OfferDetails').show();
	});

	$('#OfferDetails a.close').click(function(evt) {
		evt.preventDefault();
		$('#OfferDetails').hide();
	});

	$('#InfoTab img').click(function(evt) {
		$('#InfoTabDetails').show();
	});

	$('#InfoTabDetails a.close').click(function(evt) {
		evt.preventDefault();
		$('#InfoTabDetails').hide();
	});

	$('#offers').submit(function(evt) {
		if ($('#offers_email').val() == ''){
			$('#offers_email').removeClass('email');
			$('#offers_email').addClass('email_req');
			return false;
		} else{
			return true;
		}
	});

	$('#burberry').each(function(){
		$(this).hover(function(){
			status=$(this).find('a').attr('href');
		});
		$(this).click(function(){
			location = $(this).find('a').attr('href');
		});
		$(this).css('cursor','pointer');
	});

	$('#livework').each(function(){
		$(this).hover(function(){
			status=$(this).find('a').attr('href');
		});
		$(this).click(function(){
			location = $(this).find('a').attr('href');
		});
		$(this).css('cursor','pointer');
	});

	$('#rowhomes').each(function(){
		$(this).hover(function(){
			status=$(this).find('a').attr('href');
		});
		$(this).click(function(){
			location = $(this).find('a').attr('href');
		});
		$(this).css('cursor','pointer');
	});

	$('#carriage').each(function(){
		$(this).hover(function(){
			status=$(this).find('a').attr('href');
		});
		$(this).click(function(){
			location = $(this).find('a').attr('href');
		});
		$(this).css('cursor','pointer');
	});

}); 