// JavaScript Document
var IE7=true;
var Esort='eur';

var cop=new Array();
var nop=new Array();
var top=new Array();
var FOcop=new Array();
var FOnop=new Array();
var FOtop=new Array();
var tim=new Array();


    //Advertisement script
    function moveup(id) {
        document.getElementById(id).style.zIndex='11';
    }

    function movedown(id) {
        document.getElementById(id).style.zIndex='0';
    }




var xmlHttp;
function checkbrowser()
{
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
}

function do_ajax(ding,actie,id,id2)
{
	checkbrowser();
	
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById(ding).innerHTML=xmlHttp.responseText;
		}
	}
	
	url="/include/ajax.asp?elem="+ding+"&action="+actie+"&id="+id+"&id2="+id2+"&dtm="+Date();
	
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	
	if(actie=='bevestigpwv')
	{
		var t = setTimeout("wwsluiten()",5000);
	}
}

function wwsluiten()
{
	showwin('pwvenster','hidden');
	showwin('overlay','hidden');
	window.location='default.asp';
}

function checkmailexists()
{
	checkbrowser();
	
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			if(xmlHttp.responseText!="ok")
				document.getElementById("melding").innerHTML=xmlHttp.responseText;
			else
				document.registerform.submit();
		}
	}
	
	url="/include/ajax.asp?action=checkmailexists&mail="+document.getElementById("klantemail").value+"&dtm="+Date();
	showwin('melding','mailexists');
	
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function showwin(id,klasse)
{
	document.getElementById(id).className=klasse;
}





    function goPageInPage(page,callback) {
        document.getElementById('main_2').innerHTML = document.getElementById('main_1').innerHTML ;
        document.getElementById('main_2').style.display='';
        document.getElementById('main_2').scrollTop=document.getElementById('main_1').scrollTop;
        setFade('main_1',0);
        setFade('main_2',100);
        document.getElementById('main_1').scrollTop=0;
        getPage(page,callback);
        hideHover();
    }   


    function goFormPage(page,callback,title,formname) {
        document.getElementById('main_2').innerHTML = document.getElementById('main_1').innerHTML ;
        document.getElementById('main_2').style.display='';
        setFade('main_1',0);
        setFade('main_2',100);
        getFormPage(page,callback,formname);
        if (title !=''&& title !=undefined) {
            document.getElementById('titlefield').innerHTML=title;
        }        
        hideHover();
    }  
 
    function back(backtext) {
        clearTimeout(tim['main_1']);
        clearTimeout(tim['main_2']);
        Loading=true;
        document.getElementById('main_1').innerHTML = backtext;
        FadeOut('main_2',fadeTimeout,fadeStep);
        FadeIn('main_1',fadeTimeout,fadeStep);
        var scroller = new String(document.location );
        scroller = scroller.substr(scroller.indexOf('&scrollto')+10,scroller.length -(scroller.indexOf('&scrollto')+10)) ;
        if (scroller !='' && scroller.length < 10) {
            document.getElementById(scroller).scrollIntoView();
            if (String(navigator.appVersion).search('MSIE6')==-1) {
                document.getElementById('main_1').scrollTop=document.getElementById('main_1').scrollTop-25;
            }
            window.scrollTo(0,0);
        }       
    }

    function ad(backtext) {
       document.getElementById('advert').innerHTML = backtext;
    }
    

    
    var Loading = false;
    var Viewing=false;
//Basket functies
    var inBasket=0;
    
	// basket aantal verhogen
	function count(number) {
		//alert(number);
		//alert(parseInt(document.getElementById('cartcontent').innerHTML));
		inBasket+=parseInt(number);
		document.getElementById('cartcontent').innerHTML ='Inhoud : ' + inBasket + ' Item(s)';
    }
	
	// basket aantal opvragen
    function recount() {
        //alert(Date.parse );
        getPage('basketcount.asp?x=',didrecount);
    }

    function didrecount(input) {
   		inBasket=parseInt(input);
		document.getElementById('cartcontent').innerHTML ='Inhoud : ' + inBasket + ' Item(s)';

    }

