split value from units
if element.style.top => '15px'
splitUnit( element.style.top ) => [15,'px']
1 function splitUnit(e) 2 /* 3 * takes a string and seperates 'px or 'em' from it 4 * 5 * could be streamlined to simply seperate the last two characters, but that could cause errors if used sloppily 6 */ 7 { 8 if( e && ( length = e.search( /px/ ) ) ) {var eUnit = 'px'; var eValue = e.substr( 0, length );} 9 else if( e && ( length = e.search( /em/ ) ) ) {var eUnit = 'em'; var eValue = e.substr( 0, length );} 10 else return false; 11 12 return new Array( eValue, eUnit ); 13 }