<script>
var checkFormReqs =function(e){
e = new Event(e);
var _form= $(e.target);
var reqs = $$(_form.getElements('input[type=text]'),_form.getElements('textarea'));
if(reqs.some(function(req){
if(!req.get('required')&&!req.get('vtype').contains('required'))return;
if(req.getValue().trim()==''){
req.focus();
MessageBox.error('请完善表单必填项*');
return true;
}
return false;
})){
e.stop();
}
};
</script>
<script>
$$('.addcomment .title input').addEvents({
'focus':function(){this.removeClass('blur');},
'blur':function(){this.addClass('blur');}
});
</script>
<script>
var buycoutText=$E('#goods-viewer .buyinfo input[type=text]').addEvent('keydown',function(e){
if($A(keyCodeFix).include(e.code).length>25){
e.stop();
}
});
var getStore=function(){
return $E('#goods-viewer .buyinfo .store').get('text').toInt()
};
buycoutText.addEvent('keyup',function(e){
if(getStore()
<script>
window.addEvent('domready',function(){
/*快速购买*/
var fastbuyBtn = $E('#goods-viewer .btn-fastbuy');
if(fastbuyBtn){
fastbuyBtn.addEvent('click',function(e){
e.stop();
this.blur();
var form = $('fastbuy-form');
form.empty().adopt($(this.form).toQueryString().toFormElements());
form.adopt(new Element('input', {name:'isfastbuy',value:1,type:'hidden'}));
if(!form.retrieve('events',{})['submit'])return form.submit();
form.fireEvent('submit',e);
});
}
});
</script>
<script>
/*设置浏览过的商品*/
withBroswerStore(function(broswerStore){
broswerStore.get('history',function(history){
history=JSON.decode(history);
if(!history||$type(history)!=='array')history=[];
if(history.length==40);
var newhis={'goodsId':14922,
'goodsName':'三星(SAMSUNG)Galaxy SIII I9300 3G手机(宝石红)',
'goodsImg':'http://needw.com/images/goods/20120923/7b9dc7cfdb2b54e0.jpg',
'viewTime':$time()
};
if(!history.some(function(i,index){
if(i['goodsId']==newhis['goodsId']){
history.erase(i);
history.include(newhis)
return true;
}
return false;
})){
history.include(newhis);
}
broswerStore.set('history',history);
});
});
window.addEvent('domready', function(){
/*Tab的处理*/
try{
var viewTabsContainer=$E('#goods-viewer .goods-detail-tab');
var viewTabs=[];
var viewSections=$$('#goods-viewer .section');
viewSections.each(function(se){
var t=new Element('div',{'class':'goodsDetailTab'}).set('html',''+se.get('tab')+'');
viewTabs.push(t);
});
viewTabsContainer.adopt(viewTabs);
new ItemAgg(viewTabs,viewSections,{activeName:'active',
onActive:function(tab,item){
var anotherItems=$$($A(this.items).remove(item));
if(tab.getElement('span').get('text')=='商品详情'){
anotherItems.show();
}else{
anotherItems.hide();
}
}});
}catch(e){}
});
/*验证码刷新*/
function changeimg(id,type){
$(id).set('src','?passport-'+type+'-verifyCode.html#'+$time());
};
</script>
<script type=text/javascript src="http://needw.com/statics/script/goodscupcake.js"></script>