//img hover fix
function hideHover() {
        document.getElementById('o_1').style.left='-200px';
        document.getElementById('o_1').style.top='0px';  
        document.getElementById('b_1').style.display='none';
        Viewing=false;
}

//functies voor het ophalen van paginas met ajax
    var lastpages=new Array();
    var pages=0;
    var lastheads=new Array();
    var heads=0;

    function pagesBack(cnt) {
        var pgoto=0;
        pgoto = pages - (cnt);
        if (pgoto < 1) {
            pgoto=1;
        }
        return lastpages[pgoto];
    }

    function headsBack(cnt) {
        var hgoto=0;
        hgoto = heads - (cnt);
        if (hgoto < 1) {
            hgoto=1;
        }
        return lastheads[hgoto];
    }

    function getPage(page,callback) {
    Loading = true;
    if (String(page).search("advert.asp")==-1 && String(page).search("basketcount.asp")==-1) {
        pages++;
        lastpages[pages]=page;
        heads++;
        lastheads[heads]=document.getElementById('titlefield').innerHTML;
    }
    //alert(callback);
        var xmlHttp;
          try
            {
            // Firefox, Opera 8.0+, Safari
            xmlHttp=new XMLHttpRequest();
            }
          catch (e)
            {
            // Internet Explorer
            try
              {
              xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
              }
            catch (e)
              {
              try
                {
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                }
              catch (e)
                {
                alert("Your browser does not support AJAX!");
                return false;
                }
              }
            }
            xmlHttp.onreadystatechange=function()
              {
              if(xmlHttp.readyState==4)
                {
                    Loading = false;
                    callback(xmlHttp.responseText);
                    pageChanged(page);
                    if (String(page).search("basket2.asp")!=-1){
                        //basket refresh
						recount();
                    }
                    if (String(page).search("products.asp")!=-1){ //kijken of products.asp in de locatie voorkomt
						//sorteerfuncties tonen
                        document.getElementById('sort').style.display= '';    
                    }
                    else if (String(page).search("advert.asp")==-1 && String(page).search("basketcount.asp")==-1) {
                        document.getElementById('sort').style.display= 'none';
                        document.getElementById('sortText').innerHTML="A-Z";
                        Esort="eur";
                    }                                        
                }
              }
        xmlHttp.open("GET",page,true);
        xmlHttp.send(null);
        hideHover();
  }
  
  function getFormPage(page,callback,formname) {
    //alert(callback);
        Loading = true;
        /*pages++;
        lastpages[pages]=page;  */
        /*heads++;
        lastheads[heads]=document.getElementById('titlefield').innerHTML;              
        */
        var xmlHttp;
          try
            {
            // Firefox, Opera 8.0+, Safari
            xmlHttp=new XMLHttpRequest();
            }
          catch (e)
            {
            // Internet Explorer
            try
              {
              xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
              }
            catch (e)
              {
              try
                {
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                }
              catch (e)
                {
                alert("Your browser does not support AJAX!");
                return false;
                }
              }
            }
            xmlHttp.onreadystatechange=function()
              {
              if(xmlHttp.readyState==4)
                {
                    Loading=false;
                    //pageChanged(page);
                    //callback(xmlHttp.responseText);
                    if (String(page).search("basket2.asp")!=-1){
						
                        recount();
                    }
                    if (String(page).search("products.asp")!=-1){
                        document.getElementById('sort').style.display='';    
                    }
                    else if (String(page).search("advert.asp")==-1 && String(page).search("basketcount.asp")==-1) {
                        document.getElementById('sort').style.display= 'none';
                        document.getElementById('sortText').innerHTML="A-Z";
                        Esort="eur";
                    }                     
                }
              }
        xmlHttp.open("POST",page,true);
        xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        xmlHttp.send(collectformdata(formname));
        hideHover();    
        
  }
  
 /* function align(id,mode) {
    if (mode=='center') {
        document.getElementById(id).style.position='absolute';
        document.getElementById(id).style.left=((document.body.offsetWidth/2)  - (document.getElementById(id).offsetWidth/2)) + 'px';
    }
    else if(mode=='left') {
        document.getElementById(id).style.position='absolute';
        document.getElementById(id).style.left='0px';
    }
    else if(mode='right') {
        document.getElementById(id).style.position='absolute';
        document.getElementById(id).style.left=((document.body.offsetWidth  - document.getElementById(id).offsetWidth)-21) + 'px';
    }

  }*/
  
  
  //scroll script
  
            var scrollval=new Array();
            var oscrollval=new Array();
            /* Belangrijke settings
            var curItem='menu';
            var menuItems = new Array('menu','menu2');
            */
            function scrollInit() {
                var item='';
                for (x=0;x<menuItems.length;x++ ) {
                    item = menuItems[x];
                    if (item!=curItem) {
                        document.getElementById(item).style.left = document.getElementById('menucontent').offsetWidth + 20 + 'px';
                        document.getElementById(item).style.clip='rect(0px 0px 15px auto)';
                        document.getElementById(item).style.width='0px';
                    }
                }
            }
            
 
             
       
            
            
