var http = false;
if(navigator.appName == "Microsoft Internet Explorer") {
    http = new ActiveXObject("Microsoft.XMLHTTP");
} else {
    http = new XMLHttpRequest();
}

/* ---------------------------- */
/* Menu en Submenu		 		*/
/* ---------------------------- */
$(document).ready(function(){
	var menuids=["suckertree1"] 
	function buildsubmenus(){
	for (var i=0; i<menuids.length; i++){
	  var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
	    for (var t=0; t<ultags.length; t++){
	    ultags[t].parentNode.getElementsByTagName("a")[0].className="subfolderstyle"
	    ultags[t].parentNode.onmouseover=function(){
	    this.getElementsByTagName("ul")[0].style.display="block"
	    }
	    ultags[t].parentNode.onmouseout=function(){
	    this.getElementsByTagName("ul")[0].style.display="none"
	    }
	    }
	  }
	}
	if (window.addEventListener)
	window.addEventListener("load", buildsubmenus, false)
	else if (window.attachEvent)
	window.attachEvent("onload", buildsubmenus)
});

/* ---------------------------- */
/* Nieuwsbrief Check	 		*/
/* ---------------------------- */  
function nieuwsbriefform(nieuwsbrief_naam, nieuwsbrief_email) {
    http.abort();
    http.open("GET", "http://www.kanoshop.nl/lib/ninsert.php?naam=" + nieuwsbrief_naam + "&email=" + nieuwsbrief_email, true);
    
    http.onreadystatechange=function() {
        if(http.readyState == 4) {
            document.getElementById('nAresponse').innerHTML = http.responseText;
        }
        if(http.readyState == 1) {
            document.getElementById('nAresponse').innerHTML = '<img src="loading.gif" alt="Loading" /> Loading..';
        }
    }
    http.send(null);
} 


window.addEvent('domready', function(){
	var drop = $('cart');
	var dropFx = drop.effect('background-color', {wait: false}); // wait is needed so that to toggle the effect,
	
	$$('.item').each(function(item){
	
		item.addEvent('mousedown', function(e) {
			e = new Event(e).stop();
	
			var clone = this.clone()
				.setStyles(this.getCoordinates()) // this returns an object with left/top/bottom/right, so its perfect
				.setStyles({'opacity': 0.7, 'position': 'absolute'})
				.addEvent('emptydrop', function() {
					this.remove();
					drop.removeEvents();
				}).inject(document.body);
	
			drop.addEvents({
				'drop': function() {
					drop.removeEvents();
					clone.remove();
					item.clone().inject(drop);
					dropFx.start('7389AE').chain(dropFx.start.pass('ffffff', dropFx));
				},
				'over': function() {
					dropFx.start('98B5C1');
				},
				'leave': function() {
					dropFx.start('ffffff');
				}
			});
	
			var drag = clone.makeDraggable({
				droppables: [drop]
			}); // this returns the dragged element
	
			drag.start(e); // start the event manual
		});
	
	});
}); 


