$(document).ready(function() {
	
	if ($('a.fancybox').length) {
		$('a.fancybox').fancybox({
			titlePosition: 'inside'
			});
	}

	if ($('img#save_label').length) {
		$('img#save_label').fadeIn(2000);	
	}

	if ($('div.jqmWindow').length) {

		$('div.jqmWindow').jqm();
		$('a.popout').click(function(){
			var href = $(this).attr('href').replace('#open_','');
			$('div#' + href).jqmShow();
			});
		$('a.modal_close').click(function(){
			var id = $(this).attr('rel');
			$('div#' + id).jqmHide();
			});
	}
	
    $('a[rel=external]').click(function(){
        //open new window
        var myurl = $(this).attr('href');
        window.open(myurl, 'external');
        return false;
        });

	$('ul.package_contents li span').each(function(){
		$(this).qtip({
			content: $(this).parents('li').children('p.explanation'),
			position: {
				corner: {
					target: 'rightMiddle',
					tooltip: 'topLeft'
				}
			},
			style: {
      			width: 400,
      			color: '#333300',
				name: 'cream', // Inherit from preset style
				tip: 'leftTop' // Inherit from preset style
			}
		});
	});
	
});