// This file was created for http://www.ine-pps.nl by N. Braat
// All content is handwritten.
//

//-------------- ANIMATIONS START
function easeInOut(minValue,maxValue,totalSteps,actualStep) {
	var delta = maxValue - minValue;
	var stepp = minValue+(((1 / totalSteps)*actualStep)*delta);
	
	return Math.ceil(stepp)
}

function animations_size_new(element, box_or_image, width, height, stepsize, speed){
	
	if(element.size_timer) {
		clearInterval(element.size_timer);
	}
		
	element.newHeight=height;
	element.newWidth=width;
	element.stepsize=stepsize;
	element.state="busy";
	element.size_timer=setInterval(
		function() {
			
			element.currentWidth= parseInt(element.style.width); 
			element.currentHeight= parseInt(element.style.height); 
			if(box_or_image=="box") element.currentLeft= parseInt(element.style.left); 
			if(box_or_image=="box") element.currentTop= parseInt(element.style.top); 
			
			if(element.currentWidth>(element.newWidth+element.stepsize)) {
				element.style.width= element.currentWidth - (2*element.stepsize);
				if(box_or_image=="box") element.style.left= element.currentLeft+element.stepsize; 
			} 
			if(element.currentWidth<(element.newWidth-element.stepsize)) {
				element.style.width= element.currentWidth + (2*element.stepsize);
				if(box_or_image=="box") element.style.left= element.currentLeft-element.stepsize; 
			}
			if(element.currentHeight>(element.newHeight+element.stepsize)) {
				element.style.height= element.currentHeight - (2*element.stepsize);
				if(box_or_image=="box") element.style.top= element.currentTop+element.stepsize; 
			} 
			if(element.currentHeight<(element.newHeight-element.stepsize)) {
				element.style.height= element.currentHeight + (2*element.stepsize);
				if(box_or_image=="box") element.style.top= element.currentTop-element.stepsize; 
			}
			
			if((element.currentHeight<=element.newHeight+element.stepsize && element.currentHeight>=element.newHeight-element.stepsize) &&
				(element.currentWidth<=element.newWidth+element.stepsize && element.currentWidth>=element.newWidth-element.stepsize)) {
				clearInterval(element.size_timer);
				if(box_or_image=="box") {
					element.style.left = parseInt(element.style.left) - ((element.newWidth-parseInt(element.style.width)+1)/2) -1;
				//	element.style.top = parseInt(element.style.top) - ((element.newHeight-parseInt(element.style.height))/2) + 1;
				}
				element.style.height=element.newHeight+"px";
				element.style.width=element.newWidth+"px";
				element.state="done";
			}
		}
	, speed);
}

function animations_folddown_new(element, height, speed){
	if(element.size_timer) {
		clearInterval(element.size_timer);
	}
	height=height;
	element.status="busy";
	element.style.display="inline";
	element.size_timer=setInterval(
		function() {
			
			element.currentHeight= parseInt(element.style.height); 
			
			element.style.height= element.currentHeight + Math.ceil((height - element.currentHeight)/10);
			if(element.currentHeight>=height){
				clearInterval(element.size_timer);
				element.status="down";
				menu_click(menu_active, "null", "null");
			}
		}
	, speed);
}

function animations_foldup_new(element, speed){
	if(element.size_timer) {
		clearInterval(element.size_timer);
	}
	element.status="busy";
	var stepsize=0;
	element.size_timer=setInterval(
	
		function() {
			
			element.currentHeight= parseInt(element.style.height); 
			
			if(stepsize<30) stepsize++;
			
			if(element.currentHeight<=stepsize) {
				element.style.height=1;
				clearInterval(element.size_timer);
				element.style.display="none";
				element.status="up";
				menu_click(menu_active, "null",  "null");
			} else {
				element.style.height=(element.currentHeight-stepsize);
			}
		}	
	, speed);
}


function animations_text_color(element, startcolor, endcolor, steps){
	if(element.color_timer) {
		clearInterval(element.color_timer);
	}
	var actstep=0;
	element.color_timer=setInterval(
		function() {
			element.currentRGBColor=[easeInOut(startcolor[0],endcolor[0],steps,actstep),easeInOut(startcolor[1],endcolor[1],steps,actstep),easeInOut(startcolor[2],endcolor[2],steps,actstep)];
			if(element.currentRGBColor) element.style.color="rgb("+element.currentRGBColor[0]+","+element.currentRGBColor[1]+","+element.currentRGBColor[2]+")";
			actstep++;
			if (actstep > steps) clearInterval(element.color_timer);
		}
	, 30);
}

function animations_color_blink(element, startcolor, endcolor, steps){
	if(element.blink_color_timer) {
		clearInterval(element.blink_color_timer);
	}
	var actstep=0;
	var state=0;
	element.blink_color_timer=setInterval(
		function() {
			if(state==0){
				element.currentRGBColor=[easeInOut(startcolor[0],endcolor[0],steps,actstep),easeInOut(startcolor[1],endcolor[1],steps,actstep),easeInOut(startcolor[2],endcolor[2],steps,actstep)];
				element.style.background="rgb("+element.currentRGBColor[0]+","+element.currentRGBColor[1]+","+element.currentRGBColor[2]+")";
			} else {
				element.currentRGBColor=[easeInOut(endcolor[0],startcolor[0],steps,actstep),easeInOut(endcolor[1],startcolor[1],steps,actstep),easeInOut(endcolor[2],startcolor[2],steps,actstep)];
				element.style.background="rgb("+element.currentRGBColor[0]+","+element.currentRGBColor[1]+","+element.currentRGBColor[2]+")";
			}	
			actstep++;
			if (actstep > steps) {
				if(state==0) {
					state++; 
					actstep=0;
				} else {
					clearInterval(element.blink_color_timer);
				}
			}
		}
	, 20);
}

function animations_fade(element, stop, stepsize, speed){	// LET OP STEPSIZE! Moet precies uitkomen!
	if(document.getElementById(element).fade_timer) {
		clearInterval(document.getElementById(element).fade_timer);
	}
	document.getElementById(element).status="busy";
	var difference;
	document.getElementById(element).fade_timer=setInterval(
		function() {
			
			document.getElementById(element).currentfade= parseInt(document.getElementById("div_"+element).style.opacity*100); 
						
			if(document.getElementById(element).currentfade-stop>stepsize) {
				document.getElementById("div_"+element).style.opacity=((document.getElementById(element).currentfade-stepsize)/100);
				document.getElementById(element).style.filter='alpha(opacity='+((document.getElementById(element).currentfade-stepsize))+')';

			} else {
				if(stop-document.getElementById(element).currentfade>stepsize) {
					document.getElementById("div_"+element).style.opacity=((document.getElementById(element).currentfade+stepsize)/100);
					document.getElementById(element).style.filter='alpha(opacity='+((document.getElementById(element).currentfade+stepsize))+')';
				} else {
					document.getElementById("div_"+element).style.opacity=(stop/100);
					document.getElementById(element).style.filter='alpha(opacity='+stop+')';
					clearInterval(document.getElementById(element).fade_timer);
					document.getElementById(element).status="done";
				}
			}
		}	
	, speed);
}

