// JavaScript Document

function manage(a,b,c) {  //receive value=[ a={edit,del,add}, b={id}, c={the name things to change. i.e=product}]
	
	var a,b,c;
	var url = "admin_home.php?i=manage_" + c + "&do=" + a + "&id=" + b;

	if (a == 'del' ) {
		
		var del=confirm("Are you sure you want to delete");
	 
 			if (del ==true)
    			{ document.location = url; }
	}
	
	if (a == 'edit'){	document.location = url; }
	
}


function goURL(a,b) {  //revieve value={a=reply,forward,delete} b={id}
	
	var a,b;
	var url= "admin_inbox.php?i=" + a + "&id=" + b;
	
	
	if (a == 'delete' ) {
		
		var del=confirm("Are you sure you want to delete");
	 
 			if (del ==true)
    			{ document.location = url; }
	}
	
	if (a == 'forward' || a == 'reply'){	document.location = url; }
	
	

}

function goback(){

history.go(-1);

}



function validate()
{
	var x = document.contact_us.email.value;
	var subject = document.contact_us.subject.value; 
	var content = document.contact_us.content.value; 
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	if( subject == null || subject == "" ){	
	alert('Please fill in the Subject.');
	return false;
	}else if (content == null || content == "" ){
	alert('Please fill in your message.');
	return false;	
	} else if (!filter.test(x)) { alert('Please insert a valid E-mail address.'); return false; 
	}else return true;
	
}

function newWindow(url){

	var url;
	window.open(url);
}

function cursor_hand() {
document.body.style.cursor = 'pointer';
}

function cursor_clear() {
document.body.style.cursor = 'default';
}

