var tool_url = "http://mycount.zikou.com/";

$(function(){
	if($('#right_div').length!=0){
		tongji();
	}else{
		setTimeout(tongji,1000);
	}
	
	$("a[id^='qq']").click(function () {
		var wf = _chat.getCookie("wf");
		var st = _chat.getCookie("st");
		var sid = _chat.getCookie("sid");
		var adtype = _chat.getCookie("adtype");
		
		
		if (wf.length > 0 && st.length > 0) {
			adtype = adtype.length > 0 ? adtype : "POP";
		}
		
		try {
			var tmp_url = "tooltype=Q&wf=" + wf + "&st=" + st + "&sid=" + sid + "&adtype=" + adtype + "&rand=" + Math.random();
			
			document.getElementById("if_tong").src = tool_url + "piwik_index.php?n=import&h=action&" + tmp_url;
		} catch( err ) {
		
		}
	})
	
	$("a[id^='msn']").click(function () {
		var wf = _chat.getCookie("wf");
		var st = _chat.getCookie("st");
		var sid = _chat.getCookie("sid");
		var adtype = _chat.getCookie("adtype");
		
		
		if (wf.length > 0 && st.length > 0) {
			adtype = adtype.length > 0 ? adtype : "POP";
		}
		
		try {
			var tmp_url = "tooltype=M&wf=" + wf + "&st=" + st + "&sid=" + sid + "&adtype=" + adtype + "&rand=" + Math.random();
			
			document.getElementById("if_tong").src = tool_url + "piwik_index.php?n=import&h=action&" + tmp_url;
		} catch( err ) {
		
		}
	})

})

function tongji(){
	$('#right_div').click(function(){
		var wf = _chat.getCookie("wf");
		var st = _chat.getCookie("st");
		var sid = _chat.getCookie("sid");
		var adtype = _chat.getCookie("adtype");
		
		if (wf.length > 0 && st.length > 0) {
			adtype = adtype.length > 0 ? adtype : "POP";
		}
		
		try {
			var tmp_url = "tooltype=K&wf=" + wf + "&st=" + st + "&sid=" + sid + "&adtype=" + adtype + "&rand="+Math.random();
			document.getElementById("if_tong").src = tool_url + "piwik_index.php?n=import&h=action&" + tmp_url;
		} catch( err ) {
		
		}
	});
}
