

function Zuguide(){
    this.location = document.location.hash;
    
    this.ec = null;
    this.cO = 1;
    this.hg = false;
    this.fM = true;
    this.kv = null;
    this.kN = new Array();
    this.la = new eE(2);
    this.lO = false;
    
    }


var zuguide = new Zuguide();

var aa = null;
var aW = null;
var aR = null;
var cs = null;



function dB(cZ){
    var i;
    var cb = cZ.length;
    
    for (i = 0; i < cb; i++) {
        var code = cZ.charCodeAt(i);
        switch (code) {
            case 32:
            case 10:
                cZ = cZ.substring(1, cZ.length);
                i--;
                cb--;
                break;
            default:
                return cZ;
        }
    }
    return cZ;
}

if (!Array.indexOf) {
    Array.prototype.indexOf = function(jr){
        for (var i = 0; i < this.length; i++) {
            if (this[i] == jr) {
                return i;
            }
        }
        return -1;
    }
}

function dA(nj) {
	if (document.onkeydown == "") {
		    document.onkeydown = ah;
	}
	return document.getElementById(nj);
}

function iw(){
    var jH = kJ;
    var jX = dA("historyFrame");
    if (!jX) {
        jX = ih("historyFrame");
        jX.src = "historyframe.htm";
    }
    var doc = jX.contentWindow.document;
    if (!doc) {
        alert("null doc");
    }
    doc.open("javascript:'<html></html>'");
    var cZ = "<html><head><scri" +
    "pt type=\"text/javascript\">parent.onFrameLoaded('" +
    (jH) +
    "');</scri" +
    "pt></head><body></body></html>";
    doc.write(cZ);
    doc.close();
}

function onFrameLoaded(hash){
    if (hk()) {
        if (location.hash != hash) {
            en(hash);
        }
    }
}

function ChangeCurrentIELocation(gp){
    eh(gp, true);
    var search = hc(gp);
    if (search == "logo") {
        }
    else 
        if (search) {
            aU = search;
            V();
        }
}

function en(gp){
    var search = hc(gp);
    if (search == "logo") {
        }
    else 
        if (search) {
            aU = search;
            V();
        }
}

function gD(){
    if (zuguide.location != document.location.hash) {
        en(document.location.hash);
        }
}

function SetLocationTimer(){
    if (!zuguide.ec) {
        if (!hk()) {
            zuguide.ec = setInterval(gD, 300);
        }
        else {
            zuguide.ec = true;
        }
    }
}

var kJ = null;

function eh(gp, justset){
    SetLocationTimer();
    if (gp != zuguide.location) {
        document.location.hash = gp;
        zuguide.location = gp;
        if (hk() && justset == undefined) {
            var xxx = new Array;
            xxx.push(gp);
            kJ = gp;
            setTimeout(iw, 1000);
            }
    }
}

function gY(){
    if (aS) {
        if (aS.query.as("data/entlist.php?srch=")) {
            var mX = escape(aS.mX);
            eh("#search-" + mX);
        }
        else {
            eh("#" + aS.mX);
        }
    }
}

function gL(){
    if (aT) {
        eh("#" + aT.url);
    }
}

function log(message){
    return;
    if (!log.gw || log.gw.closed) {
        var jF = window.open("nothing.htm", "debug", "width=400,height=200," +
        "scrollbars=yes,resizable=yes,status=no," +
        "location=no,menubar=no,toolbar=no");
        if (!jF) 
            return;
        var doc = jF.document;
        doc.write("<html><head><title>Debug Log</title></head>" +
        "<body></body></html>");
        doc.close();
        log.gw = jF;
    }
    var iE = log.gw.document.createElement("div");
    iE.appendChild(log.gw.document.createTextNode(message));
    log.gw.document.body.appendChild(iE);
}

function fF(){


}

fF.prototype.log = function(xxx){
    }

var dR = new fF();

function cv(){
    this.ei = null;
    this.fS = null;
}


cv.prototype.iD = function(node, ba){
    ba.prev = node;
    ba.next = node.next;
    
    if (node.next == null) {
        this.fS = ba;
    }
    else {
        node.next.prev = ba;
    }
    node.next = ba;
}

cv.prototype.insertBefore = function(node, ba){
    ba.prev = node.prev;
    ba.next = node;
    
    if (node.prev == null) {
        this.ei = ba;
    }
    else {
        node.prev.next = ba;
    }
    node.prev = ba;
}

cv.prototype.hl = function(ba){
    if (this.ei == null) {
        this.ei = ba;
        this.fS = ba;
        ba.prev = null;
        ba.next = null;
    }
    else {
        this.insertBefore(this.ei, ba)
    }
}

cv.prototype.hH = function(ba){
    if (this.fS == null) {
        this.hl(ba);
    }
    else {
        this.iD(this.fS, ba);
    }
}

cv.prototype.remove = function(node, jm){
    if (node.prev == null) {
        this.ei = node.next;
    }
    else {
        node.prev.next = node.next;
    }
    
    if (node.next == null) {
        this.fS = node.prev;
    }
    else {
        node.next.prev = node.prev;
    }
    if (jm) {
        delete node;
    }
    else {
        node.prev = null;
        node.next = null;
    }
}

cv.prototype.aj = function(node){
    this.remove(node);
    this.hH(node);
}

cv.prototype.jJ = function(node){
    var first = this.ei;
    if (first) {
        this.remove(first);
        return first;
    }
}


var eO = false;
var eL = false;
var eP = false;
var cQ = "";
var aK = "a";

function hh(cZ){
    var o = hh.options, m = o.hU[o.iO ? "strict" : "loose"].exec(cZ), bB = {}, i = 14;
    
    while (i--) 
        bB[o.jO[i]] = m[i] || "";
    
    bB[o.q.name] = {};
    bB[o.jO[12]].replace(o.q.hU, function(lX, $1, $2){
        if ($1) 
            bB[o.q.name][$1] = $2;
    });
    
    return bB;
};

hh.options = {
    iO: true,
    jO: ["source", "protocol", "authority", "userInfo", "user", "password", "host", "port", "relative", "path", "directory", "file", "query", "anchor"],
    q: {
        name: "queryKey",
        hU: /(?:^|&)([^&=]*)=?([^&]*)/g
    },
    hU: {
        strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
        loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
    }
};


function iW(name, value, iH, path){
    if (typeof(iH) != 'undefined') {
        var dO = new Date();
        dO.setTime(dO.getTime() + (iH * 1000));
        var expires = "; expires=" + dO.toGMTString();
    }
    else {
        expires = "";
    }
    if (path == undefined) 
        path = "";
    var cU = name + "=" + escape(value) + expires + "; path=/" + path;
    document.cookie = cU;
}

function jd(name){
    name = name + "=";
    var jb = document.cookie.split(';');
    for (var i = 0; i < jb.length; i++) {
        var c = jb[i];
        while (c.charAt(0) == ' ') {
            c = c.substring(1, c.length);
        }
        if (c.indexOf(name) === 0) {
            return c.substring(name.length, c.length);
        }
    }
    return null;
}

function cI(s){
    return (s.toString().search(/^[0-9]+$/) == 0);
}


function dk(prefix){
    var jb = document.cookie.split(';');
    var max = 0;
    for (var i = 0; i < jb.length; i++) {
        var c = jb[i];
        while (c.charAt(0) == ' ') {
            c = c.substring(1, c.length);
        }
        if (c.as(prefix)) {
            c = c.substring(prefix.length, c.indexOf('=') - 1);
            if (cI(c)) {
                var cp = parseInt(c);
                if (cp > max) 
                    max = cp;
            }
        }
    }
    return max;
}




function it(name){
    iW(name, "", -1);
}

function me(mf){
    var md = dA(mf);
    if (md) {
        var jU = md.value;
        if (jU.length > 3) {
            searchclick(jU);
            md.blur();
            }
    }
    return false;
}

function submitsearch(){
    return me("searchtext");
}


function submitsearch1(){
    return me("searchtext1");
}

function searchchange(id){
    var fI;
    if (id == "searchtext") {
        fI = "searchtext1";
    }
    else 
        if (id == "searchtext1") {
            fI = "searchtext";
        }
        else {
            return;
        }
    eW(id, fI);
}

function eW(gh, fI){
    var fQ = dA(gh);
    var fR = dA(fI);
    if (fQ != null && fR != null) {
        fR.value = fQ.value;
    }
}




function jT(bB){
    bB.dir = location.href.substring(0, location.href.lastIndexOf('\/'));
    bB.ic = bB.dir;
    if (bB.ic.substr(0, 7) == 'http:\/\/') 
        bB.ic = bB.ic.substr(7);
    bB.path = '';
    var pos = bB.ic.indexOf('\/');
    if (pos > -1) {
        bB.path = bB.ic.substr(pos + 1);
        bB.ic = bB.ic.substr(0, pos);
    }
    bB.page = location.href.substring(bB.dir.length + 1, location.href.length + 1);
    pos = bB.page.indexOf('?');
    if (pos > -1) {
        bB.page = bB.page.substring(0, pos);
    }
    pos = bB.page.indexOf('#');
    if (pos > -1) {
        bB.page = bB.page.substring(0, pos);
    }
    bB.jB = '';
    pos = bB.page.indexOf('.');
    if (pos > -1) {
        bB.jB = bB.page.substring(pos + 1);
        bB.page = bB.page.substr(0, pos);
    }
    bB.file = bB.page;
    if (bB.jB != '') 
        bB.file += '.' + bB.jB;
    if (bB.file == '') 
        bB.page = 'index';
    bB.jV = location.search.substr(1).split("?");
    return bB;
}

function gW(id){
    this.select();
    }

function searchfocus(id){
    var bq = dA(id);
    if (bq != null) {
        if (bq.value == 'search zuguide') {
            bq.value = "";
        }
        else 
            bq.select();
    }
}

function fm(bq){
    bq.style.visibility = "";
    bq.style.width = "";
    bq.style.height = "";
    bq.style.left = "";
    bq.style.top = "";
    bq.style.position = "";
    bq.style.overflow = "";
}


function ae(bq, by, bw, bx, bA, visible){
    if (visible == undefined) 
        visible = true;
    if (!visible) {
        bq.style.visibility = "hidden";
    }
    bq.style.width = by + "px";
    if (bw != 0) {
        bq.style.height = bw + "px";
    }
    bq.style.left = bx + "px";
    bq.style.top = bA + "px";
    bq.style.position = "absolute";
    bq.style.overflow = "hidden";
}

function moveposition(id, bx, bA){
    debugger;
    var bq = dA(id);
    bq.style.left = bx + "px";
    bq.style.top = bA + "px";
    bq.style.position = "absolute";
}

String.prototype.db = function(cZ){
    var index = this.indexOf(cZ);
    if (index == -1) 
        index = this.length;
    return this.substring(0, index);
}

String.prototype.as = function(prefix){
    var index = this.indexOf(prefix);
    return (index == 0);
}

String.prototype.iT = function(text){
    var length = text.length;
    if (length == 0) 
        return "";
    var pos = this.indexOf(text);
    if (pos == -1) 
        return "";
    if (pos + length >= this.length) 
        return "";
    var jZ = this.substring(pos + length);
    return jZ;
}

String.prototype.nh = function(mu) {
	var my = new Array();
	var index = 0;
	var cZ = this;
	while (1) {
		cZ = cZ.iT(mu);
		if (cZ == "") return my;
		my[index++] = cZ.db(mu);
		cZ = cZ.iT(mu);
	}
}





String.prototype.gX = function(ht){
    if (ht == undefined) 
        ht = 0;
    if (ht >= this.length) 
        return false;
    var ji = "0123456789";
    return ji.indexOf(this.charAt(ht)) != -1;
}

Array.prototype.O = function(dD){
    for (var i = 0, l = this.length; i < l; i++) {
        if (this[i] == dD) {
            return true;
        }
    }
    return false;
}


function getTime(){
    var x = new Date();
    return x.getTime();
}


String.prototype.bV = function(cY){
    var cT = this.length - cY.length;
    if (cT < 0) {
        return false;
    }
    return (this.lastIndexOf(cY, cT) == cT);
};

function I(){
}

I.bc = [function(){
    return new XMLHttpRequest();
}, function(){
    return new ActiveXObject("Msxml2.XMLHTTP");
}, function(){
    return new ActiveXObject("Microsoft.XMLHTTP");
}
];

I.aZ = null;

I.cj = function(){
    if (I.aZ != null) 
        return I.aZ();
    
    for (var i = 0; i < I.bc.length; i++) {
        try {
            var bL = I.bc[i];
            var cH = bL();
            if (cH != null) {
                I.aZ = bL;
                return cH;
            }
        } 
        catch (e) {
            continue;
        }
    }
    I.aZ = function(){
        throw new Error("XMLHttpRequest not supported");
    };
    I.aZ(); 
};


function G(query){
    this.previous = null;
    this.next = null;
    this.cc = 0;
    this.entities = new Array();
    this.query = query;
    this.bT = 0;
    this.di = 0;
    this.mX = iq(this.query);
    this.source = null;
    this.title = "";
    this.ee = "";
    this.linklist = null;
}

G.prototype.bS = function(mX){
    return mX == this.mX;
}

G.prototype.dZ = function(){
    return this.id;
}

G.prototype.kK = function(){
    return this.mX;
}

G.prototype.dp = function(){
    return this.entities.length;
}

G.prototype.dS = function(){
    this.cc = Math.min(12, this.dp() - this.di);
    
}

G.prototype.fN = function(i, fC){
    if (fC) {
        i += this.di;
    }
    if (i < 0 || i >= this.dp()) 
        return null;
    var cJ = this.entities[i];
    var src = J() + cJ.id + "/" + cJ.id + '.' + cJ.firstimage + ".219.138" + ".jpg";
    return src;
}

G.prototype.eR = function(gg){
    var result = this.di + gg;
    if (result >= 0 && result < this.dp()) {
        this.di = result;
    }
    this.dS();
}

G.prototype.nc = function(){
    var mz = dA("thumbnail_highlight");
	if (this.bT >= this.cc) {
		this.bT = this.cc - 1;
	}
    mz.style.left = "" + (42 + (this.bT % 4) * 238) + "px";
    mz.style.top = "" + (86 + Math.floor(this.bT / 4) * 183) + "px";
}

function mQ(x, y){
    return Math.floor(x / y);
}

G.prototype.nd = function(mN, direction){
var mk = this.bT + mN;
d("thumbnail_highlight");
	
    if (mk >= 0 && mk < this.cc) {
        this.bT = mk;
        this.nc();
		mA(this.bT);
    }
    else 
        if (mk < 0) {
            ml(cD.mW.none);
        }
        else 
            if (mk >= this.cc && direction == cD.mW.mZ) {
                mj(cD.mW.none);
            }
}

