vAlign = new Class({   
	initialize: function(element){ 
		this.element = $(element);   
		var div = new Element('div', { 'class': 'nitinh-vAlign', 'styles': { 'position': 'relative' } });   
		div.set({ 'html': this.element.get('html') }) 
		this.element.set({'html':''}) 
		div.inject(this.element);   
		var ph = this.element.getSize().y; 
		var dh = div.getSize().y; 
		var mh = (ph - dh) / 2; 
		div.set('styles',{ 'top':mh }); 
	} 
});

var cookieStatus = Cookie.read('interactive');

/*
if ((Browser.Engine.version == 4 && Browser.Engine.name == 'trident') || (window.screen.height <= 768)) {
    Cookie.write('interactive', 'no', {
        duration: 365,
        domain: window.location.hostname,
        path: '/'
    });
    if (cookieStatus == null) window.showMessage = true
} else if (cookieStatus == null) {
    Cookie.write('interactive', 'yes', {
        duration: 365,
        domain: window.location.hostname,
        path: '/'
    });
    cookieStatus = 'yes'
}
if (cookieStatus == 'yes') {
    var tLoc = window.location;
    if (tLoc.pathname.length > 1) tLoc.replace('http://' + tLoc.hostname + '#' + tLoc.pathname);
    else window.addEvent('domready', function () {
        utils.checkRes();
        interactive.init()
    })
} else {
    window.addEvent('domready', function () {
        if (window.showMessage) {
            utils.showAlert();
            Cufon.replace('#lofi_alert h4');
        }
        utils.checkRes();
        utils.setCufon();
        whatsnew.init();
        utils.injectEmail();
        utils.loadMap();
        utils.accordianInit();
    })
}
*/

window.addEvent('domready', function () {
    utils.checkRes();
    utils.setCufon();
    whatsnew.init();
    utils.injectEmail();
    utils.loadMap();
    utils.accordianInit();

	// var v = new vAlign($('container'));

})



