function	SelectFriend(obj)
{
	ul = showModalDialog("../app/sms_friend.html",window,"center:yes;dialogHeight:265px;dialogWidth:250px;help:no;status:no;scrollbars=no")	
	if(ul != null){
		obj.value = obj.value + ul;
	}
}

var clocktext, timeday;
var pagetitle = window.status;
function time_scroll() 
{
	today = new Date();
	sec = today.getSeconds();
	hr = today.getHours();
	min = today.getMinutes();
	
	time_info = "";
	timeday = "";
	if(hr<=1) timeday = " 午夜";
	if(hr>1 && hr <=5) timeday =" 凌晨";
	if(hr>5 && hr <=10) timeday = " 上午";
	if(hr>10 && hr<=12) timeday = " 中午";
	if(hr>12 && hr<=16) timeday = "下午";
	if(hr>16 && hr<=18) timeday = "傍晚";
	if(hr>18 && hr<=21) timeday = " 晚上";
	if(hr>21 && hr<=23) timeday = " 深夜";
	if(hr>=22 || hr<=1){
		time_info = "    夜深了，您也该休息了!";
	}
	
	if (hr > 12) hr = hr - 12;
	if (hr <= 9) hr = "0" + hr;
	if (min <= 9) min = "0" + min;
	if (sec <= 9) sec = "0" + sec;
	var clocktext = timeday+" - " + hr + ":" + min + ":" + sec;
	clocktimer = setTimeout("time_scroll()", 1000);
	window.status = pagetitle + "欢迎您的光临 ：" + clocktext + time_info;
}

function	noname()
{
	if(talk.nn.checked)
		talk.userid.value = "无记名";
	else
		talk.userid.value = "";
}

function choose_icon()
{  
	p = showModalDialog("../comm/icon.asp",window,"center:yes;dialogHeight:140px;dialogWidth:190px;help:no;status:no")
	if(p != null)
	{
		window.photo.innerHTML = "<p align=center><img src=" + p + "></p>";
		slt.icon.value = p;
	}
}

function ShowMenu(obj, menu)
{
	menu.style.display == "none"? menu.style.display ="": menu.style.display="none";
	menu.style.display == "none"? obj.src = "../images/add001.gif": obj.src = "../images/sub001.gif";
}

function HideMenu(menu, show)
{
	menu.style.display = show;
}

function	getOK(op, loc)
{
	if(op == 1)
		op = "删除";
	var sTmp = "警告: " + op + "不可以恢复，是否确定进行" + op + "操作？";
	
	var ret = window.confirm( sTmp );
	
	if( ret )
	{
		document.location = loc;
	}
}
function	OK(op)
{
	if(op == 1)
		op = "删除";
	var sTmp = "提醒: 是否确定进行 " + op + " 操作？";
	
	var ret = window.confirm( sTmp );
	
	return ret;	
}
function	retOK(op,loc)
{
	if(op == 1)
		op = "删除";
	var sTmp = '提醒: 是否确定进行"' + op + '"操作？';
	
	var ret = window.confirm( sTmp );
	
	if( ret )
		document.location = loc;
}


function seldate(txt)
{
	strFeatures="dialogWidth=180px;dialogHeight=210px;help=no;status=no";
	var url='../comm/date.htm'
	var temp;
	temp=window.showModalDialog(url,txt.value,strFeatures);
	if(temp!='')
	{
		txt.value=temp;
	}
}


function UploadError(sErrDesc){
	try {
		alert(sErrDesc);
	}
	catch(e){}
}

function	SaveUpload(s,src)
{
	try{
		rich.filename.value = s;
	}
	catch(e){}
	try{
		rich.srcontext.value = src;
	}		
	catch(e){}
	
	try{
		filename.value = s;
	}
	catch(e){}
	try{
		slt.filename.value = "../upload/" + s;
	}catch(e){}
	try{
		slt.icon.value = "../upload/" + s;
	}catch(e){}
	try{
		p = "../upload/" + s;
		window.photo.innerHTML = "<p align=center><img src=" + p + "></p>";
		slt.icon.value = p;
	}catch(e){}
	try{
		bbs.filename.value = "../upload/" + s;
	}catch(e){}
	
	try{
		file_upload.style.display="none";
	}catch(e){}
}
function	DrawImg(ImgD)
{
	var image=new Image(); 
	image.src=ImgD.src; 
	if(image.width>0 && image.height>0){ 
		flag=true; 
		if(image.width>=500){ 
			ImgD.width=500; 
			ImgD.height=(image.height*500)/image.width; 
		}else{ 
			ImgD.width=image.width; 
			ImgD.height=image.height; 
		}  
	} 
}

function	OpenImg(imgSrc)
{
	window.open(imgSrc,'','scrollbars=yes,resizable=yes');
}

function	 adjustDialog()
{
	IsSP2 = (navigator.userAgent.indexOf("SV1") != -1);
	var w = tabDialogSize.offsetWidth + 6;
	var h = tabDialogSize.offsetHeight + 25;
	if(IsSP2){
		h += 45;
	}
	window.dialogWidth = w + "px";
	window.dialogHeight = h + "px";
	window.dialogLeft = (screen.availWidth - w) / 2;
	window.dialogTop = (screen.availHeight - h) / 2;
	
	window.moveTo(window.dialogLeft,window.dialogTop);
	window.resizeTo(w, h);
}

var	newWindow;
function	openWindow(str)
{
	if(newWindow==null)
		newWindow = window.open(str, '', 'width=5,height=5,toolbars=no');
	else
		try{
			newWindow.focus();
		}
		catch(e){
			newWindow = window.open(str, '', 'toolbars=no,width=5,height=5');
		}
}
function	userinfo(id)
{
	window.open("../comm/userinfo.asp?id="+id, "", "height=440,width=400");
}

function	OpenWindow(url)
{
	w=window.open("about:blank","w","width="+(screen.availWidth-4)+",height="+(screen.availHeight-20)+",toolbar=no,scrollbars=2,resizable=2");
	w.moveTo(-4,-4);
	w.location.href=url;
}

function	Login()
{
	userid = login_userid.value;
	pwd = login_userpwd.value;
	if(userid != "" && pwd != "")
		window.location="../comm/login.asp?userid=" + userid + "&pwd=" + pwd;	
}

function Register(loc)
{
	window.open("../comm/register.asp","","width=600,height=520,toolbars=no");
}

function	enter(uio,pso)
{
	ui = uio.value;
	ps = pso.value;
	
	if(event.keyCode == 13)
	{
		if(ui=="")
		{
			uio.focus();
			return;
		}
		if(ps=="")
		{
			pso.focus();
			return;
		}
		
		window.location="../comm/login.asp?userid=" + ui+ "&pwd=" + ps;	
	}
}
function	kw_focus()
{
	if(kw.value=="请输入关键字")
		kw.value="";
}
function	kw_blur()
{
	if(kw.value=="")
		kw.value="请输入关键字";
}

function	Search(){
	if(kw.value!="")
	{
		var search_val = "";		
		try{
			search_val = search.value;
		}catch(e){}
		src = '../app/search.asp?kw=' + kw.value + "&search=" + search_val;
		document.location = src;
	}
}