var common_standbytime = 1; function ajax_submit(url, data, function_on_success) { $.ajax({ url: url, type: 'get', dataType: 'json', data: data, cache: false, timeout: 2 * 1000, success: function(response) { function_on_success(response); }, error: function() { //alert("error"); }, complete: function() { //alert('ok'); } }); } function ajax_async_submit(url, data, function_on_complete) { $.ajax({ url: url, type: 'post', dataType: 'json', data: data, cache: false, beforeSend: function() { show_loading_image(); }, success: function(response) { //function_on_success(response); }, error: function() { //alert("error"); }, complete: function() { function_on_complete(); } }); } function has_checked_checkbox(name) { return $("input[name='" + name + "']").is(":checked"); } function getCookie(cookieName) { var search = cookieName + "="; var cookie = document.cookie; if( cookie.length > 0 ) { startIndex = cookie.indexOf( cookieName ); if( startIndex != -1 ) { startIndex += cookieName.length; endIndex = cookie.indexOf( ";", startIndex ); if( endIndex == -1) endIndex = cookie.length; return unescape( cookie.substring( startIndex + 1, endIndex ) ); } else { return false; } } else { return false; } } function executeLogout(callBackFunction) { ajax_submit('/cgi-bin/logout.cgi', null, callBackFunction); } function get2Digit(val) { if (val < 10) return "0" + val; else return val; } String.format = function() { var args = arguments; var count = args.length; if( count < 2 ) return null; var format = args[0]; for(var i=1; i{1}", option.val(), option.text())); } } function isNumeric(s) { var len= s.length; var ch; if(len==0) return false; for( i=0; i< len; i++) { ch= s.charAt(i); if( ch > '9' || ch < '0') { return false; } } return true; } function strip_tag(str) { return str.replace(/(<([^>]+)>)/ig,""); } function select_val(obj_id, val) { $(obj_id).val(val); if (get_selected_index(obj_id) < 0) { $(obj_id + " option:eq(0)").attr('selected', 'selected'); } } function get_selected_index(obj_id) { return $(obj_id + " option").index($(obj_id + " option:selected")); } if (!('forEach' in Array.prototype)) { Array.prototype.forEach= function(action, that /*opt*/) { for (var i= 0, n= this.length; i=0; i--) { if (arCompare[i] == showValue) continue; for (var j=0; j<$("[name=" + targetName + "] option").length; j++) { if ($("[name=" + targetName + "] option:eq(" + j + ")").val() == preFix + i) { $("[name=" + targetName + "] option:eq(" + j + ")").remove(); break; } } } } /* ONTW-243 END */