//clip functie

function clip(id,top,right,bottom,left){
    //document.getElementById(id).style.clip='rect(' + top +  right + ' px' )';
}


//pagina functies

//contact.asp

	function openmap()
	{
		window.open('map.asp','map','width=600, height=500, scrollbars=no');
	}
	
	function openview()
    {
        window.open("open360.asp","klundert360");
    }
    
    
    
//muispositie

/*		var IE = document.all?true:false
		if (!IE) document.captureEvents(Event.MOUSEMOVE)
		document.onmousemove = getMouseXY;
		var tempX = 0
		var tempY = 0
		function getMouseXY(e) {
		  if (IE) {
		    tempX = event.clientX + document.body.scrollLeft
		    tempY = event.clientY + document.body.scrollTop
		  } else {
		    tempX = e.pageX
		    tempY = e.pageY
		  }  
		  if (tempX < 0){tempX = 0}
		  if (tempY < 0){tempY = 0}  
		  return true
		}    */
		
//Search functions
        function searchmerk(merk) {
            goPage('products.asp?merk='+merk,back,merk);
            document.getElementById('sortText').innerHTML="A-Z";
            Esort="eur";
        }

        function search(text) {
            goPage('products.asp?search='+text,back, text);
            document.getElementById('sortText').innerHTML="A-Z";
            Esort="eur";
        }
        
        function searchkey(e) {
            var dkey=0;
            if (e.which==undefined) {
                dkey= e.keyCode;
            }
            else {
                dkey= e.which;
            }
            if (dkey==13) {
                search(document.getElementById('searchtext').value);
            }
        }		
		
