//GLOBAL

//var imgPath = 'http://www.apdetap.nl/elyoyo/wp-content/themes/elyoyo/';
var imgPath = 'http://www.elyoyo.nl/wp-content/themes/elyoyo/';

//alert everytime a image's loaded and once finished loading,
//add the images to 'myElement'
function preloadImages(strPage){
	//var strPage = par;
	/*
	var imgCount = 1; //keep track of image count
	//showProgress is called each time a image finished loading.
	var showProgress = function(){
	  alert(imgCount + ' image(s) loaded!');
	  imgCount++;
	};

	var img = new Array(); //initialize image array needed in finishedLoading
	//finishedLoading is called when all images are finished loading.
	var finishedLoading = function(){
	  //inject images
	  for(var item in img){
		if($type(img[item]) == 'function') break;
		img[item].injectInside('preload');
	  }
	};
	*/

	/* DEFAULT ROLLOVERS */
	var img = new Asset.images( [
		imgPath + 'images/home/home_roll.gif',
		imgPath + 'images/home/cursus_roll.gif',
		imgPath + 'images/home/agenda_roll.gif',
		imgPath + 'images/home/links_roll.gif',
		imgPath + 'images/home/contact_roll.gif',
		imgPath + 'images/home/pics_roll.gif',
		imgPath + 'images/home/newsletter_roll.gif',
		imgPath + 'images/home/login_roll.gif',
		imgPath + 'images/home/loguit_roll.gif']
	);


	if(strPage == 'home'){
		var img = new Asset.images( [
				imgPath + 'images/' + strPage + '/block.gif',
				imgPath + 'images/' + strPage + '/e_roll.gif',
				imgPath + 'images/' + strPage + '/l_roll.gif',
				imgPath + 'images/' + strPage + '/y_1_roll.gif',
				imgPath + 'images/' + strPage + '/o_1_roll.gif',
				imgPath + 'images/' + strPage + '/y_2_roll.gif',
				imgPath + 'images/' + strPage + '/o_2_roll.gif']
		);
	}
	if(strPage =='cursus'){
		var img = new Asset.images( [
				imgPath + 'images/' + strPage + '/block.gif',
				imgPath + 'images/' + strPage + '/c_roll.gif',
				imgPath + 'images/' + strPage + '/u_1_roll.gif',
				imgPath + 'images/' + strPage + '/r_roll.gif',
				imgPath + 'images/' + strPage + '/s_1_roll.gif',
				imgPath + 'images/' + strPage + '/u_2_roll.gif',
				imgPath + 'images/' + strPage + '/s_2_roll.gif']
		);
	}


}

function rollLetters(strPage, arrLetters) {
		//var strPage = par;
		//alert(arrLetters);
		//var Letters = ['e', 'l', 'y_1', 'o_1', 'y_2', 'o_2'];
		arrLetters.each(function(letter){
		   //document.write(animal)
		
			$$('img.' + letter).addEvent('mouseover', function(el, i){
				$$('img.' + letter).setProperties({
					src: imgPath + 'images/' + strPage +'/' + letter + '_roll.gif'
				});
			});
			$$('img.' + letter).addEvent('mouseout', function(el, i){
				$$('img.' + letter).setProperties({
					src: imgPath + 'images/' + strPage + '/' + letter +'.gif'
				});
			});	
		});
}

function wrapper(strPage, arrLetters){
	preloadImages(strPage);
	rollLetters(strPage, arrLetters);
}

function wp_calendar() {
	//var Tips1 = new Tips($$('.wp_cal_eventtip'));
	var Tips1 = new Tips($$('.wp_cal_eventtip'));

}


function myFunction(event){
   alert(event.client.x) //returns the coordinates of the mouse..
};

function openLinkInNewWindow() {
	$$('link-list li a').each(function(){
			this.addEvent('click', openInNewWindow);
		}
	);
}

function openInNewWindow(e) {
	var event;
	if (!e) event = window.event;
	else event = e;
	// Abort if a modifier key is pressed
	if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) {
		return true;
	}
	else {
		// Change "_blank" to something like "newWindow" to load all links in the same new window
	    var newWindow = window.open(this.getAttribute('href'), '_blank');
		if (newWindow) {
			if (newWindow.focus) {
				newWindow.focus();
			}
			return false;
		}
		return true;
	}
}


window.addEvent('domready', function() {
	wp_calendar();
	new SmoothScroll();

	var mySlide = new Slideshow('first_slideshow', {hu: 'animated/1/', images: ['1.gif','2.gif','3.gif','4.gif','5.gif'], height: 73, width: 140});
});

