function obj(menu)
{
    return (navigator.appName == "Microsoft Internet Explorer")?this[menu]:document.getElementById(menu);
}

function CheckMultiple()
    {
    if (!form1.multiple[0].checked)
        {
        this.obj('multiple').style.position="";
        this.obj('multiple').style.visibility="";
        }
        else
        {
        window.location="?files=0";
        this.obj('multiple').style.position="absolute";
        this.obj('multiple').style.visibility="hidden";
    }
}

function CheckResize()
{
    if (!form1.resize[0].checked)
    {
        this.obj('percent').style.position="";
        this.obj('percent').style.visibility="";
    }
    else
    {
        this.obj('percent').style.position="absolute";
        this.obj('percent').style.visibility="hidden";
    }
}

function CheckFileCount()
{
    for (counter = 0; counter < form1.files.length; counter++)
    {
        if(form1.files[counter].checked)
        {
            window.location="uploaden.html?files="+form1.files[counter].value;
        }
    }
}

var resized_images = new Array();

var maxImageWidth = 600;

	function fullsize(){
		var oSource = window.event.srcElement.src;
		tempvar = resized_images[oSource];
		showpopupwindow = window.open('', "_blank","toolbar=no,location=no,menubar=no,scrollbars=no,status=no,left=0,top=0"+tempvar);
		showpopupwindow.document.writeln("<html><head><title>Orginele foto: " + unescape(oSource) +  "</title>");
		showpopupwindow.document.writeln("</head><body topmargin=\"0\" leftmargin=\"0\" marginheight=\"0\" marginwidth=\"0\">");
		showpopupwindow.document.writeln("<img src=\"" + oSource + "\" onclick=\"window.close()\" title=\"Klik om dit venster te sluiten\">");
		showpopupwindow.document.writeln("</body></html>");
		showpopupwindow.document.close();
	}

	function resize(image){
		if(!image){
			var image = window.event.srcElement;
		}

		width = image.width;
		height = image.height;
		var url = image.src;

		if(width>maxImageWidth && 
                   url.substring(0, 33) != "http://www.plaatjesupload.nl/img/"
                  )
                   {
			resized_images[url] = ",width="+width+",height="+height;
			image.width = maxImageWidth;
			image.title = 'Originele grootte: '+width+'x'+height;
			image.style.border = "dashed 1px red";
			image.style.cursor = "hand";
			image.onclick = fullsize;
			image.height = Math.floor(height/(width/maxImageWidth));
		}
	}

	function check_images(){
		count = document.images.length;
		i = 0;

		while(count>i){
			imgurl = document.images[i].src;

			if(document.images[i].complete){
        			resize(document.images[i]);
			}else{
				document.images[i].onload = resize;
			}
			i++;
		}
	}

function userSel()
{
    document.getElementById('admin_zoekveld').value = document.getElementById('admin_users').options[document.getElementById('admin_users').selectedIndex].value;
    document.getElementById('admin_option').selectedIndex = 2;
}