var userAgent = navigator.userAgent.toLowerCase();
var is_opera = userAgent.indexOf('opera') != -1 && opera.version();
var is_moz = (navigator.product == 'Gecko') && userAgent.substr(userAgent.indexOf('firefox') + 8, 3);
var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera) && userAgent.substr(userAgent.indexOf('msie') + 5, 3);

function validLength(str, minlen, maxlen)
{
    if (str.length < minlen){
        return false;
    }
    if (str.length > maxlen){
        return false;
    }
    return true;
}
function $(id) {
	return document.getElementById(id);
}
function trim(str) {
	return (str + '').replace(/(\s+)$/g, '').replace(/^\s+/g, '');
}
function timestamp(){
	var timestampVal = Math.round(new Date().getTime()/1000);
	return timestampVal;
}
function chkEmail(str)
{
	 var emailRE = /(@\w[-._\w]*\w\.\w{2,3})$/;
   return emailRE.test(str);
}
function isNull(value, contain)
{
	if (("" == value) || (null == value))	{
		return true;
	}	else {
		return false;
	}
}
function getSelOpt(obj)
{
	return obj.options[obj.selectedIndex];
}
function getSelVal(obj)
{
	return obj.options[obj.selectedIndex].value;
}
function getSelText(obj)
{
	return obj.options[obj.selectedIndex].text;
}
function setCurrentVal(obj, val, max)
{
	var len = obj.options.length;
	var index = -1;
	for (var i=0; i<len ; i++) {
		obj.options[i].selected = '';
		if (obj.options[i].value == val) {
			index = i;
		}
	}
	if (index != -1) {
		obj.options[index].selected = "selected";
	} else if (max) {
		obj.options[len].selected = "selected";
	}
}
function setChecked(objname, val)
{
	objs =	document.getElementsByName(objname);
	var len = objs.length;
	var index = -1;
	for (var i=0; i<len; i++) {
		objs[i].checked = '';
		if (objs[i].value == val) 	{
			index = i;
		}
	}
	if (index != -1) {
		objs[index].checked = "checked";
	}
}
function getCheckVal(objname, flag)
{
	var objs = document.getElementsByName(objname);
	var len = objs.length;
	var val = '';
	var selObj;
	for (var i=0; i<len; i++) {
		if (objs[i].checked) {
		  selObj = objs[i];
			val = objs[i].value;
			break;
		}
	}
	if (flag) {
		return selObj;
	}
	return val;
}
function setMulti(objname, val)
{
	if ("" == val) {
		return false;
	}
	var objs =	document.getElementsByName(objname);
	var valArr = val.split(",");	// array
	var len = objs.length;
	for (var i=0; i<len; i++) {
		if (valArr.indexOf(objs[i].value) != -1) {
			objs[i].checked = "checked";
		}
	}
}
function getFileExt(filename)
{
  return filename.replace(/^.*(\.[^\.\?]*)\??.*$/, '$1');
}
function isImage(filename)
{
	var ext;
	ext = getFileExt(filename).toLowerCase();
	switch (ext)
  {
		case '.jpeg':
		case '.jpg':
		case '.gif':
		case '.png': return true;
		default:
			   return false;
	}
	return false;
}
function isNumber(val) 
{
	  var reg = /[\d]+/;
    return reg.test(val);
}
function Keypress(el,event,type)
{
	var code = window.event ? event.keyCode : event.which;	
	if ((code == 8) || (code == 0)) { return true; }
	if ((code<48 || code>57))	{	
		 if (event.preventDefault) { return event.preventDefault(); }
		 else { event.returnValue = false; }
	}
}
function ctlent(event, frmobj) {
	 if((event.ctrlKey && event.keyCode == 13) || (event.altKey && event.keyCode == 83)) {
		 if (frmobj.onsubmit()) {
			 frmobj.submit();
		 }
	 }
}
Array.prototype.indexOf = function(substr,start){
	var ta,rt,d='\0';
	if(start!=null){ta=this.slice(start);rt=start;}else{ta=this;rt=0;}
	var str=d+ta.join(d)+d,t=str.indexOf(d+substr+d);
	if(t==-1)return -1;rt+=str.slice(0,t).replace(/[^\0]/g,'').length;
	return rt;
}
function arrayIndeOf(objArr, v)
{
	for(var i=objArr.length; i-- && objArr[i] != v;);
	return i;
}	
function hide(obj)
{
	$(obj).style.display = 'none';
}
function show(obj)
{
	$(obj).style.display = '';
}
function DrawImage(ImgD, FitWidth, FitHeight){ 
		var image=new Image(); 
		image.src=ImgD.src; 
		if(image.width>0 && image.height>0){ 
				if(image.width/image.height>= FitWidth/FitHeight){ 
						if(image.width>FitWidth){ 
								ImgD.width=FitWidth; 
								ImgD.height=(image.height*FitWidth)/image.width; 
						}else{ 
								ImgD.width=image.width; 
								ImgD.height=image.height; 
						} 
				} else{ 
						if(image.height>FitHeight){ 
								ImgD.height=FitHeight; 
								ImgD.width=(image.width*FitHeight)/image.height; 
						}else{ 
								ImgD.width=image.width; 
								ImgD.height=image.height; 
						} 
				} 
		} 
}
function AddFavorite(url, title){
	if (window.sidebar) window.sidebar.addPanel(title, url, "");
	else if (window.opera && window.print){
		var mbm = document.createElement('a');
		mbm.setAttribute('rel', 'sidebar');
		mbm.setAttribute('href', url);
		mbm.setAttribute('title', title);
		mbm.click();
	}	else if (document.all) window.external.AddFavorite(url, title);
}
function setPosition(posObj, setY) {	
    var yScroll;
	if (self.innerHeight) {
		windowHeight = self.innerHeight;
	}	else {
		windowHeight = document.documentElement.clientHeight;
	}
	if (! setY) {
		if (self.pageYOffset) {
			yScroll = self.pageYOffset;
		} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
			yScroll = document.documentElement.scrollTop;
		} else if (document.body) {
			  yScroll = document.body.scrollTop;
		}
	} else {
		yScroll = 0;
	}
	posObj.style.left = (document.documentElement.clientWidth - parseInt(posObj.style.width))/2 + 'px';
	posObj.style.top = yScroll + (windowHeight - parseInt(posObj.style.height))/2 + 'px';	
}
function slideLine(ul, delay, speed, lh) {
			var slideBox = (typeof ul == 'string')?document.getElementById(ul):ul;
			var delay = delay||1000, speed=speed||20, lh = lh||20;
			var tid = null, pause = false;
			var start = function() {
				tid=setInterval(slide, speed);
			}
			var slide = function() {
				if (pause) return;
				slideBox.scrollTop += 2;
				if (slideBox.scrollTop % lh == 0) {
					clearInterval(tid);
					slideBox.appendChild(slideBox.getElementsByTagName('li')[0]);
					slideBox.scrollTop = 0;
					setTimeout(start, delay);
				}
			}            
			slideBox.onmouseover=function(){pause=true;}
			slideBox.onmouseout=function(){pause=false;}
			setTimeout(start, delay);
}
var XMLHttp = {
    _objPool: [],    
    _getInstance: function () {
			  len = this._objPool.length;
        for (var i = 0; i < len; i ++) {
            if (this._objPool[i].readyState == 0 || this._objPool[i].readyState == 4) {
                return this._objPool[i];
            }
        }
        this._objPool[this._objPool.length] = this._createObj();
        return this._objPool[this._objPool.length - 1];
    },
    _createObj: function () {
		var objXMLHttp = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
		if (! objXMLHttp) {
			alert('操作終止：非常抱歉，由於您的瀏覽器不支持XMLHttpRequest，請升級您的瀏覽器，或聯絡客服中心，謝謝。');
			return ;
		}
		if (objXMLHttp.readyState == null) {
        	objXMLHttp.readyState = 0;
            objXMLHttp.addEventListener("load", function () {
                    objXMLHttp.readyState = 4;
                    
                    if (typeof objXMLHttp.onreadystatechange == "function") {
                        objXMLHttp.onreadystatechange();
                    }
                },  false);
        }
        return objXMLHttp;
    },
    sendReq: function (method, url, data, callback, function_name) {
        var objXMLHttp = this._getInstance();
        with(objXMLHttp) {
            try {
                if (url.indexOf("?") > 0) {
                    url += "&randnum=" + Math.random();
                } else {
                    url += "?randnum=" + Math.random();
                }
                open(method, url, true);
                setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset: utf-8');
                send(data);
                onreadystatechange = function () {      
                    if (objXMLHttp.readyState == 4 && (objXMLHttp.status == 200 || objXMLHttp.status == 304)) {
                        callback(objXMLHttp, function_name);
                    }
                }
            } catch(e) {
                alert(e);
            }
        }
    },
	deleteAll: function(objName) {
		len = this._objPool.length;
        for (var i = 0; i < len; i ++) {
            if (this._objPool[i].readyState == 1) {
                is_moz ? this._objPool[i].onreadystatechange = null : this._objPool[i].abort();				 
            }
        }		
		this._objPool.length = 0;
	}
};



