





/* date functions */
function showTodaysDate() {
	var d = new Date();
	document.write( d.getMonth() + 1 + " / " + d.getDate() + " / " + d.getFullYear() );
}
function showCurrYear() {
	var d = new Date();
	//document.write( "2000-" + d.getFullYear() );
	document.write( d.getFullYear() );
}




/* lifestyle - photo tour */
function doLifestylePhototour() {
	$(function() {
		//$('#productdetailimagelarge').cycle({
		$('#productdetailimagelarge1').cycle({
			fx:     'fade',
			speed:  500,
			timeout: 0,
			pager:  '.colorways_grid1',
			pagerAnchorBuilder: function(idx, slide) {
				return '.colorways_grid1 li:eq(' + (idx) + ') a';
			}
		});
	});
	$(function() {
		//$('#productdetailimagelarge').cycle({
		$('#productdetailimagelarge2').cycle({
			fx:     'fade',
			speed:  500,
			timeout: 0,
			pager:  '.colorways_grid2',
			pagerAnchorBuilder: function(idx, slide) {
				return '.colorways_grid2 li:eq(' + (idx) + ') a';
			}
		});
	});
	$(function() {
		//$('#productdetailimagelarge').cycle({
		$('#productdetailimagelarge3').cycle({
			fx:     'fade',
			speed:  500,
			timeout: 0,
			pager:  '.colorways_grid3',
			pagerAnchorBuilder: function(idx, slide) {
				return '.colorways_grid3 li:eq(' + (idx) + ') a';
			}
		});
	});
}






//function showScroller() {
/*
// execute your scripts when DOM is ready. this is a good habit
$(function() {		
		
	// initialize scrollable 
	$("div.scrollable").scrollable({
			
		// items are auto-scrolled in 2 secnod interval
		interval: 2000,
		
		// when last item is encountered go back to first item
		loop: true, 
		
		// make animation a little slower than the default
		speed: 600,
		
		// when seek starts make items little transparent
		onBeforeSeek: function() {
			this.getItems().fadeTo(300, 0.2);		
		},
		
		// when seek ends resume items to full transparency
		onSeek: function() {
			this.getItems().fadeTo(300, 1);
		}
	});	
	
});
*/
//}










