function ViewMentor(task, params){ this.task = task; this.params = params; switch(task){ case 'searchAct': searchAct(); break; case 'gotoReviews': $('html, body').animate({ scrollTop: $("#course-reviews").offset().top }, 200); break; } function searchAct() { if ($("#txtKeyword").val() == "" ) { $("#txtKeyword").focus(); } else { var url = parent_path + "/search/index.php?p=homep&keyword=" + encodeURIComponent( $("#txtKeyword").val() ); //location.href = url; openLink( url ); } } }