﻿//voorladen van de plaatjes
var foto1=new Image()
foto1.src="/images/header_right_logo_maxicosi.jpg"// foto 1
var foto2=new Image()
foto2.src="/images/header_right_logo_recaro.jpg"// foto 2
var foto3=new Image()
foto3.src="/images/header_right_logo_quinny.jpg"// foto 3
var foto4=new Image()
foto4.src="/images/header_right_logo_easywalker.jpg"// foto 4
var foto5=new Image()
foto5.src="/images/header_right_logo_romer.jpg"// foto 5
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

var stap=1
var beeldnr=1
function overvloeier(){
if (!document.images)
return
if (document.all)
//slide.filters.blendTrans.apply()
document.images.slide.src=eval("foto"+stap+".src")
if (document.all)
//slide.filters.blendTrans.play()
beeldnr=stap
if (stap<5)// aanpassen aan aantal plaatjes
stap++
else
stap=1
setTimeout("overvloeier()",4000)// de tijd tussen twee plaatjes in milliseconden
}
function overgang(){
if (beeldnr==1)
window.location="http://www.maxicosi.nl"
else if (beeldnr==2)
window.location="http://www.recaro.com"
else if (beeldnr==3)
window.location="http://www.quinny.com"
else if (beeldnr==4)
window.location="http://www.britax-roemer.de"
else if (beeldnr==5)
window.location="http://www.easywalker.nl"
 // bij meer foto's gewoon doornummeren
}

function bestel(strNummer) 
{
    var strURL;
    strURL = '' + '/orderdefault.aspx?addtocart=' + strNummer;
    window.location.href =  strURL;
}

function PopupWindow(strURL,strName,strWidth,strHeight)
{
var hWindow;
if (strWidth != '') {strWidth = 'width=' + strWidth ;}
if (strHeight != '') {strHeight = 'Height=' + strHeight;} 
hWindow = window.open(strURL , '', 'dependent=yes, hotkeys=no, titlebar=no, fullscreen=no, channelmode=no, toolbar=no, location=no, directories=no, status=no, menubars=no, resizable=no,' + strWidth + ', ' + strHeight + ', top=150, left=70');
}

function getElementById_s(id){
	var obj = null;
	if(document.getElementById){
	/* Prefer the widely supported W3C DOM method, if
	available:-
	*/
	obj = document.getElementById(id);
	}else if(document.all){
	/* Branch to use document.all on document.all only
	browsers. Requires that IDs are unique to the page
	and do not coincide with NAME attributes on other
	elements:-
	*/
	obj = document.all[id];
	}
	/* If no appropriate element retrieval mechanism exists on
	this browser this function always returns null:-
	*/
	return obj;
}

//Load extern file in div
var loadedobjects=""
var rootdomain="http://"+window.location.hostname

function ajaxpage(url, containerid){
    document.getElementById(containerid).innerHTML = "<br><center><img src='/images/loading.gif' border=0></center>";

    var page_request = false;
    if (window.XMLHttpRequest){ // if Mozilla, Safari etc
    page_request = new XMLHttpRequest()}
    else if (window.ActiveXObject){ // if IE
    try {
    page_request = new ActiveXObject("Msxml2.XMLHTTP")
    } 
    catch (e){
    try{
    page_request = new ActiveXObject("Microsoft.XMLHTTP")
    }
    catch (e){}
    }
    }
    else
    return false
    page_request.onreadystatechange=function(){
    loadpage(page_request, containerid)
    }
    page_request.open('GET', url, true)
    page_request.send(null)
}

function loadpage(page_request, containerid){
    var rep;
    if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
    {
    rep = page_request.responseText;
    document.getElementById(containerid).innerHTML = "";
    document.getElementById(containerid).innerHTML =  "" + rep + "";
    }
}