function animations_fadeout(element, stop, stepsize, speed){	// LET OP STEPSIZE! Moet precies uitkomen!
	if(document.getElementById(element).fade_timer) {
		clearInterval(document.getElementById(element).fade_timer);
	}
	document.getElementById(element).status="busy";
	var difference;
	document.getElementById(element).fade_timer=setInterval(
		function() {
			
			document.getElementById(element).currentfade= parseInt(document.getElementById(element).style.opacity*100); 
						
			if(document.getElementById(element).currentfade-stop>stepsize) {
				document.getElementById(element).style.opacity=((document.getElementById(element).currentfade-stepsize)/100);
				document.getElementById(element).style.filter='alpha(opacity='+((document.getElementById(element).currentfade-stepsize))+')';

			} else {
				if(stop-document.getElementById(element).currentfade>stepsize) {
					document.getElementById(element).style.opacity=((document.getElementById(element).currentfade+stepsize)/100);
					document.getElementById(element).style.filter='alpha(opacity='+((document.getElementById(element).currentfade+stepsize))+')';
				} else {
					document.getElementById(element).style.opacity=(stop/100);
					document.getElementById(element).style.filter='alpha(opacity='+stop+')';
					clearInterval(document.getElementById(element).fade_timer);
					document.getElementById(element).status="up";
					menu_click(menu_active, "null", "null");
				}
			}
		}	
	, speed);
}

function animations_fadein(element, stop, stepsize, speed){	// LET OP STEPSIZE! Moet precies uitkomen!
	if(document.getElementById(element).fade_timer) {
		clearInterval(document.getElementById(element).fade_timer);
	}
	document.getElementById(element).status="busy";
	var difference;
	document.getElementById(element).fade_timer=setInterval(
		function() {
			
			document.getElementById(element).currentfade= parseInt(document.getElementById(element).style.opacity*100); 
						
			if(document.getElementById(element).currentfade-stop>stepsize) {
				document.getElementById(element).style.opacity=((document.getElementById(element).currentfade-stepsize)/100);
				document.getElementById(element).style.filter='alpha(opacity='+((document.getElementById(element).currentfade-stepsize))+')';

			} else {
				if(stop-document.getElementById(element).currentfade>stepsize) {
					document.getElementById(element).style.opacity=((document.getElementById(element).currentfade+stepsize)/100);
					document.getElementById(element).style.filter='alpha(opacity='+((document.getElementById(element).currentfade+stepsize))+')';
				} else {
					document.getElementById(element).style.opacity=(stop/100);
					document.getElementById(element).style.filter='alpha(opacity='+stop+')';
					clearInterval(document.getElementById(element).fade_timer);
					document.getElementById(element).status="down";
					menu_click(menu_active, "null", "null");
				}
			}
		}	
	, speed);
}

//-------------- ANIMATIONS END
var startup_counter=0;
var startup_timer;
var runthesite=0;
var letter=0;
var letter_download=0;
var ppsnumber=0;
var page=1; 					// new
var page_download=1;			// Page indeication used with the download button in presentations

var backgroundtimer;			// Catch the name of the backgroundtimer
var biotimer;					// Catch the name of the biography timer
var titletimer;					// Catch the name of the title movement timer
var slideShowSpeed = 4000;		// Set slideShowSpeed of biography pictures (milliseconds)
var crossFadeDuration = 3;		// Duration of crossfade of biography pictures (seconds)
var menu_active="";				// to check if the same page is clicked > no action.
var website_title_state=0;		// Titlebar animation state;
var wallpaper_page=0;			// Current page on the wallpapers

var dbase="pps";				// Select the presentations (pps) of movie (movie) database
var daylight_check_timer;
var home_timer;
var home_core_timer;
var biography_timer;
var biography_core_timer;
var wallpapers_timer;
var wallpapers_core_timer;
var presentations_timer;
var presentations_core_timer;
var software_timer;
var software_core_timer;

// Variable for slideshow function of background
var background_picture=0;
var backpreLoad = new Array();

// Variable for slideshow function of biography
var biography_picture = 0;
var preLoad = new Array();
var bio_slideshow=0;

//--------------------------------------------------------------

for (i = 0; i < back_pic.length; i++){
   backpreLoad[i] = new Image();
   backpreLoad[i].src = back_pic[i];
   backpreLoad[i].onLoad=check_onload();
}

for (i = 0; i < bio_pic.length; i++){
   preLoad[i] = new Image();
   preLoad[i].src = bio_pic[i];
}

function setup_text_new(element, fontsize, color, display, text, left, top, width, height){
	
	if(fontsize)	element.style.fontSize=fontsize;
	if(top) 		element.style.top=(top_offset+top);
	if(left) 		element.style.left=left;
	if(width) 		element.style.width=width;
	if(height) 		element.style.height=height;	
	if(color) 		element.style.color='rgb('+color[0]+','+color[1]+','+color[2]+')';
	if(display) 	element.style.display=display;
	if(text) 		element.innerHTML=text;
	
	//set it to not selectable
	element.onselectstart=new Function("return false");
}

function setup_image(element, display, src, left, top, width, height){
	
	if(top!="null") 		document.getElementById("div_"+element).style.top=(top_offset+top);
	if(left!="null") 		document.getElementById("div_"+element).style.left=left;
	if(width!="null") 		document.getElementById(element).style.width=width;
	if(height!="null") 		document.getElementById(element).style.height=height;	
	if(display!="null") 	document.getElementById("div_"+element).style.display=display;
	if(src!="null") 		document.getElementById(element).src=src;
	
	//set it to not selectable
	document.getElementById(element).onselectstart=new Function("return false");
}

function set_version(visibility){
	var enable="inline";

	if(visibility=="hidden") {
		enable="none";
	} 
	setup_text_new(document.getElementById("div_version"), 9, version_color, enable, ("v"+version), 14, 647, 40, null);
}

function background_slideshow(){
	var wallpapers_imagesize_busy=0;
	for(i=0; i<20; i++){
		if(document.getElementById("wallpapers_image_"+i).state=="busy") wallpapers_imagesize_busy=1;
	}
	
	if(document.getElementById("div_box1").status!="busy" && 
		document.getElementById("div_box2").status!="busy" &&
		document.getElementById("div_box3").status!="busy" &&
		document.getElementById("div_box4").status!="busy" &&
		wallpapers_imagesize_busy==0) {
	
		if(document.getElementById("div_background1").style.opacity!=0.0) {
			document.getElementById("background2").src=backpreLoad[background_picture].src;
			animations_fade("background1", 0, 20, 30);
			
		} else {
			document.getElementById("background1").src=backpreLoad[background_picture].src;
			animations_fade("background1", 100, 20,30);
		}
		
		background_picture = background_picture + 1;
	
		if (background_picture > (back_pic.length-1)) background_picture=0;
		
		if(back_pic.length>1) {
			backgroundtimer=setTimeout('background_slideshow()', back_slideShowSpeed);
		}
	} else {
		backgroundtimer=setTimeout('background_slideshow()', 2000); // if animation fold is active, try again in 2 secs
	}
}

