(function( $ ){
    $.fn.ghostType = function() {

        return this.each(function() {

            var $this = $(this);
            var str = $this.text();
            $this.empty().show();
            str = str.split("");
            str.push("_");

            // increase the delay to ghostType slower
            var delay = 100;

            $.each(str, function (i, val) {
                if (val == "^") {
                    // Do nothing. This will add to the delay.
                }
                else {
                    $this.append('<span>' + val + '</span>');
                    $this.children("span").hide().fadeIn(100).delay(delay * i);

                }
            });
            $this.children("span:last").css("textDecoration", "blink");

        });

    };
})( jQuery );

(function( $ ){
    $.fn.printWords = function() {

        return this.each(function() {

            var $this = $(this);
            var str = $this.text();
            $this.empty().show();
            str = str.split(" ");
            str.push(" ");

            // increase the delay to ghostType slower
            var delay = 100;

            $.each(str, function (i, val) {
                if (val == "^") {
                    // Do nothing. This will add to the delay.
                }
                else {
                    $this.append('<span>' + val + '</span>');
                    $this.children("span").hide().fadeIn(100).delay(delay * i);

                }
            });
            $this.children("span:last").css("textDecoration", "blink");

        });

    };
})( jQuery );

var $jQ=jQuery.noConflict();
$jQ(document).ready(function($){


//	embed code voor de wereldbol is niet valid, voeg deze mbv javascript toe om validatiefouten te voorkomen
$('#wereldbol').html('<div><object width="300" height="200"> <param name="movie" value="http://fpdownload.adobe.com/strobe/FlashMediaPlayback.swf"></param><param name="flashvars" value="src=http://www.vandenban.nl/wordpress/wp-content/themes/vandenban_by_VD_Websolutions/flv/INSTORE wereldbol_04.flv&controlBarMode=none&poster=http%3A%2F%2Fosmf.org%2Fimages%2Fposter_cathy_fmp.jpg&playButtonOverlay=false&loop=true&autoPlay=true"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://fpdownload.adobe.com/strobe/FlashMediaPlayback.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="300" height="200" flashvars="src=http://www.vandenban.nl/wordpress/wp-content/themes/vandenban_by_VD_Websolutions/flv/INSTORE wereldbol_04.flv&controlBarMode=none&poster=http%3A%2F%2Fosmf.org%2Fimages%2Fposter_cathy_fmp.jpg&playButtonOverlay=false&loop=true&autoPlay=true"></embed></object></div>');

recursive2();
 
  /*var options = {
    newsList: "#ticker",
    startDelay: 10,
    placeHolder1: "",
	placeHolder2: "",
	stopOnHover:false,
	controls: false
  }
  $().newsTicker(options);*/
/*
$('.slideshow').cycle({
		fx: 'fade',
		timeout: 6000
	});

scroller_margin=$jQ('#footer-scroll').width();
scroller_duration=100000;//scroller_margin/40*1000;	//	80 pixels/second

function scrollFooter()
 {
 
	$('#footer-scroll').animate({
	//	marginLeft: -scroller_margin + "px"}, 
			left: -scroller_margin + "px"}, 
		
		scroller_duration, 
		//"linear").animate({	marginLeft: "1300px"}, 
			"linear").animate({	left: "1300px"}, 
							0, 
							"linear", 
							scrollFooter 
							);
 
/* $('#featured-brands div#scroll').animate({
 marginLeft: "-9100px"}, 130000, "linear").animate({
 marginTop: "-223px" }, 200, "linear").animate({
 marginLeft: "750px" }, 100, "linear").animate({
 marginTop: "57px" }, 1, "linear", scrollIt); */
  }
 //scrollIt(); 
 // scrollFooter();}

 );

var strArray = ["De eerste zin met meer woorden dan de 2e", "de 2e zin"];
var i = 9;
var arrayIndex = 0;
var t;
var footerLines=[' ',' '];

function recursive2() {
	arrayIndex++;
    jQuery(".box").html('');
    recursive('box');
}

