var TabGroup = function(fStyle,bStyle){
    return {
        tabArray: [],
        focusStyle : fStyle,
        blurStyle : bStyle,
        add: function(tab){
            var self = this;
            tab.addEvent('onmouseover', function(){
                self.show(this.id);
            });
            this.tabArray[this.tabArray.length] = tab;
        },
        show: function(tabId){
            for (var i = 0; i < this.tabArray.length; i++) {
	            var tab = this.tabArray[i];
            	if(tab.tabTitle && tab.tabContent){
	                if (tab.tabTitle.id == tabId) {
	                    tab.tabContent.style.display = 'block';
	                    tab.tabTitle.className = this.focusStyle || '';
	                }
	                else {
	                    tab.tabContent.style.display = 'none';
	                    tab.tabTitle.className = this.blurStyle || '';
	                }
            	}
            }
        }
    }
}
var Tab = function(tabTitleId, tabContentId){
    this.tabTitle = document.getElementById(tabTitleId);
    this.tabContent = document.getElementById(tabContentId);
    this.addEvent = function(eventName, eventFunction){
    	if(this.tabTitle){
	        this.tabTitle[eventName] = eventFunction;
    	}
    }
}

function isMobile(mobile){
    var reg0 = /^13\d{5,9}$/; //130--139。至少7位
    var reg1 = /^15\d{5,9}$/; //150-159
    var reg2 = /^18\d{5,9}$/; //180-189
    var reg3 = /^14\d{5,9}$/; //140-149
    var my = false;
    if (reg0.test(mobile)) 
        my = true;
    if (reg1.test(mobile)) 
        my = true;
    if (reg2.test(mobile)) 
        my = true;
    if (reg3.test(mobile)) 
        my = true;
    return my;
}

function validate(uNErr,pwdErr,rErr){

try{
    var userName = document.getElementById('userName');
    if(!userName){
    	return false;
    }
    
	if(!userName.value || isNaN(userName.value) || !isMobile(userName.value)){
		userName.className = uNErr || 'text01_2';
        document.getElementById('userNameMsg').innerHTML = '请您正确输入手机号码';
    	return false;
    }
    
    var pwd = document.getElementById('password');
    if(!pwd){
    	return false;
    }
    if (!pwd.value) {
        pwd.className= pwdErr || 'text01_2';
        document.getElementById(pwd.id + 'Msg').innerHTML = '请您正确输入密码';
        return false;
    }
    var rString = document.getElementById('rString');
    if(!rString){
    	return false;
    }
    if (!rString.value) {
        rString.className= rErr || 'text02_2';
        document.getElementById(rString.id + 'Msg').innerHTML = '请您正确输入验证码';
        return false;
    }
   	return true;
   	}catch(e){
   		alert(e);
   		return false;
   	}

}

function showError(obj,errorStyle){
	if(!obj){
		return;
	}
	if(obj.className == errorStyle && document.getElementById(obj.id + 'Msg')){
			document.getElementById(obj.id + 'Msg').style.display = 'block';
	}
}

function hideError(obj){
	if(document.getElementById(obj.id + 'Msg')){
		document.getElementById(obj.id + 'Msg').style.display = 'none';
	}
}

function validateUserName(obj,style){
	if(!obj){
		return;
	}
	if(obj.value && !isNaN(obj.value) && isMobile(obj.value)){
		obj.className = style;
		if(document.getElementById(obj.id + 'Msg')){
			document.getElementById(obj.id + 'Msg').style.display = 'none';
			document.getElementById(obj.id + 'Msg').innerHTML = '';
		}
	}
}

function validatePwd(obj,style){
	if(!obj){
		return;
	}
	if(obj.value){
		obj.className = style;
		if(document.getElementById(obj.id + 'Msg')){
			document.getElementById(obj.id + 'Msg').style.display = 'none';
			document.getElementById(obj.id + 'Msg').innerHTML = '';
		}
	}
}

function validateRString(obj,style){
	if(!obj){
		return;
	}
	if(obj.value){
		obj.className = style;
		if(document.getElementById(obj.id + 'Msg')){
			document.getElementById(obj.id + 'Msg').style.display = 'none';
			document.getElementById(obj.id + 'Msg').innerHTML = '';
		}
	}
}



