var googlekey = ''; request = { querystring: function(item) { var svalue = location.search.match(new regexp("[\?\&]" + item + "=([^\&]*)(\&?)", "i")); return svalue ? svalue[1] : svalue; } } $(document).ready(function() { //google_cse_load(); $(".search-keyword").keypress(function(e) { var keycode = e.keycode ? e.keycode: e.which ? e.which: e.charcode; if (keycode == 13) { dosearch(); return false; } else return true; }); }); function dosearch() { var key = $('.search-keyword').val(); if(key.length < 2){ alert('搜索字符不要小于两个字~!'); return;} $('#keyword2').val(key); document.bf.submit(); return false; } function google_cse_load() { try { var cses = document.createelement('script'); cses.type = 'text/javascript'; cses.src = 'http://www.google.com.hk/coop/cse/brand?form=cse-search-box&lang=zh-hans'; var node = document.getelementbyid('google_cse_holder'); node.parentnode.insertbefore(cses, node); } catch(e) {} } function addme() { addfavor('http://www.chinabird.com','宁波波导股份有限公司'); } function addfavor(url,title) { //if(confirm("网站名称:"+title+"\n网址:"+url+"\n确定添加收藏?")){ if(true){ var ua = navigator.useragent.tolowercase(); if(ua.indexof("msie 8")>-1){ external.addtofavoritesbar(url,title,'');//ie8 }else{ try { window.external.addfavorite(url, title); } catch(e) { try { window.sidebar.addpanel(title, url, "");//firefox } catch(e) { alert("加入收藏失败,请使用ctrl+d进行添加"); } } } } return false; } function addrecent(id) { var s = $.cookie('recent'); if(!s){ s = '';} var arr = s.split(","); arr.push(id); var o = {}; for(var i = 0; i < arr.length; i++){ o[arr[i]] = arr[i]; } arr = []; for (var el in o) { if (el == o[el]) arr.push(el - 0); } $.cookie('recent', arr.join(',')); } jquery.fn.fancyzoom = function(options){ var options = options || {}; var directory = options && options.directory ? options.directory : 'images'; var zooming = false; if ($('#zoom').length == 0) { var ext = $.browser.msie ? 'gif' : 'png'; var html = ''; $('body').append(html); $('html').click(function(e){if($(e.target).parents('#zoom:visible').length == 0) hide();}); $(document).keyup(function(event){ if (event.keycode == 27 && $('#zoom:visible').length > 0) hide(); }); $('#zoom_close').click(hide); } var zoom = $('#zoom'); var zoom_table = $('#zoom_table'); var zoom_close = $('#zoom_close'); var zoom_content = $('#zoom_content'); var middle_row = $('td.ml,td.mm,td.mr'); this.each(function(i) { $($(this).attr('href')).hide(); $(this).click(show); }); return this; function show(e) { if (zooming) return false; zooming = true; var content_div = $($(this).attr('href')); var zoom_width = options.width; var zoom_height = options.height; var width = window.innerwidth || (window.document.documentelement.clientwidth || window.document.body.clientwidth); var height = window.innerheight || (window.document.documentelement.clientheight || window.document.body.clientheight); var x = window.pagexoffset || (window.document.documentelement.scrollleft || window.document.body.scrollleft); var y = window.pageyoffset || (window.document.documentelement.scrolltop || window.document.body.scrolltop); var window_size = {'width':width, 'height':height, 'x':x, 'y':y} var width = (zoom_width || content_div.width()) + 60; var height = (zoom_height || content_div.height()) + 60; var d = window_size; // ensure that newtop is at least 0 so it doesn't hide close button var newtop = math.max((d.height/2) - (height/2) + y, 0); var newleft = (d.width/2) - (width/2); var curtop = e.pagey; var curleft = e.pagex; zoom_close.attr('curtop', curtop); zoom_close.attr('curleft', curleft); zoom_close.attr('scaleimg', options.scaleimg ? 'true' : 'false'); $('#zoom').hide().css({ position : 'absolute', top : curtop + 'px', left : curleft + 'px', width : '1px', height : '1px' }); fixbackgroundsforie(); zoom_close.hide(); if (options.closeonclick) { $('#zoom').click(hide); } if (options.scaleimg) { zoom_content.html(content_div.html()); $('#zoom_content img').css('width', '100%'); } else { zoom_content.html(''); } $('#zoom').animate({ top : newtop + 'px', left : newleft + 'px', opacity : "show", width : width, height : height }, 500, null, function() { if (options.scaleimg != true) { zoom_content.html(content_div.html()); } unfixbackgroundsforie(); zoom_close.show(); zooming = false; }) return false; } function hide() { if (zooming) return false; zooming = true; $('#zoom').unbind('click'); fixbackgroundsforie(); if (zoom_close.attr('scaleimg') != 'true') { zoom_content.html(''); } zoom_close.hide(); $('#zoom').animate({ top : zoom_close.attr('curtop') + 'px', left : zoom_close.attr('curleft') + 'px', opacity : "hide", width : '1px', height : '1px' }, 500, null, function() { if (zoom_close.attr('scaleimg') == 'true') { zoom_content.html(''); } unfixbackgroundsforie(); zooming = false; }); return false; } function switchbackgroundimagesto(to) { $('#zoom_table td').each(function(i) { var bg = $(this).css('background-image').replace(/\.(png|gif|none)\"\)$/, '.' + to + '")'); $(this).css('background-image', bg); }); var close_img = zoom_close.children('img'); var new_img = close_img.attr('src').replace(/\.(png|gif|none)$/, '.' + to); close_img.attr('src', new_img); } function fixbackgroundsforie() { if ($.browser.msie && parsefloat($.browser.version) >= 7) { switchbackgroundimagesto('gif'); } } function unfixbackgroundsforie() { if ($.browser.msie && $.browser.version >= 7) { switchbackgroundimagesto('png'); } } }; jquery.cookie = function(name, value, options) { if (typeof value != 'undefined') { // name and value given, set cookie options = options || {}; if (value === null) { value = ''; options.expires = -1; } var expires = ''; if (options.expires && (typeof options.expires == 'number' || options.expires.toutcstring)) { var date; if (typeof options.expires == 'number') { date = new date(); date.settime(date.gettime() + (options.expires * 24 * 60 * 60 * 1000)); } else { date = options.expires; } expires = '; expires=' + date.toutcstring(); // use expires attribute, max-age is not supported by ie } // caution: needed to parenthesize options.path and options.domain // in the following expressions, otherwise they evaluate to undefined // in the packed version for some reason... var path = options.path ? '; path=' + (options.path) : ''; var domain = options.domain ? '; domain=' + (options.domain) : ''; var secure = options.secure ? '; secure' : ''; document.cookie = [name, '=', encodeuricomponent(value), expires, path, domain, secure].join(''); } else { // only name given, get cookie var cookievalue = null; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = jquery.trim(cookies[i]); // does this cookie string begin with the name we want? if (cookie.substring(0, name.length + 1) == (name + '=')) { cookievalue = decodeuricomponent(cookie.substring(name.length + 1)); break; } } } return cookievalue; } };