function addToFav(){
    var url = "http://www.1dhy.com";
    var title = "无基础开花店运营方案";
	if (window.confirm("【如果您正准备发展经营好花店，现在又暂时没有时间看，建议收藏本站】\n\n   点确定加入收藏夹,不可错过哦!!  (*^__^*) !"))
	{
		if (document.all){
			window.external.AddFavorite( url, title);
		} else if(window.sidebar){
			window.sidebar.addPanel(title, url,"");
		} else if(window.opera) { // Opera 7+
			alert("other");
			return false; // do nothing
		} else { 
				alert('对不起，您的浏览器不支持这个操作，请使用 Ctrl+D 进行添加！');
		}
	}
}
function addToFavClick(){
    var url = "http://127.0.0.1/";
    var title = "无基础开花店运营方案";
	if (document.all){
		window.external.AddFavorite( url, title);
	} else if(window.sidebar){
		window.sidebar.addPanel(title, url,"");
	} else if(window.opera) { // Opera 7+
		alert("other");
		return false; // do nothing
	} else { 
			alert('对不起，您的浏览器不支持这个操作，请使用 Ctrl+D 进行添加！');
	}
}
function dataProcess(){
	currInfo(260,100,876938);
	initPageData();
	countVisiter();
}
function currInfo(currOnlineRNum,leastOnline,allVisited){
	var currOnline = Math.round(Math.random()*currOnlineRNum);
	currOnline = currOnline + leastOnline;
	var currOnlineShow = document.getElementById("currOnline");
	currOnlineShow.innerHTML = "当前在线：<span style=\"color:red;\"><I><B>" + currOnline + "</B></I></span> 人";
	currOnlineShow = document.getElementById("allVisited");
	currOnlineShow.innerHTML = "累积访问：<span style=\"color:red;\"><I><B>" + allVisited + "</B></I></span> 人";
}
function aboutUs(){
	var currDIV = document.getElementById("attention");
	currDIV.innerHTML = "对不起，您可能无权访问 http://www.miaotiao520.net/aboutus.html ，“关于我们” 只针对合作伙伴开放，请加入我们再访问！";	
	currDIV.style.display = "block";
}
function joinUs(){
	var currDIV = document.getElementById("attention");
	currDIV.innerHTML = "对不起，您可能无权访问 http://www.miaotiao520.net/joinus.html ，“加入我们” 目前尚未开放！";	
	currDIV.style.display = "block";
}
function privacy(){
	var currDIV = document.getElementById("attention");
	currDIV.innerHTML = "对不起，您可能无权访问 http://www.miaotiao520.net/privacy.html ，“隐私政策” 只针对特殊人员开放，请授权后再访问！";	
	currDIV.style.display = "block";
}
window.onbeforeunload = addToFav;
window.onload = dataProcess;

/*Ajax count*/
//声明XMLHtttpRequest对象	
function countClick(pos){
	var xRequest = createRequest();
	//成功创建
	if(xRequest){
		xRequest.open("POST","http://www.miaotiao520.net/countClick.php?pos=" + pos); //建立服务器请求, ajaxtest 为请求的 servlet
		xRequest.onreadystatechange = callbackExcute; //指定回调方法
		xRequest.send(""); //发送请求
	}
}
//回调方法
function callbackExcute(){
	return;
}
function countVisiter(){
	var xRequest = createRequest();
	//成功创建
	if(xRequest){
		xRequest.open("POST","http://www.miaotiao520.net/countVisiter.php"); //建立服务器请求, ajaxtest 为请求的 servlet
		xRequest.onreadystatechange = callbackExcute; //指定回调方法
		xRequest.send(""); //发送请求
	}
}
//创建request
function createRequest(){
	var xRequest;
	//判断IE浏览器版本
	try{
		xRequest = new ActiveXObject("Msxml2.XMLHTTP");//创建旧版本IE请求对象
	} catch (e) {
		 try {
			if(window.XMLHttpRequest){
				xRequest = new XMLHttpRequest();//创建新版本IE请求对象
			}else if (ActiveXObject){
				xRequest = new ActiveXObject("Microsoft.XMLHTTP"); //创建COM组件
			}
		} catch (e) {
			xRequest = 0;
		}
	}
	//创建非IE浏览器请求对象
	if (!xRequest && XMLHttpRequest) {
		xRequest = new XMLHttpRequest();
	}
	return xRequest;
}
function click_change_div(flag){
	if(flag=="fl"){
		document.getElementById("friendlink_content_div").style.display="block";
		document.getElementById("article_content_div").style.display="none";
	}else if(flag=="ac"){
		document.getElementById("article_content_div").style.display="block";
		document.getElementById("friendlink_content_div").style.display="none";
	}
}