$(document).ready(function(){
    //alert('yes');

    $("#submitButton").attr("disabled", "disabled");

    $('#emailBox').keyup(function () {
        var email  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
        if($(this).val().match(email)) {
            $(this).removeClass("error");
            $("#emailError").hide();
            $("#Box2").fadeIn("slow");
            $("#submitButton").removeAttr("disabled");
        //} else {
        //    $("#textbox1error").html("not a valid email address.")
        }
    });
    $('#emailBox').blur(function () {
        var email  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
        if(!$(this).val().match(email)) {
            //$("#Box2").fadeIn("slow");
            //$("#submitButton").removeAttr("disabled");
            //$("#textbox1error").hide();
        //} else {
            $(this).focus().addClass("error");
            $("#emailError").show().html("not a valid email address");
            
        }

    });




    $('#usernameBox').keyup(function () {
        //if($(this).val().length > 2) {
        //    $("#Box3").fadeIn("slow");
        //}
        var user = /[(\*\(\)\[\]\+\.\,\/\?\:\;\'\"\`\~\\#\$\%\^\&\<\>)+]/;
        if($(this).val().match(user)) {
            //$("#Box3").fadeIn("slow");
            //$("#textbox2error").hide();
            $(this).focus().addClass("error");
            $("#usernameError").show().html("no special characters allowed");
        } else {
            //$("#textbox2error").html("no special characters allowed");
            
            //$("#usernameError").hide();
            //$("#Box3").fadeIn("slow");

            if($(this).val().length > 5) {
                $(this).removeClass("error");
                $("#usernameError").hide();
                $("#Box3").fadeIn("slow");
            } else {
                //$("#usernameError").show().html("minimum 6 characters");
            }

            //$("#textbox2error").html("good");
        }
    });
    $('#usernameBox').blur(function () {
        //if($(this).val().length > 2) {
        //    $("#Box3").fadeIn("slow");
        //}
        var user = /[(\*\(\)\[\]\+\.\,\/\?\:\;\'\"\`\~\\#\$\%\^\&\<\>)+]/;
        if($(this).val().match(user)) {
            $(this).focus().addClass("error");
            $("#usernameError").show().html("no special characters allowed");
        } else {

            if($(this).val().length > 5) {
                $(this).removeClass("error");
                $("#usernameError").hide();
                $("#Box3").fadeIn("slow");
            } else {
                $(this).focus().addClass("error");
                $("#usernameError").show().html("minimum 6 characters");
            }

        }

    });



    $('#dateBox').keyup(function () {
        //if($(this).val().length > 2) {
        //    $("#Box3").fadeIn("slow");
        //}
        var dob  = /(0[1-9]|1[012])+\/(0[1-9]|[12][0-9]|3[01])+\/(19|20)\d\d/;
        if(!$(this).val().match(dob)) {
            //$(this).focus().addClass("error");
            //$("#dateError").show().html("not a valid date");
        } else {
            //if( ($(this).val().length > 7) and $(this).val().length < 11) ) {
            //if ($(this).val().length>7.val().length<11) {
            //if( ($(this).val().length > 7) and ($(this).val().length < 11) ) {
            //if( 12 > $(this).val().length > 7) {
            if( $(this).val().length > 7 ) {
                if( $(this).val().length < 11 ) {
                    $(this).removeClass("error");
                    $("#dateError").hide();
                    $("#Box4").fadeIn("slow");
                } else {
                    $(this).focus().addClass("error");
                    $("#dateError").show().html("not a valid date");
                }
            } else {
                $(this).focus().addClass("error");
                $("#dateError").show().html("not a valid date");
            }
        }
    });


    /*$('#dateBox').blur(function () {
        var dob  = /(0[1-9]|1[012])+\/(0[1-9]|[12][0-9]|3[01])+\/(19|20)\d\d/;
        if(!$(this).val().match(dob)) {
            $(this).focus().addClass("error");
            $("#dateError").show().html("not a valid date");
        }
    });*/



    $('#textbox4').keyup(function () {
        if($(this).val().length > 2) {
            $("#Box5").fadeIn("slow");
        }
    });


    $('#textbox5').keyup(function () {
        if($(this).val().length > 2) {
            $("#Box6").fadeIn("slow");
        }
    });

});

/*$.fn.clearForm = function() {
    return this.each(function() {
        var type = this.type, tag = this.tagName.toLowerCase();
        if (tag == 'form')
            return $(':input',this).clearForm();
        if (type == 'text' || type == 'password' || tag == 'textarea')
            this.value = '';
        else if (type == 'checkbox' || type == 'radio')
            this.checked = false;
        else if (tag == 'select')
            this.selectedIndex = -1;
    });
};*/











function startform() {
	//alert('start form');
    $('.mover').hide(); // hides content
    $('#slideToggleButton').hide(); // hides button
}
function startformHome() {
    $('#slideToggle').hide(); // hides button
    //$('#slideToggleButton').show(); // shows button
}



// http://www.mredesign.com/demos/jquery-effects-1/
$(document).ready(function(){
    //var $elementHeight = $('.mover').height();  // fixes jumpy behavior
    
    //$('.mover').hide(); // hides content
    //$('#slideToggleButton').hide(); // hides button
	//startform();

    // toggle slide
    $('#slideToggle').click(function(){
        //$('.mover').css({height: $elementHeight}); // fixes jumpy behavior
        $(this).siblings('.mover').slideToggle('medium'); // animation
        $('#slideToggle').hide(); // hides button
        $('#slideToggleButton').show(); // shows button
    });
    $('.openForm').click(function(){
        //$('.mover').css({height: $elementHeight}); // fixes jumpy behavior
        $('#slideToggle').siblings('.mover').slideToggle('medium'); // animation
        $('#slideToggle').hide(); // hides button
        $('#slideToggleButton').show(); // shows button
        return false;
    });
});









