PageController = {
            CFrom: null,
            CFromParam: null,
            cad_id: null,
            cpm_id: null,
            ccm_id: null,
            cam_id: null,
            CTo: null,
            CToParam: null,
            CIp: null,
            CSessionID: null,
            CUserID: null,
            IDuration: null,
            cStart: null,
			cState: false,
			TTime:null,
            
            init: function(){
            	var UrlFrom = "";
				try {
				   UrlFrom=top.document.referrer;
				} catch(err) {
				   UrlFrom="";
				} finally {
				   UrlFrom=(UrlFrom=="")?document.referrer:UrlFrom;
				}
                var _CFrom = this.splitUrl(UrlFrom)[0];
                var _CFromParam = this.splitUrl(UrlFrom)[1];
                
                
                var UrlTo = window.location.href;
                var _CTo = this.splitUrl(UrlTo)[0];
                var _CToParam = this.splitUrl(UrlTo)[1];
                
                var Params = _CToParam.split('&');
                for (var i = 0; i < Params.length; i++) {
                    this[Params[i].split('=')[0].toLowerCase()] = Params[i].split('=')[1];
                }
                
                this.CFrom = _CFrom;
                this.CFrom = _CFrom.replace( /^\s+|\s+$/g, "" );
                this.CFrom = _CFrom.replace(/\/$/,"")
                this.CFromParam = _CFromParam;
                this.CTo = _CTo;
                this.CTo = _CTo.replace( /^\s+|\s+$/g, "" );
                this.CTo = _CTo.replace(/\/$/,"")
                this.CToParam = _CToParam;
                this.IDuration = 0;
                this.cStart = new Date();
                this.TTime = this.cStart;
                
                if(this.cad_id && this.cad_id !=""){
                	Cookies.set("USERFROM",this.cad_id);
                }
                if(this.cpm_id && this.cpm_id !=""){
                	Cookies.set("USERFROM_Pm",this.cpm_id);
                }
                if(this.ccm_id && this.ccm_id !=""){
                	Cookies.set("USERFROM_Cm",this.ccm_id);
                }
                if(this.cam_id && this.cam_id !=""){
                	Cookies.set("USERFROM_Am",this.cam_id);
                }

                /*
                alert(Cookies.get("USERFROM"));
                alert(Cookies.get("USERFROM_Pm"));
                alert(Cookies.get("USERFROM_Cm"));
                alert(Cookies.get("USERFROM_Am"));
                */
            },
            splitUrl: function(url){
                var tempArr = [];
                if (url.indexOf('?') == -1) {
                    tempArr.push(url);
                    tempArr.push('');
                }
                else {
                    tempArr.push(url.replace(/(.*)\?(.*)/, '$1'));
                    tempArr.push(url.replace(/(.*)\?(.*)/, '$2'));
                }
                return tempArr;
            },
            getDuration: function(){
                var cEnd = new Date();
                return parseInt((cEnd - this.cStart) / 1000);
            },
            postInfo: function(){
                jQuery.ajax({
					method:"POST",
                    url: '/tbNet_manager.do',
                    data: {
                        CFrom: this.CFrom,
                        CFromParam: this.CFromParam,
                        CAd_id: this.cad_id,
    					CPm_id: this.cpm_id,
                        CCm_id: this.ccm_id,
                        CAm_id: this.cam_id,
                        CTo: this.CTo,
                        CToParam: this.CToParam,
                        CIp: this.CIp,
    					CSessionID: this.CSessionID,
    					CUserID: this.CUserID,
    					IDuration: this.getDuration(),
    					TTime: this.TTIme
                    },
					success:function(){
						this.state = true;
						PageController.getInfo();
					}
                });
            },
            getInfo: function(){
                var outStr = '';
                outStr += '------------------------ Start Here ------------------------\n';
                outStr += 'IDuration: ' + this.getDuration() + '\n';
                outStr += 'CFrom: ' + this.CFrom + '\n';
                outStr += 'CFromParam: ' + this.CFromParam + '\n';
                outStr += 'CAd_id: ' + this.cad_id + '\n';
                outStr += 'CPm_id: ' + this.cpm_id + '\n';
                outStr += 'CCm_id: ' + this.ccm_id + '\n';
                outStr += 'CAm_id: ' + this.cam_id + '\n';
                outStr += 'CTo: ' + this.CTo + '\n';
                outStr += 'CToParam: ' + this.CToParam + '\n';
                outStr += 'CIp: ' + this.CIp + '\n';
                outStr += 'CSessionID: ' + this.CSessionID + '\n';
                outStr += 'CUserID: ' + this.CUserID + '\n';
                outStr += '------------------------ End Here -------------------------\n';
                alert(outStr);
            }
        }