//afbeelding weergave

		 function hide_it(ind){
		    document.getElementById("b_" + ind).style.display = "none";
		 }
		 
        var curartc='';
        var curind=0;
        var curcor=0;
        var curheight=0;
        var curwidth=0;

        function changeImg(Img) {
            var mover;
            mover=document.getElementById('b_1');
            removeImg();
            var img;
            img=document.createElement('img')
            img.id='img_1';
            img.src='products/' + Img + '.jpg';
            mover.appendChild(img);
        }

        function removeImg() {
            var mover;
            mover=document.getElementById('b_1');
            var img;
            img=document.getElementById('img_1');
            if (img!=undefined) {
                mover.removeChild(img);                
            }
        }

   		/*function show_it(ind,artc,height,width){
   		    if (Loading==false) {
              curartc=artc;
              curind=ind;
              curheight=height;
              curwidth=width;
              var plusleft=0;
              plusleft=parseInt(String(document.getElementById("container").style.left).replace('px',''));
              changeImg(artc)
		      document.getElementById("b_" + ind).style.display = "";
		      setFade("b_"+ind,90);
	          curcor=12;
    		  document.getElementById('o_' + ind).style.top=document.getElementById("main_1").offsetTop + document.getElementById("t_" + artc).offsetTop + document.getElementById("c_" + artc).offsetTop + document.getElementById("main").offsetTop + curcor - document.getElementById("main_1").scrollTop + 2 + 'px'
    		  document.getElementById('o_' + ind).style.left=document.getElementById("main_1").offsetLeft + document.getElementById("main").offsetLeft + plusleft + 21 + 'px';
    	      Viewing=true;
    	    }
            else {
                hideHover();
            }    	    
		 }

        
		function Position(ind){
			if (Viewing==true) {
			    document.getElementById("b_" + ind).style.top=(tempY) + 10 + "px";
			    document.getElementById("b_" + ind).style.left=(tempX )+ 10 + "px";
		        if (IE) {
                    if ((document.getElementById("b_" + ind).offsetHeight  +  tempY + 10) > document.documentElement.clientHeight) {
		                document.getElementById("b_" + ind).style.top=((tempY) - document.getElementById('b_' + ind).offsetHeight) + 10 + "px";
		            }

		        }
                else {
                    if ((document.getElementById("b_" + ind).offsetHeight  +  tempY + 10) > window.innerHeight) {
		                document.getElementById("b_" + ind).style.top=((tempY) - document.getElementById('b_' + ind).offsetHeight) + 10 + "px";
		            }
		        }
		        if (tempY > (document.getElementById('main').offsetTop + document.getElementById('main').offsetHeight -20)) {
		            hide_it(ind);
		        }
		        else if (tempY < document.getElementById('main').offsetTop) {
		            hide_it(ind);
		        }
		        else {
		            show_itex(ind);
		        }
            }
            else {
                hideHover();
            }
		}*/
        
        
		function show_itex(ind){
		    if (Viewing==false) {
		        document.getElementById("b_" + ind).style.display = "none";
                hideHover();
		    }
		    else {
		      //document.getElementById("img_1").src="/products/" + curartc + ".jpg";
		      document.getElementById("b_" + ind).style.display = "";
		    }
		 }
		
        
        function scrolled() {
            if (document.getElementById('o_' + curind)!= undefined) {
		      document.getElementById('o_' + curind).style.top=document.getElementById("main_1").offsetTop + document.getElementById("t_" + curartc).offsetTop + document.getElementById("c_" + curartc).offsetTop + document.getElementById("main").offsetTop + curcor - document.getElementById("main_1").scrollTop + 'px'
		    }
        }
		
		
//positioning functions
function getY( id ){
oElement=document.getElementById(id);
var iReturnValue = 0;
while( oElement != null ) {
iReturnValue += oElement.offsetLeft;
oElement = oElement.offsetParent;
}
return iReturnValue;
}

function getX(id){
oElement=document.getElementById(id);
var iReturnValue = 0;
while( oElement != null ) {
iReturnValue += oElement.offsetLeft;
oElement = oElement.offsetParent;
}
return iReturnValue;
}		


//collect form data

    function collectformdata(frm) {
        var frmData = new String();
        for (intEl=0;intEl<frm.elements.length;intEl++) {
            if (frm.elements[intEl].name!='') {
                if (frmData=='') {
                    frmData=formConvert(frm.elements[intEl].name) + '=' + formConvert(frm.elements[intEl].value);
                }
                else {
                    frmData= frmData + '&' + formConvert(frm.elements[intEl].name) + '=' + formConvert(frm.elements[intEl].value);
                }
            }
        
        }
        return frmData;
    }

    
    function formConvert(data) {
        var strNoCode=new String('*+-./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz');
        var strCheck=new String(data);
        var strOut=new String();
        var strTmp=new String();
        for (intfrm=0;intfrm<strCheck.length;intfrm++) {
            if (strNoCode.indexOf(strCheck.charAt(intfrm))==-1) {
                //niet toegestane characters
                strTmp = '';
                strTmp = strCheck.charCodeAt(intfrm).toString(16);
                if (strTmp.length ==1) {strTmp = '0' + strTmp;}
                strOut = strOut + '%' + strTmp.toUpperCase () ;
            }
            else {
                //toegestane characters
                strOut = strOut + strCheck.charAt(intfrm);
            }
        }
        return(strOut);
    }


