
function edit_content(ID, type) {
	if(type == 'content') { width = 700; height = 450; }
	if(type == 'showcase') { width = 850; height = 450; }
	shadow("editor_shadow.php?action=edit&ID="+ID+"&type="+type, "", width, height);
}

function remove_content(ID, type) {
	if(type == 'showcase') { width = 400; height = 150; }
	shadow("editor_shadow.php?action=remove&ID="+ID+"&type="+type, "", width, height);
}

/* shadow */
function shadow(url, title, width, height) {
	Shadowbox.init();
	Shadowbox.open({
		player:     "iframe",
		content:    url,
		title:      title,
		width:		width,
		height:		height
	});
}

//login
function login() {						
	$.ajax({
		type: "POST",
		url: "php/ajax.php",
		data: "user="+document.getElementById("user").value+"&pass="+document.getElementById("pass").value,
		success: function(response){
			if(response == "succes") {
				windowurl = window.location.href.split(".php"); 
				//remove all parameters
				window.location.href = windowurl[0]+".php";
			}
			if(response == "fail") {
				document.getElementById("user").value = '';				
				document.getElementById("pass").value = '';				
			}
		}
	});	
	return false;
}

//logout
function logout() {						
	$.ajax({
		type: "POST",
		url: "php/ajax.php",
		data: "logout=true",
		success: function(response){
			windowurl = window.location.href.split(".php"); 
			//remove all parameters
			window.location.href = windowurl[0]+".php";
		}
	});	
}