G.prototype.nf = function(){
	if (zuguide.lO == "Searchlist") {
		mg();
		zuguide.lO = "Selectedtype";
		mD(this.bT);
		lP("back");
	}
	else if (mi("prevpage")) {
		az();
	}
	else if (mi("nextpage")) {
		aB();
	}
}



G.prototype.cR = "Searchlist";


G.prototype.cz = function(xml){
    if (this.query.as("favlist.php?action")) {
        var eY = cG.getItem("favlist.php?");
        if (eY) {
            eY.cz(xml);
        }
    }
    else {
    
        var title = "";
        var ge = xml.getElementsByTagName("titleinfo");
        if (ge && ge.length) {
            ge = ge[0];
            title = ge.getAttribute("title");
            this.title = title;
        }
        var entities = xml.getElementsByTagName("entity");
        this.entities = new Array(entities.length);
        for (var i = 0; i < entities.length; i++) {
            this.entities[i] = new summary(entities[i]);
        }
        this.dS();
        if (eJ(this)) {
            j();
        }
    }
}

function eJ(search){
    if (aU == null || search == null || aU.query != search.query) {
        return false;
    }
    else {
        return true;
    }
}

G.prototype.bN = function(index){
    var dx = 0 + this.di;
    dx = dx + index;
    if (dx < this.entities.length) {
        return this.entities[dx];
    }
    return null;
}

function jp(){
    this.query = "getuserdata.php";
    this.hm = "";
    this.hI = "";
    this.hL = "";
    this.eb = "";
    this.eQ = "";
    I.bP(this.query, hp);
}

function aN(){
    I.bP("checkid/checkid.php", an);
}

function an(xml){

}

function hp(xml){
    var entities = xml.getElementsByTagName("entity");
    if (entities.length == 0) {
        return;
    }
    var aJ = entities[0];
    var eQ = C(aJ, "userid");
    if (aP) {
        aP.eQ = eQ;
        aP.hm = C(aJ, "firstname");
        aP.hI = C(aJ, "lastname");
        aP.hL = C(aJ, "email");
        aP.eb = C(aJ, "username");
        changeFavorites(eQ);
    }
}

function changeFavorites(eQ){
    var ca = cG.getItem("favlist.php?", true); 
    if (isVisibleElem("favoritetext")) {
        fh();
        ak("myfavorites");
    }
    
}

function kp(domain, link, linkname){
    this.domain = domain;
    this.link = link;
    this.linkname = linkname;
}

kp.prototype.kt = function(){
    if (hN) {
        for (var i = 0; i < hN.length; i++) {
            var link = hN[i];
            if (this.domain == link.domain) {
                return link.link;
            }
        }
    }
    return "blanklinkbutton";
}

kp.prototype.kq = function(){
    if (this.linkname) 
        return this.linkname;
    if (hN) {
        for (var i = 0; i < hN.length; i++) {
            var link = hN[i];
            if (this.domain == link.domain) {
                if (link.linkname) 
                    return link.linkname;
            }
        }
    }
    var linkname = this.domain;
    if (linkname.as("www.")) 
        linkname = linkname.substring(4);
    return linkname;
}


function kn(query){
    this.list = new Array();
    this.id = query.iT("data/linklist.php?indexed=");
}

var hN = new Array();

kn.prototype.cz = function(xml){
    var kd = xml.getElementsByTagName("linkentity");
    this.list = new Array(kd.length);
    for (var i = 0; i < kd.length; i++) {
        var xml = kd[i];
        var domain = xml.getAttribute("domain");
        var link = xml.getAttribute("link");
        var linkname = xml.getAttribute("linkname");
        this.list[i] = new kp(domain, link, linkname);
    }
    if (this.id) {
        if (this.id == 0) {
            hN = this.list;
            gk();
            
        }
        else {
            var cN = cG.bX(F(this.id));
            if (cN) {
                if (eJ(cN)) {
                    gk();
                }
            }
        }
    }
}

function Selected(query, xml){
    this.previous = null;
    this.next = null;
    this.query = query;
    this.type = null;
    this.id = null;
    this.aV = 0;
    this.title = "";
    this.url = "";
    this.ha = "";
    this.bl = 0;
    this.description = null;
    this.cw = "";
    this.dU = "";
    this.dX = "";
    this.back = null;
    this.ck = 0;
}

Selected.prototype.dZ = function(){
    return this.id;
}

Selected.prototype.kK = function(){
    return this.url;
}


Selected.prototype.bS = function(id){
    return id == this.url;
}

Selected.prototype.cR = "Selectedtype";

Selected.prototype.gJ = function(aJ){
    this.description = av(aJ, "description");
    this.cw = C(aJ, "previewvideo");
    this.ha = C(aJ, "banner");
    this.ck = aJ.getAttribute("nimages");
    this.url = aJ.getAttribute("url");
    this.dU = C(aJ, "amazonid");
    this.dX = C(aJ, "bnid");
    this.id = aJ.getAttribute("id");
    if (this.title == "") {
        this.title = C(aJ, "displayTitle");
    }
}

function ao(){
    this.length = 0;
    this.bE = new Array();
}

ao.prototype.removeItem = function(bz){
    var dv;
    if (this.bE[bz] != 'undefined') {
        this.length--;
        var dv = this.bE[bz];
        delete this.bE[bz];
    }
    return dv;
}

ao.prototype.fB = function(bz, fX){
    var value = this.removeItem(bz);
    return this.dc(fX, value);
}



ao.prototype.getItem = function(bz){
    var item = this.bE[bz];
    if (item == 'undefined') 
        return false;
    return item;
}

ao.prototype.dc = function(bz, bH){
    if (typeof(bH) != 'undefined') {
        if (typeof(this.bE[bz]) == 'undefined') {
            this.length++;
        }
        
        this.bE[bz] = bH;
    }
    
    return bH;
}

ao.prototype.bX = function(bz){
    return typeof(this.bE[bz]) != 'undefined';
}

ao.prototype.gf = function(){
    return this.bE;
}

ao.prototype.fT = function(){
    return this.bE.length;
}

function ii(cZ){
    this.cZ = cZ;
}

function co(fk){
    this.fk = fk;
    this.list = new cv();
    ao.call(this);
}

co.prototype = new ao();

co.prototype.bX = function(cZ){
    var node = this.getItem(cZ);
    if (node) {
        this.list.aj(node);
        return true;
    }
    return false;
}


co.prototype.iJ = function(cZ){
    var node = this.bX(cZ);
    if (!node) {
        if (this.fT >= this.fk) {
            this.iv();
        }
        var node = new ii(cZ);
        this.dc(cZ, node);
        this.list.hH(node);
    }
}

co.prototype.iv = function(){
    var first = this.list.first;
    if (first) {
        this.removeItem(first.cZ);
        this.list.remove(first, true);
    }
}


function eE(fk){
    this.fk = fk;
    ao.call(this);
}

eE.prototype = new ao();


eE.prototype.first = function(){
    var fr = null;
    var value = getTime() + 10000;
    for (var fl in this.bE) { 
        var image = this.bE[fl];
        if (image) {
            if (image.img) {
                if (image.img.complete) {
                    return image;
                }
            }
            else {
                var jl = 3;
            }
            if (image.time < value) {
                fr = image;
                value = image.time;
            }
        }
        else {
            var xxx = 3;
        }
    }
    if (fr) {
        return fr;
    }
    else {
        return null;
    }
};

eE.prototype.add = function(src){
    if (this.getItem(src)) {
        dR.log("found " + src + " in cache");
        return true;
    }
    if (this.length < this.fk) {
        var fy = new fc(src);
        this.dc(src, fy);
        dR.log("added " + src + " to cache", src);
        return true;
    }
    else {
        var first = this.first();
        if (!first || first.img == null) 
            return false;
        var jq = getTime();
        var complete = first.img.complete;
        var jP = jq - first.time;
        dR.log(" Time Diff: " + jP + " Complete: " + complete);
        if (complete || first.time + 500000 < jq) {
            var bB = hh(first.img.src);
            var path = bB.relative.substring(1);
            if (complete) {
                cg.iJ(path);
            }
            delete first.img;
            this.removeItem(path);
            if (path != src) {
                var fy = new fc(src);
                this.dc(src, fy);
            }
            return true;
        }
        else {
            dR.log("no room in cache");
            return false;
        }
    }
};

var eC = new eE(4);

function fc(src){
    this.img = new Image();
    this.time = getTime();
    if (src != undefined) {
        this.img.src = src;
    }
}

function QueryCache(){
    this.hash = new ao();
    this.current = null;
}

QueryCache.prototype.df = function(cL){
    this.current = cL;
};

QueryCache.prototype.add = function(cL){
    this.hash.dc(cL.query, cL);
};


QueryCache.prototype.lA = function(query, bv){
    if (query.as("data/entities")) {
        return new Selected(query);
    }
    else 
        if (query.as("data/linklist")) {
            return new kn(query);
        }
        else {
            return new G(query);
        }
}

QueryCache.prototype.hM = function(query, bd){
    if (bd.length == 0) 
        return;
    if (bd.length == 1) {
        return this.getItem(bd[0]);
    }
    for (var i = 0; i < bd.length; i++) {
        var fE = bd[i];
        var value = this.lA(fE);
        var bb = new g(this, fE, value, true);
    }
    var de = new g(this, query, null);
    de.bd = bd;
}

QueryCache.prototype.gN = function(query){
    var bb = this.hash.getItem(query);
    return bb;
}

QueryCache.prototype.bX = function(query){
    var bb = this.hash.getItem(query);
    if (bb == null) {
        return false;
    }
    return bb.value;
}

QueryCache.prototype.getItem = function(query, bv){
    var bb = this.hash.getItem(query);
    if (bv == undefined) {
        bv = false;
    }
    else 
        if (bv == 'getval') {
            if (bb) 
                return bb.value;
            else 
                return bb;
        }
    if (bb != null && !bv) {
        return bb.value;
    }
    if (bb != null) {
        bb.jh();
    }
    else {
        var value = this.lA(query);
        bb = new g(this, query, value);
    }
    return bb.value;
}


QueryCache.prototype.dc = function(query, value){
    var bb = this.hash.getItem(query);
    bb.value = value;
    return value;
}


QueryCache.prototype.bD = function(summary){
    var selected = null;
    var cZ = location + "";
    if (cZ.as("http://127.0.0.1:800")) {
        selected = cG.getItem("entitiesimdb_tt0048280.xml");
    }
    else {
        var id = summary.url;
        if (!summary.url) {
            id = summary.id;
        }
        selected = cG.getItem("data/entities.php?id=" + id);
    }
    if (selected.id == null) {
        selected.id = summary.id;
        selected.title = summary.title;
        selected.type = summary.type;
        selected.aV = summary.firstimage;
        selected.url = summary.url;
    }
    return selected;
}


function test(dz){
    var state = dz;
    state = dz;
    
}

function aO(){

}

aO.prototype.init = function(){
    aO.prototype.cG = new QueryCache();
}

function gc(cH){
    if (cH.readyState != 4) {
        return 13031;
    }
    try {
        var bC = cH.status;
        if (bC == undefined || bC == 0) {
            return 13032;
        }
        return bC;
    } 
    catch (e) {
        return 13030;
    }
}


g.prototype.bP = function(url, random){
    var cH = I.cj();
    var de = this;
    cH.onreadystatechange = function(){
        var bC = gc(cH);
        if (bC == 200) {
            de.cz(cH.responseXML);
        }
    }
    if (random == undefined) 
        random = false;
    if (random) {
        var dO = new Date();
        url += "&" + dO.toString();
    }
    cH.open("GET", url, true);
    cH.send(null);
}

function fs(url, random){
    var cH = I.cj();
    if (random == undefined) 
        random = false;
    if (random) {
        var dO = new Date();
        url += "&" + dO.toString();
    }
    cH.open("GET", url, false);
    cH.send(null);
}


function ep(url){
    var cH = I.cj();
    var dO = new Date();
    url += "&" + dO.getTime();
    cH.open("GET", url, true);
    cH.send(null);
}

function gu(jM, ee){
    var text = dA(jM);
    if (text) {
        if (!jI(text.value)) {
            return ee;
        }
    }
    return "";
}

function jI(cZ){
    if (!cZ) 
        return false;
    var mb = "@";
    var iF = ".";
    var iL = cZ.indexOf(mb);
    var jE = cZ.length;
    if (cZ.indexOf(mb) == -1) 
        return false;
    if (cZ.indexOf(mb) == -1 || cZ.indexOf(mb) == 0 || cZ.indexOf(mb) == jE) 
        return false;
    if (cZ.indexOf(iF) == -1 || cZ.indexOf(iF) == 0 || cZ.indexOf(iF) == jE) 
        return false;
    if (cZ.indexOf(mb, (iL + 1)) != -1) 
        return false;
    if (cZ.substring(iL - 1, iL) == iF || cZ.substring(iL + 1, iL + 2) == iF) 
        return false;
    if (cZ.indexOf(iF, (iL + 2)) == -1) 
        return false;
    if (cZ.indexOf(" ") != -1) 
        return false;
    return true;
}

I.hB = function(url, bh, jc){
    var cH = I.cj();
    cH.onreadystatechange = function(){
        var bC = gc(cH);
        if (bC == 200) {
            bh(cH.responseText);
        }
    }
    cH.open("POST", url);
    cH.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    var data = null;
    if (jc != undefined) {
        var jx = dA(jc);
        data = gE(jx);
    }
    cH.send(data);
}

I.get = function(url, bh){
    var cH = I.cj();
    cH.onreadystatechange = function(){
        var bC = gc(cH);
        if (bC == 200) {
            bh(cH.responseText, url);
        }
    }
    try {
        cH.open("GET", url);
    } 
    catch (ex) {
        alert(ex);
    }
    try {
        cH.send(null);
    } 
    catch (ex) {
        var xx = 3;
        alert(ex);
    }
    var xx = 3;
}

function hw(){
    var js = dA("logindiv");
    var iZ = js.className;
    if (iZ == "visible") 
        return true;
    return false;
}


function jz(){
    try {
        var jl = 4;
        
    } 
    catch (e) {
        var mR = 7;
    }
    
    
    var js = dA("logindiv");
    if (hw()) {
        }
}

function jo(cZ, jS){
    if (cZ.substring(cZ.length - 1) == jS) {
        return cZ.substring(0, cZ.length - 1);
    }
    else {
        return cZ;
    }
}


