﻿var isIE = true;
var fileName = (String(window.location.pathname).slice(String(window.location.pathname).lastIndexOf("/")+1)).split(".")[0];
if(window.navigator.appName == "Netscape"){isIE= false;}//判断IE
//设置cookies
function setCookie(arg_CookieName, arg_CookieValue, arg_CookieExpireDays)
{
	var todayDate = new Date ();
	todayDate.setDate (todayDate.getDate () + arg_CookieExpireDays);
	document.cookie = arg_CookieName + "=" + arg_CookieValue + ";path=/;expires=" + todayDate.toGMTString () + ";";
}
//取得cookies
function getCookie(arg_CookieName)
{
	var Found = false;
	var start, end;
	var i = 0;
	while (i <= document.cookie.length)
	{
		start = i;
		end = start + arg_CookieName.length;
		if (document.cookie.substring (start, end) == arg_CookieName){Found = true;	break;}
		i++;
	}
	if (Found == true)
	{
		start = end + 1;
		end = document.cookie.indexOf (";", start);
		if (end < start) end = document.cookie.length;
		return document.cookie.substring (start, end);
	}
	return "";
}

//提示ajax处理成功
var ajax_Dealok = function () {
	$ID("mc").innerHTML = "您的请求处理成功";
	window.timeoutid = window.setTimeout(ajax_Deal_Close, 3000);
};
//开始处理ajax
var ajax_Deal_Begin = function () {
	$ID("mc").style.display = "";
	$ID("mc").innerHTML = "您的请求正在处理...";
	scroll_lay();
};
//关闭提示条
var ajax_Deal_Close = function () {
	$ID("mc").style.display = "none";
	$ID("mc").innerHTML = "";
	window.clearTimeout(window.timeoutid);
};
//滚动提示层
function scroll_lay() {
	$ID("mc").style.top = (document.documentElement.scrollTop)+"px";
	$ID("mc").style.left = (document.documentElement.scrollLeft+document.documentElement.clientWidth-$ID("mc").offsetWidth)+"px";
}
//返回对象
function $ID(key){return document.getElementById(key.toString ());}//返回对象
function $Name(key){return document.getElementsByName(key.toString ());}//返回对象数组
isChinese = function(arg_str){for(i = 0; i < arg_str.length; i++){if(arg_str.charCodeAt(i) > 128){return false;}}return true;}// 中文值检测
isMail = function(arg_str){var myReg = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;if(myReg.test(arg_str)){return true;}else{return false;}}// E-mail值检测
String.prototype.trim = function(){return this.replace(/(^\s*)|(\s*$)/g,"");}//去掉两头空格
String.prototype.toBr = function(){return this.replace(/\r\n/g,"<br/>");}//换行回车
String.prototype.toHTMLEncode = function()
{
	return this.replace(/\"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
}//格式化html代码
String.prototype.toLen = function(){return this.replace(/[^\x00-\xff]/g,"xx").length;} //返回双字节长度
String.prototype.getURLvalue = function(){
	var mystr_Arr = this.substr(1,this.length).split("&");	
	var myArr = new Array();
	for(var i = 0;i<mystr_Arr.length;i++)
	{	var tempStr = mystr_Arr[i].split("=");		
		myArr[tempStr[0]] = tempStr[1];		
	}
	return myArr;
}
//参数
getParameter = function (varName) {
	var query = location.search;
	if (query != null || query != "") {
		query = query.replace(/^\?+/, "");
		var qArray = query.split("&");
		var len = qArray.length;
		if (len>0) {
			for (var i = 0; i<len; i++) {
				var sArray = qArray[i].split("=", 2);
				if (sArray[0] && sArray[1] && sArray[0] == varName) {
					return unescape(sArray[1]);
				}
			}
		}
	}
	return null;
};
