﻿//==========================================
//文 件 名：Js/function.asp
//文件用途：系统JS函数
//版权所有：方卡在线
//==========================================
var formTemp="";
var ajaxProcess="0";
var outdo="0";
var Un=0;

//==========================================
//用途：按ESC关闭弹出窗口
//参数：
//==========================================
$(document).keypress(function(e){  
	if (e.keyCode==27)  
		CloseBox();
});


function SetRContent(Urls){

	$.get(Urls,
		function(data){
		
			$("#comment").html(data);
			return true;
		}
	);

}

function SetRContent1(Urls){

	$.get(Urls,
		function(data){
		
			$("#pingfen").html(data);
			return true;
		}
	);

}


function sc(Urls){

	$.get(Urls,
		function(data){

			alert(data)
			return true;
		}
	);

}
//==========================================
//函数名：Sends
//用途：表单提交
//参数：FormName：提交的FORM
//     ToUrl：提交向的链接
//     SuGo：成功后是否转向链接，1转向，0不转向
//     GoUrl：转向链接
//     SuAlert：成功后是否弹出框提示，1弹出，0不弹出
//     SuF5：成功后是否刷新DIV，1刷新，0不刷新
//     F5Url：刷新URL
//     F5Div：刷新DIV
//==========================================
function Sends(FormName,ToUrl,GoUrl,SuAlert){

	if(ajaxProcess=="0"){
		if(document.getElementById("Enter")!=null){
			formTemp=$('#Enter').val();
			//$('#Enter').val("正在提交");
			ajaxProcess="1";
			outdo="1";
			
		}
		var options = { 
			url:  ToUrl,
			beforeSubmit:function(formData, jqForm, options){
			return true; 
			},
			success:function(responseText, statusText){
				
				if(statusText=="success"){
					ajaxProcess="0";
					outdo="0";
					
					if(responseText.search("成功")>0){
						iPic=0;
						cPic=0;
						
						if(SuAlert==1){
							var st=responseText.replace(/\|\|\|\|\|/gi,"\n");
							window.location.href=window.location.href;
						}else{
							//CloseBox();
							
							alert(responseText);
							location=GoUrl;
						}
						
					}else{
						var st=responseText.replace(/\|\|\|\|\|/gi,"\n");
						//$('#Enter').val(formTemp);
						alert(st);
					}
				}else{
					alert(statusText);
				}
			}
		}; 
		$('#'+FormName+'').ajaxForm(options); 
	}else{
		alert("请勿重复提交！");
	}
}



function sendcomment(FormName,ToUrl,newsid){

	if(ajaxProcess=="0"){
		if(document.getElementById("Enter")!=null){
			formTemp=$('#Enter').val();
			//$('#Enter').val("正在提交");
			ajaxProcess="1";
			outdo="1";
			
		}
		var options = { 
			url:  ToUrl,
			beforeSubmit:function(formData, jqForm, options){
			return true; 
			},
			success:function(responseText, statusText){
				if(statusText=="success"){
					ajaxProcess="0";
					outdo="0";
					
					if(responseText.search("成功")>0){
						iPic=0;
						cPic=0;
						
						SetRContent("/web/product/comment.asp?pid="+newsid);
						
					}else{
						var st=responseText.replace(/\|\|\|\|\|/gi,"\n");
						//$('#Enter').val(formTemp);
						alert(st);
					}
				}else{
					alert(statusText);
				}
			}
		}; 
		$('#'+FormName+'').ajaxForm(options); 
	}else{
		alert("请勿重复提交！");
	}
}





//==========================================
//函数名：hiddenMsg
//用途：关闭提示窗口
//==========================================
function hiddenMsg(url){
	$("#MsgBox").hide();

}


function showinf(inf)
{
	$('#MsgContent').html(inf);$("#MsgBox").show();setTimeout("hiddenMsg('')",3000);
}
function formTimeout(){
	if(outdo=="1"){
		outdo="0";
		$('#Enter').val(formTemp);
		ajaxProcess="0";
		alert("提交未获取正常返回，可能原因如下：\n\n1.由于网速过慢或者处理内容过多，仍然在处理中或者已经超时\n\n2.程序出错，或者服务器异常\n\n请尝试重新提交，或者稍候再试！\n\n如还有问题，请联系管理员！");
	}
}





function quit(){

	$.ajax({
		url:"/web/member/quit.asp",
		type:'GET',
		success:function(responseText, statusText){
	
			if(responseText=="yes")
			{window.location.href="index.asp";}
		
			
		}
	});
}




function checkIntensity(pwd)
{
  var Mcolor = "#FFF",Lcolor = "#FFF",Hcolor = "#FFF";
  var m=0;

  var Modes = 0;
  for (i=0; i<pwd.length; i++)
  {
    var charType = 0;
    var t = pwd.charCodeAt(i);
    if (t>=48 && t <=57)
    {
      charType = 1;
    }
    else if (t>=65 && t <=90)
    {
      charType = 2;
    }
    else if (t>=97 && t <=122)
      charType = 4;
    else
      charType = 4;
    Modes |= charType;
  }

  for (i=0;i<4;i++)
  {
    if (Modes & 1) m++;
      Modes>>>=1;
  }

  if (pwd.length<=4)
  {
    m = 1;
  }

  switch(m)
  {
    case 1 :
      Lcolor = "2px solid red";
      Mcolor = Hcolor = "2px solid #DADADA";
    break;
    case 2 :
      Mcolor = "2px solid #f90";
      Lcolor = Hcolor = "2px solid #DADADA";
    break;
    case 3 :
      Hcolor = "2px solid #3c0";
      Lcolor = Mcolor = "2px solid #DADADA";
    break;
    case 4 :
      Hcolor = "2px solid #3c0";
      Lcolor = Mcolor = "2px solid #DADADA";
    break;
    default :
      Hcolor = Mcolor = Lcolor = "";
    break;
  }
  if (document.getElementById("pwd_lower"))
  {
    document.getElementById("pwd_lower").style.borderBottom  = Lcolor;
    document.getElementById("pwd_middle").style.borderBottom = Mcolor;
    document.getElementById("pwd_high").style.borderBottom   = Hcolor;
  }


}