var ajax = {
    ajaxObj: null,
    create: function(){
        try {
            // Firefox, Opera 8.0+, Safari
            this.ajaxObj = new XMLHttpRequest();
        } 
        catch (e) {
            // Internet Explorer
            try {
                this.ajaxObj = new ActiveXObject("Msxml2.XMLHTTP");
            } 
            catch (e) {
                this.ajaxObj = new ActiveXObject("Microsoft.XMLHTTP");
            }
        }
    },
    send: function(url, paramters, method, isSyna, callback){
        try {
            if (!this.ajaxObj) {
                this.create();
            }
            var uri = url;
            if (url.indexOf('&') > 0) {
                uri = url.substring(0, url.indexOf('&'));
            }
            this.ajaxObj.open(method, encodeURI(uri), true);
            
            
            this.ajaxObj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            
            this.ajaxObj.onreadystatechange = function(){
                if (ajax.ajaxObj.readyState == 4 && ajax.ajaxObj.status == 200) {
                    callback(ajax.ajaxObj);
                }
            };
            var paramterString = null;
            if (paramters) {
                if (typeof(paramters) == 'string') {
                    paramterString = paramters;
                }
                if (typeof(paramters) == 'object') {
                    paramterString = '';
                    for (var p in paramters) {
                        paramterString += (p + '=' + escape(paramters[p]) + '&');
                    }
                    paramterString = paramterString.substring(0, paramterString.length - 1);
                }
                
            }
            this.ajaxObj.send(paramterString);
        } 
        catch (e) {
            alert(e);
        }
    }
}
//引用子页面的写法
//window.document.getElementById('bodyIframe').contentWindow.pageManager
//感谢http://www.leigeber.com/2008/04/custom-javascript-dialog-boxes/
var Dialog = {

    login: function(title, content, callback){
    
        var dialog;
        var dialogheader;
        var dialogclose;
        var dialogtitle;
        var dialogcontent;
        var dialogbottom;
        var dialogmask;
        var submitBtn;
        var iframe;
        
        if (!document.getElementById('login')) {
            dialog = document.createElement('div');
            dialog.id = 'login';
            dialogheader = document.createElement('div');
            dialogheader.id = 'login-header';
            dialogtitle = document.createElement('div');
            dialogtitle.id = 'login-title';
            dialogclose = document.createElement('div');
            dialogclose.id = 'login-close'
            dialogcontent = document.createElement('div');
            dialogcontent.id = 'login-content';
            dialogbottom = document.createElement('div');
            dialogbottom.id = 'login-bottom';
            submitBtn = document.createElement('div');
            submitBtn.className = 'lg_bn';
            submitBtn.onclick = function(){
                callback(document);
                dialogclose.onclick();
            }
            dialogmask = document.createElement('div');
            dialogmask.id = 'login-mask';
            iframe = document.createElement('iframe');
            iframe.id = 'i-mask';
            document.body.appendChild(iframe);
            document.body.appendChild(dialogmask);
            document.body.appendChild(dialog);
            dialog.appendChild(dialogheader);
            dialogheader.appendChild(dialogtitle);
            dialogheader.appendChild(dialogclose);
            dialogcontent.innerHTML = content
            dialog.appendChild(dialogcontent);
            dialog.appendChild(dialogbottom);
            dialogbottom.appendChild(submitBtn);
            // dialogclose.setAttribute('onclick','hideDialog()');
            //dialogclose.onclick = hideDialog;
            dialogclose.onclick = function(){
                document.body.removeChild(iframe);
                document.body.removeChild(dialogmask);
                document.body.removeChild(dialog);
            }
        }
        else {
            dialog = document.getElementById('login');
            dialogheader = document.getElementById('login-header');
            dialogtitle = document.getElementById('login-title');
            dialogclose = document.getElementById('login-close');
            dialogcontent = document.getElementById('login-content');
            dialogmask = document.getElementById('login-mask');
            dialogmask.style.visibility = 'visible';
            dialog.style.visibility = 'visible';
        }
        
        var width = pageWidth();
        var height = pageHeight();
        var left = leftPosition();
        var top = topPosition();
        var dialogwidth = dialog.offsetWidth;
        var dialogheight = dialog.offsetHeight;
        var topposition = top + (height / 3) - (dialogheight / 2);
        var leftposition = left + (width / 2) - (dialogwidth / 2);
        dialog.style.top = topposition + 'px';
        dialog.style.left = leftposition + 'px';
        dialogheader.className = 'errorheader';
        dialogtitle.innerHTML = title;
        
        dialogcontent.className = 'error';
        iframe.style.height = document.body.scrollHeight + 'px';
        dialogmask.style.height = document.body.scrollHeight + 'px';
        
    },
    ajax: function(config){
        ajax.send(config.ajax.url, config.ajax.paramters, 'POST', true, function(ajaxObj){
            if (!config.type || config.type == 'confirm') {
                Dialog.confirm(config.title, ajaxObj.responseText, config.callback);
            }
            else 
                if (config.type == 'hm') {
                    Dialog.confirm(config.title, ajaxObj.responseText, config.callback, config.type);
                }
                else 
                    if (config.type == 'login') {
                        Dialog.login(config.title, ajaxObj.responseText, config.callback);
                    }
            
        });
    },
    iframe: function(config){
        var bgDiv = document.createElement('div');
        //bgDiv.className = '';
        bgDiv.style.position = "absolute";
        bgDiv.style.top = "0";
        bgDiv.style.background = "#777";
        bgDiv.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=0,finishOpacity=80)";
        bgDiv.style.opacity = "0.6";
        bgDiv.style.left = "0";
        bgDiv.style.width = "100%";
        bgDiv.style.height = document.body.scrollHeight;
        bgDiv.style.zIndex = "10000";
        
        var dialogDiv = document.createElement('div');
        dialogDiv.className = '';
        
        dialogDiv.style.background = "#333333";
        dialogDiv.style.border = "1pxsolid" + "#000000";
        dialogDiv.style.position = "absolute";
        dialogDiv.style.font = "12px/1.6emVerdana,Geneva,Arial,Helvetica,sans-serif";
        dialogDiv.style.left = 50 + "px";
        dialogDiv.style.top = 50 + "px";
        dialogDiv.style.width = 600 + "px";
        dialogDiv.style.height = 600 + "px";
        dialogDiv.style.textAlign = "center";
        dialogDiv.style.lineHeight = "25px";
        dialogDiv.style.zIndex = "10001";
        
        
        var titleDiv = document.createElement('div');
        titleDiv.className = '';
        titleDiv.innerHTML = config.title;
        dialogDiv.appendChild(titleDiv);
        var contentDiv = document.createElement('div');
        contentDiv.className = '';
        
        var iframe = document.createElement('iframe');
        iframe.name = 'dialogIframe';
        iframe.id = 'dialogIframe';
        iframe.src = config.url;
        iframe.scrolling = 'no';
        iframe.frameborder = '0';
        //iframe.width = '100%';
        iframe.onload = function(){
            this.height = this.contentDocument.body.scrollHeight;
            dialogDiv.style.height = this.height;
        }
        contentDiv.appendChild(iframe);
        dialogDiv.appendChild(contentDiv);
        var bottomDiv = document.createElement('div');
        bottomDiv.className = '';
        var btn = document.createElement('input');
        btn.type = 'button';
        btn.className = '';
        btn.value = '确定';
        var callback = config.callback;
        btn.onclick = function(){
            callback(iframe);
            document.body.removeChild(bgDiv);
            dialogDiv = null;
        }
        bottomDiv.appendChild(btn);
        dialogDiv.appendChild(bottomDiv);
        document.body.appendChild(dialogDiv);
        document.body.appendChild(bgDiv);
    },
    alert: function(title, messages, callback){
        var type = 'error';
        var dialog;
        var dialogheader;
        var dialogclose;
        var dialogtitle;
        var dialogcontent;
        var dialogbottom;
        var dialogmask;
        var submitBtn;
        
        var iframe;
        
        
        if (!document.getElementById('dialog')) {
            dialog = document.createElement('div');
            dialog.id = 'art';
            dialogheader = document.createElement('div');
            dialogheader.id = 'art-header';
            dialogtitle = document.createElement('div');
            dialogtitle.id = 'art-title';
            dialogclose = document.createElement('div');
            dialogclose.id = 'art-close'
            dialogcontent = document.createElement('div');
            dialogcontent.id = 'art-content';
            dialogcontent.innerHTML = messages;
            dialogbottom = document.createElement('div');
            dialogbottom.id = 'art-bottom';
            submitBtn = document.createElement('div');
            submitBtn.className = 'art_bn';
            submitBtn.onclick = function(){
                callback(document);
                dialogclose.onclick();
            }
            dialogmask = document.createElement('div');
            dialogmask.id = 'art-mask';
            iframe = document.createElement('iframe');
            iframe.id = 'i-mask';
            document.body.appendChild(iframe);
            document.body.appendChild(dialogmask);
            document.body.appendChild(dialog);
            dialog.appendChild(dialogheader);
            dialogheader.appendChild(dialogtitle);
            dialogheader.appendChild(dialogclose);
            dialog.appendChild(dialogcontent);
            dialog.appendChild(dialogbottom);
            dialogbottom.appendChild(submitBtn);
            // dialogclose.setAttribute('onclick','hideDialog()');
            //dialogclose.onclick = hideDialog;
            dialogclose.onclick = function(){
                //callback(document);
                
                document.body.removeChild(iframe);
                document.body.removeChild(dialogmask);
                document.body.removeChild(dialog);
            }
        }
        else {
            dialog = document.getElementById('art');
            dialogheader = document.getElementById('art-header');
            dialogtitle = document.getElementById('art-title');
            dialogclose = document.getElementById('art-close');
            dialogcontent = document.getElementById('art-content');
            dialogmask = document.getElementById('art-mask');
            dialogmask.style.visibility = "visible";
            dialog.style.visibility = "visible";
        }
        
        var width = pageWidth();
        var height = pageHeight();
        var left = leftPosition();
        var top = topPosition();
        var dialogwidth = dialog.offsetWidth;
        var dialogheight = dialog.offsetHeight;
        var topposition = top + (height / 3) - (dialogheight / 2);
        var leftposition = left + (width / 2) - (dialogwidth / 2);
        dialog.style.top = topposition + "px";
        dialog.style.left = leftposition + "px";
        dialogheader.className = type + "header";
        //dialogtitle.innerHTML = title;
        
        dialogcontent.className = type;
        iframe.style.height = document.body.scrollHeight + 'px';
        dialogmask.style.height = document.body.scrollHeight + 'px';
    },
    confirm: function(title, content, callback, type){
        var dialog;
        var dialogheader;
        var dialogclose;
        var dialogtitle;
        var dialogcontent;
        var dialogbottom;
        var dialogmask;
        var submitBtn;
        var iframe;
        var dialogBtnPanel;
        var t = (type && type == 'hm') ? type : '';
        
        if (!document.getElementById('dialog')) {
            dialog = document.createElement('div');
            dialog.id = t + 'dialog';
            dialogheader = document.createElement('div');
            dialogheader.id = t + 'dialog-header';
            dialogtitle = document.createElement('div');
            dialogtitle.id = t + 'dialog-title';
            dialogclose = document.createElement('div');
            dialogclose.id = t + 'dialog-close'
            dialogcontent = document.createElement('div');
            dialogcontent.id = t + 'dialog-content';
            dialogcontent.innerHTML = content;
            dialogbottom = document.createElement('div');
            dialogbottom.id = t + 'dialog-bottom';
            
            dialogBtnPanel = document.createElement('div');
            dialogBtnPanel.className = 'dialog-btns';
            cancelBtn = document.createElement('div');
            cancelBtn.className = 'cl_bn';
            cancelBtn.onclick = function(){
            
                dialogclose.onclick();
            }
            
            
            submitBtn = document.createElement('div');
            submitBtn.className = 'od_bn';
            submitBtn.onclick = function(){
                callback(document);
                dialogclose.onclick();
                Dialog.loading();
            }
            dialogmask = document.createElement('div');
            dialogmask.id = t + 'dialog-mask';
            
            iframe = document.createElement('iframe');
            iframe.id = 'i-mask';
            
            document.body.appendChild(iframe);
            document.body.appendChild(dialogmask);
            document.body.appendChild(dialog);
            dialog.appendChild(dialogheader);
            dialogheader.appendChild(dialogtitle);
            dialogheader.appendChild(dialogclose);
            dialog.appendChild(dialogcontent);
            dialog.appendChild(dialogbottom);
            dialogBtnPanel.appendChild(cancelBtn);
            dialogBtnPanel.appendChild(submitBtn);
            dialogbottom.appendChild(dialogBtnPanel);
            // dialogclose.setAttribute('onclick','hideDialog()');
            //dialogclose.onclick = hideDialog;
            dialogclose.onclick = function(){
                document.body.removeChild(iframe);
                document.body.removeChild(dialogmask);
                document.body.removeChild(dialog);
            }
        }
        else {
            dialog = document.getElementById('dialog');
            dialogheader = document.getElementById('dialog-header');
            dialogtitle = document.getElementById('dialog-title');
            dialogclose = document.getElementById('dialog-close');
            dialogcontent = document.getElementById('dialog-content');
            dialogmask = document.getElementById('dialog-mask');
            dialogmask.style.visibility = "visible";
            dialog.style.visibility = "visible";
        }
        
        var width = pageWidth();
        var height = pageHeight();
        var left = leftPosition();
        var top = topPosition();
        var dialogwidth = dialog.offsetWidth;
        var dialogheight = dialog.offsetHeight;
        var topposition = top + (height / 3) - (dialogheight / 2);
        if (topposition > 150) {
            topposition = 150;
        }
        var leftposition = left + (width / 2) - (dialogwidth / 2);
        dialog.style.top = topposition + "px";
        dialog.style.left = leftposition + "px";
        dialogheader.className = "errorheader";
        dialogtitle.innerHTML = title;
        dialogcontent.className = 'error';
        iframe.style.height = document.body.scrollHeight + 'px';
        dialogmask.style.height = document.body.scrollHeight + 'px';
    },
	loading: function(title, messages, callback){
        var type = 'error';
        var dialog;
        var dialogheader;
        var dialogclose;
        var dialogtitle;
        var dialogcontent;
        var dialogbottom;
        var dialogmask;
        var submitBtn;
        
        var iframe;
        
        
        if (!document.getElementById('dialog')) {
            dialog = document.createElement('div');
            dialog.id = 'loading';
            //dialogheader = document.createElement('div');
            //dialogheader.id = 'loading-header';
            //dialogtitle = document.createElement('div');
            //dialogtitle.id = 'loading-title';
            //dialogclose = document.createElement('div');
            //dialogclose.id = 'loading-close'
            dialogcontent = document.createElement('div');
            dialogcontent.id = 'loading-content';
            //dialogcontent.innerHTML = messages;
            //dialogbottom = document.createElement('div');
            //dialogbottom.id = 'loading-bottom';
           
            dialogmask = document.createElement('div');
            dialogmask.id = 'loading-mask';
            iframe = document.createElement('iframe');
            iframe.id = 'i-mask';
            document.body.appendChild(iframe);
            document.body.appendChild(dialogmask);
            document.body.appendChild(dialog);
            //dialog.appendChild(dialogheader);
            //dialogheader.appendChild(dialogtitle);
            //dialogheader.appendChild(dialogclose);
            dialog.appendChild(dialogcontent);
            //dialog.appendChild(dialogbottom);
            // dialogclose.setAttribute('onclick','hideDialog()');
            //dialogclose.onclick = hideDialog;
            
        }
        else {
            dialog = document.getElementById('loading');
            //dialogheader = document.getElementById('loading-header');
            //dialogtitle = document.getElementById('loading-title');
            //dialogclose = document.getElementById('loading-close');
            dialogcontent = document.getElementById('loading-content');
            dialogmask = document.getElementById('loading-mask');
            dialogmask.style.visibility = "visible";
            dialog.style.visibility = "visible";
        }
        
        var width = pageWidth();
        var height = pageHeight();
        var left = leftPosition();
        var top = topPosition();
        var dialogwidth = dialog.offsetWidth;
        var dialogheight = dialog.offsetHeight;
        var topposition = top + (height / 3) - (dialogheight / 2);
        var leftposition = left + (width / 2) - (dialogwidth / 2);
        dialog.style.top = topposition + "px";
        dialog.style.left = leftposition + "px";
       // dialogheader.className = type + "header";
       // dialogtitle.innerHTML = title;
        
        dialogcontent.className = type;
        iframe.style.height = document.body.scrollHeight + 'px';
        dialogmask.style.height = document.body.scrollHeight + 'px';
    }
}

