events = function(){
	var isflag = false;
	var oldX = 0;
	var oldY = 0;
	var index_cate = [];
}
var _e = events.prototype;
_e.isflag = false;
_e.oldX = 0;
_e.oldY = 0;
_e.index_cate = [];

//首页分类显示
_e.index_category_slidelist = function(index){
	var index_urlpre = ['best','meinvxiu','feizhuliu','sigemanhua','lvyoutiandi','qinqingaiqing','woxingwoxiu','qita'];
	var parent_obj = document.getElementById("category_list");
	var obj = parent_obj.getElementsByTagName("li");
	for(var i=0;i<obj.length;i++){
		obj[i].className = i == index ? "selected" : "";
	}
	if(!_e.index_cate[index]){
		var _ajax = new ajax;
		var _ajax_url = "seven_html/index_category_"+index+".asp";
		_e.index_cate[index] = _ajax.StartRequest(_ajax_url,"text","");
	}
	//alert(_e.index_cate[index]);
	document.getElementById("category_slide").innerHTML = _e.index_cate[index];
	var url = index==0 ? "best.asp" : "category-"+index+".asp";
//	var url = index==0 ? "best.asp" : index_urlpre[index]+"-"+index+"-1-1-1-1.asp";
	document.getElementById("category_more").href = url;
}

//抓取QQ
_e.getqq = function(){
	this.StartWin("导入QQ相册","","320px");
	var _ajax = new ajax;
	var content = _ajax.StartRequest("./win/getqq.html","text","");
	this.SetWin(content);
}

_e.setsize = function (obj){
	sl.setwidth(obj.width.value);
	sl.setheight(obj.height.value);
	this.closewin();
	this.preview();
	return false;
}

_e.resize = function(){
	this.StartWin("设置大小","","380px");
	var _ajax = new ajax;
	var content = _ajax.StartRequest("./win/resize.html","text","");
	this.SetWin(content);
	document.resize.width.value = sl.getwidth();
	document.resize.height.value = sl.getheight();
}

//好友的最新作品显示
_e.displayfriendslide = function(userid,nickname){
	var _ajax = new ajax;
	var result = _ajax.StartRequest("./action.asp?action=friendlist_slide&userid="+userid+"&username="+nickname,"text","");
	document.getElementById("friendlist").innerHTML = result;
}

//删除留言
_e.delcomment = function(id){
	if(!confirm("您确定要删除这条留言吗？")){
		return;
	}
	var url = "./index.asp?action=delcomment&id="+id;
	var _ajax = new ajax;
	_ajax.StartRequest(url,"text","");
	alert("删除留言成功");
	location.href = location.href;
}

//删除好友
_e.delfriend = function(userid,username){
	if(!confirm("您确定要删除"+username+"吗？")){
		return;
	}
	var _ajax = new ajax;
	_ajax.StartRequest("./index.asp?action=delfriend&userid="+userid,"text","");
	location.href = location.href;
}

//添加评论
_e.comment = function(obj){
	if(obj.content.value.length==0){
		alert("请输入评论内容");
		obj.content.focus();
		return false;
	}
	if(obj.username.value.length==0){
		alert("请输入你的大名");
		obj.username.focus();
		return false;
	}
	if(obj.num.value.length==0){
		alert("请输入验证码");
		obj.num.focus();
		return false;
	}
	//var value = obj.content.value;
	//value2 = coder(value);
	//var value3 = encodeURIComponent(value2);
	var _ajax = new ajax();
	var isRight = _ajax.StartRequest("./index.asp?action=checknum&inputnum="+obj.num.value,"text","");
	if(isRight!="1"){
		alert("验证码输入错误");
		return false;
	}
	var url = "./index.asp?action=comment&slideid="+obj.slideid.value+"&username="+obj.username.value+"&content="+obj.content.value+"&num="+obj.num.value;
	var result = _ajax.StartRequest(url,"text","");
	if(result=="0"){
		alert("留言失败");
	}else{
		alert("留言成功");
	}
	location.href = location.href;
	return false;
}
function coder(str) {  
    var s = "";  
    if(str.length == 0) return  "";  
        for(var i=0;i<str.length;i++){  
           switch (str.substr(i,1))  {  
            case   "<"     :   s   +=   "&lt;";       break;  
            case   ">"     :   s   +=   "&gt;";       break;  
			case   "&"     :   s   +=   "&amp;";     break;  
            case   " "     :   s   +=   "&nbsp;";   break;  
            case   "\'"   :   s   +=   "&#39;";     break;  
            case   "\""   :   s   +=   "&quot;";   break;  
            case   "\n"   :   s   +=   "<br>";       break;  
            default       :   s   +=   str.substr(i,1);   break;  
           }
		}
        return s;  	
} 

