Testing For Existence

// test for the existence of an object before doing anything with it
if(typeof someObject == 'undefined'){
	alert('someObject does not exist');
}else{
	alert('someObject exists');
 
	// check for a specific function before calling it
	if(someObject.someFunction){
		someObject.someFunction();
	}
}