var XMLHttp_2 = {
    _objPool: [],    
    _getInstance: function () {
			  len = this._objPool.length;
        for (var i = 0; i < len; i ++) {
            if (this._objPool[i].readyState == 0 || this._objPool[i].readyState == 4) {
                return this._objPool[i];
            }
        }
        this._objPool[this._objPool.length] = this._createObj();
        return this._objPool[this._objPool.length - 1];
    },
    _createObj: function () {
		var objXMLHttp = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
		if (! objXMLHttp) {
			alert('操作終止：非常抱歉，由於您的瀏覽器不支持XMLHttpRequest，請升級您的瀏覽器，或聯絡客服中心，謝謝。');
			return ;
		}
		if (objXMLHttp.readyState == null) {
        	objXMLHttp.readyState = 0;
            objXMLHttp.addEventListener("load", function () {
                    objXMLHttp.readyState = 4;
                    
                    if (typeof objXMLHttp.onreadystatechange == "function") {
                        objXMLHttp.onreadystatechange();
                    }
                },  false);
        }
        return objXMLHttp;
    },
    sendReq: function (method, url, data, callback, function_name) {
        var objXMLHttp = this._getInstance();
        with(objXMLHttp) {
            try {
                if (url.indexOf("?") > 0) {
                    url += "&randnum=" + Math.random();
                } else {
                    url += "?randnum=" + Math.random();
                }
                open(method, url, true);
                setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset: utf-8');
                send(data);
                onreadystatechange = function () {      
                    if (objXMLHttp.readyState == 4 && (objXMLHttp.status == 200 || objXMLHttp.status == 304)) {
                        callback(objXMLHttp, function_name);
                    }
                }
            } catch(e) {
                alert(e);
            }
        }
    },
	deleteAll: function(objName) {
		len = this._objPool.length;
        for (var i = 0; i < len; i ++) {
            if (this._objPool[i].readyState == 1) {
                is_moz ? this._objPool[i].onreadystatechange = null : this._objPool[i].abort();				 
            }
        }		
		this._objPool.length = 0;
	}
};
function _callback_function__2(obj,function_name_2) {
	 function_name_2(obj.responseText); 
}




