if (typeof Beast == "undefined") Beast = {};
if (typeof Beast.YAHOO == "undefined") Beast.YAHOO = {};
if (typeof Beast.YAHOO.lang == "undefined") Beast.YAHOO.lang = {};
if (typeof Beast.YAHOO.env == "undefined") Beast.YAHOO.env = {};
if (typeof Beast.YAHOO.env.ua == "undefined") Beast.YAHOO.env.ua = {};

/*	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
	is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
Beast.swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in Beast.swfobject){Beast.swfobject[X]=null}Beast.swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();

/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.8.0r4
*/
(function () {
Beast.YAHOO.env.ua.caja = navigator.cajaVersion;
var L = Beast.YAHOO.lang,
    OP = Object.prototype;
    
Beast.YAHOO.lang.isFunction = function(o){
	return (typeof o === 'function') || OP.toString.apply(o) === FUNCTION_TOSTRING;
}
Beast.YAHOO.lang.isObject = function(o){
	return (o && (typeof o === 'object' || L.isFunction(o))) || false;
}
Beast.YAHOO.lang.isArray = function(o){
	return OP.toString.apply(o) === ARRAY_TOSTRING;
}
Beast.YAHOO.lang.isString = function(o){
	return typeof o === 'string';
}
Beast.YAHOO.lang.isUndefined = function(o) {
    return typeof o === 'undefined';
}
Beast.YAHOO.lang.hasOwnProperty = (OP.hasOwnProperty) ?
    function(o, prop) {
        return o && o.hasOwnProperty(prop);
    } : function(o, prop) {
        return !L.isUndefined(o[prop]) && 
                o.constructor.prototype[prop] !== o[prop];
    };

var l = Beast.YAHOO.lang,
    isFunction = l.isFunction,
    isObject   = l.isObject,
    isArray    = l.isArray,
    _toStr     = Object.prototype.toString,
    Native     = (Beast.YAHOO.env.ua.caja ? window : this).JSON,

    _UNICODE_EXCEPTIONS = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
    _ESCAPES = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
    _VALUES  = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
    _BRACKETS = /(?:^|:|,)(?:\s*\[)+/g,
    _UNSAFE  = /^[\],:{}\s]*$/,
    _SPECIAL_CHARS = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
    _CHARS = {
        '\b': '\\b',
        '\t': '\\t',
        '\n': '\\n',
        '\f': '\\f',
        '\r': '\\r',
        '"' : '\\"',
        '\\': '\\\\'
    },
    
    UNDEFINED = 'undefined',
    OBJECT    = 'object',
    NULL      = 'null',
    STRING    = 'string',
    NUMBER    = 'number',
    BOOLEAN   = 'boolean',
    DATE      = 'date',
    _allowable = {
        'undefined'        : UNDEFINED,
        'string'           : STRING,
        '[object String]'  : STRING,
        'number'           : NUMBER,
        '[object Number]'  : NUMBER,
        'boolean'          : BOOLEAN,
        '[object Boolean]' : BOOLEAN,
        '[object Date]'    : DATE,
        '[object RegExp]'  : OBJECT
    },
    EMPTY     = '',
    OPEN_O    = '{',
    CLOSE_O   = '}',
    OPEN_A    = '[',
    CLOSE_A   = ']',
    COMMA     = ',',
    COMMA_CR  = ",\n",
    CR        = "\n",
    COLON     = ':',
    COLON_SP  = ': ',
    QUOTE     = '"';

Native = _toStr.call(Native) === '[object JSON]' && Native;

function _char(c) {
    if (!_CHARS[c]) {
        _CHARS[c] =  '\\u'+('0000'+(+(c.charCodeAt(0))).toString(16)).slice(-4);
    }
    return _CHARS[c];
}

function _revive(data, reviver) {
    var walk = function (o,key) {
        var k,v,value = o[key];
        if (value && typeof value === 'object') {
            for (k in value) {
                if (l.hasOwnProperty(value,k)) {
                    v = walk(value, k);
                    if (v === undefined) {
                        delete value[k];
                    } else {
                        value[k] = v;
                    }
                }
            }
        }
        return reviver.call(o,key,value);
    };

    return typeof reviver === 'function' ? walk({'':data},'') : data;
}
function _prepare(s) {
    return s.replace(_UNICODE_EXCEPTIONS, _char);
}

function _isSafe(str) {
    return l.isString(str) &&
            _UNSAFE.test(str.replace(_ESCAPES,'@').
                             replace(_VALUES,']').
                             replace(_BRACKETS,''));
}
function _parse(s,reviver) {
    s = _prepare(s);
    if (_isSafe(s)) {
        return _revive( eval('(' + s + ')'), reviver );
    }
    throw new SyntaxError('JSON.parse');
}
function _type(o) {
    var t = typeof o;
    return  _allowable[t] ||              // number, string, boolean, undefined
            _allowable[_toStr.call(o)] || // Number, String, Boolean, Date
            (t === OBJECT ?
                (o ? OBJECT : NULL) :     // object, array, null, misc natives
                UNDEFINED);               // function, unknown
}
function _string(s) {
    return QUOTE + s.replace(_SPECIAL_CHARS, _char) + QUOTE;
}
function _indent(s,space) {
    return s.replace(/^/gm, space);
}
function _stringify(o,w,space) {
    if (o === undefined) {
        return undefined;
    }

    var replacer = isFunction(w) ? w : null,
        format   = _toStr.call(space).match(/String|Number/) || [],
        _date    = Beast.YAHOO.lang.JSON.dateToString,
        stack    = [],
        tmp,i,len;

    if (replacer || !isArray(w)) {
        w = undefined;
    }
    if (w) {
        tmp = {};
        for (i = 0, len = w.length; i < len; ++i) {
            tmp[w[i]] = true;
        }
        w = tmp;
    }
    space = format[0] === 'Number' ?
                new Array(Math.min(Math.max(0,space),10)+1).join(" ") :
                (space || EMPTY).slice(0,10);

    function _serialize(h,key) {
        var value = h[key],
            t     = _type(value),
            a     = [],
            colon = space ? COLON_SP : COLON,
            arr, i, keys, k, v;

        if (isObject(value) && isFunction(value.toJSON)) {
            value = value.toJSON(key);
        } else if (t === DATE) {
            value = _date(value);
        }

        if (isFunction(replacer)) {
            value = replacer.call(h,key,value);
        }

        if (value !== h[key]) {
            t = _type(value);
        }

        switch (t) {
            case DATE    : // intentional fallthrough.  Pre-replacer Dates are
                           // serialized in the toJSON stage.  Dates here would
                           // have been produced by the replacer.
            case OBJECT  : break;
            case STRING  : return _string(value);
            case NUMBER  : return isFinite(value) ? value+EMPTY : NULL;
            case BOOLEAN : return value+EMPTY;
            case NULL    : return NULL;
            default      : return undefined;
        }

        for (i = stack.length - 1; i >= 0; --i) {
            if (stack[i] === value) {
                throw new Error("JSON.stringify. Cyclical reference");
            }
        }

        arr = isArray(value);

        stack.push(value);

        if (arr) { // Array
            for (i = value.length - 1; i >= 0; --i) {
                a[i] = _serialize(value, i) || NULL;
            }
        } else {   // Object
            // If whitelist provided, take only those keys
            keys = w || value;
            i = 0;

            for (k in keys) {
                if (keys.hasOwnProperty(k)) {
                    v = _serialize(value, k);
                    if (v) {
                        a[i++] = _string(k) + colon + v;
                    }
                }
            }
        }

        stack.pop();

        if (space && a.length) {
            return arr ?
                OPEN_A + CR + _indent(a.join(COMMA_CR), space) + CR + CLOSE_A :
                OPEN_O + CR + _indent(a.join(COMMA_CR), space) + CR + CLOSE_O;
        } else {
            return arr ?
                OPEN_A + a.join(COMMA) + CLOSE_A :
                OPEN_O + a.join(COMMA) + CLOSE_O;
        }
    }

    // process the input
    return _serialize({'':o},'');
}

Beast.YAHOO.lang.JSON = {
    useNativeParse : !!Native,
    useNativeStringify : !!Native,

    isSafe : function (s) {
        return _isSafe(_prepare(s));
    },

    parse : function (s,reviver) {
        return Native && Beast.YAHOO.lang.JSON.useNativeParse ?
            Native.parse(s,reviver) : _parse(s,reviver);
    },

    stringify : function (o,w,space) {
        return Native && Beast.YAHOO.lang.JSON.useNativeStringify ?
            Native.stringify(o,w,space) : _stringify(o,w,space);
    },

    dateToString : function (d) {
        function _zeroPad(v) {
            return v < 10 ? '0' + v : v;
        }

        return d.getUTCFullYear()         + '-' +
            _zeroPad(d.getUTCMonth() + 1) + '-' +
            _zeroPad(d.getUTCDate())      + 'T' +
            _zeroPad(d.getUTCHours())     + COLON +
            _zeroPad(d.getUTCMinutes())   + COLON +
            _zeroPad(d.getUTCSeconds())   + 'Z';
    },

    stringToDate : function (str) {
        var m = str.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{3}))?Z$/);
        if (m) {
            var d = new Date();
            d.setUTCFullYear(m[1], m[2]-1, m[3]);
            d.setUTCHours(m[4], m[5], m[6], (m[7] || 0));
            return d;
        }
        return str;
    }
};

