/*
This code is based on a code example from the article "Javascript navigation - cleaner, not meaner" by Christian Heilmann
URL: http://www.evolt.org/article/Javascript_navigation_cleaner_not_meaner/17/60273/index.html
*/

// If there is enough W3C DOM support for all our show/hide behavior:
// 1. Call the stylesheet that by default hides all toggleable sections 
// 2. Apply the show/hide behavior by calling the initialization function
if (document.getElementById && document.getElementsByTagName && document.createTextNode) {
	document.write('<link rel="stylesheet" type="text/css" href="js_hide.css" />');
//	window.onload = initShowHide;
}

function initShowHide() {
	// Hide all toggleable sections with JavaScript for the highly improbable case that CSS is disabled
	// Note that in this case the 'flash of visible content' still will occur
	// For testing purposes you can add the following code to disable CSS: document.getElementsByTagName('link')[0].disabled = true;			
	hide();
	var toggle = document.getElementById('toggle');
	var as = toggle.getElementsByTagName('img');
	for (var i = 0; i < as.length; i++) {
		as[i].onmouseover = function() {
			show(this);
			return false;
		}
	}
}

function show(s) {
	hide();
	var id = s.name;
	var toggleable = document.getElementById('image_info').getElementsByTagName('div');
        for (var i = 0; i < toggleable.length; i++) {
		if (toggleable[i].id == id)
	                toggleable[i].style.display = 'block';
        }
//document.getElementById(id).style.display = 'none';
}

function hide() {
	var toggleable = document.getElementById('image_info').getElementsByTagName('div');
	for (var i = 0; i < toggleable.length; i++) {
		toggleable[i].style.display = 'none';
	}
}



function showimg(form)
{
	adres = form.image_file.value;
	index = adres.indexOf(".gif");
	index = index + adres.indexOf(".jpg");
	index = index + adres.indexOf(".bmp");
	if (form.image_file.value == ""){
		alert("No Image found!");
	}
	else{
		if (index == -3){
			alert("Unknow image type");
			form.width.value=0;
			form.height.value=0;
		}
		else{
			var img_obj = new Image();
			img_obj = form.image_file.value;
			document.changing.src = img_obj;
			document.changing2.src= img_obj;
			document.changing.width = document.changing2.width;
			document.changing.height = document.changing2.height;
			set();
		}
	}
}


function set(){
	document.image.width.value=document.changing.width;
	document.image.height.value=document.changing.height;
}


function resize(){
	document.changing.height = document.image.height.value;
	document.changing.width = document.image.width.value;
}


