﻿/*
// 开始加载页面
function s_loadjs(path)
{        
	var _script = document.createElement('script');
	_script.setAttribute('type', 'text/javascript');
	_script.setAttribute('src', theme+"javascript/"+path);
	document.getElementsByTagName('head')[0].appendChild(_script);
}
function s_loadcss(path){
	path = theme+"css/"+path;
	document.createStyleSheet(path);
}
//
//对话框----------------->
//value
//open
System.Dialog={
	
}

--> 废止以前的
--> 修正
*/
//---------------------------------------------------------------
//---------------------------------------------------------------
//常用函数类
var System = new Object();
System.Common={
	loadjs:function (path){        
	var _script = document.createElement('script');
	_script.setAttribute('type', 'text/javascript');
	_script.setAttribute('src', System.Directory.Theme+"javascript/"+path);
	document.getElementsByTagName('head')[0].appendChild(_script);},
	loadcss:function (path){
	path = System.Directory.Theme+"css/"+path;
	document.createStyleSheet(path);}
}

//抄袭我哥哥的
//Dialog类
//System.Dialog.Open("UploadImage","上传图片","dialog/upload.html",440,430,true);
System.Dialog={
	defaultValue:"",
	returnValue:"",
	IsOpened:false,
	//dialogName  参数不名
	Open:function(dialogName,dialogTitle,dialogPage,defaultValue,width,height,dialogType,parentWindow){
		System.Dialog.returnValue="";
		var oDialogInfo=new Object();
			oDialogInfo.Title=dialogTitle;
			oDialogInfo.Page=dialogPage;
			oDialogInfo.Opener=window;
			oDialogInfo.DefualtValue=defaultValue;
			var sUrl=System.Directory.Theme+"javascript/dialog.html";
			System.Dialog.show(oDialogInfo,dialogName,sUrl,width,height,dialogType,parentWindow);
	},
	show:function(dialogInfo,dialogName,pageUrl,dialogWidth,dialogHeight,dialogType,parentWindow){
		
		dialogWidth=dialogWidth||100;
		dialogHeight=dialogHeight||100;
		dialogType=dialogType||0;
		
		if(!parentWindow)parentWindow=window;
		System.Dialog.IsOpened=true;
		if(dialogType==0){
			parentWindow.showModalDialog(pageUrl,dialogInfo,'dialogWidth:'+dialogWidth+'px;dialogHeight:'+dialogHeight+'px;help:no;scroll:no;status:no')
		}else if(dialogType==1){
			parentWindow.showModelessDialog(pageUrl,dialogInfo,'dialogWidth:'+dialogWidth+'px;dialogHeight:'+dialogHeight+'px;help:no;scroll:no;status:no')
		}
		System.Dialog.IsOpened=false;		
	}
}
// Directory  类
System.Directory={
	Theme:"",
	Root:""
}

//cookie 类
System.Cookies = {
	 Save:function(name, value, expires, path, domain, secure){
			if(expires)	{							//改成分钟
				var date=new Date();
				var ms=expires * 60 * 1000;         //每分钟有60秒，每秒1000毫秒
				date.setTime(date.getTime()+ms);
				expires=date;
			}
		  document.cookie = name + "=" + escape(value) +
		   ((expires) ? "; expires=" + expires.toGMTString() : "") +
		   ((path) ? "; path=" + path : "; path=/") +
		   ((domain) ? "; domain=" + domain : "") +
		   ((secure) ? "; secure" : "");
	 },
	 Read : function(name){
		  var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
		  if (arr != null){
		   return unescape(arr[2]);
		  }
		  return null;
	 },
	 Delete : function(name, path, domain){
		  if (System.Cookies.Read(name)){
			document.cookie = name + "=" +
			((path) ? "; path=" + path : "; path=/") +
			((domain) ? "; domain=" + domain : "") +
			";expires=Fri, 02-Jan-1970 00:00:00 GMT";
		  }
	 }
};


