﻿var f=true;


function show_frame()
{
	if(f)
	{
		document.getElementById('left').style.display='none';
		document.getElementsByTagName('img')[1].src='../images/right.jpg';
		f=false;
	}
	else if(!f)
	{
		document.getElementById('left').style.display='';
		document.getElementsByTagName('img')[1].src='../images/left.jpg';
		f=true;
	}
}

function all_select()
{
	if(document.getElementById('chk_all').checked)
	{
		for(i=0;i<document.getElementsByName('chk_item').length;i++)
		{
			document.getElementsByName('chk_item')[i].checked=true;
		}
	}
	else
	{
		for(i=0;i<document.getElementsByName('chk_item').length;i++)
		{
			document.getElementsByName('chk_item')[i].checked=false;
		}
	}
}

function is_select()
{
	var f=false;
	for(i=0;i<document.getElementsByName('chk_item').length;i++)
	{
		if(document.getElementsByName('chk_item')[i].checked)
		{
			f=true;
			break;
		}
	}
	return f;	
}

function first()
{
	start=0;	
	d_search();
}
		
function pre()
{
	if(start>=20)
	{
		start-=20;
		d_search();
	}
}

function aa(obj)
{
	obj.style.color="#FFFFFF";
	var s="dropmenu"+obj.childNodes[0].id;
	if(document.getElementById(s).innerHTML!='')
	{
		cssdropdown.dropit(obj,event,s);
	}
}

//初始化错误窗口
var html="<style>.divError{background-image: url(images/bgError.jpg);position: absolute;width: 260;height:148;display:none;}";
html+=".close{height: 21px;text-align: right;padding-right: 3px;padding-top:3px;}";
html+=".info{height: 80px;text-align:center;font-family: '宋体' ,Verdana, Arial, Helvetica, sans-serif;font-size: 12px;margin:0px;}";
html+=".info p{margin-top:auto;margin-left:30px;margin-right:10px;text-align:center;}";
html+=" .left{ float:left; width:32px; }";
html+=" .right{ float:left;width:auto;text-align:center;}";
html+=".ok{height: 47px;text-align: center;}</style>";
html+="<script src=js/dom-drag.js></script>";
html+="<script>function load_error(){Drag.init(document.getElementById('error'));}</script>";
html+="<div class=divError id=error>";
html+="<div class=close><img src=images/divClose.jpg class=h onclick=set_id(this)></div>";
html+="<div class=info><table width=200px style='font-size:12px;'><tr><td align=center>";
html+="<p id=e_error_text></p></td></tr></table>";
html+="</div>";
html+="<div class=ok><img src=images/divOK.jpg class=h onclick=set_id(this)></div>";
html+="</div><input type=hidden id=error_h>"
document.write(html);

//显示错误窗口提示
//text是错误提示信息
//id 焦点id
function e_alert(text,id)
{
	var error=document.getElementById('error');
	error.style.display='block';
	error.style.left=(window.screen.availWidth-260)/2;
	document.getElementById('error').style.top=(window.screen.availHeight-148)/2-50;
	document.getElementById('e_error_text').innerText=text;
	document.getElementById('error_h').value=id;
}

//设置焦点,关闭窗口
function set_id(obj)
{
	obj.parentNode.parentNode.style.display='none';
	document.getElementById(document.getElementById('error_h').value).focus()
}

function bq()
{
	var html="&copy;Copyright 本站版权归 湖北省黄州中学所有 <strong>www.hzzx.cn</strong> All Rights Reserved. <br>";
	html+="技术支持:黄州中学信息中心     Tel:  0713-8384816 <br>";
	html+="最佳浏览方式：IE5.5以上 1024x768分辨率";
	document.write(html);
}

//判断是不是整数
function isInt(val) 
{
    for (var i=0;i<val.length;i++) 
    {
		if (isNaN(val.charAt(i))) 
		{
			 return false; 
		}
    }
    return true;
}

//投票
var a=true;
var temp='';
function submit_vote(obj)
{
	if(a==false)
	{
		e_alert('请勿重复投票!','d_vote');
		return;
	}
	var vote=document.getElementsByName('r_vote');
	for(i=0;i<vote.length;i++)
	{
		if(vote[i].checked)
		{
			obj.submit_vote(vote[i].value);
			a = false;
			break;
		}
	}
	temp=document.getElementById('d_vote').innerHTML;
	document.getElementById('d_vote').innerHTML=obj.get_result().value;
}

//投票返回
function s_vote()
{
	document.getElementById('d_vote').innerHTML=temp;
}

//查看投票结果
function ss_vote(obj)
{
	temp=document.getElementById('d_vote').innerHTML;
	document.getElementById('d_vote').innerHTML=obj.get_result().value;
}


//设置焦点,关闭窗口
function set_id(obj)
{
	obj.parentNode.parentNode.style.display='none';
	document.getElementById(document.getElementById('error_h').value).focus()
}

