﻿function addCookie() {　 // 加入收藏
	if (document.all) {
		window.external.addFavorite("http://www.131uu.com","131UU -儿童虚拟社区");
	} else if (window.sidebar) {
		window.sidebar.addPanel("131UU -儿童虚拟社区","http://www.131uu.com", "");
	}
}　　　　　　　 
function setHomepage() {　 // 设为首页
	if (document.all) {
		document.body.style.behavior = "url(#default#homepage)";
		document.body.setHomePage("http://www.131uu.com");　　　　　　　　　　　 }
	else if (window.sidebar) {
		if (window.netscape) {
			try {
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
			}
			catch (e) {
				alert("该操作被浏览器拒绝，假如想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true");
			}
		}
		var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
		prefs.setCharPref("browser.startup.homepage","http://www.131uu.com");
	}　　　　　　　 
}
var vars = "";
var loginid = getparmByUrl("loginid");
var pwd = getparmByUrl("pwd");
if(loginid != ""){
	vars = 'loginid=' + loginid;
	if(pwd != ""){
		vars += '&pwd=' + pwd;
	}
}

function getparmByUrl(parmName){
    var url = document.location.href;
    var result = '';
    if(url.indexOf('?') != -1){
        var arr = url.split('?');
        var arr_temp = arr[1].split('&');
        for(var i=0;i<arr_temp.length;i++){
            var str = arr_temp[i].indexOf(parmName);
            if(str != -1){
                result = arr_temp[i].substring(arr_temp[i].indexOf('=')+1,arr_temp[i].length);
				break;
            }
        }
    }
    return result;
} 

function GuardianAngle(){
	window.open("http://www.131uu.com/web/angel/index.php?action=login");
}

function reloadWin(loginid, pwd){
	//window.location.reload();
	var vars = '';
	if(loginid){
		vars = '?loginid=' + loginid;
		if(pwd){
			vars += '&pwd=' + pwd;
		}
	}
	window.location.href='index.html'+vars;
}

var initCount = 0;
var paddingCount = 16;
var marginCount = 0;

function effectOut(){
	paddingCount -=4;
	if(paddingCount<0){
		paddingCount = 16;
		document.getElementById("effect").style.paddingTop = "0";
		update();
		return;
	}
	document.getElementById("effect").style.paddingTop = paddingCount + "px";
	updateHTML();
	setTimeout(effectOut,100);
}

function effectIn(){
	marginCount +=4;
	if(marginCount>16){
		marginCount = 0;
		document.getElementById("effect").style.marginTop = "0";
		effectOut();
		return;
	}
	document.getElementById("effect").style.marginTop = -marginCount + "px";
	setTimeout(effectIn,100);
}

function updateHTML(){
	if(typeof(updateContent[initCount]["href"])!="undefined" && updateContent[initCount]["href"]!=""){
		document.getElementById("effect").innerHTML = "<a target='_blank' href='"+updateContent[initCount]["href"]+"'>"+updateContent[initCount]["title"]+"</a>";
	}else{
		document.getElementById("effect").innerHTML = updateContent[initCount]["title"];
	}
}

function update(){
	updateHTML();
	initCount ++ ;
	if(initCount>updateContent.length-1){
		initCount=0;
	}
	setTimeout(effectIn,10000);
}