function biography_slideshow(){

	document.images.bio_slideshow.src = preLoad[biography_picture].src;
	biography_picture = biography_picture + 1;
	if (biography_picture > (bio_pic.length-1)) biography_picture=0;
	if(bio_slideshow==1) {
		biotimer=setTimeout('biography_slideshow()', slideShowSpeed);
	}
}

function set_biography(visibility) {
	
	if(visibility=="none") {
		clearTimeout(biotimer);
		bio_slideshow=0;
		//animations_foldup_new(document.getElementById("div_box1"), foldupdown_speed);
		//animations_foldup_new(document.getElementById("div_box2"), foldupdown_speed);
		animations_fadeout("div_box1", 0, 10, 30);
		animations_fadeout("div_box2", 0, 10, 30);
	} else {
		set_box(visibility, document.getElementById("div_box1"), 123, 125, 275, 420);
		set_box(visibility, document.getElementById("div_box2"), 493, 125, 465, 420);
		//animations_folddown_new(document.getElementById("div_box1"), 420, foldupdown_speed);
		//animations_folddown_new(document.getElementById("div_box2"), 420, foldupdown_speed);
		animations_fadein("div_box1", box_opacity, 10, 30);
		animations_fadein("div_box2", box_opacity, 10, 30);
		bio_slideshow=1;
		biography_slideshow();
	}
}

function set_biography_core(enable){
	
	setup_image("signature", enable, signature_file, 593, 415, 295, 85);
	
	setup_image("bio_slideshow", enable, "null", 135, 162, 250, 188);
	
	setup_text_new(document.getElementById("div_download"), 20, default_onmouseout_color_rgb, enable, "Biography PPS", 150, 410, 218, null);
	
	document.getElementById("symbol_download").onclick=function () 		 {window.location.href="./ppsen/biography.zip";};	
	setup_image("symbol_download", 	enable, symbol_download, 		210, 450, 100, 84);
	
	setup_text_new(document.getElementById("div_textbox_right"), 17, default_text_color, enable, "<B>Welcome to my website!</B><BR><BR>"+ 
																"My name is Ine.<BR>"+
																"I live in the Netherlands, together with<BR>"+
																"my husband, son and Beagle named Dizzy.<BR><BR>"+
																"Making Powerpoint presentations is one<BR>"+
																"of the things I love to do, so that is why this<BR>"+
																"website was created, to be able to share<BR>"+
																"them with you.<BR><BR>"+
																"Birthday: Oktober 25th 1953<BR>"+
																"Nationality: NL (Netherlands)", 495, 155, 440, 400);
}

function software_select_item(element){

	if(element=="div_software_item_2"){
		setup_text_new(document.getElementById("div_textbox_right"), 17, default_text_color, "inline", "<B>NAME</b><BR><BR>"+
																		"Just Zip-it<BR><BR><BR>"+ 
																		"<B>DESCRIPTION</b><BR><BR>"+
																		"Just Zip-it is a freeware program<BR>"+
																		"to unzip files, like the presentations<BR>"+
																		"that can be downloaded from this website.<BR><BR>"+
																		"Click the download button below if you<BR>"+
																		"experience problems with unzipping the presentations.", 495, 155, 440, 400);
		//setup_text_new(document.getElementById("div_download"), 20, default_onmouseout_color_rgb, "inline", "DOWNLOAD", 503, 465, 440, null);
		
		document.getElementById("symbol_download").onclick=function () 		 {window.location.href="./software/justzipit.exe";};	
		setup_image("symbol_download", 	"inline", symbol_download, 		670, 450, 100, 84);
		
		//document.getElementById("div_download").onclick=function () {window.location.href="./software/justzipit.exe";};
		//document.getElementById("div_download").onmouseout=function () {default_onmouseout(this);};
		//document.getElementById("div_download").onmouseover=function () {default_onmouseover(this);};
	}
	
	if(element=="div_software_item_3"){
		setup_text_new(document.getElementById("div_textbox_right"), 17, default_text_color, "inline", "<B>NAME</b><BR><BR>"+
																		"Powerpoint 2003 viewer<BR><BR><BR>"+ 
																		"<B>DESCRIPTION</b><BR><BR>"+
																		"The Powerpoint 2003 viewer allows you to<BR>"+
																		"view the presentations that can be<BR>"+
																		"downloaded from this website.<BR><BR>"+
																		"Click the download button below to get the<BR>"+
																		"Powerpoint 2003 viewer if you experience<BR>"+
																		"problems with viewing the presentations", 495, 155, 440, 400);
		//setup_text_new(document.getElementById("div_download"), 20, default_onmouseout_color_rgb, "inline", "DOWNLOAD", 503, 465, 440, null);
		//document.getElementById("div_download").onclick=function () {window.open("./software/ppviewer.exe", "_blank", "location=no,status=no,menubar=no,directories=no,toolbar=no,resizable=yes,scrollbars=no");};
		//document.getElementById("div_download").onclick=function () {window.location.href="./software/ppviewer.exe";};
		//document.getElementById("div_download").onmouseout=function () {default_onmouseout(this);};
		//document.getElementById("div_download").onmouseover=function () {default_onmouseover(this);};
		document.getElementById("symbol_download").onclick=function () 		 {window.location.href="./software/ppviewer.exe";};	
		setup_image("symbol_download", 	"inline", symbol_download, 		670, 450, 100, 84);
	}
}

function set_software(visibility){
	if(visibility=="none") {
		//animations_foldup_new(document.getElementById("div_box1"), foldupdown_speed);
		//animations_foldup_new(document.getElementById("div_box2"), foldupdown_speed);
		animations_fadeout("div_box1", 0, 10, 30);
		animations_fadeout("div_box2", 0, 10, 30);
	} else {
		set_box(visibility, document.getElementById("div_box1"), 123, 125, 275, 420);
		set_box(visibility, document.getElementById("div_box2"), 485, 125, 465, 420);
		//animations_folddown_new(document.getElementById("div_box1"), 420, foldupdown_speed);
		//animations_folddown_new(document.getElementById("div_box2"), 420, foldupdown_speed);
		animations_fadein("div_box1", box_opacity, 10, 30);
		animations_fadein("div_box2", box_opacity, 10, 30);
	}
}

