function checkus(){
	if((document.form1.usern.value=="") || (document.form1.passn.value=="")) {
		alert("Please enter username and password");
	} else {
		document.form1.submit()
	}
}

function typesel(){
	if(document.formadd.type.value =="0"){
		document.formadd.btnadd.disabled = true;
	} else {
		document.formadd.btnadd.disabled = false;
	}
}

function checkcat(){
	if( (document.formadd.catname.value!="") && (document.formadd.catrank.value!="") && (document.formadd.sphoto.value!="") && ( document.formadd.type.value!="") ){
		document.formadd.btnadd.disabled = false;
	} else {
		document.formadd.btnadd.disabled = true;
	}
}

function submod(){
	document.form1.action="";
}

function confpass(){
	if((document.changepass.oldpass.value=="") || (document.changepass.pass.value=="") || (document.changepass.confirmpass.value=="")) {
		alert('Please Fill in the blank');
	} else if(document.changepass.pass.value != document.changepass.confirmpass.value){
		alert('Please confirm your password');
	} else if(document.changepass.pass.value.length<6){
		alert('your password may be 6 character');
	} else {
  		document.changepass.submit();
 	}
}

function setidcat(){
	if(document.form1.cat.value != ""){
		document.getElementById("mod").href="addcat.php?action=mod&idcat="+document.form1.cat.value;
		document.getElementById("del").href="codepage/catmang.php?action=delete&idcat="+document.form1.cat.value;
	} else {
		document.getElementById("mod").href = true;
		document.getElementById("del").href = true;
	}
}

function setidsubcat(){
	document.getElementById("mod").href="addsubcat.php?action=mod&idscat="+document.form1.subcat.value;
	document.getElementById("del").href="codepage/subcatmang.php?action=delete&idscat="+document.form1.subcat.value;
}

function checksubcat(){
	if( (document.formadd.subcatname.value!="") && (document.formadd.subcatrank.value!="") && (document.formadd.sphoto.value!="")  && ( document.formadd.cat.value!="") ){
		document.formadd.btnadd.disabled = false;
	} else {
		document.formadd.btnadd.disabled = true;
	}
}

function checkvaluecat(){
	return confirm('are you sure you want to delete this Sub-categorie');
}
function mover(th) {
document.getElementById(th).style.color="#cccccc";
}
function mout(th) {
document.getElementById(th).style.color="#ffffff";
}

function moverp(th) {
document.getElementById(th).style.borderColor="#999999";
}
function moutp(th) {
document.getElementById(th).style.borderColor="#ffffff";
}
