﻿var sAlt = '';
var ii = 0;
var inputCBX = 0;

$(document).ready(function(){
	
	//图片链接半透明
	$('.jiePai_picList a img,.adsArea a img').css("opacity",.75)
	$('.jiePai_picList a img,.adsArea a img').hover(function() {$(this).stop().animate({ "opacity": 1 },200);}, function() { $(this).stop().animate({ "opacity": .75 },200); });


	//去除链接虚框
	$("a,label").focus(function(){
		this.blur();
	})
	
	
	//首页最新视频
	//$('.pagesJiepai_detail .picList li.current').append('<span></span>')
	$(".zxspArea .list li:first").addClass('first')
	$(".zxspArea .list li:first").append('<span></span>')
	$(".zxspArea .list li,#activityList li,.jiePai_picList li").hover(function(){
		$(".zxspArea .list li:first").children('span').remove();
		$(this).append("<span></span>")
		$(this).children('span').click(function(){
			window.location.href=$(this).prev().attr('href')
		})
	}, function(){
		$(this).children('span').remove();
		$('.pagesJiepai_detail .picList li.current').append('<span></span>')
		$(".zxspArea .list li:first").append('<span></span>')		
	})

	//记住用户名
	$(".jzyhm label").click(function(){
		var _for = $(this).attr('for');
		if($("#"+_for).attr('checked') == true){
			$("#"+_for).attr('checked',false)
			$(this).children().css('background-position','-64px -46px')
		} else {
			$("#"+_for).attr('checked','checked')
			$(this).children().css('background-position','-77px -46px')
		}
		return false;
	})
	
	
	
	//左侧 模拟Selsect
	mSelect('.searchCat');
	mSelect('.searchDate');
	mSelect('.searchTags');
	mSelect('.searchGuanfang');
	mSelect('.searchPlace');
	mSelect('.searchWorks');
	mSelect('.searchSinger');
	
	//统一页面两侧高度
/*	var iSiderBarHeight = $(".sideBar_lefter").height();
	var iContainerHeight = $(".containerArea").height();
	var imainHeight = $("#main").height();
	$(".sideBar_lefter").height(iContainerHeight>iSiderBarHeight?iContainerHeight:iSiderBarHeight);*/
	
	/*if( iContainerHeight > iLefterBarHeight ){
		$(".lefterBar").height(iContainerHeight - 250);
	} else {
		$(".container").height(iLefterBarHeight);
	}*/
	
})

//模拟select
function _selected(o,i){
	document.getElementsByName(o)[0].options[i].selected =true;
}

function mSelect(obj) {
	var opv = '';

	$(obj).children('select').css('display','none');
	$(obj).children('select').children('option').each(function(i){
		if(i == 0) { 
			opv = '<dt>'+$(this).html()+'</dt><dd>'
			return true;
		}
		var sobj = this.parentNode.getAttribute('name');
		opv += '<a href="###" onclick="javascript:_selected(\''+sobj+'\','+i+');">'+$(this).html()+'</a>';
	})
	
	$(obj).append('<dl>'+opv+'</dd></dl>')
	if (!window.XMLHttpRequest) DD_belatedPNG.fix('dl');
	$(obj).children('dl').children('dd').children('a').each(function(i){
		$(this).click(function(){
			$(this).parent().prev().html($(this).html())
			$(this).parent().css('display','none')
			$(this).parent().children('a').removeClass('current')
			$(this).addClass('current')
			return false;
		})
	})
	
	$(obj).children('dl').each(function(){
		$(this).hover(function(){
			$(this).children('dd').css('display','block')
		}, function(){
			$(this).children('dd').css('display','none')
		})
	})
	
	var selected=$(obj).children('select[to^=setSelect]');
	
	if(selected.html()!=null){
		var selectedIndex=selected[0].selectedIndex;
		$(obj).children('dl').children('dd').children('a').each(function(i){
			if(i==selectedIndex){
				$(this).parent().prev().html($(this).html())
				$(this).parent().css('display','none')
				$(this).parent().children('a').removeClass('current')
				$(this).addClass('current')
				return false;
			}
		})
	}
}

function getFlash(){
	var str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9.0.45.0" width="950" height="150" id="menuSwf" name="menuSwf">';
		str += '<param name="movie" value="/swf/menu.swf" />';
		str += '<param name="quality" value="high" />';
		str += '<param name="wmode" value="transparent" />';
		str += '<embed src="/swf/menu.swf" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="950" height="150"></embed>';
	str += '</object>';
	document.write(str);
}

