function OpenPictureUpload(url)
{
	MeinFenster = window.open(url, "MediaWindow", "width=555,height=300,scrollbars=yes,toolbar=0,status=1");
	MeinFenster.focus();
}

function CheckApplicationInput(sender, args)
{
	if (document.Form1._ctl1_ApplicationText.value == "") 
		{
			args.IsValid = false;
		}
	else
		{
			args.IsValid = true;
		}
}

function PictureUploadClose()
{
	self.close();
}

function PictureUploadPostValueObj(myvalue,path)
{
		opener.document.Form1._ctl1_Hidden_Picture.value = myvalue;
		opener.document.Form1._ctl1_ImageObjPic.src = path+myvalue;
		opener.document.Form1._ctl1_ImageObjPic.style.visibility = "visible";
		PictureUploadClose();
}

function PictureMove(obj)
{
	var obj = document.getElementById('_ctl1_ListBoxBilder');
	for (i=0; i<obj.options.length; i++) {
		if (obj.options[i].selected) {
			if (i != 0 && !obj.options[i-1].selected) {
			swapOptions(obj,i,i-1);
			obj.options[i-1].selected = true;
			}
		}
	}
}
		
function swapOptions(obj,i,j)
{
	var o = obj.options;
	var i_selected = o[i].selected;
	var j_selected = o[j].selected;
	var temp = new Option(o[i].text, o[i].value, o[i].defaultSelected, o[i].selected);
	var temp2= new Option(o[j].text, o[j].value, o[j].defaultSelected, o[j].selected);
	o[i] = temp2;
	o[j] = temp;
	o[i].selected = j_selected;
	o[j].selected = i_selected;
}

		
function PictureDelete()
{
  var elSel = document.getElementById('_ctl1_ListBoxBilder');
	var i;
	for (i = elSel.length - 1; i>=0; i--) {
		if (elSel.options[i].selected) {
			elSel.remove(i);
	  }
	}
	if (elSel.length > 0)
	{
		elSel.options[0].selected = true;
		document.Form1._ctl1_ImageBilder.src='../pictures/thumbs/'+elSel.options[0].value
	}
	else
	{
		document.Form1._ctl1_ImageBilder.style.visibility = 'hidden';
	}
}
		
function PictureUploadPostValueVar(myvalue,path)
{
		document.Form1._ctl1_ListBoxBilder.options[document.Form1._ctl1_ListBoxBilder.options.length] = new Option(myvalue, myvalue,false,true);
		document.Form1._ctl1_ImageBilder.src='../pictures/thumbs/'+myvalue
		document.Form1._ctl1_ImageBilder.style.visibility = 'visible';
}
	
function SelectAllItems()
{
	var intCount = window.document.Form1._ctl1_ListBoxBilder.options.length;
	for (i = 0; i < intCount; i++)
	{
		document.Form1._ctl1_ListBoxBilder.options(i).selected = true;
	}
}

function openWindow(Pfad,Dateiname) 
{
	html = "<HTML><HEAD><TITLE>" + Dateiname + "</TITLE></HEAD><BODY LEFTMARGIN=0 MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0><IMG style='display: inline;' SRC='" + Pfad + Dateiname + "' BORDER=0 NAME=image onload='var w=document.image.width, h=document.image.height;var a=300/w;document.image.width = 300;document.image.height = a*h;window.resizeTo(312,a*h+31);'></BODY></HTML>";
	popupWin=window.open('','image','alwaysRaised=yes,toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=1,screenX=150,screenY=150');
	popupWin.document.open();
	popupWin.document.write(html);
	popupWin.document.focus();
	popupWin.document.close()
}



