// JavaScript Document
function hidshow(idname){
	var thespn = document.getElementById(idname);
	var theul = document.getElementById(idname+"1");
	if(theul.style.display == "block"){
		thespn.className = "hide-show-down";
		theul.style.display = "none"
	}
	
	else{
		thespn.className = "hide-show";
		theul.style.display = "block"
	}
}
function bookmarksite(title, url)
{
	if(document.all)
	window.external.AddFavorite(url, title);
	else if (window.sidebar)
	window.sidebar.addPanel(title, url, "")
}
function guanbi() {
	var hidddv = document.getElementById("myhidd");
		hidddv.style.display = "none";
}	
function libg(){
	var thelis = document.getElementById('thelibg').getElementsByTagName('li');
	
	for(var i = 0; i<thelis.length ;i++ ) {
		thelis[i].onmouseover = function() {
			this.style.background = "#f9f4f1";
		}
		thelis[i].onmouseout = function() {
			this.style.background = "none";
		}
	}
}

function thetopdono(){
	var thelicls = document.getElementById('todn1').className;
	if( thelicls == "my_malp2"){
		document.getElementById('todn1').className = "my_malp2-top";
	}
	if( thelicls == "my_malp2-top"){
		document.getElementById('todn1').className = "my_malp2-down";
	}
	if( thelicls == "my_malp2-down"){
		document.getElementById('todn1').className = "my_malp2-top";
	}
}

function thetopdont(){
	var thelicls = document.getElementById('todn2').className;
	if( thelicls == "my_malp3"){
		document.getElementById('todn2').className = "my_malp3-top";
	}
	if( thelicls == "my_malp3-top"){
		document.getElementById('todn2').className = "my_malp3-down";
	}
	if( thelicls == "my_malp3-down"){
		document.getElementById('todn2').className = "my_malp3-top";
	}
}

