/*----------------------------------------------------------------------------------------------------------------- */
/*SCRIPT FOR TARGET="_BLANK" TO FAKE,  FOR STRICT HTML TO BE VALID*/
function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (
			anchor.getAttribute("href") && ( 
			anchor.getAttribute("rel") == "external" || 
			anchor.getAttribute("rel") == "external nofollow" || 
			anchor.getAttribute("rel") == "nofollow external" )
			)
		anchor.target = "_blank";
	}
}
window.onload = function() {
	externalLinks();
}




function del(object) {
    var answer = confirm("Weet u zeker dit product te verwijderen.")
    if (answer)
        if (Validate(object)) {
            eval("document.getElementById('" + object + "').submit();");
            jQuery("#loadingscreen").show();
        }
        else {
            return false;
        }
   
      
}




/* END FUCNTION */
/*----------------------------------------------------------------------------------------------------------------- */


/*----------------------------------------------------------------------------------------------------------------- */
/*FORM VALIDATION SCRIPT STARTERS*/

$(document).ready(function () {

    $('#searchform').submit(function () {
        if (!Validate('searchform')) { return false; }
    });



    $("div.outerMenu .parent").hover(function () { //When trigger is clicked...  

        //Following events are applied to the subnav itself (moving subnav up and down)  

        $(this).parent().find("div.submenu").slideDown(125).show(); //Drop down the subnav on click  

        $(this).parent().hover(function () {
        }, function () {
            $(this).parent().find("div.submenu").slideUp(125); //When the mouse hovers out of the subnav, move it back up  
        });

        //Following events are applied to the trigger (Hover events for the trigger)  
    }).hover(function () {
        $(this).addClass("subhover"); //On hover over, add class "subhover"  
    }, function () {  //On Hover Out  
        $(this).removeClass("subhover"); //On hover out, remove class "subhover"
    });


    jQuery('.buttonpopup', '#offerteContainer').bind('click', function () {
        jQuery("#loadingscreen").show();
    });

});







var formfunctions = new function () {
    this.onfocus = function (Element) {
        if (Element.value.length == 0 || Element.value == Element.title || Element.title == "") {
            Element.title = Element.value;
            Element.alt = Element.value;
            Element.value = "";
        }
    }


    this.onblur = function (Element) {
        if (Element.value.length == 0 || Element.value == Element.title) {
            Element.value = Element.title
            Element.alt = ""
            Element.title = ""
        }
    }



    this.formproductsubmit = function (element) {
        if (Validate(element)) {
            jQuery("#loadingscreen").show();
            eval("document.getElementById('" + element + "').submit();") 
        }
    }



    this.formsubmit = function (element) {
        if (Validate(element)) { eval("document.getElementById('" + element + "').submit();") }
    }

}
/* END FUCNTION */
/*----------------------------------------------------------------------------------------------------------------- */

/*----------------------------------------------------------------------------------------------------------------- */
/*JQUERY FUNCTIONS*/

$(function () {
    $('#slider1').anythingSlider({ // Banner Homepage
        buildArrows: false,
        pauseOnHover: false,
        delay: 9000,
        autoPlay: false,
        animationTime: 0,
        navigationFormatter: function (i, panel) {
            return jQuery(panel).find("img").attr('alt');
        }
    });

});

//$(function () {
//    $('#AnythingFader').anythingFader({
//        autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
//        delay: 5000,                    // How long between slide transitions in AutoPlay mode
//        startStopped: false,            // If autoPlay is on, this can force it to start stopped
//        animationTime: 500,             // How long the slide transition takes
//        hashTags: true,                 // Should links change the hashtag in the URL?
//        buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
//        pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
//        startText: "Go",                // Start text
//        stopText: "Stop",               // Stop text
//        navigationFormatter: function (i, panel) {
//           return jQuery(panel).find("img").attr('alt');
//        }
//    });
//});


$(document).ready(function () {
    setTimeout(function () {
        $('.MeldingBox').slideUp(500);
    }, 15000); // <-- time in milliseconds
});

$(document).ready(function () {

    $("a.single_image").fancybox({
        'type': 'image'
    });

    $("a#inline").fancybox({
        'hideOnContentClick': false,
        'overlayColor': '#106286'
    });


    $("a#callme").fancybox({
        'hideOnContentClick': false,
        'overlayColor': '#106286'
    });


    $("a.group").fancybox({
        'transitionIn': 'elastic',
        'transitionOut': 'elastic',
        'type': 'image',
        'speedIn': 600,
        'speedOut': 200,
        'overlayColor': '#106286',
        'overlayShow': true,
        'overlayOpacity': 0.7
    });

    $("a.single_image").fancybox({
        'titlePosition': 'inside',
        'transitionIn': 'elastic',
        'transitionOut': 'elastic',
        'overlayColor': '#106286',
        'type': 'image',
        'overlayOpacity': 0.7
    });

    $('a.button', '#loginBar').click(function () { // Login
        $('#loginBar').toggleClass('showForm');
    });

  

    $('a.closeMessage').click(function () {
        $('.MeldingBox').slideUp(500);
    });
    
    


    $('.submitButton').click(function () {

        if (Validate($(this).parent().parent().attr('id'))) {
            parent.$.fancybox.close();
           var id = $(this).attr("id");
           $('#product' + id).find('.productcountinput').val($(this).parent().find('.changebleProductCount').val());
           $('#product' + id).find('.productcount').html($(this).parent().find('.changebleProductCount').val())
            $('#product' + id).find('.changable').css('display', 'block');
        };
    });





});










/* END FUCNTION */
/*----------------------------------------------------------------------------------------------------------------- */



