fraudJq =$.noConflict();
fraudJq(document).ready(function(){
  fraudJq.getScript("http://www.5191js.com/payment/js/swfobject-2.2.min.js",function(){
	  fraudJq.getScript("http://www.5191js.com/payment/js/fraudcontroller_ext.js",function(){
		  fraudJq.getScript("http://www.5191js.com/payment/js/userAgent.js",function(){
		  fraudJq.getScript("http://www.5191js.com/payment/js/evercookie.js",function(){
			  var police1 = new EtcPolice();
			  var police2 = new EtcPolice('vas');
			  var police3 = new EtcPolice('vex');
			  var police4 = new EtcPolice('res');
			 
			  var ec = new evercookie({
				  history:false,
				  phpuri:'',
				  baseurl:'http://www.5191js.com/payment',
				  pngPath:'/fraudController/pngFraud',
				  etagPath:'/fraudController/etagFraud',
				  cachePath:'/fraudController/cacheFraud',
				  asseturi:'/assets'
			  });
			  ec.get("UID", function(best_candidate, all_candidates){
				  if("undefined" == best_candidate || undefined == best_candidate || ""==best_candidate){
					  var val = new Date().getTime();
					  ec.set("UID",val);
					  best_candidate = val;
				  }
				  fraudJq.data(document.body, 'UID', best_candidate);
				  var values = "";
				  for (var item in all_candidates){
					  values += ("&"+item +"=" +all_candidates[item]);
				  }
				  fraudJq.ajax({
					   type: "POST",
					   url: "http://www.5191js.com/payment/fraudController/getFraudId",
					   dataType : "jsonp",
					   data: "uid="+best_candidate+'&referrer='+encodeURIComponent(document.referrer)+values+"&police1="+police1.get()+"&police2="+police2.get()+"&police3="+police3.get()+"&police4="+police4.get()+"&os="+getOSAndBrowser()+'&version=1.0',
					   jsonpCallback:'paraseJsonP',
					   success: function(msg){
						   if(msg.fraudId != '' || msg.fraudId != 0){
								ec.set("orderId",msg.fraudId);
						   }
					   },
					   error:function(o){
						   
					   }
				  });
			  });
		  });
		  });
	  });
    });
});

function paraseJsonP(o){
	
}

function getUID(){
	return fraudJq.data(document.body, 'UID');
}
var getOSAndBrowser = function() {
	 var info = "";
	//识别系统
	if(client.system.win){
		info+="WIN "+client.system.win+"/";
	}
	else if(client.system.mac){
		info+="MAC "+client.system.mac+"/";
	}
	else if(client.system.x11){
		info+="Unix "+client.system.x11+"/";
	}
	else if(client.system.iphone){
		info+="iphone "+client.system.iphone+"/";
	}
	else if(client.system.ipod){
		info+="ipod "+client.system.ipod+"/";
	}
	else if(client.system.ipad){
		info+="ipad "+client.system.ipad+"/";
	}
	else if(client.system.ios){
		info+="ISO "+client.system.ios+"/";
	}
	else if(client.system.android){
		info+="android "+client.system.android+"/";
	}
	else if(client.system.nokiaN){
		info+="nokian "+client.system.nokiaN+"/";
	}
	else if(client.system.winMobile){
		info+="winMobile "+client.system.winMobile+"/";
	}
	else if(client.system.wii){
		info+="wii "+client.system.wii+"/";
	}
	else if(client.system.ps){
		info+="ps "+client.system.wii+"/";
	}
	else{
		info +="Other";
	}
	if(client.browser.ie){
		info+="IE ("+ client.browser.ver+")"+"/";
	}
	else if(client.browser.safari){
		info+="Safari ("+ client.browser.ver+")"+"/";
	}
	else if(client.browser.firefox){
		info+="Firefox ("+ client.browser.ver+")"+"/";
	}
	else if(client.browser.konq){
		info+="Konq ("+ client.browser.ver+")"+"/";
	}
	else if(client.browser.opera){
		info+="Opera ("+ client.browser.ver+")"+"/";
	}
	else if(client.browser.chrome){
		info+="Chrome ("+ client.browser.ver+")"+"/";
	}
	else{
		info+= "Other "+"/";
	}
	if(client.engine.ie){
		info+= "Other ("+client.engine.ver+")";
	}
	else if(client.engine.webkit){
		info +="Webkit ("+client.engine.ver+")";
	}
	else if(client.engine.gecko){
		info +="Gecko ("+client.engine.ver+")";
	}
	else if(client.engine.khtml){
		info +="Khtml ("+client.engine.ver+")";
	}
	else if(client.engine.opera){
		info +="Opera ("+client.engine.ver+")";
	}
	else{
		info +="Other";
	}
	return info;
};