function set_software_core(enable){
	setup_text_new(document.getElementById("div_software_top"), 18, default_onmouseout_color_rgb, enable, "<b>Software list</b>", 151, 155, 218, null);
	setup_text_new(document.getElementById("div_software_item_2"), 17, default_onmouseout_color_rgb, enable, "Just Zip-it", 151, 245, 218, null);
	setup_text_new(document.getElementById("div_software_item_3"), 17, default_onmouseout_color_rgb, enable, "Powerpoint 2003 viewer", 151, 275, 218, null);
	
	var element = document.getElementById("div_software_item_2");
	element.onclick=function () {software_select_item(this.id);};
	element.onmouseout=function () {default_onmouseout(this);};
	element.onmouseover=function () {default_onmouseover(this);};
	
	element = document.getElementById("div_software_item_3");
	element.onclick=function () {software_select_item(this.id);};
	element.onmouseout=function () {default_onmouseout(this);};
	element.onmouseover=function () {default_onmouseover(this);};
	
	setup_text_new(document.getElementById("div_download"), null, null, "none", " ", null, null, null, null);
	
	setup_text_new(document.getElementById("div_textbox_right"), 17, default_text_color, enable, "This is the software section<BR><BR>"+ 
																"At the left, an item can be clicked,<BR>"+
																"to view the description and to<BR>"+
																"download it.<BR><BR>"+
																"Please download the listed software when<BR>"+
																"experiencing problems with this website<BR>"+
																"or with viewing the presentations.", 495, 155, 440, 400);
	if(enable="none") {
		setup_image("symbol_download", 	"none", symbol_download, 		210, 450, 100, 84);
	}
}

function set_wallpapers(visibility){
	if(visibility=="none") {
		wallpaper_page=0;
		//animations_foldup_new(document.getElementById("div_box1"), foldupdown_speed);
		//animations_foldup_new(document.getElementById("div_box2"), foldupdown_speed);
		animations_fadeout("div_box1", 0, 10, 30);
		animations_fadeout("div_box2", 0, 10, 30);
	} else {
		set_box(visibility, document.getElementById("div_box1"), 143, 555, 785, 20);	// page box
		set_box(visibility, document.getElementById("div_box2"), 143, 85, 785, 460); 	//image box
		//animations_folddown_new(document.getElementById("div_box1"), 20, foldupdown_speed);
		//animations_folddown_new(document.getElementById("div_box2"), 460, foldupdown_speed);
		animations_fadein("div_box1", box_opacity, 10, 30);
		animations_fadein("div_box2", box_opacity, 10, 30);
	}
}

function set_wallpapers_core(enable){
	//Set page to page none
	wallpaper_page=0;
	
	document.getElementById("div_wallpapers_images").style.display="none";
	
	for(h=0; h<20; h++){
		clearInterval(document.getElementById("wallpapers_image_"+h).size_timer);
		document.getElementById("wallpapers_image_"+h).onclick=  function () {view_picture(this.id);};
		document.getElementById("wallpapers_image_"+h).onmouseout= function () {animations_size_new(this, "image", 128, 96, 1, 10);};	
		document.getElementById("wallpapers_image_"+h).onmouseover= function () {animations_size_new(this, "image", (128+wallpaper_enlarge), (96+wallpaper_enlarge), 1, 10);};
				
	}

	setup_text_new(document.getElementById("div_wallpapers_page_forward"), 15, default_onmouseout_color_rgb, enable, "<B>NEXT ></b>", 730, 564, null, null);
	setup_text_new(document.getElementById("div_wallpapers_page_backward"), 15, default_onmouseout_color_rgb, enable, "<B>< BACK</b>", 195, 564, null, null);
	setup_text_new(document.getElementById("div_wallpapers_page_current"), 15, default_onmouseout_color_rgb, enable, wallpaper_page+"/"+wallpaper_pages, 465, 564, null, null);
	
	document.getElementById("div_wallpapers_page_forward").onclick= function () {wallpapers_right_panel(this.id);};
	document.getElementById("div_wallpapers_page_backward").onclick= function () {wallpapers_right_panel(this.id);};
	
	document.getElementById("div_wallpapers_page_forward").onmouseover= function () {default_onmouseover(this);};
	document.getElementById("div_wallpapers_page_forward").onmouseout= function () {default_onmouseout(this);};
	document.getElementById("div_wallpapers_page_backward").onmouseover= function () {default_onmouseover(this);};
	document.getElementById("div_wallpapers_page_backward").onmouseout= function () {default_onmouseout(this);};
	
	setup_text_new(document.getElementById("div_textbox_right"), 17, default_text_color, enable, "This is the pictures section. <BR><BR>"+ 
																"The buttons 'BACK' and 'NEXT' navigate through the available picture pages. <BR><BR>"+
																"A thumbnail of a picture can be clicked to view it full scale.<BR>"+
																"It can be downloaded by clicking with the right mouse button on the picture,<BR>"+
																"followed by choosing 'save picture as'.", 243, 189, 600, 400);
	if(enable=="none") {
		document.getElementById("div_wallpapers_images").style.display="none";
	}
}
	
function set_overlay_picture(inumber) { 
	var decoded=0;
	decoded=parseInt(inumber.substring(17));
}

function view_picture(inumber) { 
		// Extract the number from the ID that is given in number
		var decoded=0;
		decoded=parseInt(inumber.substring(17));
		// END Extraction
		var OpenWindow=window.open("", "_blank", "height=1600, width=2560, location=no, status=no, menubar=no, directories=no, toolbar=no, resizable=yes, scrollbars=yes"); 
		OpenWindow.document.write("<META HTTP-EQUIV='imagetoolbar' CONTENT='yes'>")
		OpenWindow.document.write("<HTML><HEAD>");
		OpenWindow.document.write("<title>Ine's Media Page - Wallpaper full size view</title>");
		OpenWindow.document.write("</HEAD><BODY>");
		OpenWindow.document.write("<body bgcolor='black'>");
		OpenWindow.document.write("<font color='#FFFFFF'>");
		OpenWindow.document.write("<font face='Arial'>");
		OpenWindow.document.write("<font size='2px'>");
		OpenWindow.document.write("<center><b>Click the picture to close this window</b></center>");
		OpenWindow.document.write("<BR>");
		OpenWindow.document.write("<center><div id='div_full_size_image'><img GALLERYIMG='true' id='full_size_image' onclick='self.close();' src='"+wallpapers_full_address+(wallpaper_page)+"-"+(decoded+1)+".jpg' onerror='set_gif();' style='border: 1px solid #FFFFFF;'></img></div></center>");
		OpenWindow.document.write("<script TYPE='text/javaScript'>");
		OpenWindow.document.write("function set_gif() {");
		OpenWindow.document.write("document.getElementById('full_size_image').src='"+wallpapers_full_address+(wallpaper_page)+"-"+(decoded+1)+".gif';");
		OpenWindow.document.write("}");
		OpenWindow.document.write("</script>");
		OpenWindow.document.write("</BODY></HTML>");
		OpenWindow.document.close();
	} 

function download_item(title, file) {
	if(menu_active=="presentations") {
		//window.open(file, "_blank", "location=no,status=no,menubar=no,directories=no,toolbar=no,resizable=yes,scrollbars=no");	
		window.location.href=file;
	} else {	//movies
		// If IE do other download window because that crappy browser plays the file by default.
		// The other sane browsers should not have to suffer from IE workarouns. :@
		
		if (navigator.appVersion.indexOf("MSIE") != -1) {	// IE detected
			download_movie(title, file);
		} else {
			window.location.href=file;
		}
		
	}
}

