function get_object(id) 
{
	var object = null;
	if (document.layers) 
	{   
		object = document.layers[id];
	} else if (document.all)
	{
		object = document.all[id];
	}else if (document.getElementById) 
	{
		object = document.getElementById(id);
	}
    return object;
}
var request = false;
if (!request && typeof XMLHttpRequest != 'undefined') {
  request = new XMLHttpRequest();
}
function gotoSearch(urlstr,titelstr,str,fouttekst,venstertekst)
{
	if(get_object("zoeken").value =='' || get_object("zoeken").value == titelstr )
	{
		alert(fouttekst);
	}
	else
	{
		var strzoeken ="";
		if(get_object("SearchAll").checked)
		{
			strzoeken= strzoeken + "&SearchAll=-1"; 
		}else
		{
			strzoeken= strzoeken + "&SearchAll=0"; 
		}
		if(get_object("SearchProductSolutions").checked)
		{
			strzoeken= strzoeken + "&SearchProductSolutions=-1"; 
		}else
		{
			strzoeken= strzoeken + "&SearchProductSolutions=0"; 
		}
		if(get_object("SearchServices").checked)
		{
			strzoeken= strzoeken + "&SearchServices=-1"; 
		}else
		{
			strzoeken= strzoeken + "&SearchServices=0"; 
		}
		if(get_object("SearchInvestorRelations").checked)
		{
			strzoeken= strzoeken + "&SearchInvestorRelations=-1"; 
		}else
		{
			strzoeken= strzoeken + "&SearchInvestorRelations=0"; 
		}
		if(get_object("SearchPressMedia").checked)
		{
			strzoeken= strzoeken + "&SearchPressMedia=-1"; 
		}else
		{
			strzoeken= strzoeken + "&SearchPressMedia=0"; 
		}
		if(get_object("SearchResources").checked)
		{
			strzoeken= strzoeken + "&SearchResources=-1"; 
		}else
		{
			strzoeken= strzoeken + "&SearchResources=0"; 
		}
		if(get_object("SearchProductDatasheets").checked)
		{
			strzoeken= strzoeken + "&SearchProductDatasheets=-1"; 
		}else
		{
			strzoeken= strzoeken + "&SearchProductDatasheets=0"; 
		}
		$.prettyPhoto.open(urlstr + '/Modules/Mod_search.php?zoeken=' + get_object("zoeken").value + strzoeken + str +  "&randNR=" + Math.floor(Math.random()*11) + '&iframe=true&width=100%&height=100%',venstertekst + ' ' + get_object("zoeken").value,'');
	}
}
function gotoCallToAction(urlstr,titelstr,wid,taal,StickyID,breedte,hoogte)
{
	var framebreedte ="100%";
	var framehoogte ="100%";
	if(breedte != 0)
	{
		framebreedte = breedte;
	}
	if(hoogte != 0)
	{
		framehoogte = hoogte;
	}
	jQuery.prettyPhoto.open(urlstr + '/Modules/Mod_CallToAction.php?wid=' + wid + '&taal=' + taal + '&StickyID=' + StickyID + '&iframe=true&width=' + framebreedte + '&height=' + framehoogte,titelstr,'');
} 
/*BEGIN TAALKEUZE*/
  jQuery(document).ready(function($){
 
	//$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled - Adds empty span tag after ul.subnav
	if($("ul.topnav li") != null)
	{
		$("ul.topnav li").click(function() { //When trigger is clicked...
			
			//Following events are applied to the subnav itself (moving subnav up and down)
			$(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click
	 
			$(this).parent().hover(function() {
			}, function(){	
				$(this).parent().find("ul.subnav").slideUp('slow'); //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"
		});
	}
 
});
/*EINDE TAALKEUZE*/
/*BEGIN BUTTON ANIMATION*/
jQuery(document).ready(function($) {
		$(".social li, #social li").hover(function() {
			var e = this;
		    $(e).find("a").stop().animate({ marginTop: "-8px" }, 200, function() {
		    	$(e).find("a").animate({ marginTop: "-6px" }, 200);
		    });
		},function(){
			var e = this;
		    $(e).find("a").stop().animate({ marginTop: "4px" }, 300, function() {
		    	$(e).find("a").animate({ marginTop: "0px" }, 300);
		    });
		});
		$("#stickydiv_back-to-top").hover(function() {
			var e = this;
		    $(e).find("a").stop().animate({ marginTop: "-8px" }, 200, function() {
		    	$(e).find("a").animate({ marginTop: "-6px" }, 200);
		    });
		},function(){
			var e = this;
		    $(e).find("a").stop().animate({ marginTop: "0px" }, 300, function() {
		    	$(e).find("a").animate({ marginTop: "0px" }, 300);
		    });
		});
		$("#searchdiv").hover(function() {
			var e = this;
		    $(e).stop();
			$(e).animate({ marginTop: "211px" }, 300, function() {
		    	$(e).animate({ marginTop: "206px" }, 200);
		    });
		},function(){
			var e = this;
		    $(e).stop();
			$(e).animate({ marginTop: "-5px" }, 300, function() {
		    	$(e).animate({ marginTop: "0px" }, 200);
		    });
		});
		$(".higlight-animation").hover(function() {
			var e = this;
		    $(e).find("a").stop().animate({ marginLeft: "10px" }, 200, function() {
		    	$(e).find("a").animate({ marginLeft: "10px" }, 200);
		    });
		},function(){
			var e = this;
		    $(e).find("a").stop().animate({ marginLeft: "0px" }, 200, function() {
		    	$(e).find("a").animate({ marginLeft: "0px" }, 200);
		    });
		});
	});
/*EINDE BUTTON ANIMATION*/
/*BEGIN INVOERVELDEN*/
function changeField(veld,waarde,actie)
{
	if(actie == 0)
	{
		if(get_object(veld).value == waarde)
		{
			get_object(veld).value = "";
		}
	}else if(actie == 1)
	{
		if(get_object(veld).value == "")
		{
			get_object(veld).value = waarde;	
		}
	}
}
/*EINDE INVOERVELDEN*/
/*BEGIN PRODUCT CAROUSEL*/
function ChangeProductSlider(SliderID,SEO)
{
	get_object("product_list_title_cat").innerHTML = get_object("ProductSliderCatItemLink_" + SliderID).innerHTML;
	var SliderSelected = $("#ProductSliderProducts").children(".imageflow")[0].id;
	SliderSelectedCode = SliderSelected.replace("myImageFlow_","");
	if(SliderSelectedCode != SliderID)
	{
		get_object(SliderSelected).className = "imageflowHIDDEN";
		eval("instanceOne_" + SliderSelectedCode).glideTo(0);
		eval("instanceOne_" + SliderSelectedCode).Slideshow.stop();
		eval("instanceOne_" + SliderID).glideTo(0);
		eval("instanceOne_" + SliderID).Slideshow.stop();
		$("#myImageFlow_" + SliderID).removeClass("imageflowHIDDEN");
		$("#myImageFlow_" + SliderID).addClass("imageflow");
		$("#imageFlowTekst_" + SliderSelectedCode).removeClass("imageFlowTekst");
		$("#imageFlowTekst_" + SliderSelectedCode).addClass("imageFlowTekstHIDDEN");
		$("#imageFlowTekst_" + SliderID).removeClass("imageFlowTekstHIDDEN");
		$("#imageFlowTekst_" + SliderID).addClass("imageFlowTekst");
		eval("instanceOne_" + SliderID).refresh();
		eval("instanceOne_" + SliderID).Slideshow.start();
		var SliderSelectedTitle = $("#ProductSliderCat").children(".ProductSliderCatItemSELECTED")[0].id;
		$("#" + SliderSelectedTitle).removeClass("ProductSliderCatItemSELECTED");
		$("#" + SliderSelectedTitle).addClass("ProductSliderCatItem");
		$("#ProductSliderCatItem_" + SliderID).removeClass("ProductSliderCatItem");
		$("#ProductSliderCatItem_" + SliderID).addClass("ProductSliderCatItemSELECTED");
		if($("#ProductLijst").children(".ProductCataloogSELECTED").length > 0)
		{
			var $kids = $("#ProductLijst").children(".ProductCataloogSELECTED");
			$kids.removeClass("ProductCataloogSELECTED");
			$kids.addClass("ProductCataloog");
		}
		var $kids =$(':regex(id,^Product_.*' + SliderID + '_.*)');
		$kids.removeClass("ProductCataloog");
		$kids.addClass("ProductCataloogSELECTED");
		 $kids.each
		 (
			function(index) 
			{
				var productlink = $("a",this).attr("href");
				var productlinksplit = productlink.split('/');
				$("a",this).attr("href",productlink.replace('/' + productlinksplit[5] + '/','/' + SEO + '/'));
			}
		);

	}else
	{
		eval("instanceOne_" + SliderID).glideTo(0);
		eval("instanceOne_" + SliderID).Slideshow.stop();
		eval("instanceOne_" + SliderID).Slideshow.start();	
	}
}
jQuery.expr[':'].regex = function(elem, index, match) {
    var matchParams = match[3].split(','),
        validLabels = /^(data|css):/,
        attr = {
            method: matchParams[0].match(validLabels) ? 
                        matchParams[0].split(':')[0] : 'attr',
            property: matchParams.shift().replace(validLabels,'')
        },
        regexFlags = 'ig',
        regex = new RegExp(matchParams.join('').replace(/^\s+|\s+$/g,''), regexFlags);
    return regex.test(jQuery(elem)[attr.method](attr.property));
}
function ChangeProductSliderNext()
{
	var parent = $("#ProductSliderCat"); // this is the div that you may alread have found earlier 
	var SliderSelected = parent.children(".ProductSliderCatItemSELECTED")[0].id;
	var Aantalchilds = parent.children().length;
	var SliderNext =-1;
	for (iSlider=0;iSlider<=(Aantalchilds -1);iSlider++)
	{
		if(SliderNext == -2)
		{
			if(parent.children()[iSlider].id != undefined )
			{
				SliderNext =parent.children()[iSlider].id;
			}
		}
		if(SliderSelected == parent.children()[iSlider].id)
		{
			SliderNext = -2;
		}
	}
	if(SliderNext < 0)
	{
		if(parent.children(".ProductSliderCatItemLink")[0].id != undefined)
		{
			SliderNext = parent.children(".ProductSliderCatItem")[0].id;
		}
	}
	ChangeProductSlider(SliderNext,'');
}
/*EINDE PRODUCT CAROUSEL*/
/*BEGIN BACK TO TOP*/
var scrolltotop={
	setting: {startline:100, scrollto: 0, scrollduration:500, fadeduration:[500, 100]},
	controlHTML: '<div id="stickydiv_back-to-top"></div>', //HTML for control, which is auto wrapped in DIV w/ ID="topcontrol"
	controlattrs: {offsetx:5, offsety:5}, //offset of control relative to right/ bottom of window corner
	anchorkeyword: '#top', //Enter href value of HTML anchors on the page that should also act as "Scroll Up" links
	state: {isvisible:false, shouldvisible:false},
	scrollup:function(){
		if (!this.cssfixedsupport) //if control is positioned using JavaScript
			this.$control.css({opacity:0}) //hide control immediately after clicking it
		var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto)
		if (typeof dest=="string" && jQuery('#'+dest).length==1) //check element set by string exists
			dest=jQuery('#'+dest).offset().top
		else
			dest=0
		this.$body.animate({scrollTop: dest}, this.setting.scrollduration);
	},
	keepfixed:function(){
		var $window=jQuery(window)
		var controlx=$window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx
		var controly=$window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety
		this.$control.css({left:controlx+'px', top:controly+'px'})
	},
	togglecontrol:function(){
		var scrolltop=jQuery(window).scrollTop()
		if (!this.cssfixedsupport)
			this.keepfixed()
		this.state.shouldvisible=(scrolltop>=this.setting.startline)? true : false
		if (this.state.shouldvisible && !this.state.isvisible){
			this.$control.stop().animate({opacity:1}, this.setting.fadeduration[0])
			this.state.isvisible=true
		}
		else if (this.state.shouldvisible==false && this.state.isvisible){
			this.$control.stop().animate({opacity:0}, this.setting.fadeduration[1])
			this.state.isvisible=false
		}
	},
	init:function(){
		jQuery(document).ready(function($){
			var mainobj=scrolltotop
			var iebrws=document.all
			mainobj.cssfixedsupport=!iebrws || iebrws && document.compatMode=="CSS1Compat" && window.XMLHttpRequest //not IE or IE7+ browsers in standards mode
			mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body')
			mainobj.$control=$('<div id="topcontrol">'+mainobj.controlHTML+'</div>')
				.css({position:mainobj.cssfixedsupport? 'fixed' : 'absolute', bottom:mainobj.controlattrs.offsety, right:mainobj.controlattrs.offsetx, opacity:0, cursor:'pointer'})
				.attr({title:''})
				.click(function(){mainobj.scrollup(); return false})
				.appendTo('body')
			if (document.all && !window.XMLHttpRequest && mainobj.$control.text()!='') //loose check for IE6 and below, plus whether control contains any text
				mainobj.$control.css({width:mainobj.$control.width()}) //IE6- seems to require an explicit width on a DIV containing text
			mainobj.togglecontrol()
			$('a[href="' + mainobj.anchorkeyword +'"]').click(function(){
				mainobj.scrollup()
				return false
			})
			$(window).bind('scroll resize', function(e){
				mainobj.togglecontrol()
			})
		})
	}
}
scrolltotop.init()
/*EINDE BACK TO TOP*/
function xhrRequest(type) { 
		type = type ||  "html"; 
		xhrSend =  !window.XMLHttpRequest ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest(); 
		if (xhrSend.overrideMimeType) {   xhrSend.overrideMimeType("text/" + type); } 
	return xhrSend; 
} 
function gotoNewsletterSubscribe(website,taal)
{
	url = website + "/Modules/Mod_Newsletter_Subscribe_content.php?taal=" + taal + "&Newsletter_check=yes&Newsletter_email=" + encodeURIComponent(get_object("Newsletter_email").value);
	var reqType = "text"; 
	var xhrRec = xhrRequest(reqType); 
	xhrRec.open("GET", url, true); 
	var xhrRecB = xhrRequest(reqType); 
	xhrRec.onreadystatechange =    function () 
	{ 
		if (xhrRec.readyState == 4 && xhrRec.status == 200) 
		{ 
			var rt= xhrRec.responseText; 
			get_object("div_newsletter_subscribe").innerHTML =  rt; 
			xhrRec = null;         
		} 
	} 
	xhrRec.send(null); 
}
jQuery(document).ready(function($)
	{
		$( ".print" )
		.attr( "href", "javascript:void( 0 )" )
		.click(
			function(){
				$( "#" + $(this).attr('id') ).print();
				return( false );
			}
			);
	});
function gotoResourcesBuyingEmail(urlstr,titelstr,wid,taal,ResBuyingID,breedte,hoogte)
{
	var framebreedte ="100%";
	var framehoogte ="100%";
	if(breedte != 0)
	{
		framebreedte = breedte;
	}
	if(hoogte != 0)
	{
		framehoogte = hoogte;
	}
	$.prettyPhoto.open(urlstr + '/Modules/Mod_Resources_email.php?wid=' + wid + '&ResType=BuyingGuides&taal=' + taal + '&ResBuyingID=' + ResBuyingID + '&iframe=true&width=' + framebreedte + '&height=' + framehoogte,titelstr,'');
}
function gotoResourcesAll(urlstr,titelstr,wid,taal,ResID,ResType,Resvar,breedte,hoogte)
{
	var framebreedte ="100%";
	var framehoogte ="100%";
	if(breedte != 0)
	{
		framebreedte = breedte;
	}
	if(hoogte != 0)
	{
		framehoogte = hoogte;
	}
	$.prettyPhoto.open(urlstr + '/Modules/Mod_Resources_email.php?wid=' + wid + '&ResType=' + ResType +  '&taal=' + taal + '&' + Resvar + '=' + ResID + '&iframe=true&width=' + framebreedte + '&height=' + framehoogte,titelstr,'');
}
function gotoResourcesAddresses(urlstr,titelstr,wid,taal,breedte,hoogte)
{
	var framebreedte ="100%";
	var framehoogte ="100%";
	if(breedte != 0)
	{
		framebreedte = breedte;
	}
	if(hoogte != 0)
	{
		framehoogte = hoogte;
	}
	$.prettyPhoto.open(urlstr + '/address.php?wid=' + wid +  '&taal=' + taal + '&iframe=true&width=' + framebreedte + '&height=' + framehoogte,titelstr,'');
}