//other functions

        function moreInfo(info) {
           
             window.open('productinfo.asp?id=' + info,'','toolbar=yes,scrollbars=yes,height=584,width=612');
                         
            //document.getElementById('extraInfo').innerHTML = unescape(info);
        }
        
        function openProductImage(image,height,width) {
            window.open(image,'km_artikelview','menubar=no,status=no,toolbar=no,location=no,height='+ (height + 40) + ',width=' + (width+40) );
        }


        function imgclicked() {
            moreInfo(curartc);
            //openProductImage('products/' + curartc + '.jpg',curheight,curwidth);
        }
        

//sort functions


        function sort(stype) {
            if (stype=='sortText') {
                var lp = new String(pagesBack(0));
                lp = lp.replace('&p=','&x=');
                if (lp.search('&sort=')==-1) {
                    //alert(lp);
                    document.location.href=lp + '&sort=' + document.getElementById(stype).innerHTML;
                }
                else {
                    goPageInPage(lp.substring(0,lp.search('&sort='))+'&sort=' + document.getElementById(stype).innerHTML,back);
                }
                if (document.getElementById('sortText').innerHTML=="Z-A") {
                    document.getElementById('sortText').innerHTML="A-Z";
                }
                else {
                    document.getElementById('sortText').innerHTML="Z-A";
                }
                Esort="eur";
            }
            else {
                var lp = new String(pagesBack(0));
                lp = lp.replace('&p=','&x=');
                if (lp.search('&sort=')==-1) {
                    //alert(lp);
                    goPageInPage(lp + '&sort=' + Esort,back);
                }
                else {
                    goPageInPage(lp.substring(0,lp.search('&sort='))+'&sort=' + Esort,back);
                }
                if (Esort=="eur") {
                    Esort="rue";
                }
                else {
                    Esort="eur";
                }            
                document.getElementById('sortText').innerHTML="A-Z";
            }        
        }
        
//ongekende paginas toch een # verwijzing geven.

        function pageChanged(page) {
            var strPage=new String(page);
            if (strPage.search('basket2.asp')==-1 && strPage.search('basketcount.asp')==-1 && strPage.search('advert.asp')==-1 && strPage.search('contact.asp')==-1 && strPage.search('faq.asp')==-1 && strPage.search('voorwaarden.asp')==-1 && strPage.search('artiesten.asp')==-1 && strPage.search('succes.asp')==-1 && strPage.search('cancel.asp')==-1 && strPage.search('error.asp')==-1 && strPage.search('links.asp')==-1) {
                recount();
                if (strPage.search('products.asp')!=-1) {
                    if (inspec==1) {
                        document.location = rootloc + '#' + document.getElementById('titlefield').innerHTML   +  '#' + page + '&spec=true';
                        document.getElementById('titlefield').innerHTML='specials';
                    }
                    else {
                        document.location = rootloc + '#' + document.getElementById('titlefield').innerHTML   +  '#' + page ;
                    }
                }
                else {
                    document.location = rootloc + '#' + document.getElementById('titlefield').innerHTML   +  '#' + page;
                }
            }
            //if (strPage.search('products.asp?spec=true')!=-1) {
            if (strPage.search('spec=true')!=-1 && strPage.search('products.asp')!=-1) {
                inspec=1;
            }
            else if( (strPage.search('products.asp')!=-1 && strPage.search('search=')==-1) || ( strPage.search('products.asp')==-1 && strPage.search('advert.asp')==-1 && strPage.search('basketcount.asp')==-1)) {
                inspec=0;
                SetSpecial(0);
            }
            var doctitle=new String(document.getElementById('titlefield').innerHTML);
            document.title='KlundertMuziek ' + doctitle.substr(0,1).toUpperCase() + doctitle.substr(1,doctitle.length - 1).toLowerCase()  ;   
        }      
        
    function SetSpecial(value) {
        var xmlHttp;
          try
            {
            xmlHttp=new XMLHttpRequest();
            }
          catch (e)
            {
            // Internet Explorer
            try
              {
              xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
              }
            catch (e)
              {
              try
                {
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                }
              catch (e)
                {
                alert("Your browser does not support AJAX!");
                return false;
                }
              }
            }
            xmlHttp.onreadystatechange=function()
              {
              if(xmlHttp.readyState==4)
                {
                }
              }
        xmlHttp.open("GET","setspecial.asp?value=" + value,true);
        xmlHttp.send(null);
        
  }
  
  
  //Javascript file