function download_movie(title, file) { 
		var OpenWindow=window.open("", "_blank", "height=300, width=600, location=no, status=no, menubar=no, directories=no, toolbar=no, resizable=yes, scrollbars=yes"); 
		OpenWindow.document.write("<META HTTP-EQUIV='imagetoolbar' CONTENT='yes'>")
		OpenWindow.document.write("<HTML><HEAD>");
		OpenWindow.document.write("<title>Ine's Media Page - Movie Download</title>");
		OpenWindow.document.write("</HEAD><BODY>");
		OpenWindow.document.write("<body bgcolor='#000000' vlink='#FFFFFF' alink='#FFFFFF' link='#FFFFFF'>");
		OpenWindow.document.write('<SCRIPT TYPE="text/javaScript">');
		OpenWindow.document.write('document.body.style.backgroundColor="rgb(0,0,0)";');
		OpenWindow.document.write("</script>");
		OpenWindow.document.write("<font color='#FFFFFF'>");
		OpenWindow.document.write("<font face='Arial'>");
		OpenWindow.document.write("<font size='5px'>");
		OpenWindow.document.write("<BR>");
		OpenWindow.document.write('<center><b>DOWNLOAD</b></center>');		
		OpenWindow.document.write("<BR>");
		OpenWindow.document.write("<font size='2px'>");
		OpenWindow.document.write('<center><b>Click the link to open file or</b></center>');	
		OpenWindow.document.write('<center><b>right click > "Save target as" < for download.</b></center>');
		OpenWindow.document.write("<BR>");
		OpenWindow.document.write("<BR>");
		OpenWindow.document.write("<font size='6px'>");
		OpenWindow.document.write("<center><a href=http://www.ine-pps.nl/"+file+">"+title+"</A></center>");
		OpenWindow.document.write("</BODY></HTML>");
		OpenWindow.document.close();
} 

function open_guestbook(){
	window.open("./source/guestbook.php","_blank","height=700, width=600, location=no, status=no, menubar=no, directories=no, toolbar=no, resizable=yes, scrollbars=yes");
}	
	
function wallpapers_right_panel(event){
	document.getElementById("div_wallpapers_images").style.display="inline";
	
	if(event=="div_wallpapers_page_forward") {
		if(wallpaper_page<wallpaper_pages) {
			wallpaper_page++;
		} else {
			wallpaper_page=1;
		}
	}
	if(event=="div_wallpapers_page_backward") {
		if(wallpaper_page>1) {
			wallpaper_page--;
		} else {
			wallpaper_page=wallpaper_pages;
		}
	}
	document.getElementById("div_wallpapers_page_current").innerHTML=wallpaper_page+"/"+wallpaper_pages;
	setup_text_new(document.getElementById("div_textbox_right"), null, null, "none", " ", null, null, null, null);
	for(i=0; i<20; i++)	{
		document.getElementById("wallpapers_image_"+i).style.display = "inline";
		document.getElementById("div_wallpapers_images").style.display = "inline";
		document.getElementById("wallpapers_image_"+i).src=wallpaper_thumbs+"wall"+(wallpaper_page)+"-"+(i+1)+".jpg";
	}	
}

function set_presentations(visibility) {
	if(visibility=="none") {
		wallpaper_page=0;
		//animations_foldup_new(document.getElementById("div_box1"), foldupdown_speed);
		//animations_foldup_new(document.getElementById("div_box2"), foldupdown_speed);
		animations_fadeout("div_box1", 0, 10, 30);
		animations_fadeout("div_box2", 0, 10, 30);
	} else {
		set_box(visibility, document.getElementById("div_box1"), 133, 597, 825, 25);		// page box
		set_box(visibility, document.getElementById("div_box2"), 133, 85, 825, 502); 	//image box
		//animations_folddown_new(document.getElementById("div_box1"), 25, foldupdown_speed);
		//animations_folddown_new(document.getElementById("div_box2"), 502, foldupdown_speed);
		animations_fadein("div_box1", box_opacity, 10, 30);
		animations_fadein("div_box2", box_opacity, 10, 30);
	}
}

function applyFilter(){
	sortList("null", document.getElementById("dbase_Textbox").value, defaultTextColor, overTextColor);
}

function handleEnter(inField, e) {
    var charCode;
    
    if(e && e.which){
        charCode = e.which;
    }else if(window.event){
        e = window.event;
        charCode = e.keyCode;
    }

    if(charCode == 13) {
        //alert("Enter was pressed on " + inField.id);
		applyFilter();
    }
}

function set_presentations_core(mode, enable, filter, sort){
	reset_scrollbar("div_main_table");
	if(enable=="inline") {
		if(mode=="movie") {	
			setPaths("movie");
			internalArray=internalArrayMovie;
		} else {
			setPaths("pps");
			internalArray=internalArrayPps;		
		}
	}
	setup_page(internalArray, defaultTextColor, overTextColor, overTextPointer, imageWidthSmall, imageWidthMedium, enable);
	if(enable=="inline") {
		sortList(sort, filter, defaultTextColor, overTextColor);
	} else {
		clearTable("main_table");
	}
	document.getElementById("dbase_Textbox").style.left=138;
	document.getElementById("dbase_Textbox").style.top=600;
	document.getElementById("dbase_Textbox").style.width=248;
	document.getElementById("dbase_Textbox").style.height=20;
	document.getElementById("dbase_Textbox").style.fontsize=14;
	document.getElementById("dbase_Textbox").style.color=searchtext_begincolor;

	document.getElementById("div_filter_message").style.left=463;
	document.getElementById("div_filter_message").style.top=603;
	document.getElementById("div_filter_message").style.width=250;
	document.getElementById("div_filter_message").style.height=20;
	document.getElementById("div_filter_message").style.fontsize=12;
	document.getElementById("div_filter_message").style.fontweight="bold";

	document.getElementById("div_list_items").style.left=813;
	document.getElementById("div_list_items").style.top=603;
	document.getElementById("div_list_items").style.width=110;
	document.getElementById("div_list_items").style.height=20;
	document.getElementById("div_list_items").style.fontsize=12;
	document.getElementById("div_list_items").style.fontweight="bold";
	
	document.getElementById("buttonFilterApply").style.left=390;
	document.getElementById("buttonFilterApply").style.top=599;	
	
	document.getElementById("dbase_Textbox").style.display=enable;
	document.getElementById("buttonFilterApply").style.display=enable;
	document.getElementById("div_filter_message").style.display=enable;
	document.getElementById("div_filter_message").innerHTML=default_message_text;
	document.getElementById("div_list_items").style.display=enable;
	if(filter==""){
		document.getElementById("dbase_Textbox").value=default_textbox_text;
	}
}

var global_sort = "null";
	