// calculate the current window width //
function pageWidth(){
    return window.innerWidth != null ? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
}

// calculate the current window height //
function pageHeight(){

    return window.innerHeight != null ? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null ? document.body.clientHeight : null;
}

// calculate the current window vertical offset //
function topPosition(){
    return typeof window.pageYOffset != 'undefined' ? window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;
}

// calculate the position starting at the left of the window //
function leftPosition(){
    return typeof window.pageXOffset != 'undefined' ? window.pageXOffset : document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;
}

var Margueer = function(){
    return {
        marguee: document.getElementById('marguee'),
        iLineHeight: 33,
        iLineCount: 5,
        iScrollAmount: 1,
        run: function(){
            var self = this;
            this.marguee.scrollTop += this.iScrollAmount;
            if (this.marguee.scrollTop == this.iLineCount * this.iLineHeight) {
                this.marguee.scrollTop = 0;
            }
            if (this.marguee.scrollTop % this.iLineHeight == 0) {
                setTimeout(function(){
                    self.run();
                }, 2000);
            }
            else {
                setTimeout(function(){
                    self.run();
                }, 50);
            }
        },
        start: function(){
            this.marguee.innerHTML += this.marguee.innerHTML;
            var self = this;
            setTimeout(function(){
                self.run();
            }, 2000);
        }
    };
};

