﻿// perform JavaScript after the document is scriptable.
/*
$(document).ready(function () {
    //don't run these scripts when logged in to OW
    if (typeof OneWeb.Admin === "undefined") {
        // setup tabs switching
        $("#ui-tabs").tabs({ fx: { opacity: "toggle", effect: "fade", fadeOutSpeed: 2} });
    } else {
        //if logged in 
        // setup feature blocks for editing mode
        $("#fragment-2").removeClass("ui-tabs-hide").css({ "height": "500px" });
        $("#fragment-3").removeClass("ui-tabs-hide").css({ "height": "500px" });
        $(".tabbed_content_header,.ui-tabs-hide").css({ "display": "block" });
    }
});
*/
$(document).ready(function () {
	//always do

	//only do when NOT logged in to OW
	if (typeof OneWeb.Admin === "undefined") {
		/* Binding Events to the slides */
		$('.slide').bind('open', function () {
			if (!$(this).hasClass('open')) {
				$(this).next().trigger('open');
				$(this).addClass('open');
				$(this).animate({ right: "-=802px" });
			}
			else {
				$(this).prev().trigger('close');
			}
			$(this).siblings().removeClass('active');
			$(this).addClass('active');
		}).bind('close', function () {
			if ($(this).hasClass('open')) {
				$(this).removeClass('open');
				$(this).animate({ right: "+=802px" });
				$(this).prev().trigger('close');
			}
		});

		/* Triggering from the buttons */
		$('.slidebutton').click(function () {
			$(this).parent().trigger('open');
			$('#content-' + $(this).parent().attr('id')).trigger('show');
		});
		$("#slide_btn_1").trigger("click");

		// setup tabs switching
		$("#ui-tabs").tabs({ fx: { opacity: "toggle", effect: "fade", fadeOutSpeed: 2} });
		
	}

	//only do when logged in to OW
	if (typeof OneWeb.Admin != "undefined") {
		$("#slide-1,#slide-2,#slide-3,#slide-4").addClass("active").css({ "position": "relative", "display": "block", "right": "0", "margin-bottom": "20px" });
		$("#slides").css({ "height": "auto" });
		$("div").removeClass("ui-tabs-hide");
	}
});

