/*

	sd.js [v0.2]

	Copyright 2004 Slightly Different Ltd.
	<http://www.slightlydifferent.co.uk/>

	REUSE OF THIS CODE WITHOUT EXPRESS WRITTEN
	PERMISSION IS STRICTLY PROHIBITED...

*/

function sd_kp_sethandler(){
	if(document.layers){
  		document.captureEvents(Event.KEYPRESS);
  	}
  	document.onkeypress = sd_kp_handler;
}

function sd_kp_handler(e){
	if(window.TEXTAREA){
		return true;
	}
	if((document.layers ? e.which : window.event.keyCode) == 13){
		if(document.forms[0].onsubmit && window.ONSUBMIT){
			if(eval(window.ONSUBMIT)){
				document.forms[0].submit();
			}
		}
		else{
			document.forms[0].submit();
		}
		return false;
	}
}

function sd_alterhtml(id,html){
	if(document.getElementById(id)){
		document.getElementById(id).innerHTML = html;
	}
}

function sd_redirect_parent(url){
	if(opener && !opener.closed){
		opener.location.href = url;
	}
}

function sd_closewin(w){
	if(w){
		w.close();
	}
}

function sd_textarea(e){
	if(e.type == 'focus'){
		TEXTAREA = 1;
	}
	else if(e.type == 'blur'){
		TEXTAREA = 0;
	}
}

function sd_redirect(url){
	location.href = url;
}

function sd_delete_confirm(msg){
	var t;
	if(msg){
		t = "Are you sure you would like to delete [" + msg + "]?";
	}
	else{
		t = "Are you sure you would like to proceed with this deletion?";
	}
	return confirm(t);
}