function menu_click(menu_new, title, filter, sort) {

	if(sort) global_sort=sort;

	if(filter!="null") {
		document.getElementById("dbase_Textbox").value=filter;
	}
	if(menu_active!=menu_new) {
		switch(menu_active){
			case "home" :			set_home_core("none");
									set_home("none");
									break;		
			case "bio" :			set_biography_core("none");
									set_biography("none");
									break;
			case "email" :			break;
			case "guestbook" :		break;
			case "presentations" :	set_presentations_core("presentations","none", "null", "null");
									set_presentations("none");
									break;
			case "software" :		set_software_core("none");
									set_software("none");
									break;
			case "wallpapers" :		set_wallpapers_core("none");
									set_wallpapers("none");
									break;
			case "movie" :			set_presentations_core("movie","none", "null", "null");
									set_presentations("none");
									break;
			default : 				break;
		}
	}
		switch(menu_new) {
			case "home" :			if(document.getElementById("div_box1").status=="up" && 
										document.getElementById("div_box2").status=="up" &&
										document.getElementById("div_box3").status=="up" &&
										document.getElementById("div_box4").status=="up") {
										setTimeout('set_home("inline");', 200);
									}
									if(document.getElementById("div_box1").status=="down" && 
										document.getElementById("div_box2").status=="down" &&
										document.getElementById("div_box3").status=="up" &&
										document.getElementById("div_box4").status=="up") {
										set_home_core("inline");
									}
									break;		
			case "bio" :			if(document.getElementById("div_box1").status=="up" && 
										document.getElementById("div_box2").status=="up" &&
										document.getElementById("div_box3").status=="up" &&
										document.getElementById("div_box4").status=="up") {
										setTimeout('set_biography("inline");',200);
									}
									if(document.getElementById("div_box1").status=="down" && 
										document.getElementById("div_box2").status=="down" &&
										document.getElementById("div_box3").status=="up" &&
										document.getElementById("div_box4").status=="up") {
										set_biography_core("inline");
									}
									break;
			case "email" :			
									break;
			case "guestbook" :	
									break;
			case "presentations" :	if(document.getElementById("div_box1").status=="up" && 
										document.getElementById("div_box2").status=="up" &&
										document.getElementById("div_box3").status=="up" &&
										document.getElementById("div_box4").status=="up") {
										setTimeout('set_presentations("inline");',200);
									}
									if(document.getElementById("div_box1").status=="down" && 
										document.getElementById("div_box2").status=="down" &&
										document.getElementById("div_box3").status=="up" &&
										document.getElementById("div_box4").status=="up") {
										set_presentations_core("presentations","inline", document.getElementById("dbase_Textbox").value, global_sort);
									}
									break;
			case "software" :		if(document.getElementById("div_box1").status=="up" && 
										document.getElementById("div_box2").status=="up" &&
										document.getElementById("div_box3").status=="up" &&
										document.getElementById("div_box4").status=="up") {
										setTimeout('set_software("inline");',200);
									}
									if(document.getElementById("div_box1").status=="down" && 
										document.getElementById("div_box2").status=="down" &&
										document.getElementById("div_box3").status=="up" &&
										document.getElementById("div_box4").status=="up") {
										set_software_core("inline");
									}
									break;
			case "wallpapers" :		if(document.getElementById("div_box1").status=="up" && 
										document.getElementById("div_box2").status=="up" &&
										document.getElementById("div_box3").status=="up" &&
										document.getElementById("div_box4").status=="up") {
										setTimeout('set_wallpapers("inline");',200);
									}
									if(document.getElementById("div_box1").status=="down" && 
										document.getElementById("div_box2").status=="down" &&
										document.getElementById("div_box3").status=="up" &&
										document.getElementById("div_box4").status=="up") {
										set_wallpapers_core("inline");
									}
									break;
			case "movie" :			if(document.getElementById("div_box1").status=="up" && 
										document.getElementById("div_box2").status=="up" &&
										document.getElementById("div_box3").status=="up" &&
										document.getElementById("div_box4").status=="up") {
										setTimeout('set_presentations("inline");',200);
									}
									if(document.getElementById("div_box1").status=="down" && 
										document.getElementById("div_box2").status=="down" &&
										document.getElementById("div_box3").status=="up" &&
										document.getElementById("div_box4").status=="up") {
										set_presentations_core("movie","inline", document.getElementById("dbase_Textbox").value, global_sort);
									}
									break;
			default : 				break;
		}
		menu_active=menu_new;
}

function default_onmouseover(element){
	document.body.style.cursor='default'; 
	animations_text_color(element, default_onmouseout_color_rgb, default_onmouseover_color_rgb, color_change_steps);
}
function default_onmouseout(element){
	animations_text_color(element, default_onmouseover_color_rgb, default_onmouseout_color_rgb, color_change_steps);
}

