moving footer js calls into self invoking function