// 框架自适应代码2.0   (-_-)凸 耗费老子(帅树)很长时间的破东西 
function SetCwinHeight(obj){
    var cwin = obj;
    if (document.getElementById) {
        if (cwin && !window.opera) {
            if (cwin.contentDocument && cwin.contentDocument.body.offsetHeight) 
                cwin.height = cwin.contentDocument.body.offsetHeight; //FF NS  
            else 
                if (cwin.Document && cwin.Document.body.scrollHeight) 
                    cwin.height = cwin.Document.body.scrollHeight; //IE  
        }
        else {
            if (cwin.contentWindow.document && cwin.contentWindow.document.body.scrollHeight) 
                cwin.height = cwin.contentWindow.document.body.scrollHeight; //Opera  
        }
    }
}

//计时器
var Timer = function(time,speed,startCallback,beforeCallback,processCallback,afertCallback,endCallback){
	return {
		time : time || 0,
		beginTime : time || 0,
		speed : speed || 1,
		startCallback : startCallback || function(obj){},
		beforeCallback : beforeCallback || function(obj){},
		processCallback : processCallback || function(obj){},
		afertCallback : afertCallback || function(obj){},
		endCallback : endCallback || function(obj){},
		minute : 0,
		second : 0,
		interval : null,
		run : function(){
			if(this.interval){
				if(this.time <= 0){
					endCallback(this);
					return;
				}
				
				this.beforeCallback(this);
				
				this.time = parseInt(this.time-(this.speed/1000));
	            this.minute = parseInt(this.time / 60);
	            this.second = this.time % 60;
	            this.second = this.second < 0 ? '0' : this.second;
	            if (parseInt(this.minute) < 10) {
	                this.minute = '0' + this.minute;
	            }
	            if (parseInt(this.second) < 10) {
	                this.second = '0' + this.second;
	            }
	            
	            if (parseInt(this.time) <= 0) {
						clearInterval(this.interval);
						endCallback(this);
						return;
	            }
				
	            if (this.begintime != 0) {
	                processCallback(this);
	            }
	            this.afertCallback(this);
            }
		},
		start : function(){
			this.startCallback(this);
			var self = this;
			this.interval = setInterval(function(){
				self.run();
			},self.speed);
		},
		isEnd : function(){
			return (this.time == 0);
		},
		isStarted : function(){
			return (this.time < this.beginTime);
		},
		isRunning : function(){
			return (this.time < this.beginTime) && (this.time > 0);
		}
	};
}


