// JavaScript Document
$(function() {
	$('.index_3_c>li').height($('.index_3_c').height());
	if($("#index_banner").size() > 0)
		$.getScript('/js/jqFancyTransitions.1.8.min.js', function() {
			$("#index_banner").jqFancyTransitions({
				width : 940,   // width of panel
				height : 385,   // height of panel
				strips : 20,   // number of strips
				delay : 5000,   // delay between images in ms
				stripDelay : 50,   // delay beetwen strips in ms
				titleOpacity : 0,   // opacity of title
				//		titleSpeed: 100, // speed of title appereance in ms
				position : 'top',   // top, bottom, alternate, curtain
				direction : 'random',   // left, right, alternate, random, fountain, fountainAlternate
				navigation : false,   // prev and next navigation buttons
				links : true // show images as links
			});
		});
	$('.s_a li').hover(function() {
		var t = $('h4', this);
		$(t).stop().animate({
			top : ($(this).height() -  $(t).height()) + 'px',
			opacity : 0.7
		}, {
			queue : false,
			duration : 500
		});
	}, function() {
		$('h4',this).stop().animate({
			top : $(this).height() + 'px',
			opacity : 1
		}, {
			queue : false,
			duration : 500
		});
	});
	if($('.bar_list').size() > 0) {
		$.getScript('/js/jquery.url.js', function() {
			$('.B_AD_List span').hover(function() {
				$(this).addClass('selected').siblings().removeClass('selected');
				$('.S_AD_List div[rel="Ad_bid_'+$(this).data('id')+'"]').show().siblings().hide();
				$('#BigADType').val($(this).data('id'));
			}, function() {

			});
			$('.S_AD_List span').click(function() {
				$(this).addClass('selected').siblings().removeClass('selected');
				$('#SADType').val($(this).data('id'));
			});
			$('.Area_List span').click(function() {
				$(this).addClass('selected').siblings().removeClass('selected');
				$('#Area').val($(this).data('id'));
			});
			if($('#BigADType').val() != '') {
				$('#Ad_bid_'+$('#BigADType').val()).addClass('selected');
				$('.S_AD_List div[rel="Ad_bid_'+$('#BigADType').val()+'"]').show();
			} else {
				$('.B_AD_List span:first').addClass('selected');
				$('.S_AD_List div:first').show();
			}
			if($('#SADType').val() != '') {
				if($('#SADType').val() == '0')
					$('.S_AD_List .nolimit').addClass('selected');
				else
					$('#Ad_sid_'+$('#SADType').val()).addClass('selected');
			} else {
				$('.nolimit').addClass('selected');
			}
			if($('#Area').val() != '') {
				$('#Area_id_'+$('#Area').val()).addClass('selected');
			}
			$('.B_AD_List span,.S_AD_List span,.Area_List span,#searchbtn').click(function() {
				window.location.href = '/Ad.aspx?BigADType=' + $('#BigADType').val() + '&SADType=' + $('#SADType').val() + '&Area=' + $('#Area').val() + '&keyword=' + escape($('#keyword').val());
			});
			
		});
	}
	
	$('#clean').click(function(){ 
		$('.order .input').val('');
	});
	$('#send').click(function(){ 
		var parm=[];
		parm.push('adid='+escape($('#ctl00_ContentPlaceHolder1_AdID').val()));
		$('.order .input').each(function(){
			parm.push($(this).attr('name')+'='+escape($(this).val()));
			});
		$.ajax({type:'POST',beforeSend:function(){},url:'post.aspx',data:parm.join('&'),dataType:'html',error:function(){
			alert('链接失败');
			},success:function(html){
			alert(html);
			}});
	});
});