function hu(bu){
    if (bu.as("not logged in")) {
        hY();
    }
    else 
        if (bu.as("1234fbcancel")) {
            window.scrollTo(0, 0);
            bk("middle_cont");
            aD('fbframediv');
            bk("logindiv");
        }
        else {
            window.scrollTo(0, 0);
            bk("middle_cont");
            aD('fbframediv');
            aD("logindiv");
            bk("facebooklogindiv");
            bu = jo(bu, '\n');
            ip("logininfofacebookname", bu);
        }
}

function hY(add){
    if (add) {
        var cd = dA("fbframe");
        aD("middle_cont");
        bk('fbframediv');
        cd.src = "facebook/tryfb.php?add";
    }
    else {
        var cd = dA("fbframe2");
        if (!cd) {
            cd = ih("fbframe2");
            if (hk()) {
                setvisibility(cd, "visible");
                cd.height = 1;
                cd.width = 1;
            }
        }
        cd.onload = jj;
        cd.src = "facebook/tryfb.php";
    }
}

function jj(){
    var x = 3;
}

function jA(){
    hY(true);
}

function ix(){
    I.hB("checklogin.php", gT, "loginform");
}

function fW(){
    if (!il("facebooklogindiv") && jd("username") && jd("password")) {
        I.hB("checklogin.php", hQ);
    }
}

function iA(){
    cA("forgotusername");
    cA("forgotemailaddress");
}

function hS(){
    cA("regfirstname");
    cA("reglastname");
    cA("regemailaddress");
    cA("regusername");
    cA("regpass");
    cA("regpassconfirm");
}

function ij(){
    I.hB("logout.php", hO);
    hS();
    iA();
}

function hD(){
    bk("logouteditdiv");
}

function hv(){
    aD("logouteditdiv");
}

function aD(gz){
    var ft = dA(gz);
    if (ft) {
        ft.className = "hidden";
    }
}

function bk(gz){
    var ft = dA(gz);
    if (ft) {
        ft.className = "visible";
    }
}

function il(gz){
    var ft = dA(gz);
    if (ft.className == "visible") 
        return true;
    return false;
}

function jv(ct){
    var bq = dA(ct);
    if (bq != null) {
        return bq.value;
    }
    return null;
}

function lN(ct){
    var bq = dA(ct);
    if (bq != null) {
        var text = bq.value;
        if (text.length > 0) {
            return true;
        }
    }
    return false;
}

function fw(ct, label, min, type){
    var au = "";
    var bq = dA(ct);
    if (bq != null) {
        var text = bq.value;
        if (text.length == 0) {
            au = "Please enter a " + label + ".";
        }
        else 
            if (text.length < min) {
                au = "Please enter a " + label + " at least " + min + " characters long.";
            }
    }
    if (au.length > 0) 
        au += "<br />";
    return au;
}

function hx(pass, confirm){
    var au = "";
    var gP = dA(pass);
    var hf = dA(confirm);
    if (gP != null && hf != null) {
        if (gP.value != hf.value) {
            return "Passwords do not match.<br />"
        }
    }
    return "";
}

function dE(id, text){
    var bq = dA(id);
    if (bq) {
        bq.innerHTML = text;
    }
}

function cF(id, text){
    var bq = dA(id);
    if (bq) {
        bq.value = text;
    }
}

function cA(id){
    cF(id, "");
}

function hT(){
    if (!aP) 
        return;
    dE("registertitle", "Modify Profile");
    dE("registerinstructions", "Please change the information you want.<br />To change the password, please enter new values.<br />");
    cF("regfirstname", aP.hm);
    cF("reglastname", aP.hI);
    cF("regemailaddress", aP.hL);
    cF("regusername", aP.eb);
    cF("regpass", "");
    cF("regpassconfirm", "");
    var cf = dA("registerbutton")
    cf.onclick = ik;
    cf.src = "jsimg/savebutton.gif";
    eT();
}

var gC = null;

function hd(){
    if (isVisibleElem("favoritetext")) {
        gC = "favorite";
    }
    else {
        gC = null;
    }
}

function gj(){
    hd();
    fh();
    dE("registertitle", "Registration");
    dE("registerinstructions", "Please enter the following information in order to become a Zuguide member.  Membership is free!");
    var cf = dA("registerbutton")
    cf.onclick = gx;
    cf.src = "jsimg/registerbutton.gif";
    eT();
    eh("#dispregister");
    ed("dispregister", "", "");
}

function eT(){
    aD("middle_cont");
    bk("regdiv");
}

function gH(){
    hd();
    fh();
    aD("middle_cont");
    bk("forgotdiv");
    eh("#dispforgot");
    ed("dispforgot", "", "");
}

var gb = false;



function ik(){
    eo(true);
}

function gx(){
    eo(false);
}

function io(){
    dA("forgoterrors").innerHTML = "";
    var au = "";
    var ju = lN("forgotusername");
    var jk = lN("forgotemailaddress");
    if (!ju && !jk) {
        au = "Please enter your zuguide username or your registered zuguide email address.";
        dA("forgoterrors").innerHTML = au + "<br />";
    }
    else {
        var ib = fw("forgotusername", "username", 5);
        var hK = gu("forgotemailaddress", "Please enter a valid email address.");
        if (ib.length > 0 && hK.length > 0) {
            var au = ib + hK;
            dA("forgoterrors").innerHTML = au + "<br />";
        }
        else {
            I.hB("forgot.php", hR, "forgotform");
        }
    }
}


function eo(hj){
    var au = "";
    dA("regerrors").innerHTML = "";
    au += fw("regfirstname", "first name", 3);
    au += fw("reglastname", "last name", 3);
    au += fw("regusername", "username", 5);
    var eq = "";
    var he = jv("regpass");
    if (!hj && he) {
        eq = fw("regpass", "password", 5);
    }
    if (!hj && he && eq.length == 0) {
        eq = hx("regpass", "regpassconfirm");
    }
    au += eq;
    au += gu("regemailaddress", "Please enter a valid email address.");
    if (au.length > 0) {
        dA("regerrors").innerHTML = au + "<br />";
    }
    else {
        if (hj) {
            I.hB("register.php?modify=true", gS, "registerform");
        }
        else {
            I.hB("register.php", gK, "registerform");
        }
    }
    ed("gx", "", "");
}

function gK(bu){
    if (bu.as("Registration Failed")) {
        dA("regerrors").innerHTML = bu + "<br />";
    }
    else {
        aD("middle_cont");
        aD("regdiv");
        bk('responsediv');
        dE("responsemessage", "<p>Your registration has been successful.<br>You are now registered as " +
        bu +
        ".<br />Zuguide has sent a confirmation email to your email address. <br />Please follow the instructions in that email.<br />Please click OK to continue.</p>" +
        "<br />");
        setloggedin(bu);
    }
}

function hR(bu){
    if (bu.as("Forgot Password Failed")) {
        dA("forgoterrors").innerHTML = bu + "<br />";
    }
    else {
        aD("middle_cont");
        aD("forgotdiv");
        bk('responsediv');
        dE("responsemessage", bu);
    }
}


function gS(bu){
    if (bu.as("Profile Modification Failed")) {
        dA("regerrors").innerHTML = bu + "<br />";
    }
    else {
        aD("regdiv");
        bk('responsediv');
        dE("responsemessage", "<p>Your Profile Modification has been successful.<br>You are now logged in  as " +
        bu +
        ".<br />Please click OK to continue.</p>" +
        "<br />");
        setloggedin(bu);
    }
}

function eu(){
    if (gC == "favorite") {
        ak("myfavorites");
    }
    else {
        fh();
    }
}


function iQ(){
    aD("responsediv");
    fW();
    bk("middle_cont");
    eu();
}

var aP = null;

function setloggedin(eb){
    if (!aP || aP.eb != eb) {
        aP = new jp(eb);
    }
    aD("logindiv");
    bk("logininfodiv");
    ip("logininfousername", eb);
}

function gZ(){
    aD("loginmessage");
}

function hO(bu){
    aP = null;
    bk("logindiv");
    aD("logininfodiv");
    aD("loginmessage");
}

function hQ(bu){
    gT(bu, true)
}

function gT(bu, hP){
    bu = dB(bu);
    if (bu != "failure") {
        aD("loginmessage");
        setloggedin(bu);
    }
    else {
        bk("logindiv");
        aD("logininfodiv");
        if (!hP) {
            bk("loginmessage");
        }
        else {
            var x33 = true;
        }
    }
}

function gE(iK){
    var v = '';
    var bR;
    var gO = '';
    for (var i = 0; i < iK.elements.length; i++) {
    
        bR = iK.elements[i];
        switch (bR.type) {
            case 'text':
            case 'hidden':
            case 'password':
            case 'textarea':
            case 'select-one':
                v += bR.name + '=' + encodeURIComponent(bR.value) + '&';
                break;
                
            case 'radio':
                if (bR.checked) {
                    v += bR.name + '=' + escape(bR.value) + '&'
                }
                break;
                
            case 'checkbox':
                if (bR.checked) {
                    if (bR.name == gO) {
                        if (v.lastIndexOf('&') == v.length - 1) {
                            v = v.substr(0, v.length - 1);
                        }
                        v += ',' + escape(bR.value);
                    }
                    else {
                        v += bR.name + '=' + escape(bR.value);
                    }
                    v += '&';
                    gO = bR.name;
                }
                break;
                
        }
    }
    var jD = /%20/g; 
    v.replace(jD, "+");
    v = v.substr(0, v.length - 1);
    return v;
}


function g(cP, query, value, jy){
    this.cP = cP;
    this.eg = false;
    this.query = query;
    this.xml = null;
    this.value = value;
    if (!jy) {
        this.bP(query);
    }
    this.time = getTime();
    this.add();
}

g.prototype.jh = function(){
    this.eg = false;
    this.bP(this.query, true);
}

g.prototype.dN = function(value){
    this.value = value;
    this.eg = false;
    this.bP(this.query, true);
}

g.prototype.add = function(){
    var cP = this.cP;
    var de = this;
    if (cP != null) {
        cP.add(de);
    }
}

g.prototype.iR = function(xml){
    var jf = xml.getElementsByTagName("entitylist");
    return jf;
}


g.prototype.hb = function(xml){
    var entities = xml.getElementsByTagName("entity");
    return entities;
}

g.prototype.gF = function(aJ){
    var selected = this.value;
    if (this.value != null) {
        selected.gJ(aJ);
        this.eg = true;
        ai(selected);
    }
}

g.prototype.kl = function(ko){
    if (this.value != null) {
        var linklist = this.value;
        linklist.cz(ko);
        this.eg = true;
        if (aU && aU.kK() == linklist.id) {
            gk();
        }
    }
}

g.prototype.gs = function(iS, fZ){

    if (this.value != null) {
        var cN = this.value;
        cN.cz(iS);
        if (fZ) {
            cN.fZ = true;
        }
        this.eg = true;
        af(cN);
    }
}

g.prototype.cz = function(xml){
    if (xml == null) 
        return;
    var bn = xml.documentElement;
    var bo = "";
    if (bn) {
        bo = bn.nodeName;
    }
    else {
        bo = "";
    }
    
    if (this.query.as("data/entities.php?x")) {
        var entities = this.hb(xml);
        var eG = this.bd;
        if (!eG || (eG.length != entities.length)) 
            return;
        for (var i = 0; i < entities.length; i++) {
            var de = cG.gN(eG[i]);
            if (de != null) {
                de.gF(entities[i]);
            }
        }
    }
    else 
        if (this.query.as("data/entlist.php?mult=t")) {
            var entities = this.iR(xml);
            var eG = this.bd;
            if (!eG) 
                return;
            if (eG.length != entities.length) 
                return;
            for (var i = 0; i < entities.length; i++) {
                var de = cG.gN(eG[i]);
                if (de != null) {
                    de.gs(entities[i]);
                }
            }
        }
        
        else 
            if (this.query.as("data/entities")) {
                var entities = this.hb(xml);
                if (entities.length == 0) 
                    return;
                this.gF(entities[0]);
            }
            else 
                if (bo == "entitylist") {
                    this.gs(xml, true);
                }
                else 
                    if (bo == "linklist") {
                        this.kl(xml, true);
                    }
                    else 
                        if (bo == "error") {
                            this.eg = true;
                            this.value.ee = C(xml, "error");
                            var dI = 5;
                        }
}

function av(xml, tag){
    var bt = xml.getElementsByTagName(tag);
    if (bt.length > 0) 
        return bt[0];
    return null;
}

function ip(id, value){
    var bq = dA(id);
    if (bq != null) {
        if (navigator.appVersion.indexOf("MSIE") != -1) {
            bq.innerHTML = value; 
        }
        else {
            bq.textContent = value; 
        }
    }
}


function C(xml, tag){
    var bt = xml.getElementsByTagName(tag);
    if (bt.length > 0) {
        var cV = bt[0];
        if (navigator.appVersion.indexOf("MSIE") != -1) {
            var cW = cV.text; 
        }
        else {
            var cW = cV.textContent; 
        }
        if (cW.length > 0) 
            return cW;
    }
    return "";
}

summary.prototype.fi = function(xml){
    this.id = xml.getAttribute("id");
    if (this.id.indexOf("/index/Category/") >= 0) {
        var start = this.id.lastIndexOf('/') + 1;
        this.id = this.id.substring(start);
    }
    this.type = xml.getAttribute("type");
    this.url = xml.getAttribute("url");
    this.title = C(xml, "displayTitle");
    this.firstimage = xml.getAttribute("firstimage");
    this.count = xml.getAttribute("count");
    if (this.firstimage == undefined || this.firstimage == null || this.firstimage.length == 0) 
        this.firstimage = 0;
}

function summary(id, type, title, firstimage, url){
    if (arguments.length == 1) {
        this.fi(arguments[0]);
    }
    else {
        this.id = id;
        this.type = type;
        this.title = title;
        this.url = url;
        this.firstimage = firstimage;
        if (this.firstimage.length == 0) 
            this.firstimage = 0;
    }
}



I.bP = function(url, bh){
    var cH = I.cj();
    cH.onreadystatechange = function(){
        var bC = gc(cH);
        if (bC == 200) {
            bh(cH.responseXML);
        }
    }
    cH.open("GET", url);
    cH.send(null);
}

var cG = null;
var aS = null;
var bf = null;
var aT = null;
var aU = null;
var cg = null;

function ai(ds){
    if (aT == ds) {
        D(false);
    }
}

function af(dq){
    if (aS == dq) {
        j();
    }
}

function U(tags){
    for (var i = 0; i < tags.length; i++) {
        var bq = dA(tags[i]);
        if (bq) 
            setvisibility(bq, "hidden");
    }
}

function f(tag){
    U(arguments);
}