//het scroll script
var ow= new Array();
var oh= new Array();
var cw= new Array();
var ch= new Array();
var ot= new Array();
var ol= new Array();
var v=new Array();
var h=new Array();
var stim=new Array();
var hchan=0;
var vchan=0;
function initBanner(id,owidth,oheight,cwidth,cheight) {
    ow[id]=owidth;
    oh[id]=oheight;
    cw[id]=cwidth;
    ch[id]=cheight;
}

function bannerInit(width,height) {
    var id='';
    for (i=0;i<banner.length;i++) {
        id=banner[i];
        initBanner(id,bannerw[i] ,bannerh[i],width,height);
        v[id]=0;
        h[id]=0;
        ot[id] = (document.getElementById(id).offsetTop);
        ol[id] = (document.getElementById(id).offsetLeft);
        document.getElementById(id).style.position='absolute';
        document.getElementById(id).style.clip='rect(' + ((oh[id]-ch[id])/2) + 'px ' + (ow[id] - ((ow[id]-cw[id])/2)) + 'px ' + (oh[id]-(oh[id]-ch[id])/2) + 'px ' + ((ow[id]-cw[id])/2) + 'px)';
        document.getElementById(id).style.top= ot[id] - ((oh[id]-ch[id])/2) + 'px';
        document.getElementById(id).style.left= ol[id] - ((ow[id]-cw[id])/2) + 'px';
        if (id!=lastID) {
            document.getElementById(id).style.zIndex=2;
            document.getElementById(id).style.display = 'none';
        }
        else {
            document.getElementById(id).style.zIndex=3;
            document.getElementById(id).style.display = '';
        }
    }
    bannerStart(bannerChangeTime);
}

function bannerStart(timeout) {
    nextBanner();
    setTimeout("bannerStart(" + timeout + ");",timeout);
}

function nextBanner() {
    if (banner.length>1) {
        var nid=lastID;
        while (nid == lastID) {
            nid = banner[Math.round(Math.random()*(banner.length-1)) ]
        }
        changeBanner(nid);
    }
    else {
        changeBanner(lastID);
    }
    
}

function changeBanner(id){
    setFade(lastID,bannerSFade);
    setFade(id,0);
    document.getElementById(id).style.display='';
    document.getElementById(id).style.zIndex=3;
    document.getElementById(lastID).style.zIndex=2;
    h[id]=0;
    v[id]=0;
    randomSlide(id);
    BannerFadeOut(lastID,bannerTime,bannerStep);
    BannerFadeIn(id,bannerTime,bannerStep);
    lastID=id;
}

function FadeOut_Stop(id){
    document.getElementById(id).style.display='none';
}

function randomSlide(id) {
    var hor;
    var ver;
    if (Math.round(Math.random()*11) % 2) {
        hor='r';
    }
    else {
        hor='l';
    }
    if (Math.round(Math.random()*11) % 2) {
        ver='u';
    }
    else {
        ver='d';
    }
    hchang=0;
    vchang=0;
    slide(id,hor,ver);
}

function slide(id,H,V) {
    clearTimeout(stim[id]);
    if (H=='l') {
        if (hchang%2==0) {
            slideH(id,0);
        }
        else {
            slideH(id,1);
        }
    }
    else if (H=='r') {
        if (hchang%2==0) {
            slideH(id,1);
        }
        else {
            slideH(id,0);
        }    
    }
    if (V=='u') {
        if (vchang%2==0) {
            slideV(id,0);
        }
        else {
            slideV(id,1);
        }
    }
    else if (V=='d') {
        if (vchang%2==0) {
            slideV(id,1);
        }
        else {
            slideV(id,0);
        }
    }
    
    stim[id] = setTimeout("slide('" + id + "','" + H + "','" + V + "');",slideTime);
}

