/*
* 绿色家装首页用的js
*/

$(document).ready(function(){
	//首页搜索
	$('#jsSearchEngineTagDiv div').click(function(){
		$('#jsSearchEngineTagDiv div').css('background-image','');
		switch($(this).html()){
			case '视频':
				$('#jsSearchTypeHidFm').val('video');
				break;
			case '快讯':
				$('#jsSearchTypeHidFm').val('news');
				break;
			case '商家':
				$('#jsSearchTypeHidFm').val('comp');
				break;
			case '商品':
				$('#jsSearchTypeHidFm').val('prod');
				break;
			case '商机':
				$('#jsSearchTypeHidFm').val('oppt');
				break;
			case '团购':
				$('#jsSearchTypeHidFm').val('tuan');
				break;
			case '设计师':
				$('#jsSearchTypeHidFm').val('desi');
				break;
		}
		$(this).css('background-image','url(publicimages/searchTag_bg.gif)');
	});
});

//在线商机的ajax返回
$(document).ready(function(){
	$('#ywl_jzShangjiDiv').html('加载数据……');
	$.get('zgz_functions_handle.php',{action:'ajBusiness'},function(data){
		$('#ywl_jzShangjiDiv').html(data);
	});
	if($('#ywl_jzShangjiDiv').html() != '加载数据……' || $('#ywl_jzShangjiDiv').html() != ''){
		$('#ywl_jzSJGYTitleDiv').mouseover(function(){
			$(this).css('background-image','');
			$(this).css('background-color','#ffffff');
			$(this).css('color','#28641A');
			$(this).css('border-left','1px solid #cccccc');
			$(this).css('border-right','1px solid #cccccc');
			$(this).css('font-size','14px');
			$('#ywl_jzSJXQTitleDiv').css('background-image', 'url(./templates/images/biaoti.jpg)');
			$('#ywl_jzSJXQTitleDiv').css('color', '#333333');
			$('#ywl_jzSJXQTitleDiv').css('font-size', '12px');
			$('#ywl_jzSJXQTitleDiv').css('border', '0px');
			$('#ywl_gongyingDiv').show();
			$('#ywl_qiugouDiv').hide();
		});
		$('#ywl_jzSJXQTitleDiv').mouseover(function(){
			$(this).css('background-image','');
			$(this).css('background-color','#ffffff');
			$(this).css('color','#28641A');
			$(this).css('border-left','1px solid #cccccc');
			$(this).css('border-right','1px solid #cccccc');
			$(this).css('font-size','14px');
			$('#ywl_jzSJGYTitleDiv').css('background-image', 'url(./templates/images/biaoti.jpg)');
			$('#ywl_jzSJGYTitleDiv').css('color', '#333333');
			$('#ywl_jzSJGYTitleDiv').css('font-size', '12px');
			$('#ywl_jzSJGYTitleDiv').css('border', '0px');
			$('#ywl_qiugouDiv').show();
			$('#ywl_gongyingDiv').hide();
		});
	} else {
		$('#ywl_jzShangjiDiv').html('加载数据……');
	}
	//手册
	$('#ywl_jzShouceDiv').html('加载数据……');
	$.get('zgz_functions_handle.php',{action:'ajShouce'},function(data){
		$('#ywl_jzShouceDiv').html(data);
	});
	if($('#ywl_jzShouceDiv').html() != '加载数据……' || $('#ywl_jzShouceDiv').html() != ''){
		$('#ywl_jzSCZSTitleDiv').mouseover(function(){
			$(this).css('background-image','');
			$(this).css('background-color','#ffffff');
			$(this).css('color','#28641A');
			$(this).css('border-left','1px solid #cccccc');
			$(this).css('border-right','1px solid #cccccc');
			$(this).css('font-size','14px');
			$('#ywl_jzSCRJTitleDiv').css('background-image', 'url(./templates/images/biaoti.jpg)');
			$('#ywl_jzSCRJTitleDiv').css('color', '#333333');
			$('#ywl_jzSCRJTitleDiv').css('font-size', '12px');
			$('#ywl_jzSCRJTitleDiv').css('border', '0px');
			$('#ywl_zhishiDiv').show();
			$('#ywl_rijiDiv').hide();
		});
		$('#ywl_jzSCRJTitleDiv').mouseover(function(){
			$(this).css('background-image','');
			$(this).css('background-color','#ffffff');
			$(this).css('color','#28641A');
			$(this).css('border-left','1px solid #cccccc');
			$(this).css('border-right','1px solid #cccccc');
			$(this).css('font-size','14px');
			$('#ywl_jzSCZSTitleDiv').css('background-image', 'url(./templates/images/biaoti.jpg)');
			$('#ywl_jzSCZSTitleDiv').css('color', '#333333');
			$('#ywl_jzSCZSTitleDiv').css('font-size', '12px');
			$('#ywl_jzSCZSTitleDiv').css('border', '0px');
			$('#ywl_rijiDiv').show();
			$('#ywl_zhishiDiv').hide();
		});
	}else{
		$('#ywl_jzShouceDiv').html('加载数据……');
	}
	//利用ajax 来显示今日特价，商品展示，精品设计，名师推荐
	$.get('zgz_functions_handle.php',{action:'jzYouhui'},function(data){
			$('#ywl_jzYouhuiDiv').html(data);
	});
	$.get('zgz_functions_handle.php',{action:'jzProduct'},function(data){
			$('#ywl_jzProductDiv').html(data);
	});
	$.get('zgz_functions_handle.php',{action:'jzJingpin'},function(data){
			$('#ywl_jzJingpinDiv').html(data);
	});
	$.get('zgz_functions_handle.php',{action:'jzMingshi'},function(data){
			$('#ywl_jzMingshiDiv').html(data);
	});
	
});


$(document).ready(function(){$('#clientAdmin_nav div').click(function(){
	$('#clientAdmin_nav div').css('background-color','');
	$(this).css('background','#F7F7F7');});
	
	//设置姜晓宁的前台楼盘的详细信息的表格颜色变化
	//ywl_senfe('jxn_table','#E1F1F1','#F0F0F0');
	$('#jxn_table tr').each(function(i){
		var color = i%2 == 0 ? '#E1F1F1':'#F0F0F0';
		$(this).css('background',color);
	});
});


//检测搜索提交是否为空
function ywl_checkSearchCondition(){
	if($('#ywl_jzSearchbox').val() == '')alert('搜索关键字不能为空');
}

/*
function ywl_senfe(o,a,b){
 var t=document.getElementById(o).getElementsByTagName("tr");
 for(var i=0;i<t.length;i++){
  t[i].style.backgroundColor=(t[i].sectionRowIndex%2==0)?a:b;
 }
}

*/