function isVisibleElem(tag){
    var bq = dA(tag);
    if (bq != undefined && bq != null) {
        if (bq.style.visibility != "hidden") {
            return true;
        }
    }
    return false;
}

function P(bJ){
    if (cQ.length > 0) {
        if (bJ == undefined) {
            return "http:/" + cQ + "/";
        }
        else {
        
            return "http://" + cQ + "/" + bJ + "/";
        }
    }
    else {
        return bJ + "/";
    }
}

function J(){
    return P("images");
}

function bs(fD){
    if (fD) {
        d("del_favorites_off");
        f("add_favorites_off");
        
    }
    else {
        d("add_favorites_off");
        f("del_favorites_off");
    }
    
}

function eZ(){
    if (aU == aT) {
        bs(dP(aT.id));
    }
}


function dP(id){
    if (id == null || id.length == 0) 
        return false;
    if (!aP || !aP.eQ) 
        return false;
    var ca = cG.getItem("favlist.php?");
    if (ca == null) 
        return false;
    for (var i = 0; i < ca.entities.length; i++) {
        var dT = ca.entities[i];
        if (dT.id == id) {
            return true;
        }
    }
    return false;
}


function fd(){
    if (!ho()) {
        eV();
    }
    else {
        bs(true);
        cG.getItem("favlist.php?action=add&id=" + aT.id, true);
        ed("addfavorite", aT.id, aT.title);
    }
}

function dQ(){
    bs(false);
    cG.getItem("favlist.php?action=delete&id=" + aT.id, true);
    ed("delfavorite", aT.id, aT.title);
}

function B(){
    return P("jsimg");
}

function d(tag){
    var bq = dA(tag);
    if (bq != undefined) {
        setvisibility(bq, "visible");
    }
    for (var i = 1; i < arguments.length; i++) {
        f(arguments[i]);
    }
    
}

function K(){
    f("preview_bkgd");
    R("preview");
    f("getflashplayer");
    setNonVisibleOnOff("back");
    setNonVisibleOnOff("add_favorites");
    setNonVisibleOnOff("del_favorites");
    f("bigimage");
    f("transparentplay");
    
    f("bannertop");
    f("bannerbottom");
    f("amazon_button");
    f("bn_button");
    f("flvplayercontrols");
    f("descrip");
    f("toptitle");
    f("bigtitle");
    f("linksdiv");
    f("addtoany");
    hide();
}

function hideThumbnailScreen(){
    settitlevisibility(0);
    f("bkgd", "prevpage_off", "prevpage_on", "nextpage_off", "nextpage_on", "thumbswithtitlebars", "pagetext", "linksdiv", "thumbnail_highlight");
}

function hq(jr){
    if (jr.innerText) { 
        return jr.innerText;
    }
    else {
        if (jr.textContent) {
            return jr.textContent;
        }
    }
}

function ad(tag, description){
    var fe = Array();
    var cy = dA(tag);
    if (!cy) 
        return;
    cy.innerHTML = "";
    if (description == null) 
        return;
    for (var i = 0; i < description.childNodes.length; i++) {
        var node = description.childNodes[i];
        switch (node.nodeType) {
            case 3:
                var dn = document.createTextNode(node.nodeValue);
                cy.appendChild(dn);
                break;
                
            case 1:
                if (node.nodeName == 'a') {
                
                    var bi = document.createElement('a');
                    if (node.childNodes.length > 0) {
                        var dr = node.childNodes[0];
                        if (dr.nodeType == 3) {
                            var bg = document.createTextNode(dr.nodeValue);
                            bi.appendChild(bg);
                        }
                        if (node.attributes.length > 0) {
                            var bm = node.attributes[0];
                            if (bm.nodeType == 2 && bm.nodeName == "href") {
                                var fU = bm.nodeValue;
                                var displaytext = bi.text;
                                if (navigator.appName.indexOf("Microsoft") != -1) {
                                    displaytext = bi.innerText;
                                }
                                bi.href = "javascript:refclick('" + fU + "','" + displaytext + "')";
                                bi.onmouseover = gI;
                                fe.push(fU);
                            }
                        }
                        cy.appendChild(bi);
                    }
                }
                break;
                
            default:
                break;
        }
    }
    fY(fe);
    return fe;
}

function gI(){
    dh = this.hJ;
}

function im(){
    dh = null;
}

function F(gV){
    return "data/entlist.php?type=program&indexed=" + gV;
}

function iq(query){
    var pos = query.lastIndexOf('=');
    var cZ = query.substring(pos + 1);
    return cZ;
}

function fo(cZ){
    return "data/entlist.php?srch=" + encodeURIComponent(cZ);
}

function ap(dF, cp){
    d("pagetext");
    var bp = Math.floor(dF / 12) + 1;
    var gv = " PAGE   " + bp;
    if (cp != 0) {
        var ci = Math.ceil(cp / 12);
        if (ci == 0) 
            ci = 1;
        gv += "   OF   " + ci;
    }
    M("pagetext", gv);
}

var Q = false;
var cq = null;



function fP(image, title){
    if (title != undefined) 
        image.title = title;
    else 
        image.title = "";
}



function lL(){
    var fl = J() + aT.id + "/" + aT.id + '.';
    for (var i = 0; i <= 12; i++) {
        var gM = fl + i + ".219.138.jpg";
        if (cg.bX(gM)) {
            return gM;
        }
    }
    return B() + "largethumbreplacement.jpg";
}


function computeBigSourcename(){
    if (aT.id) {
        return J() + aT.id + "/" + aT.id + '.' + aT.aV + ".570.359" + ".jpg";
    }
    else {
        return null;
    }
}

function ff(){
    if (aT.aV + 1 < aT.ck) {
        aT.aV++;
    }
    else {
        aT.aV = 0;
    }
}

var ez = null;

function hC(){
    if (aT.cw.length != 0) {
        d("transparentplay");
    }
    else {
        f("transparentplay");
    }
}

function hy(){

    var iU = dA("transparentplay");
    var ma = dA("bigimage");
    var x = 0;
    var y = 0;
    if (typeof window.event != "undefined") {
        x = event.clientX;
        y = event.clientY;
    }
    else 
        if (arguments.length >= 1) {
            x = arguments[0].clientX;
            y = arguments[0].clientY;
        }
    if (x < ma.offsetLeft || x > ma.offsetLeft + ma.offsetWidth ||
    y < ma.offsetTop ||
    y > ma.offsetTop + ma.offsetHeight ||
    (x < iU.offsetLeft || x > iU.offsetLeft + iU.offsetWidth) &&
    (y < iU.offsetTop || y > iU.offsetTop + iU.offsetHeight)) {
        f("transparentplay");
    }
    
}

function H(){
    return jW(false);
}


function jW(fM){
    var fu = 10;
    if (Q) 
        clearTimeout(Q);
    Q = null;
    image = false;
    image = aL("bigimage");
    if (aT.cw.length != 0) {
        image.onclick = cl;
        image.style.cursor = 'pointer';
        image.onmouseover = hC;
        image.onmouseout = hy;
    }
    else 
        if (image) {
            image.onclick = "";
            image.style.cursor = '';
            image.onmouseover = "";
            image.onmouseout = "";
        }
    
    if (fM) {
        image.src = lL();
        ez.img.src = computeBigSourcename();
    }
    else {
        if (ez.img.complete) {
            var image = aL("bigimage");
            image.src = computeBigSourcename();
            ff();
            ez.img.src = computeBigSourcename();
            fu = 3000;
        }
    }
    Q = setTimeout(H, fu);
}



function hz(tag, src){
    var image = dA(tag);
    if (!image) 
        return;
    src = src + ".jpg";
    if (image.src == src) 
        return;
    image.src = src;
}

function D(refresh){
    if (refresh == undefined) {
        refresh = true;
    }
    cS();
    bK(true);
    lK();
    d("searchdiv");
    gL();
    if (isVisibleElem("bkgd")) {
        hideThumbnailScreen();
    }
    else {
        aD("middle");
    }
    d("preview_bkgd");
    
    if (aT.cw.length != 0) {
        d("flvplayercontrols");
        if (ku()) {
            f("preview_grey");
            d("getflashplayer");
        }
        else {
            d("preview_off");
            if (aT.ha) {
                fG.dK("advert", "trailers/" + aT.ha);
            }
            
            var cx = aT.cw.substring(0, aT.cw.indexOf('.'));
            fG.dK("trailer", cx);
            hide();
            setTimeout("hide()", 100);
            setTimeout("hide()", 300);
            setTimeout("hide()", 500);
            
        }
    }
    else {
        d("preview_grey");
        f("flvplayercontrols");
    }
    if (aT.dU.length > 0) {
        d("amazon_button");
    }
    if (aT.dX.length > 0) {
        d("bn_button");
    }
	if (!isVisibleElem("back_on")) {
		d("back_off");
	}
    eZ();
    d("chapter_off");
    d("play_off");
    d("bigimage");
    jW(true);
    d("bannertop");
    d("bannerbottom");
    if (refresh) {
        kM();
    }
    if (aT.description != null) {
        fe = ad("descrip", aT.description);
        dh = null;
        bK(false);
        cs = setTimeout(gn, 1000);
        d("descrip");
        lU();
    }
    else {
        f("descrip");
    }
    d("toptitle");
    M("toptitle", aT.title);
    d("bigtitle");
    M("bigtitle", aT.title);
    ag(aT);
    iB();
    gk();
    if (zuguide.fM) {
        hC();
        zuguide.fM = false;
    }
}

var fe = null;
var dh = null;


function kT(){
    this.kO = "";
    this.kR = "";
    this.kZ = "";
}


kT.prototype.set = function(kW){
    if (kW.length == 3) {
        this.kO = kW[0];
        this.kR = kW[1];
        iP(zuguide.la, this.kR);
        this.kZ = kW[2];
    }
}

function kQ(){
    if (this.mX) {
        window.open(this.mX);
        ed("cjclick", this.mX, this.src);
    }
}

function kM(){
    kP("bannertop", 468, 60, 1);
    kP("bannerbottom", 468, 60, 2);
}


function kP(kY, width, height, cp){
    var kO = kX(kS(width, height, cp));
    var banner = dA(kY);
    if (banner) {
        banner.src = kO.kR;
        banner.title = kO.kZ;
        banner.mX = kO.kO;
        if (banner.src && isVisibleElem("preview_bkgd")) {
            setvisibility(banner, true);
        }
    }
    kU(width, height, cp);
}

function kU(width, height, cp){
    var kI = "smartz.php?data=" + kS(width, height, cp);
    I.get(kI, kV);
}

function kS(width, height, cp){
    return width + '-' + height + '-' + cp;
}

function kV(kF, url){
    var bB = hh(url);
    var data = bB.query.iT('=');
    if (!zuguide.kN[data]) {
        zuguide.kN[data] = new kT();
    }
    var kW = kF.split("\n");
    zuguide.kN[data].set(kW);
}

function kX(data){
    if (!zuguide.kN[data]) {
        zuguide.kN[data] = new kT();
    }
    return zuguide.kN[data];
}

function ie(gd){
    var query = F(gd);
    var ac = cG.getItem(query);
    if (!ac || ac.dp() == 0) {
        return false;
    }
    else {
        var result = eA(ac, 0, eC);
        if (!result) {
            return -1;
        }
    }
    return true;
}


function gn(){
    bK(false);
    if (fe == null) 
        return;
    if (dh) 
        ie(dh);
    var lb = true;
    for (var i = 0; i < fe.length; i++) {
        var result = ie(fe[i]);
        if (!result) {
            lb = false;
        }
        else 
            if (result == -1) {
                lb = false;
                break;
            }
    }
    if (!lb) {
        cs = setTimeout(gn, 50);
    }
}

function fH(){
    var ll = dA("regdiv");
    if (ll) 
        return true;
    else 
        return false;
}

function fh(text){
    if (!fH()) {
        I.get("loadmiddle.php", fh);
        return;
    }
    if (text) 
        ar(text);
    aD("regdiv");
    cS();
    aD("forgotdiv");
    aD("helpdiv");
    bk("middle_cont");
    f("searchdiv");
    fj();
    hide();
    stop();
    if (Q) 
        clearTimeout(Q);
    if (isVisibleElem("preview_bkgd")) {
        K();
    }
    if (isVisibleElem("bkgd")) {
        hideThumbnailScreen();
    }
    bk("middle");
    f("searchdiv");
    f("srch_title_lg");
    f("left_arrow");
    f("rt_arrow");
    f("search");
    fW();
    eh("#home");
    
}




function fq(parent, node){
    if (parent.firstChild != undefined) {
        parent.insertBefore(node, parent.firstChild);
    }
    else {
        parent.appendChild(node);
    }
}

function fj(){
    var searchformdiv = dA("searchformdiv");
    var fV = dA("left");
    fq(fV, searchformdiv);
    fm(searchformdiv);
}

function ga(){
    if (aU && aU.linklist == null) {
        var linklist = cG.getItem("data/linklist.php?indexed=" + aU.kK());
        if (linklist != null) {
            aU.linklist = linklist;
        }
    }
    else {
        return true;
    }
}

function kg(){
    this.style.backgroundPosition = "115px 0px";
}

function ki(){
    this.style.backgroundPosition = "0px 0px";
    
}


function ka(){
    kj("none");
}

function kk(){
    kj("block");
}

function kj(direction){
    var lZ = dA("linksdiv");
    if (lZ.linklist) {
    
        for (var i = 0; i < lZ.linklist.list.length; i++) {
            var lY = dA("linkdiv" + i);
            lY.style.display = direction;
            lY.style.cursor = "pointer";
        }
        if (direction == "block") {
            for (; i < lZ.linklist.list.length; i++) {
                var lY = dA("linkdiv" + i);
                lY.style.display = "none";
            }
            var height = 28 * lZ.linklist.list.length;
            var top = 727 - height;
            lZ.style.top = top + "px";
            lZ.style.height = height + 29 + "px";
        }
        else {
            lZ.style.top = "727px";
            lZ.style.height = 29 + "px";
            
        }
    }
    else {
        lZ.style.top = "727px";
        lZ.style.height = 29 + "px";
    }
    return true;
}

function kr(){
    ka();
    var link = this.hN;
    var ke = "";
    switch (link.domain) {
        default:
            ke = link.domain;
            if (!link.link.as('/')) {
                ke += '/';
            }
            ke += link.link;
            break;
    }
    ke = "http://" + ke;
    window.open(ke);
    var dI = 5;
}