Beast.YAHOO.lang.JSON.isValid = Beast.YAHOO.lang.JSON.isSafe;

})();

if (typeof Beast.Frame == "undefined") {
	Beast.FrameCount = 0;
	Beast.Frames = [];
	Beast.Frame = {
		GetViewportScroll: function() {
			if (Beast.Frames.length > 0) return Beast.Frames[0].GetViewportScroll();
			else return 0;
		},

		DocumentResized: function(Height, ScrollY) {
			if (Beast.Frames.length > 0) return Beast.Frames[0].DocumentResized(Height, ScrollY);
			else return 0;
		},

		ScrollTo: function(Y) {
			if (Beast.Frames.length > 0) return Beast.Frames[0].ScrollTo(Y);
			else return 0;
		},

		FlashReceiveMessage: function(e) {
			if (Beast.Frames.length > 0) return Beast.Frames[0].FlashReceiveMessage(e);
			else return 0;
		}
	};

	Beast.FrameConstructor = function(id) {
		Beast.FrameCount++;

		this.DomId = '_dsSearchAgent_Idx_Frame_' + id;
		this.BaseUrl = 'http://idx.diversesolutions.com/link/32232';
		this.Query = '';
		this.IdxDomain = 'idx.diversesolutions.com';
		this.ColorSchemeID = 0;
		this.FirstResize = false;
		this.WindowLoaded = false;
		this.HasPostMessage = window['postMessage'];
		this.JSON = Beast.YAHOO.lang.JSON;
		this.HasSetScrollStyle = false;
		this.LastHash = "";
		this.HasSentReferringUrl = false;

		this.GetViewportScroll = function() {
			var FrameDom = document.getElementById(this.DomId);

			var XY = this.cumulativeOffset(FrameDom);
			var ScrollTop = (window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop);

			if (ScrollTop > XY[1]) return ScrollTop - XY[1];
			else return 0
		};

		this.BuildFrame = function() {
			var BeastFrameProxy = this;

			var linkIdMatch = /linkid=(\d+)/i.exec(location.search);
			if (linkIdMatch == null) linkIdMatch = /linkid=(\d+)/i.exec(location.hash);

			if (linkIdMatch != null) {
				if (this.BaseUrl.indexOf("/link/") == -1) {
					if (this.BaseUrl.lastIndexOf("/") == this.BaseUrl.length - 1) this.BaseUrl = this.BaseUrl.substring(0, this.BaseUrl.length - 1)
					this.BaseUrl += "/link/" + linkIdMatch[1];
				} else {
					this.BaseUrl = this.BaseUrl.replace(/\/link\/(\d+)/i, "/link/" + linkIdMatch[1]);
				}
			}

			var urlhash = location.hash;
			var search = location.search;

			if (this.BaseUrl.substring(0, 1) == "#") this.BaseUrl = this.BaseUrl.substring(1);
			if (this.BaseUrl.substring(0, 1) == "/") this.BaseUrl = this.BaseUrl.substring(1);

			if (urlhash.substring(0, 1) == "#") urlhash = urlhash.substring(1);
			if (urlhash.substring(0, 1) == "&") urlhash = urlhash.substring(1);

			if (search.substring(0, 1) == "?") search = search.substring(1);
			if (search.substring(0, 1) == "&") search = search.substring(1);

			if (search != "") {
				hash = "#" + search + this.Query;
			} else if (urlhash != "") {
				hash = "#" + urlhash + this.Query;
			} else {
				hash = '#' + this.Query;
			}

			var propertySearchMatch = /PropertySearchID=([0-9]+)/.exec(location.hash);
			if (propertySearchMatch == null) { propertySearchMatch = /PropertySearchID=([0-9]+)/.exec(location.search); }

			if (propertySearchMatch) {
				this.BaseUrl += "/" + propertySearchMatch[1];
			}

			var mlsnumberMatch = /mlsnumber=(\w+)/i.exec(location.search);
			if (mlsnumberMatch == null) { mlsnumberMatch = /mlsnumber=(\w+)/i.exec(location.hash); }

			if (mlsnumberMatch) {
				this.BaseUrl += "/mlsnumber/" + mlsnumberMatch[1];
			}

			var featuredMatch = /featured/i.exec(location.search);
			if (featuredMatch == null) { featuredMatch = /featured/i.exec(location.hash); }

			if (featuredMatch) {
				this.BaseUrl += "/featured";
			}

			var featuredOfficeMatch = /featuredoffice/i.exec(location.search);
			if (featuredOfficeMatch == null) { featuredOfficeMatch = /featuredoffice/i.exec(location.hash); }

			if (featuredOfficeMatch) {
				this.BaseUrl += "/featuredoffice";
			}

			var referralMatch = /ref=([a-zA-Z0-9]+)/i.exec(location.search);
			if (referralMatch == null) { referralMatch = /ref=([a-zA-Z0-9]+)/i.exec(location.hash); }

			if (referralMatch) {
				this.BaseUrl += "/ref/" + referralMatch[1];
			}

			if (this.ColorSchemeID != 0)
				this.BaseUrl += "/colorscheme/" + this.ColorSchemeID;

			var uid = this.createUUID();
			if (!this.HasPostMessage) {
				hash += "&uid=" + uid;
			}
			//this.BaseUrl += "/";

			var DivDom = document.getElementById(this.DomId + "_div");
			FrameSrc = "<iframe id='" + this.DomId + "' name='" + this.DomId + "' src='" + this.BaseUrl + (hash == '#' ? '#-' : hash) + "' scrolling='no' style='width:auto;height:" + 2000 + "px;' frameborder='0'></iframe>";

			if (DivDom == null) {
				document.write("<div id='" + this.DomId + "_div'></div>")
				DivDom = document.getElementById(this.DomId + "_div");
			}

			DivDom.innerHTML = FrameSrc;
			this.LastHash = location.hash;

			var FrameDom = document.getElementById(this.DomId);
			if (FrameDom.parentNode.offsetWidth != 0)
				FrameDom.style.width = (FrameDom.parentNode.offsetWidth < 720 ? 720 : FrameDom.parentNode.offsetWidth) + "px";

			this.CheckReady();

			this.ThisWindowScrolledProxy = function() { BeastFrameProxy.ThisWindowScrolled(); };
			this.WindowLoadProxy = function() { BeastFrameProxy.WindowLoad(); };
			this.UnLoadProxy = function() { BeastFrameProxy.UnLoad(); };
			this.ReceiveMessageProxy = function(e) { BeastFrameProxy.ReceiveMessage(e); };

			if (window.addEventListener) window.addEventListener("scroll", this.ThisWindowScrolledProxy, false);
			else if (document.addEventListener) document.addEventListener("scroll", this.ThisWindowScrolledProxy, false);
			else if (window.attachEvent) window.attachEvent("onscroll", this.ThisWindowScrolledProxy);

			if (window.addEventListener) window.addEventListener("load", this.WindowLoadProxy, false);
			else if (document.addEventListener) document.addEventListener("load", this.WindowLoadProxy, false);
			else if (window.attachEvent) window.attachEvent("onload", this.WindowLoadProxy);

			if (window.addEventListener) window.addEventListener("unload", this.UnLoadProxy, false);
			else if (document.addEventListener) document.addEventListener("unload", this.UnLoadProxy, false);
			else if (window.attachEvent) window.attachEvent("onunload", this.UnLoadProxy);

			if (window.addEventListener) window.addEventListener("message", this.ReceiveMessageProxy, false);
			else if (document.addEventListener) document.addEventListener("message", this.ReceiveMessageProxy, false);
			else if (window.attachEvent) window.attachEvent("message", this.ReceiveMessageProxy);

			if (window.addEventListener) window.addEventListener("onmessage", this.ReceiveMessageProxy, false);
			else if (document.addEventListener) document.addEventListener("onmessage", this.ReceiveMessageProxy, false);
			else if (window.attachEvent) window.attachEvent("onmessage", this.ReceiveMessageProxy);

			if (!this.HasPostMessage) {
				var flashvars = { uid: uid };
				var params = { allowScriptAccess: "always" };
				var attributes = { name: "BeastFrameCommunicatorParent" };

				var BeastFrameCommunicatorDiv = document.createElement("div");
				BeastFrameCommunicatorDiv.id = "BeastFrameCommunicatorParent";
				FrameDom.parentNode.appendChild(BeastFrameCommunicatorDiv);

				Beast.swfobject.embedSWF("http://idx-cdn.assets.diversesolutions.com/scripts/controls/framecommunicator-parent.swf/aa20a9", "BeastFrameCommunicatorParent", "0", "0", "9.0.0", "", flashvars, params, attributes);
			}
		};

		this.FlashReceiveMessage = function(data) {
			this.ReceiveMessage({ data: data });
		};

		this.ReceiveMessage = function(e) {
			var payload = this.JSON.parse(e.data);

			switch (payload.command.toLowerCase()) {
				case "documentresized":
					this.DocumentResized(payload.data);
					break;
				case "scrollto":
					this.ScrollTo(payload.data);
					break;
				case "hashchange":
					this.HashChange(payload.data);
					break;
			}

			this.SendMessage("referringurl", document.referrer);

			try {
				e.preventDefault();
			} catch (err) { }
		};

		this.SendMessage = function(command, data) {
			var FrameDom = document.getElementById(this.DomId);
			var payload = {
				command: command,
				data: data
			};

			try {
				if (!this.HasPostMessage) {
					var movie = navigator.appName.indexOf("Microsoft") != -1 ? window["BeastFrameCommunicatorParent"] : document["BeastFrameCommunicatorParent"];
					movie.callPostMessageParent(this.JSON.stringify(payload));
				} else {
					FrameDom.contentWindow.postMessage(this.JSON.stringify(payload), "*");
				}
			} catch (e) { return false; }
		};

		this.HashChange = function(newhash) {
			location.hash = newhash;
		};

		this.CheckReady = function() {
			var BeastFrameProxy = this;
			var FrameDom = document.getElementById(this.DomId);

			if (!FrameDom.parentNode.nextSibling && !this.WindowLoaded) {
				FrameDom.style.width = (FrameDom.parentNode.offsetWidth < 720 ? 720 : FrameDom.parentNode.offsetWidth) + "px";
				setTimeout(function() { BeastFrameProxy.CheckReady(); }, 250);
			} else {
				FrameDom.style.width = (FrameDom.parentNode.offsetWidth < 720 ? 720 : FrameDom.parentNode.offsetWidth) + "px";
			}
		};

		this.UnLoad = function() {
			var BeastFrameProxy = this;

			if (window.addEventListener) window.removeEventListener("scroll", this.ThisWindowScrolledProxy, false);
			else if (document.addEventListener) document.removeEventListener("scroll", this.ThisWindowScrolledProxy, false);
			else if (window.attachEvent) window.detachEvent("onscroll", this.ThisWindowScrolledProxy);

			if (window.addEventListener) window.removeEventListener("load", this.WindowLoadProxy, false);
			else if (document.addEventListener) document.removeEventListener("load", this.WindowLoadProxy, false);
			else if (window.attachEvent) window.detachEvent("onload", this.WindowLoadProxy);

			if (window.addEventListener) window.removeEventListener("unload", this.UnLoadProxy, false);
			else if (document.addEventListener) document.removeEventListener("unload", this.UnLoadProxy, false);
			else if (window.attachEvent) window.detachEvent("onunload", this.UnLoadProxy);
		};

		this.ThisWindowScrolled = function() {
			this.SendMessage("parentscrolled", this.GetViewportScroll());
		};

		this.WindowLoad = function() {
			this.WindowLoaded = true;
			this.FixWidth();
		};

		this.FixWidth = function() {
			var FrameDom = document.getElementById(this.DomId);
			FrameDom.style.width = (FrameDom.parentNode.offsetWidth < 720 ? 720 : FrameDom.parentNode.offsetWidth) + "px";
		};

		this.DocumentResized = function(Height) {
			var FrameDom = document.getElementById(this.DomId);

			if (typeof Height != "number") Height = 2000;

			FrameDom.style.height = Height + "px";
			if (FrameDom.parentNode.offsetWidth < 720) FrameDom.style.width = "720px";

			if (!this.HasSetScrollStyle) {
				FrameDom.style.overflow = "hidden";
				FrameDom.scrolling = "no";
				this.HasSetScrollStyle = true;
			}
		};

		this.ScrollTo = function(Y) {
			var BeastFrameProxy = this;
			var FrameDom = document.getElementById(this.DomId);

			var XY = this.cumulativeOffset(FrameDom);
			var ScrollToY = XY[1] + Y;
			var StartY = (window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop);
			var DistanceY = ScrollToY - StartY;
			var ViewportHieght = document.documentElement.clientHeight;

			if (StartY < ScrollToY)
				return;

			window.scroll(0, StartY + DistanceY);

			var AfterY = (window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop);

			if (AfterY != StartY + DistanceY)
				window.setTimeout(function() { BeastFrameProxy.ScrollTo(Y); }, 250);
		};

		/* from prototype 1.6 */
		this.cumulativeOffset = function(element) {
			var valueT = 0, valueL = 0;
			do {
				valueT += element.offsetTop || 0;
				valueL += element.offsetLeft || 0;
				element = element.offsetParent;
			} while (element);
			return this._returnOffset(valueL, valueT);
		};

		/* from prototype 1.6 */
		this._returnOffset = function(l, t) {
			var result = [l, t];
			result.left = l;
			result.top = t;
			return result;
		};

		this.createUUID = function() {
			// http://www.ietf.org/rfc/rfc4122.txt
			var s = [];
			var hexDigits = "0123456789ABCDEF";
			for (var i = 0; i < 32; i++) {
				s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
			}
			s[12] = "4";  // bits 12-15 of the time_hi_and_version field to 0010
			s[16] = hexDigits.substr((s[16] & 0x3) | 0x8, 1);  // bits 6-7 of the clock_seq_hi_and_reserved to 01

			var uuid = s.join("");
			return uuid;
		};

		this.StartHashSentry = function() {
			var FrameProxy = this;

			if (this.LastHash != location.hash) this.BuildFrame();

			setTimeout(function() { FrameProxy.StartHashSentry() }, 500);
		};

		this.BuildFrame();
		this.StartHashSentry();
	};
}

Beast.Frames[Beast.FrameCount] = new Beast.FrameConstructor(Beast.FrameCount);
