anim_speed = "normal";

(function($){
	$.fn.modalHide = function() {
		return this.each(function() {
			if($.browser.msie) {
				$(this).hide();
			} else {
				$(this).fadeOut(anim_speed);
			}
		});
	};
})(jQuery);

(function($){
	$.fn.modalShow = function() {
		return this.each(function() {
			if($.browser.msie) {
				$(this).show();
			} else {
				$(this).fadeIn(anim_speed);
			}
		});
	};
})(jQuery);

function resizeContainer() {
	height = $(this).css("height").replace("p", "");
	height = height.replace("x", "");
	height = height*1;
	height = height+8;
	$('#content-main-image').animate({
		height: height+"px"
	});
}

$(document).ready(function()
{
	$('.slideshow').cycle(
	{
		fx: 'fade',
		speed: 1500,
		timeout: 5000
	});
	
	$('.organza-carousel').carousel('.organza-carousel-left', '.organza-carousel-right');
	$('.polyester-carousel').carousel('.polyester-carousel-left', '.polyester-carousel-right');
	$('.satin-carousel').carousel('.satin-carousel-left', '.satin-carousel-right');
	$('.crinkle-carousel').carousel('.crinkle-carousel-left', '.crinkle-carousel-right');
	
	$().mousemove(function(e)
	{
		$('.hover').css("top", e.pageY-55);
		$('.hover').css("left", e.pageX+10);
	}); 
	
	$('.organza-hover-container').bind("mouseenter",function()
	{
		this.tip = this.title;
		$('.organza-carousel-outer').append('<div class="hover png_fix">'+this.tip+'</div>');
		this.width = $(this).width();
		//$('.hover').fadeIn(500);
		$('.hover').show();
	}).bind("mouseleave",function()
	{
		//$('.hover').fadeOut(500);
		$('.hover').remove();
	});
	
	$('.polyester-hover-container').bind("mouseenter",function()
	{
		this.tip = this.title;
		$('.polyester-carousel-outer').append('<div class="hover png_fix">'+this.tip+'</div>');
		this.width = $(this).width();
		//$('.hover').fadeIn(500);
		$('.hover').show();
	}).bind("mouseleave",function()
	{
		//$('.hover').fadeOut(500);
		$('.hover').remove();
	});
	
	$('.satin-hover-container').bind("mouseenter",function()
	{
		this.tip = this.title;
		$('.satin-carousel-outer').append('<div class="hover png_fix">'+this.tip+'</div>');
		this.width = $(this).width();
		//$('.hover').fadeIn(500);
		$('.hover').show();
	}).bind("mouseleave",function()
	{
		//$('.hover').fadeOut(500);
		$('.hover').remove();
	});
	
	$('.crinkle-hover-container').bind("mouseenter",function()
	{
		this.tip = this.title;
		$('.crinkle-carousel-outer').append('<div class="hover png_fix">'+this.tip+'</div>');
		this.width = $(this).width();
		//$('.hover').fadeIn(500);
		$('.hover').show();
	}).bind("mouseleave",function()
	{
		//$('.hover').fadeOut(500);
		$('.hover').remove();
	});

	$(".quote-button").click(function(event){
		$('#quote-modal').css("margin-top", $(window).scrollTop()+150+"px");
		event.preventDefault();
		$('#modal-outer').modalShow();
		$('#quote-modal').modalShow();
	});
	
	$("#modal-close").click(function(event){
		event.preventDefault();
		$('#quote-modal').modalHide();
		$('#modal-outer').modalHide();
	});
	
	$("#modal-outer").click(function(event){
		event.preventDefault();
		$('#quote-modal').modalHide();
		$('#modal-outer').modalHide();
	});
	
	$("a.fancy").fancybox();
});