function gk(){
    if (!aU) 
        return;
    ga();
    var lZ = dA("linksdiv");
    if (!lZ) 
        return;
    lZ.linklist = aU.linklist;
    var linklist = lZ.linklist;
    if (linklist != null && linklist.list.length > 0) {
        var lZ = dA("linksdiv");
        for (var i = 0; i < linklist.list.length; i++) {
            var link = linklist.list[i];
            var km = link.kt();
            var lY = dA("linkdiv" + i);
            lY.hN = link;
            lY.onclick = kr;
            if (km == "blanklinkbutton") {
                lY.style.backgroundImage = "url(jsimg/" + km + ".gif)";
                lY.style.backgroundPosition = "top left";
                lY.innerHTML = "";
                var linkname = link.kq();
                if (linkname) {
                    lY.innerHTML = linkname;
                }
                else {
                    lY.innerHTML = link.domain;
                }
            }
            else {
                lY.style.backgroundImage = "url(jsimg/" + km + ".gif)";
                lY.style.backgroundPosition = "top left";
                lY.innerHTML = "";
            }
        }
        d("linksdiv");
    }
    else {
        f("linksdiv");
    }
}

function eF(){
    hide();
    T();
    d("searchdiv");
    d("bkgd");
    d("thumbswithtitlebars");
    if (zuguide.lO == "Searchlist") {
        d("thumbnail_highlight");
    }
    if (isVisibleElem("preview_bkgd")) {
        K();
        d("bkgd");
        d("thumbswithtitlebars");
    }
    else {
        aD("middle");
    }
    settitlevisibility(aS.cc);
    f("prevpage_off", "prevpage_on", "nextpage_off", "nextpage_on");
    if (aS.di > 0) {
        d("prevpage_off");
    }
    if (aS.di + 12 < aS.dp()) {
        d("nextpage_off");
    }
}


function bK(all){
    if (aa) {
        clearTimeout(aa);
        aa = null;
    }
    if (aW) {
        clearTimeout(aW);
        aW = null;
    }
    if (aR) {
        clearTimeout(aR);
        aR = null;
    }
    if (cs) {
        clearTimeout(cs);
        cs = null;
    }
    if (all) {
        gU();
    }
}


function gU(){
    if (Q) {
        clearTimeout(Q);
        Q = null;
    }
}



function iB(){
    for (var i = 0; i < 12; i++) {
        var tag = "thumb" + aK + (i + 1);
        var image = aL(tag);
        if (image) {
            image.src = "jsimg/blank.gif";
        }
    }
}

function j(){
    cS();
    if (aS.ee) {
        var dI = 3;
    }
    bK(true);
    var fZ = true;
    if (!aS.fZ) {
        aS.fZ = true;
        fZ = false;
        cG.getItem(aS.query, true);
        }
    if (Q) 
        clearTimeout(Q);
    if (aS.dp() == 1 && aS.title.as("Search for ")) {
        var summary = aS.bN(0);
        if (summary != null) {
            eB(summary);
            return;
        }
    }
    eF();
    fp(fZ);
    gY();
    gk();
    if (aS.query.as("favlist.php?")) {
        eV();
    }
}

function ea(){

    var result = eA(aS, aS.di + 12, eC);
    if (!result) {
        aW = setTimeout(ea, 50);
    }
    
}

function iP(cache, src){
    var result = cache.add(src);
    if (result) {
        dR.log("added to image loading cache");
    }
    else {
        dR.log("not added to image loading cache");
    }
    return result;
}

var fy = new Image();


function eA(ac, start, cache){
    var end = Math.min(start + 12, ac.dp());
    for (var i = start; i < end; i++) {
        var src = ac.fN(i);
        dR.log("looking for: " + i + ": " + src);
        if (cg.bX(src)) {
            dR.log("in browser cache");
        }
        else {
            var jn = iP(cache, src);
            if (!jn) {
                return false;
            }
        }
    }
    return true;
}

function ej(){
    aa = null;
    var complete = true;
    if (!eJ(aS)) 
        return;
    for (var i = 0; i < aS.cc; i++) {
        var hi = aS.fN(i, true);
        var image = dA("thumb" + aK + (i + 1));
        dR.log("Image: " + hi + " Complete: " + image.complete);
        if (!image.complete) {
            complete = false;
        }
        else {
            var hi = aS.fN(i, true);
            cg.iJ(hi);
        }
    }
    if (complete) {
        hA();
        ea();
    }
    else {
        aa = setTimeout(ej, 100);
    }
}


function fp(fZ){
    bK(true);
    var et = aK;
    if (aK == 'a') {
        aK = 'b';
    }
    else {
        aK = 'a';
    }
    aS.nc();
    
    
    for (var i = 0; i < aS.cc; i++) {
        var cJ = aS.entities[aS.di + i];
        var image = aL("thumb" + aK + (i + 1));
        var title = cJ.title;
        if (cJ.count) {
            title += " (" + cJ.count + ")";
        }
        if (title.length > 32) 
            title = title.substring(0, 29) + "..";
        M("titletext" + (i + 1), title);
        image.src = J() + cJ.id + "/" + cJ.id + '.' + cJ.firstimage + ".219.138" + ".jpg";
    }
    for (var i = 0; i < aS.cc; i++) {
        var cJ = aS.entities[aS.di + i];
        var image = aL("thumb" + aK + (i + 1));
        var fK = aL("thumb" + et + (i + 1));
        setvisibility(image, true);
        setvisibility(fK, false);
        fP(image, cJ.title);
        fK.src = "jsimg/blank.gif";
    }
    for (var i = 0; i < aS.cc; i++) {
        var fK = aL("thumb" + et + (i + 1));
        fK.src = "jsimg/blank.gif";
    }
    var cb = aS.entities.length;
    if (!fZ) {
        cb = 0;
    }
    ap(aS.di, cb);
    ag(aS);
    if (aS.cc > 0) {
        var xxx = true;
        aa = setTimeout(ej, 10);
    }
    else {
        xxx = false;
    }
}

function fY(ef){
    if (ef.length == 0) 
        return;
    var bd = Array();
    var query = "data/entlist.php?mult=t";
    var cp = 1;
    for (var i = 0; i < ef.length; i++) {
        var fE = F(ef[i]);
        if (!cG.getItem(fE, 'getval')) {
            bd.push(fE);
            query += "&id" + cp++ + "=" + ef[i];
        }
    }
    cG.hM(query, bd);
}

function hA(){
    var bd = Array();
    var query = "data/entities.php?x";
    var ef = Array();
    for (var i = 0; i < aS.cc; i++) {
        var cJ = aS.entities[aS.di + i];
        if (cJ.type == "category") {
            ef.push(cJ.id);
            }
        else {
            var fE = "data/entities.php?id=" + cJ.id;
            if (!cG.getItem(fE, 'getval')) {
                bd.push(fE);
                query += "&id" + i + "=" + cJ.id;
            }
        }
    }
    cG.hM(query, bd);
    if (ef.length > 0) {
        fY(ef);
        fe = ef;
        cs = setTimeout(gn, 1000);
    }
}

var dm;
var dw;
var tabs;

function lM(lJ){
    if (lJ == "avpreq") {
        dm = new Array("data/entlist.php?type=program&indexed=/index/Category/imdbkeyword_AlienSeries&bydate=true", "data/entlist.php?type=program&indexed=/index/Category/imdbkeyword_PredatorSeries&bydate=true", "data/entlist.php?type=program&indexed=/index/Category/imdbkeyword_AVPSeries&bydate=true", "data/entlist.php?type=program&indexed=/index/Category/imdbkeyword_AllTrailers&bydate=true", "data/entlist.php?type=program&indexed=/index/Category/imdbkeyword_All-Show&bydate=true");
        dw = new Array("Alien", "Predator", "Alien vs. Predator", "Just the Trailers", "All Content");
        tabs = new Array("alien", "predator", "avp", "atrailers", "all");
    }
    else {
        dm = new Array("data/entlist.php?type=intheaters", "data/entlist.php?type=recentdvd", "data/entlist.php?type=comingsoon", "catlist.php?", "favlist.php?");
        dw = new Array("In Theaters", "New on DVD", "Coming Soon", "My Categories", "My Favorites")
        tabs = new Array("intheaters", "newdvd", "comingsoon", "mycategories", "myfavorites");
        
    }
}


function am(){
    for (var i = 0; i < dm.length; i++) {
        cG.getItem(dm[i]);
    }
    setTimeout(eN, 200);
}

var iM = -1;

function ja(id){
    for (var dy = 0; dy < tabs.length; dy++) {
        var tab = tabs[dy];
        if (tab == id) 
            return dy;
    }
    return -1;
}

function jt(){
    iM = ja(this.id);
    eN();
}

function eN(){
    if (aR) {
        clearTimeout(aR);
        aR = null;
    }
    var lb = true;
    var start = iM;
    if (start < 0) 
        start = 0;
    var cb = dm.length;
    for (var i = 0; i < cb; i++) {
        var index = er(i + start, cb);
        var ac = cG.getItem(dm[index]);
        if (ac != null && (ac.dp() != 0 || ac.ee == 'undefined')) { 
            var result = eA(ac, 0, eC);
            if (!result) {
                lb = false;
                break;
            }
        }
        else {
            lb = false; 
        }
    }
    if (!lb) {
        aR = setTimeout(eN, 100);
    }
}

function aH(bq){
    if (bq != null) {
        if (bq.next != null) {
            bq.next.previous = bq.previous;
        }
        if (bq.previous != null) {
            bq.previous.next = bq.next;
        }
    }
}

function aC(next, prev){

    if (next != null) {
        next.previous = prev;
    }
    if (prev != null) {
        prev.next = next;
    }
}

var gq = null;

function ay(start){
    if (start == null) 
        return gq;
    var next = start;
    while (next.next != null) {
        next = next.next;
    }
    return next;
}



function aM(bq){
    var end = ay(aU);
    aC(bq, end);
    bq.next = null;
}

function aj(bq){
    if (bq != null) {
        aH(bq);
        aM(bq);
        return bq;
    }
    else {
        return ay(aU);
    }
}

function ed(type, gV, title){
    if (gV == undefined) 
        el = "";
    if (title == undefined) 
        el = "";
    var ek = type + "*" + gV + "*" + title + "*" + getTime();
    iW("zzlog" + (zuguide.cO++), ek, 31536000, 'data/');
}

function is(){
    return refclick(this.hJ, hq(this));
}

function refclick(gd, title){
	mg();
	mB(gd, title);
}
	
function mB(gd,title) {
    var el = F(gd);
    A(el, title);
    ed("mX", gd, title);
    kC(gd);
}

function searchclick(cZ){
    var fx = fo(cZ);
    var title = "Search for '" + cZ + "'";
    A(fx, title);
    ed("search", cZ);
}

function A(query, title, mX){
    stop();
    if (Q) 
        clearTimeout(Q);
    bf = query;
    var ce = cG.getItem(query);
    if (ce != null) {
        if (!query.as("tvlist?")) {
            aj(ce);
        }
        if (title == undefined) {
            ce.title = "";
        }
        else {
            ce.title = title;
        }
        if (mX) {
            ce.mX = mX;
        }
        aS = ce;
        if (!query.as("tvlist?")) {
            aU = aS;
        }
        j();
    }
}

function preloadselected(){
    ew(".jpg", "preview_bkgd", "flvplayercontrols");
    ew(".gif", "amazon_button", "bn_button");
    ew(".gif", "preview_grey");
    fa(".gif", "back", "preview", "add_favorites", "del_favorites");
}

function preloadthumbnails(){
    ew(".jpg", "bkgd", "thumbswithtitlebars", "prevpage_off", "nextpage_off");
    ew(".gif", "titlebarcoversoneline");
    
    }


function init(lJ){
    setTimeout(preloadselected, 1500);
    setTimeout(preloadthumbnails, 2000);
    setTimeout(am, 2500);
    kM();
    setTimeout(kM, 2500);
    
    if (lJ == "avpreq") {
        ak("atrailers");
    }
    else {
}
}

function jG(image){
    var cK = image.id;
    var by = image.offsetWidth;
    var bw = image.offsetHeight;
    var bx = image.offsetLeft;
    var bA = image.offsetTop;
    var visible = image.style.visibility;
    var be = image.onclick;
    var gB = image.onmouseover;
    var fg = image.onload;
    var zIndex = image.style.zIndex;
    document.body.removeChild(image);
    delete image;
    return L(cK, by, bw, bx, bA, visible, be, gB, fg, zIndex);
}

function kh(){
    var lZ = dA("linksdiv");
    if (lZ) 
        return;
    cG.getItem("data/linklist.php?indexed=0");
    lZ = fJ("linksdiv", 115, 29, 888, 740, false, "linksdivclass");
    lZ.style.zIndex = 7;
    for (var i = 0; i < 10; i++) {
        var lY = iX("linkdiv" + i, 115, 28, "linksdiv");
        lY.style.backgroundImage = "url(jsimg/blanklinkbutton.gif)";
        lY.className = "linkdivclass";
        lY.style.display = "none";
        lY.style.zIndex = 7;
        kf(lY, 115, 28);
        
        lY.onmouseover = kg;
        lY.onmouseout = ki;
    }
    lZ.onmouseover = kk;
    lZ.onmouseout = ka;
    
    var kc = iX("linksbutton", 115, 29, "linksdiv");
    kf(kc, 115, 29);
    kc.style.display = "block";
    kc.style.backgroundImage = "url(jsimg/linksbutton.gif)";
    kc.style.backgroundPosition = "top left";
}

function k(cK, by, bw, bx, bA, visible, bF, be){
    var image = L(cK, by, bw, bx, bA, visible, be);
    eH(image, cK, bF);
    return image;
}

function L(cK, by, bw, bx, bA, visible, be, gB, fg, zIndex){
    var image = document.createElement('img');
    ae(image, by, bw, bx, bA, visible);
    if (be != undefined) {
        image.onclick = be;
        image.style.cursor = 'pointer';
    }
    if (gB) {
        image.onmouseover = gB;
    }
    if (zIndex != undefined) {
        image.style.zIndex = zIndex;
    }
    else {
        image.style.zIndex = 5;
    }
    
    if (fg != undefined) {
        image.onload = fg;
    }
    document.body.appendChild(image);
    var cb = document.images.length;
    var bW = document.images.item(document.images.length - 1);
    bW.id = cK;
    return image;
}

function eD(bO, bF){
    var image = new Image();
    eH(image, bO, bF);
    bI.push(image);
}


function ew(bF){
    for (var i = 1; i < arguments.length; i++) {
        eD(arguments[i], bF);
    }
}

function fa(bF){
    for (var i = 1; i < arguments.length; i++) {
        eD(arguments[i] + "_on", bF);
        eD(arguments[i] + "_off", bF);
    }
}

