function setCookie(c_name,value,expiredays)
{
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function logIn() {
	var saltword = "s3cr3ts4lt";
	var foxuser = doSha1(saltword+document.getElementById('username').value);
	var foxpass = doSha1(saltword+document.getElementById('password').value);
	setCookie('foxuser',foxuser,1);
	setCookie('foxpass',foxpass,1);
	document.location='functions/authenticate.php';
	return false;
}

function editMe(id,section,orderby) {
	window.location="edit.php?section="+section+"&id="+id+"&orderby="+orderby;
}

function orderBy(section,orderby) {
	window.location="list.php?section="+section+"&orderby="+orderby;
}

function imgToTop(img,parent,order,section) {
	window.location="functions/action_imgtop.php?id="+img+"&parent="+parent+"&order="+order+"&section="+section;
}

function imgDel(img,parent,type,section) {
	var really = confirm("Are you sure you want to delete this image?")
	if (really){
		window.location="functions/action_imgdel.php?id="+img+"&parent="+parent+"&type="+type+"&section="+section;
	}
	else{
		return false;
	}
}

function shownews(url) {
	windowFeatures ='height=810,width=840,top=0,left=0,scrollbars=yes,resizable';
	newWindow=window.open(url, "fox_news", windowFeatures);
}

function cancelApp() {
	var answer = confirm("Are you sure?  Any data you have entered so far will be cleared.")
	if (answer) {
		window.location = "functions/action_reset.php";
	}
	else {
	}
}