evt_site = {

    v:{
        isIE:(navigator.userAgent.toLowerCase().search("msie") > -1),
        isFox:(navigator.userAgent.toLowerCase().search("firefox") > -1),
        isMac:(navigator.userAgent.toLowerCase().search("macintosh;") > -1),
        sSheet:0
    },

    u:{
        TO:function(oObj, sFun, oVars, iInt, bInterval){
            var to = function(){
                oObj[sFun](oVars);
            }
            if(bInterval){
                return setInterval(to, iInt);
            } else {
                return setTimeout(to, iInt);
            }
        },

        JSON:function(oObj, sFun, oVars, sURL, sCache){
                if(sCache){
                     d = sCache;
                } else {
                    var d = (new Date).getTime();
                    var d = "1000";
                }
                var j = this.JSON;
                j["JSON_"+d] = function(oRet){
                    oObj[sFun](oRet, oVars);
                    delete j["JSON_"+d];
                }
                s = document.createElement("SCRIPT");
                s.src = "testJASON_1.js"+sURL;
                document.documentElement.childNodes[0].appendChild(s);
        },
        addListener:function(o,e,f){
            for(var i =0;i<e.length;i++){
                if(this.par.v.isIE){
                    o.attachEvent("on"+e[i], f);
                } else {
                    o.addEventListener(e[i],f,0);
                }
            }
        },

        getPos:function(o, bUseParent){
                if(typeof(o) == "string") o = document.getElementById(o);
                var b = this.par.s.tn("body")[0];
                var de = this.par.s.de();
                var sl = de.scrollLeft;
                var st = de.scrollTop;
                if(document.getBoxObjectFor){
                    var r = document.getBoxObjectFor(o);
                    var rect = {l:r.x,t:r.y,r:r.width+r.x,b:r.y+r.height};
                } else{
                    if(o.getBoundingClientRect){
                        var r = o.getBoundingClientRect();
                        var rect = {l:r.left-2+sl,t:r.top-2+st,r:r.right-2+sl,b:r.bottom-2+st};
                    } else {
                        var l = o.offsetLeft;
                        var t = o.offsetTop;
                        var rect = {l:l,t:t,r:l+o.offsetWidth,b:t+o.offsetHeight};
                        var p = o.offsetParent;
                        if(bUseParent) p = o.parentNode;
                        while(p){
                            l = p.offsetLeft;
                            t = p.offsetTop;
                            if(l){
                                rect.l += l;
                                rect.r += l;
                            }
                            if(t){
                                rect.t += t;
                                rect.b += t;
                            }
                            if(bUseParent){
                                p = p.parentNode;
                            } else {
                                p = p.offsetParent;
                            }
                        }
                    }
                }
                return rect;
         },
        mPos:function(e){
                if(e.pageX || e.pageY){
                        return {x:e.pageX, y:e.pageY};
                } else {
                        if(e.clientX || e.clientY) return {x:e.clientX, y:e.clientY};
                }
                return {x:0,y:0};
        },
        pIn:function(o, e, p){
                if(e) p = this.mPos(e);
                var r = this.getPos(o);
                return (p.x > r.l && p.x < r.r && p.y > r.t && p.y < r.b);
        },
        cachSprite:function(v){
            var s = this.par.s;
            var t = s.id(v.targ);
            for(var i =0; i<v.cn.length; i++){
                var c = s.cE("div");
                c.style.position = "absolute";
                c.style.left = c.style.height = "0px";
                c.style.width = c.style.height = "1px";
                c.style.overflow = "hidden";
                c.style.visibility = "hidden";
                c.className = v.cn[i];
                t = t.appendChild(c);
            }
        },
        scale:function(oW, oH, sW, sH, bCrop){
        	
        	var dW = oW - sW
        	var dH = oH - sH
        	var cL = cT = 0
        	var p = 0;
        	
        	if(dW > dH){
        		p = sW/oW
        	} else {
        		p = sH/oH
        	}
        	
        	var w = oW*p
        	var h = oH*p
        	if(bCrop){
        		if(w < sW){
        			p = sW/oW
        		}
        		if(h < sH){
        			p = sH/oH
        		}
        		w = oW*p
        		h = oH*p
        		if(w > sW) cL = (sW-w)/2
        		if(h > sH) cT = (sH-h)/2
        	}
        	return {w:w, h:h, cL:cL, cT:cT}
        },
        
        inish:function(sName, oPar){
            this.name = sName;
            this.par = oPar;
            var l = location.toString().split(location.host);
            var p = l.shift().split(":").shift();
            l = l.pop().split("?");
            oPar.v.url = {
                p:p,
                h:location.host,
                l:l.shift().split("/"),
                q:l.pop()
            };
            
            if(oPar.v.url.l[oPar.v.url.l.length-1] == "") oPar.v.url.l.pop();
            oPar.v.url.l.shift(); 
        }
    },
    s:{
        tn:function(s){return document.getElementsByTagName(s)},
        id:function(s){return document.getElementById(s)},
        ids:function(s){
            var el = [];
            var t = this.id(s);
            if(t){
                while(t){
                    el.push(t);
                    t.id = t.id+"_"+(el.length-1);
                    t = this.id(s);
                }
            }
            return el;
        },
        de:function(e){return document.documentElement},
        cE:function(s){return document.createElement(s)},
        aC:function(o, s){return o.appendChild(this.cE(s));},
        iB:function(o,c,s){
            if(typeof(s) == "string") s = this.cE(s);
            if(!c) c = o.childNodes[0];
            return o.insertBefore(s,c);
        },
            
        fC:function(o, s, bD, bF){
            var a = [];
            for(var i=0;i<o.childNodes.length;i++){
                if(o.childNodes[i].tagName){
                    if(s && o.childNodes[i].tagName.toLowerCase() == s){
                        a.push(o.childNodes[i]);
                        if(bF) return a;
                    } else {
                        if(!s){
                            a.push(o.childNodes[i]);
                            if(bF) return a;
                        }
                    }
                    if(bD && o.childNodes[i].childNodes.length){
                        var r = this.fC(o.childNodes[i], s, bD, bF);
                        while(r.length) a.push(r.shift());
                    }
                }
            }
            return a;
        },
        cnRe:function(o,s,v){
            if(!v) v = {};
            if(!v.d) v.d = "_";
            var cn = o.className.split(v.d);
            cn[cn.length-1] = s;
            if(v.r) return cn.join(v.d);
            o.className = cn.join(v.d);
        },
        mR:function(sClass, oObj){
            var r = {t:this.cE("div"),b:this.cE("div")};
            var ary = {t:["spritesA corner tl", "mid t", "spritesA corner tr"],b:["spritesA corner bl", "mid b", "spritesA corner br"]};
            for(var e in r){
                r[e].className = sClass+" "+sClass+"_"+e;
                for(var i in ary[e]){
                    var d = this.aC(r[e], "div");
                    d.className = ary[e][i];
                }
                if(oObj) r[e] = oObj.appendChild(r[e]);
            }
            return r;
        },
        cEvt:function(e){
            var cE = {};
            for(var ee in e) cE[ee] = e[ee];
            return cE;
        },
        cTable:function(){
            var t = this.cE("TABLE");
            t.cellPadding = t.cellSpacing = t.border = 0;
            var tb = this.aC(t, "tbody");
            return {t:t, tb:tb};
        },
        cSelect:function(oAry){
        	if(!oAry) return false;
        	var ary = [];
        	for(var i=0;i<oAry.length;i++){
        		ary[i] = "<option value='"+oAry[i].value+"'>"+oAry[i].text+"</option>"
        	}
        	return ary.join("\n");
        }
    },
    page:{},
    fun:{
        event:function(f, o, p){
            var f = f;
            var o = o;
            var p = p;
            this.run = function(e){
                if(!e) e = event;
                f.event(e, o, f, p);
            }
        }

    },
    inish:function(sName, oPar, oSite){
        this.name = sName;
        this.par = oPar;
        if(!oSite){
            oSite = this;
        } else {
            this.site = oSite;
        }
        if(this.u) this.u.inish("u", this);
        if(this.page){
         for(var e in this.page){
            this[e] = this.page[e];
            if(this[e].inish) this[e].inish(e, this, oSite);
         }
      }
    }
}

