var Browser = new Object();
Browser.isMozilla = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined') && (typeof HTMLDocument!='undefined');
Browser.isIE = window.ActiveXObject ? true : false;
Browser.isFirefox = (navigator.userAgent.toLowerCase().indexOf("firefox")!=-1);
Browser.isOpera = (navigator.userAgent.toLowerCase().indexOf("opera")!=-1);
if (Browser.isFirefox) { // entend Event Mod for FireFox
	extendEventObject();
}
function extendEventObject() {
	Event.prototype.__defineGetter__("srcElement", function () {
		var node = this.target;
		while (node.nodeType != 1) node = node.parentNode;
		return node;
	});

	Event.prototype.__defineGetter__("fromElement", function () {
		var node;
		if (this.type == "mouseover")
			node = this.relatedTarget;
		else if (this.type == "mouseout")
			node = this.target;
		if (!node) return;
		while (node.nodeType != 1) node = node.parentNode;
		return node;
	});

	Event.prototype.__defineGetter__("toElement", function () {
		var node;
		if (this.type == "mouseout")
			node = this.relatedTarget;
		else if (this.type == "mouseover")
			node = this.target;
		if (!node) return;
		while (node.nodeType != 1) node = node.parentNode;
		return node;
	});
}


    //出处:网上搜集
    // Trim() , Ltrim() , RTrim() 
    String.prototype.Trim = function() 
    { 
    return this.replace(/(^\s*)|(\s*$)/g, ""); 
    } 

    String.prototype.LTrim = function() 
    { 
    return this.replace(/(^\s*)/g, ""); 
    } 

    String.prototype.RTrim = function() 
    { 
    return this.replace(/(\s*$)/g, ""); 
    } 

 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
    //用javascript设置cookie
    function setLastlastVisitCookie() {
        var expdate = new Date();

        //设置1年
        //expdate.setFullYear(expdate.getFullYear() + 1);

        //删除cookie
        //expdate.setTime(expdate.getTime() - 1);

        //设置30分钟
        expdate.setTime(expdate.getTime() + 30 * 60 * 1000);
        document.cookie = "photo_id=" + escape(document.form1.photo_id.value)
        + "; expires=" + expdate.toGMTString() + "; path=/";
        }
    //搜索满足条件的cookie
    function GetCookie(name){
        var nameEQ = name + "=";
        var ca = document.cookie.split(';');
        for(var i=0;i < ca.length;i++) {
                var c = ca[i];
                while (c.charAt(0)==' ') c = c.substring(1,c.length);
                if (c.indexOf(nameEQ) == 0) return decodeURIComponent(c.substring(nameEQ.length,c.length));
        }
        return null;
        }
    
//    function GetCookie(name) {
//        var arg = name + "=";
//        var alen = arg.length;
//        var clen = document.cookie.length;
//        var i = 0;
//        while (i < clen) {
//        var j = i + alen;
//        if (document.cookie.substring(i, j) == arg)
//        return getCookieVal (j);
//        i = document.cookie.indexOf(" ", i) + 1;
//        if (i == 0) break;
//        }
//        return null;
//        }

//    //得到满足条件的cookie值
//    function getCookieVal(offset) {
//        var endstr = document.cookie.indexOf (";", offset);
//        if (endstr == -1)
//        endstr = document.cookie.length;
//        return decodeURIComponent(document.cookie.substring(offset, endstr));
//        }
//        
//        function delCookie(name)
//        {
//        var exp = new Date();
//            exp.setTime(exp.getTime() - 1);
//        var cval=GetCookie(name);
//        if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
//        }
  /////////////////////////////////////////////////////////////////////////////////////////////////////      
  
  
//判断obj是否是target或包含在target中
function contains(target, obj){
    while(obj.parentNode){
        if(obj == target) return true;
        obj = obj.parentNode;
    }
    return false;
}

function isie()
{
    if(window.navigator.userAgent.indexOf("MSIE") >= 1)
        return true;
    else
        return false;
}

//判断搜索关键词
    function checkSearchWord(form)
    {
       if(form.searchWord.value.Trim() =="")
       {
            alert("请输入查询关键字");
            return false;
       }
        else
        return true;
    }
  
