// JavaScript Document // ----- Header functions ------------------------------------------------------------ function init_header_update_processed_number() { if($('.header_process_number').length){ var header_process_number_post = $.post( local_url+'lib/ajax/processed/', $("#header_search_form").serialize(), function(json_data,status){ $('.header_process_number').animateNumber({ number: json_data.rand_no }); }, "json"); } }; function init_header_language_hover_effect(){ if($('#header_lang_en').length){ $("#header_lang_en, #header_lang_tc, #header_lang_sc").hover( function() {$(this).stop().animate({"opacity": "0.6"}, "fast");}, function() {$(this).stop().animate({"opacity": "1"}, "fast"); }); } } function header_search_normal_onoff(boo){ if($('#header_search_input_normal').length){ if(boo){ $('#header_search_input_normal').show(); $('#header_search_input_normal').stop().animate({"width": "310px"}, "fast"); } else { if(!normalSearchInputFocusBoo){ $('#header_search_input_normal').stop().animate({"width": "0px"}, "fast", function() { $(this).hide(); }); } } } if($('#process_number_table').length){ if(boo){ $('#process_number_table').stop().animate({"opacity": "0"}, "fast", function() { $(this).hide(); }); } else { if(!normalSearchInputFocusBoo){ $('#process_number_table').show(); $('#process_number_table').stop().animate({"opacity": "1.0"}, "fast"); } } } } function header_search_normal_onBlur(){ if($('#header_search_input_normal').length){ normalSearchInputFocusBoo = false; header_search_normal_onoff(false); } } function init_header_search_normal(){ if($('#header_search').length){ $("#header_search").hover( function() { if($('#header_search_input_normal').val() == ''){ $('#header_search_input_normal').val(searchNormalDefaultValue); } header_search_normal_onoff(true); }, function() { header_search_normal_onoff(false); }); $('#header_search_input_normal').val(searchNormalDefaultValue); $('#header_search_input_normal').focus(function (){ normalSearchInputFocusBoo = true; if($.trim($(this).val()) == searchNormalDefaultValue){ $(this).val(''); } }); $("#header_search_input").blur(function (){ header_search_normal_onBlur(); }); } } function header_open_mm(id){ // close old layer if(ddmenuitem) ddmenuitem.hide(); ddmenuitem = $('#'+id); ddmenuitem.show(); } function header_close_mm(){ if(ddmenuitem) { ddmenuitem.hide(); } } function init_header_mm_event(){ if($('#mobile_mm').length){ $('#mobile_mm').click(function(e) { if(Number($('#mobile_mm').attr('title')) == 0){ //$('#mobile_mm img').stop().attr("src", local_url+"lib/img/header/header_mobile_mm_still_close.gif"); $('#mobile_mm img').stop().attr("src", mm_still_close.src); $('#mobile_mm').attr('title', '1'); $('#headerContent_mobile').stop().animate({ height: (250+((!$('#header_process_container').length ? 100 : 0))+($('.header_mm_org').length ? $('.header_mm_org').height() : 0)) +'px' }, 400, 'easeOutBack'); } else { //$('#mobile_mm img').stop().attr("src", local_url+"lib/img/header/header_mobile_mm_close_still.gif"); $('#mobile_mm img').stop().attr("src", mm_close_still.src); $('#mobile_mm').attr('title', '0'); $('#headerContent_mobile').stop().animate({ height:'84px' }, 200); } }) } if($('#mm_org').length && $('#mm_account').length){ $('#mm_org, #mm_account').hover( function() { header_open_mm($(this).attr('id')+'_div'); }, function() { // }); $('#mm_org, #mm_account').click(function(e) { //if($('#'+$(this).attr('id')+'_div').is(':visible')){ //header_close_mm(); //} else { header_open_mm($(this).attr('id')+'_div'); //} }); } if($('.about_page').length){ $('.about_page').click(function(e) { move_to_about(); }); } } function init_header_search_input_event(){ $("#header_search_input").val(searchDefaultValue); $("#header_search_input").focus(function (){ if($.trim($(this).val()) == searchDefaultValue){ $(this).val(''); } $(this).stop().animate({"width": "350px"}, "fast"); }); $("#header_search_input").blur(function (){ if($.trim($(this).val()) == ''){ $(this).val(searchDefaultValue); } $(this).stop().animate({"width": "156px"}, "fast"); }); } // -- END --- Header functions ------------------------------------------------------------