var getsessionurl='servlet/getsession';

var Err_HasDets='主表还有从表数据，请先删除从表明细数据后再删除主表数据.';
var Err_OpenErr=':数据集打开出错.SQL:';
var Err_NoOpen='数据集未打开.';
var Err_Null='数据不能为空.';
var Err_Long='数据超过允许的长度.';
var Err_Number='非法的数值输入';
var Err_DateTime='非法的日期/时间';
var Err_NoURL="错误有可能是以下原因：指定的URL未找到，或者URL程序发生错误，返回为空";
var Err_ReadOnly="当前数据是只读的";
var Err_NoField="字段没找到";
var Err_NoDataSet="数据集未指定";
var clBlack = "#000000";
var clMaroon = "#000080";
var clGreen = "#008000";
var clOlive = "#008080";
var clNavy = "#800000";
var clPurple = "#800080";
var clTeal = "#808000";
var clGray = "#808080";
var clSilver = "#C6C3C6";
var clRed = "#FF0000";
var clLime = "#00FF00";
var clYellow = "#00FFFF";
var clBlue = "#0000FF";
var clFuchsia = "#FF00FF";
var clAqua = "#FFFF00";
var clLtGray = "#C0C0C0";
var clDkGray = "#808080";
var clWhite = "#FFFFFF";

var clMoneyGreen = "#C0DCC0";
var clSkyBlue = "#F0CAA6";
var clCream = "#F0FBFF";
var clMedGray = "#A4A0A0";

var clNone = "#FFFFFF";
var clDefault = "#CCCCFF";
var StandardColorsCount = 16;
var ExtendedColorsCount = 4;
var clBlue0='#9CBEE7';
var clButton='#CECFCE';
var clShadow="#ADAAAD";
var clHightGray = "#F7F3F7";
var clBorder = "#9C9A9C";


var DecPoint=".";

var jcl_ResourceURL = "../jcl/image/";
var image_AppendRecord = "newrecord.gif";
var image_DeleteRecord = "deleterecord.gif";
var image_SaveRecord = "saverecord.gif";

var image_First = "image_first.gif";
var image_First_Disable = "image_first_disable.gif";

var isMoz = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined');
var isIE = (typeof window.ActiveXObject != 'undefined');
var isInspect=true;

window.Exception=true;
if(window.opener)window.Parent=window.opener;
if(window.dialogArguments){window.Parent=window.dialogArguments;}
window.Show=function(url,title,ops){var bars;if(ops)bars=ops;else bars='menubar=yes,status=yes,toolbar=yes,scrollbars=yes,resizable=yes';return open(url,title,bars);}
window.ShowModal=function(url,ops){var o;if(ops)o=ops;else o='resizable:no';window.showModalDialog(url,window,o);}


function GetXMLDOM() {
  var xmlDoc;
  if (isIE) {
     xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
  } else if (isMoz) {
     xmlDoc = document.implementation.createDocument("","",null);
  }
  return xmlDoc; 
}
//将字串XML对象化
function parseXML(st){
	var result;
    if(isIE){
        result = GetXMLDOM();
        result.loadXML(st);
    }else{
        var parser = new DOMParser();
        result = parser.parseFromString(st, "text/xml");
    }
    return result;
}
//将XML对象字符串化
function XMLToStr(xml){
	if(isIE){
		return xml.xml;
	}
	else{
		var xmls = new XMLSerializer(); 
		var s = xmls.serializeToString(xml);
		return s;
	}
}
function DateTimeToStr(d)
{
if(isNaN(d))return;
/*var y=d.getFullYear();var m=(d.getMonth()+1);var da=d.getDate();
var h=d.getHours();var mi=d.getMinutes();var sec=d.getSeconds();var ms=d.getMilliseconds();var s=y.toString()+'-';
if(m<10) s=s+'0';s=s+m+'-';if(da<10) s=s+'0';s=s+da+' ';
if(h||mi||sec||ms){if(h<10) s=s+'0';s=s+h+':';if(mi<10) s=s+'0';s=s+mi+':';if(sec<10) s=s+'0';s=s+sec+'.0';}
*/
var s = d.toLocaleString() ;
return s;
}
function DateToStr(d)
{
if(isNaN(d))return;
/*var y=d.getFullYear();var m=(d.getMonth()+1);var da=d.getDate();
var s=y.toString()+'-';
if(m<10) s=s+'0';s=s+m+'-';if(da<10) s=s+'0';s=s+da;
*/
var s = d.toLocaleString();
return s;
}
function StrToTimeLong(value) {
  var r=/[\u4e00-\u9fa5]/;
  value=value.replace(r, "/");
  value=value.replace(r, "/");
  value=value.replace(r, "");
  var v=Date.parse(value);
  return v;
}