//评价
_e.submitrank = function(slideid,rank){
	var cookie = _e.GetCookie("molihe_slide_rank");
	if(!cookie){cookie="";}
	//alert(cookie);
	//if(cookie.indexOf("%2C"+slideid+"%2C")>-1){
	//	alert("您已经参加过评分，不能重复评分！");
	//}else{
		var _ajax = new ajax();
		var url = "./index.asp?action=rank&slideid="+slideid+"&rank="+rank;
		var result = _ajax.StartRequest(url,"text","");
        if(result == 'err'){
            alert("对不起, 单项每天只能投10票!");
        }else if(result == 'err1'){
            alert("您还没有登录, 非注册用户不能参与投票!");
        }else{
            alert("评分成功!");
            //location.href = location.href;
            var obj_rank = document.getElementById('rank'+rank);
            obj_rank.innerHTML = Number(obj_rank.innerHTML)+1;
        }
	//}
}

//首页最新
_e.indexnews = function(){
	var _ajax = new ajax();
	var url = "index.asp?action=molihe_news";
	var content = _ajax.StartRequest(url,"text","");
	document.getElementById("slidelist").innerHTML = content;
	document.getElementById("news").className = "xiu_57";
	document.getElementById("tops").className = "";
	document.getElementById("bests").className = "";
}

//首页精品
_e.indexbests = function(){
	var _ajax = new ajax();
	var url = "index.asp?action=molihe_bests";
	var content = _ajax.StartRequest(url,"text","");
	document.getElementById("slidelist").innerHTML = content;
	document.getElementById("bests").className = "xiu_57";
	document.getElementById("tops").className = "";
	document.getElementById("news").className = "";
}


//首页人气
_e.indextops = function(){
	var _ajax = new ajax();
	var url = "index.asp?action=molihe_tops";
	var content = _ajax.StartRequest(url,"text","");
	document.getElementById("slidelist").innerHTML = content;
	document.getElementById("tops").className = "xiu_57";
	document.getElementById("bests").className = "";
	document.getElementById("news").className = "";
}

//魔豆展页-作者魔豆
_e.molihe_slidelist_user = function(userid){
	var _ajax = new ajax();
	var url = "action.asp?action=molihe_slidelist&userid="+userid;
	var content = _ajax.StartRequest(url,"text","");
	document.getElementById("slidelist").innerHTML = content;
	document.getElementById("user").style.backgroundColor = "#dfedf9";
	document.getElementById("cate").style.backgroundColor = "#ffffff";
	document.getElementById("auser").className="a_hei_2";
	document.getElementById("acate").className="";
}

//魔豆展页-相关魔豆
_e.molihe_slidelist_cate = function(cate){
	var _ajax = new ajax();
	var url = encodeURI("action.asp?action=molihe_slidelist&cate="+cate);
	var content = _ajax.StartRequest(url,"text","");
	document.getElementById("slidelist").innerHTML = content;
	document.getElementById("user").style.backgroundColor = "#ffffff";
	document.getElementById("cate").style.backgroundColor = "#dfedf9";
	document.getElementById("auser").className="";
	document.getElementById("acate").className="a_hei_2";
}

//魔豆展页-评论
_e.molihe_slide_ping = function(moliheid,page){
	var _ajax = new ajax();
	var url = "action.asp?action=molihe_slide_ping&moliheid="+moliheid+"&page="+page;
	var content = _ajax.StartRequest(url,"text","");
	document.getElementById("slideping").innerHTML = content;
}

//添加好友
_e.addfriend = function(userid,username){
	var _ajax = new ajax;
	var result = _ajax.StartRequest("./index.asp?action=checklogin","text","");
	if(result=="0"){
		alert(username+"的作品很酷吧，请点确定按钮登录以后即可成功订阅了");
		et.login(0);
		return;
	}else{
		var content = _ajax.StartRequest("./index.asp?action=addfriend&userid="+userid,"text","");
		if(content=="1"){
			alert("恭喜您订阅成功，您可以直接在“我的订阅”中看到"+username+"的最新大作罗~");
		}
		if(content=="207"){
			alert("这个作品很酷吧，这可是你自己的作品哦~");
		}
		if(content=="208"){
			alert("您已经订阅过了"+username+"的作品哦");
		}
	}
}

//输入图片网址
_e.getpic = function(){
	this.StartWin("导入图片网址","","320px");
	var _ajax = new ajax;
	var content = _ajax.StartRequest("./win/getpic.html","text","");
	this.SetWin(content);
}

//上传窗口
_e.open_upload = function(){
	this.openiframe("上传图片","","upload_flash.html",600,336,"no",true);
}

//音乐列表
_e.open_musiclist = function(){
	this.openiframe("选择背景音乐","","musiclist.asp",540,336,"auto",true);
}

//预览
_e.preview = function(){
    sl.resetDragId();
	//sl.getplay_mode 
	
	//this.openiframe('预览','','flash_slide.html?vars=|'+sl._width+'|'+sl._height,sl._width,sl._height,'no',false);
	this.openiframe('预览','','flash_slide.html?vars=|'+sl._width+'|'+sl._height+'|'+sl.getplay_mode() ,sl._width,sl._height,'no',false);
	
	document.getElementById("openwincontent").style.padding = "0px";
}