function unity(tab){
    
            if(document.getElementById("touzhu") && document.getElementById("zhongjiang") ) {
		    
		       var touzhutab =document.getElementById("touzhutab"); 
		       var zhongjiangtab =document.getElementById("zhongjiangtab"); 
		       var touzhu =document.getElementById("touzhu");
		       var zhongjiang =document.getElementById("zhongjiang");
		       var moo = document.getElementById("moo");  
		       var catId = document.getElementById("xxid").value ;
		      
                
                if(tab == 'touzhu'){
                       if(touzhutab && zhongjiangtab){
                            touzhutab.style.display = "";
                            zhongjiangtab.style.display = "none";
                       }
                       touzhu.className= "dkc bg08";
                       zhongjiang.className="dkc";
                       if(moo){
                            moo.href = "/tickethispage.do?catId="+catId;
                             moo.innerHTML="更多投注";
                       }
                }else if(tab == 'zhongjiang'){
                           if(touzhutab && zhongjiangtab){
                                touzhutab.style.display = "none";
                                zhongjiangtab.style.display = "";
                           }
                        touzhu.className= "dkc";
                        zhongjiang.className="dkc bg08";
                         if(moo){
                            moo.href = "/web_mybonus.do?catId="+catId;
                             moo.innerHTML="更多中奖";
                         }
                }else {
                    
                      if(touzhutab && zhongjiangtab){
                            touzhutab.style.display = "";
                            zhongjiangtab.style.display = "none";
                       }
                       
                       touzhu.style.display = "dkc bg08";
                       zhongjiang.style.display = "dkc";   
                       
                        if(moo){
                            moo.href = "/tickethispage.do";
                             moo.innerHTML="查看更多";
                        }
                }
            
		        
      }
}