function recursive(classname) {
    //arrayIndex++;
	
    if (arrayIndex>=footerLines.length){
        arrayIndex=0;   
    }
    jQuery(".box").html('');
    var str;
    str = footerLines[arrayIndex];
         jQuery("." + classname).html('');
    var spans = '<span>' + str.split(/\s+/).join(' </span><span>') + '</span>';

jQuery(spans).hide().appendTo('.'+classname).each(function(ij) {
    jQuery(this).delay(700 * ij).fadeIn(1000);
});
    //var spans = '<span>' + str.split(/\s+/).join(' </span><span>') + '</span>';
   // var i;
   // $(spans).hide().appendTo('.' + classname).each(function(i) {
  //      $(this).delay(400 * i).fadeIn(1000);
  //  });


    //$("." + classname).html(i);
    //i++;
  // alert (spans.length);
   t=setTimeout(recursive2,str.split(' ').length*700+2000);
// t=setTimeout(recursive2,2000);

}

		var evd_active_div_id = '';
	
		function evdHideContent(d) {
			if(d.length < 1) { return; }
				document.getElementById("inner-"+d).style.display = "none";
				//document.getElementById("inner-"+d).style.border = "1px solid #ffffff";
				document.getElementById("outer-"+d).style.backgroundPosition = "1px 11px";
			}
		function evdShowContent(d) {
		if(d.length < 1) { return; }
		evdHideContent(evd_active_div_id); // Hide active id.
		document.getElementById("inner-"+d).style.display = "block";
		document.getElementById("outer-"+d).style.backgroundPosition = "0px -11px";
		evd_active_div_id=d; // New active id.
		}
		function evdReverseContentDisplay(d) {
	
			if(d.length < 1) { return; }
			if(document.getElementById("inner-"+d).style.display !== "block")
			evdShowContent(d); // Code changed here!!!
			else
			evdHideContent(d); // Code changed here!!!
		} 

//	Algemeen
// JavaScript Document

var sMethod = 'show';
function setLang(method, id) {
	setItem(sMethod, id);
	sMethod = method;
}

function setItem(method, id) {
	switch(method) {
		case 'show' :
			document.getElementById(id).style.display = 'block';
		break;
		default :
			document.getElementById(id).style.display = 'none';
		break;
	}
}

var open_slide = '';
var action = true;
var history_id = '';

function slide(id)
{
	if((action == true) && (history_id != id))
	{
		action = false;
		
		if(history_id != '') {
			Effect.BlindUp(open_slide, {
				duration: 0.5,
				beforeStart: function() {
					document.getElementById('div_'+open_slide).className = 'band inactief';
				}		
			});
			delay = 0.6;
		}
		else {
			delay = 0.0;
		}
		
		Effect.BlindDown(id, {
			delay: delay, 
			duration: 0.5,
			beforeStart: function() {
				document.getElementById('div_'+id).className = 'band actief';
				open_slide = id;
				action = true;
			}		
		});
		delay = 0.6;
		
		history_id = id;
		
	}
}

var bOpen = false;
function logintab(id) {
	if(bOpen == false) {
		new Effect.Move(id, {
			x: 0,
			y: 735,
			duration: 0.5,
			mode: 'absolute',
			afterFinish: function() {
				bOpen = true;	
			}
		});
	} else {
		new Effect.Move(id, {
			x: 0,
			y: 586,
			duration: 0.5,
			mode: 'absolute',
			beforeStart: function() {
				document.getElementById('error').style.display = 'none';
			},
			afterFinish: function() {
				bOpen = false;	
			}
		});
	}
}

function resetField(pID, pValue) {
	if($jQ(pID).value == pValue) {
		$jQ(pID).value = '';
	}
}

function loadField(pID, pValue) {
	if($jQ(pID).value == '') {
		$jQ(pID).value = pValue;
	}
}

function loginForm(id) {
	new Ajax.Request(
		'includes/request.php', { 
		method: 'post', 
		postBody: Form.serialize(id),
		onSuccess: 
			function(r) { 
				//alert(r.responseText);
				sResponse = r.responseText;
				aResponse = sResponse.split('|');
				if(aResponse[0] == 'wrong') {
					document.getElementById('error').style.display = 'block';
					document.getElementById('error').innerHTML = aResponse[1];
				} else if(aResponse[0] == 'succes') {
					window.location = 'downloads.php';	
				}
			} 
	});
}

		
	
//	Verkoop 
function afb(id, actie)
{
	if (actie == 'show')
	{
			document.getElementById('kaart').src = 'http://www.vandenban.nl/wordpress/wp-content/themes/vandenban_by_VD_Websolutions/images/verkoop/'+id+'.gif';
	}
	if (actie == 'hide')
	{
			document.getElementById('kaart').src = 'http://www.vandenban.nl/wordpress/wp-content/themes/vandenban_by_VD_Websolutions/images/verkoop/europa.gif';
	}
}

var active_content = '';
function content(id, actie) {
	if (actie == 'show') {
		if(active_content == '') {
			//$jQ('default_content').hide();
			document.getElementById('default_content').style.display = "none";
			
			//$jQ(id+'_content').show();
			document.getElementById(id+'_content').style.display = "block";
			
			active_content = id;
	//		new Effect.ScrollTo('top');
		}
		else if(active_content != id) {
			//$jQ(active_content+'_content').hide();
			document.getElementById(active_content+'_content').style.display = "none";
			//$jQ(id+'_content').show();
			document.getElementById(id+'_content').style.display = "block";
			active_content = id;
	//		new Effect.ScrollTo('top');
		}
	}
}