function loadobjs(){
    if (!document.getElementById)
    return
    for (i=0; i<arguments.length; i++){
    var file=arguments[i]
    var fileref=""
    if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
    if (file.indexOf(".js")!=-1){ //If object is a js file
    fileref=document.createElement('script')
    fileref.setAttribute("type","text/javascript");
    fileref.setAttribute("src", file);
    }
    else if (file.indexOf(".css")!=-1){ //If object is a css file
    fileref=document.createElement("link")
    fileref.setAttribute("rel", "stylesheet");
    fileref.setAttribute("type", "text/css");
    fileref.setAttribute("href", file);
    }
    }
    if (fileref!=""){
    document.getElementsByTagName("head").item(0).appendChild(fileref)
    loadedobjects+=file+" " //Remember this object as being already added to page
    }
    }
}

function getElementById_s(id) {
    var obj = null;
    if (document.getElementById) {
        /* Prefer the widely supported W3C DOM method, if
        available:-
        */
        obj = document.getElementById(id);
    } else if (document.all) {
        /* Branch to use document.all on document.all only
        browsers. Requires that IDs are unique to the page
        and do not coincide with NAME attributes on other
        elements:-
        */
        obj = document.all[id];
    }
    /* If no appropriate element retrieval mechanism exists on
    this browser this function always returns null:-
    */
    return obj;
}

var intCurrentImage;
intCurrentImage = 1;
intMaxImage = 1;
function initPage() {
    if (document.getElementById('anderekleuren') != null) {
        ajaxpage('/altermodel.aspx?id=' + document.getElementById('anderekleuren').title, 'anderekleuren');
        document.getElementById('anderekleuren').title;
        document.getElementById('anderekleuren').title = "";
    }
    showProductImage();
}

function showProductImage() {
    //var obj;
    //obj = getElementById_s("productimage1");
    //if (obj != null) {
    showhideImage();
    //}
}
function showhideImage() {
    var strImage;
    var intTeller;
    var obj;
    var strCurrentImage;
    strCurrentImage = "productimage" + intCurrentImage;
    intTeller = 1;
    strImage = "productimage1";
    obj = getElementById_s(strImage);
    while (obj != null) {
        if (strImage == strCurrentImage) {
            obj.className = 'showimage';
        } else {
            obj.className = 'hideimage';
        }
        intTeller++;
        strImage = "productimage" + intTeller;
        obj = getElementById_s(strImage);
    }
    intMaxImage = intTeller - 1;
    if (intCurrentImage < intMaxImage) {
        intCurrentImage++;
    } else {
        intCurrentImage = 1;
    }
    setTimeout(showhideImage, 3000);
}

function Nieuwsbriefaanmelden(strNaam, strEmail)
{
    ajaxpage('/nieuwsbriefaanmeld.aspx?naam=' + strNaam + '&email=' + strEmail ,'nieuwsbrief');
}

//Begin functies voor category tekst
var dhtmlgoodies_slideSpeed = 90;	// Higher value = faster
var dhtmlgoodies_timer = 10;	// Lower value = faster

var objectIdToSlideDown = false;
var dhtmlgoodies_activeId = false;
var dhtmlgoodies_slideInProgress = false;
function showHideContent(e,inputId)
{
	if(dhtmlgoodies_slideInProgress)return;
	dhtmlgoodies_slideInProgress = true;
	if(!inputId)inputId = this.id;
	inputId = inputId + '';
	var numericId = inputId.replace(/[^0-9]/g,'');
	var answerDiv = document.getElementById('dhtmlgoodies_a' + numericId);

	objectIdToSlideDown = false;
	
	if(!answerDiv.style.display || answerDiv.style.display=='none'){		
		if(dhtmlgoodies_activeId &&  dhtmlgoodies_activeId!=numericId){			
			objectIdToSlideDown = numericId;
			slideContent(dhtmlgoodies_activeId,(dhtmlgoodies_slideSpeed*-1));
		}else{
			
			answerDiv.style.display='block';
			answerDiv.style.visibility = 'visible';
			
			slideContent(numericId,dhtmlgoodies_slideSpeed);
		}
	}else{
		slideContent(numericId,(dhtmlgoodies_slideSpeed*-1));
		dhtmlgoodies_activeId = false;
	}	
}

