function getFile(file){
	var url='files.php';
	var par;
	
	if(file=='loginForm')
		par = 'krkkt=loginForm';
	else
		par = 'uri=file&file='+encodeURIComponent(file);
	
	if(xmlHttp){
		xmlHttp.open("POST",url,true);
		xmlHttp.onreadystatechange = openFile;
		xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xmlHttp.send(par);
	}else{
		alert('Brak obiektu XML!');
	}
}

function deleteFile(file){
	var url='files.php';
	var par = 'uri=deleteFile&delFile='+file;
	if(xmlHttp){
		xmlHttp.open("POST",url,true);
		xmlHttp.onreadystatechange = openFile;
		xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xmlHttp.send(par);
	}else{
		alert('Brak obiektu XML!');
	}
}

function showUploded(dir){
	var url='files.php';
	var par = "uri=showFiles&dir="+dir;
	if(xmlHttp){
		xmlHttp.open("POST",url,true);
		xmlHttp.onreadystatechange = openFile;
		xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xmlHttp.send(par);
	}else{
		alert('Brak obiektu XML!');
	}
}

function contact(todo){
	var url;
	var par;
	if(todo=='mailForm') {
		url = 'files.php';
		par="uri="+todo;
	}else{
		url = "sendMail.php";
		var to = getValue('to');
		var from = getValue('from');
		var topic = getValue('topic');
		var body = getValue('body');
		par = "from="+from+"&to="+to+"&topic="+topic+"&body="+body;
	}
	
	if(xmlHttp){
		xmlHttp.open("POST",url,true);
		xmlHttp.onreadystatechange = openFile;
		xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xmlHttp.send(par);
	}else{
		alert('Brak obiektu XML!');
	}
}

function setPanel(action){
	if(xmlHttp){
		var url="panel.php";
		var par = "url="+action;
		xmlHttp.open("POST",url,true);
		xmlHttp.onreadystatechange = openFile;
		xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xmlHttp.send(par);
	}else{
		alert('Brak obiektu XML!');
	}
}

function searchForm(){
	var url='files.php';
	var par = 'uri=camistsList';
	if(xmlHttp){
		xmlHttp.open("POST",url,true);
		xmlHttp.onreadystatechange = openFile;
		xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xmlHttp.send(par);
	}else{
		alert('Brak obiektu XML!');
	}
}

function openFile(){
	var content = document.getElementById('content');
	if(xmlHttp){
		if((xmlHttp.readyState==4)&&(xmlHttp.status==200)){
			try{
				content.innerHTML = xmlHttp.responseText;
			}catch(e){
				alert('Blad obiektu: '+e.toString());
			}
		}
	}else{
		alert('Brak obiektu XML!');
	}
}