function eH(image, cK, bF){
    if (bF == undefined) {
        bF = ".jpg";
    }
    var src = B() + cK + bF;
    image.src = src;
}

function ab(cK, by, bw, bx, bA, bG){
    k(cK + "_grey", by, bw, bx, bA, false, ".gif");
    lI(cK, by, bw, bx, bA, bG);
}

function R(tag){
    setNonVisibleOnOff(tag);
    f(tag + "_grey");
}

function setNonVisibleOnOff(tag){
    f(tag + "_on", tag + "_off");
}

function aY(cK, by, bw, bx, bA, bG){
    var button = k(cK, by, bw, bx, bA, false, ".gif");
    if (bG != undefined) {
        button.onclick = bG;
        button.style.cursor = 'pointer';
    }
}

function lI(cK, by, bw, bx, bA, bG){
    var button = k(cK + "_on", by, bw, bx, bA, false, ".gif");
    if (button && bG != undefined) {
        button.onclick = bG;
        button.style.cursor = 'pointer';
        
    }
    button = k(cK + "_off", by, bw, bx, bA, false, ".gif");
    if (button && bG != undefined) {
        button.onclick = bG;
        button.style.cursor = 'pointer';
    }
    return button;
}

function kb(ct, jU){
    var bq = dA(ct);
    if (bq) {
        bq.src = jU;
    }
}

function ia(ct, jR){
    var bq = dA(ct);
    var jC = dA(jR);
    if (bq && jC) {
        jC.appendChild(bq);
    }
}

function gy(fZ){
    hF();
    T();
    hideThumbnailScreen();
    K();
    d("bkgd");
    d("favoritetext");
    d("bottomfilm1");
    d("topfilm");
    if (fZ) {
        bk('favoritelogintext');
        ia("logindiv", "favoritetext");
        kb("loginsubmit", "jsimg/bigsubmitButton.png");
    }
    else {
        aD('favoritelogintext');
    }
}

function cS(){
    f("bottomfilm1", "topfilm", "favoritetext");
    ia("logindiv", "login");
    kb("loginsubmit", "jsimg/submitButton.gif");
}

function hF(){
    if (gb) 
        return;
    var jN = k("bottomfilm1", 215, 382, 50, 120, true, ".gif");
    var jL = k("topfilm", 134, 98, 610, 360, true, ".gif");
    var hs = fJ("favoritetext", 520, 500, 300, 80, true, "favoritetext");
    var text = "<h1>Welcome to My Favorites!</h3>";
    text += "<p>Here users can create a collection of their favorite movies and trailers.  Simply navigate to a movie of your choice, then click:</p>";
    text += "<img src='jsimg/add_favorites_off.gif'>";
    text += "<p>to add a movie to My Favorites.</p>";
    text += "<p id='favoritelogintext'>To access My Favorites, please login below.<br>If you are a new user, please register to gain access to My Favorites.</p>";
    hs.innerHTML = text;
    gb = true;
}

function ih(tag){
    var es = document.createElement('iframe');
    es.id = tag;
    es.jK = 'no';
    es.style.visibility = 'hidden';
    document.body.appendChild(es);
    return dA(tag);
}

function kf(bq, width, height){
    bq.style.width = width + "px";
    bq.style.height = height + "px";
}

function iX(tag, by, bw, hZ, aX){
    var eI = document.createElement('div');
    if (by != 0) {
        eI.style.width = by;
    }
    if (bw != 0) {
        eI.style.height = bw;
    }
    eI.id = tag;
    if (aX != undefined) {
        eI.className = aX;
    }
    eI.style.zIndex = 5;
    if (hZ != undefined) {
        var parent = dA(hZ);
        parent.appendChild(eI);
    }
    else {
        document.body.appendChild(eI);
    }
    return dA(tag);
}


function fJ(tag, by, bw, bx, bA, visible, aX, hZ){
    var eI = iX(tag, by, bw, hZ, aX);
    ae(eI, by, bw, bx, bA - 13, visible);
    return eI;
}

var eS = false;
function lA(){
    if (!eS) {
        eS = true;
        var hX = fJ("searchdiv", 200, 50, -4, 745, true, "searchformdivclass");
        hX.innerHTML = "<form method='get' name='searchform1' onSubmit='return submitsearch1();'><input type='text' name='searchtext1' id = 'searchtext1' class='text' value='search zuguide' onClick='searchfocus(this.id)' onchange='searchchange(this.id)'/><input type='image' src='parts/search.gif' class='button' name='submit' /><br /></form>";
        eW('searchtext', 'searchtext1');
    }
}

function r(tag, by, bw, bx, bA, visible, aX){
    var dj = document.createElement('p');
    var dn = document.createTextNode("");
    ae(dj, by, 0, bx, bA - 13, visible);
    dj.appendChild(dn);
    dj.id = tag;
    dj.className = aX;
    dj.style.zIndex = 5;
    document.body.appendChild(dj);
    var cB = dA(tag);
    if (dj.id == cB.id) {
        var dI = cB.id;
    }
    return cB;
}

function M(tag, text){
    var cy = dA(tag);
    if (cy) {
        cy.lastChild.nodeValue = text;
        var dn = cy.lastChild;
        var xx = 3;
    }
    else {
        var xx = 5;
    }
}


var bI = new Array();

function aG(){
    var bZ = this.id;
    mL(bZ);
    ml(cD.mW.none);
}

function mL(bZ){
    stop();
    ak(bZ);
}

function dG(){
    return Math.floor(aS.di / 12) + 1;
}

function aB(){
    mK();
    mj(cD.mW.none);
}

function mK(){
    if (aS && aS.di + 12 < aS.entities.length) {
        aS.eR(12);
        ed("nextpage", aS.mX, dG());
        j();
    }
}

function az(){
    mJ();
    mj(cD.mW.none);
}


function mJ(){
    if (aS && aS.di > 0) {
        aS.eR(-12);
        ed("prevpage", aS.mX, dG());
        j();
    }
}




function aE(){
    if (aU.previous != null) {
        aU = aU.previous;
        V();
        ed("prevhistfunc", aU.dZ(), aU.title);
    }
}

function aF(){
    if (aU.next != null) {
        aU = aU.next;
        V();
        ed("nexthistfunc", aU.dZ(), aU.title);
    }
}




function V(){
    stop();
    if (aU.cR == "Selectedtype") {
        aT = aU;
        D();
    }
    else 
        if (aU.cR == "Searchlist") {
            aS = aU;
            j();
        }
    
}

function hc(hash, kG){
    if (hash.substring(0, 1) == "#") {
        hash = hash.substring(1);
    }
    if (hash == null || hash == "" || hash == "home") {
        fh();
        return "logo";
    }
    if (hash.as("help_")) {
        var hg = hash.iT("help");
        if (hg) {
            gm(hg);
        }
        return;
    }
    switch (hash) {
        case "dispregister":
            gj();
            return;case "dispforgot":
            gH();
            return;    }
    if (kG == undefined) {
        kG = hash.substring(0, 1);
        if (!tabs.O(hash) && (kG == 'i' || kG == 'r')) {
            hash = hash.substring(1);
            var bB = hh(document.location);
            var xxx = 3;
            location.replace(bB.path + '#' + hash);
        }
    }
    var kH = hash;
    if (hash.as("search-")) {
        kH = hash.iT("search-");
    }
    if (aU != null) {
        var search = ay(aU);
        while (search) {
            if (search.bS(kH)) {
                return search;
            }
            search = search.previous;
        }
    }
    if (tabs.O(hash)) {
        ak(hash);
        return;
    }
    if (hash.as("search-")) {
        searchclick(kH);
        return;
    }
    switch (kG) {
        case 'i':
            var dT = new summary("", "", "", "", hash);
            eB(dT);
            return;case 'r':
            var title = "";
            A(F(hash), title);
            return;    }
    kD(hash);
    return null;
}

function kD(url){
    var kI = "actormovie.php?id=" + url;
    I.get(kI, kE);
}

function kE(kF, url){
    if (kF == 'r' || kF == 'i') {
        var bB = hh(url);
        var iu = bB.query.iT('=');
        hc(iu, kF);
    }
}

function ig(){
    var ca = cG.getItem("favlist.php?");
    if (ca == null) 
        return false;
    if (ca.entities.length == 0) 
        return false;
    return true;
}

function ho(){
    return aP && aP.eQ;
}

function eV(){
    stop();
    hide();
    if (!ho()) {
        gy(true);
    }
    else 
        if (!ig()) {
            gy(false);
        }
    f("linksdiv");
}


function hn(dy){
    var query = dm[dy];
    var mX = tabs[dy];
    A(query, dw[dy], mX);
    ed("tab", dy, dw[dy]);
    kC(dw[dy]);
    cS();
    if (query.as("favlist.php?")) {
        eV();
    }
    
}

var iC = null;

function ak(selected){
    if (selected == "logo") {
        fh();
    }
    for (var dy = 0; dy < tabs.length; dy++) {
        var du = tabs[dy];
        var tab = dA(du);
        if (!tab) 
            return;
        if (du == selected) {
            tab.style.backgroundImage = "url(jsimg/stackedtabswidelogonew.gif)";
            
            var left = tab.style.left;
            left = left.substring(0, left.length - 2);
            left = 0 - left;
            var jw = left + "px 42px";
            tab.style.backgroundPosition = jw;
            hn(dy);
        }
        else {
            tab.style.backgroundImage = "";
        }
    }
    iC = selected;
}

function aL(bj){
    return dA(bj);
}

function aI(du, width, left){
    var tab = document.createElement('li');
    tab.id = du;
    tab.style.width = width + "px";
    tab.style.left = left + "px";
    tab.onclick = aG;
    tab.onmouseover = jt;
    tab.style.cursor = 'pointer';
    dA("toptabs").appendChild(tab);
}

function al(){
    var kL = document.createElement('ul');
    kL.id = "toptabs";
    var jQ = dA("tabdiv");
    jQ.appendChild(kL);
    if (!eP) {
        eP = true;
        aI("logo", 185, 0);
        var dC = new Array(161, 163, 173, 160, 159);
        var bx = 186;
        for (var i = 0; i < tabs.length; i++) {
            aI(tabs[i], dC[i], bx);
            bx += dC[i] + 1;
        }
    }
}

function mP(lV){
return ah(lV);
}
function mS(lV){
return ah(lV);
}


function ah(lV){
    var e = lV || window.event; 
    var code = e.charCode || e.keyCode; 
    mI(code);
    }

function cD(){
}

cD.mW = {
    none: 0,
    ng: 13,
    nb: 37,
    mY: 38,
    na: 39,
    mZ: 40
}

function mI(code){
	if (code >= 48 && code <= 90) {
		var charCode = String.fromCharCode(code);
		switch(charCode) {
			case 'p': fG.ni("trailer");
			break;
		}
	}
	else {
		switch (code) {
			case cD.mW.nb:
			case cD.mW.mY:
			case cD.mW.na:
			case cD.mW.mZ:
				mr(code);
				break;
			case cD.mW.ng:
				aU.nf();
				break;
		}
	}
}

function ms(){
    var hash = document.location.hash;
    if (hash.substring(0, 1) == "#") {
        hash = hash.substring(1);
    }
    if (hash == null || hash == "" || hash == "home") {
        return "home";
    }
    if (aU.cR == "Searchlist") {
        return "Searchlist";
    }
    if (aU.cR == "Selectedtype") {
		return "Selectedtype";
	}	
}

function mr(direction){
var mh = ms();
    if (mh == "home") {
        zuguide.lO = "tabstype";
        ak(tabs[0]);
    }
    switch (zuguide.lO) {
        case "tabstype":
            ml(direction);
            break;
        case "Searchlist":
			if (aS) {
				aS.mr(direction);
			}
            break;
        case "prevnext":
            mj(direction);
            break;
        case "history":
            mn(direction);
            break;
		case "Selectedtype":
			mC(direction);
			break;
        default:
            if (!zuguide.lO) {
                if (mh == "Searchlist") {
                    zuguide.lO = "Searchlist";
                    aS.mr(direction);
                }
				else if (mh == "Selectedtype") {
					lP("back");
					zuguide.lO = "Selectedtype";
				}
            }
            break;
    }
}

G.prototype.mr = function(direction){
    switch (direction) {
        case cD.mW.nb:
            this.nd(-1, direction);
            break;
        case cD.mW.mY:
            this.nd(-4, direction);
            break;
        case cD.mW.na:
            this.nd(1, direction);
            break;
        case cD.mW.mZ:
            this.nd(4, direction);
            break;
    }
}


function mg(){
    f("thumbnail_highlight");
    lS("prevpage");
    lS("nextpage");
	mG();
    var mv = dA("search");
    mv.style.color = "white";
	zuguide.lO = false;
}

function mC(direction) {
	var current = mp();
	if (mi("back")) {
		switch(direction) {
			case cD.mW.mY:             
					lS("back");
					ml(cD.mW.none);  		
					break;
			case cD.mW.na:
				if (isVisibleElem("preview_off")) {
					lS("back");
					lP("preview");
				}
				break;
			case cD.mW.mZ:  
					lS("back");
					mt(-1,direction);  break;      
		}
	}
	else if (mi("preview")) {
		switch(direction) {
			case cD.mW.mY:             
					lS("preview");
					ml(cD.mW.none);  	
					break;
			case cD.mW.nb:
					lS("preview");
					lP("back");
					break;
			case cD.mW.mZ:  
					lS("preview");
					mt(-1,direction);  
					break;      
		}
	}
	else  {
		switch(direction) {
			case cD.mW.nb:
			case cD.mW.mY:         
				if (current != -1) {
					mx(current,direction);
					current = mp();
					if (current == -1) {
						if (isVisibleElem("preview_off")) {
							lP("preview");
						}
						else {
							lP("back");
						}
					}
				}
					break;
			case cD.mW.na:  
			case cD.mW.mZ:  
					var result = mt(current,direction);
					if (!result) {
		                    mn(cD.mW.none);
					}
					break;      
			case cD.mW.none:
				zuguide.lO = "Selectedtype";
				mx(-1,cD.mW.mY);
				break;

		}
	}
}

function mp() {
	var description = dA("descrip");
	if (description) {
		for (var i = 0; i < description.childNodes.length; i++) {
			var iV = description.childNodes[i];
			if (iV.nodeName == "A") {
				if (iV.className == "highlight") {
					return i;
				}
			}
		}
	}
	else {
		return -1;
	}
	return -1;
}

function mV() {
	var description = dA("descrip");
	for (var i = 0; i < description.childNodes.length; i++) {
		var iV = description.childNodes[i];
		if (iV.nodeName == "A") {
				return i;
			}
		}
	return last;
}