function set_menu(visibility){
	var enable="inline";
	if(visibility=="hidden") {
		enable="none";
	} 

	// init symbols
	//function setup_image(element, display, src, left, top, width, height){
	document.getElementById("symbol_home").src_unsel=		menu_symbol_home;
	document.getElementById("symbol_home").src_sel=			menu_symbol_home_s;
	document.getElementById("symbol_movies").src_unsel=		menu_symbol_movies;
	document.getElementById("symbol_movies").src_sel=		menu_symbol_movies_s;
	document.getElementById("symbol_pps").src_unsel=		menu_symbol_pps;
	document.getElementById("symbol_pps").src_sel=			menu_symbol_pps_s;
	document.getElementById("symbol_images").src_unsel=		menu_symbol_images;
	document.getElementById("symbol_images").src_sel=		menu_symbol_images_s;
	document.getElementById("symbol_gbook").src_unsel=		menu_symbol_gbook;
	document.getElementById("symbol_gbook").src_sel=		menu_symbol_gbook_s;
	document.getElementById("symbol_bio").src_unsel=		menu_symbol_bio;
	document.getElementById("symbol_bio").src_sel=			menu_symbol_bio_s;
	document.getElementById("symbol_email").src_unsel=		menu_symbol_email;
	document.getElementById("symbol_email").src_sel=		menu_symbol_email_s;
	document.getElementById("symbol_prog").src_unsel=		menu_symbol_prog;
	document.getElementById("symbol_prog").src_sel=			menu_symbol_prog_s;
	document.getElementById("symbol_facebook").src_unsel=	menu_symbol_facebook;
	document.getElementById("symbol_facebook").src_sel=		menu_symbol_facebook_s;
	document.getElementById("symbol_youtube").src_unsel=	menu_symbol_youtube;
	document.getElementById("symbol_youtube").src_sel=		menu_symbol_youtube_s;
	
	setup_image("symbol_home", 		"inline", menu_symbol_home, 		10, 7, 60, 50);
	setup_image("symbol_movies", 	"inline", menu_symbol_movies, 		170, 7, 60, 50);
	setup_image("symbol_pps", 		"inline", menu_symbol_pps, 			230, 7, 60, 50);
	setup_image("symbol_images", 	"inline", menu_symbol_images, 		290, 7, 60, 50);
	setup_image("symbol_gbook", 	"inline", menu_symbol_gbook, 		495, 7, 60, 50);
	setup_image("symbol_bio", 		"inline", menu_symbol_bio, 			555, 7, 60, 50);
	setup_image("symbol_email", 	"inline", menu_symbol_email, 		615, 7, 60, 50);
	setup_image("symbol_prog", 		"inline", menu_symbol_prog, 		675, 7, 60, 50);
	setup_image("symbol_facebook", 	"inline", menu_symbol_facebook, 	835, 7, 60, 50);
	setup_image("symbol_youtube", 	"inline", menu_symbol_youtube, 		895, 7, 60, 50);
	
	document.getElementById("div_symbol_home").onclick=function () 		{menu_click("home", "HOME", "", "null");};
	document.getElementById("div_symbol_bio").onclick=function () 			{menu_click("bio", "BIOGRAPHY", "", "null");};
	document.getElementById("div_symbol_email").onclick=function () 		{window.open("mailto:ine.pps.ontwerp@gmail.com?subject=Website Email&nbsp;from&nbsp;Website","_blank","null");};
	document.getElementById("div_symbol_gbook").onclick=function () 		{open_guestbook();};
	document.getElementById("div_symbol_pps").onclick=function () 			{menu_click("presentations", "PRESENTATIONS", "", "name");};
	document.getElementById("div_symbol_prog").onclick=function () 		{menu_click("software", "SOFTWARE", "", "null");};
	document.getElementById("div_symbol_images").onclick=function () 		{menu_click("wallpapers", "PICTURES", "", "null");};
	document.getElementById("div_symbol_movies").onclick=function () 		{menu_click("movie", "MOVIES", "", "name");};
	document.getElementById("div_symbol_facebook").onclick=function () 	{window.open("http://www.facebook.com/ine.braat", "_blank");};
	document.getElementById("div_symbol_youtube").onclick=function () 		{window.open("http://www.youtube.com/inousch", "_blank");};
	
	document.getElementById("symbol_home").onmouseout=function ()       {document.getElementById("symbol_home").src=document.getElementById("symbol_home").src_unsel;};
	document.getElementById("symbol_bio").onmouseout=function ()        {document.getElementById("symbol_bio").src=document.getElementById("symbol_bio").src_unsel;};
	document.getElementById("symbol_email").onmouseout=function ()      {document.getElementById("symbol_email").src=document.getElementById("symbol_email").src_unsel;};
	document.getElementById("symbol_gbook").onmouseout=function ()      {document.getElementById("symbol_gbook").src=document.getElementById("symbol_gbook").src_unsel;};
	document.getElementById("symbol_pps").onmouseout=function ()  		 {document.getElementById("symbol_pps").src=document.getElementById("symbol_pps").src_unsel;};
	document.getElementById("symbol_prog").onmouseout=function ()       {document.getElementById("symbol_prog").src=document.getElementById("symbol_prog").src_unsel;};
	document.getElementById("symbol_images").onmouseout=function ()     {document.getElementById("symbol_images").src=document.getElementById("symbol_images").src_unsel;};
	document.getElementById("symbol_movies").onmouseout=function ()  	 {document.getElementById("symbol_movies").src=document.getElementById("symbol_movies").src_unsel;};
	document.getElementById("symbol_facebook").onmouseout=function ()   {document.getElementById("symbol_facebook").src=document.getElementById("symbol_facebook").src_unsel;};
	document.getElementById("symbol_youtube").onmouseout=function ()  	 {document.getElementById("symbol_youtube").src=document.getElementById("symbol_youtube").src_unsel;};
	
	document.getElementById("symbol_home").onmouseover=function ()      {document.getElementById("symbol_home").src=document.getElementById("symbol_home").src_sel;};
	document.getElementById("symbol_bio").onmouseover=function ()       {document.getElementById("symbol_bio").src=document.getElementById("symbol_bio").src_sel;};
	document.getElementById("symbol_email").onmouseover=function ()     {document.getElementById("symbol_email").src=document.getElementById("symbol_email").src_sel;};
	document.getElementById("symbol_gbook").onmouseover=function ()     {document.getElementById("symbol_gbook").src=document.getElementById("symbol_gbook").src_sel;};
	document.getElementById("symbol_pps").onmouseover=function () 		 {document.getElementById("symbol_pps").src=document.getElementById("symbol_pps").src_sel;};
	document.getElementById("symbol_prog").onmouseover=function ()      {document.getElementById("symbol_prog").src=document.getElementById("symbol_prog").src_sel;};
	document.getElementById("symbol_images").onmouseover=function ()    {document.getElementById("symbol_images").src=document.getElementById("symbol_images").src_sel;};
	document.getElementById("symbol_movies").onmouseover=function ()    {document.getElementById("symbol_movies").src=document.getElementById("symbol_movies").src_sel;};
	document.getElementById("symbol_facebook").onmouseover=function ()    {document.getElementById("symbol_facebook").src=document.getElementById("symbol_facebook").src_sel;};
	document.getElementById("symbol_youtube").onmouseover=function ()    {document.getElementById("symbol_youtube").src=document.getElementById("symbol_youtube").src_sel;};

	document.getElementById("symbol_download").src_unsel=		symbol_download;
	document.getElementById("symbol_download").src_sel=			symbol_download_s;
	
	document.getElementById("symbol_download").onmouseout=function ()  	 {document.getElementById("symbol_download").src=document.getElementById("symbol_download").src_unsel;};
	document.getElementById("symbol_download").onmouseover=function ()      {document.getElementById("symbol_download").src=document.getElementById("symbol_download").src_sel;};
}

function set_title(){
	//setup_text_new(document.getElementById("div_title"), 16, title_color, null, null, 123, 40, null, null);
}

function set_background(){
	setup_image("background1", "inline", "null", 0, 56, 998, 612);	
	setup_image("background2", "inline", "null", 0, 56, 998, 612);	
	document.getElementById("div_background1").style.zIndex=2;
	document.getElementById("div_background2").style.zIndex=1;
	document.getElementById("div_background1").style.opacity=0.0;
	document.getElementById("div_background2").style.opacity=1.0;
	var element = document.getElementById("div_background_effect");
	element.style.zIndex=3;
	element.style.opacity=(background_opacity/100);
	element.style.filter="alpha(opacity="+background_opacity+")";
	element.style.background="rgb(0,0,0)";
	element.style.display="inline";
	element.style.top=0;
	element.style.left=0;
	element.style.width=998;
	element.style.height=660;
}
	
function set_box(visibility, element, left, top, width, height){
	var enable="inline";
	if(visibility=="hidden") {
		enable="none";
	} 	
	if(top) 		element.style.top=top;
	if(left) 		element.style.left=left;
	if(width) 		element.style.width=width;
	if(height) 		element.style.height=height;	
	if(visibility) 	element.style.display=enable;
	element.style.background="rgb("+box_color[0]+","+box_color[1]+","+box_color[2]+")";
	//set it to not selectable
	element.onselectstart=new Function("return false");
}

function set_home(visibility){
	if(visibility=="none") {
		//animations_foldup_new(document.getElementById("div_box1"), foldupdown_speed);
		//animations_foldup_new(document.getElementById("div_box2"), foldupdown_speed);
		animations_fadeout("div_box1", 0, 10, 30);
		animations_fadeout("div_box2", 0, 10, 30);
	} else {
		set_box(visibility, document.getElementById("div_box1"),123, 115, 275, 420);
		set_box(visibility, document.getElementById("div_box2"),493, 115, 465, 420);
		//animations_folddown_new(document.getElementById("div_box1"), 420, foldupdown_speed);
		//animations_folddown_new(document.getElementById("div_box2"), 420, foldupdown_speed);
		animations_fadein("div_box1", box_opacity, 10, 30);
		animations_fadein("div_box2", box_opacity, 10, 30);

	}
}