function _callback_function_(obj,function_name) {
	 function_name(obj.responseText); 
}
function Http_Get_Request(Url,function_name) {
	XMLHttp.sendReq('GET',Url,'',_callback_function_,function_name);
}
function Http_Post_Request(Url,PostStr,function_name) {
	XMLHttp.sendReq('POST', Url, PostStr, _callback_function_, function_name);
}
function myencode(value) {
		var varString = encodeURIComponent(value);
    return varString;
}
var Drag = {
    obj : null,
    init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper)
    {
        o.onmousedown    = Drag.start;
        o.hmode            = bSwapHorzRef ? false : true ;
        o.vmode            = bSwapVertRef ? false : true ;
        o.root = oRoot && oRoot != null ? oRoot : o ;
        if (o.hmode && isNaN(parseInt(o.root.style.left ))) o.root.style.left   = "0px";
        if (o.vmode && isNaN(parseInt(o.root.style.top   ))) o.root.style.top    = "0px";
        if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right = "0px";
        if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";
        o.minX    = typeof minX != 'undefined' ? minX : null;
        o.minY    = typeof minY != 'undefined' ? minY : null;
        o.maxX    = typeof maxX != 'undefined' ? maxX : null;
        o.maxY    = typeof maxY != 'undefined' ? maxY : null;

        o.xMapper = fXMapper ? fXMapper : null;
        o.yMapper = fYMapper ? fYMapper : null;

        o.root.onDragStart    = new Function();
        o.root.onDragEnd    = new Function();
        o.root.onDrag        = new Function();
    },
    start : function(e)
    {
        var o = Drag.obj = this;
        e = Drag.fixE(e);
        var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom);
        var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
        o.root.onDragStart(x, y);
        o.lastMouseX    = e.clientX;
        o.lastMouseY    = e.clientY;
        if (o.hmode) {
            if (o.minX != null)    o.minMouseX    = e.clientX - x + o.minX;
            if (o.maxX != null)    o.maxMouseX    = o.minMouseX + o.maxX - o.minX;
        } else {
            if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;
            if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;
        }
        if (o.vmode) {
            if (o.minY != null)    o.minMouseY    = e.clientY - y + o.minY;
            if (o.maxY != null)    o.maxMouseY    = o.minMouseY + o.maxY - o.minY;
        } else {
            if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;
            if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;
        }
        document.onmousemove    = Drag.drag;
        document.onmouseup        = Drag.end;
        return false;
    },
    drag : function(e)
    {
        e = Drag.fixE(e);
        var o = Drag.obj;

        var ey    = e.clientY;
        var ex    = e.clientX;
        var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom);
        var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
        var nx, ny;

        if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
        if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
        if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
        if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);

        nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
        ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));

        if (o.xMapper)        nx = o.xMapper(y)
        else if (o.yMapper)    ny = o.yMapper(x)

        Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";
        Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";
        Drag.obj.lastMouseX    = ex;
        Drag.obj.lastMouseY    = ey;

        Drag.obj.root.onDrag(nx, ny);
        return false;
    },
    end : function()
    {
        document.onmousemove = null;
        document.onmouseup   = null;
        Drag.obj.root.onDragEnd(    parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]), 
                                    parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"]));
        Drag.obj = null;
    },
    fixE : function(e)
    {
        if (typeof e == 'undefined') e = window.event;
        if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
        if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
        return e;
    }
};
function num_han(num)
{
    if ( num == "1" )       return "壹";
    else if ( num == "2" )  return "貳";
    else if ( num == "3" )  return "參";
    else if ( num == "4" )  return "肆";
    else if ( num == "5" )  return "伍";
    else if ( num == "6" )  return "陸";
    else if ( num == "7" )  return "柒";
    else if ( num == "8" )  return "捌";
    else if ( num == "9" )  return "玖";
    else if ( num == "拾" ) return "拾";
    else if ( num == "佰" ) return "佰";
    else if ( num == "仟" ) return "仟";
    else if ( num == "萬" ) return "萬 ";
    else if ( num == "億" ) return "億 ";
    else if ( num == "兆" ) return "兆 ";
    else if ( num == "0" )  return "";
}

