$(document).ready(function() {
    //reset name for input fields with the class focus_value
    //get the title and use it as value if empty
    $('.focus_value').focus(function(){
        var current_value = $(this).attr('value');
        var current_title = $(this).attr('title');
        if(current_value == current_title) {
            $(this).attr('value', '');
        }
    }); 
    
    $('.focus_value').blur(function(){
        var current_value = $(this).attr('value');
        var current_title = $(this).attr('title');
        
        if(current_value == '') {
            $(this).attr('value', current_title);
        }
    });
    
    //hover van i bij nieuwsitem
    $("#newsi").hover(
        function () {
            $(".news_slideshowoverlay").fadeIn();
            $(".news_slideshowoverlaycontent").fadeIn();
        }, 
        function () {
            $(".news_slideshowoverlay").fadeOut();
            $(".news_slideshowoverlaycontent").fadeOut();
        }
    );
    
    
    
    
    //hover van de i naast wachtlijst
    $(".wachtlijst_i").hover(
    	function () {
    		//alert('s')
            var pos = $(this).offset(); //pos bepalen
            $(this).css('z-index', 12);
            $(".wachtlijst_i").css('z-index', 4);
            $(".wachtlijsttext").css({"left" : (pos.left), "top" : pos.top}).css('zIndex', '3');
            $(".wachtlijsttext").fadeIn(); 

        }, 
        function () {
           $(".wachtlijsttext").removeAttr("style").fadeOut(); 
           $(".wachtlijst_i").css('z-index', 9);           
        }
    );
    
     //hover van de i bij gewijzigd product
    $(".changed_i").hover(
    	function () {
    		//alert('s')
            var pos = $(this).offset(); //pos bepalen
            $(this).css('z-index', 12);
            $(".changed_i").css('z-index', 4);
            $(".changedtext").css({"left" : (pos.left), "top" : pos.top}).css('zIndex', '3');
            $(".changedtext").fadeIn(); 

        }, 
        function () {
           $(".changedtext").removeAttr("style").fadeOut(); 
           $(".changed_i").css('z-index', 9);           
        }
    );
    
    //laat inlinecard
    inlinecart(0);
    
    
    
   
    
	$(".accordion h3").click(function(){
		$(this).next("p").slideToggle("slow")
		.siblings("p:visible").slideUp("slow");
		$(this).toggleClass("active");
		$(this).siblings("h3").removeClass("active");
	});
    
    
    //hover van slideshow_link
  	$('#slideshow_link li').hover(function(){
        $(this).siblings('li').removeClass('active');
        $(this).addClass('active');
    });    
    
    $('#product_link li a').hover(function(){
        //$('.realactive').removeClass('active');
        $(this).addClass('active');
    });
    
   	$('#product_link').mouseout(function(){
   		$('#product_link li a').removeClass('active');
		$(".realactive").addClass('active');
	});
   
	

    
});

function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
  var rv = -1; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}

function checkVersion()
{
  var ver = getInternetExplorerVersion();

  if ( ver > -1 )
  {
    if ( ver < 7.0 ) {
      window.open('ajax/ie6.php','_blank','width=960,height=600');
    }
  }
  //alert( msg );
}



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.target = "_blank";  
 }  
}  
window.onload = externalLinks;