wouldn't usually post a thread like this but my brain hurts 
Having trouble with the below code, the final 'if' - obj doesnt contain what i'm expecting (the object name), according to the alert it just contains [object]

Having trouble with the below code, the final 'if' - obj doesnt contain what i'm expecting (the object name), according to the alert it just contains [object]

Code:
function MM_showHideLayers() { //v9.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3)
with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
<!--alert (obj);-->
if (obj=='apDiv_contact') {MM_swapImage('Image292','','images/index_17_ovr.jpg',0);}
}