var interactive = {
    shade: null,
    body: null,
    bodyInfo: null,
    mapContainer: null,
    map: null,
    textView: null,
    xConstant: null,
    yConstant: 75,
    dragMe: null,
    dragging: false,
    init: function () {
        var a = window.interactive;
        a.body = $(document.body);
        a.bodyInfo = a.body.getSize();
        var b = new Element('div', {
            id: 'shade'
        });
        b.inject(a.body);
        a.shade = new Fx.Elements([b, $('mast_head')], {
            duration: 500,
            fps: 1000,
            link: 'cancel',
            transition: 'sine:out',
            onStart: function () {
                interactive.animating = true
            },
            onComplete: function () {
                interactive.animating = false
            }
        });
        $('footer').destroy();
        a.mapContainer = new Element('div', {
            id: 'mapContainer'
        });
        var c = new Element('div', {
            id: 'map'
        });
        c.inject(a.mapContainer);
        a.textView = new Element('div', {
            id: 'text_view'
        });
        data.preLoad = new Element('div', {
            id: 'pre_load'
        });
        $('page_home').inject(data.preLoad);
        dialogue.container = new Element('div', {
            id: 'dialogue'
        });
        dialogue.container.style.display = 'none';
        dialogue.loaderObj = new Element('div', {
            id: 'loader'
        });
        dialogue.projectObj = new Element('div', {
            id: 'project_info_window'
        });
        var d = new Element('div', {
            id: 'spinner'
        });
        d.inject(dialogue.loaderObj);
        dialogue.loaderObj.inject(dialogue.container);
        dialogue.projectObj.inject(dialogue.container);
        a.mapContainer.inject(b, 'before');
        dialogue.container.inject(b, 'after');
        a.textView.inject(b, 'after');
        data.preLoad.inject(dialogue.container, 'after');
        a.map = new Fx.Morph(c, {
            duration: 1500,
            fps: 1000,
            transition: 'quad:out',
            onStart: function () {
                interactive.animating = true
            },
            onComplete: function () {
                interactive.map.options.duration = 500;
                interactive.map.options.transition = 'quad:in:out';
                interactive.animating = false;
                nav.interpret()
            }
        });
        a.shade.set({
            0: {
                width: a.bodyInfo.x,
                height: a.bodyInfo.y
            },
            1: {
                position: 'fixed',
                margin: '0',
                top: -126
            }
        });
        if (window.IE7) window.IE7.recalc();
        a.resize();
        var e = window.getSize();
        interactive.map.set({
            top: e.y + 20
        });
        window.addEvent('resize', interactive.resize);
        data.get('load')
    },
    resize: function () {
        var a = window.interactive;
        var b = window.getSize();
        var c = a.body.getSize();
        a.xConstant = parseInt(c.x / 2, 10);
        a.xConstant = a.xConstant - 440;
        a.mapContainer.style.width = c.x + 'px';
        a.mapContainer.style.height = b.y + 'px';

        var d = utils.getSet(loc.current.coords[0], loc.current.coords[1]);
        a.map.set(d);
        a.shade.set({
            0: {
                width: c.x,
                height: b.y
            },
            1: {
                'left': a.xConstant
            }
        });
        if (window.IE7) window.IE7.recalc()
    },
    setZoneState: function (b) {
        var c = interactive;
        if (b == 'reset') loc.zones.each(function (a) {
            a.obj.className = 'zone dragging'
        });
        else {
            var d = loc.current.zone_id;
            loc.zones.each(function (a) {
                if (a.obj.id == d && a.obj.className != 'zone') a.obj.className = 'zone';
			 	else {
                if (a.obj.className != "zone secondary" && a.obj.id != d) {
                    a.obj.className = "zone secondary"
                }
            }
            });
            interactive.dragging = false
        }
    },
    setupDragDrop: function () {
        interactive.dragMe = new Drag($(interactive.map.element), {
            onStart: function () {
                if (interactive.animating == true) {
                    interactive.dragMe.stop();
                    return
                }
                if (interactive.dragging == true) {
                    interactive.dragging = false;
                    interactive.dragMe.stop()
                } else {
                    clearInterval(nav.timer);
                    interactive.dragging = true;
                    interactive.setZoneState('reset');
                    document.body.style.cursor = 'move'
                }
            },
            onComplete: function () {
                var a = this.element;
                var b = utils.determineLocation(a.style.top, a.style.left);
                var c = utils.gridToString(b[0], b[1]);

                interactive.map.options.duration = 400;
                interactive.map.options.transition = 'back:out';
                document.body.style.cursor = 'auto';
                if (window.location.hash != '#/' + c + '/') {
                    window.location.hash = '/' + c + '/';
                    nav.detect(window.location.hash)
                } else {
                    var d = utils.getSet(b[0], b[1]);
                    interactive.map.start(d)
                }
            }
        })
    }
};
var loc = {
    current: {
        hash: '/load/',
        list: ['load'],
        view: null,
        zone_id: null,
        coords: [0, 1]
    },
    stored: {
        hash: null,
        list: [],
        view: null,
        zone_id: null,
        coords: [null, null]
    },
    zones: [{
        name: 'menu',
        coords: [0, 0],
        obj: null
    },
    {
        name: 'profile',
        coords: [0, 1],
        obj: null
    },
    {
        name: 'reviews',
        coords: [1, 2],
        obj: null
    },
    {
        name: 'privatedining',
        coords: [1, 0],
        obj: null
    },
    {
        name: 'home',
        coords: [1, 1],
        obj: null
    },
    {
        name: 'whatsnew',
        coords: [0, 2],
        obj: null
    },
    {
        name: 'gallery',
        coords: [2, 0],
        obj: null
    },
    {
        name: 'faq',
        coords: [2, 1],
        obj: null
    },
    {
        name: 'contact',
        coords: [2, 2],
        obj: null
    }],
    set: function (a, b, c) {
        if (a) loc.current.hash = utils.rebuildHash(a);
        if (b) {
            loc.current.list.length = 0;
            for (var x = 0; x < b.length; x++) loc.current.list[x] = b[x];
            var d = utils.getZoneIndex(loc.current.list[0]);
            loc.current.coords = loc.zones[d].coords;
            loc.current.zone_id = loc.zones[d].obj.id
        }
        if (c) loc.current.view = c
    }
};