function NUM_HAN(num,mode,return_input,is_wan)
{
    if ( num == "" || num == "0" ) {
        if ( mode == "3" ) {
            return_input.value = "";
        }
        return;
    }
		
    num=new String(num);
    num=num.replace(/,/gi,"");

  	if (is_wan) {
			num = num + '0000';
	    num=new String(num);			
		}
	  var len  = num.length;
    var temp1 = "";
    var temp2 = "";

    if ( len/4 > 3 && len/4 <= 4 ) {
        if ( len%4 == 0 ) {
            temp1 = ciphers_han(num.substring(0,4)) + "兆" + ciphers_han(num.substring(4,8)) + "億" + ciphers_han(num.substring(8,12)) + "萬" + ciphers_han(num.substring(12,16));
        }
        else {
            temp1 = ciphers_han(num.substring(0,len%4)) + "兆" + ciphers_han(num.substring(len%4,len%4+4)) + "億" + ciphers_han(num.substring(len%4+4,len%4+8)) + "萬" + ciphers_han(num.substring(len%4+8,len%4+12));
        }
    }
    else if ( len/4 > 2 && len/4 <= 3 ) {
        if ( len%4 == 0 ) {
            temp1 = ciphers_han(num.substring(0,4)) + "億" + ciphers_han(num.substring(4,8)) + "萬" + ciphers_han(num.substring(8,12));
        }
        else {
            temp1 = ciphers_han(num.substring(0,len%4)) + "億" + ciphers_han(num.substring(len%4,len%4+4)) + "萬" + ciphers_han(num.substring(len%4+4,len%4+8));
        }
    }
    else if ( len/4 > 1 && len/4 <= 2 ) {
        if ( len%4 == 0 ) {
            temp1 = ciphers_han(num.substring(0,4)) + "萬" + ciphers_han(num.substring(4,len));
        }
        else {
            temp1 = ciphers_han(num.substring(0,len%4)) + "萬" + ciphers_han(num.substring(len%4,len));
        }
    }
    else if ( len/4 <= 1 ) {
        temp1 = ciphers_han(num.substring(0,len));
    }

    for (var i=0; i<temp1.length; i++) {
        temp2 = temp2 + num_han(temp1.substring(i, i+1));
    }

    temp3=new String(temp2);
    temp3=temp3.replace(/億 萬/gi,"億 ");
    temp3=temp3.replace(/兆 億/gi,"兆 ");

    if ( mode == 1 ) {
        alert(temp3 + " 圓");
    } else if ( mode == 2 ) {
        return temp3;
    } else if ( mode == 3 ) {
        return_input.value = "( " + temp3 + " 圓 )";
    }
}

