var screenWidth;
var curImage;
var totalImage;
var hFramePageLarge=0;
var hFramePageSmall=0;
arImages=new Array();
var curImage=0;
var bPopped=0;
var $bPopup=0;
<!--
// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;

// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0

// Main function to retrieve mouse x-y pos.s
function getMouseXY(e) {
if (IE) { // grab the x-y pos.s if browser is IE
tempX = event.clientX + document.body.scrollLeft
tempY = event.clientY + document.body.scrollTop
} else {  // grab the x-y pos.s if browser is NS
tempX = e.pageX
tempY = e.pageY

}  
// catch possible negative values in NS4
if (tempX < 0){tempX = 0}
if (tempY < 0){tempY = 0}  
// show the position values in the form named Show
// in the text fields named MouseX and MouseY
return true
}
//-->

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_showHideLayers() { //v9.0  
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function MM_setTextOfLayer(objId,x,newText) { //v9.0
  with (document) if (getElementById && ((obj=getElementById(objId))!=null))
    with (obj) innerHTML = unescape(newText);
}

function GetWidth()
{
       var x = 0;
       if (self.innerHeight)
       {
                x = self.innerWidth;
        }
        else if (document.documentElement && document.documentElement.clientHeight)
       {
                x = document.documentElement.clientWidth;
       }
       else if (document.body)
        {
                x = document.body.clientWidth;
        }
       return x;
}
 
function GetHeight()
{
        var y = 0;
        if (self.innerHeight)
        {
                y = self.innerHeight;
        }
        else if (document.documentElement && document.documentElement.clientHeight)
        {
                y = document.documentElement.clientHeight;
        }
        else if (document.body)
       {
                y = document.body.clientHeight;
        }
        return y;
}


function randomNumber(limit){
	return Math.floor(Math.random()*limit);
}

function randOrd(){
	return (Math.round(Math.random())-0.5); 
} 

function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }

function hideAll(tagName){
	var tag = document.getElementsByTagName('UL')
	for(x=0; x<tag.length; x++){
	//hide all div layers with the 'nav' attribute	
		if(tag[x].getAttribute(tagName)){
			tag[x].style.display='none';
		}
	}
}


function hideTotalOverlay(){	
	oTotalOverlay=MM_findObj('overLay');
	oTotalOverlay.style.display='none';
}

function showTotalOverlay(){	
	oContainer=MM_findObj('container');
	oTotalOverlay=MM_findObj('overLay');
	oTotalOverlay.style.height=oContainer.offsetHeight + 50 +'px';
	oTotalOverlay.style.display='block';
	screenWidth=oTotalOverlay.offsetWidth;
}


function showShopBox(numItem,transactionType,transactionCategory){
	showTotalOverlay();
	oShopBox=MM_findObj('shopBox');
	oShopBox.style.display='block';
	
	oFrame=MM_findObj("shopFrame");
	if (oFrame){
		oFrame.src="shoppingCard.php?AC="+numItem+"&type="+transactionType+"&cat="+transactionCategory;	
	}
	
	var ScrollTop = document.body.scrollTop;	
	if (ScrollTop == 0)
	{
		if (window.pageYOffset)
			ScrollTop = window.pageYOffset;
		else
			ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
	}
	oShopBox.style.top=ScrollTop +100 +'px';
	oShopBox.style.left=(screenWidth/2)-150 +'px';
}


