/* NO JQuery
function bj_closeErrors() { 
return true; 
} 
window.onerror=bj_closeErrors;
document.domain = 'bbboo.com'; */
/*if (top.location !== self.location) {
    top.location=self.location;
}*/
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);
var bj_i='i.3b2o.com';
var bj_active='http://active.3b2o.com:8090/';
function $$(item){
return document.getElementById(item);
}
function showHide(showID){
if(showID != null){
if(document.getElementById(showID).style.display == "none"){
document.getElementById(showID).style.display = "block";
}else{
document.getElementById(showID).style.display = "none";
}
}
return false;
}
function copyToClipboard(theField, message){
var tempval=$(theField);
if ($.browser.msie){
tempval.select();
window.clipboardData.setData("Text", tempval.val());
if(message!=false)
alert(message);
return;
}else{
alert("您使用的浏览器不支持此复制功能，请使用Ctrl+C或鼠标右键。");
tempval.select();
}
}
/* 顶部导航的效果 */
function bj_topMenu(){
var c=$$("bj_nav");
var m=c.getElementsByTagName("li")
var miL=m.length;
for (var i = 0; i < miL; i++) {
if (m[i].innerHTML.indexOf('ul>')!=-1 || m[i].innerHTML.indexOf('UL>')!=-1){
m[i].onmouseover = function() {
this.className = "hover";
}
m[i].onmouseout = function() {
this.className = "";
}
}
}
}
function bj_addFavorite(){
    var surl=window.location.href;
    var stitle=window.document.title;
    if (document.all){
        window.external.addFavorite(surl, stitle);
    } 
    else if (window.sidebar){
        window.sidebar.addPanel(stitle, surl, "");
    }
}
function bj_count(){
var a4796tf = "51la";
var a4796pu = "";
var a4796pf = "51la";
var a4796su = window.location;
var a4796sf = document.referrer;
var a4796of = "";
var a4796op = "";
var a4796ops = 1;
var a4796ot = 1;
var a4796d = new Date();
var a4796color = "";
if (navigator.appName == "Netscape") {
a4796color = screen.pixelDepth;
} else {
a4796color = screen.colorDepth;
}
try {
a4796tf = top.document.referrer;
} catch(e) {}
try {
a4796pu = window.parent.location;
} catch(e) {}
try {
a4796pf = window.parent.document.referrer;
} catch(e) {}
try {
a4796ops = document.cookie.match(new RegExp("(^| )AJSTAT_ok_pages=([^;]*)(;|$)"));
a4796ops = (a4796ops == null) ? 1 : (parseInt(unescape((a4796ops)[2])) + 1);
var a4796oe = new Date();
a4796oe.setTime(a4796oe.getTime() + 60 * 60 * 1000);
document.cookie = "AJSTAT_ok_pages=" + a4796ops + ";path=/;expires=" + a4796oe.toGMTString();
a4796ot = document.cookie.match(new RegExp("(^| )AJSTAT_ok_times=([^;]*)(;|$)"));
if (a4796ot == null) {
a4796ot = 1;
} else {
a4796ot = parseInt(unescape((a4796ot)[2]));
a4796ot = (a4796ops == 1) ? (a4796ot + 1) : (a4796ot);
}
a4796oe.setTime(a4796oe.getTime() + 365 * 24 * 60 * 60 * 1000);
document.cookie = "AJSTAT_ok_times=" + a4796ot + ";path=/;expires=" + a4796oe.toGMTString();
} catch(e) {}
a4796of = a4796sf;
if (a4796pf !== "51la") {
a4796of = a4796pf;
}
if (a4796tf !== "51la") {
a4796of = a4796tf;
}
a4796op = a4796pu;
try {
lainframe
} catch(e) {
a4796op = a4796su;
}
$('#bj_count').html('<a href="http://www.51.la/?524796" target="_blank"><img alt="&#x6211;&#x8981;&#x5566;&#x514D;&#x8D39;&#x7EDF;&#x8BA1; VIP &#x7528;&#x6237;" src="http://icon.ajiang.net/icon_8.gif" style="border:none" /></a>\n<img style="width:0px;height:0px" src="http://vip.51.la:82/go.asp?svid=2&id=524796&tpages=' + a4796ops + '&ttimes=' + a4796ot + '&tzone=' + (0 - a4796d.getTimezoneOffset() / 60) + '&tcolor=' + a4796color + '&sSize=' + screen.width + ',' + screen.height + '&referrer=' + escape(a4796of) + '&vpage=' + escape(a4796op) + '" />');
}

