function combanner(config){
	var str = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"940\" height=\"300\">";
	str += "  <param name=\"movie\" value=\"pic/reeyee.swf?config="+config+"\" />";
	str += "  <param name=\"quality\" value=\"high\" />";
	str += "  <param name=\"wmode\" value=\"transparent\" />"
	str += "  <param name=\"allowFullscreen\" value=\"true\" />";
	str += "  <embed src=\"pic/reeyee.swf?config="+config+"\" wmode = \"transparent\" allowFullscreen=\"true\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"940\" height=\"300\"></embed></object>";
	document.write(str);
}

$(document).ready(function(){
	$(".i_service li").hover(function(){
		var idx = $(this).index();
		idx++;
		$(this).find("h3 img").attr("src","images/b0"+idx+"n.jpg");
		$(this).find(".i_service_btn img").attr("src","images/moren.jpg");
		
	},function(){
		var idx = $(this).index();
		idx++;
		$(this).find("h3 img").attr("src","images/b0"+idx+".jpg");
		$(this).find(".i_service_btn img").attr("src","images/more.jpg");
	})
	//首页BANNER图片切换
	$("#index_banner a:not(:first)").hide();
	$("#index_banner").attr("idx",0);
	window.setInterval(index_banner_autoPlay,5000);
	window.setInterval(project,3000);
	$("#case_list_btn div").click(function(){
		direction = $(this).index();
		$("#case_list_btn div").eq(0).removeClass("clb_pre_nomorl");
		$("#case_list_btn div").eq(0).removeClass("clb_next_nomorl");
		
		$("#case_list_btn div").eq(1).removeClass("clb_pre_hover");
		$("#case_list_btn div").eq(1).removeClass("clb_next_hover");
		if(direction == 1){
			$("#case_list_btn div").eq(0).addClass("clb_pre_nomorl");
			$("#case_list_btn div").eq(1).addClass("clb_next_hover");
		}
		else{
			$("#case_list_btn div").eq(0).addClass("clb_next_nomorl");
			$("#case_list_btn div").eq(1).addClass("clb_pre_hover");
		}
	})
	
})
direction = 1;
function project(){
	var width = $("#case_list li:first").outerWidth(true) * -1;
	if(direction == 1){
		$("#case_list").animate({left:width},100,function(){
			$("#case_list").append($("#case_list li:first"));
			$("#case_list").css("left","0px");
		});
	}
	else{
		$("#case_list").animate({left:0},100,function(){
			$("#case_list").prepend($("#case_list li:last"));
			$("#case_list").css("left",width);
		});
	}
}

function index_banner_autoPlay(){
	var len = $("#index_banner a").length;
	var idx = parseInt($("#index_banner").attr("idx"));
	var next = idx+1;
	if(next == len) next = 0;
	$("#index_banner a").eq(idx).fadeOut(200);
	$("#index_banner a").eq(next).fadeIn(200);
	$("#index_banner").attr("idx",next);
}

function checkguest(){
	
	if($('#compName').val() == ''){
		alert('单位名称不能为空！');
		$('#compName').focus();
		return false;
	}
	if($('#userName').val() == ''){
		alert('联系人不能为空！');
		$('#userName').focus();
		return false;
	}
	if($('#tel').val() == ''){
		alert('电话不能为空！');
		$('#tel').focus();
		return false;
	}
	if($('#email').val() == ''){
		alert('电子邮件不能为空！');
		$('#email').focus();
		return false;
	}
	if($('#email').val() != ''){
		var myemail = /^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/;
		if(!myemail.test($('#email').val())){
			alert('电子邮件格式错误！');
			return false;
		}
	}
	if($('#vol').val() == ''){
		alert('验证码不能为空！');
		$('#vol').focus();
		return false;
	}
	if($('#content').val() == ''){
		alert('需求描述不能为空！');
		$('#content').focus();
		return false;
	}
	var data = {compName:$("#compName").val(),userName:$("#userName").val(),tel:$("#tel").val(),
				email:$("#email").val(),address:$("#address").val(),
				vol:$("#vol").val(),content:$("#content").val(),cmd:'guestbook'};
	if($("#load").length == 0){
		var w = $(document).width();
		var h = $(document).height()- ($.browser.msie?4:0);
		var load = $('<div id="load" style="position:absolute;left:0px;top:0px;width:100%;height:100px;text-align:center;background:#fff;filter: Alpha(Opacity=70); -moz-opacity:0.70; opacity:0.70;z-index:999;"></div>').appendTo("body");
		$("#load").html("<img src='images/loading.gif'>").css({height:h});	
		$("#load img").css({marginTop:h/2});
		$("#load").hide();
	}		
	$("#load").show();
	
	$.ajax({
		type:'POST',
		url:'ajax.php',
		data:data,
		dataType:'text',
		success:function(msg){
			if(msg==1){
				alert('验证码错误！');
			}
			else if(msg==2){
				alert('单位名称不能为空！');
			}
			else if(msg==3){
				alert('联系人不能为空！');
			}
			else if(msg==4){
				alert('电子邮件格式错误！');
			}
			else{
				alert('您的留言已经成功保存，我们将与您联系！');
				document.frmguest.reset();
			}
			$("#load").hide();
			return;
		}
	})
	return false;
}