function formCheck(typeForm){
		flagError=0;
		MM_findObj('hTypeForm').value=typeForm;
		
		if(typeForm==2){
			arForm=new Array("Voornaam","Achternaam", "Adres", "Postcode","Plaats","Email","Telefoon");
			oErrorTopBox=MM_findObj("errorBox2")
		}else{
			arForm=new Array("Username","FormPassword");
			oErrorTopBox=MM_findObj("errorBox1")
		}
			for (var i=0; i<arForm.length; i++){
				oName='s' + arForm[i];
				oItem=MM_findObj(oName);
				oName='box'+arForm[i];
				oError=MM_findObj(oName);
				oName='form'+arForm[i];
				oBlock=MM_findObj(oName);
				//alert(oName+'='+oItem.value)
				if (oItem.value==''){				
					oError.style.color='#ff0000';
					flagError=1
				}else{
					oError.style.color='#000000';
				}
				if (arForm[i]=='Email'){
					var a=oItem.value.indexOf('@')
					var p=oItem.value.indexOf('.')
					if (a==-1 || p==-1){
						oError.style.color='#ff0000';				
						flagError=1
					}else{
						oError.style.color='#000000';
					}
				}
				
				
				if (arForm[i]=='Postcode'){
					oPostCode=MM_findObj('sPostcode');				
					if (IsNumeric(oPostCode.value.substring(0,4))&& oPostCode.value.length>=4){
						oError.style.color='#000000';
					}else{
						oError.style.color='#ff0000';	
						flagError=1	
					}				
				}
			}	
			if (flagError==1){
				oErrorTopBox.style.display="block"	;
			}else{
				oErrorTopBox.style.display="none"	;	
			}
		
		
		
		arForm2=new Array();
		for (var i=0; i<arForm2.length; i++){
			oName = "b" + arForm2[i];
			oItem=MM_findObj(oName);
			flagSel=0
			for (var j=0; j<oItem.length;j++){
				if (oItem[j].checked){
					flagSel=1;			
				}
			}
			oName='formErr'+arForm2[i];;
			oError=MM_findObj(oName);
			oName='form'+arForm2[i];;
			oBlock=MM_findObj(oName);
			if (flagSel==0){
				oError.style.display='block';	
				oBlock.style.borderLeft='5px solid #ff0000';
				oBlock.style.backgroundColor='#CCCCCC'
				flagError=1
			}else{
				oError.style.display='none';
				oBlock.style.borderLeft='5px solid #eeeeee';
				oBlock.style.backgroundColor='#eeeeee'
			}
		}
			
		oItem=MM_findObj('formErrorBlock')	
		if (flagError==1){
			
		}else{
			MM_findObj("contactForm").submit();	
		}
	}
	
	
	function setAbonnement(typeAbonnement){		
		if (MM_findObj("chkAbonnement"+typeAbonnement).checked){
			MM_findObj("inputAbonnement"+typeAbonnement).value=1;
		}else{
			MM_findObj("inputAbonnement"+typeAbonnement).value=0;
		}
		calcAbonnement();
	}
	
	function changeAbonnement(typeAbonnement){
		calcAbonnement();
	}
	
	function calcAbonnement(){
		grandTotal=0;
		for (i=0;i<9;i++){
			subTotal=MM_findObj("inputAbonnement"+i).value*12*MM_findObj("chkAbonnement"+i).value/100;
			grandTotal=grandTotal+subTotal;
			if (subTotal!=0){
				MM_findObj("divAbonnement"+i).innerHTML="&euro; <strong>" + subTotal+",- </strong>";
			}else{
				MM_findObj("divAbonnement"+i).innerHTML="";		
			}
		}
		if (grandTotal!=0){
			MM_findObj("grandTotaal").innerHTML="Totaal per jaar&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&euro; " + grandTotal + ",-";
		}else{
			MM_findObj("grandTotaal").innerHTML="&nbsp;";
		}
	}
	
	function chkFormAbonnement(typeSubmit){
		if(typeSubmit=='1'){
			MM_findObj("gotoURL").value="artShopOverzicht.php";
		}else{
			MM_findObj("gotoURL").value="artShopUser.php";
		}
		MM_findObj("abonnementForm").submit();
	}
	
	
	function openWindow(SRC,ID){		
		 window.open('/?SRC='+SRC+'&ID='+ID+'','_blank', 'fullscreen=yes,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no')
	}

	
	
	function showPage(SRC,ID){
		
		wH=GetHeight();
		wW=GetWidth();
		sTop=(wH-250)-(0.15*wH);
		oHome=MM_findObj("homeDiv");
		if(oHome){
			oHome.style.display='none';	
		}
		oPage=MM_findObj("container");
		if(oPage){
			oPage.style.display='block';
			oPage.style.height=wH+'px';	
		}
		
		oPageFrame=MM_findObj("pageFrame");
		if(oPageFrame){
			oPageFrame.style.display='block';
			//oPageFrame.style.marginLeft=(wW-960)/2+'px';
			hFramePageLarge=(wH-200);
			hFramePageSmall=(sTop-200);
			
		}		
		oStroke=MM_findObj("presentatieStrook");
		if (oStroke){
			oStroke.style.marginTop=sTop+'px';;
		}

		gotoPage(SRC,ID);		

	}
	
	function mouseX(evt) {
	if (evt.pageX) return evt.pageX;
	else if (evt.clientX)
	   return evt.clientX + (document.documentElement.scrollLeft ?
	   document.documentElement.scrollLeft :
	   document.body.scrollLeft);
	else return null;
	}
	
	function mouseY(evt) {
	if (evt.pageY) return evt.pageY;
	else if (evt.clientY)
	   return evt.clientY + (document.documentElement.scrollTop ?
	   document.documentElement.scrollTop :
	   document.body.scrollTop);
	else return null;
	}
	
	function findPos(ctrl){
	var pos = {x:0,y:0}
	if (ctrl.offsetParent){
		while(ctrl.offsetParent){
		   pos.x+= ctrl.offsetLeft;
		   pos.y+= ctrl.offsetTop;
		   ctrl=ctrl.offsetParent;
		   }
	}else{
		  pos.x += ctrl.x;
		  pos.y += ctrl.y;
	  }
	  return pos;
}