function bj_tabs(p){
this.p = p;
for(var i=0;i<this.p.num;i++){
$$(this.p.tabs+i).onmouseover = function(){
alert(i);
return;
bj_tabs.hover(i);
}
}

this.hover=function(n){
//将所有重置为没有样式
for(var i=0;i<this.p.num;i++){$$(this.p.tabs+toString(i)).className='taboff';}
for(var i=0;i<this.p.num;i++){$$(this.p.content+toString(i)).style.display='none';}
//给当前活动增加样式
$$(this.p.tabs+n).className='tab';
$$(this.p.content+n).style.display='block';
}
}
function bj_searchNav(a,e){
if (a==1){
if($$('nav_search_input').value!=''){
bj_searchNav(5);
}
}
else if(a==2){
}
//关闭
else if(a==3){
//$$('nav_sajax').style.display='none';
}
else if(a==4){
}
else if(a==5){
return;
var keyword = $$('nav_search_input').value;
url = 'http://v.bbboo.com/php/video/ajax.php';
data = {action: 'search', keyword: keyword};
$.ajax({
type: "POST",
url: url,
data: data,
success: function(json){
alert(json);
},
dataType: 'json'
});
}
else if(a==6){
if ($$('nav_search_input').value=='' || $$('nav_search_input').value=='关键字'){
alert('请输入关键字');
return false;
}
if ($$('nav_search_type').value=='bbs'){
self.location='http://www.baidu.com/s?tn=jobbr88&ie=utf-8&ct=2097152&si=bbs.bbboo.com&wd='+$$('nav_search_input').value;
}
else if ($$('nav_search_type').value=='all'){
self.location='http://www.baidu.com/s?tn=jobbr88&ie=utf-8&ct=2097152&si=bbboo.com&wd='+$$('nav_search_input').value;
}
else{
self.location='http://v.bbboo.com/q/'+$$('nav_search_input').value+'/';
}
return false;
}
}
function side_photo_init(tag){
var list = $('#'+tag+' li');
list.each(function(i){
nophoto = $('.text', $(this)).html();
$('.show', $(this)).css('display', 'none');
$(this).html('<div class="show_text" onmouseover="side_photo_show('+i+',\''+tag+'\');">'+nophoto+'</div>'+$(this).html());
if(i==0){
$('.show', $(this)).css('display', 'block');
$('.show_text', $(this)).css('display', 'none');
}
});
}
//图片列表
function side_photo_show(now, tag){
var list = $('#'+tag+' li');
list.each(function(i){
if(now==i){
$('.show', $(this)).css('display', 'block');
$('.show_text', $(this)).css('display', 'none');
}
else{
$('.show', $(this)).css('display', 'none');
$('.show_text', $(this)).css('display', 'block');
}
});
}
//显示tabs
function bj_areaTabs(node){
var tab_div = $("#"+node);
var tabs = $('.tabs li', tab_div);
var contents = $('.c', tab_div);
var l=tabs.length;
if (l != contents.length){
return;
}
tabs.each(function(i){
$(this).hover(function(){
var c=i;
for(var j=0;j<l;j++){
if (j==c){
tabs[j].className='hover';
contents[j].style.display='block';
}
else{
tabs[j].className='';
contents[j].style.display='none';
}
}
});
});
}
//本行变色
function mover(src,clrover){ 
src.style.backgroundColor = clrover; 
}
function mout(src,clrout)  { 
src.style.backgroundColor = ''; 
}
//取得联动表单
function bj_getAjaxSelect(from, to, url){
$('#'+from).change(function(){
data = {para: $('#'+from).val()};
$.ajax({
type: "POST",
url: url,
data: data,
success: function(j){
$('#'+to).empty();
var oh = '';
for(i = 0; i < j.length; i++){
oh += '<option value="'+j[i].id+'">'+j[i].name+'</option>';
}
$('#'+to).html(oh);
}, 
dataType: 'json'
});
});
}

