﻿jQuery.noConflict();
jQuery(document).ready(function () {

    /* trigger mega dropdown menu in header */
    jQuery("#header div.menu ul li div.sub").css({ 'opacity': '0' });
    jQuery("#header div.menu ul li").hoverIntent(config);

    jQuery("#twitter").getTwitter({
        userName: "collagesnet",
        numTweets: 1,
        loaderText: "",
        slideIn: false,
        showHeading: true,
        headingText: "Latest Tweets",
        showProfileLink: true
    });

    jQuery('.scrollpage').click(function () {
        var elementClicked = jQuery(this).attr("href");
        var destination = jQuery(elementClicked).offset().top;
        jQuery("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination - 29 }, 500);
        return false;
    });



    //Tabs
    /*    
    jQuery(".tab_content").hide(); //Hide all content
    jQuery("ul.tabs li:first").addClass("active").show(); //Activate first tab
    jQuery(".tab_content:first").show(); //Show first tab content

    //On Click Event
    jQuery("ul.tabs li").click(function () {

    jQuery("ul.tabs li").removeClass("active"); //Remove any "active" class
    jQuery(this).addClass("active"); //Add "active" class to selected tab
    jQuery(".tab_content").hide(); //Hide all tab content

    var activeTab = jQuery(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
    jQuery(activeTab).fadeIn(); //Fade in the active ID content
    return false;
    });
    */


    
    

    //Example of preserving a JavaScript event for inline calls.
    jQuery("#click").click(function () {
        jQuery('#click').css({ "background-color": "#f00", "color": "#fff", "cursor": "inherit" }).text("Open this window again and this message will still be here.");
        return false;
    });


    //jQuery('a[rel*=facebox]').facebox();


    /* products home fade */
    jQuery("div.productshome ul li a").hover(function () {
        jQuery(this).children("div.productsHomeHover").fadeTo(0, 0); // This should set the opacity to 0% on hover
        jQuery(this).children("div.productsHomeHover").fadeTo(100, 1);

    }, function () {
        jQuery(this).children("div.productsHomeHover").fadeTo(0, 1); // This should set the opacity back to 100% on mouseout
        jQuery(this).children("div.productsHomeHover").fadeTo(150, 0);
    });

});



//Mega Dropdown Stuff
//On Hover Over
function megaHoverOver() {
    jQuery(this).find(".sub").stop().animate({'opacity': 1}, 0).show(); //Find sub and fade it in
    (function (jQuery) {
        //Function to calculate total width of all ul's
        jQuery.fn.calcSubWidth = function () {
            rowWidth = 0;
            //Calculate row
            jQuery(this).find("ul").each(function () { //for each ul...
                rowWidth += jQuery(this).width(); //Add each ul's width together
            });
        };
    })(jQuery);

    if (jQuery(this).find(".row").length > 0) { //If row exists...

        var biggestRow = 0;

        jQuery(this).find(".row").each(function () {	//for each row...
            jQuery(this).calcSubWidth(); //Call function to calculate width of all ul's
            //Find biggest row
            if (rowWidth > biggestRow) {
                biggestRow = rowWidth;
            }
        });

        jQuery(this).find(".sub").css({ 'width': biggestRow }); //Set width
        jQuery(this).find(".row:last").css({ 'margin': '0' });  //Kill last row's margin

    } else { //If row does not exist...

        jQuery(this).calcSubWidth();  //Call function to calculate width of all ul's
        jQuery(this).find(".sub").css({ 'width': rowWidth }); //Set Width

    }
}
//On Hover Out
function megaHoverOut() {
    jQuery(this).find(".sub").stop().animate({'opacity': 0}, 0).hide();    
}

var config = {
    sensitivity: 1000, // number = sensitivity threshold (must be 1 or higher)
    interval:0, // number = milliseconds for onMouseOver polling interval
    over: megaHoverOver, // function = onMouseOver callback (REQUIRED)
    timeout:0, // number = milliseconds delay before onMouseOut
    out: megaHoverOut // function = onMouseOut callback (REQUIRED)
};

jQuery("ul#topnav li .sub").css({ 'opacity': '0' }); //Fade sub nav to 0 opacity on default
jQuery("ul#topnav li").hoverIntent(config); //Trigger Hover intent with custom configuratio
//End Mega Dropdown Stuff




/* jCarouselLite */
jQuery(function () {
    jQuery(".weddings").jCarouselLite({
        btnNext: ".nextWeddings",
        btnPrev: ".prevWeddings"
    });
    jQuery(".seniors").jCarouselLite({
        btnNext: ".nextSeniors",
        btnPrev: ".prevSeniors"
    });
    jQuery(".children").jCarouselLite({
        btnNext: ".nextChildren",
        btnPrev: ".prevChildren"
    });
    jQuery(".bridals").jCarouselLite({
        btnNext: ".nextBridals",
        btnPrev: ".prevBridals"
    });
    jQuery(".albumcovercolors").jCarouselLite({
        btnNext: ".right",
        btnPrev: ".left",
        visible: 7,
        scroll:3,
        speed:400
    });
    jQuery(".ppctemplates").jCarouselLite({
        btnNext: ".right",
        btnPrev: ".left",
        visible: 5,
        scroll: 1,
        speed: 400
    });
    jQuery(".digilabsBGs").jCarouselLite({
        btnNext: ".right",
        btnPrev: ".left",
        visible: 5,
        scroll: 5,
        speed: 600
    });
    jQuery(".proofBooksCoverColors").jCarouselLite({
        btnNext: ".right",
        btnPrev: ".left",
        visible: 7,
        scroll: 7,
        speed: 600
    });
    jQuery(".collagesDesignerBGs").jCarouselLite({
        btnNext: ".right",
        btnPrev: ".left",
        visible: 5,
        scroll: 5,
        speed: 600
    });
});


/* colorbox */
function colorBoxInit() {    
    jQuery("a[rel='usecolorbox']").colorbox();
    jQuery("a[rel='usecolorbox_albumcovers']").colorbox();
    jQuery("a[rel='usecolorbox_sendtoafriend']").colorbox({ width: "500px", inline: true, href: "#dv_sendtoafriend" });
    jQuery("a[rel='usecolorbox_ppctemplates']").colorbox();

    jQuery("a[rel='usecolorbox1']").colorbox(); /* multiple on page */
    jQuery("a[rel='usecolorbox2']").colorbox();
    jQuery("a[rel='usecolorbox3']").colorbox();
}


jQuery(function () {
    jQuery('input, textarea').placeholder();
});


function tooltipsInit() {
    //tipsy tooltips    
    jQuery('#abswatch_Sky_Blue').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Light_Blue').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Green').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Lime').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Forest_Green').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Tan').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Orange').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Gold').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Deep_Orange').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Saddle_Brown').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Burgundy').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Cowboy_Red').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Deep_Cherry').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Red').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Magenta').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Pink').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Black').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Onyx').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Ivory').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Brown').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Chocolate').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Aubergine').tipsy({ gravity: 's', title: 'alt' });

    jQuery('#abswatch_Black_Masquerade').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Ultra_Pink_Masquerade').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Fire_Engine_Red_Nasquerade').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Orange_Crush_Masquerade').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Cashmere_Masquerade').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Jade_Masquerade').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Sapphire_Masquerade').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Periwinkle_Masquerade').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Cobalt_Blue_Masquerade').tipsy({ gravity: 's', title: 'alt' });

    jQuery('#abswatch_Platinum').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Teal').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#abswatch_Honey').tipsy({ gravity: 's', title: 'alt' });

    jQuery('#pbswatch_Blanca').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Mint').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Sage').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Vail').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Blush').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Petal').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Island').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Terracotta').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Honey').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Cashmere').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Kelly').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Ivy').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Turquoise').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Caribbean').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Montauk').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Cherry').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Raspberry').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Cranberry').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Crimson').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Wildflower').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Juicy').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Grape').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Cabo').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Sunset').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Napa').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Chocolate').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Navy').tipsy({ gravity: 's', title: 'alt' });
    jQuery('#pbswatch_Onyx').tipsy({ gravity: 's', title: 'alt' });

    jQuery('#turnaroundtime').tipsy({ gravity: 's', title: 'title' });
}
