// JavaScript Document
function check_mbox(){
        if($("#yourname").val() == ''){
			 alert('请填写您的名字');
			 return false;
		}
		else if ($("#yourtelephone").val() == '' && $("#yourmobile").val()==''){
			 alert('手机号码和固定电话至少要填写一个');
			 return false;
		}
		else if ($("#youremail").val() == ''){
			 alert('请填写您的电子邮件');
			 return false;
		}
		else if ($("#title").val() == ''){
			 alert('请填写留言标题');
			 return false;
		}
		else if ($("#content").val() == ''){
			 alert('请填写留言内容');
			 return false;
		}
		else if ($("#code").val() == ''){
			 alert('请填写验证码');
			 return false;
		}			
}
function To_jumpMenu($link_url){
   window.open($link_url);
}
 function check_forms($type_id,$id){
		    if ($type_id != 3){
			  $j  =  1;	
			  $(".opt_"+$id).each(function(){
			     if ($(this).attr("checked") == true){
				    $j = $j*0;
				 }else{
				    $j = $j*1;
				 }
			  })
			  if ($j == 1){
			      alert('请选择投票项!');
				  return false;
			  }
			}
			else{
				if ($("#content_"+$id).val() == ''){
			      alert('请先输入内容,然后方可提交');
				  return false;
				}
				
			}
}
function check_form(id,thisform){
  alert(thisform);
  type_id = "type_"+id;
  alert(document.getElementById(type_id).value);
  return false;
}
function show_content_method($id){
	$method   =  $("#method_"+$id);
	$method_array = Array("凑合下","电话","传真","其他");
	if ($method.attr("checked") == true){
	    $("#content_method").html($("#content_method").html() + "<div id='tel_"+$id+"'>"+$method_array[$id]+": <input type=text  id='content_method_"+$id+"' name='content_method_"+$id+"'></div>");
	}else{
	    $("div").remove("#tel_"+$id);
	}
}
function check_sale(){
   if ($("#resideprovince").val() == ''){
	   alert('请选择城市');
	   return false;
   }else if ($("#company_name").val() == ''){
	   alert('请填写您单位名称');
	   return false;
   }
	$yt = 0;
   $("input[type='checkbox']").each(function($i){
												 if ($(this).attr('checked') == true){
													  $yt = $yt+1;
												 }
											 })
   
	if ($yt == 0){
		alert("请选择要提供的联系方式");
		return false;
	}
   var $k = 1;	
   $("input[type='checkbox']").each(function($i){
											   
											   $j = $i+1;
											    if ($("#content_method_"+$j).val() == ''){
													$k = $k*0;
												}
											 })
 	if ($k == 0){
		alert("请将联系方式填写完整了");
		return false;
	}  
   if ($("#email").val() == ''){
	   alert('请填写邮箱地址');
	   return false;
   }	
   if ($("#project_name").val() == ''){
	   alert('请填写项目名称');
	   return false;
   }
   
}

function check_nh(){
	$company = $.trim($("#company").val());
	$name    = $.trim($("#name").val());
	if ($company == ''){
		alert('请填写公司名称');
		$("#company").focus();
		return false;
	}
	if ($name == ''){
		alert('请填写您的姓名');
		$("#name").focus();
		return false;
	}	
}

function yj_checked(){
	 $("input[type='radio']").each(function($k){
			 $alt  =  $(this).attr("alt");
			 if ($.trim($alt) == '其它'){
			  if ($(this).attr("checked")){ 
			    $names  = $(this).attr('name');	
				alert('d');
			    $(".nh:eq("+$k+")").html("<input type=text name='val_"+$names+"'   class=nhd>");
			  }
			 }else{
			   $(".nh:eq("+$k+")").html("");
			 }
	 }),
	 $("input[type='checkbox']").each(function($kt){
			 $alt  =  $(this).attr("alt");
			 if ($(this).attr("checked") == true  &&   $.trim($alt) == '其它'){
			   $names  = $(this).attr('name');	 
			   $(".nh1:eq("+$kt+")").html("<input type=text name='val_"+$names+"'  class=nhd>");
			 }else{
			   $(".nh1:eq("+$kt+")").html("");
			 }
	 })
}

$(function(){
	 $("input[type='radio']").each(function($k){
		 $(this).click(function(){
			 $alt  =  $(this).attr("alt");
			 if ($.trim($alt) == '其它'){
			   $names  = $(this).attr('name');	 
			   $(".nh:eq("+$k+")").html("<input type=text name='val_"+$names+"'   class=nhd>");
			 }else{
			   $(".nh:eq("+$k+")").html("");
			 }
		 })
	 }),
	 $("input[type='checkbox']").each(function($kt){
		 $(this).click(function(){
			 $alt  =  $(this).attr("alt");
			 if ($.trim($alt) == '其它'){
			   $names  = $(this).attr('name');	 
			   $(".nh1:eq("+$kt+")").html("<input type=text name='val_"+$names+"'  class=nhd>");
			 }else{
			   $(".nh1:eq("+$kt+")").html("");
			 }
		 })
	 })
	 
	 
	 
	 $("input[type='radio']").each(function($k){
		$(this).click(function(){
			 $("input[type='radio']").each(function($kz){
				if ($(this).attr("checked") == false){
					$(".nh:eq("+$kz+")").html("");									   
				}	
			  })		 
		}) 

		 
	 })		 
	 $("input[type='checkbox']").each(function($k){
		$(this).click(function(){
		   $("input[type='checkbox']").each(function($kt){				   
			 if ($(this).attr("checked") == false){
				$(".nh1:eq("+$kt+")").html("");									   
			 }	
		   })	 	 
		}) 		 
		 
	 })	 
	 
 
})
