$(document).ready(function () {

	$("#orderform :input:not(.notip)").tooltip({

	// place tooltip on the right edge
	position: "center right",

	// a little tweaking of the position
	offset: [-2, 10],

	// use the built-in fadeIn/fadeOut effect
	effect: "fade",

	// custom opacity setting
	opacity: 0.7

	});

	$("#helpfulhints a[title]:not(.notip)").tooltip({ effect: "fade", delay: 500, position: "center right", relative: true, tipClass: "tooltip_big_box_no_img", opacity: 1.0, events: { def: "click,mouseleave", tooltip: "mouseenter,mouseleave" } });


	$("div.clickable").click(function(event) {
		event.preventDefault();
		window.location = $(this).find("a").attr("href");
	});

	$("#loginw").fancybox({
		'scrolling'		: 'no',
		'titleShow'		: false,
		'onClosed'		: function() {
		    $("#login_error").hide();
		}
	});


	$("a.showimg").fancybox({'type' : 'image'});
	$("area.showimg").fancybox({'type' : 'image'});
	$("a.fusion").fancybox({'type' : 'iframe', 'width' : 625, 'height' : 800 });

	$("a.swf").click(function() {
        	$.fancybox({
                        'padding'       : 0,
                        'autoScale'     : false,
                        'transitionIn'  : 'none',
                        'transitionOut' : 'none',
                        'title'         : this.title,
                        'width'         : 800,  
                        'height'        : 500,
                        'href'          : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
                        'type'          : 'swf',
                        'swf'           : {
                        'wmode'         : 'transparent',
                        'allowfullscreen' : 'true'
                        }
		});
		return false;
	});

	$("#showTop").toggle($.cookies.get('showTop') != 'collapsed');

	$("#showTopCollapse").click(function () {
		$("#showTop").slideToggle("slow");
		var newOptions = { domain: '.servint.net', path: '/', expiresAt: new Date(2012,7,1) } 
		$.cookies.set('showTop', 'collapsed', newOptions);
	});

});

