﻿function select_change(){
	if((document.frm_list.button_select1 && document.frm_list.button_select1.value=="全选") || (document.frm_list.button_select2 && document.frm_list.button_select2.value=="全选")){
		if(document.frm_list.button_select1)document.frm_list.button_select1.value="取消";
		if(document.frm_list.button_select2)document.frm_list.button_select2.value="取消";
		select_All(true);
	}else{
		if(document.frm_list.button_select1)document.frm_list.button_select1.value="全选";
		if(document.frm_list.button_select2)document.frm_list.button_select2.value="全选";
		select_All(false);
	}
}
function select_All(checked){
	for (var i=0;i<document.frm_list.elements.length;i++){
		var e=document.frm_list.elements[i];
		if (e.type=='checkbox')e.checked = checked;
	}
}
function EditPictype(straction,strpictype,strvalue) {
	document.frm_list.action=straction;
	document.frm_list.scid.value=strvalue;
    document.frm_list.pictype.value=strpictype;
	var o=document.getElementById("id"+strvalue);
	if(o)o.checked=true;
}
function checkform(objForm){
	var objForm;
	var re = /^[_a-zA-Z0-9\-\.]+@([\-_a-zA-Z0-9]+\.)+[a-zA-Z0-9]{2,3}$/;
	var rc = /^[0-9]{6}$/;
	var rai = /^\d{15}$|^\d{18}$|^\d{17}x$/;
	var rtel = /^[_0-9\-\.]+-[0-9]{7,8}$/;
	var ram = /^\d{11}/;
	var raq = /^[0-9]{4,9}$/;
	var strid = eval(objForm.id);
	var striscount = 0;
	for(var i=0;i<strid.length;i++){
		if(strid[i].checked==true){striscount++;}
	}
	var pictype = objForm.pictype.value;
	//var strsession = "<%=session("user")%>";
	if (pictype == "sc")
	{
	  if (strsession == "") {
		 alert('请先登录！');
		 return false;
		}
 	  if(confirm("确定收藏吗？"))
	  {
		 return true;
	  }else{
		return false;
	  }
	}
	if (pictype == "duibi")
	{
	if (striscount>0){
		  if(striscount>5){
			 alert('【温馨提示】\n\n  1、您一次最多只能选择5个产品；\n\n  2、您已经选择'+striscount+'个产品，请去掉'+(striscount-5)+'个；');
			 return false;
		  }
		  if(striscount<2){
			 alert('【温馨提示】\n\n  需要两个以上产品才能对比；');
			 return false;
		  }
		if(confirm('确认对比吗?')){
			 return true;
		}
	}else{
		alert('请选择要对比的信息!');
		  return false;
	} 
	}
	if (pictype == "message")
	{
	 if (striscount>0){
		if(confirm("确认留言吗?")){return (true);}
	 }else{
		alert('请选择要留言的信息!');
		return false;
	 } 
	}
	if (pictype == "plsc")
	{
	 if (strsession == "") {
		 alert('请先登录！');
		 return false;
	 }
	if (striscount>0){
		if(confirm("确认收藏吗?")){
			return (true);
		}
	}else{
		alert('请选择要收藏的信息!');return false;} 
	}
	return false; 
}