$().ready(function(){
	moveIt();			 
});
var F={//global object
	intval:100,  //切换时间
	m_paly:false,
	m_width:0
};	
function moveIt(){
	F.m_width = $("#m1>li").length * 85;
	$("#m1").append($("#m1").html());
	$("#m1").mouseover(function(){F.m_paly = false;})
	$("#m1").mouseout(function(){F.m_paly = true;})
	$("#m1").css("width",F.m_width*2+"px");
	F.m_paly = true;
	$("#m1").css("left","0px");
	var tmp_left=0;
	setInterval(function(){
		if(F.m_paly == true){
		tmp_left -=2;
		if(-tmp_left>F.m_width){
			tmp_left = 	parseInt(F.m_width)+parseInt(tmp_left);
		}
		$("#m1").css("left",tmp_left+"px");			 
		}
			},F.intval)
};

function getbyid(id) {
	if (document.getElementById) {
		return document.getElementById(id);
	}else if (document.all) {
		return document.all[id];
	}else if (document.layers) {
		return document.layers[id];
	}else {
		return null;
	}
}
function checkForms(){
	var temp,state
	state=true;
	if (getbyid("txtUserNa").value==""){
		getbyid("txtUserNa").className="online_input_err";
		getbyid("check_name").style.display="block";
		state=false;
		}else{
			getbyid("txtUserNa").className="online_input";
			getbyid("check_name").style.display="none";
			}
	if (getbyid("txtTel").value==""){
		getbyid("txtTel").className="online_input_err";
		getbyid("check_tel").style.color="red";
		state=false;
		}else{
			if (isphone(getbyid("txtTel").value)){
				getbyid("txtTel").className="online_input";
				getbyid("check_tel").innerHTML='<img src="/images/_normal.gif">';
			}else{
				getbyid("txtTel").className="online_input_err";
				getbyid("check_tel").innerHTML="您输入的电话号码不符合规范！示例:021-12345678"
				getbyid("check_tel").style.color="red";
				state=false;
			}	
		}
	if (getbyid("txtMail").value==""){
		getbyid("txtMail").className="online_input_err";
		getbyid("check_mail").style.color="red";
		state=false;
		}else{
			if (ismail(getbyid("txtMail").value)){
				getbyid("txtMail").className="online_input";
				getbyid("check_mail").innerHTML='<img src="/images/_normal.gif">';
			}else{
				getbyid("txtMail").className="online_input_err";
				getbyid("check_mail").innerHTML="错误的邮箱地址！"
				getbyid("check_mail").style.color="red";
				state=false;
			}
		}
	if (getbyid("txtMobile").value!=""){
			if (ismobile(getbyid("txtMobile").value)){
				getbyid("txtMobile").className="online_input";
				getbyid("check_mobile").innerHTML='<img src="/images/_normal.gif">';
			}else{
				getbyid("txtMobile").className="online_input_err";
				getbyid("check_mobile").innerHTML="错误的手机号码！"
				getbyid("check_mobile").style.color="red";
				state=false;
			}
	}
	if (getbyid("txtAddress").value!=""){
			if (getbyid("txtAddress").value.length>5){
				getbyid("txtAddress").className="online_input";
				getbyid("check_address").innerHTML='<img src="/images/_normal.gif">';
			}else{
				getbyid("txtAddress").className="online_input_err";
				getbyid("check_address").innerHTML="你输入的地址太短啦！"
				getbyid("check_address").style.color="red";
				state=false;
			}
	}
	if (getbyid("txtContents").value==""){
		getbyid("txtContents").className="online_text_err";
		getbyid("check_content").style.color="red";
		state=false;
		}else{
			getbyid("txtContents").className="online_txt";
			getbyid("check_content").style.color="#999999";
			}
		
	return state;
	
} 


function ismail(x){ 
var reg=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/; 
if(!reg.test(x)){ 
	return false
	} 
else 
	{ 
	return true
	} 
}


function isphone(x){ 
var reg=/^(^[0-9]{3,4}\-[0-9]{6,8}$)|(^\([0-9]{3,4}\)[0-9]{6,8}$)/; 
	if(!reg.test(x)){ 
		return false
	}else{ 
		return true
	} 
} 
function ismobile(x){ 
	var reg=/^(^0{0,1}13[0-9]{9}$)|(^0{0,1}15[0-9]{9}$)/; 
	if(!reg.test(x)){ 
		return false
	}else{ 
		return true
	} 
} 

function drawImage(ImgD,widthStr,heightStr){ 
	var image=new Image(); 
	image.src=ImgD.src;
	if(image.width>0 && image.height>0){ 
		if(image.width/image.height>= 1){ 
			if(image.width>widthStr){
   				ImgD.width=widthStr; 
   				ImgD.height=(image.height*widthStr)/image.width; 
  			}else{ 
  			 	ImgD.width=image.width;
   				ImgD.height=image.height; 
  			}
		}else{ 
  			if(image.height>heightStr){
   				ImgD.height=heightStr; 
   				ImgD.width=(image.width*heightStr)/image.height; 
  			}else{ 
   				ImgD.width=image.width;
   				ImgD.height=image.height; 
  			} 
		} 
	}
}