function ciphers_han(num)
{
    var len  = num.length;
    var temp = "";
    if ( len == 1 ) {
        temp = num;
    }
    else if ( len == 2 ) {
        temp = num.substring(0,1) + "拾" + num.substring(1,2);
    }
    else if ( len == 3 ) {
        temp = num.substring(0,1) + "佰" + num.substring(1,2) + "拾" + num.substring(2,3);
    }
    else if ( len == 4 ) {
        temp = num.substring(0,1) + "仟" + num.substring(1,2) + "佰" + num.substring(2,3) + "拾" + num.substring(3,4);
    }
    num=new String(temp);
    num=num.replace(/0拾/gi,"");
    num=num.replace(/0佰/gi,"");
    num=num.replace(/0仟/gi,"");		
    return num;
}
function numchk(num){	  
    num=new String(num);
    num=num.replace(/,/gi,"");
		num = numberConv(num);
    return numchk1(num);
}

function numchk2(num){
	num =new String(num);
    num=num.replace(/,/gi,"");
	num=new Number(num);
	num=num+15;
	return numchk1(num);
}

function numchk3(num){
	num =new String(num);
    num=num.replace(/,/gi,"");
	num=new Number(num);
	num=num*15;
	return numchk1(num);
}

function numchk1(num){
    var sign="";
    if(isNaN(num)) {
        alert("只可以輸入數字.");
        return 0;
    }
    if(num==0) {
        return num;
    }

    if(num<0){
        num=num*(-1);
        sign="-";
    }
    else{
        num=num*1;
    }
    num = new String(num)
    var temp="";
    var pos=3;
    num_len=num.length;
    while (num_len>0){
        num_len=num_len-pos;
        if(num_len<0) {
            pos=num_len+pos;
            num_len=0;
        }
        temp=","+num.substr(num_len,pos)+temp;
    }
    return sign+temp.substr(1);
}
function numchk4(num){
	num =new String(num);
    num=num.replace(/,/gi,"");
	num=new Number(num);
	num=num+25;
	return numchk1(num);
}
function checkInteger(obj, allowzero)
{
	obj.value = numberConv(obj.value);
	if (false == allowzero)
	{
		if ((obj.value != '') && obj.value < 1)
		{
			alert('不能為零');
			obj.value = '';
			return false;
		}
	}
 	obj.value=obj.value.replace(/[^0123456789]/g, '');
}
function numberConv(val)
{
	if ('' == val)
	{
		return '';
	}
	return val.replace("０","0").replace("１","1").replace("２","2").replace("３","3").replace("４","4").replace("５","5").replace("６","6").replace("７","7").replace("８","8").replace("９","9").replace("．",".").replace("。",".");
}
function checkIsDouble(obj, help_obj)
 {  
	  if ('' == obj.value) {
			return ;
	  }
      obj.value = numberConv(obj.value);
	  re = /^\d+\.?\d*$/;
      if (! re.test(obj.value)) {
			if (obj.value.indexOf('.') != -1) {
				len = obj.value.length;
				obj.value = obj.value.substr(0, len-1);
			}
			obj.value=obj.value.replace(/[^0123456789.]/g, '');
			if (help_obj)
			{
				$(help_obj).innerHTML = '（請輸入正確的數字）';
			}
			return ;
		}
		if (obj.value < 1)
		{
			if (help_obj)
			{
				$(help_obj).innerHTML = '（數字不能小於0）';
				obj.value = '';
			}
			return ;
		}
		if (help_obj)
		{
			$(help_obj).innerHTML = '（正確的數字）';
		}
 }
 function DBC2SBC(str,flag) {
	var i;
	var result='';
	if (str.length<=0) { return '';}
	for(i=0;i<str.length;i++) { 
		str1=str.charCodeAt(i);
		if (str1<125 && ! flag) {		    
				result+=String.fromCharCode(str.charCodeAt(i)+65248);
		} else if (str1>=65290 && str1<653620 && flag) {
				result+=String.fromCharCode(str.charCodeAt(i)-65248);
		} else {
				result+=String.fromCharCode(str.charCodeAt(i));
		}  
	}
  return result;
}