function mO() {
	var description = dA("descrip");
	var last = -1;
	for (var i = 0; i < description.childNodes.length; i++) {
		var iV = description.childNodes[i];
		if (iV.nodeName == "A") {
				last = i;
			}
		}
	return last;
}

function mG() {
	var current = mp();
	var description = dA("descrip");
	if (current != -1) {
		var iV = description.childNodes[current];
		iV.className = "";
	}
}

function mt(current,direction){
	var description = dA("descrip");
	var offsetTop  = 0;
	if (current != -1) {
		var iV = description.childNodes[current];
		iV.className = "";
		offsetTop = iV.offsetTop; 
	}
	for (var i = current + 1; i < description.childNodes.length; i++) {
		var iV = description.childNodes[i];
		if (iV.nodeName == "A") {
			if (direction == cD.mW.na || (direction == cD.mW.mZ && iV.offsetTop > offsetTop)) {
				iV.className = "highlight";
				return true;
			}
		}
	}
	return false;
}

function mx(current,direction){
	var description = dA("descrip");
	var offsetTop  = 2000;
	if (current == -1) {
		current = mO() + 1;
	}
	else {
		var iV = description.childNodes[current];
		iV.className = "";
		offsetTop = iV.offsetTop; 
	}
	for (var i = current - 1; i >= 0; i--) {
		var iV = description.childNodes[i];
		if (iV.nodeName == "A") {
			if (direction == cD.mW.nb || (direction == cD.mW.mY && iV.offsetTop < offsetTop)) {
				iV.className = "highlight";
				return true;
			}
		}
	}
	return false;
}


Selected.prototype.nf = function(){
	if (zuguide.lO == "Selectedtype") {
		if (mi("back")) {
			mg();
			zuguide.lO = "Searchlist";
			ax();
		}
		if (mi("preview")) {
			cl();
		}
		else {
			var current = mp();
			if (current != -1) {
				var description = dA("descrip");
				var iV = description.childNodes[current];
				var href = iV.href;
				var pos = href.nh("\'");
				if (pos.length == 2) {
					zuguide.lO = "Searchlist";
					mB(pos[0], pos[1]);
				}
			}
		}
	}
}


function ml(direction, mH){
    var mq = tabs.indexOf(iC);
    switch (direction) {
        case cD.mW.none:
            mg();
            zuguide.lO = "tabstype";
            if (!mH) {
                if (iC) {
                    ak(iC);
                }
                else {
                    ak(tabs[0]);
                }
            }
            break;
        case cD.mW.nb:
            if (mq == 0) {
                fh();
            }
            else {
                ak(tabs[mq - 1]);
            }
            break;
        case cD.mW.na:
            if (mq < tabs.length - 1) {
                ak(tabs[mq + 1]);
            }
            break;
        case cD.mW.mZ:
		    var mh = ms();
            if (mh == "Searchlist") {
				zuguide.lO = "Searchlist";
				d("thumbnail_highlight");
				aS.nc();
			}
			else if (mh == "Selectedtype") {
					lP("back");
					zuguide.lO = "Selectedtype";
			}
            break;
    }
}

function mj(direction, mE){
    switch (direction) {
        case cD.mW.none:
            mg();
            if (!mw() && !mo()) {
                if (mE == cD.mW.mY) {
                    zuguide.lO = "Searchlist";
                    d("thumbnail_highlight");
                    aS.nc();
                }
                else {
                    mn(cD.mW.none);
                }
            }
            else {
                zuguide.lO = "prevnext";
                if (mo()) {
                    lP("nextpage");
                }
                else {
                    lP("prevpage");
                }
            }
            break;
        case cD.mW.nb:
            if (mw()) {
                if (isVisibleElem("prevpage_on")) {
                    az();
                }
                if (mw()) {
                    lP("prevpage");
                    lS("nextpage");
                }
                else {
                    lP("nextpage");
                }
            }
            break;
        case cD.mW.na:
            if (mo()) {
                if (isVisibleElem("nextpage_on")) {
                    aB();
                }
                if (mo()) {
                    lP("nextpage");
                    lS("prevpage");
                }
                else {
                    lP("prevpage");
                }
            }
            break;
        case cD.mW.mY:
            mg();
            zuguide.lO = "Searchlist";
            d("thumbnail_highlight");
            aS.nc();
            break;
        case cD.mW.mZ:
            mn(cD.mW.none);
    }
}

function mn(direction){
    switch (direction) {
        case cD.mW.none:
            mg();
            zuguide.lO = "history";
            var mv = dA("search");
            mv.style.color = "#FE6700";
            
            break;
        case cD.mW.nb:
            if (isVisibleElem("left_arrow")) {
                aE();
            }
            break;
        case cD.mW.na:
            if (isVisibleElem("rt_arrow")) {
                aF();
            }
            break;
        case cD.mW.mY:
			var mh = ms();
			if (mh == "Searchlist") {
				mj(cD.mW.none, cD.mW.mY);
			}
			else if (mh == "Selectedtype") {
				mg();
				mC(cD.mW.none);
			}
            break;
    }
}

function mi(button) {
    return isVisibleElem(button + "_on");	
}

function lP(button){
    if (isVisibleElem(button + "_off")) {
        f(button + "_off");
        d(button + "_on");
    }
}

function lS(button){
    if (isVisibleElem(button + "_on")) {
        f(button + "_on");
        d(button + "_off");
    }
}


function mw(){
    return isVisibleElem("prevpage_off") || isVisibleElem("prevpage_on");
}

function mo(){
    return isVisibleElem("nextpage_off") || isVisibleElem("nextpage_on");
}


function aw(ch){

    }




function resize(){
    if (window.screen.height == 768 && window.screen.width == 1024) {
    
    }
}

function ey(id){
    var bq = dA(id);
    bq.onclick = fL;
    bq.style.cursor = 'pointer';
    bq.onmouseover = jg;
}

function fn(){
    I.get("loadmiddle.php", ar);
}

function ar(text){
    if (ar.lG) 
        return;
    var lF = dA("middle_place");
    lF.innerHTML = text;
    aQ("displayregisterspan", gj);
    aQ("forgotpasswordspan", gH);
    aQ("spanlogout", ij);
    aQ("spanmodify", hT);
    cu("loginformuser", gZ);
    cu("loginformpass", gZ);
    aQ("loginsubmit", ix);
    cu("regfirstname", gW);
    cu("reglastname", gW);
    cu("regusername", gW);
    cu("regusername", gW);
    cu("regpassconfirm", gW);
    cu("regemailaddress", gW);
    aQ("registerbutton", gx);
    aQ("cancelregbutton", eu);
    aQ("forgotbutton", io);
    aQ("cancelforgotbutton", eu);
    aQ("responsebutton", iQ);
    ir("logininfodiv", hD);
    iy("login", hv);
    ey("movie_id");
    ey("recommended_id");
    ey("dvd_id");
    ey("actor_id");
    fW();
    iI();
    ar.lG = true;
}

function aQ(ct, click){
    var bq = dA(ct);
    if (bq) {
        bq.onclick = click;
    }
}

function iy(ct, bU){
    var bq = dA(ct);
    if (bq) {
        bq.onmouseout = bU;
    }
}

function ir(ct, bU){
    var bq = dA(ct);
    if (bq) {
        bq.onmouseover = bU;
    }
}

function cu(ct, bU){
    var bq = dA(ct);
    if (bq) {
        bq.onfocus = bU;
    }
}

function hE(text){
    var helpdiv = dA("helpdiv");
    helpdiv.innerHTML = text;
    iI("tab");
    }

function kC(jU){
    if (!jU || jU == ".html") {
        var xxx = 3;
    }
    if (!jU.bV(".html")) {
        jU += ".html";
    }
    if (typeof(ky) == 'undefined') {
        ky = null;
    }
    if (!ky) {
        kB();
    }
    if (ky) {
        try {
            ky._trackPageview(jU);
        } 
        catch (kA) {
            ky = null;
        }
    }
}

function kB(){
    if (location.hostname == "localhost") 
        return;
    var kz = "UA-6352812-1";
    if (location.hostname.bV("zuads.com")) {
        kz = "UA-6352812-2";
    }
    try {
        ky = _gat._getTracker(kz);
        if (ky) {
            ky._trackPageview();
        }
    } 
    catch (kA) {
        ky = null;
    }
}

function gm(id){
    if (this.id) {
        id = this.id.substring(this.id.indexOf("help") + 4);
    }
    ed("showhelp", id, "");
    kC("help/" + id);
    aD("middle_cont");
    bk("helpdiv");
    zuguide.hg = id;
    I.get("help.php?itn&h=" + id, hE);
    eh("#help" + id);
    window.scrollTo(0, 0);
    id += "3";
}

function fA(jY, id){
    var bi = dA(id + "help" + jY);
    if (bi) {
        bi.removeAttribute("href");
        bi.onclick = gm;
        bi.style.cursor = 'pointer';
    }
}

function iI(id){
    if (id == undefined) 
        id = "";
    fA("about", id);
    fA("registration", id);
    fA("faq", id);
    fA("contact", id);
    fA("rss", id);
}


function aq(){
    var height = 83;
    al();
    var hV = k("preview_bkgd", 1024, 721, 0, 48, false);
    hV.style.zIndex = 1;
    fn();
    k("srch_title_lg", 451, 28, 285, 723, false);
    r("search", 350, 24, 330, 714, true, "search");
    var bQ = k("left_arrow", 14, 24, 290, 725, false, ".gif");
    if (bQ) {
        bQ.onclick = aE;
        bQ.style.cursor = 'pointer';
    }
    var cX = k("rt_arrow", 14, 24, 718, 725, false, ".gif");
    if (cX) {
        cX.onclick = aF;
        cX.style.cursor = 'pointer';
    }
    ez = new fc(B() + "largethumbreplacement" + ".jpg", 570, 359);
    
    setTimeout(T, 2500);
    setTimeout(lK, 2000);
    }

function dV(){
    var dY = aT.dU;
    if (dY.length > 0) {
        var url = "http://www.amazon.com/gp/product/" + dY +
        "?ie=UTF8&tag=visibleworld-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=" +
        dY;
        window.open(url);
        ed("amazon", aT.id, aT.title);
    }
}

function dW(){
    var dX = aT.dX;
    if (dX.length > 0) {
        var url = "http://video.barnesandnoble.com/search/product.asp?z=y&EAN=" +
        dX +
        "&itm=1";
        window.open(url);
        ed("bn", aT.id, aT.title);
    }
}


function hk(){
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return true;
    }
    else {
        return false;
    }
}

function hide(){
    fG.lk("trailer");
    fG.lk("advert");
}

function aA(){
    dA('playerdiv').style.visibility = "visible";
}

function ln(){
    var gi = navigator.userAgent;
    if (gi.indexOf("iPhone") > 0) {
        if (aT.cw.length > 0) {
            document.location = aT.cw;
        }
        return false;
    }
    if (!aT || aT.cw.length == 0) {
return false;
    }
    return true;
}

function cl(){
    if (!ln()) 
        return;
    if (ku()) {
        kw();
    }
    else 
        if (aT && aT.ha) {
            var lp = fG.dK("advert");
            if (lp) {
                lp.gr("PLAY");
            }
        }
        else {
            var movie = fG.fb("trailer");
            if (movie) {
                log("calling play from cl");
                if (!movie) {
                    log("movie is null");
                }
                movie.gr("PLAY");
            }
        }
    ed("preview", aT.id, aT.title);
}

function ku(){
    if (zuguide.kv == null || zuguide.kv.major < 9) {
        zuguide.kv = swfobject.getFlashPlayerVersion(); 
        ed("flashversion", zuguide.kv.major + '.' + zuguide.kv.minor + "." + zuguide.kv.release, "");
        
    }
    if (zuguide.kv.major < 9) {
        return true;
    }
    return false;
}

function kw(){
    var url = "http://www.adobe.com/go/getflashplayer";
    window.open(url);
    ed("getflash", aT.id, aT.title);
}

function ly(){
    var gi = navigator.userAgent;
    if (gi) 
        return (gi.indexOf("iPhone") > 0);
    return false;
    
}

function lK(){
    if (lK.eL) 
        return;
    else 
        lK.eL = true;
    lA();
    if (!ly() && ku()) {
        k("getflashplayer", 160, 41, 837, 76, true, ".jpg", kw);
    }
    lI("back", 80, 30, 600, 76, ax);
    ab("preview", 97, 30, 897, 76, cl);
    lI("add_favorites", 175, 35, 263, 654, fd);
    lI("del_favorites", 217, 35, 263, 654, dQ);
    aY("amazon_button", 217, 35, 480, 654, dV);
    aY("bn_button", 217, 35, 697, 654, dW);
    L("bigimage", 570, 359, 21, 70);
    var iU = k("transparentplay", 40, 38, 286, 231, false, ".png");
    if (iU) {
        iU.onclick = cl;
        iU.style.cursor = 'pointer';
    }
    var bannertop = L("bannertop", 468, 60, 81, 490, true, kQ);
    bannertop.src = "jsimg/transparentthumb.gif";
    L("bannerbottom", 468, 60, 81, 560, false, kQ);
    kM();
    r("descrip", 357, 450, 610, 142, false, "descrip");
    r("toptitle", 372, 29, 610, 92, false, "toptitle");
    r("bigtitle", 555, 30, 27, 430, false, "bigtitle");
    var bM = k("flvplayercontrols", 570, 20, 21, 429, true);
    if (bM) {
        bM.onclick = cl;
        bM.style.cursor = 'pointer';
    }
    
    K();
    kh();
    var t = fJ("addtoany", 500, 100, 100, 100, false);
    at();
    }

function at(){
    var t = dA("addtoany");
    t.innerHTML = "<a class='a2a_dd' id = 'a3" + getTime() + "'  href='http://www.addtoany.com/share_save'> \
	<img src='jsimg/share-save.jpg' width='412' height='40' border='0' alt='Share/Save/Bookmark'/></a>";
}

function lU(){
    var cy = dA("descrip");
    if (cy) {
        var t = dA("addtoany");
        if (t) {
            d("addtoany");
            bottom = 129 + 35 + cy.clientHeight;
            t.style.left = "593px";
            t.style.top = bottom + "px";
        }
        at();
        a2a_linkname = aT.title + " on Zuguide.com";
        var mF = "http://www.zuguide.com/" + aT.url + ".html";
        a2a_linkurl = mF;
        a2a_track_links = 'a2a';
        a2a_init('page');
    }
}

function lT(){
    var dg = dA("sharethis_0");
    if (dg) {
        dg.style.position = "absolute";
        dg.style.zIndex = 10;
        f("sharethis_0");
    }
}