function thetopdonf(){
	var thelicls = document.getElementById('todn3').className;
	if( thelicls == "my_malp4"){
		document.getElementById('todn3').className = "my_malp4-top";
	}
	if( thelicls == "my_malp4-top"){
		document.getElementById('todn3').className = "my_malp4-down";
	}
	if( thelicls == "my_malp4-down"){
		document.getElementById('todn3').className = "my_malp4-top";
	}
}
var writemail;
function newmail_send()
{
	obj('mailtype').name = 'send';
	var sendmail_form = obj('sendmail');
	if(jQuery.trim(sendmail_form.title.value)=='')
	{
		swoole.alert('邮件主题不能为空');
		return false;
	}
	if(jQuery.trim(sendmail_form.content.value)==''){
		swoole.alert('邮件内容不能为空');
		return false;
	}
	sendmail_form.submit();
}
function newmail_save()
{
	obj('mailtype').name = 'save';
	var sendmail_form = obj('sendmail');
	if(jQuery.trim(sendmail_form.title.value)=='')
	{
		swoole.alert('邮件主题不能为空');
		return false;
	}
	if(jQuery.trim(sendmail_form.content.value)==''){
		swoole.alert('邮件内容不能为空');
		return false;
	}
	sendmail_form.submit();
}
function sendmail(tid,tname,avatar)
{
	if(!islogin){
		location.href = 'http://www.21xiehou.com/page/login/';
		return false;
	}
	if(!tid) return false;
	var mailto = '<form id="sendmail" name="sendmail" method="post" action="/mail/writeto/?tid='+tid+'">\
		<div class="Dialog_cont" style="background:url(/static/images/myxh_diagmsgbg1.gif) right bottom no-repeat;">\
		<div class="my_fsyjpic mb30">\
			<a href="#"><img src="'+ avatar +'" alt="" /></a>\
			<p><a href="#">'+tname+'</a></p>\
			<input name="tid" type="hidden" id="tid" value="'+tid+'" />\
			<input name="send" type="hidden" id="mailtype" />\
	        <input name="tname" type="hidden" id="tname" value="'+tname+'" />\
		</div>\
		<ul class="my_gimrhuifu">\
			<li><label>主题：</label><input type="text" name="title" value="" class="inpt_4" /></li>\
			<li class="li1"><label>内容：</label><textarea name="content" class="textarea_3"></textarea></li>\
			<li class="li2">\
				<input type="checkbox" value="" name="" checked="checked" disabled="disabled" />\
				<label>已经阅读并同意<a href="http://www.21xiehou.com/page/help/?id=30" target="_blank">《21邂逅网站隐私条约》</a></label>\
			</li>\
		</ul>\
		<div class="fsqb_spn1">写信成功后，您可以在收件箱看到此邮件。</div>\
	</div></form>';
	var btns = [new swoole.Button('发送',newmail_send),new swoole.Button('保存为草稿',newmail_save)];
	writemail = new swoole.Dialog('发送邮件',mailto,450,480,true,btns);
	writemail.show();
}
var writeleer;
function setValue(id,value)
{
	obj(id).value = value;
	return true;
}
function newleer_send()
{
	var sendleer_form = obj('sendleer');
	if(jQuery.trim(sendleer_form.leerid.value)=='')
	{
		swoole.alert('请选择要发送的秋波');
		return false;
	}
	sendleer_form.submit();
}
function sendleer(tid,tname)
{
	if(!islogin){
		location.href = 'http://www.21xiehou.com/page/login/';
		return false;
	}
	if(!tid) return false;
	var leerto = '<form id="sendleer" name="sendleer" method="post" action="/mail/leer/">\
	<input name="tid" type="hidden" id="tid" value="'+tid+'" />\
	<input name="tname" type="hidden" id="tname" value="'+tname+'" />\
	<input name="leerid" type="hidden" id="leerid" value="" />\
	<iframe src="/mail/leer/" scrolling="no" width="450" height="650" frameborder="0">\
	</form>';
	var btn = [new swoole.Button('发送',newleer_send)];
	writeleer = new swoole.Dialog('发送秋波',leerto,450,650,true,btn);
	writeleer.show();
}
var ifcheck=true;
function CheckAll(form)
{
	for (var i=0;i<form.elements.length;i++)
	{
		var e = form.elements[i];
		if(e.type=='checkbox') e.checked = ifcheck;
	}
	ifcheck = ifcheck == true ? false : true;
}
var writelove;
function lovemessage(tid,tname){
	if(!islogin){
		location.href = 'http://www.21xiehou.com/page/login/';
		return false;
	}
	if(!tid) return false;
	var loveto = '<form id="sendlove" name="sendlove" method="post" action="/user_relation/lovemessage/">\
        <input name="tid" type="hidden" value="'+tid+'" />\
        <input name="tname" id="tname" type="hidden" value="'+tname+'" />\
        <input name="love_content" type="hidden" id="love_content" value="" />\
        <iframe src="/user_relation/lovemessage/?tid='+tid+'" scrolling="no" width="375" height="470" frameborder="0">\
</form>';
var btns = [new swoole.Button('发送',sendlove)];
writelove = new swoole.Dialog('发送爱情宣言',loveto,390,470,true,btns);
writelove.show();
}
function sendlove(){
	var sendlove_form = obj('sendlove');
	if(jQuery.trim(sendlove_form.love_content.value)=='')
	{
		swoole.alert('请填写爱情宣言');
		return false;
	}
	sendlove_form.submit();
}
var showgift;
function show_gift(big,tid){
	if(!islogin){
		location.href = 'http://www.21xiehou.com/page/login/';
		return false;
	}
	id = tid||"";
	if(!big) return false;
	var giftfla = '<iframe src="/gift/gift_fla/?adress='+big+'&id='+id+'" scrolling="no" width="465" height="339" frameborder="0">';
	showgift = new swoole.Dialog('礼物',giftfla,465,339,true);
	showgift.show();
}