function FormatFloat(value,mask)
{
	return BasicFormat(value,mask,'FormatNumber')
}
function FormatDate(varDate, bstrFormat, varDestLocale)
{
	return BasicFormat(varDate,bstrFormat,'FormatDate',varDestLocale);
}
function FormatTime(varTime, bstrFormat, varDestLocale)
{
	return BasicFormat(varTime,bstrFormat,'FormatTime',varDestLocale);
}
function BasicFormat(value,mask,action,param)
{
	var xmlDoc;
	var xslDoc;
	var v='<formats><format><value>'+value+'</value><mask>'+mask+'</mask></format></formats>';
	xmlDoc=parseXML(v);

	var x; 
	if(isIE)
		x='<xsl:stylesheet xmlns:xsl="uri:xsl">'
	else
		x='<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">';
	x+='<xsl:template match="/">';
	if(isIE) {
		x+='<xsl:eval>'+action+'('+value+',"'+mask+'"';
		if(param)x+=','+param;
		x+=')</xsl:eval>';
	}
	else
		x+='<xsl:value-of select="format-number('+value+',\''+mask+'\')" />';

	x+='</xsl:template></xsl:stylesheet>';
	xslDoc=parseXML(x);
	var s;
	if(isIE)
	 s= xmlDoc.transformNode(xslDoc)
	else{
		//for mozilla/netscape 
        var processor = new XSLTProcessor(); 
		processor.importStylesheet(xslDoc);
		var result = processor.transformToFragment(xmlDoc, xmlDoc);
        var xmls = new XMLSerializer(); 
        s = xmls.serializeToString(result);
	}
	return s;
}
// 奇偶数判断
function isOddNumber(value)
{
  var v = parseInt(value/2);
  if(v*2!=value) return true
  else return false;
}

new Strings();
Strings.prototype.Add=function(v){var a=this.Strings;a[a.length]=v;this.Count=a.length};
Strings.prototype.Clear=function(){this.Strings.length=0;this.Count=0;};
Strings.prototype.Count=0;
function Strings(){
  this.Strings=new Array();
}

function Items(parent){
//  if(!type)type='items';
//  var pdiv,obj = document.createElement(type);
  this.Parent=parent;
//  parent.appendChild(obj);
  this.Item=new Array();
  this.Count=0;
  this.Add=Items_Add;
  this.Clear=Items_Clear;
  this.Delete=Items_Delete;
  return this;
}
function Items_Add(item)
{
  if(this.Parent)this.Parent.appendChild(item);
  this.Item[this.Item.length]=item;
  item.Index=this.Item.length-1;
  item.Parent=this.Parent;
  this.Count=this.Item.length;
}
function Items_Delete(item)
{
  _arrayremove(this.Item,item.Index);
  if(this.Parent)this.Parent.removeChild(item);
  item.removeNode(true);
  this.Count=this.Item.length;
}
function Items_Clear()
{
   for(var i=0;i<this.Item.length;i++){
	   this.Delete(this.Item[i]);
   }
}


new Params();
Params.prototype.Count;
Params.prototype.Add=function(param){this.Param[param.Name]=param;this.Paramx[this.Paramx.length]=param;this.Count=this.Paramx.length;}
Params.prototype.Clear=function(){this.Paramx.length=0;this.Param=new Array();this.Count=0;}
function Params(){
  this.Param=new Array();
  this.Paramx=new Array();
}
new Param(null,null,null);
Param.prototype.Name;
Param.prototype.Value;
Param.prototype.Type;
function Param(name,value,type)
{
  this.Name=name;this.Value=value;this.Type=type;
}
function jcl_err(e)
{
  if(window.Exception){alert(e);}else throw e;
}

function DC_onpropertychange(sender)//属性变化处理
{
  var n;
  if(isIE) {
	  n=event.propertyName;
	  sender=this;
  }
  else
	  n='DataSet';
  switch(n){
	case 'DataSet':
	  if(sender.OldDataSet==sender.DataSet)return;
	  if(sender.OldDataSet)sender.OldDataSet.RemoveLink(sender);//从原来的DATASET中移除
      if(sender.DataSet)sender.DataSet.LinkObj(sender);
	  sender.OldDataSet=sender.DataSet;
	  break;
  }
}

//增加函数定时侦听执行
function addEventTimerListener(obj,func){
	listenerFuncList[listenerFuncList.length]=func;
	listenerObjList[listenerObjList.length]=obj;
	return listenerFuncList.length-1;
}
//删除增加函数定时侦听执行
function removeEventTimerListener(index){
	_arrayremove(listenerFuncList, index);
	_arrayremove(listenerObjList, index);
}
//清除所有侦听执行
function clearEventTimerListener(index){
	listenerFuncList.length=0;
	listenerObjList.length=0;
}

//调用函数定时侦听执行
function processEventTimerListener(){
	for(var i=0;i<window.listenerFuncList.length;i++){
		listenerFuncList[i](listenerObjList[i]);
	}
}
//开始其他非IE浏览器属性变化侦听
function startEventListener(){
	window.listenerFuncList=new Array();
	window.listenerObjList=new Array();
	window.eventDelay=300;
	window.eventTimer=setInterval(processEventTimerListener, window.eventDelay); 
}
//停止其他非IE浏览器属性变化侦听
function stopEventListener(){
	clearInterval(window.eventTimer); 
}

if(isMoz){
	startEventListener();
}