function set_home_core(enable){
	setup_image("signature", enable, signature_file, 593, 422, 295, 85);
	setup_text_new(document.getElementById("div_home_t1"), 25, default_text_color, enable, welcome_text, 503, 142, 440, null);
	document.getElementById("div_home_t1").style.fontWeight='bold';
	setup_text_new(document.getElementById("div_textbox_right"), 17, default_text_color, enable, "Last updated on "+update+"<BR><BR>"+
													"The latest presentations and movies are listed at the left.<BR>"+
													"Click one to go directly to that presentation or movie.<BR><BR><BR>"+
													"'Making powerpoint presentations is<BR>"+
													"one of the things I love to do,<BR>"+
													"so that is why this website was created,<BR>"+
													"to be able to share them with you.'", 513, 182, 440, 180);
	
	setup_text_new(document.getElementById("div_home_0"), 18, default_text_color, enable, "<b>Latest presentations</b>", 123, 142, 275, null);
	setup_text_new(document.getElementById("div_home_1"), 17, default_text_color, enable, new_pps_1, 123, 182, 275, null);
	setup_text_new(document.getElementById("div_home_2"), 17, default_text_color, enable, new_pps_2, 123, 232, 275, null);
	setup_text_new(document.getElementById("div_home_3"), 17, default_text_color, enable, new_pps_3, 123, 282, 275, null);
	setup_text_new(document.getElementById("div_home_4"), 18, default_text_color, enable, "<b>Latest movies</b>", 123, 342, 275, null);
	setup_text_new(document.getElementById("div_home_5"), 17, default_text_color, enable, new_movie_1, 123, 382, 275, null);
	setup_text_new(document.getElementById("div_home_6"), 17, default_text_color, enable, new_movie_2, 123, 432, 275, null);
	setup_text_new(document.getElementById("div_home_7"), 17, default_text_color, enable, new_movie_3, 123, 482, 275, null);
	document.getElementById("div_home_1").onclick=function () {menu_click("presentations", "PRESENTATIONS", new_pps_1, "name");};
	document.getElementById("div_home_2").onclick=function () {menu_click("presentations", "PRESENTATIONS", new_pps_2, "name");};
	document.getElementById("div_home_3").onclick=function () {menu_click("presentations", "PRESENTATIONS", new_pps_3, "name");};
	document.getElementById("div_home_5").onclick=function () {menu_click("movie", "MOVIES", new_movie_1, "name");};
	document.getElementById("div_home_6").onclick=function () {menu_click("movie", "MOVIES", new_movie_2, "name");};
	document.getElementById("div_home_7").onclick=function () {menu_click("movie", "MOVIES", new_movie_3, "name");};
		document.getElementById("div_home_0").onclick=function () {menu_click("presentations", "PRESENTATIONS", "null", "date");};
	document.getElementById("div_home_4").onclick=function () {menu_click("movie", "MOVIES", "null", "date");};
	
	for(i=0; i<=7; i++){
		document.getElementById("div_home_"+i).onmouseover =function () {default_onmouseover(this);};
		document.getElementById("div_home_"+i).onmouseout  =function () {default_onmouseout(this);};
	}
}

function startup_site(){
	//Site startup values
	document.getElementById("div_loading").style.display="none";
	document.getElementById("div_welcome").style.display="none";
	set_box("hidden", document.getElementById("div_box2"), 123, 555, 835, 1);
	set_box("hidden", document.getElementById("div_box3"), 123, 555, 835, 1);
	set_box("hidden", document.getElementById("div_box4"), 123, 555, 835, 1);
	document.getElementById("div_box1").style.opacity=(box_opacity/100);
	document.getElementById("div_box1").style.filter="alpha(opacity="+box_opacity+")";
	document.getElementById("div_box2").style.opacity=(box_opacity/100);
	document.getElementById("div_box2").style.filter="alpha(opacity="+box_opacity+")";
	document.getElementById("div_box3").style.opacity=(box_opacity/100);
	document.getElementById("div_box3").style.filter="alpha(opacity="+box_opacity+")";		
	document.getElementById("div_box4").style.opacity=(box_opacity/100);
	document.getElementById("div_box4").style.filter="alpha(opacity="+box_opacity+")";
	document.getElementById("div_box_name1").style.opacity=(box_left_opacity/100);
	document.getElementById("div_box_name1").style.filter="alpha(opacity="+box_left_opacity+")";
	document.getElementById("div_box1").status="up";
	document.getElementById("div_box2").status="up";
	document.getElementById("div_box3").status="up";
	document.getElementById("div_box4").status="up";
	// Menu box color for blinking	
	if(box_color[0]<165) blink_box_color[0]=box_color[0]+90; else blink_box_color[0]=255;
	if(box_color[1]<165) blink_box_color[1]=box_color[1]+90; else blink_box_color[1]=255;
	if(box_color[2]<165) blink_box_color[2]=box_color[2]+90; else blink_box_color[2]=255;
	setTimeout('setup_top_box();',400);
	setTimeout('animations_size_new(document.getElementById("div_box_title"), "box", 998, 49, 40, 10);',500);
	setTimeout('set_background();',600);			//configure background picture
	setTimeout('background_slideshow();',600);		//start background slideshow	set_box("hidden", document.getElementById("div_box1"), 123, 555, 835, 1);
	setTimeout('set_box("visible", document.getElementById("div_box_name1"), 40, 0, 1, 661);',800);		
	setTimeout('animations_size_new(document.getElementById("div_box_name1"), "box", 80, 661, 20, 10);',950);		
	setTimeout('set_menu("visible"); set_title(); set_version("visible");  if (browserok && let_it_snow==1){initsnow();}', 1000);
	setTimeout('menu_click("home", "HOME", "", "null");',1500);
	setTimeout('blink_name();',2100);

}

function setup_top_box (){
	set_box("visible", document.getElementById("div_box_title"), 500, 0, 1, 49);

}

function blink_name(){
	var random_time=0;
	var random_steps=0;
	var wallpapers_imagesize_busy=0;
	
	for(i=0; i<20; i++){
		if(document.getElementById("wallpapers_image_"+i).state=="busy") wallpapers_imagesize_busy=1;
	}
	random_steps=Math.round((Math.random()*10)+15);  //random 15 - 25
	if(document.getElementById("div_box1").status!="busy" && 
		document.getElementById("div_box2").status!="busy" &&
		document.getElementById("div_box3").status!="busy" &&
		document.getElementById("div_box4").status!="busy" &&
		wallpapers_imagesize_busy==0) {
		animations_color_blink(document.getElementById("div_box_name1"), box_color, blink_box_color, random_steps);
	}
	random_time=Math.round((Math.random()*5000)+3000);  //random 3000 - 8000
	setTimeout('blink_name();', random_time);
}

function check_onload() {
	runthesite++;
	if(runthesite==back_pic.length) {
		setTimeout('startup_site();', 700);	//Kick this software in the face to wake 'em up and make it shake! :P
	}
}