function bj_comment(i, n){
this.item=i;
this.num=n || 20;
this.page=1;
this.show=function(p){
this.page=p || 1;
var num=this.num;
var page=this.page;
    $.getScript(bj_active+'php/comment/ajax.php?action=get&item='+this.item+'&page='+this.page+'&jsonp=comment.show_jsonp&num='+this.num+'&t='+new Date().getTime());
}
this.show_jsonp=function(j){
var num=this.num;
var page=this.page;
var html = '';
/*html += '<div class="content">||--近日广告太过疯狂，本站暂时停止评论功能--||</div>';*/
if(j.count==0){
html += '<div class="content">||--还没有人发表评论哦，快抢沙发吧--||</div>';
}
else{
var htmlcount='<div class="page">';
if(page*num>=j.count){
var islast=true;
}
else{
var islast=false;
}
if(page==1){
var isfrist=true;
}
else{
var isfrist=false;
}
htmlcount+='<div class="nn">第'+((page-1)*num+1)+'-'+(islast ? j.count : page*num)+'条 ';
htmlcount+='共'+j.count+'条</div><div class="pp">';
if (!isfrist){
htmlcount+='<a href="javascript:comment.show('+(page-1)+')">上页</a> ';
}
if (!islast){
htmlcount+='<a href="javascript:comment.show('+(page+1)+')">下页</a>';
}
htmlcount+='</div><div class="clear"></div></div>';
html+=htmlcount;
for (var i=0;i<j.c.length;i++){
html+='<div class="usertime"><span>'+j.c[i].user_name+'</span> 发表于'+j.c[i].timepast+'</div>';
html+='<div class="content">'+j.c[i].content+'</div>';
}
html+=htmlcount;
}
$('#comment_list').html(html);
}
this.post=function(){
var commentUrl = bj_active+'php/comment/ajax.php?action=post&item='+this.item+'&num='+this.num;
commentUrl += '&comment_content='+$$('comment_content').value;
commentUrl += '&comment_user='+$$('comment_user').value;
commentUrl += '&t='+new Date().getTime();
    $.getScript(commentUrl);
/*var url='/php/comment/ajax.php?action=post&item='+this.item+'&num='+this.num+'';
if ($$('comment_content').value.length < 5){
alert('评论内容太短，是不是又灌水了……不能少于五个汉字。');
return false
}
if ($$('comment_content').value.length > 200){
alert('评论内容太长了，不能多于200个汉字…');
return false;
}
var user_name = $$('comment_user').value;
if (user_name.length == 0 || user_name == '请输入用户名'){
alert('请输入用户名');
$('#comment_user').focus();
return false
}
var hanzi;
if (hanzi=user_name.match(/[^x00-xff]/g)){
if ((user_name.length+hanzi.length) > 12){
alert('用户名太长，请输入6个以内的汉字或者12个以内的英文字母。');
return false;
}
}
else{
if (user_name.length > 12){
alert('用户名太长，请输入6个以内的汉字或者12个以内的英文字母。');
return false;
}
}
var content=$$('comment_content').value;
var commentdata={comment_content: content, comment_user: user_name,num:this.num};
alert('近日广告太过疯狂，本站暂停评论功能。');
return;
$.post(url, commentdata, function(d){
if (d == 1){
alert('恭喜您，发表评论成功。');
comment.show();
}
else if(d == -4){
alert('您发帖太频繁啦，30秒限发一个评论：）');
}
});*/
}
}

function dw(str){
    document.write(str);
}

function drawdiv(para){
    return '<div style="'+para.style+'">'+para.content+'<div class="clear"></div></div>';
}

function drawimg(para){
    var html = '';
    if (para.type=='swf')
    {
        html += '<div style="position:relative;width:'+para.width+';height:'+para.height+'px;'+para.style+'px;float:left;">';
        html += '<a target="_blank" href="'+para.href+'" style="position:absolute;top:0;left:0;bottom:0;right:0;display:block;width:100%;height:expression(this.parentNode.scrollHeight);filter:alpha(opacity=0);opacity:0;background:#FFF;"></a>';
        html += '<object id="BAIDU_CLB_FLASH1324176064405" height="'+para.height+'" align="middle" width="'+para.width+'" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">';
        html += '<param value="never" name="allowScriptAccess">';
        html += '<param value="high" name="quality">';
        html += '<param value="transparent" name="wmode">';
        html += '<param value="'+para.src+'" name="movie">';
        html += '<embed height="'+para.height+'" align="middle" width="'+para.width+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowscriptaccess="never" quality="high" src="'+para.src+'" name="BAIDU_CLB_FLASH_N1324176064405" wmode="transparent">';
        html += '</object>';
        html += '</div>';
    }
    else {
        para.style+='height:'+para.height+'px;width:'+para.width+'px;'
        html += '<a href="'+para.href+'" target="_blank" style="display:block;float:left;'+para.style+'">';
        html += '<img src="'+para.src+'" style="height:'+para.height+'px;width:'+para.width+'px;"></a>';
    }
    return html;
}

function drawad(para){
    var html = ''; 
    for(img in para.imgs){
        html += drawimg(para.imgs[img]);
    }   
    var divpara = {"style":para.div.style,"content":html}
    return drawdiv(divpara);
}

function drawtext(para){
    var html = '<a href="'+para.href+'" target="_blank"';
    if (para.style){html += ' style="'+para.style+'"';}
    html += '>'+para.text+'</a>';
    return html;
}