function  onlyNum()
{
	if(!((event.keyCode>=48&&event.keyCode<=57)||(event.keyCode>=96&&event.keyCode<=105)||(event.keyCode==8)))
	event.returnValue=false;
}
//house-describe
function houseDescribe()
{
	$("house-describe").style.display='n' + 'one';
}

//顯示隱藏層
function showHide(sid)
{
	var obj = typeof(sid)=="string" ? $(sid) : sid;
	var display = obj.style.display == 'none' ? '' : 'none';
	var status  = obj.style.display == 'none' ? 'true' : 'false';
	obj.style.display = display;
	return status;
}
/*
 * 獲取查詢字符串
 *使用方法：
 *var sUrl = location.href;
 *sUrl = sUrl.toString();
 *var t = sUrl.getQuery("title");
 */
String.prototype.getQuery = function(name) {
　　var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
　　var r = this.substr(this.indexOf("\?")+1).match(reg);
　　if (r!=null) return unescape(r[2]); return null;
}
//刪除物件問答
function delQuestion(pid,type,post_id)
{
	if (false == window.confirm("提問刪除後，您的回覆也會被刪除，確定要刪除嗎?")) return ;
	location.href = "./index.php?module=question&action=delQuestion&pid="+pid+"&type="+type+"&post_id="+post_id;
}
/*
 * js版in_array
 * 
 */
function in_array(stringToSearch, arrayToSearch) 
{
	if(arrayToSearch.length==1){
		return thisEntry==arrayToSearch[0].toString();
	}
	for (s = 0; s <arrayToSearch.length; s++) {
		thisEntry = arrayToSearch[s].toString();
		if (thisEntry == stringToSearch) {
			return true;
		}
	}
	return false;
}



function indexClickStat(key)
{
    var url = "./index.php?module=index&action=indexClickStat&key="+key;
	Http_Get_Request(url, callIndexClickStat);
}
function callIndexClickStat(val)
{

}