function lW(lQ){
    alert(lQ.title);
}

function T(){
    if (eO) 
        return;
    eO = true;
    var iY = k("bkgd", 1024, 721, 0, 48, false);
    iY.style.zIndex = 1;
    lA();
    k("thumbswithtitlebars", 989, 580, 18, 67, false);
    aK = "a";
    var border = k("thumbnail_highlight", 229, 176, 42, 86, false, ".gif");
    for (var y = 0; y < 3; y++) {
        for (var x = 0; x < 4; x++) {
            var index = 1 + y * 4 + x;
            var image = L("thumba" + index, 219, 138, 47 + x * 238, 91 + y * 183, false, imageclick, gG); 
            image.onmouseout = gQ;
            image = L("thumbb" + index, 219, 138, 47 + x * 238, 91 + y * 183, false, imageclick, gG); 
            image.onmouseout = gQ;
            fJ("background" + index, 219, 40, 47 + x * 238, 242 + y * 183, true);
            r("titletext" + index, 219, 40, 47 + x * 238, 243 + y * 183, false, "tagline");
            }
    }
    var cC = k("prevpage_off", 93, 33, 26, 655, false, ".jpg", az);
    var mU = k("prevpage_on", 93, 33, 26, 655, false, ".jpg", az);
    var cn = k("nextpage_off", 93, 33, 903, 655, false, ".jpg", aB);
    var mT = k("nextpage_on", 93, 33, 903, 655, false, ".jpg", aB);
    kh();
    var lZ = dA("linksdiv");
    lZ.style.top = "727px";
    r("pagetext", 450, 33, 242, 655, false, "pagetextinfo");
    }



function er(X, Y){
    var mc;
    mc = X % Y;
    return mc < 0 ? mc + Y : mc;
}

function ag(search){
    d("srch_title_lg");
    if (aU.previous != null) {
        d("left_arrow");
    }
    else {
        f("left_arrow");
    }
    if (aU.next != null) {
        d("rt_arrow");
    }
    else {
        f("rt_arrow");
    }
    
    M("search", search.title);
    document.title = "Zuguide - " + search.title;
    d("search");
}

function eB(summary){
    var selected = cG.bD(summary);
    if (selected != null) {
        aj(selected);
        aU = aT = selected;
        aT.back = aS;
    }
    D();
    ed("selected", summary.url, summary.title);
    kC(summary.url);
}

function gG(){
    if (this.id.as("thumb")) {
		var index = parseInt(this.id.substring(6), 10) - 1;
		mA(index);
	}
}

function mA(index) {
        var summary = aS.bN(index);
        if (summary == null) 
            return;
        if (summary.type == "category") {
            var query = F(summary.id);
            cG.getItem(query);
            dh = summary.id;
        }
        else {
            cG.bD(summary);
        }
}

function gQ(){
    dh = null;
}

function mD(index){
    var summary = aS.bN(index);
    if (summary == null) 
        return;
    if (summary.type == "category") {
        var title = summary.title.db("(");
        A(F(summary.id), title);
        ed("category", summary.id, title);
        kC(title);
    }
    else {
        eB(summary);
    }
}

function imageclick(){
    mg();
    if (this.id.as("thumb")) {
        var index = parseInt(this.id.substring(6), 10) - 1;
        mD(index);
    }
}


function jg(){
    var id = this.className;
    var title = this.title;
    if (id.as("p")) {
        id = id.substring(1);
        fe = Array(id);
        gn();
    }
    else {
        cG.getItem("data/entities.php?id=" + id);
    }
    return true;
    
}

function fL(){
    var url = this.className;
    var title = this.title;
    if (url.as("p")) {
        url = url.substring(1);
        refclick(url, title);
    }
    else {
        var dT = new summary("", "", this.title, "", url);
        eB(dT);
    }
    return true;
}

function ax(){
    stop();
    if (aT.back != null) {
        aS = aT.back;
        aU = aS;
        j();
    }
}

function setvisibility(bq, value){
    if (value == true) 
        value = 'visible';
    if (value == false) 
        value = 'hidden';
    if (bq.style.visibility != value) {
        bq.style.visibility = value;
    }
}

function cr(name, state){
    var bq = dA(name);
    if (bq != null) {
        if (state) {
            setvisibility(bq, "visible");
        }
        else {
            setvisibility(bq, "hidden");
        }
    }
}

function gR(i, state){
    var hG = "titletext" + i;
    var gA = "background" + i;
    var bq = dA(gA);
    if (bq != null) {
        setvisibility(bq, "visible");
        if (state) {
            cr(hG, true);
            bq.style.backgroundImage = "";
            bq.style.backgroundPosition = "";
        }
        else {
            M(hG, "");
            cr(gA, true);
            bq.ks = "url(jsimg/titlebarcoversoneline.gif)";
            var left = -(i - 1) * 219 + "px 0px";
            bq.style.backgroundPosition = left;
        }
    }
}

function settitlevisibility(cp){
    var state = false;
    for (var x = 1; x <= 12; x++) {
        if (x <= cp) {
            state = true;
        }
        else {
            state = false;
        }
        if (cp == 0) {
            cr("titletext" + x, false);
            cr("background" + x, false);
            
        }
        else 
            if (state || cp == 0) {
                gR(x, true);
            }
            else {
                gR(x, state);
            }
        cr("thumb" + aK + x, state);
    }
}

function je(){
    var jU = jd("confirmed");
    if (jU) {
        it("confirmed");
        fW();
    }
}

function iz(){
    je();
    
}

function eK(){
    stop()
    ed("unload");
    fs("data/entities.php?x", true);
}

function lq(){
    cl();
    }

var lH = null;
var gl = null;

function setupsoon(){
    setTimeout(iG, 0);
}

function iG(){
    setup(lH);
    if (gl) {
        setloggedin(gl);
    }
}

function setup(lJ){
    zuguide = new Zuguide();
    if (document.domain.as("www.")) {
        }
    document.onkeydown = ah;
window.focus();
    lT();
    ed("hash", location.hash, "");
    window.onfocus = iz;
    aN();
    window.onunload = eK;
    cg = new co(200);
    cG = new QueryCache();
    
    lM(lJ);
    aq();
    kB();
    if (document.location.hash.length >= 2) {
        hc(location.hash);
        setTimeout(lq, 3000);
    }
    else {
        fh();
    }
    init(lJ);
    }


fG.prototype.lz = function(){
    if (this.player) 
        return true;
    return false;
}

fG.prototype.pause = function(){
    return this.sendEvent("PLAY", null);
}

fG.prototype.mute = function(){
    return this.sendEvent("MUTE", true);
}

fG.prototype.lB = function(){
    var lu = this.sendEvent("MUTE", false);
    if (lu && this.hW) {
        this.hW = false;
        this.lj();
        this.hide();
    }
    return lu;
}

fG.prototype.lv = function(){
    if (this.player) {
        this.lj();
        return this.sendEvent("PLAY", true);
    }
    return false;
}


fG.prototype.play = function(){
    if (this.player) {
        this.lj();
        this.aA();
        return this.sendEvent("PLAY", true);
    }
    return false;
}


fG.prototype.stop = function(){
    if (this.state) {
        if (this.currentPosition > 0) {
            ed("previewprogress", aT.id, this.currentPosition);
        }
        this.sendEvent("STOP");
    }
}

function lx(id, type, bU, iteration){
    this.id = id;
    this.type = type;
    this.bU = bU;
    if (iteration == undefined) {
        iteration = 0;
    }
    this.iteration = iteration;
}

fG.ls = function(id, type, bU, iteration){
if (iteration != undefined && iteration > 99) 
        return;
    if (!fG.bY) 
        fG.bY = new Array();
    var bY = new lx(id, type, bU, iteration);
    fG.bY.push(bY);
    fG.lg();
}

fG.fO = function(id){
    var movie = fG.dK(id);
    if (movie && movie.state) {
        if (movie.currentPosition > 0) {
            ed("previewprogress", movie.id + ' ' + aT.id, movie.currentPosition);
        }
        movie.sendEvent("STOP");
    }
}

fG.lk = function(id){
    var movie = fG.fb(id);
    if (movie) {
        movie.hide();
    }
}

fG.ni = function(id){
    var movie = fG.fb(id);
    if (movie) {
        movie.aA();
    }
}


fG.fb = function(id){
    if (fG.ids) {
        return fG.ids[id];
    }
}

function le(){
    fG.le();
}

fG.le = function(){
    if (!fG.bY) 
        fG.bY = new Array();
    var result = false;
    var bY = null;
    if (fG.bY.length) {
        bY = fG.bY.shift();
    }
    if (bY) {
        var movie = fG.fb(bY.id);
if (movie && movie.player) {
            switch (bY.type) {
                case "TIME":
                case "STATE":
                    result = movie.addModelListener(bY.type, bY.bU);
                    break;
                case "CACHEPLAY":
                    result = movie.lv();
                    break;
                case "PLAY":
result = movie.play();
                    break;
                case "PAUSE":
                    result = movie.pause();
                    break;
                case "MUTE":
                    result = movie.mute();
                    break;
                case "UNMUTE":
                    result = movie.lB();
                    break;
                default:
                    result = true;
                    break;
            }
        }
if (!result) {
            fG.ls(bY.id, bY.type, bY.bU, bY.iteration + 1);
            return;
        }
    }
    fG.lg();
}

fG.lg = function(){
    if (fG.lh) 
        clearTimeout(fG.lh);
    if (fG.bY.length) {
        fG.lh = setTimeout(le, 100);
    }
    else {
        fG.lh = null;
    }
}


function fG(id, file, width, height, left, top, controlbar){
    if (!controlbar) {
        controlbar = 'over';
    }
    if (!fG.lC) 
        fG.lC = null;
    if (!fG.ids) 
        fG.ids = new Array();
    if (!fG.bY) 
        fG.bY = new Array();
    fG.ids[id] = this;
    this.kx = false;
    this.hW = false;
    this.lf = false;
    this.eg = false;
    this.player = null;
    this.width = width;
    this.height = height;
    this.id = id;
    this.div = id + "div";
    var placeholder = id + "placeholder";
    var playerdiv = fJ(this.div, 1, 1, left, top, true);
    playerdiv.style.zIndex = 10;
    playerdiv.innerHTML = "<p id='" + placeholder + "'>xxx</p>";
    this.reset();
    this.dM(id, file, placeholder, controlbar);
    }

fG.prototype.dM = function(lD, filename, placeholder, controlbar){
    if (ku()) 
        return;
    var flashvars = {
        file: filename,
        autostart: "false",
        stretching: "uniform",
        controlbar: controlbar
    }
    var fz = {
        allowfullscreen: "true",
        allowscriptaccess: "always"
    }
    var attributes = {
        id: lD,
        name: lD
    }
    swfobject.embedSWF("player.swf", placeholder, "0", "0", "9", "", flashvars, fz, attributes);
    this.kx = true;
}

fG.prototype.reset = function(){
    this.currentPosition = -1;
    this.state = null;
    this.da = null;
};

fG.prototype.loadFile = function(file){
    this.reset();
    this.sendEvent("LOAD", file);
    this.cache();
}

fG.prototype.lj = function(){
    var div = dA(this.div);
    if (!this.eg) {
        this.player.width = this.width;
        this.player.height = this.height;
        this.eg = true;
    }
    if (!this.hW) {
        div.style.width = this.width + "px";
        div.style.height = this.height + "px";
    }
}


fG.prototype.hide = function(){
    if (this.player) {
        dA(this.div).style.visibility = "hidden";
        dA(this.id).style.visibility = "hidden";
    }
    
}

fG.prototype.aA = function(){
    if (this.player) {
        dA(this.div).style.visibility = "visible";
        dA(this.id).style.visibility = "visible";
    }
}

fG.prototype.sendEvent = function(dH, cE){
    if (cE == undefined) {
        cE = null;
    }
    if (this.player) {
        try {
            this.player.sendEvent(dH, cE);
        } 
        catch (ex) {
            var dI = 3;
            return false;
        }
        return true;
    }
    return false;
};


function playerReady(fv){
try {
        var movie = fG.fb(fv.id);
if (movie) {
            movie.player = dA(fv.id);
            movie.addListeners();
        }
    } 
    catch (e) {
        var dI = e;
    }
    var lE = 3;
}

fG.prototype.addModelListener = function(type, bU){
    try {
        if (this.player) {
            this.player.addModelListener(type, bU);
            if (this.player.getConfig().mute) {
                this.lf = true;
            }
            return true;
        }
    } 
    catch (e) {
        var error = type + e;
    }
    return false;
}

fG.prototype.gr = function(type, bU){
fG.ls(this.id, type, bU);
}

fG.prototype.cache = function(){
    if (this.player) {
        var lw = this.player.getConfig();
        var volume = lw.volume;
        this.hW = true;
        if (!this.lf) {
            this.gr("MUTE");
        }
        this.gr("CACHEPLAY");
        var xxx = 3;
        
    }
}

fG.prototype.addListeners = function(){
    this.gr("TIME", "eU");
    this.gr("STATE", "dL");
}

function dL(jr){ 
    if (jr.id == "advert" && jr.newstate == "COMPLETED") {
        lo();
        var lp = fG.dK("advert");
        lp.hide();
    }
    var movie = fG.fb(jr.id);
    if (movie) {
        var lw = movie.player.getConfig();
        movie.state = jr.newstate;
        movie.da = jr.oldstate;
        if ((movie.state == "COMPLETED") && (movie.da == "PLAYING")) {
            }
        if (movie.state == "PLAYING" && movie.hW) {
            movie.gr("PAUSE");
            movie.gr("UNMUTE");
        }
    }
}

function eU(jr){
    var movie = fG.fb(jr.id);
    if (movie) {
        movie.currentPosition = jr.position;
    }
}

function lo(){
    var ld = fG.dK("trailer");
    if (ld) {
        if (ld.lz()) {
            ld.play();
        }
    }
}

function stop(){
    fG.fO("trailer");
    fG.fO("advert");
}

fG.dK = function(lc, dJ){
    var movie = fG.fb(lc);
    if (dJ == undefined) {
        return movie;
    }
    if (!dJ.bV(".flv")) {
        dJ += ".flv";
    }
    if (movie) {
        if (movie.file != dJ) {
            movie.loadFile(dJ);
        }
        return movie;
    }
    return fG.lm(lc, dJ);
}

fG.lm = function(lc, dJ){
	switch (lc) {
		case "advert":
			return new fG("advert", dJ, 570, 379, 21, 83, "none");
		case "trailer":
			return new fG("trailer", dJ, 570, 379, 21, 83);
		default:
			return null;
	}
}









