$('#div_templates_best_jquery').cycle({
    fx:    'scrollLeft', //blindX, blindY, blindZ, cover, curtainX, curtainY, fade, fadeZoom, growX, growY, scrollUp, scrollDown, scrollLeft, scrollRight, scrollHorz, scrollVert, shuffle, slideX, slideY, toss, turnUp, turnDown, turnLeft, turnRight, uncover, wipe, zoom
	speed:  'fast', //fast, 1000
	timeout:'10000'
});
$('#div_templates_today_jquery').cycle({
	fx:     'fade',
	speed:  '2000',
	timeout:'13000',
	pager:  '#nav'
});
$('#div_templates_banner_center_01_jquery').cycle({
    fx:    'scrollUp', //blindX, blindY, blindZ, cover, curtainX, curtainY, fade, fadeZoom, growX, growY, scrollUp, scrollDown, scrollLeft, scrollRight, scrollHorz, scrollVert, shuffle, slideX, slideY, toss, turnUp, turnDown, turnLeft, turnRight, uncover, wipe, zoom
	speed: 'fast', //fast, 1000
	timeout:'8000'
});
$('#div_templates_end_jquery').cycle({
	fx:     'scrollHorz',
	speed:  '500',
	timeout:'16000',
	next:   '#next',
	prev:   '#prev'

});
$(function(){
	var _showTab = 0;
	$('ul.div_templates_theme_main_tab li').eq(_showTab).addClass('active');
	$('.div_templates_theme_main_content').hide().eq(_showTab).show();
	$('ul.div_templates_theme_main_tab li').mouseover(function() {
		var $this = $(this),
			_index = $this.index();
		$this.addClass('active').siblings('.active').removeClass('active');
		$('.div_templates_theme_main_content').eq(_index).stop(false, true).fadeIn().siblings().hide();

		return false;
	}).find('a').focus(function(){
		this.blur();
	});
});
$(function(){
	var _showTab = 0;
	$('ul.div_templates_theme_second_tab li').eq(_showTab).addClass('active');
	$('.div_templates_theme_second_content').hide().eq(_showTab).show();
	$('ul.div_templates_theme_second_tab li').mouseover(function() {
		var $this = $(this),
			_index = $this.index();
		$this.addClass('active').siblings('.active').removeClass('active');
		$('.div_templates_theme_second_content').eq(_index).stop(false, true).fadeIn().siblings().hide();

		return false;
	}).find('a').focus(function(){
		this.blur();
	});
});
/*----------------------------------------------------------------------------------------------------------*/
$(function(){
	// 大廣告圖片的高度及動畫時間
	// 計時器及輪播時間(毫秒)
	var adHeight = 270,
		animateSpeed = 400,
		timer,
		speed = 3500;

	function showNext(){
		// 找出目前是第幾個選項被展示出來(jQuery 1.4)
		var $li = $('#div_templates_product_prime_adblock ul.div_templates_product_prime_link li'),
			no = $li.has('a.selected').index();
		
		// 計算出下一個要展示的廣告選項
		no = (no + 1) % $li.length;
		
		// 觸發指定選項的 mouseover 事件
		$li.eq(no).children('a').mouseover();

		// 再啟動計時器
		timer = setTimeout(showNext, speed);
	}

	$('#div_templates_product_prime_adblock ul.div_templates_product_prime_link li a').each(function(i){
		$(this).css('top', i * 0);
	}).hover(function(){
		var $this = $(this),
			// 找出目前 li 是在選單中的第幾個(jQuery 1.4)
			no = $this.parent().index();
		
		// 先移除有 .selected 的超連結的樣式
		$('#div_templates_product_prime_adblock ul.div_templates_product_prime_link li a.selected').removeClass('selected');
		// 再把目前點擊到的超連結加上 .selected
		$this.addClass('selected');
		
		// 把 ul.div_templates_product_prime_showbox 的 top 移到相對應的高度
		$('#div_templates_product_prime_adblock ul.div_templates_product_prime_showbox').stop().animate({
			top: adHeight * no * -1
		}, animateSpeed);
		
		// 移除計時器
		clearTimeout(timer);
	}, function(){
		// 啟動計時器
		timer = setTimeout(showNext, speed);
	}).focus(function(){
		$(this).blur();
	}).eq(0).addClass('selected');
	
	// 當滑鼠移到廣告上時停止計時器..移出後啟動計時器
	$('#div_templates_product_prime_adblock ul.div_templates_product_prime_showbox li').hover(function(){
		clearTimeout(timer);
	}, function(){
		timer = setTimeout(showNext, speed);
	});
	
	// 啟動計時器
	timer = setTimeout(showNext, speed);
});
/*----------------------------------------------------------------------------------------------------------*/
$(function(){
	$("#show_details_data a").click(function(){ 
		var _this= $(this).attr("href");     
		if($(_this).css("display")=="none"){
			$(_this).slideDown();
		}else{
			$(_this).slideUp();
		}
		$("#msg").html($(_this).css("display"));
		return false;   
	});  
});
/*----------------------------------------------------------------------------------------------------------*/
$(function(){
	$("#show_best_video a").click(function(){ 
		var _this= $(this).attr("href");  
		var _length= (_this.length)-1;
		var _title= (_this.substr(0,_length));
		if($(_this).css("display")=="none"){
			for (i=1; i<=8; i=i+1){
			var _temps= _title+i;  
			$(_temps).slideUp();};
			$(_this).slideDown();
		}else{
			$(_this).slideUp();
		}
		$("#msg").html($(_this).css("display"));
		return false;   
	});
});

