function Init()
{
	if (typeof(SetupIme) != "undefined")
		SetupIme();

	//最新产品
	$(".List3").marquee("up", 2, 100).mouseover(function(){$(this).trigger("stop");}).mouseout(function(){$(this).trigger("start");});	

	//友情连接
	$(".Link").marquee("up", 2, 100).mouseover(function(){$(this).trigger("stop");}).mouseout(function(){$(this).trigger("start");});	

	//公告
	$(".Block4").marquee("up", 2, 100).mouseover(function(){$(this).trigger("stop");}).mouseout(function(){$(this).trigger("start");});	

	$("[name=Head]").change(function()
	{
		var pic = $("#HeadPicture");
		var slash = pic.attr("src").lastIndexOf("/");
		var src = pic.attr("src").substr(0, slash + 1);
		pic.attr("src", src + this.options[this.selectedIndex].text + ".gif");
	});
		
	$("form").submit(function()
	{
		if ($.trim(this.Name.value) == "")
		{
			Alert(_lang_name_empty, function(){this.Name.select();}, this);
			return false;
		}
		
		if ($.trim(this.Subject.value) == "")
		{
			Alert(_lang_subject_empty, function(){this.Subject.select();}, this);
			return false;
		}
		
		if ($.trim(this.Content.value) == "")
		{
			Alert(_lang_content_empty, function(){this.Content.select();}, this);
			return false;
		}
		
		if (this.QQ.value != "" && !this.QQ.value.match(/^\d+$/))
		{
			Alert(_lang_qq_not_correct, function(){this.QQ.select();}, this);
			return false;
		}

		if (this.Email.value != "" && !this.Email.value.match(/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/))
		{
			Alert(_lang_email_not_correct, function(){this.Email.select();}, this);
			return false;
		}
		
		var data = "IsChecked=" + !_isNeedToCheck;
		data += "&Name=" + encodeURIComponent(this.Name.value);
		data += "&Subject=" + encodeURIComponent(this.Subject.value);
		data += "&Content=" + encodeURIComponent(this.Content.value);
		data += "&Head=" + encodeURIComponent($("#HeadPicture").attr("src").substr("http://" + document.domain));
		if (this.QQ.value != "")
			data += "&QQ=" + this.QQ.value;
		if (this.Email.value != "")
			data += "&Email=" + encodeURIComponent(this.Email.value);
		
		$(":submit").disabled = true;
		$.ajax(
		{
			url : _webPath + "ilghar.aspx?Object=GuestBook&Operation=Add",
			data : data,
			type : "POST",
			error : function (request)
			{
				Alert(_lang_fail);
				$(":submit").disabled = false;
			},
			success : function  (data)
			{
				Alert(_lang_success);
				$(":submit").disabled = false;
			}
		});
	
		return false;
	});
}

Init();