//弹窗
_e.openiframe = function(title,footer,url,width,height,scrolling,isj,v){
	this.StartWin(title,footer,width+"px");
	if(isj==true){width -= 20};
	var content = "<iframe align=\"center\" frameborder=\"0\" height=\""+height+"\" width=\""+width+"\" scrolling=\""+scrolling+"\" src=\""+url+"\" name=\"openiframe\"></iframe>";
	
	//
	if(v == null){}
	else if(v == "qq"){content += '<div><img src="http://img.tongji.cn.yahoo.com/643306/ystat.gif" /></div>';}
	else if(v == "163"){content += '<div><img src="http://img.tongji.cn.yahoo.com/643308/ystat.gif" /></div>';}
	this.SetWin(content);
}

//更改头像
_e.modface = function(){
	this.loadwin("上传头像","","./win/upload_face.html","320px");
}

//更改用户设置
_e.moduserset = function(nickname,rank_allow,comment_allow){
	this.loadwin("修改设置","","./win/moduserset.html","320px");
	var obj = document.moduserset;
	obj.nickname.value = nickname;
	var r = 1 - rank_allow;
	var c = 1 - comment_allow;
	obj.rank_allow[r].checked = true;
	obj.comment_allow[c].checked = true;

}

//弹窗
_e.loadwin = function(title,footer,url,width){
	_e.StartWin(title,footer,width);
	var _ajax = new ajax;
	var content = _ajax.StartRequest(url,"text","");
	_e.SetWin(content);
}

//找回密码
_e.getpass = function(){
	var _ajax = new ajax;
	var regcontent = _ajax.StartRequest("./win/getpass.html","text","");
	//alert(regcontent);
	var winstr = _ajax.getwin("找回密码",regcontent,"");
	//var winstr = "a";
	this.CreateMask();
	//alert(winstr);
	this.CreateWin(winstr,"260px");
}

//保存slide窗口 0526
_e.saveslide = function(v,issave){
    sl.resetDragId();
	if(!sl.getimginfo()){
		alert("您还没有添加图片，不能进行保存！");
		return;
	}
	if(!issave){
		var _ajax = new ajax;
		var result = _ajax.StartRequest("./index.asp?action=checklogin","text","");
		if(result=="0"){
			_e.login("1");
			return;
		}
	}
	this.StartWin("保存魔豆","","260px");
	var _ajax = new ajax;
	var winstr = _ajax.StartRequest("./win/saveslide.html","text","");
	if(v == null){}
	else if(v == "up"){winstr += '<div><img src="http://img.tongji.cn.yahoo.com/643251/ystat.gif" /></div>';}
	else if(v == "down"){winstr += '<div><img src="http://img.tongji.cn.yahoo.com/643252/ystat.gif" /></div>';}
	this.SetWin(winstr);
    document.getElementById("name").focus();
	document.getElementById("name").focus();
}
//修改保存slide窗口
_e.modsaveslide = function(){
	this.StartWin("保存魔豆","","260px");
	var _ajax = new ajax;
	var winstr = _ajax.StartRequest("./win/modsaveslide.html","text","");
	this.SetWin(winstr);
}

//注册窗口
_e.register = function(num){
	this.StartWin("用户注册","","420px");
	var _ajax = new ajax;
	var str = "";
	var randnum = Math.floor(Math.random()*100000000+1);
	var regcontent = _ajax.StartRequest("/win/register.html","text","");
				
	winstr = regcontent.replace("{randnum}",randnum);
	winstr = winstr.replace("{*num*}",num);
	winstr = winstr.replace("{*num*}",num);
	winstr = winstr.replace("{*str*}",str);
	//alert(regcontent);
	//var winstr = _ajax.getwin("用户注册",regcontent,"");
	//var winstr = "a";
	//this.CreateMask();
	//alert(winstr);
	this.SetWin(winstr);
	document.getElementById("email").focus();
	document.getElementById("email").focus();
			//邮箱后缀  yt
			
}

_e.checktype = function(type){
	var obj = document.register.type;
	for(var i=0;i<obj.length;i++){
		if(obj[i].value==type){
			obj[i].checked = true;
			break;
		}
	}
}

//登陆窗口
_e.login = function(num){
	var _ajax = new ajax;
	var regcontent = _ajax.StartRequest("/win/login.html","text","");
	//alert(regcontent);

	var str = "";

	if(num=="1"){
		str = "永久保存请先『登录』或『<a href=\"javascript:et.closewin();et.register('"+num+"')\">免费注册</a>』<br /><a href=\"javascript:et.closewin();et.saveslide(1);\">暂时保存，我下次再注册</a>";
	}
	
	if(num=="2"){
		str = "永久保存请先『登录』或『<a href=\"javascript:et.closewin();et.register('"+num+"')\">免费注册</a>』<br /><a href=\"javascript:et.closewin();sl.editslide_save(1);\">暂时保存，我下次再注册</a>";
	}

	var winstr = _ajax.getwin("用户登录",regcontent,"");
	winstr = winstr.replace("{*num*}",num);
	winstr = winstr.replace("{*num*}",num);
	winstr = winstr.replace("{*str*}",str);
	//var winstr = "a";
	this.CreateMask();
	//alert(winstr);
	this.CreateWin(winstr,"280px");
	var logininfo = this.GetCookie("logininfo_slide");
	if(logininfo){
		//var li = logininfo.split("%7C%7C");
		//document.login.email.value=li['0'];
		//document.login.pwd.value=li['1'];
		//document.login.issavelogin.checked = true;
	}
	document.getElementById("email").focus();
}

