/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */



$(document).ready(function(){

    var loc = window.location.toString();
    var speed = 200;
  
    $.preloadImages = function()
    {
        for(var i = 0; i<arguments.length; i++)
        {
            $("<img>").attr("src", arguments[i]);
        }     
    }

    $.preloadImages("/../images/contact.gif","/../images/Footer/GraphicFooterSelected.png");


    $(function() {
        $(".anyClass").jCarouselLite({
            btnNext: ".next",
            btnPrev: ".prev",            
            auto:7500,           
            pause: "#CarouselPlayPause",
            speed:1000,
            start: 0,
            visible:1,
            easing: "easeInOutQuint"
        });
    });

    $(function() {
        $(".LogoSlider").jCarouselLite({
            btnNext: ".next",
            btnPrev: ".prev",
            speed: 200,
            visible:1,
            start: 0,
            easing: "easeInOutQuad"
        });
    });

    $(function() {
        $(".SiteSlider").jCarouselLite({
            btnNext: ".next",
            btnPrev: ".prev",
            speed: 200,
            visible:1,
            start: 0,
            easing: "easeInOutQuad"
        });
    });

    $(function() {
        $(".LogoThumbSlider").jCarouselLite({
            btnNext: ".next",
            btnPrev: ".prev",
            auto:null,
            speed: 200,
            visible:2,
            start: 0,
            easing: "easeInOutQuad"
        });
    });

    $(function() {
        $(".SiteThumbSlider").jCarouselLite({
            btnNext: ".next",
            btnPrev: ".prev",
            auto:null,
            speed: 200,
            visible:3,
            start: 0,
            easing: "easeInOutQuad"
        });
    });

    $(function() {
        $(".PrintThumbSlider").jCarouselLite({
            btnNext: ".next",
            btnPrev: ".prev",
            auto:null,
            speed: 200,
            visible:3,
            start: 0,
            easing: "easeInOutQuad"
        });
    });

    $(".BottomMenuItem").click(function()
    {
                
        $(".BottomSelected").removeClass("BottomSelected");
        $(this).addClass("BottomSelected");
    });

    $("#CarouselPlayPause").click(function()
    {
        if ($("#CarouselPlayPause").hasClass("paused"))
        {
            $(this).removeClass("paused");
        }
        else
        {
            $(this).addClass("paused");
        }
    });

    $(".contact").click(function()
    {       
        
        if ($("#ContactBoxPopUp").css("display") == "none")
        {
           
            $("#ContactBoxPopUp").css("display","block");
            $("#ContactBoxPopUp").animate({
                "top":"-245px",
                opacity:1
            },{
                duraction:1000,
                easing:"easeOutQuart"
            });
        }
        else
        {
            $("#ContactBoxPopUp").animate({
                "top":"-160px",
                opacity:0
            },300,"easeInBack",function(){

                $(this).css("display","none");
                        

            });

                        

                    

                    
        }
    });

    $("#SendMessage").click(function()
    {
        var messageVal = "Name:" + $("#name").val() + "\n"
        + "Email:" + $("#email").val() + "\n"
        + "Phone:" + $("#phone").val() + "\n"
        + "Subject:" + $("#subject").val() + "\n"
        + "Message:" + $("#message").val() + "\n";

        $.post("./SendEmail.php",{
            emailTo: "info@millerdesignwork.com",
            emailFrom: $("#email").val(),
            subject: $("#subject").val(),
            message: messageVal
        },
        function(data){

            $("form input").attr("disabled", "disabled");
            $("form textarea").attr("disabled", "disabled");
            $("form input").css("opacity","0.3");
            $("form textarea").css("opacity","0.3");
            $("#SendMessage").html("Email sent. Thank you.");

        }

        );
             
    });

    $("#SendMessageLink").click(function()
    {
        verified = verifyForm();

        if (verified)
        {

        var messageVal = "Phone: " + $("#phone").val() + "\n"
        + "Company Name: " + $("#ContactFormCompany").val() + "\n"
        + "Name: " + $("#ContactFormName").val() + "\n"
        + "Email: " + $("#ContactFormEmail").val() + "\n"
        + "Phone: " + $("#ContactFormPhone").val() + "\n"
        + "Extension: " + $("#ContactFormExt").val() + "\n"
        + "Preference: " + $("#ContactFormPref").val() + "\n"
        + "Message Body: " + $("#ContactFormMessage").val();


        $.post("./SendEmail.php",{
            emailTo: "info@millerdesignwork.com",
            emailFrom: $("#email").val(),
            subject: $("#subject").val(),
            message: messageVal
        },
        function(data){

            //$("#ContactFormBox input").attr("disabled", "disabled");
            //$("#ContactFormBox textarea").attr("disabled", "disabled");
            //$("#ContactFormBox").css("opacity","0.2");
            //$("#ContactFormBox input").css("opacity","0.3");
            //$("#ContactFormBox textarea").css("opacity","0.3");
            $("#ContactFormBox").slideUp(200,function(){
                
                $("#SendMessageThanks").show();
                $("#SendMessageThanks").animate({top:"110px",duration:2000},function(){});
                
            });
            //$("#SendMessageLink").hide();
            

        }

        );

        }

        else return false;

    });

           

    if ($("#BoxMiddle").hasClass("home") || loc.indexOf("Contact") > 0 )
    {
        $("#TopMenuHome .MenuInactive").height("0px");
        $("#TopMenuHome .MenuActive").height("22px").show().addClass("CurrentPage");


        $("#BottomMenu1 h2").html("THE 7 REASONS");
        $("#BottomMenu2 h2").html("A BETTER PROCESS");
        $("#BottomMenu3 h2").html("GETTING STARTED");

        $("#BottomMenu1 .BottomMenuContent").html("It’s about quality, trust, and reliability. It’s about better design and development.");
        $("#BottomMenu2 .BottomMenuContent").html("We’ve streamlined the process, making it smoother, sleeker, and better than ever.");
        $("#BottomMenu3 .BottomMenuContent").html("For all your media needs from online to print, we are your solution.");

        $("#BottomMenu1").click(function()
        {
            window.location = "./Reasons.php";
           

        });

        $("#BottomMenu2").click(function()
        {
            window.location = "./Process.php";
           

        });

        $("#BottomMenu3").click(function()
        {
            window.location = "./GetStarted.php";
           
        });


    }

    else
    {
        $("#CarouselControlBox").remove();
    }

    if (loc.indexOf("Site") > 0)
    {
        $("#BottomMenu1").addClass("BottomSelected");

        $("#TopMenuSite .MenuInactive").height("0px");
        $("#TopMenuSite .MenuActive").height("22px").show().addClass("CurrentPage");


        $("#BottomMenu1 h2").html("THE WEBSITES & BLOGS");
        $("#BottomMenu2 h2").html("THE WEBSITE PROCESS");
        $("#BottomMenu3 h2").html("WEB PACKAGES & PRICING");

        $("#BottomMenu1 .BottomMenuContent").html("We create websites people want to visit and blogs they want to see.");
        $("#BottomMenu2 .BottomMenuContent").html("We’ve streamlined the process. It’s smoother, sleeker, and better than ever.");
        $("#BottomMenu3 .BottomMenuContent").html("Take a look at our different packages. See what’s right for your business.");

        $("#BottomMenu1").click(function()
        {
            //window.location = "./Reasons.php";
            $("#BoxSlider").animate({
                left:"-25px"
            });

        });




        $("#SiteTextArrow").click(function()
        {
            // window.location = "./SiteProcess.php";
            $("#BoxSlider").animate({
                left:"-1102px"
            });

            $(".BottomSelected").removeClass("BottomSelected");
            $("#BottomMenu2").addClass("BottomSelected");

        });

        $("#BottomMenu2").click(function()
        {
            // window.location = "./SiteProcess.php";
            $("#BoxSlider").animate({
                left:"-1102px"
            });

        });

        $("#BottomMenu3").click(function()
        {
            //window.location = "./SitePrices.php";
            $("#BoxSlider").animate({
                left:"-2205px"
            });


        });
        
        $("#PricesArrow").click(function()
        {
            //window.location = "./SitePrices.php";
            $("#BoxSlider").animate({
                left:"-2205px"
            });

            $(".BottomSelected").removeClass("BottomSelected");
            $("#BottomMenu3").addClass("BottomSelected");

        });


    }

    if (loc.indexOf("Brand") > 0 || loc.indexOf("brand") > 0)
    {
        $("#BottomMenu1").addClass("BottomSelected");

        $("#TopMenuLogo .MenuInactive").height("0px");
        $("#TopMenuLogo .MenuActive").height("22px").show().addClass("CurrentPage");

        $("#BottomMenu1 h2").html("THE BRANDS. THE LOGOS.");
        $("#BottomMenu2 h2").html("THE BRANDING PROCESS");
        $("#BottomMenu3 h2").html("LOGO PACKAGES & PRICING");

        $("#BottomMenu1 .BottomMenuContent").html("We create logos that people remember and brands they can’t forget.");
        $("#BottomMenu2 .BottomMenuContent").html("We’ve streamlined the process. It’s smoother, sleeker, and better than ever.");
        $("#BottomMenu3 .BottomMenuContent").html("We bring a better value to your business. See what packages fit your organization.");


        $("#BottomMenu1").click(function()
        {
            //window.location = "./Reasons.php";
            $("#BoxSlider").animate({
                left:"-25px"
            });

        });

        $("#BottomMenu2").click(function()
        {
            // window.location = "./SiteProcess.php";
            $("#BoxSlider").animate({
                left:"-1116px"
            });

        });

        $("#BottomMenu3").click(function()
        {
            //window.location = "./SitePrices.php";
            $("#BoxSlider").animate({
                left:"-2225px"
            });

        });

        $("#Arrow1").click(function()
        {
            // window.location = "./SiteProcess.php";
            $("#BoxSlider").animate({
                left:"-1116px"
            });

            $(".BottomSelected").removeClass("BottomSelected");
            $("#BottomMenu2").addClass("BottomSelected");
        });

        $("#PrintProcessArrow").click(function()
        {
            //window.location = "./SitePrices.php";
            $("#BoxSlider").animate({
                left:"-2225px"
            });

            $(".BottomSelected").removeClass("BottomSelected");
            $("#BottomMenu3").addClass("BottomSelected");

        });
    }
           
    

    if (loc.indexOf("Print") > 0)
    {
        $("#BottomMenu1").addClass("BottomSelected");

        $("#TopMenuPrint .MenuInactive").height("0px");
        $("#TopMenuPrint .MenuActive").height("22px").show().addClass("CurrentPage");
        
        $("#BottomMenu1 h2").html("THE PRINT WORK");
        $("#BottomMenu2 h2").html("THE PRINT PROCESS");
        $("#BottomMenu3 h2").html("PRINT DESIGN PRICING");

        $("#BottomMenu1 .BottomMenuContent").html("See the work. See the difference.");
        $("#BottomMenu2 .BottomMenuContent").html("We’ve streamlined the process. It’s smoother, sleeker, and better than ever.");
        $("#BottomMenu3 .BottomMenuContent").html("We understand excellence and as a result, we bring value to a whole new level.");

        
        $("#BottomMenu1").click(function()
        {
            //window.location = "./Reasons.php";
            $("#BoxSlider").animate({
                left:"-25px"
            });

        });

        $("#BottomMenu2").click(function()
        {
            // window.location = "./SiteProcess.php";
            $("#BoxSlider").animate({
                left:"-1102px"
            });

        });

        $("#BottomMenu3").click(function()
        {
            //window.location = "./SitePrices.php";
            $("#BoxSlider").animate({
                left:"-2205px"
            });

        });

        $("#PrintPricesLink").click(function()
        {
            // window.location = "./SiteProcess.php";
            $("#BoxSlider").animate({
                left:"-2205px"
            });

            $(".BottomSelected").removeClass("BottomSelected");
            $("#BottomMenu3").addClass("BottomSelected");

        });

        $("#PrintTextArrow").click(function()
        {
            // window.location = "./SiteProcess.php";
            $("#BoxSlider").animate({
                left:"-1102px"
            });

            $(".BottomSelected").removeClass("BottomSelected");
            $("#BottomMenu2").addClass("BottomSelected");

        });

        $("#PrintProcessArrow").click(function()
        {
            //window.location = "./SitePrices.php";
            $("#BoxSlider").animate({
                left:"-2205px"
            });

            $(".BottomSelected").removeClass("BottomSelected");
            $("#BottomMenu3").addClass("BottomSelected");

        });
    }


    if (loc.indexOf("About") > 0)
    {
        $("#TopMenuAbout .MenuInactive").height("0px");
        $("#TopMenuAbout .MenuActive").height("22px").show().addClass("CurrentPage");

        $("#BottomMenu1 h2").html("THE 7 REASONS");
        $("#BottomMenu2 h2").html("A BETTER PROCESS");
        $("#BottomMenu3 h2").html("GETTING STARTED");

        $("#BottomMenu1 .BottomMenuContent").html("It’s about quality, trust, and reliability. It’s about better design and development.");
        $("#BottomMenu2 .BottomMenuContent").html("We’ve streamlined the process. It’s smoother, sleeker, and better than ever.");
        $("#BottomMenu3 .BottomMenuContent").html("For all your media needs from online to print, we are your solution.");

        $("#BottomMenu1").click(function()
        {
            window.location = "./Reasons.php";
           

        });

        $("#BottomMenu2").click(function()
        {
            window.location = "./Process.php";
           

        });

        $("#BottomMenu3").click(function()
        {
            window.location = "./GetStarted.php";
           
        

        });
    }

    if (loc.indexOf("Started") > 0)
    {
        $("#TopMenuStarted .MenuInactive").height("0px");
        $("#TopMenuStarted .MenuActive").height("22px").show().addClass("CurrentPage");

        $("#BottomMenu1 h2").html("THE 7 REASONS");
        $("#BottomMenu2 h2").html("A BETTER PROCESS");
        $("#BottomMenu3 h2").html("PURE SATISFACTION");

        $("#BottomMenu1 .BottomMenuContent").html("It’s about quality, trust, and reliability. It’s about better design and development.");
        $("#BottomMenu2 .BottomMenuContent").html("We’ve streamlined the process. It’s smoother, sleeker, and better than ever.");
        $("#BottomMenu3 .BottomMenuContent").html("We leave you satisfied. It's a guarantee you can count on.");


        $("#BottomMenu1").click(function()
        {
            window.location = "./Reasons.php";
           

        });

        $("#BottomMenu2").click(function()
        {
            window.location = "./Process.php";
           

        });

        $("#BottomMenu3").click(function()
        {
            window.location = "./Guarantee.php";
           
        });
    }

    if (loc.indexOf("Guarantee") > 0)
    {
        $("#TopMenuGuarantee .MenuInactive").height("0px");
        $("#TopMenuGuarantee .MenuActive").height("22px").show().addClass("CurrentPage");

        $("#BottomMenu1 h2").html("THE 7 REASONS");
        $("#BottomMenu2 h2").html("A BETTER PROCESS");
        $("#BottomMenu3 h2").html("GETTING STARTED");

        $("#BottomMenu1 .BottomMenuContent").html("It’s about quality, trust, and reliability. It’s about better design and development.");
        $("#BottomMenu2 .BottomMenuContent").html("We’ve streamlined the process. It’s smoother, sleeker, and better than ever.");
        $("#BottomMenu3 .BottomMenuContent").html("For all your media needs from online to print, we are your solution.");


        $("#BottomMenu1").click(function()
        {
            window.location = "./Reasons.php";
           

        });

        $("#BottomMenu2").click(function()
        {
            window.location = "./Process.php";
           

        });

        $("#BottomMenu3").click(function()
        {
            window.location = "./GetStarted.php";
           
        });
    }

    if (loc.indexOf("Reasons") > 0)
    {
        $("#TopMenuGuarantee .MenuInactive").height("0px");
        $("#TopMenuGuarantee .MenuActive").height("22px").show().addClass("CurrentPage");

        $("#BottomMenu1 h2").html("PURE SATISFACTION");
        $("#BottomMenu2 h2").html("A BETTER PROCESS");
        $("#BottomMenu3 h2").html("GETTING STARTED");

        $("#BottomMenu1 .BottomMenuContent").html("We leave you satisfied. It's a guarantee you can count on.");
        $("#BottomMenu2 .BottomMenuContent").html("We’ve streamlined the process. It’s smoother, sleeker, and better than ever.");
        $("#BottomMenu3 .BottomMenuContent").html("For all your media needs from online to print, we are your solution.");


        $("#BottomMenu1").click(function()
        {
            window.location = "./Reasons.php";
           

        });

        $("#BottomMenu2").click(function()
        {
            window.location = "./Process.php";
           

        });

        $("#BottomMenu3").click(function()
        {
            window.location = "./GetStarted.php";
           
        });
    }

    if (loc.indexOf("Process") > 0)
    {
        $("#TopMenuGuarantee .MenuInactive").height("0px");
        $("#TopMenuGuarantee .MenuActive").height("22px").show().addClass("CurrentPage");

        $("#BottomMenu1 h2").html("THE 7 REASONS");
        $("#BottomMenu2 h2").html("PURE SATISFACTION");
        $("#BottomMenu3 h2").html("GETTING STARTED");

        $("#BottomMenu1 .BottomMenuContent").html("It’s about quality, trust, and reliability. It’s about better design and development.");
        $("#BottomMenu2 .BottomMenuContent").html("We leave you satisfied. It's a guarantee you can count on.");
        $("#BottomMenu3 .BottomMenuContent").html("For all your media needs from online to print, we are your solution.");


        $("#BottomMenu1").click(function()
        {
            window.location = "./Reasons.php";
           

        });

        $("#BottomMenu2").click(function()
        {
            window.location = "./Process.php";
           

        });

        $("#BottomMenu3").click(function()
        {
            window.location = "./GetStarted.php";
           
        });
    }


    $(".MenuItem").bind("mouseenter",function(){

        $(this).find(".MenuInactive:not(.CurrentPage)").animate({
            height:"0px",
            width:"100%"
        },{
            queue:false,
            duration:speed
        },function(){});

        $(this).find(".MenuActive:not(.CurrentPage)").animate({
            height:"22px",
            width:"100%"
        },{
            queue:false,
            duration:speed
        });

    }).bind("mouseleave",function(){



        $(this).find(".MenuActive:not(.CurrentPage)").animate({
            height:"0px",
            width:"100%"
        },{
            queue:false,
            duration:speed
        },function(){});

        $(this).find(".MenuInactive:not(.CurrentPage)").animate({
            height:"22px",
            width:"100%"
        },{
            queue:false,
            duration:speed
        },function(){});


    });


    $(".LargeArrow").bind("mouseenter",function(){

        $(this).animate({
            "left":"10px"
        },{
            queue:false,
            duration:"100"
           
        },function(){});


    }).bind("mouseleave",function(){



        $(this).animate({
            "left":"0px"
        },{
            queue:false,
            duration:"100"
            
        },function(){});


    });

    $("#BoxTopContact").bind("mouseenter",function(){

        $(this).animate({
            "left":"10px"
        },{
            queue:false,
            duration:"100"

        },function(){});


    }).bind("mouseleave",function(){



        $(this).animate({
            "left":"0px"
        },{
            queue:false,
            duration:"100"

        },function(){});


    });

  
    

});


function verifyForm()
{

    verified=true;
    errorMsg = "Please fill out these required fields:";

    //if ($("#ContactFormCompany").val() == ""){errorMsg = errorMsg + "\n\n\t-Company Name"; verified = false;}
    if ($("#ContactFormName").val() == ""){errorMsg = errorMsg + " <span class='red'>Contact Name</span>"; verified = false;}
    if ($("#ContactFormName").val() == "" && $("#ContactFormEmail").val() == "") {errorMsg = errorMsg + ",";}
    if ($("#ContactFormEmail").val() == ""){errorMsg = errorMsg + " <span class='red'>Email</span>"; verified = false;}
    
    if (!verified)
    {    $("#ErrorBox").html(errorMsg);
        $("#ErrorBox").animate({right:"10px"});
        return false;
    }
    else
        return true;
}