function setSlider(){
	oSlider=MM_findObj("slideStrook");
	winWidth=GetWidth();	
	oSlider.style.marginLeft=(-1*(tempX/winWidth)*(oSlider.offsetWidth-winWidth)) +'px';
}


function showStroke(){
	sHideText= new Sequence();
	var a = new Object();
	a.onMotionFinished = function(){
	  	oBox=MM_findObj('blackOverlay')
		if(oBox){
			oBox.style.display='none';	
		}
	}
	sHideText.addListener(a);
	sHideText.addChild(new OpacityTween(document.getElementById('blackOverlay'),Tween.EaseOut, 100, 0, 0.5));

	sHideText.start();	
}

function hidePageOverlay(){		
	sHideOverlay= new Sequence();
	var a = new Object();
	a.onMotionFinished = function(){
	  	oBox=MM_findObj('pageOverlay')
		if(oBox){
			oBox.style.display='none';	
		}
	}
	sHideOverlay.addListener(a);
	sHideOverlay.addChild(new OpacityTween(document.getElementById('pageOverlay'),Tween.EaseOut, 100, 0, 1));
	sHideOverlay.start();	
}


function showImage(imgW,imgH,imgSrc){
	showTotalOverlay();
	scrW=GetWidth();
	scrH=GetHeight()-30;
	oImageViewer=MM_findObj("imageViewer");
	
	newImgW=scrW-200;
	newImgH=Math.round(newImgW/imgW*imgH);
	if (newImgH>(scrH-100)){
		newImgW=(scrH-100)/imgH*imgW;
	}
	
	if (oImageViewer){
		oImageViewer.style.width=newImgW+'px';
		newImgH=Math.round(newImgW/imgW*imgH);		

		oImageViewer.innerHTML="<img src='/images/cms/"+imgSrc+"' width="+newImgW+">"
		oImageViewer.style.display='block';
		oImageViewer.style.left=((scrW-newImgW)/2)+'px';
		newTop=Math.round((scrH-newImgH)/2);

		oImageViewer.style.marginTop=newTop+'px';
	}	
}