_e.checksavelogin = function(){
	var logininfo = this.GetCookie("logininfo");
	if(logininfo){
		var li = logininfo.split("%7C%7C");
		document.login_s.username.value=li['0'];
		document.login_s.pwd.value=li['1'];
		document.login_s.issavelogin.checked = true;
	}
}


//打开窗口
_e.CreateWin = function(str,width){
	if(!document.getElementById("apc_01")){
		var oResult	= document.createElement('div');
		oResult.id = "apc_01";
	}
	//oResult.innetHTML = "BB";
	document.body.appendChild(oResult);
	document.getElementById("apc_01").innerHTML = str;
	document.getElementById("apc_01").style.width = width;
	document.getElementById("apc_01").style.left = ((document.getElementsByTagName("body").item(0).offsetWidth - document.getElementById("apc_01").offsetWidth) / 2)+"px";
	var tops = (document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.getElementsByTagName("body").item(0).scrollTop;
	document.getElementById("apc_01").style.top = (120+tops)+"px";
	
}

_e.share_layer = function() {
	this.CreateMask();
	var str = '<div class="share_layer"><div class="st"></div><div class="sc"><h3>恭喜您制作的魔豆相册“'+document.getElementById("ee1").firstChild.nodeValue+'”已成功保存!</h3><div class="share_layer_123"><a href="javascript:getvalue()";></a><a href="javascript:et.share_layer2();"></a><a href="javascript:getvalue2();"></a></div><div class="share_close"><div style="float:left; padding-left:35px; font-size:12px; height:26px; line-height:26px;"><a href="'+myurl+'/mymolihe.asp">我的魔豆列表</a>&nbsp;&nbsp;&nbsp;<a href="'+myurl+'/makemolihe.asp">再制作一个</a></div><a href="javascript:et.closewin();getvalue3();"><img src="/images/share_close.gif" border="0" /></a></div></div><div class="sd"></div></div>';
	this.CreateWin(str,"554px");
}
_e.share_layer2 = function() {
	this.closewin();
	this.CreateMask();
	var str = '<div class="share_layer"><div class="st"></div><div class="sc"><h3>恭喜您制作的魔豆相册'+document.getElementById("ee1").firstChild.nodeValue+'已成功保存!</h3><div class="share_layer_2"><p><b>魔豆相册地址<span style="color:#FF6600;">已复制好</span>，使用Ctrl+V可以粘贴到QQ/MSN，发给好友看！</b></p><p><textarea id="cc1" name="">'+document.getElementById('a1').value+'?st=copy</textarea></p><p><b>你还可以：</b><br />·<a href="'+myurl+'/share.asp?action=qq-qzone&moliheid=197486645">美化空间：把魔豆相册添加到你的博客和空间&nbsp;>></a><br /> ·<a href="'+myurl+'/top.asp">提升人气：了解如何让更多朋友看你的魔豆相册&nbsp;>></a></p></div><div class="share_close"><div style="float:left; padding-left:35px; font-size:12px; height:26px; line-height:26px;"><a href="'+myurl+'/mymolihe.asp">我的'+my_name+'列表</a>&nbsp;&nbsp;&nbsp;<a href="'+myurl+'/makemolihe.asp">再制作一个</a></div><a href="javascript:et.closewin();getvalue3();"><img src="/images/share_close.gif" border="0" /></a><img src="http://img.tongji.cn.yahoo.com/644692/ystat.gif" border="0" /></div></div><div class="sd"></div></div>';
	this.CreateWin(str,"554px");
	var obj = document.getElementById('cc1');
	var bbb = '推荐一个我刚刚在魔豆制作的相册“'+document.getElementById("ee1").firstChild.nodeValue+'”给你看看:';
	window.clipboardData.setData("Text",bbb+obj.firstChild.nodeValue);
}

//初始化窗口
_e.StartWin = function(title,footer,width){
	this.CreateMask();
	winstr = this.getwin(title,"<div align=\"center\"><img src=\"/images/loading.gif\" /></div>",footer);
	this.CreateWin(winstr,width);
}

//设置窗口内容
_e.SetWin = function(str){
	document.getElementById("openwincontent").innerHTML = str;
}

//窗口拖动
_e.startmove = function(evt){
	if(!evt){evt=window.event;}
	//alert(this.isflag);
	_e.isflag = true;
	_e.oldX = evt.clientX;
	_e.oldY = evt.clientY;
	document.onmousemove = this.MoveWin;
	document.onmouseup = this.stopmove;
}

//停止拖动
_e.stopmove = function(){
	_e.isflag = false;
	//alert(location.href+"\n\n"+location.href.indexOf("action=makeslide"));
	if(location.href.indexOf("makemolihe")>-1){
		//alert("f");
		document.onmouseup = sl.mouseUp;
		document.onmousemove = sl.mouseMove;
	}
	if(location.href.indexOf("modmolihe")>-1){
		//alert("f");
		document.onmouseup = sl.mouseUp;
		document.onmousemove = sl.mouseMove;
	}
}

//打开遮照
_e.CreateMask = function(){
	var oResult	= document.createElement('div');
	oResult.id = "divPageMask";
	document.body.appendChild(oResult);
	document.getElementById("divPageMask").style.display="block";
	document.getElementById("divPageMask").style.left = "0px";
	document.getElementById("divPageMask").style.top = "0px";
	//document.getElementById("divPageMask").style.width = window.screen.width;
	//document.getElementById("divPageMask").style.height = "100%";
	//document.getElementById("divPageMask").style.width = document.getElementsByTagName("body").item(0).scrollWidth+"px";
	var MaskHeight = document.getElementsByTagName("body").item(0).scrollHeight;
	if(MaskHeight<window.screen.height)
		MaskHeight = window.screen.height;
	var MaskWidth = window.screen.width - 21;
	document.getElementById("divPageMask").style.width = MaskWidth+"px";
	document.getElementById("divPageMask").style.height = MaskHeight+"px";	
	
	this.DispalySelect(0);
}

//移动窗口
_e.MoveWin = function(evt){
	if(!evt){evt=window.event;}
	//alert(_e.isflag);
    if(_e.isflag){
		
		var x =evt.clientX;
    	var y = evt.clientY;
		//alert(x+"\n\n"+y);
		var width = document.getElementsByTagName("body").item(0).clientWidth - document.getElementById("apc_01").offsetWidth;
		var height = document.getElementsByTagName("body").item(0).offsetHeight - document.getElementById("apc_01").offsetHeight;
		var lefts = parseInt(document.getElementById("apc_01").style.left.replace("px","")) + (x - _e.oldX);
		var tops = parseInt(document.getElementById("apc_01").style.top.replace("px","")) + (y - _e.oldY);
		if(lefts<0)lefts=0;
		if(tops<0)tops=0;
		//alert(width+"\n"+lefts);
		if(lefts>width){lefts=width;}
		if(tops>height){tops=height;}
		document.getElementById("apc_01").style.left = lefts+"px";
		document.getElementById("apc_01").style.top = tops+"px";
		
		_e.oldX = x;
		_e.oldY = y;
	}
}


//关闭窗口
_e.closeOpenwin = function(){
	if(document.getElementById("apc_01")){
		document.body.removeChild(document.getElementById("apc_01"));
	}	
}

//关闭遮照窗口
_e.closewin = function(){
	if(document.getElementById("apc_01")){
		document.body.removeChild(document.getElementById("apc_01"));
	}
	if(document.getElementById("divPageMask")){
		document.body.removeChild(document.getElementById("divPageMask"));
	}
	this.DispalySelect(1);
}

//窗口进行状态
_e.status = function(){
	document.getElementById("openwincontent").innerHTML = "<div align=\"center\"><img src=\"/common/css/images/status.gif\"></div>";	
}

//设置窗口内容
_e.setopenwincontent = function(str,height){
	if(document.getElementById("openwincontent")){
		document.getElementById("openwincontent").innerHTML = "<div align=\"center\">"+str+"</div>";
	}
}

//显示和隐藏select
_e.DispalySelect = function(val)
{   //显示和隐藏select控件
var dispalyType;
   var arrdispalyType=["hidden","visible"];
   var arrObjSelect=document.getElementsByTagName("select");
   for (i=0;i<arrObjSelect.length;i++)
   {
     arrObjSelect[i].style.visibility=arrdispalyType[val];
   }
}

_e.GetCookie = function (sName)
{
    // cookies are separated by semicolons
	//alert(document.cookie);
    var aCookie = document.cookie.split("; ");
    for (var i=0; i < aCookie.length; i++)
    {
        // a name alue pair (a crumb) is separated by an equal sign
        var aCrumb = aCookie[i].split("=");
        if (sName == aCrumb[0])
        {
            return aCrumb[1];
        }
    }
	//alert(document.cookie);
    // a cookie with the requested name does not exist
    return null;
}

_e.SetCookie = function(sName, sValue, iTime){
	var date = new Date();
	date.setTime(date.getTime()+iTime*1000);
	document.cookie = escape(sName) + "=" + escape(sValue) + "; expires=" + date.toGMTString();
}

_e.closeHelp = function(){
	var visited = false;
	var obj = document.getElementById('help_area');
	_e.SetCookie('visited', document.getElementById("chk_visited").checked, 30*24*60*60);
	obj.style.display = 'none';
}

_e.getwin = function (title,content,footer){
	var winstr = "";
	winstr += "<div class=\"apc_02\" onmousedown=\"et.startmove(event);\"><div class=\"apc_05\">"+title+"</div>";
	winstr += "<div class=\"apc_06\"><a href=\"javascript:et.closewin();\" title=\"关闭\"><img src=\"/common/css/images/apc_03.gif\" width=\"23px\" height=\"23px\" border=\"0\" /></a></div></div>";
	winstr += "<div class=\"apc_03\" id=\"openwincontent\">"+content+"</div>";
	winstr += "<div class=\"apc_04\">";
	winstr += "<div class=\"apc_06\"></div>";
	winstr += "<div class=\"apc_06\">"+footer+"</div>";
	winstr += "</div>";
	return winstr;
}

_e.parent_login = function(t){
	_e.closewin();
	_e.login(t);
}

_e.parent_reg = function(t){
	_e.closewin();
	_e.register(t);
}

//0526
_e.myflash = function(v){
	this.StartWin("添加图片","","600px");
	var _ajax = new ajax;
	var content = _ajax.StartRequest("./win/_7_upload_flash.html","text","");	
	if(v == null){}
	else if(v == "up"){content += '<div><img src="http://img.tongji.cn.yahoo.com/643248/ystat.gif" /></div>';}
	else if(v == "down"){content += '<div><img src="http://img.tongji.cn.yahoo.com/643249/ystat.gif" /></div>';}
	else if(v == "help"){content += '<div><img src="http://img.tongji.cn.yahoo.com/643851/ystat.gif" /></div>';}
	this.SetWin(content);
}
_e.myflash_v = function(){
	_e.closewin();
	_e.myflash();
}
//注册邮箱后缀  yt
		var k = 0;
		var m = 0;
		mail_list = new Array ('163.com','qq.com','126.com','yahoo.cn','yahoo.com.cn','sina.com','21cn.com','sohu.com','tom.com','gmail.com');
		function auto() {
			var aa = document.getElementById("hidden");
			aa.style.display = "block";
			var cc = document.getElementById("email").value;
			var ss = cc.indexOf("@");
			if (ss !=-1) {//判断用户是否输入了@
			//aa.style.display = "none";
			var temp0 = cc.split("@")[0];
			var temp = cc.split("@")[1];
			var temp3 = [];
			for(i=0;i<mail_list.length;i++) {
				var temp2 = mail_list[i].indexOf(temp);
				if (temp2 == 0) temp3.push(mail_list[i]);
			}
			
			if(temp3.length<1) {//判断是否有相匹配的结果
				aa.style.display = "none";
				m=-1;//没有相匹配的结果
			
			document.onkeyup = function(e){//第一路
			if (e == null) { // ie
				keycode = event.keyCode;
			} else { // mozilla
				keycode = e.which;
			}	
			if (keycode == 38) { //up
				m--;
				if(m<0) m=0;
				var aa = document.getElementById("hidden");
				updatePos(aa.getElementsByTagName("p")[m]);
				
			} else if (keycode == 40) {//down
				m++;
				var aa = document.getElementById("hidden");
				var gg = aa.getElementsByTagName("p");
				if(m >=gg.length) m = gg.length-1;
				updatePos(aa.getElementsByTagName("p")[m]);
			} else if(keycode == 13 || keycode == 9){//回车键
				reg.checkemail(document.getElementById('email').value);
			}
			}
				return;
			}
			
			document.onkeyup = function(e){//第二路
				//alert(target.id);
			if (e == null) { // ie
				keycode = event.keyCode;
			} else { // mozilla
				keycode = e.which;
			}
			if(keycode!=13&&keycode!=9) {
				e = e || window.event;
				var target = e.target || e.srcElement;
				if (target.id!='email') {
					return; 
				}
				m=0;
			}
			var mail_box = document.getElementById("hidden");
			var par = "";
			for (i=0;i<=temp3.length-1;i++) {
			var str = '<p onclick = onclick_value2('+ i +')>' +'</p>';
			var par = par + str;
			}
			mail_box.innerHTML = '<h6>请选择您的邮箱类型</h6>' + par;
			var aa = document.getElementById("hidden");
			var bb = aa.getElementsByTagName("p");
			for (i=0;i < temp3.length;i++) {
				var ee = temp0 + "@" +temp3[i];
				bb[i].innerHTML = ee;
			}
			updatePos(aa.getElementsByTagName("p")[m]);
			for ( var i = 0; i < temp3.length; i++ ) {
				bb[i].onmouseover = function() {
				updatePos(this);
			}
			}
			
			
			if (keycode == 38) { //up
				m--;
				if(m<0) m=0;
				var aa = document.getElementById("hidden");
				updatePos(aa.getElementsByTagName("p")[m]);
				
			} else if (keycode == 40) {//down
				m++;
				var aa = document.getElementById("hidden");
				var gg = aa.getElementsByTagName("p");
				if(m >=gg.length) m = gg.length-1;
				updatePos(aa.getElementsByTagName("p")[m]);
			} else if(keycode == 13 || keycode == 9){//回车键
				save_value2();
				//reg.checkemail(document.getElementById('email').value);
			}
			}
				return;//判断结束
			}
			
			//每次键盘事件都添加一遍
			var mail_box = document.getElementById("hidden");
			var par = "";
			for (i=0;i<=mail_list.length-1;i++) {
			var str = '<p onclick = onclick_value('+ i +')>' +'</p>';
			var par = par + str;
			}
			mail_box.innerHTML = '<h6>请选择您的邮箱类型</h6>' + par;
			
			var bb = aa.getElementsByTagName("p");
			for (i=0;i < bb.length;i++) {
				var ee = cc + "@" +mail_list[i];
				bb[i].innerHTML = ee;
			}
			updatePos(aa.getElementsByTagName("p")[k]);
			for ( var i = 0; i < bb.length; i++ ) {
				bb[i].onmouseover = function() {
				updatePos(this);
			}
			}
			
			document.onkeyup = function(e){//第三路
			if (e == null) { // ie
				keycode = event.keyCode;
			} else { // mozilla
				keycode = e.which;
			}
			
			if (keycode == 38) { //up
				k--;
				if(k<0) k=0;
				var aa = document.getElementById("hidden");
				updatePos(aa.getElementsByTagName("p")[k]);
				
			} else if (keycode == 40) {//down
				k++;
				var aa = document.getElementById("hidden");
				var gg = aa.getElementsByTagName("p");
				if(k >=gg.length) k = gg.length-1;
				updatePos(aa.getElementsByTagName("p")[k]);
			} else if(keycode == 13 || keycode == 9){
				save_value();
				//reg.checkemail(document.getElementById('email').value);
			}
			}
			
		}
		function save_value() {
			var aa = document.getElementById("hidden");
			var bb = aa.getElementsByTagName("p")[k];
			var cc = bb.firstChild.nodeValue;
			var dd = document.getElementById("email").value;
			if(dd.length ==0) {
				aa.style.display = "none";
				k=0;
				return
			}
			if(dd.indexOf("@") != -1) {
				aa.style.display = "none";
				k=0;
				return
			}
			document.getElementById("email").value = cc;
			aa.style.display = "none";
			reg.checkemail(document.getElementById('email').value);
			document.getElementById("pwd").focus();
		}
		
		function save_value2() {
			var aa = document.getElementById("hidden");
			var dd = document.getElementById("email").value;
			if(dd.indexOf("@") != -1) {
				aa.style.display = "none";
				if(m==-1){
					m=0;
					document.getElementById("pwd").focus();
					return
				}
			}
			var bb = aa.getElementsByTagName("p")[m];
			var cc = bb.firstChild.nodeValue;
			if(dd.length ==0) {
				aa.style.display = "none";
				m=0;
				return
			}
			document.getElementById("email").value = cc;
			aa.style.display = "none";
			reg.checkemail(document.getElementById('email').value);
			document.getElementById("pwd").focus();
			//m=0;
		}
		function updatePos( elem ) {
			curPos = elem;
			var pp = document.getElementById("hidden").getElementsByTagName("p");
			for ( var i = 0; i < pp.length; i++ )
				removeClass( pp[i], "cur" );
			addClass( curPos, "cur" );
			return false;
		}
		function hasClass(ele,cls) {
			return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
		}
		function addClass(ele,cls) {
			if (!this.hasClass(ele,cls)) ele.className += " "+cls;
		}
		function removeClass(ele,cls) {
			if (hasClass(ele,cls)) {
			var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
			ele.className=ele.className.replace(reg,' ');
			}
		}
		function onclick_value(i) {
			k = i;
			save_value();
			//document.getElementById('pwd').focus();
		}
		function onclick_value2(i) {
			m = i;
			save_value2();
			//document.getElementById('pwd').focus();
		}
		
		function onblur_value() {
			var aa = document.getElementById("hidden");
			aa.style.display = 'none';
		}

		

//iframe 该ajax
//上传窗口
_e.open_upload_ajax = function (ajaxurl,title,v){
	this.StartWin(title,"["+my_url+"]","615px");
	var _ajax = new ajax;
	var content = _ajax.StartRequest(ajaxurl,"text","");
	if(v == null){}
			else if(v == "up"){content += '<div><img 					src="http://img.tongji.cn.yahoo.com/643248/ystat.gif" /></div>';}
			else if(v == "down"){content += '<div><img src="http://img.tongji.cn.yahoo.com/643249/ystat.gif" /></div>';}
			else if(v == "qq"){content += '<div><img src="http://img.tongji.cn.yahoo.com/643306/ystat.gif" /></div>';}
			else if(v == "360"){content += '<div><img src="http://img.tongji.cn.yahoo.com/643308/ystat.gif" /></div>';}
			else if(v == "help"){content += '<div><img src="http://img.tongji.cn.yahoo.com/643851/ystat.gif" /></div>';}
	this.SetWin(content);
}

qq_v = 0;
_e.open_upload_z = function(url,v){
	switch(url){
		case 'upload':
			_e.open_upload_ajax('./nget/upload_flash.asp','上传图片',v);
			break;
		case 'picqq':
			_e.open_upload_ajax('./nget/picqq.asp','QQ相册导入',v);
			break;
		case 'pic360':
			_e.open_upload_ajax('./nget/pic360.asp','360圈相册导入',v);
			break;
		case 'pic163':
			_e.open_upload_ajax('./nget/pic163.asp','网易相册导入');
			break;
		case 'picgg':
			_e.open_upload_ajax('./nget/picgoogle.asp','谷歌相册导入');
			break;
		case 'picurl':
			_e.open_upload_ajax('./nget/picurl.asp','网络图片导入');
			break;
		case 'myalbum':
			_e.open_upload_ajax('myalbum.asp','我的相册导入');
			break;
//==================================
		case 'picqqv1':
			_e.open_upload_ajax('./nget/get_qq_album.asp','QQ相册导入');
			break;
		case 'picqqv2':
			_e.open_upload_ajax('./nget/get_qq_photo.asp','QQ相册导入');
			break;
//==================================
		default:
			this.openiframe("上传图片","","upload_flash.html",600,336,"no",true);
			break;		
	}
}
_e.open_upload_v = function(v){
	_e.closewin();
	_e.open_upload_z(v);
}
//直接提交的函数
_e.getajax_img_ck = function (v){
	var str ='<div align="center">' +
			'<img src="/images/downloading.gif" style="padding:50px;"></div>'
	document.getElementById('ajaxImg').innerHTML = str;
	var _ajax = new ajax;
	var content = _ajax.StartRequest(v,"text",loading_ck);
}
function loading_ck(content) {
	document.getElementById('ajaxImg').innerHTML = content;
	getp3();
}

//我相册的直接提交
_e.getajax_img_ck_my = function (v){
	var str ='<div align="center">' +
			'<img src="/images/downloading.gif" style="padding:50px;"></div>'
	document.getElementById('ajaxImg').innerHTML = str;
	var _ajax = new ajax;
	var content = _ajax.StartRequest(v,"text",loading_ck_my);
}
function loading_ck_my(content) {
	document.getElementById('ajaxImg').innerHTML = content;
	getp4();
}

//除qq外的其他相册
_e.getajax_img = function (v){
	var str ='<div align="center">' +
			'<img src="/images/downloading.gif" style="padding:50px;"></div>'
	document.getElementById('ajaxImg').innerHTML = str;
	var _ajax = new ajax;
	var content = _ajax.StartRequest(v,"text",loading);
}
function loading(content) {
	document.getElementById('ajaxImg').innerHTML = content;
}
//qq一级页面
_e.getajax_img_q = function (v){
	var str ='<div align="center">' +
			'<img src="/images/downloading.gif" style="padding:50px;"></div>'
	document.getElementById('ajaxImg').innerHTML = str;
		var _ajax = new ajax;
		var content = _ajax.StartRequest(v,"text",loading_q);
}
function loading_q() {
	document.getElementById('ajaxImg').innerHTML = '<form method="post" name="abl" action=""><input type="hidden" name="qq" value='+qq_v+'><div class="xiu_15"><div class="xiu_19" style="background:#fff;"><div id="qqxml" name="qqxml" style="padding:0px 10px 10px 10px; overflow: auto; height:180px;"><div style="padding-left:200px;padding-top:20px;"><img src="images/downloading.gif"></div></div></div></form><div class="picFooter"><a onclick="ckqq();"><input type="button" class="btn_add"/></a></div>';
	grabFile("./nget/getqqxml.asp?qq="+qq_v);
}
//qq二级页面
var tep = '';
_e.getajax_img_qq = function (v){
	var str ='<div align="center">' +
			'<img src="/images/downloading.gif" style="padding:50px;"></div>'
	document.getElementById('ajaxImg').innerHTML = str;
		var _ajax = new ajax;
		var content = _ajax.StartRequest(v,"text",loading_qq);
		tep = v.split("aid=")[1];
		
}
function loading_qq() {
	document.getElementById('ajaxImg').innerHTML = '<form method="post" name="p" action=""><input type="hidden" name="qq" value='+qq_v+'><div class="xiu_15"><div class="xiu_19" style="background:#fff;"><div id="qqixml" name="qqixml" style="padding:0px 10px 10px 10px; overflow: auto; height:180px;"><div style="padding-left:200px;padding-top:20px;"><img src="images/downloading.gif"></div></div></div></div></form><div class="picFooter"><a href="javascript:et.getajax_img_q(\'./nget/get_qq_album.asp?qq='+qq_v+'\');">返回到我的相册</a>&nbsp<input type="checkbox" name="ca" value="" onclick="sal(this.checked);">全选&nbsp<a href=""><input type="button" onclick ="getp();" class="btn_add"/></a>';
	grabFile2("./nget/getqqixml.asp?qq="+qq_v+"&aid="+tep);
}

//qqck
_e.getajax_img_qq_ck = function (v){
	var str ='<div align="center">' +
			'<img src="/images/downloading.gif" style="padding:50px;"></div>'
	document.getElementById('ajaxImg').innerHTML = str;
		var _ajax = new ajax;
		var content = _ajax.StartRequest(v,"text",loading_qq_ck);
		tep = v.split("aid=")[1];
		
}
function loading_qq_ck() {
	document.getElementById('ajaxImg').innerHTML = '<form method="post" name="p" action=""><input type="hidden" name="qq" value='+qq_v+'><div class="xiu_15"><div class="xiu_19" style="background:#fff;"><div id="qqixml" name="qqixml" style="padding:0px 10px 10px 10px; overflow: auto; height:180px;"><div style="padding-left:200px;padding-top:20px;"><img src="images/downloading.gif"></div></div></div></div></form><div class="picFooter"><a href="javascript:et.getajax_img_q(\'./nget/get_qq_album.asp?qq='+qq_v+'\');">返回到我的相册</a>&nbsp<input type="checkbox" name="ca" value="" onclick="sal(this.checked);">全选&nbsp<a href=""><input type="button" onclick ="getp();" class="btn_add"/></a>';
	grabFile3("./nget/getqqixml.asp?qq="+qq_v+"&aid="+tep);
}
//end