// JavaScript Document
function jsHref(url,date){
	window.location=(url+"?date="+date);
}

function jsFsrc(url){
	document.getElementById("avan").src=url;
}

function jsIsrc(url){
	document.getElementById("avanImg").src=url;
}

function imgPreview(url){
	document.getElementById("imgPreview").src = url;
}

function imgInsert(url){
	top.blogFrame.eWebEditor1.insertHTML("<img src='"+url+"' width='192' />");
	closeLayer();
}

function imgDel(ID){
	if (confirm("确定要删除该图片吗？")){
		window.location=("imgDel.php?id="+ID);
	}
}

function jsLogin(){
	jsFsrc("/login/login.php");
	openLayer("SISYS","test_con");
}
function topboxs()
{
	
}
function jsHeader(Str,mark,box){
	if(typeof top.document.formtop != 'undefined')
		top.document.formtop.m_id.value="12";
	top.reurl(mark);
//	var data = Str!="" ? "欢迎您 <a href='/member/' class='link12r'>"+Str+"</a>　<a href='/login/check.php'>退出</a>" : "<a href='javascript:jsLogin()' class='link12b'>登录</a>";
//	var data = Str!="" ? "欢迎您 <strong>"+Str+"</strong>　<a href='/exit.php'>退出</a>" : '<a href="javascript:jsLogin()" class="link12b">登录</a>&nbsp;&nbsp;&nbsp;<a href="javascript:;" class="link12b" onclick="showPopWin(\'login/reg.php\', 400, 200, \'会员注册\')">注册</a>';
	box = box || 1;
	box = box == 1 ? 'none' : '';
	var data = Str!="" ? "欢迎您 <strong>"+Str+"</strong><a href='javascript:;' onclick='showPopWin(\"/login/login.php?box\", 400, 95, \"登录查看\");' style=\'display:"+box+";\' title='登录后可查看宝盒'>　登录查看</a><a href='/exit.php'>　退出</a>" : '<a href="javascript:jsLogin()" class="link12b">登录</a>';
	data += "&nbsp;&nbsp;";
	if(typeof top.document.getElementById("headerNote") != 'undefined' && top.document.getElementById("headerNote"))
		top.document.getElementById("headerNote").innerHTML=data;
	change_nav(1);
	is_show_index();
}
function show(ID){
	var oComm=document.getElementById("+ID+");
	if(oComm.createTextRange) alert(document.selection.createRange().text);
	else{
		var iStart = oComm.selectionStart;
		var iEnd = oComm.selectionEnd;
		alert(oComm.value.substr(iStart,iEnd-iStart));
	}
}
function change_nav(id)
{
	for(var i=1; i<=3; i++)
	{
		if(document.getElementById('nav_t'+i))
			document.getElementById('nav_t'+i).src = i == id ? '/images/nav_t'+i+'2.gif' : '/images/nav_t'+i+'.gif';
		else if(top.document.getElementById('nav_t'+i))
			top.document.getElementById('nav_t'+i).src = i == id ? '/images/nav_t'+i+'2.gif' : '/images/nav_t'+i+'.gif';
	}
}
function is_show_index()
{
	if(top.document.getElementById('is_show_index'))
		top.document.getElementById('is_show_index').style.display = '';
	if(top.document.getElementById('tbl_login'))
		top.document.getElementById('tbl_login').style.display = '';
	if(top.document.getElementById('tbl_no_login'))
		top.document.getElementById('tbl_no_login').style.display = 'none';
	if(top.document.getElementById('tb_no_login'))
		top.document.getElementById('tb_no_login').style.display = 'none';
	if(top.document.getElementById('tb_login_1'))
		top.document.getElementById('tb_login_1').style.display = '';
	if(top.document.getElementById('tb_login_2'))
		top.document.getElementById('tb_login_2').style.display = '';
	if(top.document.getElementById('tb_login_3'))
		top.document.getElementById('tb_login_3').style.display = '';
	if(top.document.getElementById('tb_login_4'))
		top.document.getElementById('tb_login_4').style.display = '';
	if(top.document.getElementById('tb_login_5'))
		top.document.getElementById('tb_login_5').style.display = '';
	if(top.document.getElementById('formsearch'))
		top.document.getElementById('formsearch').style.display = '';
	if(top.document.getElementById('a_login_1'))
		top.document.getElementById('a_login_1').style.display = 'none';
	if(top.document.getElementById('a_login_2'))
		top.document.getElementById('a_login_2').style.display = 'none';
}

function show_ads(obj,id,ads_id)
{
	if(!id || !ads_id)
		return;

	var id2 = 'ads_'+id;
	if(!document.getElementById(id2))
		return;

	if(!obj.className)
	{
		obj.className = 'bg_fff';
		document.getElementById(id2).style.display = '';
		set_ads_log(ads_id,id);
	}
	else
	{
		obj.className = '';
		setTimeout("if(document.getElementById('"+id2+"').style.display != 'none'){document.getElementById('"+id2+"').style.display = 'none'}",5000);
	}
}

function set_ads_log(ads_id,blog_id)
{
	if(!blog_id || !ads_id)
		return;

	$.ajax({
		type: "POST",
		url: '/ceshi/ads.php',
		data: 'blog_id='+blog_id+'&ads_id='+ads_id+'&stamp='+new Date().getTime(),
		error: function(){return;},
		success: function(data){return;/*alert(data);*/}
	});
}
function add_blog_id(thiss,id)
{
	if(!id)
		return;

	var ids = document.getElementById('b_id').value;
	var str = '';
	if(thiss.innerHTML == '&nbsp;')
	{
		if(navigator.userAgent.toLowerCase().indexOf("firefox") != -1)
			thiss.innerHTML = '<img src="/images/g.png" />';
		else
			thiss.innerHTML = '<div>&nbsp;</div>';

		if(ids)
		{
			ids = ids.split(',');
			var j = 0;
			for(var i=0; i<ids.length; i++)
			{
				if(ids[i] != id && ids[i])
					str += ','+ids[i];
				else
					j++;
			}
			if(!j)
				str += ','+id;
		}
		else
			str += ','+id;
	}
	else
	{
		thiss.innerHTML = '&nbsp;';
		if(ids)
		{
			ids = ids.split(',');
			for(var i=0; i<ids.length; i++)
			{
				if(ids[i] != id && ids[i])
					str += ','+ids[i];
			}
		}
	}
	if(str)
		str = str.substring(1);
	document.getElementById('b_id').value = str;
}
function get_cookie(name)
{
	var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
	if(arr != null)
		return unescape(arr[2]);
	return null;
}
function checkFormSJ(thiss)
{
	if(typeof thiss == 'undefined')
		return false;

	if(!get_cookie('uid'))
	{
		showPopWin('/login/login.php', 400, 200, '会员登录');
		return false;
	}
	if(!thiss.sjid.value)
	{
		alert('无效请求');
		return false;
	}
	if(!thiss.content.value)
	{
		alert('请填写评论内容');
		thiss.content.focus();
		return false;
	}
	return true;
}

