function searchByKeyword(){ var conditions = new Array(); var keyword = document.searchBykey.key1.value; if(keyword != null && keyword != "") conditions.push("keyword:(" + keyword + ")"); document.searchBykeyForm.queryStr.value = conditions.join(" "); //alert(document.advanceSearchForm.queryStr.value); document.searchBykeyForm.submit(); } function searchProduct(smallTypeId, filterItemCount, priceRangeCount) { var conditions = new Array(); //0. var area = document.conditionForm.area; var areaId = area.options[area.selectedIndex].value; var priceSelected = false; if(priceRangeCount > 0) { if(document.conditionForm.price.value != null && document.conditionForm.price.value != "") { priceSelected = true; } } if(priceSelected && areaId == "") { alert(''); return; } //1. queryStr //1.1 smallType(required) conditions.push("smallType:" + smallTypeId); //1.2 brand var brandSelected = false; if(document.conditionForm.brand.value != null && document.conditionForm.brand.value != "" ) { brandSelected = true; } if(brandSelected) { var fieldBrand = ":("; fieldBrand += document.conditionForm.brand.value; fieldBrand += ")"; conditions.push(fieldBrand); } //1.3 price & area if(priceSelected && areaId != "") { var fieldPrice = "price_" + areaId + ":"; if(document.conditionForm.price.value != null && document.conditionForm.price.value != "") { var values = document.conditionForm.price.value.split("-"); fieldPrice += "[" + values[0] + " TO " + values[1] + "]"; } conditions.push(fieldPrice); //conditions.push("area:(" + areaId + ")"); } if(priceSelected) document.advanceSearchForm.areaId.value = areaId; else document.advanceSearchForm.areaId.value = 100 //1.4 filter items for(var i = 0; i < filterItemCount; i++) { var kw = document.getElementById("keywordItem" + i).value; if(kw == "") continue; var itemSelected = false; var item = eval("document.conditionForm.item" + i); if(item.length != undefined) { //多于1个选项 for(var j = 0; j < item.length; j++) { if(item[j].checked) { itemSelected = true; break; } } } else { //只有1个选项 if(item.checked) itemSelected = true; } if(itemSelected) { var valueType; if(item.length != undefined) { //多于1个选项 valueType = item[0].value.split("-").length; } else { //只有1个选项 valueType = item.value.split("-").length; } var fieldItem; if(valueType == 1) { //single value fieldItem = kw + ":("; var cnt = 0; if(item.length != undefined) { //多于1个选项 for(var j = 0; j < item.length; j++) { if(item[j].checked) { if(cnt > 0) fieldItem += " OR "; fieldItem += item[j].value; cnt++; } } } else { if(item.checked) fieldItem += item.value; } fieldItem += ")"; } else { //range value //fieldItem = kw + ":"; fieldItem = kw + ":("; var cnt = 0; if(item.length != undefined) { //多于1个选项 for(var j = 0; j < item.length; j++) { if(item[j].checked) { if(cnt > 0) fieldItem += " OR "; var values = item[j].value.split("-"); fieldItem += "[" + values[0] + " TO " + values[1] + "]"; cnt++; } } } else { if(item.checked) { var values = item.value.split("-"); fieldItem += "[" + values[0] + " TO " + values[1] + "]"; } } fieldItem += ")"; } conditions.push(fieldItem); } } //1.5 keyword /*var keyword = document.conditionForm.keyword.value; if(keyword != null && keyword != "") conditions.push("keyword:(" + keyword + ")");*/ //2. 提交 document.advanceSearchForm.queryStr.value = conditions.join(" "); //alert(document.advanceSearchForm.queryStr.value); document.advanceSearchForm.submit(); } ;function PicFocus_(imageContainerID,textContainerID,buttonContainerID,intervarTime) { var a=new PicFocus(imageContainerID,textContainerID,buttonContainerID,intervarTime); a.init(); a.play(); } if(typeof PicFocusManager == "undefined") { PicFocusManager =[]; } function PicFocus(imageContainerID,textContainerID,buttonContainerID,intervarTime){ this.$ = function (id){return document.getElementById(id)} this.index = PicFocusManager.length; PicFocusManager[PicFocusManager.length] = this; this.imageContainer = this.$(imageContainerID); this.textContainer = this.$(textContainerID); this.buttonContainer = this.$(buttonContainerID); this.firstShow = 0; //默认显示项 this.interval = (isNaN(intervarTime)?0:intervarTime) || 5000; //切换时间 this.canAutoPlay = true; //是否可以自动切换 this.currentPosition = this.firstShow; this.timer; this.images = []; this.texts = []; this.buttons = []; this.callback=function(){}; this.bindEvent = function(){ var _self = this; for(var i=0;i= this.images.length)this.currentPosition =0 ; } this.timer = setTimeout('PicFocusManager[' + this.index + '].play()' , this.interval ) } this.stop = function(){ clearTimeout( this.timer ); } this.focus = function(button){ for(var i=0;i'+(typeof toc=="string"? toc.replace(/#increment/, i) : toc[i-1])+' ' } phtml=(nextprev[0]!=''? ' ' : '') + phtml + (nextprev[1]!=''? '' : '') pdiv.innerHTML=''+phtml+'' } var pdivlinks = [];//支持的触发 var pdivlink1=pdiv.getElementsByTagName("a"); var pdivlink2=pdiv.getElementsByTagName("I"); for(var i =0;isetting.contentdivs.length-1){ //if this toc link is out of range (user defined more toc links then there are contents) pdivlinks[i].style.display="none" //hide this toc link continue } pdivlinks[i].setAttribute("rel", ++toclinkscount) //store page number inside toc link pdivlinks[i][setting.revealtype]=function(){ featuredcontentslider.turnpage(setting, this.getAttribute("rel")) return false } setting.toclinks.push(pdivlinks[i]) } else if (this.css(pdivlinks[i], "prev", "check") || this.css(pdivlinks[i], "next", "check")){ //check for links with class "prev" or "next" pdivlinks[i].onclick=function(){ featuredcontentslider.turnpage(setting, this.className) return false } } } this.turnpage(setting, setting.currentpage, true) if (setting.autorotate[0]){ //当设置为自动轮换时,即 autorotate 为 true 时 pdiv[setting.revealtype]=function(){ return false } pdiv["onmouseover"]=function(){ featuredcontentslider.cleartimer(setting, window["fcsautorun"+setting.id])// onmouseover,停止自动轮换 return true } pdiv["onmouseout"]=function(){ featuredcontentslider.autorotate(setting)// onmouseout 后,继续自动轮换 return true } sliderdiv["onmouseover"]=function(){ featuredcontentslider.cleartimer(setting, window["fcsautorun"+setting.id]) return true } sliderdiv["onmouseout"]=function(){ featuredcontentslider.autorotate(setting) return true } setting.autorotate[1]=setting.autorotate[1]+(1/setting.enablefade[1]*80) //添加轮换停留时间 this.autorotate(setting) } }, urlparamselect:function(fcsid){ var result=window.location.search.match(new RegExp(fcsid+"=(\\d+)", "i")); //check for "?featuredcontentsliderid=2" in URL return (result==null)? null : parseInt(RegExp.$1); //returns null or index, where index (int) is the selected tab's index }, turnpage:function(setting, thepage, autocall){ var currentpage=setting.currentpage //定义当前 var totalpages=setting.contentdivs.length var turntopage=(/prev/i.test(thepage))? currentpage-1 : (/next/i.test(thepage))? currentpage+1 : parseInt(thepage) turntopage=(turntopage<1)? totalpages : (turntopage>totalpages)? 1 : turntopage //test for out of bound and adjust if (turntopage==setting.currentpage && typeof autocall=="undefined") //if a pagination link is clicked on repeatedly return setting.currentpage=turntopage setting.contentdivs[setting.prevpage-1].style.display="none" //collapse last content div shown (it was set to "block") setting.contentdivs[turntopage-1].style.zIndex=++setting.topzindex this.cleartimer(setting, window["fcsfade"+setting.id]) setting.cacheprevpage=setting.prevpage if (setting.enablefade[0]==true){ setting.curopacity=0 this.fadeup(setting) } if (setting.enablefade[0]==false){ //if fade is disabled, fire onChange event immediately (verus after fade is complete) setting.onChange(setting.prevpage, setting.currentpage) } setting.contentdivs[turntopage-1].style.visibility="visible" setting.contentdivs[turntopage-1].style.display="block" if (setting.prevpage<=setting.toclinks.length) //make sure pagination link exists (may not if manually defined via "markup", and user omitted) this.css(setting.toclinks[setting.prevpage-1], "selected", "remove") if (turntopage<=setting.toclinks.length) //make sure pagination link exists (may not if manually defined via "markup", and user omitted) this.css(setting.toclinks[turntopage-1], "selected", "add") setting.prevpage=turntopage if (this.enablepersist) this.setCookie("fcspersist"+setting.id, turntopage) }, setopacity:function(setting, value){ //赋予targetobject变量中的模块透明度,取值0-1之间 var targetobject=setting.contentdivs[setting.currentpage-1]; targetobject.className = "contentdiv sliderfilter";//解决黑色背景图片出现白点问题 if (targetobject.filters && targetobject.filters[0]){ //IE syntax if (typeof targetobject.filters[0].opacity=="number") //IE6 targetobject.filters[0].opacity=value*100; else //IE 5.5 targetobject.style.filter="alpha(opacity="+value*100+")"; } else if (typeof targetobject.style.MozOpacity!="undefined") //Old Mozilla syntax targetobject.style.MozOpacity=value; else if (typeof targetobject.style.opacity!="undefined") //Standard opacity syntax targetobject.style.opacity=value; setting.curopacity=value; }, fadeup:function(setting){ if (setting.curopacity<=0.95){ //当curopacity值小于或等于0.9时 this.setopacity(setting, setting.curopacity+setting.enablefade[1]) window["fcsfade"+setting.id]=setTimeout(function(){featuredcontentslider.fadeup(setting)}, 25) } else{ //当渐变已经完成,即 当curopacity值大于0.95时 this.setopacity(setting, 1); //(setting, setting.curopacity-setting.enablefade[1]); var targetobject=setting.contentdivs[setting.currentpage-1]; targetobject.className = "contentdiv"; if (setting.cacheprevpage!=setting.currentpage) //if previous content isn't the same as the current shown div (happens the first time the page loads/ script is run) setting.contentdivs[setting.cacheprevpage-1].style.display="none" //collapse last content div shown (it was set to "block") setting.onChange(setting.cacheprevpage, setting.currentpage) } }, cleartimer:function(setting, timervar){ if (typeof timervar!="undefined"){ clearTimeout(timervar); clearInterval(timervar); if (setting.cacheprevpage!=setting.currentpage){ //if previous content isn't the same as the current shown div setting.contentdivs[setting.cacheprevpage-1].style.display="none"; } } }, css:function(el, targetclass, action){ var needle=new RegExp("(^|\\s+)"+targetclass+"($|\\s+)", "ig"); if (action=="check") return needle.test(el.className); else if (action=="remove") el.className=el.className.replace(needle, ""); else if (action=="add") el.className+=" "+targetclass; }, autorotate:function(setting){ window["fcsautorun"+setting.id]=setInterval(function(){featuredcontentslider.turnpage(setting, "next")}, setting.autorotate[1]); }, getCookie:function(Name){ var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair if (document.cookie.match(re)) //if cookie found return document.cookie.match(re)[0].split("=")[1]; //return its value return null; }, setCookie:function(name, value){ document.cookie = name+"="+value; }, iframeconnect:function(setting){ //增加iframe处理事件,支持iframe的轮换,但iframe与div的相互组合目前不能完成,即轮换内容既有iframe的内容又有div的内容的时候 var ifr = document.createElement('iframe'); ifr.id='iframeconnect'+new Date().getTime(); ifr.style.display='none'; var self = this; var got = function(){ var d = ifr.contentDocument ? ifr.contentDocument : document.frames[ifr.id].document; document.getElementById(setting.id).innerHTML=d.body.innerHTML; document.body.removeChild(ifr); self.buildpaginate(setting); }; ifr.onload=got; ifr.onreadystatechange=function(){ if(this.readyState=='complete') got(); }; ifr.src = setting.contentsource[1]; document.body.insertBefore(ifr,document.body.firstChild); }, init:function(setting){ if(document.getElementById(setting.id)==null) return; //防止延迟载入js时焦点区因独占广告而删除 var persistedpage=this.getCookie("fcspersist"+setting.id) || 1; var urlselectedpage=this.urlparamselect(setting.id); //returns null or index from: mypage.htm?featuredcontentsliderid=index this.settingcaches[setting.id]=setting; //存储 "setting" 对象 setting.contentdivs=[]; setting.toclinks=[]; setting.topzindex=0; setting.currentpage=urlselectedpage || ((this.enablepersist)? persistedpage : 1);//默认显示模块 setting.prevpage=setting.currentpage; setting.revealtype="on"+(setting.revealtype || "click"); setting.curopacity=0; setting.onChange=setting.onChange || function(){}; if (setting.contentsource[0]=="inline")//直接页面调用div this.buildpaginate(setting); if (setting.contentsource[0]=="ajax")//调用外部utf-8页面内容 this.ajaxconnect(setting); if (setting.contentsource[0]=="iframe")//调用外部页面内容,主要以iframe形式获取,获取iframe内标签,主要解决非utf-8的内容 this.iframeconnect(setting); } }