	$(document).ready(function() {
		
		$('#subscribe').click(function(){
			$('#grey-layer').fadeIn(200);
			$('#white-layer').fadeIn(200);
		});
		$('#exitsubscibe').click(function(){
			$('#grey-layer').fadeOut(200);
			$('#white-layer').fadeOut(200);
		})
		
		$('#s2').cycle({ 
		    fx:     'scrollVert',
		    continuous:    0,
		    pager:	'#nav',
		    timeout: 5000
		});
							   
		$('.tabs .tab-active').show(); // show default content
		$('.tabs .header ul a').click(function(){
			$('.tabs .header ul li').removeClass('active');
			$(this).parent().addClass('active'); // make clicked tab active
			$('.tabs .tab').hide(); // hide all content
			$('.tabs').find('#' + $(this).attr('rel')).show(); // and show content related to clicked tab
			return false;
		});
		
		$("a.lightview").fancybox({'overlayShow': true, overlayOpacity:0.9,frameWidth:600,frameHeight:400 });
		
		$("a").focus(function () {
        	$(this).blur();
		});
		$("img.rollover").hover(function () {
			newsrc=$(this).attr('src').replace('.jpg','-over.jpg').replace('.png','-over.png');
        	$(this).attr('src',newsrc);
		},function () {
			newsrc=$(this).attr('src').replace('-over.jpg','.jpg').replace('-over.png','.png');
        	$(this).attr('src',newsrc);
		});
		
		//$('.wysiwyg-full').ckeditor();
		var config = {
				toolbar:
					[
						['Format','TextColor','Bold','Italic','Underline','Strike'],
						['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
						['Link','Unlink'],['Maximize'],
						['NumberedList','BulletedList','Outdent','Indent'],
						['Undo','Redo','-','RemoveFormat'],
						['Cut','Copy','Paste','PasteText','PasteFromWord'],
					    ['Table','HorizontalRule','SpecialChar']
					],
				uiColor: '#dddddd'
				};
		$('.wysiwyg').each(function(index) {
			config.width=$(this).css('width');
			config.height=$(this).css('height');
			$(this).ckeditor(config);
		});
		
		$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)

		$(".topnav li").hover(function() { //When trigger is clicked...
	
			//Following events are applied to the subnav itself (moving subnav up and down)
			$(this).find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click
	
			$(this).hover(function() {
			}, function(){
				$(this).find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
			});
	
			//Following events are applied to the trigger (Hover events for the trigger)
			}).hover(function() {
				$(this).addClass("subhover"); //On hover over, add class "subhover"
			}, function(){	//On Hover Out
				$(this).removeClass("subhover"); //On hover out, remove class "subhover"
		});
	});
	
	function newslettershow(){
		$('#grey-layer').fadeIn(200);
		$('#white-layer').fadeIn(200);
	}
	
	function sendEmail() {
		$('#sendbutton').val('sending...');
		$('#sendbutton').attr("disabled","true");
		$.post('contact-form.php?r='+Math.random(),{
			v_name: $('#name').val(),
			v_email: $('#email').val(),
			v_subject: $('#subject').val(),
			v_message: $('#message').val()
		},
		function (data) {
			$('#contactForm').html("");
			$('#sendStatus').html("<br /><p>Your message has been sent, we will reply as soon as possible.<br /><br />Thank you,<br />Chef's Choice</p>");
			$('#sendbutton').val('Send Message');
			$('#sendbutton').attr("disabled",false);
		}
		);
		return false;
	}
	
	function clickSub(thediv,div,image){
        $.each($('.'+div),function(){
            if(this.id==thediv){
                if(this.style.display=='none')
                {
                    $('#'+this.id).slideDown(700);
                    $('#'+image).show(700);
                    $('#'+'plus-'+this.id).hide(700)
                }
                else
                {
                    $('#'+this.id).slideUp(700);
                    $('#'+image).show(700);
                    $('#'+'minus-'+this.id).hide(700)
                }
            }else
            {
                $('#'+this.id).slideUp(700);
                $('#'+'minus-'+this.id).hide(700);
                $('#'+'plus-'+this.id).show(700);
            }

        });
	}
