﻿// JScript 文件

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function js_setmanatopurl(){
	var pi_path=0,ps_path='',pi_self=0,ps_self='';
	ps_path=window.top.location.host+window.top.location.pathname;
	pi_path=ps_path.lastIndexOf('/main.html');
	ps_self=window.location.host+window.location.pathname;
	pi_self=ps_self.lastIndexOf('/');

//window.confirm(ps_path.substr(0,pi_path));
//window.confirm(ps_self.substr(0,pi_self));
	if(ps_path.substr(0,pi_path)!=ps_self.substr(0,pi_self)){
		window.top.location.href='main.html';
	}
}
function js_calendar_obj(po_input){
//
	var pi_left=window.event.screenX;
	var pi_top=window.event.screenY;
	var pi_width=260;
	var pi_height=219;
	var ps_path='../libs/calendar.htm?n='+po_input.value;
	var ps_returnValue='';
	ps_returnValue=window.showModalDialog(ps_path, '_self', 'edge:raised;scroll:0;status:0;help:0;resizable:1;dialogTop:' + pi_top + 'px;dialogLeft:' + pi_left + 'px;dialogWidth:' + pi_width + 'px;dialogHeight:' + pi_height + 'px;');
	if(!ps_returnValue){return;}
	if(ps_returnValue==''){return;}

	po_input.value=ps_returnValue;
}
function jsp_chooseimg(po_input){
//
	var pi_left=window.event.screenX;
	var pi_top=window.event.screenY;
	var pi_width=600;
	var pi_height=400;
	var ps_path='../libs/ChooseImg.aspx?c=' + po_input.value + '&rand='+Math.random();
	var ps_returnValue='';
	ps_returnValue=window.showModalDialog(ps_path, '_self', 'edge:raised;scroll:0;status:0;help:0;resizable:1;dialogTop:' + pi_top + 'px;dialogLeft:' + pi_left + 'px;dialogWidth:' + pi_width + 'px;dialogHeight:' + pi_height + 'px;');
	if(!ps_returnValue){return;}
	if(ps_returnValue==''){return;}

	po_input.value=ps_returnValue;
}
function jsp_chooseflash(po_input){
//
	var pi_left=window.event.screenX;
	var pi_top=window.event.screenY;
	var pi_width=600;
	var pi_height=400;
	var ps_path='../libs/ChooseFlash.aspx?c=' + po_input.value + '&rand='+Math.random();
	var ps_returnValue='';
	ps_returnValue=window.showModalDialog(ps_path, '_self', 'edge:raised;scroll:0;status:0;help:0;resizable:1;dialogTop:' + pi_top + 'px;dialogLeft:' + pi_left + 'px;dialogWidth:' + pi_width + 'px;dialogHeight:' + pi_height + 'px;');
	if(!ps_returnValue){return;}
	if(ps_returnValue==''){return;}

	po_input.value=ps_returnValue;
}
function jsp_choosetxt(po_input){
//
	var pi_left=window.event.screenX;
	var pi_top=window.event.screenY;
	var pi_width=600;
	var pi_height=400;
	var ps_path='../libs/ChooseTxt.aspx?rand='+Math.random();
	var ps_returnValue='';
	ps_returnValue=window.showModalDialog(ps_path, '_self', 'edge:raised;scroll:0;status:0;help:0;resizable:1;dialogTop:' + pi_top + 'px;dialogLeft:' + pi_left + 'px;dialogWidth:' + pi_width + 'px;dialogHeight:' + pi_height + 'px;');
	if(!ps_returnValue){return;}
	if(ps_returnValue==''){return;}

	po_input.value += ps_returnValue;
}
function jsp_choosetxt2f(po_input){
//
	var pi_left=window.event.screenX;
	var pi_top=window.event.screenY;
	var pi_width=600;
	var pi_height=400;
	var ps_path='../libs/ChooseTxt.aspx?rand='+Math.random();
	var ps_returnValue='';
	ps_returnValue=window.showModalDialog(ps_path, '_self', 'edge:raised;scroll:0;status:0;help:0;resizable:1;dialogTop:' + pi_top + 'px;dialogLeft:' + pi_left + 'px;dialogWidth:' + pi_width + 'px;dialogHeight:' + pi_height + 'px;');
	if(!ps_returnValue){return;}
	if(ps_returnValue==''){return;}

    var piframe=document.frames('CE_'+po_input.name+'_ID_Frame');
	//po_input.value=ps_returnValue;
    piframe.document.body.innerHTML += ps_returnValue;
}
function js_moveAndResize(pleft,ptop,pwidth,pheight){
//打开弹出窗口，移动和设置窗口大小
	if(pwidth==0){pwidth=screen.availWidth/2;}
	if(pheight==0){pheight=screen.availHeight;}
	window.focus();
	window.moveTo(pleft,ptop);
	window.resizeTo(pwidth,pheight);
}
function js_verifyrefresh(ps_name){
	MM_findObj(ps_name).src = '../libs/valicode_v.aspx?n='+Math.random();
} 
function jsg_delrecord(pform){
	if(!window.confirm("删除选中的记录？请确认。")){return;}
	pform.submit();
}
function jsp_showAnwser(ps_name){
	var po_obj=MM_findObj(ps_name);
	var ps_curr=po_obj.style.display;
	po_obj.style.display=(ps_curr==""?"none":"");
//alert("!"+ps_curr+"!");
//	if(po_obj.style.display==""){po_obj.style.display="none";}else{po_obj.style.display="";}
}
function jsg_search(pform,ps_value){
	if(ps_value==''){
		alert('请填写搜索内容。');
		return;
	}
	ps_value=ps_value;
	var ps_url='http://www.google.com/search?q='+ps_value+'&ie=UTF-8&oe=UTF-8&hl=zh-CN&domains=www.tegest.com&sitesearch=www.tegest.com';
	//var ps_url='http://www.google.com/search?ie=UTF-8&oe=UTF-8&hl=zh-CN&domains=www.tegest.com&sitesearch=www.tegest.com';
	//pform.action = ps_url;
	//pform.target = '_blank';
	//pform.submit();
	window.open(ps_url,'_blank');
	return;
}
var verticalpos="frombottom";
var floatDivName="divStayTopLeft";
function JSFX_FloatTopDiv()
{
	var startX =3,
	startY = 150;
	var ns = (navigator.appName.indexOf("Netscape") != -1);
	var d = document;
	function ml(id)
	{
		var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
		if(d.layers)el.style=el;
		el.sP=function(x,y){this.style.left=x;this.style.top=y;};
		el.x = startX;
		if (verticalpos=="fromtop")
		el.y = startY;
		else{
		el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
		el.y -= startY;
		}
		return el;
	}
	window.stayTopLeft=function()
	{
		if (verticalpos=="fromtop"){
		var pY = ns ? pageYOffset : document.body.scrollTop;
		ftlObj.y += (pY + startY - ftlObj.y)/8;
		}
		else{
		var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
		ftlObj.y += (pY - startY - ftlObj.y)/8;
		}
		ftlObj.sP(ftlObj.x, ftlObj.y);
		setTimeout("stayTopLeft()", 10);
	}
	ftlObj = ml(floatDivName);
	stayTopLeft();
}

function chgimgstol(img)
{
	//document.getElementById("");
	if (img.src.indexOf("s.jpg")>0)
	img.src=img.src.replace("s.jpg",".jpg");
}
function jsp_addFlash(ur,ww,hh){
document.write('<embed src="'+ur+'" quality="high" wmode="transparent" bgcolor="#000000" width="'+ww+'" height="'+hh+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http:/'+'/www.macromedia.com/go/getflashplayer" />');
}