evt_site.page.gMaps = {
	getGeo:function(sAd, oObj){
		this.geocoder = new google.maps.Geocoder();
		if(this.geocoder){
			this.geocoder.geocode( { 'address': sAd }, function(results, status) {
			  			if (status == google.maps.GeocoderStatus.OK) {
			  				alert('ok')
			  				oObj.recGeo(results[0].geometry.location);
			  			} else {
							alert('bad')
							oObj.recGeo(-1);
			  			}
  			});
		}
	},
	dispGeo:function(sId, latlng, sName){
		var myOptions = {
				zoom: 15,
				center: latlng,
				mapTypeId: google.maps.MapTypeId.ROADMAP
			 };
			 var map = new google.maps.Map(document.getElementById(sId), myOptions);

			  var marker = new google.maps.Marker({
					position: latlng,
					map: map,
					title:sName
		});
	},
	getLatLong:function(oObj){
		return new google.maps.LatLng(oObj.b, oObj.c);
	},
	inish:evt_site.inish
}


evt_site.page.ooOne = {
    v:{
        g:{},
        TO:{}
    },
    fun:{
        make:function(n, o, et, t){
            this.name = n;
            this.id = 0;
            this.o = o;
            this.TO = 0;
            this.cb = [];
            this.par = t;
            for(var i=0;i<o.length;i++){
                var n = new t.par.fun.event(this, o[i]);
                t.par.u.addListener(o[i], et, n.run);
            }
            this.event = function(e, o, t){
                this.par.event(this, e, o, t.par);
            }
            this.addCB = function(cb){
                this.cb.push(cb);
            }
        }
    },
    build:function(sID, oObjs, et){
        var o = oObjs;
        if(!o) o = this.par.s.ids(sID);
        if(!et) et = ["mouseover", "mouseout"];
        this.v.g[sID] = new this.fun.make(sID, o, et, this);
        return o;
    },
    addCB:function(sID, cb){
        this.v.g[sID].addCB(cb);
    },
    doCB:function(e, o, cb, rt){
        for(var i =0;i<cb.length;i++){
            cb[i].t[cb[i].f](e,o,cb[i].t,rt);
        }
    },
    event:function(og, e, o, t){
        clearTimeout(og.TO);
        if(e.type == "mouseout"){
            if(og.id) og.TO = this.par.u.TO(this.mouse, "out", {e:this.site.s.cEvt(e),o:og.o,t:t,sg:og.name,g:og}, 5, 0);
        } else {
            if(og.id){
                if(og.id== o.id) return;
                this.mouse.out({e:e,o:og.o,t:t,sg:og.name,g:og});
            }
            og.id = o.id;
            og.o = o;
            this.mouse.over(e,o,t,og);
        }
    },
    mouse:{
        over:function(e,o,t,g){
            if(g.cb) t.doCB(e,o,g.cb, e.type);
            t.par.s.cnRe(o, e.type);
        },
        out:function(v){
            if(v.g.cb) v.t.doCB(v.e, v.o, v.g.cb, "mouseout");
            v.g.id = v.t.v.g[v.sg].id = 0;
            v.t.par.s.cnRe(v.o, "mouseout");
        }
    },
    inish:evt_site.inish
}