$(function() {
    $("#show_best_video_iphone a").click(function() {
        var _this = $(this).attr("href");
        var _length = (_this.length) - 1;
        var _title = (_this.substr(0, _length));
        if ($(_this).css("display") == "none") {
            for (i = 1; i <= 8; i = i + 1) {
                var _temps = _title + i;
                $(_temps).slideUp();
            };
            $(_this).slideDown();
        } else {
            $(_this).slideUp();
        }
        $("#msg").html($(_this).css("display"));
        return false;
    });
});

$(function() {
    $("#show_best_video_ipad a").click(function() {
        var _this = $(this).attr("href");
        var _length = (_this.length) - 1;
        var _title = (_this.substr(0, _length));
        if ($(_this).css("display") == "none") {
            for (i = 1; i <= 8; i = i + 1) {
                var _temps = _title + i;
                $(_temps).slideUp();
            };
            $(_this).slideDown();
        } else {
            $(_this).slideUp();
        }
        $("#msg").html($(_this).css("display"));
        return false;
    });
});

$(function() {
    $("#show_best_video_yamaha a").click(function() {
        var _this = $(this).attr("href");
        var _length = (_this.length) - 1;
        var _title = (_this.substr(0, _length));
        if ($(_this).css("display") == "none") {
            for (i = 1; i <= 8; i = i + 1) {
                var _temps = _title + i;
                $(_temps).slideUp();
            };
            $(_this).slideDown();
        } else {
            $(_this).slideUp();
        }
        $("#msg").html($(_this).css("display"));
        return false;
    });
});

$(function() {
    $("#show_best_video_lv a").click(function() {
        var _this = $(this).attr("href");
        var _length = (_this.length) - 1;
        var _title = (_this.substr(0, _length));
        if ($(_this).css("display") == "none") {
            for (i = 1; i <= 8; i = i + 1) {
                var _temps = _title + i;
                $(_temps).slideUp();
            };
            $(_this).slideDown();
        } else {
            $(_this).slideUp();
        }
        $("#msg").html($(_this).css("display"));
        return false;
    });
});

