var userAgent = navigator.userAgent.toLowerCase(); var is_opera = userAgent.indexOf('opera') != -1 && opera.version(); var is_moz = (navigator.product == 'Gecko') && userAgent.substr(userAgent.indexOf('firefox') + 8, 3); var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera) && userAgent.substr(userAgent.indexOf('msie') + 5, 3); function S(a,d){try{return(d||window).document.getElementById(a);}catch(c){return null;}} var gIEVer=""; if(is_ie){ var reIE=new RegExp("MSIE (\\d+\\.\\d+);","i"); reIE.test(navigator.userAgent); gIEVer=parseFloat(RegExp["$1"]); } function addClass(ob, cc) { if(ob) { var c = ob.className; if(c == "") { ob.className = cc; return; } var a = c.split(c); var l = a.length; var has_c = false; for(var i = 0; i < l; i++) { if(a[i] == cc) { has_c = true; break; } } if(!has_c) { ob.className += " " + cc; } } } function removeClass(ob, cc) { if(ob) { var c = ob.className; if(c == "") { return; } var a = c.split(" "); var l = a.length; var has_c = false; for(var i = 0; i < l; i++) { if(a[i] == cc) { has_c = true; break; } } if(has_c) { a.splice(i, 1); ob.className = a.join(" "); } } } function hasClass(ob, className) { if(ob) { var E=ob.className; if(E.length==0){ return false; } if(E==className||E.match(new RegExp("(^|\\s)"+className+"(\\s|$)"))){ return true; } return false } return false; } //缩放 function resizeImage(img, width) { var image=new Image(); image.src=img.src; var temp = image.width; img.width = temp = (temp>width)?width:temp; img.style.display = "inline"; } function resizeImageInIE6(img, width) { if(gIEVer == "6") { //ie 6中,css中没有max-width属性,所以用此方法代替下 resizeImage(img, width); } } function showError(text) { if($("show_info")) { $("show_info").style.display = "none"; $("e_info").className = "r2"; $("e_info").innerHTML = text; $("show_info").style.display = ""; go_top(); setTimeout('$("show_info").style.display = "none"', 3000); } } function showSuccess(text) { if($("show_info")) { $("show_info").style.display = "none"; $("e_info").className = "r2_2"; $("e_info").innerHTML = text; $("show_info").style.display = ""; setTimeout('$("show_info").style.display = "none"', 3000); } } function go_top() { document.documentElement.scrollTop = 0; } function getscrollTop(){ if(typeof window.pageYOffset!='undefined'){ return window.pageYOffset; }else if(typeof document.compatMode!='undefined'&&document.compatMode!='BackCompat'){ return document.documentElement.scrollTop; }else if(typeof document.body!='undefined'){ return document.body.scrollTop } } function get_post_par() { var e = document.getElementsByName("pp[]"); var l = e.length; var s = ""; for(var i = 0; i < l; i++) { if(e[i].checked) { s += e[i].value + ","; } } return s; } function Trim(sStr) { return sStr.replace(/(^\s*)|(\s*$)/ig,""); } function shop_is_number(val) { var reg = /^[\d|\.|,]+$/; return reg.test(val); } function rowindex(tr) { if (Browser.isIE) { return tr.rowIndex; } else { table = tr.parentNode.parentNode; for (i = 0; i < table.rows.length; i ++ ) { if (table.rows[i] == tr) { return i; } } } } function can_only_digital(a, zs){ pre=""; v=a.value; kc=parseInt(v); if(isNaN(kc)){ kc=""; } kc=pre+kc; if(zs && kc.substring(0, 1) == "0") { kc = ""; } a.value=kc; } String.prototype.ReplaceAll = function(stringToFind,stringToReplace) { var result = this; var index = result.indexOf(stringToFind); while(index != -1){ result = result.replace(stringToFind,stringToReplace); index = result.indexOf(stringToFind); } return result; } function showFailDialog(a){alert(a);} function resizeImage(c,d){var e=new Image();e.src=c.src;var a=e.width;c.width=a=(a>d)?d:a;c.style.display="inline";}function resizeImageInIE6(a,c){resizeImage(a,c);} function fetchOffset(d){ var c=d.offsetLeft; //alert(c); var a=d.offsetTop; while((d=d.offsetParent)!=null){ c+=d.offsetLeft; a+=d.offsetTop; } return{left:c,top:a}; } function isUndefined(a){return typeof a=="undefined"?true:false;} function setMenuPosition(a,d,c){ if(isUndefined(c)){ c=0; } if(a){ if(c == 0) { a.pos=fetchOffset(a); //alert(a.pos.left); a.X=a.pos.left; a.Y=a.pos.top; a.w=a.offsetWidth; a.h=a.offsetHeight; d.w=d.offsetWidth; d.h=d.offsetHeight; if(c == 0){ d.style.left=(a.X+d.w>document.documentElement.clientWidth)&&(a.X+a.w-d.w>=0)?a.X+a.w-d.w+"px":a.X+"px"; d.style.top=c==1?a.Y+"px":(c==2||((a.Y+a.h+d.h>document.documentElement.scrollTop+document.documentElement.clientHeight)&&(a.Y-d.h>=0))?(a.Y-d.h)+"px":a.Y+a.h+"px"); }else if(c==-1){ d.style.left=(document.documentElement.clientWidth-d.w)/2+"px"; var e=document.documentElement.scrollTop+(document.documentElement.clientHeight-d.h)/2; if(e>100){ e=e-100; } d.style.top=e+"px"; } } else { //alert(d.scrollWidth); //alert(d.style.left); //var aa = c.split(","); var w = parseInt(d.scrollWidth); var h = parseInt(d.scrollHeight); if(h > 500) { h = 500; } var pos = mad_DialogLoc(w, h); d.style.left = pos.left + "px"; d.style.top = pos.top + "px"; } if(d.style.clip&&!is_opera){ d.style.clip="rect(auto, auto, auto, auto)"; } } } function mad_mask_menu(event, href, func) { mad_menu(event, "append_parent", -1, 1000000, func, href); } function mad_getscrollTop(){ if(typeof window.pageYOffset!='undefined'){ return window.pageYOffset; }else if(typeof document.compatMode!='undefined'&&document.compatMode!='BackCompat'){ return document.documentElement.scrollTop; }else if(typeof document.body!='undefined'){ return document.body.scrollTop; } } function mad_DialogLoc(width, height){ var dde = document.documentElement; if (window.innerWidth){ var ww = window.innerWidth; var wh = window.innerHeight; var bgX = window.pageXOffset; var bgY = window.pageYOffset; }else{ var ww = dde.offsetWidth; var wh = dde.offsetHeight; var bgX = dde.scrollLeft; var bgY = dde.scrollTop; } var bgY = mad_getscrollTop(); var t_DiglogX = parseInt((bgX + ((ww - width)/2))); var t_DiglogY = parseInt((bgY + ((wh - height)/2))); //var t_DiglogX = parseInt((bgX + ((ww - t_DiglogW)/2))); //var t_DiglogY = parseInt((bgY + ((wh - t_DiglogH)/2))); return {left:t_DiglogX, top:t_DiglogY}; } function do_loading(a){if(S(a)){S(a).innerHTML='
';S(a).style.display="";}} function doane(event) { e = event ? event : window.event; if(is_ie) { e.returnValue = false; e.cancelBubble = true; } else if(e) { e.stopPropagation(); e.preventDefault(); } } function mad_ajax(method,urlstr,postDatastr,callback){ var http_5617=null; msxml_progid=['MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP']; try{ http_5617=new XMLHttpRequest(); }catch(e){ for(var i=0;i 0) { //循环到最低级分类 for(var i = 1; ; i++) { cat_str = cat_pid_str + i; if($(cat_str)) { cat_industry = parseInt($(cat_str).value); if(cat_industry <= 0) { //此处没有选择 cat_industry = c_value; break; } } else { break; } c_value = cat_industry; } } if(isNaN(cat_industry)) { //未选择任何分类时 cat_industry = 0; } return cat_industry; } function mad_oho_adjust() { try{ content_down(0); getcontop(); adjust_center_bd(); } catch(e) { } } function mad_oho_adjust_start(g_mad_block_id) { try{ if(typeof g_mad_block_id != "undefined" && g_mad_block_id != "") { $_sH(g_mad_block_id); } } catch(e) { } } function mad_oho_adjust_end(g_mad_block_id) { try{ if(typeof g_mad_block_id != "undefined" && g_mad_block_id != "") { $_eH(g_mad_block_id); } } catch(e) { } } var jsmenu = new Array(); var ctrlobjclassName; jsmenu['active'] = new Array(); jsmenu['timer'] = new Array(); jsmenu['iframe'] = new Array(); function initCtrl(ctrlobj, click, duration, timeout, layer) { if(ctrlobj && !ctrlobj.initialized) { ctrlobj.initialized = true; ctrlobj.unselectable = true; ctrlobj.outfunc = typeof ctrlobj.onmouseout == 'function' ? ctrlobj.onmouseout : null; ctrlobj.onmouseout = function() { if(this.outfunc) this.outfunc(); if(duration < 3) jsmenu['timer'][ctrlobj.id] = setTimeout('hideMenu(' + layer + ')', timeout); } ctrlobj.overfunc = typeof ctrlobj.onmouseover == 'function' ? ctrlobj.onmouseover : null; ctrlobj.onmouseover = function(e) { doane(e); if(this.overfunc) this.overfunc(); if(click) { clearTimeout(jsmenu['timer'][this.id]); } else { for(var id in jsmenu['timer']) { if(jsmenu['timer'][id]) clearTimeout(jsmenu['timer'][id]); } } } } } function initMenu(ctrlid, menuobj, duration, timeout, layer, drag) { if(menuobj && !menuobj.initialized) { menuobj.initialized = true; menuobj.ctrlkey = ctrlid; menuobj.onclick = ebygum; menuobj.style.position = 'absolute'; if(duration < 3) { if(duration > 1) { menuobj.onmouseover = function() { clearTimeout(jsmenu['timer'][ctrlid]); } } if(duration != 1) { menuobj.onmouseout = function() { jsmenu['timer'][ctrlid] = setTimeout('hideMenu(' + layer + ')', timeout); } } } menuobj.style.zIndex = 50; if(is_ie) { //menuobj.style.filter += "progid:DXImageTransform.Microsoft.shadow(direction=135,color=#CCCCCC,strength=2)"; } if(drag) { menuobj.onmousedown = function(event) {try{menudrag(menuobj, event, 1);}catch(e){}}; document.body.onmousemove = function(event) {try{menudrag(menuobj, event, 2);}catch(e){}}; menuobj.onmouseup = function(event) {try{menudrag(menuobj, event, 3);}catch(e){}}; } } } var menudragstart = new Array(); function menudrag(menuobj, e, op) { //alert(menuobj.id); if(op == 1) { var oo = is_ie ? event.srcElement : e.target; if(in_array(oo.tagName, ['TEXTAREA', 'INPUT', 'BUTTON', 'SELECT'])) { return; } else if(oo.id == menuobj.id) { return; } menudragstart = is_ie ? [event.clientX, event.clientY] : [e.clientX, e.clientY]; menudragstart[2] = parseInt(menuobj.style.left); menudragstart[3] = parseInt(menuobj.style.top); doane(e); } else if(op == 2 && menudragstart[0]) { var menudragnow = is_ie ? [event.clientX, event.clientY] : [e.clientX, e.clientY]; menuobj.style.left = (menudragstart[2] + menudragnow[0] - menudragstart[0]) + 'px'; menuobj.style.top = (menudragstart[3] + menudragnow[1] - menudragstart[1]) + 'px'; doane(e); } else if(op == 3) { menudragstart = []; doane(e); } } var mad_maskDiv=null; function mad_showmask(){ if(mad_maskDiv==null||!mad_maskDiv){ mad_maskDiv=document.createElement("span"); //mad_maskDiv.style.cssText="position:absolute;top:0px;left:0px;"; if(is_ie) { mad_maskDiv.style.cssText="position:absolute;top:0px;left:0px;background-color:#999;filter:alpha(opacity=50);z-index:49;"; } else { mad_maskDiv.style.cssText="position:absolute;top:0px;left:0px;background-color:#999;opacity:0.5;z-index:49;"; } mad_maskDiv.style.height=mad_getscrollHeight() + "px"; mad_maskDiv.style.width=document.documentElement.clientWidth + "px"; document.body.appendChild(mad_maskDiv); //alert(mad_maskDiv.style.height + "-" + mad_maskDiv.style.width); } } function mad_closeMaskDiv(){ if(mad_maskDiv==null)return; //mad_maskDiv.innerHTML=''; document.body.removeChild(mad_maskDiv); mad_maskDiv = null; } function mad_getscrollHeight(){ //alert(document.body.scrollHeight + "-" + document.documentElement.clientHeight); if(document.documentElement.scrollHeight>document.documentElement.clientHeight){ return document.documentElement.scrollHeight; }else{ return document.documentElement.clientHeight; } }; function showMenu(ctrlid, click, offset, duration, timeout, layer, showid, maxh, drag) { var ctrlobj = $(ctrlid); if(!ctrlobj) return; if(isUndefined(click)) click = false; if(isUndefined(offset)) offset = 0; if(isUndefined(duration)) duration = 2; if(isUndefined(timeout)) timeout = 500; if(isUndefined(layer)) layer = 0; if(isUndefined(showid)) showid = ctrlid; var showobj = $(showid); var menuobj = $(showid + '_menu'); if(!showobj|| !menuobj) return; if(isUndefined(maxh)) maxh = 400; if(isUndefined(drag)) drag = false; if(jsmenu['active'][layer] == menuobj) { hideMenu(layer); return; } else { //hideMenu(layer); } //停止所有的hidemenu timeout var len = jsmenu['timer'].length; if(len > 0) { for(var i=0; i maxh) { //menuobj.style.paddingRight = "20px"; v = maxh; } //alert(v); menuobj.style.height = v + 'px'; menuobj.style.overflowX = 'hidden'; if(is_opera) { menuobj.style.overflow = 'auto'; } else { menuobj.style.overflowY = 'auto'; } */ if(!duration) { setTimeout('hideMenu(' + layer + ')', timeout); } jsmenu['active'][layer] = menuobj; //return; } function hideMenu(layer, no_hide) { if(isUndefined(no_hide)) { //默认要隐藏掉遮罩,但有时不需要隐藏 try{mad_closeMaskDiv();} catch(e){} } if(isUndefined(layer)) layer = 0; if(jsmenu['active'][layer]) { try { $(jsmenu['active'][layer].ctrlkey).className = ctrlobjclassName; } catch(e) {} clearTimeout(jsmenu['timer'][jsmenu['active'][layer].ctrlkey]); jsmenu['active'][layer].style.display = 'none'; if(is_ie && is_ie < 7 && jsmenu['iframe'][layer]) { jsmenu['iframe'][layer].style.display = 'none'; } jsmenu['active'][layer] = null; } } function ebygum(eventobj) { if(!eventobj || is_ie) { window.event.cancelBubble = true; return window.event; } else { if(eventobj.target.type == 'submit') { eventobj.target.form.submit(); } eventobj.stopPropagation(); return eventobj; } } function mad_clear_menu(ctrlid) { var div = $(ctrlid + '_menu'); if(div) { div.innerHTML = ""; } } function mad_menu(e, ctrlid, offset, timeout, func, href_link, layer) { if(document.all && (document.readyState != "complete")) {return;} var box = 0; if(jsmenu['active'][0] && jsmenu['active'][0].ctrlkey == ctrlid) { hideMenu(); doane(e); return; } else if(is_ie && is_ie < 7 && document.readyState.toLowerCase() != 'complete') { return; } cache = 0; divclass = 'popupmenu_popup'; optionclass = 'popupmenu_option'; if(isUndefined(timeout)) timeout = 1000000; if(isUndefined(func)) func = ''; if(isUndefined(offset)) offset = 0; if(isUndefined(layer)) layer = 0; if(isUndefined(e) || e == null || e == '') { et = true; } else { et = (e.type == 'click') ? true : false;; } duration = timeout > 10000 ? 3 : 0; executetime = duration ? 2000: timeout; if(offset != 0) { divclass = 'popupmenu_centerbox'; box = 1; } var div = $(ctrlid + '_menu'); if(cache && div) { if(offset != 0) { mad_showmask(); } showMenu(ctrlid, et, offset, duration, timeout, layer, ctrlid, 500, 1); //if(func) setTimeout(func + '(' + ctrlid + ')', executetime); if(func) setTimeout(func + '(' + ctrlid + ')', 0); doane(e); } else { mad_showloading(''); if(!div) { div = document.createElement('div'); div.ctrlid = ctrlid; div.id = ctrlid + '_menu'; div.style.display = 'none'; //div.innerHTML = '
'; div.className = divclass; $('append_parent').appendChild(div); } //var x = new Ajax(); var href = (!isUndefined(href_link) && (href_link != "")) ? href_link : (!isUndefined($(ctrlid).href) ? $(ctrlid).href : $(ctrlid).attributes['href'].value); href += "×tamp=" + new Date().getTime(); //alert(href); startRequest("POST", href, "", function(r){set_ajax_menu(r, e, div, optionclass, ctrlid, offset, duration, timeout, layer, et, func, executetime);}); } } function set_ajax_menu(r, e, div, optionclass, ctrlid, offset, duration, timeout, layer, et, func, executetime) { mad_showloading('none'); mad_evalscript(r); if(div) { //alert(r); div.innerHTML = '
' + r + '
'; } if(offset != 0) { mad_showmask(); } showMenu(ctrlid, et, offset, duration, timeout, layer, ctrlid, 500, 1); if(func) { //alert(func); //Init_option_1(); //alert(func); //setTimeout(func + '("' + ctrlid + '")', executetime); setTimeout(func + '("' + ctrlid + '")', 0); } doane(e); } function insertContent(c,d){ var b=S(c); selection=document.selection; checkFocus(c); if(!isUndefined(b.selectionStart)){ var e=b.selectionStart+0; b.value=b.value.substr(0,b.selectionStart)+d+b.value.substr(b.selectionEnd); }else{ if(selection&&selection.createRange){ var a=selection.createRange(); a.text=d; }else{ b.value+=d; } } } function checkFocus(b){var a=S(b);if(!a.hasfocus){a.focus();}} function mad_attach_event(obj, evt, func, eventobj) { eventobj = !eventobj ? obj : eventobj; if(obj.addEventListener) { obj.addEventListener(evt, func, false); } else if(eventobj.attachEvent) { obj.attachEvent("on" + evt, func); } } function mad_stringxor(s1, s2) { var s = ''; var hash = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; var max = Math.max(s1.length, s2.length); for(var i=0; i]*?src=\"([^\>]*?)\"[^\>]*?(reload=\"1\")?(?:charset=\"([\w\-]+?)\")?><\/script>/ig; var arr = new Array(); while(arr = p.exec(s)) { //alert(arr[1]); mad_appendscript(arr[1], '', arr[2], arr[3]); } p = /