var data = {
    job_email: "<n uers=\"znvygb:pnerref\100bevtvagbebagb\056pbz\">pnerref\100bevtvagbebagb\056pbz<\057n>".replace(/[a-zA-Z]/g, function (c) {
        return String.fromCharCode((c <= "Z" ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26)
    }),
	press_email: "<n uers=\"znvygb:cerff\100bevtvagbebagb\056pbz\">cerff\100bevtvagbebagb\056pbz<\057n>".replace(/[a-zA-Z]/g, function (c) {
        return String.fromCharCode((c <= "Z" ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26)
    }),
	events_email: "<n uers=\"znvygb:riragf\100bevtvagbebagb\056pbz\">riragf\100bevtvagbebagb\056pbz<\057n>".replace(/[a-zA-Z]/g, function (c) {
        return String.fromCharCode((c <= "Z" ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26)
    }),
    accounts_email: "<n uers=\"znvygb:nppbhagf\100bevtvagbebagb\056pbz\">nppbhagf\100bevtvagbebagb\056pbz<\057n>".replace(/[a-zA-Z]/g, function (c) {
        return String.fromCharCode((c <= "Z" ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26)
    }),
	info_email: "<n uers=\"znvygb:vasb\100bevtvagbebagb\056pbz\">vasb\100bevtvagbebagb\056pbz<\057n>".replace(/[a-zA-Z]/g, function (c) {
        return String.fromCharCode((c <= "Z" ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26)
    }),
    content: null,
    contentCount: 0,
    type: null,
    homeURLs: ['menu', 'profile', 'reviews', 'privatedining',  'whatsnew', 'gallery', 'faq', 'contact'],
    ajax: new Request.HTML({
        method: 'get',
        link: 'chain',
        url: 'http://' + window.location.host + '/',
        onRequest: function () {
            dialogue.show('loader')
        },
        onSuccess: function (a, b, c) {
            var d = window.data;
            d.preLoad.innerHTML += c;
            d.content = d.preLoad.getChildren();
            var e = d.content.getElements('a');
            utils.setAnchorIntercept(e);
            d.inject()
        },
        onFailure: function () {
            console.log('whoops!')
        }
    }),
    get: function (g, h) {
        var i = window.data;
        i.type = g;
        switch (g) {
        case 'load':
            i.contentTotal = i.homeURLs.length;
            i.homeURLs.each(function (f) {
                new Request.HTML({
                    method: 'get',
                    url: 'http://' + window.location.host + '/',
                    onSuccess: function (a, b, c) {
                        var d = window.data;
                        d.preLoad.innerHTML += c;
                        d.contentCount++;
                        if (d.contentCount == d.homeURLs.length) {
                            d.content = d.preLoad.getChildren('.zone');
                            var e = d.content.getElements('a');
                            utils.setAnchorIntercept(e);
                            d.inject()
                        }
                    }
                }).get(f + '?min=true')
            });
            break;

        default:
            break
        }
    },
    inject: function () {
        var c = window.data;
        if (c.type == 'load') {
            c.content.each(function (a) {
                a.inject(interactive.map.element);
                var b = utils.convertId(a.id);
                b = utils.getZoneIndex(b);
                loc.zones[b].obj = a
            });
            utils.injectEmail();
            utils.loadMap();
            utils.setCufon();
            utils.accordianInit();
            interactive.setupDragDrop();
            whatsnew.init();
            var d = window.getSize();
            dialogue.hide('loader');
            interactive.shade.chain(function () {
                this.start({
                    0: {
                        'top': d.y / 2,
                        'height': 0
                    },
                    1: {
                        'top': 0
                    }
                })
            },


            function () {
                this.set({
                    0: {
                        'top': 0,
                        'display': 'none'
                    }
                });
                if (window.IE7) window.IE7.recalc();
                nav.init()
            });
            interactive.shade.callChain()
        }

    }
};
var nav = {
    timer: null,
    zoneObjects: {},
    view: null,
    init: function () {
        var a = window.nav;
        if (!window.location.hash) {
            a.view = 'view-zone';
            loc.current.view = 'view-zone';
            window.location.replace('http://' + window.location.hostname + '#/home/')
			
        } else {
            var b = utils.rebuildHash(window.location.hash);
            a.view = a.determineView(b);
            loc.current.view = 'view-zone';
            window.location.replace('http://' + window.location.hostname + '#' + b)
        }
        var c = $$('#mast_head a');
        utils.setAnchorIntercept(c);
        a.timer = setInterval(function () {
            nav.detect(window.location.hash)
        },
        100)
    },
    determineView: function (a) {
        var b = nav.convert(a);
        var c = 'view-zone';
        return c
    },
    clickIntercept: function (e) {
        var a = this.href;
        if (this.rel) var b = this.rel;
        else var b = 'view-zone';
        var c = this.getParent('.zone');
        if ((c == null && interactive.dragging == false) || (c && c.className == 'zone' && interactive.dragging == false)) {
            e.preventDefault();
            if (a.test(utils.isHome)) {
                var d = a.replace(utils.isHome, '');
                if (d.length < 3) {
                    b = 'view-zone';
                    nav.view = b;
                    window.location.hash = "/home/"
                } else {
                    d = utils.rebuildHash(d);
                    nav.view = b;
                    window.location.hash = d
                }
            } 
            else window.open(this.href)
        } else e.preventDefault()
    },
    detect: function (a) {
        var b = window.nav;
        a = utils.rebuildHash(a);
        if (a != loc.current.hash) {
            clearInterval(b.timer);
            window.location.replace('http://' + window.location.hostname + '#' + a);
            loc.stored.hash = a;
            loc.stored.list = b.convert(a);
            if (!nav.view) loc.stored.view = b.determineView(a);
            else loc.stored.view = nav.view;
            nav.view = null;
            b.interpret()
        }
    },
    interpret: function () {
        var a = window.nav;
        if ((loc.current.hash == loc.stored.hash) || loc.stored.hash == null) {
            clearInterval(nav.timer);
            interactive.setZoneState();
            utils.resetStored();
            nav.setNavBar();
            nav.setTitle();
            nav.timer = setInterval(function () {
                nav.detect(window.location.hash)
            },
            100);
            return
        }

        if (loc.current.list[0] != loc.stored.list[0] && loc.current.view == 'view-zone') {
            loc.set(loc.stored.list[0], [loc.stored.list[0]]);
            var d = utils.getZoneIndex(loc.stored.list[0]);
            a.execute('move', loc.zones[d].coords);
            return
        }

    },
    execute: function (a, b) {
        switch (a) {
        case 'move':
            interactive.setZoneState('reset');
            var c = utils.getSet(b[0], b[1]);
            interactive.map.start(c);
            break;
       
        default:
            console.log('not sure what to do with: ' + a);
            break
        }
    },
    convert: function (d) {
        var e = d.split('/');
        e.each(function (a, b, c) {
            if (a == '#' || a == '') c.splice(b, 1)
        });
        return e
    },
    setNavBar: function () {
        var b = 'nav_' + loc.current.list[0];
        var c = $('navigation').getElements('li');
        c.each(function (a) {
            if (a.id == b) a.className = 'current_page';
            else a.className = ''
        })
    },
    setTitle: function () {
        var a = '';
        switch (loc.current.list[0]) {
        case 'menu':
            a = 'origin |  menu';
            break;
        case 'reviews':
            a = 'origin |  reviews';
            break;
        case 'privatedining':
            a = 'origin |  private dining';
            break;
        case 'profile':
            a = 'origin |  profile';
            break;
        case 'whatsnew':
            a = 'origin |  what\'s new';
            break;
        case 'gallery':
            a = 'origin |  gallery';
            break;
        case 'faq':
            a = 'origin |  faq';
            break;
        case 'contact':
            a = 'origin |  contact';
            break;
        default:
            a = 'origin |  taste the journey';
            break
        }
        
        document.title = a
    }
};


// WHAT'S NEW

var whatsnew = {
    blogContainer: null,
    blogPos: null,
    blogNext: null,
    blogPrev: null,
    blogEntries: null,
    init: function () {
        var a = whatsnew;
        if ($('blog_entries')) {
            a.blogContainer = $('blog_entries');
            var b = a.blogContainer.getElements('.blog_entry');
            a.blogEntries = new Fx.Elements(b, {
                duration: 500,
                fps: 1000
            });
            a.blogEntries.set({
                0: {
                    position: 'absolute',
                    opacity: 1,
                    left: 0
                },
                1: {
                    position: 'absolute',
                    opacity: 0,
                    left: 0
                },
                2: {
                    position: 'absolute',
                    opacity: 0,
                    left: 0
                },
                3: {
                    position: 'absolute',
                    opacity: 0,
                    left: 0
                },
                4: {
                    position: 'absolute',
                    opacity: 0,
                    left: 0
                },
                5: {
                    position: 'absolute',
                    opacity: 0,
                    left: 0
                },
                6: {
                    position: 'absolute',
                    opacity: 0,
                    left: 0
                },
				7: {
                    position: 'absolute',
                    opacity: 0,
                    left: 0
                },
	            8: {
	               position: 'absolute',
                   opacity: 0,
                   left: 0
            	},
				9: {
	               position: 'absolute',
                   opacity: 0,
                   left: 0
            	},
				10: {
	               position: 'absolute',
                   opacity: 0,
                   left: 0
            	},
				11: {
	               position: 'absolute',
                   opacity: 0,
                   left: 0
            	},
				12: {
	               position: 'absolute',
                   opacity: 0,
                   left: 0
            	},
				13: {
	               position: 'absolute',
                   opacity: 0,
                   left: 0
            	},
				14: {
	               position: 'absolute',
                   opacity: 0,
                   left: 0
            	},
				15: {
	               position: 'absolute',
                   opacity: 0,
                   left: 0
            	},
				16: {
	               position: 'absolute',
                   opacity: 0,
                   left: 0
            	}

            });
            a.blogNext = new Element('div', {
                id: 'btn_blog_next',
                html: 'next'
            });
            a.blogPrev = new Element('div', {
                id: 'btn_blog_prev',
                html: 'previous'
            });
            a.blogNext.addEvent('click', function () {
                whatsnew.cycle('next')
            });
            a.blogPrev.addEvent('click', function () {
                whatsnew.cycle('prev')
            });
            a.blogNext.addEvent('mouseover', function () {
                this.className = 'hovered'
            });
            a.blogNext.addEvent('mouseout', function () {
                this.className = ''
            });
            a.blogPrev.addEvent('mouseover', function () {
                this.className = 'hovered'
            });
            a.blogPrev.addEvent('mouseout', function () {
                this.className = ''
            });
            $('page_reviews').getElement('.content').adopt(a.blogNext, a.blogPrev);
            a.blogPos = 0
        }
    },
    cycle: function (a) {
        var b = whatsnew;
        var c = {};
        var d = {};
        if (a == 'next') {
            var e = b.blogPos;
            b.blogPos++;
            if (b.blogPos == b.blogEntries.elements.length) b.blogPos = 0;
            c[b.blogPos] = {
                opacity: 0,
                left: 300
            };
            d[b.blogPos] = {
                opacity: 1,
                left: 0
            };
            d[e] = {
                opacity: 0,
                left: -800
            }
        }
        if (a == 'prev') {
            var e = b.blogPos;
            b.blogPos--;
            if (b.blogPos < 0) b.blogPos = b.blogEntries.elements.length - 1;
            c[b.blogPos] = {
                opacity: 0,
                left: -300
            };
            d[b.blogPos] = {
                opacity: 1,
                left: 0
            };
            d[e] = {
                opacity: 0,
                left: 800
            }
        }
        b.blogEntries.set(c);
        b.blogEntries.start(d)
    }
};


var utils = {
    zWidth: 880,
    zHeight: 540,
    lowRes: false,
    checkRes: function () {
        var a = utils;
        a.lowRes = [screen.width, screen.height];
//		winHeight=document.all?document.body.clientHeight:window.innerHeight;
//			$('mast_head').set('styles',{margin: '50px auto 0'});
    },
    showAlert: function () {
        var a = utils;
        a.lofiAlert = new Element('div', {
            id: 'lofi_alert',
            html: '<h4>Welcome!</h4><p>Based on the settings we are able to detect from your computer, we have customized our site to best match your browser and monitor configuration. Youâ€™ll still get all the same information and images, but if you get a chance, check it out with a more recent browser and/or a larger screen for a higher-fidelity, more dynamic user-experience.</p><div id="lofi_close_button" onclick="$(\'lofi_alert\').destroy();">Continue</div>'
        });
        a.lofiAlert.inject($(document.body))
    },
    injectEmail: function () {
		if ($('info_email')) $('info_email').innerHTML = data.info_email;
        if ($('careers_email')) $('careers_email').innerHTML = data.job_email;
		if ($('press_email')) $('press_email').innerHTML = data.press_email;
		if ($('events_email')) $('events_email').innerHTML = data.events_email;
		if ($('accounts_email')) $('accounts_email').innerHTML = data.accounts_email;
    },
    
    determineLocation: function (y, x) {
        x = parseInt(x, 10);
        y = parseInt(y, 10);
        y -= interactive.yConstant;
        if (y > 100) y = 0;
        else if (y < (-1080)) y = -(1080);
        x -= interactive.xConstant;
        if (x > 0) x = 0;
        else if (x < -(1620 + interactive.xConstant)) x = 1620 + interactive.xConstant;
        x = Math.abs(x);
        y = Math.abs(y);
        var a = x % utils.zWidth;
        var b = y % utils.zHeight;
        var c = (x - a) / utils.zWidth;
        var d = (y - b) / utils.zHeight;
        if (a > 440) c++;
        if (b > 270) d++;
        return [d, c]
    },
    setCufon: function () {
        Cufon.replace('.title_blurb h3');
        if (Browser.Engine.name != 'trident') {
            Cufon.replace('h2');
            Cufon.replace('.blurb');
            Cufon.replace('.blog_entry h3');
            Cufon.replace('.accordian_handle');
			Cufon.replace('.title_blurb p');
			Cufon.replace('.title_blurb li');
			//Cufon.replace('#navigation li a');
        }
    },
    getSet: function (y, x) {
        return {
            top: -(y * utils.zHeight) + interactive.yConstant,
            left: -(x * utils.zWidth) + interactive.xConstant - 4
        }
    },
    gridToString: function (a, b) {
        var c;
        for (var x = 0; x < loc.zones.length; x++) {
            if (loc.zones[x].coords[0] == a && loc.zones[x].coords[1] == b) {
                c = loc.zones[x].name;
                break
            }
        }
        return c
    },
    stripHash: function (a) {
        return a.replace(/#/, '')
    },
    convertId: function (a) {
        return a.replace(/page_/, '')
    },
    rebuildHash: function (d) {
        d = d.split('/');
        var e = '/';
        d.each(function (a, b, c) {
            if (a != '#' && a != '') e += d[b] + '/'
        });
        return e
    },
    getZoneIndex: function (a) {
        var b;
        for (var x = 0; x < loc.zones.length; x++) {
            if (loc.zones[x].name == a) {
                b = x;
                break
            }
        }
        return parseInt(b, 10)
    },
    setAnchorIntercept: function (b) {
        b.each(function (a) {
            a.addEvent('click', nav.clickIntercept)
        })
    },
    isHome: new RegExp('http://' + window.location.hostname),
    resetStored: function () {
        loc.stored.hash = null;
        loc.stored.list.length = 0;
        loc.stored.coords = [null, null];
        loc.stored.view = null;
        loc.stored.zone_id = null
    },
    getPresIndex: function (c) {
        var d = 0;
        return d
    },
    refreshLocation: function () {
        var a = $('hifi').checked;
        if (a == true) {
            Cookie.write('interactive', 'yes', {
                duration: 365,
                domain: window.location.hostname,
                path: '/'
            });
            var b = window.location;
            if (b.pathname.length > 1) b.replace('http://' + b.hostname + '#' + b.pathname);
            else window.location.reload()
        } else {
            Cookie.write('interactive', 'no', {
                duration: 365,
                domain: window.location.hostname,
                path: '/'
            });
            var c = '/';
            for (var x = 0; x < loc.current.list.length; x++) c += loc.current.list[x] + '/';
            if (loc.current.list[0] == 'home') window.location = 'http://' + window.location.hostname;
            else window.location = 'http://' + window.location.hostname + c
        }
    },
    loadMap: function () {
        if (GBrowserIsCompatible() && $('location_map')) {
            var a = new GMap2($('location_map'));
            var b = new GClientGeocoder();
            var c = new GLatLng(43.649978, -79.374117);
            var d = '<strong>Origin</strong><br/>107/109 King St. East<br />Toronto, ON&nbsp;&nbsp;&nbsp;M5C 1G6<br />416 603 8009';
            d += "<br /><br />";
            d += "<a href=\"http://maps.google.com/maps?daddr=107+King+St+E,+Toronto,+ON,+Canada\" target=\"_new\">[ Get directions ]</a><br/>&nbsp;";
            var e = new GIcon();
            e.image = "http://origintoronto.com/wp-content/themes/origin/images/origin_icon.png";
            e.shadow = "http://origintoronto.com/wp-content/themes/origin/images/origin_icon_shadow.png";
            e.iconSize = new GSize(35, 35);
            e.shadowSize = new GSize(35, 20);
            e.iconAnchor = new GPoint(15, 25);
            e.infoWindowAnchor = new GPoint(30,10);
            a.addControl(new GSmallMapControl());
            a.addControl(new GMapTypeControl());
            a.addControl(new GScaleControl());
            a.setCenter(c, 15);
            var f = new GMarker(c, e, {
                clickable: true
            });
            a.addOverlay(f);
            f.openInfoWindowHtml(d)
        }
    },

    accordianInit: function () {
        if ($('page_menu')) {
            $('page_menu').getElement('.content').style.height = '520px';
            interactive.accordion = new Fx.Accordion($$('.accordian_handle'), $$('.accord_el'), {
                display: 0,
                alwaysHide: false,
                initialDisplayFx: false,
                duration: 360,
                transition: 'sine:out',
                onActive: function (b) {
                    $$('.accordian_handle').each(function (a) {
                        a.className = 'accordian_handle'
                    });
                    b.className = 'accordian_handle open'
                }
            })
        }
    }
};

var dialogue = {
    container: null,
    loaderObj: null,
    projectObj: null,
    show: function (a) {
        var b = dialogue;
        switch (a) {
        case 'loader':
            b.loader('show');
            break;
        case 'project-info':
            b.project('show');
            break;
        default:
            break
        }
    },
    hide: function (a) {
        var b = dialogue;
        switch (a) {
        case 'loader':
            b.loader('hide');
            break;
        case 'project-info':
            b.project('hide');
            break;
        default:
            break
        }
    },
    loader: function (a) {
        var b = dialogue;
        if (a == 'show') {
            b.container.style.display = 'block';
            b.loaderObj.style.display = 'block';
            b.loaderObj.style.visibility = 'visible'
        } else {
            b.container.style.display = 'none';
            b.loaderObj.style.display = 'none';
            b.loaderObj.style.visibility = 'hidden'
        }
    },
    tempRemove: function () {
        var a = dialogue;
        dialogue.hide('project-info');
        a.container.removeEvents('click')
    }
};