function slideContent(inputId,direction)
{
	
	var obj =document.getElementById('dhtmlgoodies_a' + inputId);
	var contentObj = document.getElementById('dhtmlgoodies_ac' + inputId);
	height = obj.clientHeight;
	if(height==0)height = obj.offsetHeight;
	height = height + direction;
	rerunFunction = true;
	if(height>contentObj.offsetHeight){
		height = contentObj.offsetHeight;
		rerunFunction = false;
	}
	if(height<=1){
		height = 1;
		rerunFunction = false;
	}

	obj.style.height = height + 'px';
	var topPos = height - contentObj.offsetHeight;
	if(topPos>0)topPos=0;
	contentObj.style.top = topPos + 'px';
	if(rerunFunction){
		setTimeout('slideContent(' + inputId + ',' + direction + ')',dhtmlgoodies_timer);
	}else{
		if(height<=1){
			obj.style.display='none'; 
			if(objectIdToSlideDown && objectIdToSlideDown!=inputId){
				document.getElementById('dhtmlgoodies_a' + objectIdToSlideDown).style.display='block';
				document.getElementById('dhtmlgoodies_a' + objectIdToSlideDown).style.visibility='visible';
				slideContent(objectIdToSlideDown,dhtmlgoodies_slideSpeed);				
			}else{
				dhtmlgoodies_slideInProgress = false;
			}
		}else{
			dhtmlgoodies_activeId = inputId;
			dhtmlgoodies_slideInProgress = false;
		}
	}
}

function initShowHideDivs()
{
	var divs = document.getElementsByTagName('DIV');
	var divCounter = 1;
	for(var no=0;no<divs.length;no++){
		if(divs[no].className=='meerinfobar'){
			divs[no].onclick = showHideContent;
			divs[no].id = 'dhtmlgoodies_q'+divCounter;
			var answer = divs[no].nextSibling;
			while(answer && answer.tagName!='DIV'){
				answer = answer.nextSibling;
			}
			answer.id = 'dhtmlgoodies_a'+divCounter;	
			contentDiv = answer.getElementsByTagName('DIV')[0];
			contentDiv.style.top = 0 - contentDiv.offsetHeight + 'px'; 	
			contentDiv.className='meerinfocontent_content';
			contentDiv.id = 'dhtmlgoodies_ac' + divCounter;
			answer.style.display='none';
			answer.style.height='1px';
			divCounter++;
		}		
	}
}

function showhidealternatieven() {
    var objBox;
    objBox = getElementById_s("showhidealternatievenbox");
    if (objBox != null) {
        if (objBox.className == "hidealternatieven")
        { objBox.className = "showalternatieven" } else {objBox.className = "hidealternatieven"; }
    }
}

function leesmeer() {
    var objBox;
    objBox = getElementById_s("algemeen");
    if (objBox != null) {
        objBox.className = "product_detail_algemeen_show";
    }
    var linkleesmeer;
    linkleesmeer = getElementById_s("linkleesmeer");
    linkleesmeer.className = "hiddentab";
}

/*-------TAB -------*/
function activetab(tab) {
    activetab1(tab);
    setTimeout("activetab1('" + tab + "')", 5);
}
function activetab1(tab) {

    var intTeller;
    var obj;
    var strtab;

    intTeller = 1;

    strtab = 'tab' + intTeller;
    while (getElementById_s(strtab) != null) {
        obj = getElementById_s(strtab);
        if (strtab == tab) {
            obj.className = 'product_detail_showtab';
        } else {
            obj.className = 'hiddentab';
        }
        intTeller++;
        strtab = 'tab' + intTeller;
    }

    intTeller = 1;

    strtab = 'tab' + intTeller;
    while (getElementById_s(strtab) != null) {
        obj = getElementById_s(strtab);
        if (strtab == tab) {
            document.images[strtab + '_image'].src = '/images/' + strtab + '_ro.jpg';
        } else {
            document.images[strtab + '_image'].src = '/images/' + strtab + '.jpg';
        }
        intTeller++;
        strtab = 'tab' + intTeller;
    }
}

