var closeConfirm = function (val) {
	if (val == 1) {
		$(span_id).innerHTML = "����<font color='red'>ȷ��</font>��ť";
	} else if (val == 2) {
		$(span_id).innerHTML = "����<font color='red'>ȡ��</font>��ť";
	}
}

function refreshCode(id) {
	$(id).src="/users/captcha/"+parseInt(Math.random()*(1000) + 1);
}

//       _page.showStockQuotes = true;      
//       _page.loadSIFR=true;
//		_page.writeHeader("lighting");
		var m_sSectionBannerTag = "";
		

var crtFocused;
function showSubMenu(obj){
	if(crtFocused && crtFocused!=null){
		crtFocused.style.display = "none";
	}
	if(document.getElementById(obj)!=null){
		document.getElementById(obj).style.display = "block";
		crtFocused = document.getElementById(obj);
	}
}

function slide(id) {
	if ($(id).getStyle('display') == "none") {
		Effect.SlideDown(id, { duration: 1.2 });
	} else {
		Effect.SlideUp(id, { duration: 1.2 });
	}
}

		
var horizontal_offset="9px" //horizontal offset of hint box from anchor link

/////No further editting needed

var vertical_offset="0" //horizontal offset of hint box from anchor link. No need to change.
var ie=document.all
var ns6=document.getElementById&&!document.all

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1
if (whichedge=="rightedge"){
var windowedge=ie && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-30 : window.pageXOffset+window.innerWidth-40
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth+parseInt(horizontal_offset)
}
else{
var windowedge=ie && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
}
return edgeoffset
}

function showhint(menucontents, obj, e, tipwidth){
if ((ie||ns6) && document.getElementById("hintbox")){
dropmenuobj=document.getElementById("hintbox")
dropmenuobj.innerHTML=menucontents
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (tipwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=tipwidth
}
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
dropmenuobj.style.visibility="visible"
obj.onmouseout=hidetip
}
}

function hidetip(e){
dropmenuobj.style.visibility="hidden"
dropmenuobj.style.left="-500px"
}

function createhintbox(){
var divblock=document.createElement("div")
divblock.setAttribute("id", "hintbox")
document.body.appendChild(divblock)
}

if (window.addEventListener)
window.addEventListener("load", createhintbox, false)
else if (window.attachEvent)
window.attachEvent("onload", createhintbox)
else if (document.getElementById)
window.onload=createhintbox



function selectface(id, contentId){
	var contentId1 = contentId+"1";
	$('face').style.display='none';
	var con=$(contentId1).innerHTML;
	var img='<img src="/livingcolors/images/'+id+'">';
	var str=con+img;
	var oimg = document.createElement("IMG");
	oimg.src="/livingcolors/images/"+id;
	$(contentId1).appendChild(oimg);
	$(contentId).value=str;
}
function showallfaces(){
	if($('face').style.display=='block'){
		$('face').style.display='none';
	}else{
		$('face').style.display='block';
	}
}
function showhideMenu(which)
{
	var obj=document.getElementById(which)
	obj.style.display=(obj.style.display==''?'none':'')
}
function ifempty(contentId){
//	var a=$('NoteContent').value;
	var contentId1 = contentId+"1";
	$(contentId).value = $(contentId1).innerHTML;
	if ($(contentId1).value == "" && $(contentId).value == "") {
		alert("输入的内容不能为空");
		$(contentId1).focus();
		return false;
	} else {
		return true;
	}
}

function send_sms(icon, user, id) {
	var _dialog_html = '';
	_dialog_html += "<div><div class='touxiang'><div class='touxiangkuang'>"+icon+"<br />"+user+"</div></div>"
	_dialog_html +="<div><form method='post' action='/livingcolors/messages/dialog_send' target='send' class='wbian'><div id='content' style='text-align:left;'>如果对方在线, 可以直接与其聊天<p>内   容:<p><textarea id=passed name='data[Msg][message]' style='width:287px;height:88px;border:1px solid #red;'/></textarea></p><p>"
	_dialog_html += "<input type=hidden name='data[Msg][user_id]' value='"+id+"' onclick='return true;' />";
	_dialog_html += "<div id='hybutton'><input type='image' src='/livingcolors/images/quedingred.jpg' onclick='return true;' style='text-align:right;'/>";
	_dialog_html += "&nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:void(0)' onClick='javascript:showDialog.hideDialog()'><img src='/livingcolors/images/quxiaogray.jpg' style='text-align:right;' /></a></div>";
	_dialog_html += "</p></div></form></div><iframe name='send' src='' width='0' height='0' border='0' scroll='no'></iframe></div>";
	showDialog.init('发送短信息(私密对话)', _dialog_html, 'warning');
}

function fire_list(userId, inputId, listId, app) {
	
	new Ajax.Updater(listId, '/livingcolors/home/friend_list/'+userId, {
		asynchronous:true, 
		evalScripts:true, 
		parameters: "input="+inputId+"&list="+listId+"&app="+app,
		onComplete:function(request) {
			$(listId).setStyle({'z-index': 200, 'display':'block', 'width': '310px'});
			$(listId).show();
		},
		requestHeaders:['X-Update', listId]
	});
}

function selectFriend(id, list, app) {
	var name = new Array();
	if (app == "gift") {
		lists =	$$("div#f_container input[type=radio]");
	} else {
		lists =	$$("div#f_container input[type=checkbox]");
	}
	var len = lists.length;
	for(var n=0; n < len; n++) {
		if ($F(lists[n]) == undefined || $F(lists[n]) == null) {
			continue;
		}
		name[name.length] = $F(lists[n]);
	}
	$(id).value = name.join();
	if (app == "gift") {
		new Ajax.Updater('gift_recv', '/livingcolors/users/icon/'+encodeURI($F(id)), {
			asynchronous:true, 
			evalScripts:true, 
			onComplete:function(request) {
				$(list).hide();
			},
			requestHeaders:['X-Update', 'gift_recv']
		});
	} else {
		$(list).hide();
	}
}