function showPopup(imgW,imgH,imgSrc){
	if(bPopped==0){
	
		bPopped=1;
		alert("a");
		showTotalOverlay();
		scrW=GetWidth();
		scrH=GetHeight()-30;
		oImageViewer=MM_findObj("popupViewer");	
		
		newImgW=400;
		newImgH=Math.round(newImgW/imgW*imgH);
		if (newImgH>(scrH-200)){
			newImgW=(scrH-200)/imgH*imgW;
		}

		if (oImageViewer){
			
			oImageViewer.style.width=newImgW+20+'px';
			newImgH=Math.round(newImgW/imgW*imgH);
			
			oImageSrc=MM_findObj("imageViewerSrcPopup")
			
			if (oImageSrc){
			oImageSrc.style.width=newImgW+'px';
			oImageSrc.innerHTML="<img src='/images/cms/400/"+imgSrc+"' width="+newImgW+"  height="+newImgH+">";
			oImageViewer.style.display='block';
			}

			oImageViewer.style.marginLeft=((scrW-newImgW)/2)+'px';
			newTop=Math.round((scrH-newImgH)/2)
			
			oImageViewer.style.marginTop=newTop+'px';
			
			oNavViewer=MM_findObj("navViewer")
			if(oNavViewer){
			oNavViewer.style.marginLeft=newImgW-60+'px';
			}
		}
	}
}

function hidePopup(){
		oImageViewer=MM_findObj("popupViewer");
		if (oImageViewer){
			oImageViewer.style.display='none';	
		}
		hideTotalOverlay();
}

function hideImage(){
		oImageViewer=MM_findObj("imageViewer");
		if (oImageViewer){
			oImageViewer.style.display='none';	
		}
		hideTotalOverlay();
}


function gotoPage(SRC,ID){

		
		oFrameStrook=MM_findObj("presentatieStrook")
		oFramePage=MM_findObj("framePage2")
		oPageFrame=MM_findObj("pageFrame")
		objScrollBar=MM_findObj('scrollContent');
		objScrollBar.style.display='none';
		
		Cufon.replace('.mainMenuLink', {color:'#999999'})
		oMenuItem="#mainMenuLink"+SRC;
		if (oMenuItem){
			Cufon.replace(oMenuItem, {color:'#ffffff'})
		}
		
		oMenu=MM_findObj('mainSubMenu'+SRC);
		if (oMenu){
			oMenu.style.display='none'	;
		}
		
		
		switch(SRC){			
			case 1:	
			case 3:	
				oFrameStrook.style.display='block';
				frameStrook.location.href="slideStrook.php?SRC="+SRC+"&ID="+ ID;
				document.getElementById('framePage2').style.height=hFramePageSmall+'px';
				oPageFrame.style.height=hFramePageSmall+'px';			
				framePage.location.href="page.php?ID="+ SRC +"&subID=" +ID;		
			break;
			
	
			
			default:
				frameStrook.location.href="slideStrook.php";
				oFrameStrook.style.display='none';
				framePage.location.href="page.php?ID="+ ID;
				document.getElementById('framePage2').style.height=hFramePageLarge+'px';
				oPageFrame.style.height=hFramePageLarge+'px';
		}

	
}


function handle(delta) {
	if (delta < 0)
		/* something. */
		contentDown()
		;
	else
		/* something. */
		contentUp();
}

function wheel(event){
	var delta = 0;
	if (!event) event = window.event;
	if (event.wheelDelta) {
		delta = event.wheelDelta/120; 
		if (window.opera) delta = -delta;
	} else if (event.detail) {
		delta = -event.detail/3;
	}
	if (delta)
		handle(delta);
        if (event.preventDefault)
        event.preventDefault();
        event.returnValue = false;
}

/* Initialization code. */
if (window.addEventListener)
	window.addEventListener('DOMMouseScroll', wheel, false);
window.onmousewheel = document.onmousewheel = wheel;


function checkScroll()
  {
	objScrollBar=MM_findObj('scrollContent');
    if(framePage.document.body.scrollHeight>hFramePageLarge){
		objScrollBar.style.display='block';
	}else{
		objScrollBar.style.display='none';
	}
  }
  
  