$(function() {
    $("#show_best_video_ps3 a").click(function() {
        var _this = $(this).attr("href");
        var _length = (_this.length) - 1;
        var _title = (_this.substr(0, _length));
        if ($(_this).css("display") == "none") {
            for (i = 1; i <= 8; i = i + 1) {
                var _temps = _title + i;
                $(_temps).slideUp();
            };
            $(_this).slideDown();
        } else {
            $(_this).slideUp();
        }
        $("#msg").html($(_this).css("display"));
        return false;
    });
});

$(function() {
    $("#show_best_video_wii a").click(function() {
        var _this = $(this).attr("href");
        var _length = (_this.length) - 1;
        var _title = (_this.substr(0, _length));
        if ($(_this).css("display") == "none") {
            for (i = 1; i <= 8; i = i + 1) {
                var _temps = _title + i;
                $(_temps).slideUp();
            };
            $(_this).slideDown();
        } else {
            $(_this).slideUp();
        }
        $("#msg").html($(_this).css("display"));
        return false;
    });
});

$(function() {
    $("#show_best_video_acer a").click(function() {
        var _this = $(this).attr("href");
        var _length = (_this.length) - 1;
        var _title = (_this.substr(0, _length));
        if ($(_this).css("display") == "none") {
            for (i = 1; i <= 8; i = i + 1) {
                var _temps = _title + i;
                $(_temps).slideUp();
            };
            $(_this).slideDown();
        } else {
            $(_this).slideUp();
        }
        $("#msg").html($(_this).css("display"));
        return false;
    });
});

$(function() {
    $("#show_best_video_chimei a").click(function() {
        var _this = $(this).attr("href");
        var _length = (_this.length) - 1;
        var _title = (_this.substr(0, _length));
        if ($(_this).css("display") == "none") {
            for (i = 1; i <= 8; i = i + 1) {
                var _temps = _title + i;
                $(_temps).slideUp();
            };
            $(_this).slideDown();
        } else {
            $(_this).slideUp();
        }
        $("#msg").html($(_this).css("display"));
        return false;
    });
});
/*----------------------------------------------------------------------------------------------------------*/
function copyToClipboard(txt) {
     if(window.clipboardData) {
             window.clipboardData.clearData();
             window.clipboardData.setData("Text", txt);
     } else if(navigator.userAgent.indexOf("Opera") != -1) {
          window.location = txt;
     } else if (window.netscape) {
          try {
               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
          } catch (e) {
               alert("被瀏覽器拒絕！\n請在瀏覽器地址欄輸入'about:config'並回車\n然後將'signed.applets.codebase_principal_support'設置為'true'");
          }
          var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
          if (!clip)
               return;
          var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
          if (!trans)
               return;
          trans.addDataFlavor('text/unicode');
          var str = new Object();
          var len = new Object();
          var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
          var copytext = txt;
          str.data = copytext;
          trans.setTransferData("text/unicode",str,copytext.length*2);
          var clipid = Components.interfaces.nsIClipboard;
          if (!clip)
               return false;
          clip.setData(trans,null,clipid.kGlobalClipboard);
     }
     alert('已經複製');
}
/*----------------------------------------------------------------------------------------------------------*/
$(function(){
	$("#show_novice_answer a").click(function(){
		var _this= $(this).attr("href");
		if($(_this).css("display")=="none"){
			$(_this).slideDown(0);
		}else{
			$(_this).slideUp(0);
		}
		return false;
	});
});
/*----------------------------------------------------------------------------------------------------------*/
var isShow = false;
function change() {
	if(!isShow) {
		isShow = true;
		document.getElementById('bid_loading').style.display='';
	}
	else {
		isShow = false;
		document.getElementById('bid_loading').style.display='none';
	}			
}
/*----------------------------------------------------------------------------------------------------------*/
var isShow = false;
function change() {
	if(!isShow) {
		isShow = true;
		document.getElementById('member_sabe').style.display='';
	}
	else {
		isShow = false;
		document.getElementById('member_sabe').style.display='none';
	}			
}