function slideH(id,mode) {
    document.getElementById(id).style.position='absolute';
    if (mode==0) {
        //left
        h[id]++;
        if (h[id] > ((ow[id]-cw[id])/2)) {
            h[id]--;
            hchang++;
        }
    }
    else {
        //right
        h[id]--;
        if (h[id] < -1*((ow[id]-cw[id])/2)) {
            h[id]++;
            hchang++;
        }
    }
    document.getElementById(id).style.clip='rect(' + (((oh[id]-ch[id])/2)-v[id]) + 'px ' + ((ow[id] - ((ow[id]-cw[id])/2))-h[id]) + 'px ' + ((oh[id]-(oh[id]-ch[id])/2)-v[id]) + 'px ' + (((ow[id]-cw[id])/2)-h[id]) + 'px)';
    document.getElementById(id).style.left= ol[id] - (((ow[id]-cw[id])/2) - h[id]) + 'px';
}

function slideV(id,mode) {
    document.getElementById(id).style.position='absolute';
    if (mode==0) {
        //up
        v[id]++;
        if (v[id] > ((oh[id]-ch[id])/2)) {
            v[id]--;
            vchang++;
        }
    }
    else {
        //down
        v[id]--;
        if (v[id] < -1*((oh[id]-ch[id])/2)) {
            v[id]++;
            vchang++;
        }

    }
    document.getElementById(id).style.clip='rect(' + (((oh[id]-ch[id])/2)-v[id]) + 'px ' + ((ow[id] - ((ow[id]-cw[id])/2))-h[id]) + 'px ' + ((oh[id]-(oh[id]-ch[id])/2)-v[id]) + 'px ' + (((ow[id]-cw[id])/2)-h[id]) + 'px)';
    document.getElementById(id).style.top= ot[id] - (((oh[id]-ch[id])/2)-v[id]) + 'px';
}

//het fade script
var Bcop=new Array();
var Bnop=new Array();
var Btop=new Array();
var BFOcop=new Array();
var BFOnop=new Array();
var BFOtop=new Array();
var Btim=new Array();

function BannerFadeIn(id,timeout,step) {
                Btop[id]=timeout;
                if (Bnop[id]==null) {
                               Bnop[id]=0;
                               Bcop[id]=0;
                }
                if (Bnop[id]==bannerSFade || Bnop[id]>bannerSFade) {
                               Bnop[id]=0;
                               Bcop[id]=0;
                }
                document.getElementById(id).style.display='';
                Bcop[id] = Bcop[id] + (step/100);
                Bnop[id] = Bnop[id] + step;
                document.getElementById(id).style.filter='alpha(opacity=' + Bnop[id] + ')';
                document.getElementById(id).style.mozopacity=Bcop[id];
                document.getElementById(id).style.opacity=Bcop[id];
                //if (Bnop[id] < 100) {
                if (Bnop[id] < bannerSFade) {
                    Btim[id]=setTimeout("BannerFadeIn('" + id + "'," + timeout + "," + step + ");",Btop[id]);
                }
}

function setFade(id,value) {
    document.getElementById(id).style.filter='alpha(opacity=' + value + ')';
    document.getElementById(id).style.mozopacity=value/100;
    document.getElementById(id).style.opacity=value/100;
}

function BannerFadeOut(id,timeout,step) {
                BFOtop[id]=timeout;
                if (BFOnop[id]==null) {
                               BFOnop[id]=bannerSFade;
                               BFOcop[id]=bannerSFade/100;
                               //document.getElementById(id).style.display='';
                }
                if (BFOnop[id]==0 || BFOnop[id]<0) {
                               BFOnop[id]=bannerSFade;
                               BFOcop[id]=bannerSFade/100;
                               //document.getElementById(id).style.display='';
                }
                BFOcop[id] = BFOcop[id] - (step/100);
                BFOnop[id] = BFOnop[id] - step;
                document.getElementById(id).style.filter='alpha(opacity=' + BFOnop[id] + ')';
                document.getElementById(id).style.mozopacity=BFOcop[id];
                document.getElementById(id).style.opacity=BFOcop[id];
                if (BFOnop[id] > 0) {
                   Btim[id]=setTimeout("BannerFadeOut('" + id + "'," + timeout + "," + step + ");",BFOtop[id]);
                }
		        else {
			        FadeOut_Stop(id);

		        }
}