//查询文字
function search()
{
	var select_search=document.getElementById('select_search');
	var search_text=document.getElementById('search_text');
	if(search_text.value=='')
	{
		e_alert('请输入要搜索的关键字!','search_text');
		return;
	}
	if(select_search.selectedIndex==0)
	{
		window.location='t_a_result.aspx?state=0&text='+escape(search_text.value);
	}
	else
	{
		window.location='t_a_result.aspx?state=1&text='+escape(search_text.value);
	}
}

//查询图片
function search_pic()
{
	var select_search=document.getElementById('select_search');
	var search_text=document.getElementById('search_text');
	if(search_text.value=='')
	{
		e_alert('请输入要搜索的关键字!','search_text');
		search_text.focus();
		return;
	}
	if(select_search.selectedIndex==0)
	{
		window.location='t_p_result.aspx?state=0&text='+escape(search_text.value);
	}
	else
	{
		window.location='t_p_result.aspx?state=1&text='+escape(search_text.value);
	}
}

//友情链接
function go_link()
{
	var s=document.getElementById('select_link').value;
	window.location=s;
}

//翻页
var start=0;

var id=window.location.search.substring(window.location.search.indexOf('id')+3);

function init_list(obj)
{
	document.getElementById('t_list').innerHTML=obj.get_list(id,start).value;
	document.getElementById('t_nv').innerHTML=obj.get_nv(id,start).value;	
}

function first(obj)
{
	start=0;
	init_list(obj);	
}

function pre(obj,count)
{
	if(start>=count)
	{
		start-=count;
		init_list(obj);
	}
}

function next(obj,count)
{
	if(start<obj.getCount(id).value-count)
	{
		start+=count;
		init_list(obj);
	}
}

function last(obj,count)
{
	if(start<obj.getCount(id).value-count)
	{
		start=obj.getCount(id).value-obj.getCount(id).value%count;
		init_list(obj);
	}
}

function go_page(obj,count)
{
	var temp=start;
	var p_count=document.getElementById('p_count');
	if(p_count.value=='')
	{
		e_alert('请输入页码!','p_count');
		return;
	}
	if(!isInt(p_count.value)||p_count.value<=0)
	{
		e_alert('请输入大于0的整数!','p_count');
		p_count.value='';
		return;
	}
	start=count*(p_count.value-1);
	var s=obj.get_list(id,start).value;
	if(s=='')
	{
		e_alert('页码超出了范围!','p_count');
		start=temp;
		p_count.value='';
		return;
	}
	document.getElementById('t_list').innerHTML=s;
	document.getElementById('t_nv').innerHTML=obj.get_nv(id,start).value;
}

//个人安全中心
function show(obj)
{
	if(obj==0)
	{
		document.getElementById('t_desc').style.display='';
		document.getElementById('t_pas').style.display='none';
	}
	else
	{
		document.getElementById('t_desc').style.display='none';
		document.getElementById('t_pas').style.display='';
	}
}

//判断session
function chk_ses(obj)
{
	if(obj.chk_ses2().value)
	{
		window.location='../guest/g_index.aspx';
	}
}

function set_title()
{
	var html="<table width=96% border=0 align=right cellpadding=0 cellspacing=1>";
	html+="<tr>";
	html+="<td align=center><img src=images/topbg_line.jpg></td>";
	html+="<td height=30 align=center><a href=index.aspx class=toplink>首 页</a></td>";
	html+="<td align=center><img src=images/topbg_line.jpg></td>";
	html+="<td height=30 align=center><a href=guest/xxjs.aspx class=toplink>学校介绍</a></td>";
	html+="<td align=center><img src=images/topbg_line.jpg></td>";
	html+="<td align=center><a href=guest/szll.aspx?id=1 class=toplink>师资力量</a></td>";
	html+="<td align=center><img src=images/topbg_line.jpg></td>";
	html+="<td align=center><a href=guest/xxry.aspx?id=1 class=toplink>学校荣誉</a></td>";
	html+="<td align=center><img src=images/topbg_line.jpg></td>";
	html+="<td align=center><a href=guest/ldtd.aspx?id=1 class=toplink>领导团队</a></td>";
	html+="<td align=center><img src=images/topbg_line.jpg></td>";
	html+="<td align=center><a href=guest/bxts.aspx?id=1 class=toplink>美术特色</a></td>";
	html+="<td align=center><img src=images/topbg_line.jpg></td>";
	html+="<td align=center><a href=guest/g_index.aspx class=toplink>新闻动态</a></td>";
	html+="<td align=center><img src=images/topbg_line.jpg></td>";
	html+="<td align=center><a href=guest/ly.aspx class=toplink target=_blank>在线留言</a></td>";
	html+="</tr></table>";
	document.write(html);
}






















