modiefied orientation js code