evt_site.page.nav = {

	v:{
		curOn:0
	},
	fun:{
		make:function(oObj, oPar, oSite){
			this.c = oSite.s.fC(oObj, "div")[1];
			this.p = oPar;
			var n = new t.par.fun.event(this, oObj);
         t.par.u.addListener(oObj, ["mouseover", "mouseout"], n.run);
         
		}
	},
	build:function(sId){
		var o = [
			this.site.s.id("navHead_cur"),
			this.site.s.id("navHead_blog"),
			this.site.s.id("navHead_show")
		]
		this.site.ooOne.build("navHead", o);
		
	
	},
	
	inish:evt_site.inish
}

evt_site.page.prevNex = {
	v:{
		current:{
			max:0,
			disp:0,
			cur:0,
			oHTML:0,
			active:0,
			start:0,
			nHTML:{}
		},
		blog:{
			max:0,
			disp:0,
			cur:0,
			oHTML:0,
			active:0,
			start:0,
			nHTML:{}
		},
		show:{
			max:0,
			disp:0,
			cur:0,
			oHTML:0,
			active:0,
			start:0,
			nHTML:{}
		},
		action:'action_prevNext'
	},
	u:{
		inish:function(sName, oPar){
			oPar.fixedHeight = 0
		}
	},
	decorate:function(targ, t){
		if(t.cur == t.max){
				targ[1].className = "disabled"
			} else {
				targ[1].className = ""
			}
			if(t.cur == t.start) {
				targ[0].className = "disabled"
			} else {
				targ[0].className = ""
		}
	},
	go:function(s, dir, oObj){
		var targ = oObj.parentNode 
		if(targ.className == "disabled") return false
		var t = this.v[s]
		if(t.active) return false
		if(!this.fixedHeight){
			 
			var snip = this.site.s.id("evt_storySnipits")
			this.fixedHeight = 1
			snip.style.minHeight = snip.offsetHeight+"px"
		}
		if(!t.disp){
			var d = this.site.s.id(s+"_replace");
			t.disp = this.site.s.fC(d, "div").length
			t.oHTML = d.innerHTML
		}
		
		var data = {
			action:this.v.action,
			base:s,
			start:0,
			stop:0
		}
		
		if(dir > 0){
			var e = t.cur+t.disp
			if(e > t.max){
				e = t.max
			}
			data.start = t.cur
			data.stop = e
		} else {
			var e = t.cur-t.disp
			if(e <= this.v[s].start){
				e = this.v[s].start
				this.site.s.id(s+"_replace").innerHTML = t.oHTML
				t.cur = e
				this.decorate(this.site.s.fC(targ.parentNode, "span"), t)
				return;
			} else {
				data.start = e
				data.stop = t.cur
			}
		}
		
		t.cur = e
		
		this.decorate(this.site.s.fC(targ.parentNode, "span"), t)
		
		if(this.v[s].nHTML["_"+data.start] == undefined){
		
			
		
		
		
		
			var n = this;
			t.active = 1
			jQuery.post("/dshow/wp-admin/admin-ajax.php", data, function(response) {		
					n.display(s, response, data.start)
				});
		} else {
			this.site.s.id(s+"_replace").innerHTML = this.v[s].nHTML["_"+data.start]
		}
		return false
	},
	display:function(s, HTML, iStart){
		this.v[s].nHTML["_"+iStart] = HTML
		this.site.s.id(s+"_replace").innerHTML = HTML
		this.v[s].active = 0
	},
	inish:evt_site.inish
}
	
