﻿$(document).ready(function () {
    // flowplayer overlay
//    $("body").append("<div class='overlay' id='overlay'><div class='contentWrap'></div></div>");
//    var exposeConfig = { color: '#000', loadSpeed: 200, opacity: 0.8 };

//    $("a[rel*=#overlay]").overlay({
//        expose: exposeConfig,
//        onBeforeLoad: function () {
//            var wrap = this.getContent().find(".contentWrap");
//            wrap.load(this.getTrigger().attr("href"));
//        }
    //    });

    //tabs
    $(".tabs #tabs-nav a").click(function (e) {
        var tab = $(this).attr('href');
        $(".toggle_tabs").hide();
        $(tab).show();
        $(".tabs a").removeClass('selected');
        $(this).addClass('selected');
        e.preventDefault();
    });

    //account show/hide
    $("a.selection-bar").toggle(
		function (e) {
		    $(".selection-drop").slideDown();
		    e.preventDefault();
		},
		function (e) {
		    $(".selection-drop").slideUp();
		    e.preventDefault();
		}
	);

	//billing & shipping show/hide
	$(".btn-addnew, .btn-editinfo").click(
		function (e) {
		    $(".shippingmodules").hide();
		    $(".shippingedit").fadeIn();
		    e.preventDefault();
		}
	);

		//billing & shipping show/hide
		$(".btn-saveaddress").click(
		function (e) {
		    $(".shippingedit").hide();
		    $(".shippingmodules").fadeIn();
		    e.preventDefault();
		}
	);

		// This handle the textbox defualt values

		$('.default-value').each(function () {
		    var default_value = this.value;
		    $(this).css('color', '#666'); // this could be in the style sheet instead
		    $(this).focus(function () {
		        if (this.value == default_value) {
		            this.value = '';
		            $(this).css('color', '#333');
		        }
		    });
		    $(this).blur(function () {
		        if (this.value == '') {
		            $(this).css('color', '#666');
		            this.value = default_value;
		        }
		    });
		});


});       //END (DOCUMENT).READY

// get overlay API
//$(function () {
//    var api = $("#overlay").overlay({
//        api: true,
//        expose: { color: '#000', loadSpeed: 200, opacity: 0.8 },
//        onBeforeLoad: function () {
//            var wrap = this.getOverlay().find(".contentWrap");
//            wrap.load("/themes/SCMS/signup.htm");
//        }
//    });

//    // the name is "loadOverlay"
//    window.LaunchOverlay = function (url) {
//        api.load();
//    };
//});

//form plugin
$(function () {
    $("form").jqTransform();
});