function showlargeview(prod,nr,nr2)
{
	var xmlHttp;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
		{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e)
		{
		try
		  {
		  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		catch (e)
		  {
		  alert("Your browser does not support AJAX!");
		  return false;
		  }
		}
	  }
	  xmlHttp.onreadystatechange=function()
		{
		if(xmlHttp.readyState==4)
		  {	
		  	if ($('#imagepop').length > 0) $('#imagepop').html(xmlHttp.responseText);
		  }
		}
	url="/largeview.asp?pid="+prod+"&nr="+nr+"&nr2="+nr2;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	
	document.getElementById("blur").className='overlay';
	document.getElementById("imagepop").className='imagepop';
}


function closelargeview()
{
	document.getElementById("blur").className='';
	document.getElementById("imagepop").className='';
	document.getElementById("imagepop").innerHTML='';
}

function vorigethumb(foto)
{
	if (document.getElementById("actievefoto").value != 999)
	{
		nieuwactief=document.getElementById("actievefoto").value-1;
		if($('#nr_' + nieuwactief).length > 0)
		{
			document.getElementById("grotefoto").src = '/products/' + foto + '_' + $('#nr_' + nieuwactief).val() +'.jpg';
			document.getElementById("kader_"+nieuwactief).className="thumbkaderover";
			document.getElementById("kader_"+document.getElementById("actievefoto").value).className="thumbkader";
			document.getElementById("actievefoto").value=nieuwactief;
		}
	}
}

function volgendethumb(foto)
{
	if (document.getElementById("actievefoto").value != 999)
	{
		nieuwactief = parseInt(document.getElementById('actievefoto').value)+1;
		if($('#nr_' + nieuwactief).length > 0)
		{
			document.getElementById("grotefoto").src = '/products/' + foto + '_' + $('#nr_' + nieuwactief).val() +'.jpg';
			document.getElementById("kader_"+nieuwactief).className="thumbkaderover";
			document.getElementById("kader_"+document.getElementById("actievefoto").value).className="thumbkader";
			document.getElementById("actievefoto").value=nieuwactief;
		}
	}
}

function zetfoto(foto,nr,kd)
{
	if(nr == 999)
	{
		document.getElementById('grotefoto').src='/products/'+foto+'.jpg';
	}
	else
	{
		document.getElementById('grotefoto').src='/products/'+foto+'_'+nr+'.jpg';
		document.getElementById("kader_"+kd).className="thumbkaderover";
		document.getElementById("kader_"+document.getElementById("actievefoto").value).className="thumbkader";
		document.getElementById("actievefoto").value=kd;
	}
}

function wissen(url,txt)
{
	wissen=confirm(txt);
	if (wissen==true)
	{
		window.location=url;
	}
}

function changeblur(waarde)
{
	if(waarde==0)
	{
		document.getElementById("levadres1").disabled=true;
		document.getElementById("levadres2").disabled=true;
		document.getElementById("levinfo1").style.color="#999999";
		document.getElementById("levinfo2").style.color="#999999";
		document.getElementById("levadres3").style.color="#999999";
		document.getElementById("levadres4").style.color="#999999";
	}
	else
	{
		document.getElementById("levadres1").disabled=false;
		document.getElementById("levadres2").disabled=false;
		document.getElementById("levinfo1").style.color="#ffffff";
		document.getElementById("levinfo2").style.color="#ffffff";
		document.getElementById("levadres3").style.color="#ffffff";
		document.getElementById("levadres4").style.color="#ffffff";
	}
}