var mousedownIntervalID=0;
var mouseupIntervalID=0;
	
  function contentUp(){
	clearInterval(mousedownIntervalID);
	move('framePage2','up', 10);

  }
  function contentDown(){
	clearInterval(mouseupIntervalID);
	move('framePage2','down', 10);
  }
  
 function  hideTopPageSubmenu(menuItem){
  
  MM_findObj('mainSubMenu'+menuItem).style.display='none';
  }
  
  function is_child_of(parent, child) {
	if( child != null ) {			
		while( child.parentNode ) {
			if( (child = child.parentNode) == parent ) {
				return true;
			}
		}
	}
	return false;
}
function fixOnMouseOut(element, event, JavaScript_code) {
	var current_mouse_target = null;
	if( event.toElement ) {				
		current_mouse_target 			 = event.toElement;
	} else if( event.relatedTarget ) {				
		current_mouse_target 			 = event.relatedTarget;
	}
	if( !is_child_of(element, current_mouse_target) && element != current_mouse_target ) {
		eval(JavaScript_code);
	}
}


var secs
var timerID = null
var timerRunning = false
var delay = 500
var curImage=0;
var TopImage=2;
var BottomImage=1;

function InitializeTimer()
{
    // Set the length of the timer, in seconds
    secs = 10
    StopTheClock()
    StartTheTimer()
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function StartTheTimer()
{
    if (secs==0)
    {
        StopTheClock();
        // Here's where you put something useful that's
        // supposed to happen after the allotted time.
        // For example, you could display a message:
        //alert("You have just wasted 10 seconds of your life.")
		curImage=curImage+1;
		if (curImage==3){
			curImage=0;	
		}
		setImage(curImage);
		InitializeTimer();		
    }
    else
    {
        self.status = secs
        secs = secs - 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer()", delay)
    }
}

function setImage(numImage){
	if (TopImage==2){
		sImage2.start();
		sImage2.onMotionFinished= changeOrderImage(numImage);
	}else{
		sImage1.start();
		sImage1.onMotionFinished= changeOrderImage(numImage);
	}
	
	
	//oBottom.innerHTML=oTop.innerHTML;
	
}

function changeOrderImage(numImage){
	oTop=MM_findObj("imageLayer_"+TopImage);
	oBottom=MM_findObj("imageLayer_" +BottomImage);
	oTop.innerHTML="<img src='images/cms/500/"+arImages[numImage]+"'>"

	TempImage=TopImage;
	TopImage=BottomImage;
	BottomImage=TempImage;
	oTop.style.zIndex=10000;
	oBottom.style.zIndex=5000;	
}

function init(){
	sImage1=  new Sequence();
	var shImage1 = document.getElementById('imageLayer_1');
	sImage1.addChild(new OpacityTween(shImage1,Tween.regularEaseOut,20,100,2));

	sImage2=  new Sequence();
	var shImage2 = document.getElementById('imageLayer_2');
	sImage2.addChild(new OpacityTween(shImage2,Tween.regularEaseOut,20,100,2));

	bInit=true;
}

function toggleMusic(){
	toogleDHTMLSound();
	/*oToggle=MM_findObj("soundObject")
	if(oToggle.style.display!='none'){
		oToggle.stop();
	}else{
		oToggle.stop();
	}
	if(niftyplayer('niftyPlayer1').getState()=='playing'){
		niftyplayer('niftyPlayer1').stop();
		oToggle.style.backgroundPosition="0px 0px"
	}else{
		niftyplayer('niftyPlayer1').loadAndPlay('music/Honey.mp3');
		oToggle.style.backgroundPosition="0px -24px"
	}*/
}

var mp3 = "/music/Dusty.mp3";
 
function DHTMLSound() {
  document.getElementById("soundHolder").innerHTML='<embed src="'+mp3+'" hidden=true autostart=true loop=true>';
}
 
 
function toogleDHTMLSound() {
var obj = document.getElementById('soundHolder').innerHTML;
 if(obj) {
  document.getElementById("soundHolder").innerHTML='';
  //document.getElementById("toggle").src='http://www.e-classifieds.net/images/play.png';
 }
 else {
  document.getElementById("soundHolder").innerHTML='<embed src="'+mp3+'" hidden=true autostart=true loop=true></embed>';
  //document.getElementById("toggle").src='http://www.videotops3.com/ps3-video-converter/stop-play-btn.jpg';
 } 
 
}