//实现类反射封装
function Reflector()
{
	var obj = new Object();
    obj.getProperties=function(obj){
        var props = "";
		var type;
        for (idx in obj)
        {
			type = typeof(obj[idx]);
			if(type!='function')
               props += idx+":"+type+";";
        }
        return props;
    }
    obj.getMethods=function(obj){
        var props = "";
		var type;
        for (idx in obj)
        {
			type = typeof(obj[idx]);
			if(type=='function')
               props += idx+":"+type+";";
        }
        return props;
    }	
    obj.getMembers=function(obj){
        var props = "";
		var type;
		var member;
		var pos;
        for (idx in obj)
        {
			member = obj[idx];
			if(member) {
				type = typeof(obj[idx]);
				if(type=='function') {
					member = member.toString();
					pos = member.indexOf('(');
					if(pos!=-1) {
						member = member.substring(pos);
						pos = member.indexOf(')');
						if(pos!=-1)
							member = member.substring(0,pos+1);
					}
					props += idx+":"+type+member+";";
				}
				else
					props += idx+":"+type+";";
			}
        }
        return props;
    }	
	return obj;
}
function _arrayremove(changingarray,index){
	if(changingarray)	{

		var newarray1=changingarray.slice(0,index);
		var newarray2=changingarray.slice(index+1,changingarray.length);
		changingarray.length=0;
		changingarray=newarray1.concat(newarray2);
		return changingarray;
	}
}

function _arraypush(changingarray,newarraynode,index) {
   if ( changingarray ) {
     var newarray1 = changingarray.slice(0,index);
     var newarray2 = changingarray.slice(index,changingarray.length);
     newarray1[newarray1.length] = newarraynode;
     changingarray.length = 0;
     changingarray = newarray1.concat(newarray2);
     return changingarray;
  }
}

function _arrayswap(changingarray,indexfirst,index) {
   if ( changingarray ) {
      var m=changingarray[indexfirst];
      changingarray[indexfirst] = changingarray[index];
      changingarray[index] = m;
   }
}

function VLine(parent)
{
  var obj=new Div(parent);
  obj.style.borderLeftStyle='solid';
  obj.style.borderLeftWidth=1;
  obj.style.position='absolute';
//  obj.style.borderLeftColor='black';
  return obj;
}
function HLine(parent)
{
  var obj=new Div(parent);
  obj.style.borderTopStyle='solid';
  obj.style.borderTopWidth=1;
  obj.style.position='absolute';
//  obj.style.borderLeftColor='black';
  return obj;
}
function Point(parent)
{
  var obj=new HLine(parent);
  obj.style.width = 1;
  obj.style.height = 1;
  return obj;
}

function Draw(parent)
{
  if(parent){this.Parent=parent;}else this.Parent=document.body;//获取父块
  this.LineTo=Draw_LineTo;
  this.DashedTo1=Draw_DashedTo1;
  return this;
}
function Draw_LineTo(x1,y1,x2,y2)
{
  var xstep,ystep,point,x,y,obj=new Div(this.Parent);
  obj.style.position='absolute';
  x=x1;y=y1;
  if(x2-x1>0)xstep=(y2-y1)/(x2-x1);else xstep=0;
  if(y2-y1>0)ystep=(x2-x1)/(y2-y1);else ystep=0;
  if(xstep>1)xstep=1;
  if(ystep>1)ystep=1;

  while (true)
  {
    point=new Point(obj);
	point.style.left=x;
	point.style.top=y;
	y+=ystep;
	if(y2-y1>0)y+=2;
	x+=xstep;
    if(x2-x1>0)x+=2;
	if(x>=x2&&y>=y2)break;
  }
  return obj;
}
function Draw_DashedTo1(x1,y1,x2,y2)
{
  var xstep,ystep,point,x,y,obj=new Div(this.Parent);
  obj.style.position='absolute';
  x=x1;y=y1;
  if(x2-x1>0)xstep=(y2-y1)/(x2-x1);else xstep=0;
  if(y2-y1>0)ystep=(x2-x1)/(y2-y1);else ystep=0;
  if(xstep>1)xstep=1;
  if(ystep>1)ystep=1;

  while (true)
  {
    point=new Point(obj);

	point.style.left=x;
	point.style.top=y;
	y+=ystep;
	if(y2-y1>0)y+=2;
	x+=xstep;
    if(x2-x1>0)x+=2;
	if(x>=x2&&y>=y2)break;
  }
  return obj;
}
function Rectangle(x,y,w,h){
  this.x=x;this.y=y;this.width=w;this.height=h;
  this.isContainXY=Rectangle_isContainXY;
}
function Rectangle_isContainXY(x,y){
  var result=false;
  if(x>this.x&&x<(this.x+this.width)&&y>this.y&&y<(this.y+this.height))
	  result=true;
//  alert(x+":"+y+":"+this.x+":"+this.y+"="+result);
  return result;
}
function setStyle(obj)
{
//  obj.style.borderStyle='solid';
//  obj.style.borderWidth=1;
  obj.style.fontFamily='Tahoma';
  obj.style.fontSize='12';
}
function setFont(obj)
{
  obj.style.fontFamily='Tahoma';
  obj.style.fontSize='12';
  obj.style.color=clBlack;
}
