(function(){var _=function(selector,root,noCache){if(_.c[selector]&&!noCache&&!root){return _.c[selector]}noCache=noCache||!!root;root=root||_.doc;var sets=[];if(/^[\w[:#.][\w\]*^|=!]*$/.test(selector)){var idx=0;switch(selector.charAt(0)){case"#":idx=selector.slice(1);sets=_.doc.getElementById(idx);if(_.browser.ie&&sets.id!==idx){sets=_.doc.all[idx]}sets=sets?[sets]:[];break;case".":var klass=selector.slice(1);if(_.k){sets=(idx=(sets=root.getElementsByClassName(klass)).length)?sets:[]}else{klass=" "+klass+" ";var nodes=root.getElementsByTagName("*"),i=0,node;while(node=nodes[i++]){if((" "+node.className+" ").indexOf(klass)!=-1){sets[idx++]=node}}sets=idx?sets:[]}break;case":":var node,nodes=root.getElementsByTagName("*"),i=0,ind=selector.replace(/[^(]*\(([^)]*)\)/,"$1"),mod=selector.replace(/\(.*/,"");while(node=nodes[i++]){if(_.mods[mod]&&!_.mods[mod](node,ind)){sets[idx++]=node}}sets=idx?sets:[];break;case"[":var nodes=root.getElementsByTagName("*"),node,i=0,attrs=/\[([^!~^*|$ [:=]+)([$^*|]?=)?([^ :\]]+)?\]/.exec(selector),attr=attrs[1],eql=attrs[2]||"",value=attrs[3];while(node=nodes[i++]){if(_.attr[eql]&&(_.attr[eql](node,attr,value)||(attr==="class"&&_.attr[eql](node,"className",value)))){sets[idx++]=node}}sets=idx?sets:[];break;default:sets=(idx=(sets=root.getElementsByTagName(selector)).length)?sets:[];break}}else{if(_.q&&selector.indexOf("!=")==-1){sets=root.querySelectorAll(selector.replace(/=([^\]]+)/,'="$1"'))}else{var groups=selector.split(/ *, */),gl=groups.length-1,concat=!!gl,group,singles,singles_length,single,i,ancestor,nodes,tag,id,klass,attr,eql,mod,ind,newNodes,idx,J,child,last,childs,item,h;while(group=groups[gl--]){if(!(nodes=_.c[group])||noCache){singles_length=(singles=group.replace(/(\([^)]*)\+/,"$1%").replace(/(\[[^\]]+)~/,"$1&").replace(/(~|>|\+)/," $1 ").split(/ +/)).length;i=0;ancestor=" ";nodes=[root];while(single=singles[i++]){if(single!==" "&&single!==">"&&single!=="~"&&single!=="+"&&nodes){single=single.match(/([^[:.#]+)?(?:#([^[:.#]+))?(?:\.([^[:.]+))?(?:\[([^!&^*|$[:=]+)([!$^*|&]?=)?([^:\]]+)?\])?(?:\:([^(]+)(?:\(([^)]+)\))?)?/);tag=single[1]||"*";id=single[2];klass=single[3]?" "+single[3]+" ":"";attr=single[4];eql=single[5]||"";mod=single[7];ind=mod==="nth-child"||mod==="nth-last-child"?/(?:(-?\d*)n)?(?:(%|-)(\d*))?/.exec(single[8]==="even"&&"2n"||single[8]==="odd"&&"2n%1"||!/\D/.test(single[8])&&"0n%"+single[8]||single[8]):single[8];newNodes=[];idx=J=0;last=i==singles_length;while(child=nodes[J++]){switch(ancestor){case" ":childs=child.getElementsByTagName(tag);h=0;while(item=childs[h++]){if((!id||item.id===id)&&(!klass||(" "+item.className+" ").indexOf(klass)!=-1)&&(!attr||(_.attr[eql]&&(_.attr[eql](item,attr,single[6])||(attr==="class"&&_.attr[eql](item,"className",single[6])))))&&!item.yeasss&&!(_.mods[mod]?_.mods[mod](item,ind):mod)){if(last){item.yeasss=1}newNodes[idx++]=item}}break;case"~":tag=tag.toLowerCase();while((child=child.nextSibling)&&!child.yeasss){if(child.nodeType==1&&(tag==="*"||child.nodeName.toLowerCase()===tag)&&(!id||child.id===id)&&(!klass||(" "+child.className+" ").indexOf(klass)!=-1)&&(!attr||(_.attr[eql]&&(_.attr[eql](item,attr,single[6])||(attr==="class"&&_.attr[eql](item,"className",single[6])))))&&!child.yeasss&&!(_.mods[mod]?_.mods[mod](child,ind):mod)){if(last){child.yeasss=1}newNodes[idx++]=child}}break;case"+":while((child=child.nextSibling)&&child.nodeType!=1){}if(child&&(child.nodeName.toLowerCase()===tag.toLowerCase()||tag==="*")&&(!id||child.id===id)&&(!klass||(" "+item.className+" ").indexOf(klass)!=-1)&&(!attr||(_.attr[eql]&&(_.attr[eql](item,attr,single[6])||(attr==="class"&&_.attr[eql](item,"className",single[6])))))&&!child.yeasss&&!(_.mods[mod]?_.mods[mod](child,ind):mod)){if(last){child.yeasss=1}newNodes[idx++]=child}break;case">":childs=child.getElementsByTagName(tag);i=0;while(item=childs[i++]){if(item.parentNode===child&&(!id||item.id===id)&&(!klass||(" "+item.className+" ").indexOf(klass)!=-1)&&(!attr||(_.attr[eql]&&(_.attr[eql](item,attr,single[6])||(attr==="class"&&_.attr[eql](item,"className",single[6])))))&&!item.yeasss&&!(_.mods[mod]?_.mods[mod](item,ind):mod)){if(last){item.yeasss=1}newNodes[idx++]=item}}break}}nodes=newNodes}else{ancestor=single}}}if(concat){if(!nodes.concat){newNodes=[];h=0;while(item=nodes[h]){newNodes[h++]=item}nodes=newNodes}sets=nodes.concat(sets.length==1?sets[0]:sets)}else{sets=nodes}}idx=sets.length;while(idx--){sets[idx].yeasss=sets[idx].nodeIndex=sets[idx].nodeIndexLast=null}}}return noCache?sets:_.c[selector]=sets};_.c=[];_.doc=document;_.win=window;_.attr={"":function(child,attr){return !!child.getAttribute(attr)},"=":function(child,attr,value){return(attr=child.getAttribute(attr))&&attr===value},"&=":function(child,attr,value){return(attr=child.getAttribute(attr))&&(new RegExp("(^| +)"+value+"($| +)").test(attr))},"^=":function(child,attr,value){return(attr=child.getAttribute(attr)+"")&&!attr.indexOf(value)},"$=":function(child,attr,value){return(attr=child.getAttribute(attr)+"")&&attr.indexOf(value)==attr.length-value.length},"*=":function(child,attr,value){return(attr=child.getAttribute(attr)+"")&&attr.indexOf(value)!=-1},"|=":function(child,attr,value){return(attr=child.getAttribute(attr)+"")&&(attr===value||!!attr.indexOf(value+"-"))},"!=":function(child,attr,value){return !(attr=child.getAttribute(attr))||!(new RegExp("(^| +)"+value+"($| +)").test(attr))}};_.mods={"first-child":function(child){return child.parentNode.getElementsByTagName("*")[0]!==child},"last-child":function(child){var brother=child;while((brother=brother.nextSibling)&&brother.nodeType!=1){}return !!brother},root:function(child){return child.nodeName.toLowerCase()!=="html"},"nth-child":function(child,ind){var i=child.nodeIndex||0,a=ind[3]=ind[3]?(ind[2]==="%"?-1:1)*ind[3]:0,b=ind[1];if(i){return !((i+a)%b)}else{var brother=child.parentNode.firstChild;i++;do{if(brother.nodeType==1&&(brother.nodeIndex=++i)&&child===brother&&((i+a)%b)){return 0}}while(brother=brother.nextSibling);return 1}},"nth-last-child":function(child,ind){var i=child.nodeIndexLast||0,a=ind[3]?(ind[2]==="%"?-1:1)*ind[3]:0,b=ind[1];if(i){return !((i+a)%b)}else{var brother=child.parentNode.lastChild;i++;do{if(brother.nodeType==1&&(brother.nodeLastIndex=i++)&&child===brother&&((i+a)%b)){return 0}}while(brother=brother.previousSibling);return 1}},empty:function(child){return !!child.firstChild},parent:function(child){return !child.firstChild},"only-child":function(child){return child.parentNode.getElementsByTagName("*").length!=1},checked:function(child){return !child.checked},lang:function(child,ind){return child.lang!==ind&&_.doc.documentElement.lang!==ind},enabled:function(child){return child.disabled||child.type==="hidden"},disabled:function(child){return !child.disabled},selected:function(elem){child.parentNode.selectedIndex;return !child.selected}};_.isReady=0;_.ready=function(fn){if(typeof fn==="function"){if(!_.isReady){_.ready.list[_.ready.list.length]=fn}else{fn()}}else{if(!_.isReady){_.isReady=1;var idx=_.ready.list.length;while(idx--){_.ready.list[idx]()}}}};_.ready.list=[];_.bind=function(element,event,fn){if(typeof element==="string"){var elements=_(element),idx=0;while(element=elements[idx++]){_.bind(element,event,fn)}}else{event="on"+event;var handler=element[event];if(handler){element[event]=function(){handler();fn()}}else{element[event]=fn}}};_.ua=navigator.userAgent.toLowerCase();_.k=!!_.doc.getElementsByClassName;_.browser={safari:_.ua.indexOf("webkit")!=-1,opera:_.ua.indexOf("opera")!=-1,ie:_.ua.indexOf("msie")!=-1&&_.ua.indexOf("opera")==-1,mozilla:_.ua.indexOf("mozilla")!=-1&&(_.ua.indexOf("compatible")+_.ua.indexOf("webkit")==-2)};_.q=!!_.doc.querySelectorAll&&!_.browser.ie&&!_.browser.opera;if(_.doc.addEventListener&&!_.browser.opera){_.doc.addEventListener("DOMContentLoaded",_.ready,false)}if(_.browser.ie&&_.win==top){(function(){if(_.isReady){return}try{_.doc.documentElement.doScroll("left")}catch(e){setTimeout(arguments.callee);return}_.ready()})()}if(_.browser.opera){_.doc.addEventListener("DOMContentLoaded",function(){if(_.isReady){return}var i=0,ss;while(ss=_.doc.styleSheets[i++]){if(ss.disabled){setTimeout(arguments.callee);return}}_.ready()},false)}if(_.browser.safari){(function(){if(_.isReady){return}if((_.doc.readyState!=="loaded"&&_.doc.readyState!=="complete")||_.doc.styleSheets.length!==_("style,link[rel=stylesheet]").length){setTimeout(arguments.callee);return}_.ready()})()}_.bind(_.win,"load",_.ready);_.modules={yass:[]};_.load=function(aliases,text){var loader=function(alias,text,tries,aliases){if(!(tries%100)&&_.modules[alias].status<2){_("head")[0].removeChild(_("script[title="+alias+"]")[0]);_.modules[alias].status=0;if(!(tries-=1000)){_.modules[alias].status=-1;return}}switch(_.modules[alias].status){case 2:try{eval(text)}catch(a){}case 3:case -2:break;default:_.modules[alias].status=1;var script=_.doc.createElement("script");script.src=alias.indexOf(".js")+alias.indexOf("/")!=-2?alias:_.base+"yass."+alias+".js";script.type="text/javascript";script.text=text||"";script.title=alias;script.onreadystatechange=function(){if(this.readyState==="complete"){_.postloader(this)}};script.onload=function(e){_.postloader(e.srcElement||e.target)};_("head")[0].appendChild(script);case 1:setTimeout(function(){loader(alias,text,--tries,aliases)},100);break}},idx=0,alias,a;aliases=aliases.split("#");_.base=_.base||_("script[src*=yass.]")[0].src.replace(/yass[^\/]*\.js$/,"");while(alias=aliases[idx++]){if(!_.modules[alias]){_.modules[alias]={};_.modules.yass[_.modules.yass.length]=alias}_.modules[alias].deps=_.modules[alias].deps||{yass:[]};_.modules[alias].notloaded=_.modules[alias].notloaded||0;if((a=aliases[idx-2])&&a!==alias&&!_.modules[alias].deps[a]){_.modules[alias].deps[a]=1;_.modules[alias].deps.yass[_.modules[alias].deps.yass.length]=a;_.modules[alias].notloaded++}if(!_.modules[alias].status&&!(_.modules[alias].status-=2)){_.modules[alias].status=0;loader(alias,text,11999,aliases)}}};_.postloader=function(e){if(_.browser.opera){try{eval(e.innerHTML)}catch(a){}}var module=_.modules[e.title],aliases=module.deps.yass,idx=aliases.length-1;module.status=3;while(aliases[idx]&&_.modules[aliases[idx]].status==2&&idx--){}if(idx>-1){return}module.status=2;if(module.init){module.init()}var modules=_.modules.yass,recursive=function(title){var dep,alias,idx=0;while(alias=modules[idx++]){dep=_.modules[alias];if(dep.deps[title]&&!(--dep.notloaded)&&dep.status==3){dep.status=2;if(dep.init){dep.init()}recursive(alias)}}};recursive(e.title)};_.win._=_.win._||(_.win.yass=_)})();_.ready(function(){var c=_("[class^=yass-module-]"),d,b=c.length,a=0;while(a<b){d=c[a++];_.load(d.className.slice(d.className.indexOf("yass-module-")+12),d.title);d.title=null}});
document.documentElement.id='js';

function initJS() {

    /* Login and Register */
    var loginLightboxButton = _('.wp-header-link-login');
    for(var i = 0; i < loginLightboxButton.length; i++) {
        addEvent(loginLightboxButton[i], 'click', function(e){
            noDefaultAction(e);
            wsLightboxOpen('form-login');
        });
    }

    var registerLightboxButton = _('.wp-header-index-cta .wp-button-orange, .wp-content-common-restrictor .wp-button-orange, .wp-header-link-create-account');
    for(i = 0; i < registerLightboxButton.length; i++) {
        addEvent(registerLightboxButton[i], 'click', function(e){
            noDefaultAction(e);
            wsLightboxOpen('form-register');
        });
    }

    /* Index page Tour */
    var tourLightboxButton = _('.wp-header-index-tour, .wp-links-tour');
    for(i = 0; i < tourLightboxButton.length; i++) {
        addEvent(tourLightboxButton[i], 'click', function(e){
            /*noDefaultAction(e);*/
            wsLightboxOpen('tour');
        });
    }

    var tourButton = _('.wp-product-tour-slide-prev, .wp-product-tour-slide-next');
    for(i = 0; i < tourButton.length; i++) {
        addEvent(tourButton[i], 'click', function(e){
            noDefaultAction(e);
            var slideStep = 1100;
            var slidesContainer = this.parentNode.parentNode.parentNode;
            var step = parseInt(this.parentNode.parentNode.className.replace(/[^0-9]/g,''));
            if(this.className.search('prev') != -1) {
                step -= 2;
            }
            slidesContainer.style.left = -(step * slideStep) + "px";
        });
    }


    /* Close message boxes */
    function messageHide(delay) {
		var messageBox = _('.wp-message');
		if (messageBox.length) {
			messageBox[0].className += " wp-message-closing";
			messageBox[0].style.top = "-" + messageBox[0].clientHeight + "px";
		}
		setTimeout(function () {
			var messageBox = _('.wp-message');
			if (messageBox.length) {
				messageBox[0].className+=" wp-message-closed";
			}
		}, delay);
    }
    
    var messageOK = _('.wp-message-ok');
    if(messageOK.length) {
        setTimeout(function(){messageHide(500)}, 5000)
    }

    var messageError = _('.wp-message-error');
    if(messageError.length) {
        setTimeout(function(){messageHide(500)}, 10000)
    }
    
    var messageClose = _('.wp-message-close');
    if(messageClose.length) {
        addEvent(messageClose[0], 'click', function(e){
			messageHide(500);
            noDefaultAction(e);
        });
    }


    /* Expand / collapse sites items */
    var siteExpandCollapse = _('.wp-sidebar-sites-edit-link');
    for(i = 0; i < siteExpandCollapse.length; i++) {
        addEvent(siteExpandCollapse[i], 'click', function(e){
            if(this.parentNode.className.search(' wp-sidebar-sites-edit') != -1) {
                this.parentNode.className = this.parentNode.className.replace(' wp-sidebar-sites-edit','');
            }
            else {
                var collapseOtherSites = _('.wp-sidebar-sites-item');
                for(var j = 0; j < collapseOtherSites.length; j++) {
                    collapseOtherSites[j].className = collapseOtherSites[j].className.replace(' wp-sidebar-sites-edit','');
                }
                this.parentNode.className = this.parentNode.className + ' wp-sidebar-sites-edit';
            }
            noDefaultAction(e);
        });
    }

    /* Add confirmations to Delete Site / Check buttons */
    var checkDelete = _('.wp-content-check-delete-link, .wp-sidebar-sites-delete-link, .wp-sidebar-customers-delete-link, .wp-content-contacts-delete-link');
    for(i = 0; i < checkDelete.length; i++) {
        addEvent(checkDelete[i], 'click', function(e){
            noPropogation(e);
            if (!confirm(this.title + '?')) {
                return noDefaultAction(e);
            }
        });
    }

    /* Pause button for check */
    var checksPauseButton = _('.wp-content-check-pause-link, .wp-content-check-pause-active'),
	checksPauseButtonLength = checksPauseButton.length,
	checksPauseButtonItem;
    for(i = 0; i < checksPauseButtonLength; i++) {
        checksPauseButtonItem = checksPauseButton[i];
	    addEvent(checksPauseButtonItem, 'click', function(e){
            noPropogation(e);
	    });
    }

    /* Hiding and showing checks on click */
    var checkHeaders = _('.wp-content-check-header'),
    checkHeadersLength = checkHeaders.length,
    checkHeader;
    for(i = 0; i < checkHeadersLength; i++) {
        checkHeader = checkHeaders[i];
        addEvent(checkHeader, 'click', function(e){
            if(this.parentNode.className.indexOf('wp-content-check-collapsed') == -1) {
                this.parentNode.className += ' wp-content-check-collapsed';
                setCookie(this.parentNode.id.replace('check-', ''), 0);
            } else {
                this.parentNode.className = this.parentNode.className.replace(' wp-content-check-collapsed', '');
                var id = this.parentNode.id.replace('check-', '');
                setCookie(id, 1);
                if (!window['chart'+id+'_expanded']) {
            	    for (var i=0; i<200; i++) {
            		    if (window['chart'+id+'_'+i]) {
                		window['chart'+id+'_'+i]();
                	    }
            	    }
            	    window['chart'+id+'_expanded'] = 1;
                }
            }
        });
    }

    /* Hiding and showing checks options groups on title click */
    var checkOptions = _('.wp-content-check-options-title-switch'),
    checkOptionsLength = checkOptions.length,
    checkOption;
    for(i = 0; i < checkOptionsLength; i++) {
        checkOption = checkOptions[i];
        if (checkOption.parentNode.parentNode.className.indexOf('wp-content-check-options-important') == -1) {
            checkOption.parentNode.parentNode.className += ' wp-content-check-options-collapsed';
        }
        addEvent(checkOption, 'click', function(e){
            if(this.parentNode.parentNode.className.indexOf('wp-content-check-options-collapsed') == -1) {
                this.parentNode.parentNode.className += ' wp-content-check-options-collapsed';
            } else {
                this.parentNode.parentNode.className = this.parentNode.parentNode.className.replace(' wp-content-check-options-collapsed', '');
            }
        });
    }

    /* Edit button for check */
    var checksEditButton = _('.wp-content-check-edit-link'),
	checksEditButtonLength = checksEditButton.length,
	checksEditButtonItem;
    for(i = 0; i < checksEditButtonLength; i++) {
        checksEditButtonItem = checksEditButton[i];
	    addEvent(checksEditButtonItem, 'click', function(e){
            var checkID = this.id.replace('edit-check-', ""),
            checkEditWrapper = _('#edit-check-wrapper-' + checkID)[0],
            chekItem = _('#check-' + checkID)[0];
            /* Item is collapsed */
            if(chekItem.className.indexOf('wp-content-check-collapsed') != -1) {
                chekItem.className = chekItem.className.replace(' wp-content-check-collapsed', '');
                if(checkEditWrapper.className.indexOf('wp-content-check-edit-wrapper-expanded') == -1) {
                    checkEditWrapper.className += ' wp-content-check-edit-wrapper-expanded';
                }
                if (!window['chart'+checkID+'_expanded']) {
            	    for (var i=0; i<200; i++) {
            		    if (window['chart'+checkID+'_'+i]) {
                		window['chart'+checkID+'_'+i]();
                	    }
            	    }
            	    window['chart'+checkID+'_expanded'] = 1;
                }
            }
            /* Item is expanded */
            else {
                if(checkEditWrapper.className.indexOf('wp-content-check-edit-wrapper-expanded') == -1) {
                    checkEditWrapper.className += ' wp-content-check-edit-wrapper-expanded';
                } else {
                    checkEditWrapper.className = checkEditWrapper.className.replace(' wp-content-check-edit-wrapper-expanded', '');
                }
            }
            noPropogation(e);
            /* todo smoother rollin-rollout */
    	    return noDefaultAction(e);
	    });
    }

    /* Cancel Edit button for check */
    var checksCancelButton = _('.wp-content-checks-edit-cancel'),
	checksCancelButtonLength = checksCancelButton.length,
	checksCancelButtonItem;
    for(i = 0; i < checksCancelButtonLength; i++) {
        checksCancelButtonItem = checksCancelButton[i];
	    addEvent(checksCancelButtonItem, 'click', function(e){
            var checkID = this.id.replace('cancel-edit-check-', ''),
            checkEditWrapper = _('#edit-check-wrapper-' + checkID)[0];
            checkEditWrapper.className = checkEditWrapper.className.replace(' wp-content-check-edit-wrapper-expanded', '');
            noPropogation(e);
    	    return noDefaultAction(e);
	    });
    }

    /* Add and Cancel Add buttons for check */
    var checksAddWrapper = _('#add-check-wrapper');
    if (checksAddWrapper[0]) {
        var checksAddButton = _('#add-check')[0];
        addEvent(checksAddButton, 'click', function(e){
            checksAddWrapper = _('#add-check-wrapper')[0];
            checksAddWrapper.className += ' wp-content-checks-add-expanded';
            return noDefaultAction(e);
        });

        var checksAddCancelButton = _('#cancel-add-check')[0];
        addEvent(checksAddCancelButton, 'click', function(e){
            checksAddWrapper = _('#add-check-wrapper')[0];
            checksAddWrapper.className = checksAddWrapper.className.replace(' wp-content-checks-add-expanded', '');
            return noDefaultAction(e);
        });
    }

    /* Contacts selection */
    var buttonActivateContact = _('.wp-content-contacts-item');
    for(i = 0; i < buttonActivateContact.length; i++) {
        addEvent(buttonActivateContact[i], 'click', function(e){
            /* click at active contact does nothing */
            if(this.className.search('wp-content-contacts-active') != -1) {
                return;
            }

            contactName = this.className.replace('wp-content-contacts-item ','');

            /* deactivating old active contacts */
            deactivateContacts = _('.wp-content-contacts-item, .wp-content-contacts-details-item');
            for(j = 0; j < deactivateContacts.length; j++) {
                deactivateContacts[j].className = deactivateContacts[j].className.replace(' wp-content-contacts-active','');
            }

            /* activating new contact */
            this.className += ' wp-content-contacts-active';
            contactContent = _('.wp-content-contacts-details' + ' .' + contactName);
            if(contactContent.length) {
                contactContent[0].className += ' wp-content-contacts-active';
            }
        });
    }
    
    /* Balance calculator */
    var balanceM = _('.wp-input-moneta-amount');
    var balanceW = _('.wp-input-moneta-amount-w');
    if (balanceM[0] && balanceW[0]) {
        addEvent(balanceM[0], 'keyup', function(e){
			/*if(isNaN(this.value) || this.value < 1) {
				this.value = 1;
			}*/
			//this.value = Math.round(this.value * 100) / 100;
			var balanceW = _('#MNT_AMOUNT_W')[0];
                        var w = calculate_w(this.value, user_type);
			balanceW.value = (w > 0) ? w : 1;
        });
        addEvent(balanceW[0], 'keyup', function(e){
			/*if(isNaN(this.value)) {
				this.value = 5;
			} else {
				this.value = Math.round(this.value);
			}*/
			//this.value = Math.round(this.value);
			var balanceM = _('#MNT_AMOUNT')[0];
                        var m = calculate_m(this.value, user_type);
                        balanceM.value = (m > 0) ? m : 1;
        });
    }
   
   /* [rub, w] */
    var prices = [
		[20, 100],
		[80, 500],
		[130, 1000],
		[600, 5000],
		[1000, 10000],
		[1900, 20000],
		[4000, 50000]
   /* [usd, w] */
    ], prices_en = [
		[1, 100],
		[4, 500],
		[8, 1000],
		[30, 5000],
		[50, 10000],
		[80, 20000],
		[180, 50000]
    ];

    var lang = _('#wp_lang')[0].value, prices = lang == 'en' ? prices_en : prices;
        
	function calculate_w(rub,t) {

		if (!t) {
			var m_start = 0;
			var w_start = 0;
			for(var i=0; i<prices.length-1; i++) {
				if ((rub >= m_start) && (rub < prices[i][0]))
				{
					var k = (prices[i][1] - w_start) / (prices[i][0] - m_start);
					return Math.round(w_start + k * (rub - m_start));
				}
				m_start = prices[i][0];
				w_start = prices[i][1];
			}
			var k = (prices[i][1] - w_start) / (prices[i][0] - m_start);
			return Math.round(w_start + k * (rub - m_start));
		} else {
			return Math.round(rub/(lang == 'en' ? 0.0036 : 0.08));
		}
	}

	function calculate_m(w,t) {
		if (!t) {
			var m_start = 0;
			var w_start = 0;
			for(var i=0; i<prices.length-1; i++) {
				if ((w >= w_start) && (w < prices[i][1]))
				{
					var k = (prices[i][0] - m_start) / (prices[i][1] - w_start);
					return Math.round(m_start + k * (w - w_start));
				}
				m_start = prices[i][0];
				w_start = prices[i][1];
			}
			var k = (prices[i][0] - m_start) / (prices[i][1] - w_start);
			return Math.round(m_start + k * (w - w_start));
		} else {
			return Math.round(w*(lang == 'en' ? 0.0036 : 0.08));
		}
	}

    var boxes = _('.wp-input-select-type'), box;i=0;
    while (box = boxes[i++]) {
	addEvent(box, 'change', function(e){
	    e = e.target || e.srcElement;
	    var a = e.options[e.selectedIndex].value;
        e.parentNode.parentNode.parentNode.className = 'wp-check-type' + a;
        if (a == 16) {
    	    var b = e.parentNode.parentNode.parentNode.getElementsByTagName('select')[1],
    		c = b.options[b.selectedIndex];
    	    if (c.value > 1 && c.value < 6) {
    		window.rememberedFrequency = b.selectedIndex;
    		b.selectedIndex = 4;
    	    }
    	} else {
    	    if (typeof window.rememberedFrequency != 'undefined') {
    		e.parentNode.parentNode.parentNode.getElementsByTagName('select')[1].selectedIndex = window.rememberedFrequency;
    	    }
    	}
	});
    }

}

function setCookie (id, status) {
    _.doc.cookie='b'+id+'wp='+status+';expires='+(new Date(new Date().getTime()+30000000000)).toGMTString()+';path=/';
}

function getCookie (id) {
    var cookie = _.doc.cookie,
	key = 'b' + id + 'wp=',
	item = cookie.indexOf(key),
	length = key.length;
    if (item != -1) {
	    return cookie.substr(item + length, 1).charAt(0) === '1';
    } else {
	    return 0;
    }
}

function noDefaultAction(e) {
    e = e || _.win.event;
    if (e.preventDefault) {
        e.preventDefault();
    } else {
        e.returnValue = false;
    }
    return false;
}

function noPropogation(e) {
    if (e.stopPropagation) {
        e.stopPropagation();
    } else {
        e.cancelBubble = true;
    }
    return false;
}

function addEvent(element, type, handler) {
  // assign each event handler a unique ID
  if (!handler.$$guid) handler.$$guid = addEvent.guid++;
  // create a hash table of event types for the element
  if (!element.events) element.events = {};
  // create a hash table of event handlers for each element/event pair
  var handlers = element.events[type];
  if (!handlers) {
    handlers = element.events[type] = {};
    // store the existing event handler (if there is one)
    if (element["on" + type]) {
      handlers[0] = element["on" + type];
    }
  }
  // store the event handler in the hash table
  handlers[handler.$$guid] = handler;
  // assign a global event handler to do all the work
  element["on" + type] = handleEvent;
};
// a counter used to create unique IDs
addEvent.guid = 1;

function removeEvent(element, type, handler) {
  // delete the event handler from the hash table
  if (element.events && element.events[type]) {
    delete element.events[type][handler.$$guid];
  }
};

function handleEvent(event) {
  // grab the event object (IE uses a global event object)
  event = event || window.event;
  // get a reference to the hash table of event handlers
  var handlers = this.events[event.type];
  // execute each event handler
  for (var i in handlers) {
    this.$$handleEvent = handlers[i];
    this.$$handleEvent(event);
  }
};

_.ready(initJS);

var wsLightbox = {};

function wsLightboxOpen(formBox) {
	wsLightbox.FormBoxes = _("#form-register, #form-login, #tour");
	for(i = 0; i <  wsLightbox.FormBoxes.length; i++) {
		wsLightbox.FormBoxes[i].style.display = "none";
	}
	wsLightbox.CurrentFormBox = document.getElementById(formBox);
	wsLightbox.CurrentFormBox.style.display = "block";
	wsLightbox.Background = document.getElementById('wsLightboxBackground');
	wsLightbox.ContentWrap = document.getElementById('wsLightboxContentWrap');
	wsLightbox.Content = document.getElementById('wsLightboxContent');
    if (formBox == 'tour') {
        wsLightbox.width = 1060;
    }
    else {
        wsLightbox.width = 255;
    }

	if (window.innerHeight && window.scrollMaxY) {
		pageWidth = document.body.clientWidth + window.scrollMaxX;
		pageHeight = window.innerHeight + window.scrollMaxY
	} else if (document.body.scrollHeight > document.body.offsetHeight) {
		pageWidth = document.body.scrollWidth;
		pageHeight = document.body.scrollHeight
	} else {
		pageWidth = document.body.offsetWidth + document.body.offsetLeft;
		pageHeight = document.body.offsetHeight + document.body.offsetTop
	}
	var pagesize = [pageWidth, pageHeight];

	wsLightbox.Background.style.display = 'block';
	var top = /*document.documentElement.scrollTop ? document.documentElement.scrollTop :*/ document.body.scrollTop;
	wsLightbox.ContentWrap.style.top = (top + 120) + 'px';
	wsLightbox.Content.style.opacity = 0;
	wsLightbox.Content.style.filter = 'alpha(opacity=100)';
	wsLightbox.ContentWrap.style.width = '10px';
	wsLightbox.ContentWrap.style.display = 'block';
	wsLightboxResize();
	setTimeout(function(){wsLightboxLightenMainImage()},220);
	return false;
}

function wsLightboxClose() {
	wsLightbox.Background.style.display = 'none';
	wsLightbox.ContentWrap.style.display = 'none';
	return false
}

function wsLightboxResize() {
	var deltaWidth = wsLightbox.Content.offsetWidth - wsLightbox.width;
	var deltaHeight = wsLightbox.Content.offsetHeight - wsLightbox.height;
	var widthResizeStep = deltaWidth / 4;
	var heightResizeStep = deltaHeight / 4;
	widthResizeStep = (widthResizeStep > 0) ? Math.ceil(widthResizeStep) : Math.floor(widthResizeStep);
	heightResizeStep = (heightResizeStep > 0) ? Math.ceil(heightResizeStep) : Math.floor(heightResizeStep);
	if (Math.abs(deltaWidth) > Math.abs(widthResizeStep)) {
		var newWidth = wsLightbox.ContentWrap.offsetWidth - widthResizeStep;
		wsLightbox.ContentWrap.style.width = newWidth + 'px'
	}
	if (Math.abs(deltaHeight) > Math.abs(heightResizeStep)) {
		var newHeight = wsLightbox.Content.offsetHeight - heightResizeStep;
		wsLightbox.Content.style.height = newHeight + 'px'
	}
	if ((Math.abs(deltaHeight) > Math.abs(heightResizeStep)) || (Math.abs(deltaWidth) > Math.abs(widthResizeStep))) {
		setTimeout(arguments.callee, 10)
	} else {
		wsLightbox.ContentWrap.style.width = wsLightbox.width + 'px';
//		wsLightbox.Content.style.height = wsLightbox.height + 'px';
//		wsLightboxLightenMainImage();
	}
}

function wsLightboxLightenMainImage() {
	var step = 2;
	var newOpacity = wsLightbox.Content.style.opacity * 10 + step;
	wsLightbox.Content.style.opacity = newOpacity / 10;
	wsLightbox.Content.style.filter = 'alpha(opacity=' + newOpacity * 10 + ')';
	if (wsLightbox.Content.style.opacity < 1) {
		setTimeout(arguments.callee, 10)
	} else {
		wsLightbox.Content.style.opacity = '';
		wsLightbox.Content.style.filter = ''
	}
}
(function(){function l(){if(l.is(arguments[0],Q)){for(var a=arguments[0],b=ua[I](l,a.splice(0,3+l.is(a[0],K))),c=b.set(),e=0,f=a[p];e<f;e++){var d=a[e]||{};hb[x](d.type)&&c[F](b[d.type]().attr(d))}return c}return ua[I](l,arguments)}function W(a,b,c){function e(){var f=Array[C].slice.call(arguments,0),d=f[M]("\u25ba"),g=e.cache=e.cache||{},j=e.count=e.count||[];if(g[x](d))return c?c(g[d]):g[d];j[p]>=1E3&&delete g[j.shift()];j[F](d);g[d]=a[I](b,f);return c?c(g[d]):g[d]}return e}function Ja(){return this.x+
J+this.y}function Ka(a){return function(b,c,e,f){var d={back:a};l.is(e,"function")?f=e:d.rot=e;b&&b.constructor==E&&(b=b.attrs.path);b&&(d.along=b);return this.animate(d,c,f)}}function ib(a,b,c,e,f,d){function g(s,q){var r,o,t,u;t=s;for(o=0;o<8;o++){u=((i*t+h)*t+j)*t-s;if(v.abs(u)<q)return t;r=(3*i*t+2*h)*t+j;if(v.abs(r)<1.0E-6)break;t-=u/r}r=0;o=1;t=s;if(t<r)return r;if(t>o)return o;for(;r<o;){u=((i*t+h)*t+j)*t;if(v.abs(u-s)<q)return t;if(s>u)r=t;else o=t;t=(o-r)/2+r}return t}var j=3*b,h=3*(e-b)-
j,i=1-j-h,k=3*c,m=3*(f-c)-k,n=1-k-m;return function(s,q){var r=g(s,q);return((n*r+m)*r+k)*r}(a,1/(200*d))}l.version="1.5.0";var R=/[, ]+/,hb={circle:1,rect:1,path:1,ellipse:1,text:1,image:1},jb=/\{(\d+)\}/g,C="prototype",x="hasOwnProperty",z=document,Y=window,va={was:Object[C][x].call(Y,"Raphael"),is:Y.Raphael},ja=function(){this.customAttributes={}},H,I="apply",wa="createTouch"in z,J=" ",A=String,ba="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend orientationchange touchcancel gesturestart gesturechange gestureend".split(J),
xa={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},M="join",p="length",$=A[C].toLowerCase,v=Math,O=v.max,S=v.min,G=v.pow,K="number",Q="array",kb=Object[C].toString,F="push",ca=/^(?=[\da-f]$)/,La=/^url\(['"]?([^\)]+?)['"]?\)$/i,lb=/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+\s*,\s*[\d\.]+\s*,\s*[\d\.]+(?:\s*,\s*[\d\.]+)?)\s*\)|rgba?\(\s*([\d\.]+%\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%(?:\s*,\s*[\d\.]+%)?)\s*\)|hsb\(\s*([\d\.]+(?:deg|\xb0)?\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|hsb\(\s*([\d\.]+(?:deg|\xb0|%)\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\)|hsl\(\s*([\d\.]+(?:deg|\xb0)?\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|hsl\(\s*([\d\.]+(?:deg|\xb0|%)\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\))\s*$/i,
mb=/^(NaN|-?Infinity)$/,nb=/^cubic-bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,L=v.round,y=parseFloat,X=parseInt,ka=A[C].toUpperCase,la={blur:0,"clip-rect":"0 0 1e9 1e9",cursor:"default",cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/",opacity:1,path:"M0,0",r:0,rotation:0,rx:0,ry:0,scale:"1 1",src:"",stroke:"#999","stroke-dasharray":"","stroke-linecap":"butt",
"stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,target:"_blank","text-anchor":"middle",title:"Raphael",translation:"0 0",width:0,x:0,y:0},ya={along:"along",blur:K,"clip-rect":"csv",cx:K,cy:K,fill:"colour","fill-opacity":K,"font-size":K,height:K,opacity:K,path:"path",r:K,rotation:"csv",rx:K,ry:K,scale:"csv",stroke:"colour","stroke-opacity":K,"stroke-width":K,translation:"csv",width:K,x:K,y:K},ob=/,?([achlmqrstvxz]),?/gi,da=/\s*,\s*/,pb={hs:1,rg:1},qb=/^(from|to|\d+%)$/,
rb=/([achlmqstvz])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?\s*,?\s*)+)/ig,sb=/(-?\d*\.?\d*(?:e[-+]?\d+)?)\s*,?\s*/ig,tb=function(a,b){return a.key-b.key};l.type=Y.SVGAngle||z.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML";if(l.type=="VML"){var T=z.createElement("div");T.innerHTML='<v:shape adj="1"/>';T=T.firstChild;T.style.behavior="url(#default#VML)";if(!(T&&typeof T.adj=="object"))return l.type=null;T=null}l.svg=!(l.vml=l.type=="VML");ja[C]=l[C];H=ja[C];
l._id=0;l._oid=0;l.fn={};l.is=function(a,b){b=$.call(b);if(b=="finite")return!mb.test(+a);return b=="null"&&a===null||b==typeof a||b=="object"&&a===Object(a)||b=="array"&&Array.isArray&&Array.isArray(a)||kb.call(a).slice(8,-1).toLowerCase()==b};l.angle=function(a,b,c,e,f,d){if(f==null){a=a-c;b=b-e;if(!a&&!b)return 0;return((a<0)*180+v.atan(-b/-a)*180/v.PI+360)%360}else return l.angle(a,b,f,d)-l.angle(c,e,f,d)};l.snapTo=function(a,b,c){c=c||10;a=[].concat(a);for(var e=a.length;e--;)if(v.abs(a[e]-b)<=
c)return a[e];return b};l.setWindow=function(a){Y=a;z=Y.document};var ma=function(a){if(l.vml){var b=/^\s+|\s+$/g,c;try{var e=new ActiveXObject("htmlfile");e.write("<body>");e.close();c=e.body}catch(f){c=createPopup().document.body}var d=c.createTextRange();ma=W(function(j){try{c.style.color=A(j).replace(b,"");var h=d.queryCommandValue("ForeColor");h=(h&255)<<16|h&65280|(h&16711680)>>>16;return"#"+("000000"+h.toString(16)).slice(-6)}catch(i){return"none"}})}else{var g=z.createElement("i");g.title=
"Rapha\u00ebl Colour Picker";g.style.display="none";z.body.appendChild(g);ma=W(function(j){g.style.color=j;return z.defaultView.getComputedStyle(g,"").getPropertyValue("color")})}return ma(a)},Ma=function(){return"hsb("+[this.h,this.s,this.b]+")"},ub=function(){return"hsl("+[this.h,this.s,this.l]+")"},vb=function(){return this.hex};l.hsb2rgb=function(a,b,c){if(l.is(a,"object")&&"h"in a&&"s"in a&&"b"in a){c=a.b;b=a.s;a=a.h}return l.hsl2rgb(a,b,c/2)};l.hsl2rgb=function(a,b,c){if(l.is(a,"object")&&"h"in
a&&"s"in a&&"l"in a){c=a.l;b=a.s;a=a.h}if(a>1||b>1||c>1){a/=360;b/=100;c/=100}var e={},f=["r","g","b"],d;if(b){b=c<0.5?c*(1+b):c+b-c*b;c=2*c-b;for(var g=0,j=f.length;g<j;g++){d=a+1/3*-(g-1);d<0&&d++;d>1&&d--;e[f[g]]=d*6<1?c+(b-c)*6*d:d*2<1?b:d*3<2?c+(b-c)*(2/3-d)*6:c}}else e={r:c,g:c,b:c};e.r*=255;e.g*=255;e.b*=255;a=(~~e.r).toString(16);f=(~~e.g).toString(16);b=(~~e.b).toString(16);a=a.replace(ca,"0");f=f.replace(ca,"0");b=b.replace(ca,"0");e.hex="#"+a+f+b;e.toString=vb;return e};l.rgb2hsb=function(a,
b,c){if(b==null&&l.is(a,"object")&&"r"in a&&"g"in a&&"b"in a){c=a.b;b=a.g;a=a.r}if(b==null&&l.is(a,"string")){var e=l.getRGB(a);a=e.r;b=e.g;c=e.b}if(a>1||b>1||c>1){a/=255;b/=255;c/=255}e=O(a,b,c);var f=S(a,b,c);if(f==e)return{h:0,s:0,b:e,toString:Ma};else{var d=e-f;f=d/e;a=a==e?(b-c)/d:b==e?2+(c-a)/d:4+(a-b)/d;a/=6;a<0&&a++;a>1&&a--}return{h:a,s:f,b:e,toString:Ma}};l.rgb2hsl=function(a,b,c){if(b==null&&l.is(a,"object")&&"r"in a&&"g"in a&&"b"in a){c=a.b;b=a.g;a=a.r}if(b==null&&l.is(a,"string")){var e=
l.getRGB(a);a=e.r;b=e.g;c=e.b}if(a>1||b>1||c>1){a/=255;b/=255;c/=255}var f=O(a,b,c),d=S(a,b,c);e=(f+d)/2;if(d==f)a={h:0,s:0,l:e};else{var g=f-d;d=e<0.5?g/(f+d):g/(2-f-d);a=a==f?(b-c)/g:b==f?2+(c-a)/g:4+(a-b)/g;a/=6;a<0&&a++;a>1&&a--;a={h:a,s:d,l:e}}a.toString=ub;return a};l._path2string=function(){return this.join(",").replace(ob,"$1")};l.getRGB=W(function(a){if(!a||(a=A(a)).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1};if(a=="none")return{r:-1,g:-1,b:-1,hex:"none"};!(pb[x](a.substring(0,
2))||a.charAt()=="#")&&(a=ma(a));var b,c,e,f,d;if(a=a.match(lb)){if(a[2]){e=X(a[2].substring(5),16);c=X(a[2].substring(3,5),16);b=X(a[2].substring(1,3),16)}if(a[3]){e=X((d=a[3].charAt(3))+d,16);c=X((d=a[3].charAt(2))+d,16);b=X((d=a[3].charAt(1))+d,16)}if(a[4]){a=a[4].split(da);b=y(a[0]);c=y(a[1]);e=y(a[2]);f=y(a[3])}if(a[5]){a=a[5].split(da);b=y(a[0])*2.55;c=y(a[1])*2.55;e=y(a[2])*2.55;f=y(a[3])}if(a[6]){a=a[6].split(da);b=y(a[0]);c=y(a[1]);e=y(a[2]);(a[0].slice(-3)=="deg"||a[0].slice(-1)=="\u00b0")&&
(b/=360);return l.hsb2rgb(b,c,e)}if(a[7]){a=a[7].split(da);b=y(a[0])*2.55;c=y(a[1])*2.55;e=y(a[2])*2.55;(a[0].slice(-3)=="deg"||a[0].slice(-1)=="\u00b0")&&(b/=360*2.55);return l.hsb2rgb(b,c,e)}if(a[8]){a=a[8].split(da);b=y(a[0]);c=y(a[1]);e=y(a[2]);(a[0].slice(-3)=="deg"||a[0].slice(-1)=="\u00b0")&&(b/=360);return l.hsl2rgb(b,c,e)}if(a[9]){a=a[9].split(da);b=y(a[0])*2.55;c=y(a[1])*2.55;e=y(a[2])*2.55;(a[0].slice(-3)=="deg"||a[0].slice(-1)=="\u00b0")&&(b/=360*2.55);return l.hsl2rgb(b,c,e)}a={r:b,g:c,
b:e};b=(~~b).toString(16);c=(~~c).toString(16);e=(~~e).toString(16);b=b.replace(ca,"0");c=c.replace(ca,"0");e=e.replace(ca,"0");a.hex="#"+b+c+e;isFinite(y(f))&&(a.o=f);return a}return{r:-1,g:-1,b:-1,hex:"none",error:1}},l);l.getColor=function(a){a=this.getColor.start=this.getColor.start||{h:0,s:1,b:a||0.75};var b=this.hsb2rgb(a.h,a.s,a.b);a.h+=0.075;if(a.h>1){a.h=0;a.s-=0.2;a.s<=0&&(this.getColor.start={h:0,s:1,b:a.b})}return b.hex};l.getColor.reset=function(){delete this.start};l.parsePathString=
W(function(a){if(!a)return null;var b={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},c=[];if(l.is(a,Q)&&l.is(a[0],Q))c=na(a);c[p]||A(a).replace(rb,function(e,f,d){var g=[];e=$.call(f);d.replace(sb,function(j,h){h&&g[F](+h)});if(e=="m"&&g[p]>2){c[F]([f].concat(g.splice(0,2)));e="l";f=f=="m"?"l":"L"}for(;g[p]>=b[e];){c[F]([f].concat(g.splice(0,b[e])));if(!b[e])break}});c.toString=l._path2string;return c});l.findDotsAtSegment=function(a,b,c,e,f,d,g,j,h){var i=1-h,k=G(i,3)*a+G(i,2)*3*h*c+i*3*h*h*f+G(h,3)*
g;i=G(i,3)*b+G(i,2)*3*h*e+i*3*h*h*d+G(h,3)*j;var m=a+2*h*(c-a)+h*h*(f-2*c+a),n=b+2*h*(e-b)+h*h*(d-2*e+b),s=c+2*h*(f-c)+h*h*(g-2*f+c),q=e+2*h*(d-e)+h*h*(j-2*d+e);a=(1-h)*a+h*c;b=(1-h)*b+h*e;f=(1-h)*f+h*g;d=(1-h)*d+h*j;j=90-v.atan((m-s)/(n-q))*180/v.PI;(m>s||n<q)&&(j+=180);return{x:k,y:i,m:{x:m,y:n},n:{x:s,y:q},start:{x:a,y:b},end:{x:f,y:d},alpha:j}};var pa=W(function(a){if(!a)return{x:0,y:0,width:0,height:0};a=oa(a);for(var b=0,c=0,e=[],f=[],d,g=0,j=a[p];g<j;g++){d=a[g];if(d[0]=="M"){b=d[1];c=d[2];
e[F](b);f[F](c)}else{b=wb(b,c,d[1],d[2],d[3],d[4],d[5],d[6]);e=e.concat(b.min.x,b.max.x);f=f.concat(b.min.y,b.max.y);b=d[5];c=d[6]}}a=S[I](0,e);d=S[I](0,f);return{x:a,y:d,width:O[I](0,e)-a,height:O[I](0,f)-d}}),na=function(a){var b=[];if(!l.is(a,Q)||!l.is(a&&a[0],Q))a=l.parsePathString(a);for(var c=0,e=a[p];c<e;c++){b[c]=[];for(var f=0,d=a[c][p];f<d;f++)b[c][f]=a[c][f]}b.toString=l._path2string;return b},za=W(function(a){if(!l.is(a,Q)||!l.is(a&&a[0],Q))a=l.parsePathString(a);var b=[],c=0,e=0,f=0,
d=0,g=0;if(a[0][0]=="M"){c=a[0][1];e=a[0][2];f=c;d=e;g++;b[F](["M",c,e])}g=g;for(var j=a[p];g<j;g++){var h=b[g]=[],i=a[g];if(i[0]!=$.call(i[0])){h[0]=$.call(i[0]);switch(h[0]){case "a":h[1]=i[1];h[2]=i[2];h[3]=i[3];h[4]=i[4];h[5]=i[5];h[6]=+(i[6]-c).toFixed(3);h[7]=+(i[7]-e).toFixed(3);break;case "v":h[1]=+(i[1]-e).toFixed(3);break;case "m":f=i[1];d=i[2];default:for(var k=1,m=i[p];k<m;k++)h[k]=+(i[k]-(k%2?c:e)).toFixed(3)}}else{b[g]=[];if(i[0]=="m"){f=i[1]+c;d=i[2]+e}h=0;for(k=i[p];h<k;h++)b[g][h]=
i[h]}i=b[g][p];switch(b[g][0]){case "z":c=f;e=d;break;case "h":c+=+b[g][i-1];break;case "v":e+=+b[g][i-1];break;default:c+=+b[g][i-2];e+=+b[g][i-1]}}b.toString=l._path2string;return b},0,na),fa=W(function(a){if(!l.is(a,Q)||!l.is(a&&a[0],Q))a=l.parsePathString(a);var b=[],c=0,e=0,f=0,d=0,g=0;if(a[0][0]=="M"){c=+a[0][1];e=+a[0][2];f=c;d=e;g++;b[0]=["M",c,e]}g=g;for(var j=a[p];g<j;g++){var h=b[g]=[],i=a[g];if(i[0]!=ka.call(i[0])){h[0]=ka.call(i[0]);switch(h[0]){case "A":h[1]=i[1];h[2]=i[2];h[3]=i[3];
h[4]=i[4];h[5]=i[5];h[6]=+(i[6]+c);h[7]=+(i[7]+e);break;case "V":h[1]=+i[1]+e;break;case "H":h[1]=+i[1]+c;break;case "M":f=+i[1]+c;d=+i[2]+e;default:for(var k=1,m=i[p];k<m;k++)h[k]=+i[k]+(k%2?c:e)}}else{k=0;for(m=i[p];k<m;k++)b[g][k]=i[k]}switch(h[0]){case "Z":c=f;e=d;break;case "H":c=h[1];break;case "V":e=h[1];break;case "M":f=b[g][b[g][p]-2];d=b[g][b[g][p]-1];default:c=b[g][b[g][p]-2];e=b[g][b[g][p]-1]}}b.toString=l._path2string;return b},null,na),Na=function(a,b,c,e,f,d){var g=1/3,j=2/3;return[g*
a+j*c,g*b+j*e,g*f+j*c,g*d+j*e,f,d]},Oa=function(a,b,c,e,f,d,g,j,h,i){var k=v.PI,m=k*120/180,n=k/180*(+f||0),s=[],q,r=W(function(D,aa,qa){var xb=D*v.cos(qa)-aa*v.sin(qa);D=D*v.sin(qa)+aa*v.cos(qa);return{x:xb,y:D}});if(i){u=i[0];q=i[1];d=i[2];t=i[3]}else{q=r(a,b,-n);a=q.x;b=q.y;q=r(j,h,-n);j=q.x;h=q.y;v.cos(k/180*f);v.sin(k/180*f);q=(a-j)/2;u=(b-h)/2;t=q*q/(c*c)+u*u/(e*e);if(t>1){t=v.sqrt(t);c=t*c;e=t*e}t=c*c;var o=e*e;t=(d==g?-1:1)*v.sqrt(v.abs((t*o-t*u*u-o*q*q)/(t*u*u+o*q*q)));d=t*c*u/e+(a+j)/2;
var t=t*-e*q/c+(b+h)/2,u=v.asin(((b-t)/e).toFixed(9));q=v.asin(((h-t)/e).toFixed(9));u=a<d?k-u:u;q=j<d?k-q:q;u<0&&(u=k*2+u);q<0&&(q=k*2+q);if(g&&u>q)u-=k*2;if(!g&&q>u)q-=k*2}k=q-u;if(v.abs(k)>m){s=q;k=j;o=h;q=u+m*(g&&q>u?1:-1);j=d+c*v.cos(q);h=t+e*v.sin(q);s=Oa(j,h,c,e,f,0,g,k,o,[q,s,d,t])}k=q-u;f=v.cos(u);m=v.sin(u);g=v.cos(q);q=v.sin(q);k=v.tan(k/4);c=4/3*c*k;k=4/3*e*k;e=[a,b];a=[a+c*m,b-k*f];b=[j+c*q,h-k*g];j=[j,h];a[0]=2*e[0]-a[0];a[1]=2*e[1]-a[1];if(i)return[a,b,j].concat(s);else{s=[a,b,j].concat(s)[M]().split(",");
i=[];j=0;for(h=s[p];j<h;j++)i[j]=j%2?r(s[j-1],s[j],n).y:r(s[j],s[j+1],n).x;return i}},ra=function(a,b,c,e,f,d,g,j,h){var i=1-h;return{x:G(i,3)*a+G(i,2)*3*h*c+i*3*h*h*f+G(h,3)*g,y:G(i,3)*b+G(i,2)*3*h*e+i*3*h*h*d+G(h,3)*j}},wb=W(function(a,b,c,e,f,d,g,j){var h=f-2*c+a-(g-2*f+c),i=2*(c-a)-2*(f-c),k=a-c,m=(-i+v.sqrt(i*i-4*h*k))/2/h;h=(-i-v.sqrt(i*i-4*h*k))/2/h;var n=[b,j],s=[a,g];v.abs(m)>"1e12"&&(m=0.5);v.abs(h)>"1e12"&&(h=0.5);if(m>0&&m<1){m=ra(a,b,c,e,f,d,g,j,m);s[F](m.x);n[F](m.y)}if(h>0&&h<1){m=
ra(a,b,c,e,f,d,g,j,h);s[F](m.x);n[F](m.y)}h=d-2*e+b-(j-2*d+e);i=2*(e-b)-2*(d-e);k=b-e;m=(-i+v.sqrt(i*i-4*h*k))/2/h;h=(-i-v.sqrt(i*i-4*h*k))/2/h;v.abs(m)>"1e12"&&(m=0.5);v.abs(h)>"1e12"&&(h=0.5);if(m>0&&m<1){m=ra(a,b,c,e,f,d,g,j,m);s[F](m.x);n[F](m.y)}if(h>0&&h<1){m=ra(a,b,c,e,f,d,g,j,h);s[F](m.x);n[F](m.y)}return{min:{x:S[I](0,s),y:S[I](0,n)},max:{x:O[I](0,s),y:O[I](0,n)}}}),oa=W(function(a,b){var c=fa(a),e=b&&fa(b),f={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},d={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,
qy:null},g=function(r,o){var t,u;if(!r)return["C",o.x,o.y,o.x,o.y,o.x,o.y];!(r[0]in{T:1,Q:1})&&(o.qx=o.qy=null);switch(r[0]){case "M":o.X=r[1];o.Y=r[2];break;case "A":r=["C"].concat(Oa[I](0,[o.x,o.y].concat(r.slice(1))));break;case "S":t=o.x+(o.x-(o.bx||o.x));u=o.y+(o.y-(o.by||o.y));r=["C",t,u].concat(r.slice(1));break;case "T":o.qx=o.x+(o.x-(o.qx||o.x));o.qy=o.y+(o.y-(o.qy||o.y));r=["C"].concat(Na(o.x,o.y,o.qx,o.qy,r[1],r[2]));break;case "Q":o.qx=r[1];o.qy=r[2];r=["C"].concat(Na(o.x,o.y,r[1],r[2],
r[3],r[4]));break;case "L":r=["C"].concat([o.x,o.y,r[1],r[2],r[1],r[2]]);break;case "H":r=["C"].concat([o.x,o.y,r[1],o.y,r[1],o.y]);break;case "V":r=["C"].concat([o.x,o.y,o.x,r[1],o.x,r[1]]);break;case "Z":r=["C"].concat([o.x,o.y,o.X,o.Y,o.X,o.Y]);break}return r},j=function(r,o){if(r[o][p]>7){r[o].shift();for(var t=r[o];t[p];)r.splice(o++,0,["C"].concat(t.splice(0,6)));r.splice(o,1);k=O(c[p],e&&e[p]||0)}},h=function(r,o,t,u,D){if(r&&o&&r[D][0]=="M"&&o[D][0]!="M"){o.splice(D,0,["M",u.x,u.y]);t.bx=
0;t.by=0;t.x=r[D][1];t.y=r[D][2];k=O(c[p],e&&e[p]||0)}},i=0,k=O(c[p],e&&e[p]||0);for(;i<k;i++){c[i]=g(c[i],f);j(c,i);e&&(e[i]=g(e[i],d));e&&j(e,i);h(c,e,f,d,i);h(e,c,d,f,i);var m=c[i],n=e&&e[i],s=m[p],q=e&&n[p];f.x=m[s-2];f.y=m[s-1];f.bx=y(m[s-4])||f.x;f.by=y(m[s-3])||f.y;d.bx=e&&(y(n[q-4])||d.x);d.by=e&&(y(n[q-3])||d.y);d.x=e&&n[q-2];d.y=e&&n[q-1]}return e?[c,e]:c},null,na),Pa=W(function(a){for(var b=[],c=0,e=a[p];c<e;c++){var f={},d=a[c].match(/^([^:]*):?([\d\.]*)/);f.color=l.getRGB(d[1]);if(f.color.error)return null;
f.color=f.color.hex;d[2]&&(f.offset=d[2]+"%");b[F](f)}c=1;for(e=b[p]-1;c<e;c++)if(!b[c].offset){a=y(b[c-1].offset||0);d=0;for(f=c+1;f<e;f++)if(b[f].offset){d=b[f].offset;break}if(!d){d=100;f=e}d=y(d);for(d=(d-a)/(f-c+1);c<f;c++){a+=d;b[c].offset=a+"%"}}return b}),Qa=function(a,b,c,e){if(l.is(a,"string")||l.is(a,"object")){a=l.is(a,"string")?z.getElementById(a):a;if(a.tagName)return b==null?{container:a,width:a.style.pixelWidth||a.offsetWidth,height:a.style.pixelHeight||a.offsetHeight}:{container:a,
width:b,height:c}}else return{container:1,x:a,y:b,width:c,height:e}},Aa=function(a,b){var c=this;for(var e in b)if(b[x](e)&&!(e in a))switch(typeof b[e]){case "function":(function(f){a[e]=a===c?f:function(){return f[I](c,arguments)}})(b[e]);break;case "object":a[e]=a[e]||{};Aa.call(this,a[e],b[e]);break;default:a[e]=b[e];break}},ea=function(a,b){a==b.top&&(b.top=a.prev);a==b.bottom&&(b.bottom=a.next);a.next&&(a.next.prev=a.prev);a.prev&&(a.prev.next=a.next)},Ra=function(a,b){if(b.top!==a){ea(a,b);
a.next=null;a.prev=b.top;b.top.next=a;b.top=a}},Sa=function(a,b){if(b.bottom!==a){ea(a,b);a.next=b.bottom;a.prev=null;b.bottom.prev=a;b.bottom=a}},Ta=function(a,b,c){ea(a,c);b==c.top&&(c.top=a);b.next&&(b.next.prev=a);a.next=b.next;a.prev=b;b.next=a},Ua=function(a,b,c){ea(a,c);b==c.bottom&&(c.bottom=a);b.prev&&(b.prev.next=a);a.prev=b.prev;b.prev=a;a.next=b},Va=function(a){return function(){throw Error("Rapha\u00ebl: you are calling to method \u201c"+a+"\u201d of removed object");}},Wa=/^r(?:\(([^,]+?)\s*,\s*([^\)]+?)\))?/;
l.pathToRelative=za;if(l.svg){H.svgns="http://www.w3.org/2000/svg";H.xlink="http://www.w3.org/1999/xlink";L=function(a){return+a+(~~a===a)*0.5};var w=function(a,b){if(b)for(var c in b)b[x](c)&&a.setAttribute(c,A(b[c]));else{a=z.createElementNS(H.svgns,a);a.style.webkitTapHighlightColor="rgba(0,0,0,0)";return a}};l.toString=function(){return"Your browser supports SVG.\nYou are running Rapha\u00ebl "+this.version};var Xa=function(a,b){var c=w("path");b.canvas&&b.canvas.appendChild(c);c=new E(c,b);c.type=
"path";Z(c,{fill:"none",stroke:"#999",path:a});return c},ga=function(a,b,c){var e="linear",f=0.5,d=0.5,g=a.style;b=A(b).replace(Wa,function(k,m,n){e="radial";if(m&&n){f=y(m);d=y(n);k=(d>0.5)*2-1;G(f-0.5,2)+G(d-0.5,2)>0.25&&(d=v.sqrt(0.25-G(f-0.5,2))*k+0.5)&&d!=0.5&&(d=d.toFixed(5)-1.0E-5*k)}return""});b=b.split(/\s*\-\s*/);if(e=="linear"){var j=b.shift();j=-y(j);if(isNaN(j))return null;j=[0,0,v.cos(j*v.PI/180),v.sin(j*v.PI/180)];var h=1/(O(v.abs(j[2]),v.abs(j[3]))||1);j[2]*=h;j[3]*=h;if(j[2]<0){j[0]=
-j[2];j[2]=0}if(j[3]<0){j[1]=-j[3];j[3]=0}}b=Pa(b);if(!b)return null;h=a.getAttribute("fill");(h=h.match(/^url\(#(.*)\)$/))&&c.defs.removeChild(z.getElementById(h[1]));h=w(e+"Gradient");h.id="r"+(l._id++).toString(36);w(h,e=="radial"?{fx:f,fy:d}:{x1:j[0],y1:j[1],x2:j[2],y2:j[3]});c.defs.appendChild(h);c=0;for(j=b[p];c<j;c++){var i=w("stop");w(i,{offset:b[c].offset?b[c].offset:!c?"0%":"100%","stop-color":b[c].color||"#fff"});h.appendChild(i)}w(a,{fill:"url(#"+h.id+")",opacity:1,"fill-opacity":1});
g.fill="";g.opacity=1;return g.fillOpacity=1},Ba=function(a){var b=a.getBBox();w(a.pattern,{patternTransform:l.format("translate({0},{1})",b.x,b.y)})},Z=function(a,b){var c={"":[0],none:[0],"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},e=a.node,f=a.attrs,d=a.rotate(),g=function(q,r){if(r=c[$.call(r)]){for(var o=q.attrs["stroke-width"]||"1",t={round:o,square:o,butt:0}[q.attrs["stroke-linecap"]||b["stroke-linecap"]]||
0,u=[],D=r[p];D--;)u[D]=r[D]*o+(D%2?1:-1)*t;w(e,{"stroke-dasharray":u[M](",")})}};b[x]("rotation")&&(d=b.rotation);var j=A(d).split(R);if(j.length-1){j[1]=+j[1];j[2]=+j[2]}else j=null;y(d)&&a.rotate(0,true);for(var h in b)if(b[x](h))if(la[x](h)){var i=b[h];f[h]=i;switch(h){case "blur":a.blur(i);break;case "rotation":a.rotate(i,true);break;case "href":case "title":case "target":var k=e.parentNode;if($.call(k.tagName)!="a"){var m=w("a");k.insertBefore(m,e);m.appendChild(e);k=m}h=="target"&&i=="blank"?
k.setAttributeNS(a.paper.xlink,"show","new"):k.setAttributeNS(a.paper.xlink,h,i);break;case "cursor":e.style.cursor=i;break;case "clip-rect":k=A(i).split(R);if(k[p]==4){a.clip&&a.clip.parentNode.parentNode.removeChild(a.clip.parentNode);var n=w("clipPath");m=w("rect");n.id="r"+(l._id++).toString(36);w(m,{x:k[0],y:k[1],width:k[2],height:k[3]});n.appendChild(m);a.paper.defs.appendChild(n);w(e,{"clip-path":"url(#"+n.id+")"});a.clip=m}if(!i){(i=z.getElementById(e.getAttribute("clip-path").replace(/(^url\(#|\)$)/g,
"")))&&i.parentNode.removeChild(i);w(e,{"clip-path":""});delete a.clip}break;case "path":if(a.type=="path")w(e,{d:i?f.path=fa(i):"M0,0"});break;case "width":e.setAttribute(h,i);if(f.fx){h="x";i=f.x}else break;case "x":if(f.fx)i=-f.x-(f.width||0);case "rx":if(h=="rx"&&a.type=="rect")break;case "cx":j&&(h=="x"||h=="cx")&&(j[1]+=i-f[h]);e.setAttribute(h,i);a.pattern&&Ba(a);break;case "height":e.setAttribute(h,i);if(f.fy){h="y";i=f.y}else break;case "y":if(f.fy)i=-f.y-(f.height||0);case "ry":if(h=="ry"&&
a.type=="rect")break;case "cy":j&&(h=="y"||h=="cy")&&(j[2]+=i-f[h]);e.setAttribute(h,i);a.pattern&&Ba(a);break;case "r":a.type=="rect"?w(e,{rx:i,ry:i}):e.setAttribute(h,i);break;case "src":a.type=="image"&&e.setAttributeNS(a.paper.xlink,"href",i);break;case "stroke-width":e.style.strokeWidth=i;e.setAttribute(h,i);f["stroke-dasharray"]&&g(a,f["stroke-dasharray"]);break;case "stroke-dasharray":g(a,i);break;case "translation":i=A(i).split(R);i[0]=+i[0]||0;i[1]=+i[1]||0;if(j){j[1]+=i[0];j[2]+=i[1]}sa.call(a,
i[0],i[1]);break;case "scale":i=A(i).split(R);a.scale(+i[0]||1,+i[1]||+i[0]||1,isNaN(y(i[2]))?null:+i[2],isNaN(y(i[3]))?null:+i[3]);break;case "fill":if(k=A(i).match(La)){n=w("pattern");var s=w("image");n.id="r"+(l._id++).toString(36);w(n,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1});w(s,{x:0,y:0});s.setAttributeNS(a.paper.xlink,"href",k[1]);n.appendChild(s);i=z.createElement("img");i.style.cssText="position:absolute;left:-9999em;top-9999em";i.onload=function(){w(n,{width:this.offsetWidth,
height:this.offsetHeight});w(s,{width:this.offsetWidth,height:this.offsetHeight});z.body.removeChild(this);a.paper.safari()};z.body.appendChild(i);i.src=k[1];a.paper.defs.appendChild(n);e.style.fill="url(#"+n.id+")";w(e,{fill:"url(#"+n.id+")"});a.pattern=n;a.pattern&&Ba(a);break}k=l.getRGB(i);if(k.error){if(({circle:1,ellipse:1}[x](a.type)||A(i).charAt()!="r")&&ga(e,i,a.paper)){f.gradient=i;f.fill="none";break}}else{delete b.gradient;delete f.gradient;!l.is(f.opacity,"undefined")&&l.is(b.opacity,
"undefined")&&w(e,{opacity:f.opacity});!l.is(f["fill-opacity"],"undefined")&&l.is(b["fill-opacity"],"undefined")&&w(e,{"fill-opacity":f["fill-opacity"]})}k[x]("o")&&w(e,{"fill-opacity":k.o>1?k.o/100:k.o});case "stroke":k=l.getRGB(i);e.setAttribute(h,k.hex);h=="stroke"&&k[x]("o")&&w(e,{"stroke-opacity":k.o>1?k.o/100:k.o});break;case "gradient":(({circle:1,ellipse:1})[x](a.type)||A(i).charAt()!="r")&&ga(e,i,a.paper);break;case "opacity":case "fill-opacity":if(f.gradient){if(k=z.getElementById(e.getAttribute("fill").replace(/^url\(#|\)$/g,
""))){k=k.getElementsByTagName("stop");k[k[p]-1].setAttribute("stop-opacity",i)}break}default:h=="font-size"&&(i=X(i,10)+"px");k=h.replace(/(\-.)/g,function(q){return ka.call(q.substring(1))});e.style[k]=i;e.setAttribute(h,i);break}}yb(a,b);if(j)a.rotate(j.join(J));else y(d)&&a.rotate(d,true)},yb=function(a,b){if(!(a.type!="text"||!(b[x]("text")||b[x]("font")||b[x]("font-size")||b[x]("x")||b[x]("y")))){var c=a.attrs,e=a.node,f=e.firstChild?X(z.defaultView.getComputedStyle(e.firstChild,"").getPropertyValue("font-size"),
10):10;if(b[x]("text")){for(c.text=b.text;e.firstChild;)e.removeChild(e.firstChild);for(var d=A(b.text).split("\n"),g=0,j=d[p];g<j;g++)if(d[g]){var h=w("tspan");g&&w(h,{dy:f*1.2,x:c.x});h.appendChild(z.createTextNode(d[g]));e.appendChild(h)}}else{d=e.getElementsByTagName("tspan");g=0;for(j=d[p];g<j;g++)g&&w(d[g],{dy:f*1.2,x:c.x})}w(e,{y:c.y});f=a.getBBox();(f=c.y-(f.y+f.height/2))&&isFinite(f)&&w(e,{y:c.y+f})}},E=function(a,b){this[0]=a;this.id=l._oid++;this.node=a;a.raphael=this;this.paper=b;this.attrs=
this.attrs||{};this.transformations=[];this._={tx:0,ty:0,rt:{deg:0,cx:0,cy:0},sx:1,sy:1};!b.bottom&&(b.bottom=this);(this.prev=b.top)&&(b.top.next=this);b.top=this;this.next=null},B=E[C];E[C].rotate=function(a,b,c){if(this.removed)return this;if(a==null){if(this._.rt.cx)return[this._.rt.deg,this._.rt.cx,this._.rt.cy][M](J);return this._.rt.deg}var e=this.getBBox();a=A(a).split(R);if(a[p]-1){b=y(a[1]);c=y(a[2])}a=y(a[0]);if(b!=null&&b!==false)this._.rt.deg=a;else this._.rt.deg+=a;c==null&&(b=null);
this._.rt.cx=b;this._.rt.cy=c;b=b==null?e.x+e.width/2:b;c=c==null?e.y+e.height/2:c;if(this._.rt.deg){this.transformations[0]=l.format("rotate({0} {1} {2})",this._.rt.deg,b,c);this.clip&&w(this.clip,{transform:l.format("rotate({0} {1} {2})",-this._.rt.deg,b,c)})}else{this.transformations[0]="";this.clip&&w(this.clip,{transform:""})}w(this.node,{transform:this.transformations[M](J)});return this};E[C].hide=function(){!this.removed&&(this.node.style.display="none");return this};E[C].show=function(){!this.removed&&
(this.node.style.display="");return this};E[C].remove=function(){if(!this.removed){ea(this,this.paper);this.node.parentNode.removeChild(this.node);for(var a in this)delete this[a];this.removed=true}};E[C].getBBox=function(){if(this.removed)return this;if(this.type=="path")return pa(this.attrs.path);if(this.node.style.display=="none"){this.show();var a=true}var b={};try{b=this.node.getBBox()}catch(c){}finally{b=b||{}}if(this.type=="text"){b={x:b.x,y:Infinity,width:0,height:0};for(var e=0,f=this.node.getNumberOfChars();e<
f;e++){var d=this.node.getExtentOfChar(e);d.y<b.y&&(b.y=d.y);d.y+d.height-b.y>b.height&&(b.height=d.y+d.height-b.y);d.x+d.width-b.x>b.width&&(b.width=d.x+d.width-b.x)}}a&&this.hide();return b};E[C].attr=function(a,b){if(this.removed)return this;if(a==null){var c={};for(var e in this.attrs)if(this.attrs[x](e))c[e]=this.attrs[e];this._.rt.deg&&(c.rotation=this.rotate());(this._.sx!=1||this._.sy!=1)&&(c.scale=this.scale());c.gradient&&c.fill=="none"&&(c.fill=c.gradient)&&delete c.gradient;return c}if(b==
null&&l.is(a,"string")){if(a=="translation")return sa.call(this);if(a=="rotation")return this.rotate();if(a=="scale")return this.scale();if(a=="fill"&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;return this.attrs[a]}if(b==null&&l.is(a,Q)){e={};c=0;for(var f=a.length;c<f;c++)e[a[c]]=this.attr(a[c]);return e}if(b!=null){c={};c[a]=b}else if(a!=null&&l.is(a,"object"))c=a;for(f in this.paper.customAttributes)if(this.paper.customAttributes[x](f)&&c[x](f)&&l.is(this.paper.customAttributes[f],
"function")){e=this.paper.customAttributes[f].apply(this,[].concat(c[f]));this.attrs[f]=c[f];for(var d in e)if(e[x](d))c[d]=e[d]}Z(this,c);return this};E[C].toFront=function(){if(this.removed)return this;this.node.parentNode.appendChild(this.node);var a=this.paper;a.top!=this&&Ra(this,a);return this};E[C].toBack=function(){if(this.removed)return this;if(this.node.parentNode.firstChild!=this.node){this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild);Sa(this,this.paper)}return this};
E[C].insertAfter=function(a){if(this.removed)return this;var b=a.node||a[a.length-1].node;b.nextSibling?b.parentNode.insertBefore(this.node,b.nextSibling):b.parentNode.appendChild(this.node);Ta(this,a,this.paper);return this};E[C].insertBefore=function(a){if(this.removed)return this;var b=a.node||a[0].node;b.parentNode.insertBefore(this.node,b);Ua(this,a,this.paper);return this};E[C].blur=function(a){if(+a!==0){var b=w("filter"),c=w("feGaussianBlur");this.attrs.blur=a;b.id="r"+(l._id++).toString(36);
w(c,{stdDeviation:+a||1.5});b.appendChild(c);this.paper.defs.appendChild(b);this._blur=b;w(this.node,{filter:"url(#"+b.id+")"})}else{if(this._blur){this._blur.parentNode.removeChild(this._blur);delete this._blur;delete this.attrs.blur}this.node.removeAttribute("filter")}};var Ya=function(a,b,c,e){var f=w("circle");a.canvas&&a.canvas.appendChild(f);a=new E(f,a);a.attrs={cx:b,cy:c,r:e,fill:"none",stroke:"#999"};a.type="circle";w(f,a.attrs);return a},Za=function(a,b,c,e,f,d){var g=w("rect");a.canvas&&
a.canvas.appendChild(g);a=new E(g,a);a.attrs={x:b,y:c,width:e,height:f,r:d||0,rx:d||0,ry:d||0,fill:"none",stroke:"#999"};a.type="rect";w(g,a.attrs);return a},$a=function(a,b,c,e,f){var d=w("ellipse");a.canvas&&a.canvas.appendChild(d);a=new E(d,a);a.attrs={cx:b,cy:c,rx:e,ry:f,fill:"none",stroke:"#999"};a.type="ellipse";w(d,a.attrs);return a},ab=function(a,b,c,e,f,d){var g=w("image");w(g,{x:c,y:e,width:f,height:d,preserveAspectRatio:"none"});g.setAttributeNS(a.xlink,"href",b);a.canvas&&a.canvas.appendChild(g);
a=new E(g,a);a.attrs={x:c,y:e,width:f,height:d,src:b};a.type="image";return a},bb=function(a,b,c,e){var f=w("text");w(f,{x:b,y:c,"text-anchor":"middle"});a.canvas&&a.canvas.appendChild(f);a=new E(f,a);a.attrs={x:b,y:c,"text-anchor":"middle",text:e,font:la.font,stroke:"none",fill:"#999"};a.type="text";Z(a,a.attrs);return a},cb=function(a,b){this.width=a||this.width;this.height=b||this.height;this.canvas.setAttribute("width",this.width);this.canvas.setAttribute("height",this.height);return this},ua=
function(){var a=Qa[I](0,arguments),b=a&&a.container,c=a.x,e=a.y,f=a.width;a=a.height;if(!b)throw Error("SVG container not found.");var d=w("svg");c=c||0;e=e||0;f=f||512;a=a||342;w(d,{xmlns:"http://www.w3.org/2000/svg",version:1.1,width:f,height:a});if(b==1){d.style.cssText="position:absolute;left:"+c+"px;top:"+e+"px";z.body.appendChild(d)}else b.firstChild?b.insertBefore(d,b.firstChild):b.appendChild(d);b=new ja;b.width=f;b.height=a;b.canvas=d;Aa.call(b,b,l.fn);b.clear();return b};H.clear=function(){for(var a=
this.canvas;a.firstChild;)a.removeChild(a.firstChild);this.bottom=this.top=null;(this.desc=w("desc")).appendChild(z.createTextNode("Created with Rapha\u00ebl"));a.appendChild(this.desc);a.appendChild(this.defs=w("defs"))};H.remove=function(){this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas);for(var a in this)this[a]=Va(a)}}if(l.vml){var db={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},zb=/([clmz]),?([^clmz]*)/gi,Ab=/ progid:\S+Blur\([^\)]+\)/g,Bb=/-?[^,\s-]+/g,ha=1E3+J+1E3,
ia={path:1,rect:1},Cb=function(a){var b=/[ahqstv]/ig,c=fa;A(a).match(b)&&(c=oa);b=/[clmz]/g;if(c==fa&&!A(a).match(b))return a=A(a).replace(zb,function(h,i,k){var m=[],n=$.call(i)=="m",s=db[i];k.replace(Bb,function(q){if(n&&m[p]==2){s+=m+db[i=="m"?"l":"L"];m=[]}m[F](L(q*10))});return s+m});b=c(a);var e;a=[];for(var f=0,d=b[p];f<d;f++){c=b[f];e=$.call(b[f][0]);e=="z"&&(e="x");for(var g=1,j=c[p];g<j;g++)e+=L(c[g]*10)+(g!=j-1?",":"");a[F](e)}return a[M](J)};l.toString=function(){return"Your browser doesn\u2019t support SVG. Falling down to VML.\nYou are running Rapha\u00ebl "+
this.version};Xa=function(a,b){var c=N("group");c.style.cssText="position:absolute;left:0;top:0;width:"+b.width+"px;height:"+b.height+"px";c.coordsize=b.coordsize;c.coordorigin=b.coordorigin;var e=N("shape"),f=e.style;f.width=b.width+"px";f.height=b.height+"px";e.coordsize=ha;e.coordorigin=b.coordorigin;c.appendChild(e);e=new E(e,c,b);f={fill:"none",stroke:"#999"};a&&(f.path=a);e.type="path";e.path=[];e.Path="";Z(e,f);b.canvas.appendChild(c);return e};Z=function(a,b){a.attrs=a.attrs||{};var c=a.node,
e=a.attrs,f=c.style,d;d=(b.x!=e.x||b.y!=e.y||b.width!=e.width||b.height!=e.height||b.r!=e.r)&&a.type=="rect";for(var g in b)if(b[x](g))e[g]=b[g];if(d){e.path=eb(e.x,e.y,e.width,e.height,e.r);a.X=e.x;a.Y=e.y;a.W=e.width;a.H=e.height}b.href&&(c.href=b.href);b.title&&(c.title=b.title);b.target&&(c.target=b.target);b.cursor&&(f.cursor=b.cursor);"blur"in b&&a.blur(b.blur);if(b.path&&a.type=="path"||d)c.path=Cb(e.path);b.rotation!=null&&a.rotate(b.rotation,true);if(b.translation){d=A(b.translation).split(R);
sa.call(a,d[0],d[1]);if(a._.rt.cx!=null){a._.rt.cx+=+d[0];a._.rt.cy+=+d[1];a.setBox(a.attrs,d[0],d[1])}}if(b.scale){d=A(b.scale).split(R);a.scale(+d[0]||1,+d[1]||+d[0]||1,+d[2]||null,+d[3]||null)}if("clip-rect"in b){d=A(b["clip-rect"]).split(R);if(d[p]==4){d[2]=+d[2]+ +d[0];d[3]=+d[3]+ +d[1];g=c.clipRect||z.createElement("div");var j=g.style,h=c.parentNode;j.clip=l.format("rect({1}px {2}px {3}px {0}px)",d);if(!c.clipRect){j.position="absolute";j.top=0;j.left=0;j.width=a.paper.width+"px";j.height=
a.paper.height+"px";h.parentNode.insertBefore(g,h);g.appendChild(h);c.clipRect=g}}if(!b["clip-rect"])c.clipRect&&(c.clipRect.style.clip="")}if(a.type=="image"&&b.src)c.src=b.src;if(a.type=="image"&&b.opacity){c.filterOpacity=" progid:DXImageTransform.Microsoft.Alpha(opacity="+b.opacity*100+")";f.filter=(c.filterMatrix||"")+(c.filterOpacity||"")}b.font&&(f.font=b.font);b["font-family"]&&(f.fontFamily='"'+b["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g,"")+'"');b["font-size"]&&(f.fontSize=b["font-size"]);
b["font-weight"]&&(f.fontWeight=b["font-weight"]);b["font-style"]&&(f.fontStyle=b["font-style"]);if(b.opacity!=null||b["stroke-width"]!=null||b.fill!=null||b.stroke!=null||b["stroke-width"]!=null||b["stroke-opacity"]!=null||b["fill-opacity"]!=null||b["stroke-dasharray"]!=null||b["stroke-miterlimit"]!=null||b["stroke-linejoin"]!=null||b["stroke-linecap"]!=null){c=a.shape||c;d=c.getElementsByTagName("fill")&&c.getElementsByTagName("fill")[0];g=false;!d&&(g=d=N("fill"));if("fill-opacity"in b||"opacity"in
b){f=((+e["fill-opacity"]+1||2)-1)*((+e.opacity+1||2)-1)*((+l.getRGB(b.fill).o+1||2)-1);f=S(O(f,0),1);d.opacity=f}b.fill&&(d.on=true);if(d.on==null||b.fill=="none")d.on=false;if(d.on&&b.fill)if(f=b.fill.match(La)){d.src=f[1];d.type="tile"}else{d.color=l.getRGB(b.fill).hex;d.src="";d.type="solid";if(l.getRGB(b.fill).error&&(a.type in{circle:1,ellipse:1}||A(b.fill).charAt()!="r")&&ga(a,b.fill)){e.fill="none";e.gradient=b.fill}}g&&c.appendChild(d);d=c.getElementsByTagName("stroke")&&c.getElementsByTagName("stroke")[0];
g=false;!d&&(g=d=N("stroke"));if(b.stroke&&b.stroke!="none"||b["stroke-width"]||b["stroke-opacity"]!=null||b["stroke-dasharray"]||b["stroke-miterlimit"]||b["stroke-linejoin"]||b["stroke-linecap"])d.on=true;(b.stroke=="none"||d.on==null||b.stroke==0||b["stroke-width"]==0)&&(d.on=false);f=l.getRGB(b.stroke);d.on&&b.stroke&&(d.color=f.hex);f=((+e["stroke-opacity"]+1||2)-1)*((+e.opacity+1||2)-1)*((+f.o+1||2)-1);j=(y(b["stroke-width"])||1)*0.75;f=S(O(f,0),1);b["stroke-width"]==null&&(j=e["stroke-width"]);
b["stroke-width"]&&(d.weight=j);j&&j<1&&(f*=j)&&(d.weight=1);d.opacity=f;b["stroke-linejoin"]&&(d.joinstyle=b["stroke-linejoin"]||"miter");d.miterlimit=b["stroke-miterlimit"]||8;b["stroke-linecap"]&&(d.endcap=b["stroke-linecap"]=="butt"?"flat":b["stroke-linecap"]=="square"?"square":"round");if(b["stroke-dasharray"]){f={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};d.dashstyle=
f[x](b["stroke-dasharray"])?f[b["stroke-dasharray"]]:""}g&&c.appendChild(d)}if(a.type=="text"){f=a.paper.span.style;e.font&&(f.font=e.font);e["font-family"]&&(f.fontFamily=e["font-family"]);e["font-size"]&&(f.fontSize=e["font-size"]);e["font-weight"]&&(f.fontWeight=e["font-weight"]);e["font-style"]&&(f.fontStyle=e["font-style"]);a.node.string&&(a.paper.span.innerHTML=A(a.node.string).replace(/</g,"&#60;").replace(/&/g,"&#38;").replace(/\n/g,"<br>"));a.W=e.w=a.paper.span.offsetWidth;a.H=e.h=a.paper.span.offsetHeight;
a.X=e.x;a.Y=e.y+L(a.H/2);switch(e["text-anchor"]){case "start":a.node.style["v-text-align"]="left";a.bbx=L(a.W/2);break;case "end":a.node.style["v-text-align"]="right";a.bbx=-L(a.W/2);break;default:a.node.style["v-text-align"]="center";break}}};ga=function(a,b){a.attrs=a.attrs||{};var c,e="linear",f=".5 .5";a.attrs.gradient=b;b=A(b).replace(Wa,function(k,m,n){e="radial";if(m&&n){m=y(m);n=y(n);G(m-0.5,2)+G(n-0.5,2)>0.25&&(n=v.sqrt(0.25-G(m-0.5,2))*((n>0.5)*2-1)+0.5);f=m+J+n}return""});b=b.split(/\s*\-\s*/);
if(e=="linear"){var d=b.shift();d=-y(d);if(isNaN(d))return null}var g=Pa(b);if(!g)return null;a=a.shape||a.node;c=a.getElementsByTagName("fill")[0]||N("fill");!c.parentNode&&a.appendChild(c);if(g[p]){c.on=true;c.method="none";c.color=g[0].color;c.color2=g[g[p]-1].color;for(var j=[],h=0,i=g[p];h<i;h++)g[h].offset&&j[F](g[h].offset+J+g[h].color);c.colors&&(c.colors.value=j[p]?j[M]():"0% "+c.color);if(e=="radial"){c.type="gradientradial";c.focus="100%";c.focussize=f;c.focusposition=f}else{c.type="gradient";
c.angle=(270-d)%360}}return 1};E=function(a,b,c){this[0]=a;this.id=l._oid++;this.node=a;a.raphael=this;this.Y=this.X=0;this.attrs={};this.Group=b;this.paper=c;this._={tx:0,ty:0,rt:{deg:0},sx:1,sy:1};!c.bottom&&(c.bottom=this);(this.prev=c.top)&&(c.top.next=this);c.top=this;this.next=null};B=E[C];B.rotate=function(a,b,c){if(this.removed)return this;if(a==null){if(this._.rt.cx)return[this._.rt.deg,this._.rt.cx,this._.rt.cy][M](J);return this._.rt.deg}a=A(a).split(R);if(a[p]-1){b=y(a[1]);c=y(a[2])}a=
y(a[0]);if(b!=null)this._.rt.deg=a;else this._.rt.deg+=a;c==null&&(b=null);this._.rt.cx=b;this._.rt.cy=c;this.setBox(this.attrs,b,c);this.Group.style.rotation=this._.rt.deg;return this};B.setBox=function(a,b,c){if(this.removed)return this;var e=this.Group.style,f=this.shape&&this.shape.style||this.node.style;a=a||{};for(var d in a)if(a[x](d))this.attrs[d]=a[d];b=b||this._.rt.cx;c=c||this._.rt.cy;var g=this.attrs,j;switch(this.type){case "circle":a=g.cx-g.r;d=g.cy-g.r;j=g=g.r*2;break;case "ellipse":a=
g.cx-g.rx;d=g.cy-g.ry;j=g.rx*2;g=g.ry*2;break;case "image":a=+g.x;d=+g.y;j=g.width||0;g=g.height||0;break;case "text":this.textpath.v=["m",L(g.x),", ",L(g.y-2),"l",L(g.x)+1,", ",L(g.y-2)][M]("");a=g.x-L(this.W/2);d=g.y-this.H/2;j=this.W;g=this.H;break;case "rect":case "path":if(this.attrs.path){g=pa(this.attrs.path);a=g.x;d=g.y;j=g.width;g=g.height}else{d=a=0;j=this.paper.width;g=this.paper.height}break;default:d=a=0;j=this.paper.width;g=this.paper.height;break}b=b==null?a+j/2:b;c=c==null?d+g/2:c;
b=b-this.paper.width/2;c=c-this.paper.height/2;var h;e.left!=(h=b+"px")&&(e.left=h);e.top!=(h=c+"px")&&(e.top=h);this.X=ia[x](this.type)?-b:a;this.Y=ia[x](this.type)?-c:d;this.W=j;this.H=g;if(ia[x](this.type)){f.left!=(h=-b*10+"px")&&(f.left=h);f.top!=(h=-c*10+"px")&&(f.top=h)}else if(this.type=="text"){f.left!=(h=-b+"px")&&(f.left=h);f.top!=(h=-c+"px")&&(f.top=h)}else{e.width!=(h=this.paper.width+"px")&&(e.width=h);e.height!=(h=this.paper.height+"px")&&(e.height=h);f.left!=(h=a-b+"px")&&(f.left=
h);f.top!=(h=d-c+"px")&&(f.top=h);f.width!=(h=j+"px")&&(f.width=h);f.height!=(h=g+"px")&&(f.height=h)}};B.hide=function(){!this.removed&&(this.Group.style.display="none");return this};B.show=function(){!this.removed&&(this.Group.style.display="block");return this};B.getBBox=function(){if(this.removed)return this;if(ia[x](this.type))return pa(this.attrs.path);return{x:this.X+(this.bbx||0),y:this.Y,width:this.W,height:this.H}};B.remove=function(){if(!this.removed){ea(this,this.paper);this.node.parentNode.removeChild(this.node);
this.Group.parentNode.removeChild(this.Group);this.shape&&this.shape.parentNode.removeChild(this.shape);for(var a in this)delete this[a];this.removed=true}};B.attr=function(a,b){if(this.removed)return this;if(a==null){var c={};for(var e in this.attrs)if(this.attrs[x](e))c[e]=this.attrs[e];this._.rt.deg&&(c.rotation=this.rotate());(this._.sx!=1||this._.sy!=1)&&(c.scale=this.scale());c.gradient&&c.fill=="none"&&(c.fill=c.gradient)&&delete c.gradient;return c}if(b==null&&l.is(a,"string")){if(a=="translation")return sa.call(this);
if(a=="rotation")return this.rotate();if(a=="scale")return this.scale();if(a=="fill"&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;return this.attrs[a]}if(this.attrs&&b==null&&l.is(a,Q)){var f={};e=0;for(c=a[p];e<c;e++)f[a[e]]=this.attr(a[e]);return f}if(b!=null){c={};c[a]=b}b==null&&l.is(a,"object")&&(c=a);if(c){for(f in this.paper.customAttributes)if(this.paper.customAttributes[x](f)&&c[x](f)&&l.is(this.paper.customAttributes[f],"function")){e=this.paper.customAttributes[f].apply(this,
[].concat(c[f]));this.attrs[f]=c[f];for(var d in e)if(e[x](d))c[d]=e[d]}if(c.text&&this.type=="text")this.node.string=c.text;Z(this,c);if(c.gradient&&({circle:1,ellipse:1}[x](this.type)||A(c.gradient).charAt()!="r"))ga(this,c.gradient);(!ia[x](this.type)||this._.rt.deg)&&this.setBox(this.attrs)}return this};B.toFront=function(){!this.removed&&this.Group.parentNode.appendChild(this.Group);this.paper.top!=this&&Ra(this,this.paper);return this};B.toBack=function(){if(this.removed)return this;if(this.Group.parentNode.firstChild!=
this.Group){this.Group.parentNode.insertBefore(this.Group,this.Group.parentNode.firstChild);Sa(this,this.paper)}return this};B.insertAfter=function(a){if(this.removed)return this;if(a.constructor==P)a=a[a.length-1];a.Group.nextSibling?a.Group.parentNode.insertBefore(this.Group,a.Group.nextSibling):a.Group.parentNode.appendChild(this.Group);Ta(this,a,this.paper);return this};B.insertBefore=function(a){if(this.removed)return this;if(a.constructor==P)a=a[0];a.Group.parentNode.insertBefore(this.Group,
a.Group);Ua(this,a,this.paper);return this};B.blur=function(a){var b=this.node.runtimeStyle,c=b.filter;c=c.replace(Ab,"");if(+a!==0){this.attrs.blur=a;b.filter=c+J+" progid:DXImageTransform.Microsoft.Blur(pixelradius="+(+a||1.5)+")";b.margin=l.format("-{0}px 0 0 -{0}px",L(+a||1.5))}else{b.filter=c;b.margin=0;delete this.attrs.blur}};Ya=function(a,b,c,e){var f=N("group"),d=N("oval");f.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px";f.coordsize=ha;f.coordorigin=
a.coordorigin;f.appendChild(d);d=new E(d,f,a);d.type="circle";Z(d,{stroke:"#999",fill:"none"});d.attrs.cx=b;d.attrs.cy=c;d.attrs.r=e;d.setBox({x:b-e,y:c-e,width:e*2,height:e*2});a.canvas.appendChild(f);return d};var eb=function(a,b,c,e,f){return f?l.format("M{0},{1}l{2},0a{3},{3},0,0,1,{3},{3}l0,{5}a{3},{3},0,0,1,{4},{3}l{6},0a{3},{3},0,0,1,{4},{4}l0,{7}a{3},{3},0,0,1,{3},{4}z",a+f,b,c-f*2,f,-f,e-f*2,f*2-c,f*2-e):l.format("M{0},{1}l{2},0,0,{3},{4},0z",a,b,c,e,-c)};Za=function(a,b,c,e,f,d){var g=eb(b,
c,e,f,d);a=a.path(g);var j=a.attrs;a.X=j.x=b;a.Y=j.y=c;a.W=j.width=e;a.H=j.height=f;j.r=d;j.path=g;a.type="rect";return a};$a=function(a,b,c,e,f){var d=N("group"),g=N("oval");d.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px";d.coordsize=ha;d.coordorigin=a.coordorigin;d.appendChild(g);g=new E(g,d,a);g.type="ellipse";Z(g,{stroke:"#999"});g.attrs.cx=b;g.attrs.cy=c;g.attrs.rx=e;g.attrs.ry=f;g.setBox({x:b-e,y:c-f,width:e*2,height:f*2});a.canvas.appendChild(d);return g};
ab=function(a,b,c,e,f,d){var g=N("group"),j=N("image");g.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px";g.coordsize=ha;g.coordorigin=a.coordorigin;j.src=b;g.appendChild(j);j=new E(j,g,a);j.type="image";j.attrs.src=b;j.attrs.x=c;j.attrs.y=e;j.attrs.w=f;j.attrs.h=d;j.setBox({x:c,y:e,width:f,height:d});a.canvas.appendChild(g);return j};bb=function(a,b,c,e){var f=N("group"),d=N("shape"),g=d.style,j=N("path"),h=N("textpath");f.style.cssText="position:absolute;left:0;top:0;width:"+
a.width+"px;height:"+a.height+"px";f.coordsize=ha;f.coordorigin=a.coordorigin;j.v=l.format("m{0},{1}l{2},{1}",L(b*10),L(c*10),L(b*10)+1);j.textpathok=true;g.width=a.width;g.height=a.height;h.string=A(e);h.on=true;d.appendChild(h);d.appendChild(j);f.appendChild(d);g=new E(h,f,a);g.shape=d;g.textpath=j;g.type="text";g.attrs.text=e;g.attrs.x=b;g.attrs.y=c;g.attrs.w=1;g.attrs.h=1;Z(g,{font:la.font,stroke:"none",fill:"#999"});g.setBox();a.canvas.appendChild(f);return g};cb=function(a,b){var c=this.canvas.style;
a==+a&&(a+="px");b==+b&&(b+="px");c.width=a;c.height=b;c.clip="rect(0 "+a+" "+b+" 0)";return this};var N;z.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");try{!z.namespaces.rvml&&z.namespaces.add("rvml","urn:schemas-microsoft-com:vml");N=function(a){return z.createElement("<rvml:"+a+' class="rvml">')}}catch(Jb){N=function(a){return z.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}ua=function(){var a=Qa[I](0,arguments),b=a.container,c=a.height,e=a.width,
f=a.x;a=a.y;if(!b)throw Error("VML container not found.");var d=new ja,g=d.canvas=z.createElement("div"),j=g.style;f=f||0;a=a||0;e=e||512;c=c||342;e==+e&&(e+="px");c==+c&&(c+="px");d.width=1E3;d.height=1E3;d.coordsize=1E4+J+1E4;d.coordorigin="0 0";d.span=z.createElement("span");d.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";g.appendChild(d.span);j.cssText=l.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",
e,c);if(b==1){z.body.appendChild(g);j.left=f+"px";j.top=a+"px";j.position="absolute"}else b.firstChild?b.insertBefore(g,b.firstChild):b.appendChild(g);Aa.call(d,d,l.fn);return d};H.clear=function(){this.canvas.innerHTML="";this.span=z.createElement("span");this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";this.canvas.appendChild(this.span);this.bottom=this.top=null};H.remove=function(){this.canvas.parentNode.removeChild(this.canvas);
for(var a in this)this[a]=Va(a);return true}}T=navigator.userAgent.match(/Version\/(.*?)\s/);H.safari=navigator.vendor=="Apple Computer, Inc."&&(T&&T[1]<4||navigator.platform.slice(0,2)=="iP")?function(){var a=this.rect(-99,-99,this.width+99,this.height+99).attr({stroke:"none"});Y.setTimeout(function(){a.remove()})}:function(){};var Db=function(){this.returnValue=false},Eb=function(){return this.originalEvent.preventDefault()},Fb=function(){this.cancelBubble=true},Gb=function(){return this.originalEvent.stopPropagation()},
Hb=function(){if(z.addEventListener)return function(a,b,c,e){var f=wa&&xa[b]?xa[b]:b,d=function(g){if(wa&&xa[x](b))for(var j=0,h=g.targetTouches&&g.targetTouches.length;j<h;j++)if(g.targetTouches[j].target==a){h=g;g=g.targetTouches[j];g.originalEvent=h;g.preventDefault=Eb;g.stopPropagation=Gb;break}return c.call(e,g)};a.addEventListener(f,d,false);return function(){a.removeEventListener(f,d,false);return true}};else if(z.attachEvent)return function(a,b,c,e){var f=function(d){d=d||Y.event;d.preventDefault=
d.preventDefault||Db;d.stopPropagation=d.stopPropagation||Fb;return c.call(e,d)};a.attachEvent("on"+b,f);return function(){a.detachEvent("on"+b,f);return true}}}(),U=[],Ca=function(a){for(var b=a.clientX,c=a.clientY,e=z.documentElement.scrollTop||z.body.scrollTop,f=z.documentElement.scrollLeft||z.body.scrollLeft,d,g=U.length;g--;){d=U[g];if(wa)for(var j=a.touches.length,h;j--;){h=a.touches[j];if(h.identifier==d.el._drag.id){b=h.clientX;c=h.clientY;(a.originalEvent?a.originalEvent:a).preventDefault();
break}}else a.preventDefault();b+=f;c+=e;d.move&&d.move.call(d.el,b-d.el._drag.x,c-d.el._drag.y,b,c)}},Da=function(){l.unmousemove(Ca).unmouseup(Da);for(var a=U.length,b;a--;){b=U[a];b.el._drag={};b.end&&b.end.call(b.el)}U=[]};for(T=ba[p];T--;)(function(a){l[a]=E[C][a]=function(b){if(l.is(b,"function")){this.events=this.events||[];this.events.push({name:a,f:b,unbind:Hb(this.shape||this.node||z,a,b,this)})}return this};l["un"+a]=E[C]["un"+a]=function(b){for(var c=this.events,e=c[p];e--;)if(c[e].name==
a&&c[e].f==b){c[e].unbind();c.splice(e,1);!c.length&&delete this.events;return this}return this}})(ba[T]);B.hover=function(a,b){return this.mouseover(a).mouseout(b)};B.unhover=function(a,b){return this.unmouseover(a).unmouseout(b)};B.drag=function(a,b,c){this._drag={};this.mousedown(function(e){(e.originalEvent||e).preventDefault();var f=z.documentElement.scrollTop||z.body.scrollTop,d=z.documentElement.scrollLeft||z.body.scrollLeft;this._drag.x=e.clientX+d;this._drag.y=e.clientY+f;this._drag.id=e.identifier;
b&&b.call(this,e.clientX+d,e.clientY+f);!U.length&&l.mousemove(Ca).mouseup(Da);U.push({el:this,move:a,end:c})});return this};B.undrag=function(a,b,c){for(b=U.length;b--;){U[b].el==this&&U[b].move==a&&U[b].end==c&&U.splice(b,1);!U.length&&l.unmousemove(Ca).unmouseup(Da)}};H.circle=function(a,b,c){return Ya(this,a||0,b||0,c||0)};H.rect=function(a,b,c,e,f){return Za(this,a||0,b||0,c||0,e||0,f||0)};H.ellipse=function(a,b,c,e){return $a(this,a||0,b||0,c||0,e||0)};H.path=function(a){a&&!l.is(a,"string")&&
!l.is(a[0],Q)&&(a+="");return Xa(l.format[I](l,arguments),this)};H.image=function(a,b,c,e,f){return ab(this,a||"about:blank",b||0,c||0,e||0,f||0)};H.text=function(a,b,c){return bb(this,a||0,b||0,A(c))};H.set=function(a){arguments[p]>1&&(a=Array[C].splice.call(arguments,0,arguments[p]));return new P(a)};H.setSize=cb;H.top=H.bottom=null;H.raphael=l;B.resetScale=function(){if(this.removed)return this;this._.sx=1;this._.sy=1;this.attrs.scale="1 1"};B.scale=function(a,b,c,e){if(this.removed)return this;
if(a==null&&b==null)return{x:this._.sx,y:this._.sy,toString:Ja};b=b||a;!+b&&(b=a);var f,d,g=this.attrs;if(a!=0){var j=this.getBBox(),h=j.x+j.width/2,i=j.y+j.height/2;f=a/this._.sx;d=b/this._.sy;c=+c||c==0?c:h;e=+e||e==0?e:i;j=~~(a/v.abs(a));var k=~~(b/v.abs(b)),m=this.node.style,n=c+(h-c)*f;i=e+(i-e)*d;switch(this.type){case "rect":case "image":var s=g.width*j*f,q=g.height*k*d;this.attr({height:q,r:g.r*S(j*f,k*d),width:s,x:n-s/2,y:i-q/2});break;case "circle":case "ellipse":this.attr({rx:g.rx*j*f,
ry:g.ry*k*d,r:g.r*S(j*f,k*d),cx:n,cy:i});break;case "text":this.attr({x:n,y:i});break;case "path":h=za(g.path);for(var r=true,o=0,t=h[p];o<t;o++){var u=h[o],D=ka.call(u[0]);if(!(D=="M"&&r)){r=false;if(D=="A"){u[h[o][p]-2]*=f;u[h[o][p]-1]*=d;u[1]*=j*f;u[2]*=k*d;u[5]=+!(j+k?!+u[5]:+u[5])}else if(D=="H"){D=1;for(var aa=u[p];D<aa;D++)u[D]*=f}else if(D=="V"){D=1;for(aa=u[p];D<aa;D++)u[D]*=d}else{D=1;for(aa=u[p];D<aa;D++)u[D]*=D%2?f:d}}}d=pa(h);f=n-d.x-d.width/2;d=i-d.y-d.height/2;h[0][1]+=f;h[0][2]+=d;
this.attr({path:h});break}if(this.type in{text:1,image:1}&&(j!=1||k!=1))if(this.transformations){this.transformations[2]="scale(".concat(j,",",k,")");this.node.setAttribute("transform",this.transformations[M](J));f=j==-1?-g.x-(s||0):g.x;d=k==-1?-g.y-(q||0):g.y;this.attr({x:f,y:d});g.fx=j-1;g.fy=k-1}else{this.node.filterMatrix=" progid:DXImageTransform.Microsoft"+".Matrix(M11=".concat(j,", M12=0, M21=0, M22=",k,", Dx=0, Dy=0, sizingmethod='auto expand', filtertype='bilinear')");m.filter=(this.node.filterMatrix||
"")+(this.node.filterOpacity||"")}else if(this.transformations){this.transformations[2]="";this.node.setAttribute("transform",this.transformations[M](J));g.fx=0;g.fy=0}else{this.node.filterMatrix="";m.filter=(this.node.filterMatrix||"")+(this.node.filterOpacity||"")}g.scale=[a,b,c,e][M](J);this._.sx=a;this._.sy=b}return this};B.clone=function(){if(this.removed)return null;var a=this.attr();delete a.scale;delete a.translation;return this.paper[this.type]().attr(a)};var Ea={},Fa=function(a,b,c,e,f,
d,g,j,h){var i=0,k=[a,b,c,e,f,d,g,j].join(),m=Ea[k],n,s;!m&&(Ea[k]=m={data:[]});m.timer&&clearTimeout(m.timer);m.timer=setTimeout(function(){delete Ea[k]},2E3);for(var q=0;q<101;q++){if(m.data[h]>q)s=m.data[q*100];else{s=l.findDotsAtSegment(a,b,c,e,f,d,g,j,q/100);m.data[q]=s}q&&(i+=G(G(n.x-s.x,2)+G(n.y-s.y,2),0.5));if(h!=null&&i>=h)return s;n=s}if(h==null)return i};ba=function(a,b){return function(c,e,f){c=oa(c);for(var d,g,j,h,i="",k={},m=0,n=0,s=c.length;n<s;n++){j=c[n];if(j[0]=="M"){d=+j[1];g=
+j[2]}else{h=Fa(d,g,j[1],j[2],j[3],j[4],j[5],j[6]);if(m+h>e){if(b&&!k.start){d=Fa(d,g,j[1],j[2],j[3],j[4],j[5],j[6],e-m);i+=["C",d.start.x,d.start.y,d.m.x,d.m.y,d.x,d.y];if(f)return i;k.start=i;i=["M",d.x,d.y+"C",d.n.x,d.n.y,d.end.x,d.end.y,j[5],j[6]][M]();m+=h;d=+j[5];g=+j[6];continue}if(!a&&!b){d=Fa(d,g,j[1],j[2],j[3],j[4],j[5],j[6],e-m);return{x:d.x,y:d.y,alpha:d.alpha}}}m+=h;d=+j[5];g=+j[6]}i+=j}k.end=i;d=a?m:b?k:l.findDotsAtSegment(d,g,j[1],j[2],j[3],j[4],j[5],j[6],1);d.alpha&&(d={x:d.x,y:d.y,
alpha:d.alpha});return d}};var fb=ba(1),ta=ba(),Ga=ba(0,1);B.getTotalLength=function(){if(this.type=="path"){if(this.node.getTotalLength)return this.node.getTotalLength();return fb(this.attrs.path)}};B.getPointAtLength=function(a){if(this.type=="path"){if(this.node.getPointAtLength)return this.node.getPointAtLength(a);return ta(this.attrs.path,a)}};B.getSubpath=function(a,b){if(this.type=="path"){if(v.abs(this.getTotalLength()-b)<"1e-6")return Ga(this.attrs.path,a).end;var c=Ga(this.attrs.path,b,
1);return a?Ga(c,a).end:c}};l.easing_formulas={linear:function(a){return a},"<":function(a){return G(a,3)},">":function(a){return G(a-1,3)+1},"<>":function(a){a*=2;if(a<1)return G(a,3)/2;a-=2;return(G(a,3)+2)/2},backIn:function(a){return a*a*(2.70158*a-1.70158)},backOut:function(a){a-=1;return a*a*(2.70158*a+1.70158)+1},elastic:function(a){if(a==0||a==1)return a;return G(2,-10*a)*v.sin((a-0.075)*2*v.PI/0.3)+1},bounce:function(a){if(a<1/2.75)a=7.5625*a*a;else if(a<2/2.75){a-=1.5/2.75;a=7.5625*a*a+
0.75}else if(a<2.5/2.75){a-=2.25/2.75;a=7.5625*a*a+0.9375}else{a-=2.625/2.75;a=7.5625*a*a+0.984375}return a}};var V=[],gb=function(){for(var a=+new Date,b=0;b<V[p];b++){var c=V[b];if(!(c.stop||c.el.removed)){var e=a-c.start,f=c.ms,d=c.easing,g=c.from,j=c.diff,h=c.to,i=c.t,k=c.el;c={};var m;if(e<f){e=d(e/f);for(var n in g)if(g[x](n)){switch(ya[n]){case "along":m=e*f*j[n];h.back&&(m=h.len-m);d=ta(h[n],m);k.translate(j.sx-j.x||0,j.sy-j.y||0);j.x=d.x;j.y=d.y;k.translate(d.x-j.sx,d.y-j.sy);h.rot&&k.rotate(j.r+
d.alpha,d.x,d.y);break;case K:m=+g[n]+e*f*j[n];break;case "colour":m="rgb("+[Ha(L(g[n].r+e*f*j[n].r)),Ha(L(g[n].g+e*f*j[n].g)),Ha(L(g[n].b+e*f*j[n].b))][M](",")+")";break;case "path":m=[];d=0;for(var s=g[n][p];d<s;d++){m[d]=[g[n][d][0]];for(var q=1,r=g[n][d][p];q<r;q++)m[d][q]=+g[n][d][q]+e*f*j[n][d][q];m[d]=m[d][M](J)}m=m[M](J);break;case "csv":switch(n){case "translation":m=e*f*j[n][0]-i.x;d=e*f*j[n][1]-i.y;i.x+=m;i.y+=d;m=m+J+d;break;case "rotation":m=+g[n][0]+e*f*j[n][0];g[n][1]&&(m+=","+g[n][1]+
","+g[n][2]);break;case "scale":m=[+g[n][0]+e*f*j[n][0],+g[n][1]+e*f*j[n][1],2 in h[n]?h[n][2]:"",3 in h[n]?h[n][3]:""][M](J);break;case "clip-rect":m=[];for(d=4;d--;)m[d]=+g[n][d]+e*f*j[n][d];break}break;default:s=[].concat(g[n]);m=[];for(d=k.paper.customAttributes[n].length;d--;)m[d]=+s[d]+e*f*j[n][d];break}c[n]=m}k.attr(c);k._run&&k._run.call(k)}else{if(h.along){d=ta(h.along,h.len*!h.back);k.translate(j.sx-(j.x||0)+d.x-j.sx,j.sy-(j.y||0)+d.y-j.sy);h.rot&&k.rotate(j.r+d.alpha,d.x,d.y)}(i.x||i.y)&&
k.translate(-i.x,-i.y);h.scale&&(h.scale+="");k.attr(h);V.splice(b--,1)}}}l.svg&&k&&k.paper&&k.paper.safari();V[p]&&setTimeout(gb)},Ib=function(a,b,c,e,f){var d=c-e;b.timeouts.push(setTimeout(function(){l.is(f,"function")&&f.call(b);b.animate(a,d,a.easing)},e))},Ha=function(a){return O(S(a,255),0)},sa=function(a,b){if(a==null)return{x:this._.tx,y:this._.ty,toString:Ja};this._.tx+=+a;this._.ty+=+b;switch(this.type){case "circle":case "ellipse":this.attr({cx:+a+this.attrs.cx,cy:+b+this.attrs.cy});break;
case "rect":case "image":case "text":this.attr({x:+a+this.attrs.x,y:+b+this.attrs.y});break;case "path":var c=za(this.attrs.path);c[0][1]+=+a;c[0][2]+=+b;this.attr({path:c});break}return this};B.animateWith=function(a,b,c,e,f){for(var d=0,g=V.length;d<g;d++)if(V[d].el.id==a.id)b.start=V[d].start;return this.animate(b,c,e,f)};B.animateAlong=Ka();B.animateAlongBack=Ka(1);B.onAnimation=function(a){this._run=a||0;return this};B.animate=function(a,b,c,e){var f=this;f.timeouts=f.timeouts||[];if(l.is(c,
"function")||!c)e=c||null;if(f.removed){e&&e.call(f);return f}var d={},g={},j=false,h={};for(var i in a)if(a[x](i))if(ya[x](i)||f.paper.customAttributes[x](i)){j=true;d[i]=f.attr(i);d[i]==null&&(d[i]=la[i]);g[i]=a[i];switch(ya[i]){case "along":var k=fb(a[i]),m=ta(a[i],k*!!a.back),n=f.getBBox();h[i]=k/b;h.tx=n.x;h.ty=n.y;h.sx=m.x;h.sy=m.y;g.rot=a.rot;g.back=a.back;g.len=k;a.rot&&(h.r=y(f.rotate())||0);break;case K:h[i]=(g[i]-d[i])/b;break;case "colour":d[i]=l.getRGB(d[i]);k=l.getRGB(g[i]);h[i]={r:(k.r-
d[i].r)/b,g:(k.g-d[i].g)/b,b:(k.b-d[i].b)/b};break;case "path":k=oa(d[i],g[i]);d[i]=k[0];n=k[1];h[i]=[];k=0;for(m=d[i][p];k<m;k++){h[i][k]=[0];for(var s=1,q=d[i][k][p];s<q;s++)h[i][k][s]=(n[k][s]-d[i][k][s])/b}break;case "csv":m=A(a[i]).split(R);n=A(d[i]).split(R);switch(i){case "translation":d[i]=[0,0];h[i]=[m[0]/b,m[1]/b];break;case "rotation":d[i]=n[1]==m[1]&&n[2]==m[2]?n:[0,m[1],m[2]];h[i]=[(m[0]-d[i][0])/b,0,0];break;case "scale":a[i]=m;d[i]=A(d[i]).split(R);h[i]=[(m[0]-d[i][0])/b,(m[1]-d[i][1])/
b,0,0];break;case "clip-rect":d[i]=A(d[i]).split(R);h[i]=[];for(k=4;k--;)h[i][k]=(m[k]-d[i][k])/b;break}g[i]=m;break;default:m=[].concat(a[i]);n=[].concat(d[i]);h[i]=[];for(k=f.paper.customAttributes[i][p];k--;)h[i][k]=((m[k]||0)-(n[k]||0))/b;break}}if(j){i=l.easing_formulas[c];if(!i)if((i=A(c).match(nb))&&i[p]==5){var r=i;i=function(u){return ib(u,+r[1],+r[2],+r[3],+r[4],b)}}else i=function(u){return u};V.push({start:a.start||+new Date,ms:b,easing:i,from:d,diff:h,to:g,el:f,t:{x:0,y:0}});l.is(e,"function")&&
(f._ac=setTimeout(function(){e.call(f)},b));V[p]==1&&setTimeout(gb)}else{c=[];var o;for(var t in a)if(a[x](t)&&qb.test(t)){i={value:a[t]};t=="from"&&(t=0);t=="to"&&(t=100);i.key=X(t,10);c.push(i)}c.sort(tb);c[0].key&&c.unshift({key:0,value:f.attrs});k=0;for(m=c[p];k<m;k++)Ib(c[k].value,f,b/100*c[k].key,b/100*(c[k-1]&&c[k-1].key||0),c[k-1]&&c[k-1].value.callback);(o=c[c[p]-1].value.callback)&&f.timeouts.push(setTimeout(function(){o.call(f)},b))}return this};B.stop=function(){for(var a=0;a<V.length;a++)V[a].el.id==
this.id&&V.splice(a--,1);a=0;for(ii=this.timeouts&&this.timeouts.length;a<ii;a++)clearTimeout(this.timeouts[a]);this.timeouts=[];clearTimeout(this._ac);delete this._ac;return this};B.translate=function(a,b){return this.attr({translation:a+" "+b})};B.toString=function(){return"Rapha\u00ebl\u2019s object"};l.ae=V;var P=function(a){this.items=[];this[p]=0;this.type="set";if(a)for(var b=0,c=a[p];b<c;b++)if(a[b]&&(a[b].constructor==E||a[b].constructor==P)){this[this.items[p]]=this.items[this.items[p]]=
a[b];this[p]++}};P[C][F]=function(){for(var a,b,c=0,e=arguments[p];c<e;c++)if((a=arguments[c])&&(a.constructor==E||a.constructor==P)){b=this.items[p];this[b]=this.items[b]=a;this[p]++}return this};P[C].pop=function(){delete this[this[p]--];return this.items.pop()};for(var Ia in B)if(B[x](Ia))P[C][Ia]=function(a){return function(){for(var b=0,c=this.items[p];b<c;b++)this.items[b][a][I](this.items[b],arguments);return this}}(Ia);P[C].attr=function(a,b){if(a&&l.is(a,Q)&&l.is(a[0],"object"))for(var c=
0,e=a[p];c<e;c++)this.items[c].attr(a[c]);else{c=0;for(e=this.items[p];c<e;c++)this.items[c].attr(a,b)}return this};P[C].animate=function(a,b,c,e){(l.is(c,"function")||!c)&&(e=c||null);var f=this.items[p],d=f,g,j=this,h;e&&(h=function(){!--f&&e.call(j)});c=l.is(c,"string")?c:h;for(g=this.items[--d].animate(a,b,c,h);d--;)this.items[d]&&!this.items[d].removed&&this.items[d].animateWith(g,a,b,c,h);return this};P[C].insertAfter=function(a){for(var b=this.items[p];b--;)this.items[b].insertAfter(a);return this};
P[C].getBBox=function(){for(var a=[],b=[],c=[],e=[],f=this.items[p];f--;){var d=this.items[f].getBBox();a[F](d.x);b[F](d.y);c[F](d.x+d.width);e[F](d.y+d.height)}a=S[I](0,a);b=S[I](0,b);return{x:a,y:b,width:O[I](0,c)-a,height:O[I](0,e)-b}};P[C].clone=function(a){a=new P;for(var b=0,c=this.items[p];b<c;b++)a[F](this.items[b].clone());return a};l.registerFont=function(a){if(!a.face)return a;this.fonts=this.fonts||{};var b={w:a.w,face:{},glyphs:{}},c=a.face["font-family"];for(var e in a.face)if(a.face[x](e))b.face[e]=
a.face[e];if(this.fonts[c])this.fonts[c][F](b);else this.fonts[c]=[b];if(!a.svg){b.face["units-per-em"]=X(a.face["units-per-em"],10);for(var f in a.glyphs)if(a.glyphs[x](f)){c=a.glyphs[f];b.glyphs[f]={w:c.w,k:{},d:c.d&&"M"+c.d.replace(/[mlcxtrv]/g,function(g){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[g]||"M"})+"z"};if(c.k)for(var d in c.k)if(c[x](d))b.glyphs[f].k[d]=c.k[d]}}return a};H.getFont=function(a,b,c,e){e=e||"normal";c=c||"normal";b=+b||{normal:400,bold:700,lighter:300,bolder:800}[b]||400;
if(l.fonts){var f=l.fonts[a];if(!f){a=RegExp("(^|\\s)"+a.replace(/[^\w\d\s+!~.:_-]/g,"")+"(\\s|$)","i");for(var d in l.fonts)if(l.fonts[x](d))if(a.test(d)){f=l.fonts[d];break}}var g;if(f){d=0;for(a=f[p];d<a;d++){g=f[d];if(g.face["font-weight"]==b&&(g.face["font-style"]==c||!g.face["font-style"])&&g.face["font-stretch"]==e)break}}return g}};H.print=function(a,b,c,e,f,d,g){d=d||"middle";g=O(S(g||0,1),-1);var j=this.set(),h=A(c).split(""),i=0;l.is(e,c)&&(e=this.getFont(e));if(e){c=(f||16)/e.face["units-per-em"];
var k=e.face.bbox.split(R);f=+k[0];d=+k[1]+(d=="baseline"?k[3]-k[1]+ +e.face.descent:(k[3]-k[1])/2);k=0;for(var m=h[p];k<m;k++){var n=k&&e.glyphs[h[k-1]]||{},s=e.glyphs[h[k]];i+=k?(n.w||e.w)+(n.k&&n.k[h[k]]||0)+e.w*g:0;s&&s.d&&j[F](this.path(s.d).attr({fill:"#999",stroke:"none",translation:[i,0]}))}j.scale(c,c,f,d).translate(a-f,b-d)}return j};l.format=function(a,b){var c=l.is(b,Q)?[0].concat(b):arguments;a&&l.is(a,"string")&&c[p]-1&&(a=a.replace(jb,function(e,f){return c[++f]==null?"":c[f]}));return a||
""};l.ninja=function(){va.was?Y.Raphael=va.is:delete Raphael;return l};l.el=B;l.st=P[C];va.was?Y.Raphael=l:Raphael=l})();
(function(){Raphael.fn.g=Raphael.fn.g||{};Raphael.fn.g.markers={disc:"disc",o:"disc",flower:"flower",f:"flower",diamond:"diamond",d:"diamond",square:"square",s:"square",triangle:"triangle",t:"triangle",star:"star","*":"star",cross:"cross",x:"cross",plus:"plus","+":"plus",arrow:"arrow","->":"arrow"};Raphael.fn.g.shim={stroke:"none",fill:"#000","fill-opacity":0};Raphael.fn.g.txtattr={font:'10px Helvetica,sans-serif',fill:'#999'};Raphael.fn.g.colors=[];for(var u=[0.6,0.2,0.05,0.1333,0.75,0],s=0;s<10;s++)s<u.length?
Raphael.fn.g.colors.push("hsb("+u[s]+", .75, .75)"):Raphael.fn.g.colors.push("hsb("+u[s-u.length]+", 1, .5)");Raphael.fn.g.text=function(f,c,b){return this.text(f,c,b).attr(this.g.txtattr)};Raphael.fn.g.labelise=function(f,c,b){return f?(f+"").replace(/(##+(?:\.#+)?)|(%%+(?:\.%+)?)/g,function(e,a,g){if(a)return(+c).toFixed(a.replace(/^#+\.?/g,"").length);if(g)return(c*100/b).toFixed(g.replace(/^%+\.?/g,"").length)+"%"}):(+c).toFixed(0)};Raphael.fn.g.finger=function(f,c,b,e,a,g,i){if(a&&!e||!a&&!b)return i?
"":this.path();g={square:"square",sharp:"sharp",soft:"soft"}[g]||"round";var h;e=Math.round(e);b=Math.round(b);f=Math.round(f);c=Math.round(c);switch(g){case "round":if(a){a=Math.floor(b/2);if(e<a){a=e;h=["M",f-Math.floor(b/2)+0.0010,c+0.0010,"l",0,0,"a",Math.floor(b/2),a,0,0,1,b,0,"l",0,0,"z"]}else h=["M",f-a+0.0010,c+0.0010,"l",0,a-e,"a",a,a,0,1,1,b,0,"l",0,e-a,"z"]}else{a=Math.floor(e/2);if(b<a){a=b;h=["M",f+0.5,c+0.5-Math.floor(e/2),"l",0,0,"a",a,Math.floor(e/2),0,0,1,0,e,"l",0,0,"z"]}else h=
["M",f+0.5,c+0.5-a,"l",b-a,0,"a",a,a,0,1,1,0,e,"l",a-b,0,"z"]}break;case "sharp":if(a){a=Math.floor(b/2);h=["M",f+a+0.0010,c+0.0010,"l",-b,0,0,-Math.max(e-a,0),a,-Math.min(a,e),a,Math.min(a,e),a,"z"]}else{a=Math.floor(e/2);h=["M",f+0.5,c+0.5+a,"l",0,-e,Math.max(b-a,0),0,Math.min(a,b),a,-Math.min(a,b),a+(a*2<e),"z"]}break;case "square":h=a?["M",f+0.0010+Math.floor(b/2),c-0.0010,"l",1-b,0,0,-e,b-1,0,"z"]:["M",f,c+Math.floor(e/2),"l",0,-e,b,0,0,e,"z"];break;case "soft":if(a){a=Math.min(Math.round(b/
5),e);h=["M",f-Math.floor(b/2),c,"l",0,a-e,"a",a,a,0,0,1,a,-a,"l",b-2*a,0,"a",a,a,0,0,1,a,a,"l",0,e-a,"z"]}else{a=Math.min(b,Math.round(e/5));h=["M",f+0.5,c+0.5-Math.floor(e/2),"l",b-a,0,"a",a,a,0,0,1,a,a,"l",0,e-a*2,"a",a,a,0,0,1,-a,a,"l",a-b,0,"z"]}}return i?h.join(","):this.path(h)};Raphael.fn.g.disc=function(f,c,b){return this.circle(f,c,b)};Raphael.fn.g.line=function(f,c,b){return this.rect(f-b,c-b/5,2*b,2*b/5)};Raphael.fn.g.square=function(f,c,b){b*=0.7;return this.rect(f-b,c-b,2*b,2*b)};Raphael.fn.g.triangle=
function(f,c,b){b*=1.75;return this.path("M".concat(f,",",c,"m0-",b*0.58,"l",b*0.5,",",b*0.87,"-",b,",0z"))};Raphael.fn.g.diamond=function(f,c,b){return this.path(["M",f,c-b,"l",b,b,-b,b,-b,-b,b,-b,"z"])};Raphael.fn.g.flower=function(f,c,b,e){b*=1.25;b=b;var a=b*0.5;e=+e<3||!e?5:e;for(var g=["M",f,c+a,"Q"],i,h=1;h<e*2+1;h++){i=h%2?b:a;g=g.concat([+(f+i*Math.sin(h*Math.PI/e)).toFixed(3),+(c+i*Math.cos(h*Math.PI/e)).toFixed(3)])}g.push("z");return this.path(g.join(","))};Raphael.fn.g.star=function(f,
c,b,e){e=e||b*0.5;for(var a=["M",f,c+e,"L"],g,i=1;i<10;i++){g=i%2?b:e;a=a.concat([(f+g*Math.sin(i*Math.PI*0.2)).toFixed(3),(c+g*Math.cos(i*Math.PI*0.2)).toFixed(3)])}a.push("z");return this.path(a.join(","))};Raphael.fn.g.cross=function(f,c,b){b/=2.5;return this.path("M".concat(f-b,",",c,"l",[-b,-b,b,-b,b,b,b,-b,b,b,-b,b,b,b,-b,b,-b,-b,-b,b,-b,-b,"z"]))};Raphael.fn.g.plus=function(f,c,b){b/=2;return this.path("M".concat(f-b/2,",",c-b/2,"l",[0,-b,b,0,0,b,b,0,0,b,-b,0,0,b,-b,0,0,-b,-b,0,0,-b,"z"]))};
Raphael.fn.g.arrow=function(f,c,b){return this.path("M".concat(f-b*0.7,",",c-b*0.4,"l",[b*0.6,0,0,-b*0.4,b,b*0.8,-b,b*0.8,0,-b*0.4,-b*0.6,0],"z"))};Raphael.fn.g.tag=function(f,c,b,e,a){e=e||0;a=a==null?5:a;b=b==null?"$9.99":b;var g=0.5522*a,i=this.set();i.push(this.path().attr({fill:"#000",stroke:"none"}));i.push(this.text(f,c,b).attr(this.g.txtattr).attr({fill:"#fff"}));i.update=function(){this.rotate(0,f,c);var h=this[1].getBBox();if(h.height>=a*2)this[0].attr({path:["M",f,c+a,"a",a,a,0,1,1,0,-a*
2,a,a,0,1,1,0,a*2,"m",0,-a*2-3,"a",a+3,a+3,0,1,0,0,(a+3)*2,"L",f+a+3,c+h.height/2+3,"l",h.width+6,0,0,-h.height-6,-h.width-6,0,"L",f,c-a-3].join(",")});else{var j=Math.sqrt(Math.pow(a+3,2)-Math.pow(h.height/2+3,2));this[0].attr({path:["M",f,c+a,"c",-g,0,-a,g-a,-a,-a,0,-g,a-g,-a,a,-a,g,0,a,a-g,a,a,0,g,g-a,a,-a,a,"M",f+j,c-h.height/2-3,"a",a+3,a+3,0,1,0,0,h.height+6,"l",a+3-j+h.width+6,0,0,-h.height-6,"L",f+j,c-h.height/2-3].join(",")})}this[1].attr({x:f+a+3+h.width/2,y:c});e=(360-e)%360;this.rotate(e,
f,c);e>90&&e<270&&this[1].attr({x:f-a-3-h.width/2,y:c,rotation:[180+e,f,c]});return this};i.update();return i};Raphael.fn.g.popupit=function(f,c,b,e,a){e=e==null?2:e;a=a||5;f=Math.round(f)+0.5;c=Math.round(c)+0.5;var g=b.getBBox(),i=Math.round(g.width/2),h=Math.round(g.height/2),j=["M",f-[0,i+a*2,0,-i-a*2][e],c-[-h*2-a*3,-h-a,0,-h-a][e],"l",-a,(e==2)*-a,-Math.max(i-a,0),0,"a",a,a,0,0,1,-a,-a,"l",0,-Math.max(h-a,0),(e==3)*-a,-a,(e==3)*a,-a,0,-Math.max(h-a,0),"a",a,a,0,0,1,a,-a,"l",Math.max(i-a,0),
0,a,!e*-a,a,!e*a,Math.max(i-a,0),0,"a",a,a,0,0,1,a,a,"l",0,Math.max(h-a,0),(e==1)*a,a,(e==1)*-a,a,0,Math.max(h-a,0),"a",a,a,0,0,1,-a,a,"l",-Math.max(i-a,0),0,"z"].join(",");f=[{x:f,y:c+a*2+h},{x:f-a*2-i,y:c},{x:f,y:c-a*2-h},{x:f+a*2+i,y:c}][e];b.translate(f.x-i-g.x,f.y-h-g.y);return this.path(j).attr({fill:"#000",stroke:"none"}).insertBefore(b.node?b:b[0])};Raphael.fn.g.popup=function(f,c,b,e,a,z){e=e==null?2:e;a=a||5;b=b||"";var g=this.set();
g.push(this.path().attr({fill:"#000",stroke:"none"}));g.push(this.text(f,c,b).attr(this.g.txtattr).attr({fill:"#fff"}));
g.push(this.circle(f,c+5,5).attr({stroke:z?"#fff":"#A75848",fill:z?"#987D5C":"#fff"}));
g.update=function(i,h,j){i=i||f;h=h||c;var l=this[1].getBBox(),m=l.width/2,k=l.height/2;l=["M",i-[0,m+a*2,0,-m-a*2][e],h-[-k*2-a*3,-k-a,0,-k-a][e],"l",-a,(e==2)*-a,-Math.max(m-a,0),0,"a",a,a,0,0,1,-a,-a,"l",0,-Math.max(k-a,0),(e==3)*-a,-a,(e==3)*a,-a,0,-Math.max(k-a,0),"a",a,a,0,0,1,a,-a,"l",Math.max(m-a,0),0,a,!e*-a,a,!e*a,Math.max(m-a,0),0,"a",a,a,0,0,1,a,a,"l",0,Math.max(k-a,0),(e==1)*a,a,(e==1)*-a,a,0,Math.max(k-a,0),"a",a,a,0,0,1,-a,a,"l",-Math.max(m-a,0),0,"z"].join(",");i=[{x:i,y:h+a*2+k},{x:i-a*2-m,y:h},{x:i,y:h-a*2-k},{x:i+a*2+m,y:h}][e];if(j){this[0].animate({path:l},500,">");this[1].animate(i,500,">")}else{this[0].attr({path:l});this[1].attr(i)}return this};return g.update(f,c)};Raphael.fn.g.flag=function(f,c,b,e){e=e||0;b=b||"";var a=this.set();a.push(this.path().attr({fill:"#000",stroke:"none"}));a.push(this.text(f,c,b).attr(this.g.txtattr).attr({fill:"#fff"}));a.update=function(g,i){this.rotate(0,g,i);var h=
this[1].getBBox(),j=h.height/2;this[0].attr({path:["M",g,i,"l",j+3,-j-3,h.width+6,0,0,h.height+6,-h.width-6,0,"z"].join(",")});this[1].attr({x:g+j+3+h.width/2,y:i});e=360-e;this.rotate(e,g,i);e>90&&e<270&&this[1].attr({x:g-r-3-h.width/2,y:i,rotation:[180+e,g,i]});return this};return a.update(f,c)};Raphael.fn.g.label=function(f,c,b){var e=this.set();e.push(this.rect(f,c,10,10).attr({stroke:"none",fill:"#000"}));e.push(this.text(f,c,b).attr(this.g.txtattr).attr({fill:"#fff"}));e.update=function(){var a=
this[1].getBBox(),g=Math.min(a.width+10,a.height+10)/2;this[0].attr({x:a.x-g/2,y:a.y-g/2,width:a.width+g,height:a.height+g,r:g})};e.update();return e};Raphael.fn.g.labelit=function(f){var c=f.getBBox(),b=Math.min(20,c.width+10,c.height+10)/2;return this.rect(c.x-b/2,c.y-b/2,c.width+b,c.height+b,b).attr({stroke:"none",fill:"#000"}).insertBefore(f[0])};Raphael.fn.g.drop=function(f,c,b,e,a){e=e||30;a=a||0;var g=this.set();g.push(this.path(["M",f,c,"l",e,0,"A",e*0.4,e*0.4,0,1,0,f+e*0.7,c-e*0.7,"z"]).attr({fill:"#000",
stroke:"none",rotation:[22.5-a,f,c]}));a=(a+90)*Math.PI/180;g.push(this.text(f+e*Math.sin(a),c+e*Math.cos(a),b).attr(this.g.txtattr).attr({"font-size":e*12/30,fill:"#fff"}));g.drop=g[0];g.text=g[1];return g};Raphael.fn.g.blob=function(f,c,b,e){e=(+e+1?e:45)+90;var a=Math.PI/180,g=this.set();g.push(this.path().attr({fill:"#000",stroke:"none"}));g.push(this.text(f+12*Math.sin(e*a),c+12*Math.cos(e*a)-6,b).attr(this.g.txtattr).attr({"font-size":12,fill:"#fff"}));g.update=function(i,h,j){i=i||f;h=h||c;
var l=this[1].getBBox(),m=Math.max(l.width+12,25),k=Math.max(l.height+12,25);l=i+12*Math.sin((e-22.5)*a);var n=h+12*Math.cos((e-22.5)*a);i=i+12*Math.sin((e+22.5)*a);h=h+12*Math.cos((e+22.5)*a);var o=(i-l)/2,p=(h-n)/2;m=m/2;k=k/2;var q=-Math.sqrt(Math.abs(m*m*k*k-m*m*p*p-k*k*o*o)/(m*m*p*p+k*k*o*o));p=q*m*p/k+(i+l)/2;o=q*-k*o/m+(h+n)/2;j?this.animate({x:p,y:o,path:["M",f,c,"L",i,h,"A",m,k,0,1,1,l,n,"z"].join(",")},500,">"):this.attr({x:p,y:o,path:["M",f,c,"L",i,h,"A",m,k,0,1,1,l,n,"z"].join(",")});
return this};g.update(f,c);return g};Raphael.fn.g.colorValue=function(f,c,b,e){return"hsb("+[Math.min((1-f/c)*0.4,1),b||0.75,e||0.75]+")"};
Raphael.fn.g.snapEnds=function(f,c,b){function e(h){return Math.abs(h-0.5)<0.25?Math.floor(h)+0.5:Math.round(h)}var a=f,g=c;if(a==g)return{from:a,to:g,power:0};a=(g-a)/(b||1);var i=g=Math.floor(a);b=0;if(g){for(;i;){b--;i=Math.floor(a*Math.pow(10,b))/Math.pow(10,b)}b++}else{for(;!g;){b=b||1;g=Math.floor(a*Math.pow(10,b))/Math.pow(10,b);b++}b&&b--}g=e(c*Math.pow(10,
b))/Math.pow(10,b);if(g<c)g=e((c+0.5)*Math.pow(10,b))/Math.pow(10,b);a=e((f-(b>0?0:0.5))*Math.pow(10,b))/Math.pow(10,b);return{from:g<1000000?0:a,to:g<1000000?1.1*g:g,power:b}};
Raphael.fn.g.axis=function(f,c,b,e,a,g,i,h,j,l){l=l==null?2:l;j=j||"t";g=g||10;var m=j=="|"||j==" "?["M",f+0.5,c,"l",0,0.0010]:i==1||i==3?["M",f+0.5,c,"l",0,-b]:["M",f,c+0.5,"l",b,0];e=this.g.snapEnds(e,a,g);var k=e.from,n=e.to,o=e.power;if(n<60000){window.wp_ymax=n}a=0;e=this.set();d=(n-k)/g;n=k;var p=o>0?o:0;t=b/g;
if(+i==1||+i==3){g=c;for(k=(i-1?1:-1)*(l+3+!!(i-1));g>=c-b;){j!="-"&&j!=" "&&(m=m.concat(["M",f-(j=="+"||j=="|"?l:!(i-1)*l*2),g+0.5,"l",l*2+1,0]));
e.push(this.text(f+k,g,h&&h[a++]||(Math.round(n)==n?n:+n.toFixed(p))).attr(this.g.txtattr).attr({"text-anchor":i-1?"start":"end"}));n+=d;g-=t}if(Math.round(g+t-(c-b))){j!="-"&&j!=" "&&(m=m.concat(["M",f-(j=="+"||j=="|"?l:!(i-1)*l*2),c-b+0.5,"l",l*2+1,0]));
e.push(this.text(f+k,c-b,h&&h[a]||(Math.round(n)==n?n:+n.toFixed(p))).attr(this.g.txtattr).attr({"text-anchor":i-1?"start":"end"}))}window.wp_axis['y']=m}else{var q=f;n=k;p=o>0?o:0;k=(i?-1:1)*(l+9+!i);var t=b/g,t1=1;
for(g=o=0;q<=f+b;){j!="-"&&j!=" "&&(m=m.concat(["M",q+0.5,c-(j=="+"?l:!!i*l*2),"l",0,l*2+1]));var tt=new Date(n*1000),tt1=tt.getHours(),tt2=tt.getMinutes(),tt3=tt.getDate(),tt4=tt.getMonth()+1;
if(t1%2){e.push(o=this.text(q,c+k,h&&h[a++]||(n>1000000?(wp_range?((tt4<10?'0'+tt4:tt4)+'-'+(tt3<10?'0'+tt3:tt3)):(tt1+':'+(tt2<10?'0':'')+tt2)):(Math.round(n)==n?n:+n.toFixed(p)))).attr(this.g.txtattr))}t1++;n+=d;q+=t}
if(Math.round(q-t-f-b)){j!="-"&&j!=" "&&(m=m.concat(["M",f+b+0.5,c-(j=="+"?l:!!i*l*2),"l",0,l*2+1]));e.push(this.text(f+b,c+k,h&&h[a]||(Math.round(n)==n?n:+n.toFixed(p))).attr(this.g.txtattr))}window.wp_axis['x']=m}if(window.wp_axis['x']&&window.wp_axis['y']){var a=window.wp_axis['x'],b=window.wp_axis['y'],xs=[],ys=[],i=1,c,d,j=0,e,h,g=[];while(a[6*(i++)]){xs.push(a[6*i-5])}i=2;while(b[6*(i++)]){ys.push(b[6*i-4])}
i=0;while((c=xs[i++])&&xs[i]){e=[];j=0;while(d=ys[j++]){if(j%2){e=e.concat(["M",c,d,'l',5,0,"M",c+7,d,'l',5,0,"M",c+14,d,'l',4,0])}}this.path(e)}i=0;while(c=ys[i++]){e=[];j=1;while(d=xs[j++]){if(j%2){e=e.concat(["M",d,c,'l',0,5,"M",d,c+7,'l',0,5,"M",d,c+14,'l',0,4])}}this.path(e)}}
f=this.path(m);f.text=e;f.all=this.set([f,e]);f.remove=function(){this.text.remove();this.constructor.prototype.remove.call(this)};return f};
Raphael.el.lighter=function(f){f=f||2;var c=[this.attrs.fill,this.attrs.stroke];this.fs=this.fs||[c[0],c[1]];c[0]=Raphael.rgb2hsb(Raphael.getRGB(c[0]).hex);c[1]=Raphael.rgb2hsb(Raphael.getRGB(c[1]).hex);c[0].b=Math.min(c[0].b*f,1);c[0].s/=f;c[1].b=Math.min(c[1].b*f,1);c[1].s/=f;this.attr({fill:"hsb("+[c[0].h,c[0].s,c[0].b]+")",stroke:"hsb("+[c[1].h,c[1].s,c[1].b]+")"})};Raphael.el.darker=
function(f){f=f||2;var c=[this.attrs.fill,this.attrs.stroke];this.fs=this.fs||[c[0],c[1]];c[0]=Raphael.rgb2hsb(Raphael.getRGB(c[0]).hex);c[1]=Raphael.rgb2hsb(Raphael.getRGB(c[1]).hex);c[0].s=Math.min(c[0].s*f,1);c[0].b/=f;c[1].s=Math.min(c[1].s*f,1);c[1].b/=f;this.attr({fill:"hsb("+[c[0].h,c[0].s,c[0].b]+")",stroke:"hsb("+[c[1].h,c[1].s,c[1].b]+")"})};Raphael.el.original=function(){if(this.fs){this.attr({fill:this.fs[0],stroke:this.fs[1]});delete this.fs}}})();
Raphael.fn.g.linechart=function(q,t,u,n,h,j,k,x){var X=[];function R(b,f){for(var a=b.length/f,c=0,g=a,i=0,w=[];c<b.length;){g--;if(g<0){i+=b[c]*(1+g);w.push(i/a);i=b[c++]*-g;g+=a}else i+=b[c++]}return w}function V(b,f,a,c,g,i){var w=(a-b)/2,p=(g-a)/2;b=Math.atan((a-b)/Math.abs(c-f));g=Math.atan((g-a)/Math.abs(c-i));b=f<c?Math.PI-b:b;g=i<c?Math.PI-g:g;f=Math.PI/2-(b+g)%(Math.PI*2)/2;return{x1:a-w*Math.sin(f+b),y1:c+w*Math.cos(f+b),x2:a+p*Math.sin(f+g),y2:c+p*Math.cos(f+g)}}
function I(b){for(var f=[],a=0,c=h.length;a<c;a++)f=f.concat(h[a]);f.sort();var g=[],i=[];a=0;for(c=f.length;a<c;a++)f[a]!=f[a-1]&&g.push(f[a])&&i.push(q+d+(f[a]-x)*C);f=g;c=f.length;var w=b||D.set();for(a=0;a<c;a++){g=i[a]-(i[a]-(i[a-1]||q))/2;var p=((i[a+1]||q+u)-i[a])/2+(i[a]-(i[a-1]||q))/2,s;b?s={}:w.push(s=D.rect(g-1,t,Math.max(p+1,1),n).attr({stroke:"none",fill:"#000",opacity:0}));s.values=[];s.symbols=D.set();s.y=[];s.x=i[a];s.axis=f[a];s.timestamp=[];s.time=[];p=0;for(var J=j.length;p<J;p++){g=h[p]||h[0];
g1=X[p]||X[0];for(var E=0,W=g.length;E<W;E++)
if(g[E]==f[a]){var tt=new Date(g[E]*1000),tt1=tt.getHours(),tt2=tt.getMinutes(),tt3=tt.getDate(),tt4=tt.getMonth()+1;s.values.push(j[p][E]);s.y.push(t+n-d-(j[p][E]-A)*H);
s.timestamp.push(g1[E]);s.time.push(wp_range?((tt4<10?'0'+tt4:tt4)+'-'+(tt3<10?'0'+tt3:tt3)):((tt1<10?'0'+tt1:tt1)+':'+(tt2<10?'0'+tt2:tt2)));
s.symbols.push(m.symbols[p][E])}}b&&b.call(s)}!b&&(v=w)}function M(b){for(var f=b||D.set(),a,c=0,g=j.length;c<g;c++)for(var i=0,w=j[c].length;i<w;i++){var p=q+d+((h[c]||h[0])[i]-x)*C,s=q+d+((h[c]||h[0])[i?i-1:1]-x)*C,J=t+n-d-(j[c][i]-A)*H;b?a={}:f.push(a=D.circle(p,J,Math.abs(s-p)/2).attr({stroke:"none",fill:"#000",opacity:0}));a.x=p;a.y=J;a.value=j[c][i];a.line=m.lines[c];a.shade=m.shades[c];a.symbol=m.symbols[c][i];a.symbols=m.symbols[c];a.axis=(h[c]||h[0])[i];b&&b.call(a)}!b&&
(F=f)}k=k||{};this.raphael.is(h[0],"array")||(h=[h]);this.raphael.is(j[0],"array")||(j=[j]);for(var d=k.gutter||10,o=Math.max(h[0].length,j[0].length),N=k.symbol||"",O=k.colors||Raphael.fn.g.colors,D=this,v=null,F=null,m=this.set(),l=[],e=0,y=j.length;e<y;e++)o=Math.max(o,j[e].length);var K=this.set();e=0;for(y=j.length;e<y;e++){if(k.shade)K.push(this.path().attr({stroke:"none",fill:'#999',opacity:k.nostroke?1:0.3}));if(j[e].length>u-2*d){j[e]=R(j[e],u-2*d);o=u-2*d}
X.push(h[e]);if(h[e]&&h[e].length>u-2)h[e]=R(h[e],
u-2*d)}l=Array.prototype.concat.apply([],h);o=Array.prototype.concat.apply([],j);var a,a2=0,a3,a4=0,a5=[];while(a1=h[a2++]){while(a3=a1[a4++]){a5[Math.ceil(a3)]=1}}l=this.g.snapEnds(Math.min.apply(Math,l),Math.max.apply(Math,l),a5.length-1);var x=l.from;l=l.to;o=this.g.snapEnds(Math.min.apply(Math,o),Math.max.apply(Math,o),j[0].length-1);
var A=o.from;e=o.to*1.15;var C=(u-d*2)/(l-x||1),H=(n-d*2)/(e-A||1);o=this.set();if(k.axis){y=(k.axis+"").split(/[,\s]+/);+y[0]&&o.push(this.g.axis(q+d,t+d,u-2*d,x,l,k.axisxstep||Math.floor((u-2*d)/20),2));+y[1]&&o.push(this.g.axis(q+u-d,t+n-d,n-2*
d,A,e,k.axisystep||Math.floor((n-2*d)/20),3));+y[2]&&o.push(this.g.axis(q+d,t+n-d,u-2*d,x,l,k.axisxstep||Math.floor((u-2*d)/20),0));+y[3]&&o.push(this.g.axis(q+d,t+n-d,n-2*d,A,e,k.axisystep||Math.floor((n-2*d)/20),1))}var P=this.set(),Q=this.set(),S;e=0;for(y=j.length;e<y;e++){
k.nostroke||P.push(S=this.path().attr({stroke:k.colors[e+1]||k.colors[k.colors.length-1],"stroke-width":k.width||2,"stroke-linejoin":"round","stroke-linecap":"round","stroke-dasharray":k.dash||""}));
var G=this.raphael.is(N,"array")?N[e]:N,T=this.set();l=[];for(var r=0,U=j[e].length;r<U;r++){var z=q+d+((h[e]||h[0])[r]-x)*C,B=t+n-d-(j[e][r]-A)*H;if(k.smooth){if(r&&r!=U-1){var L=V(q+d+((h[e]||h[0])[r-1]-x)*C,t+n-d-(j[e][r-1]-A)*H,z,B,q+d+((h[e]||h[0])[r+1]-x)*C,t+n-d-(j[e][r+1]-A)*H);l=l.concat([L.x1,L.y1,z,B,L.x2,L.y2])}r||(l=["M",z,B,"C",z,B])}else l=l.concat([r?"L":"M",z,B])}if(k.smooth)l=l.concat([z,B,z,B]);Q.push(T);if(k.shade)K[e].attr({path:l.concat(["L",z,t+n-d,"L",q+d+((h[e]||h[0])[0]-x)*C,t+n-d,"z"]).join(",")});!k.nostroke&&S.attr({path:l.join(",")})}
if(window.wp_ymax>window.wp_timeout*1.2){
var to=Math.round(200*(1-window.wp_timeout/window.wp_ymax))+0.5;P.push(this.path('M34.5,'+to+'L433.5,'+to).attr({stroke:'#bf0000',"stroke-width":1,"stroke-linejoin":"round","stroke-linecap":"round"}))}
m.push(P,K,Q,o,v,F);m.lines=P;m.shades=K;m.symbols=Q;m.axis=o;m.hoverColumn=function(b,f){!v&&I();v.mouseover(b).mouseout(f);return this};m.selectColumn=function(b,f,h){!v&&I();v.mousedown(b).mousemove(h).mouseup(f);return this};m.clickColumn=function(b){!v&&I();v.click(b);return this};m.hrefColumn=function(b){var f=D.raphael.is(arguments[0],"array")?arguments[0]:arguments;if(!(arguments.length-1)&&typeof b=="object")for(var a in b)for(var c=0,g=v.length;c<g;c++)v[c].axis==a&&v[c].attr("href",b[a]);!v&&I();c=0;for(g=f.length;c<g;c++)v[c]&&v[c].attr("href",f[c]);return this};m.hover=function(b,f){!F&&M();F.mouseover(b).mouseout(f);return this};m.click=function(b){!F&&M();F.click(b);return this};m.each=function(b){M(b);return this};m.eachColumn=function(b){I(b);return this};return m};
function wp_build_chart(id,width,height,times,values,ms,err,traces,codes,timeout,scale) {
var container=_('#'+id)[0],icon=_('.wp-content-check-graph-restore-icon',container.parentNode.parentNode)[0],i=0,j,k=0,l=0,m=[[]],n=[[]],o=['#999',values[0]?'#9B7D5C':'#E57A7A'],p=0,q='';
container.innerHTML='';
if(icon){icon.style.display=scale?'block':'none'}
_.win.wp_range=times[times.length-1]-times[0]>86400?1:0;_.win.wp_axis=[];_.win.wp_width=width;_.win.wp_height=height;
while(j=times[i]){m[l].push(values[i]);n[l].push(times[i]);if(traces[times[i]]){p=l;q=traces[times[i]]}if(typeof values[i+1]!=='undefined'){if(values[i+1]&&!values[i]){o.push('#9B7D5C');m[l].push(values[i+1]);n[l].push(times[i+1]);l++;m.push([]);n.push([])}if(!values[i+1]&&values[i]){o.push('#E57A7A');l++;m.push([values[i]]);n.push([times[i]])}}if(p!=l){var a=0,b;while(b=n[p][a++]){traces[b]=q}}i++}if(o.length!=l){o.push(o[o.length-1]=='#9B7D5C'?'#E57A7A':'#9B7D5C')}
window.wp_timeout=timeout;var r=Raphael(id),lines=r.g.linechart(24,10,width,height,n,m,{nostroke:false,axis:"0 0 1 1",symbol:"o",width:4,smooth:true,shade:true,colors:o});
lines.clickColumn(function(){var a,b,c,d='',e=0,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",g;for(var i=0,ii=this.y.length;i<ii;i++){a=this.values[i];b=this.timestamp[i]}if(!a&&typeof(g=traces[this.timestamp])!=='undefined'){c='<!DOCTYPE html><html><title>WEBO Pulsar</title></head><body><blockquote><pre>'+g.replace(/###/g,"\n").replace(/@@@/g,';')+'</pre></blockquote></body></html>';for(var n=0;n<c.length;n++){var a=c.charCodeAt(n);if(a<128){d+=String.fromCharCode(a)}else if((a>127)&&(a<2048)){d+=String.fromCharCode((a>>6)|192)+String.fromCharCode((a & 63)|128)}else{d+=String.fromCharCode((a>>12)|224)+String.fromCharCode(((a>>6)&63)|128)+String.fromCharCode((a&63)|128)}}c=d;d='';while(e<c.length){var a=c.charCodeAt(e++),b=c.charCodeAt(e++),t=c.charCodeAt(e++),x=a>>2,y=((a&3)<<4)|(b>>4),z=((b&15)<<2)|(t>>6),s=t&63;if(isNaN(b)){z=s=64}else if(isNaN(t)){s=64}d+=f.charAt(x)+f.charAt(y)+f.charAt(z)+f.charAt(s)}window.open('data:text/html;base64,'+d,'mywindow','width=800,height=600,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes')}});
if(!_.browser.ie){lines.hoverColumn(function(){this.tags=r.set();this.tags.attr({fill:'#fff'});for(var i=0,ii=this.y.length;i<ii;i++){var a=this.values[i];
this.tags.push(r.g.popup(this.x,this.y[i]-5,(a?Math.round(a)+" "+ms:err+' '+codes[this.timestamp[i]])+"\n"+this.time[i],2,6,a).insertBefore(this).attr([{fill:a?'90-#8C5925-#9E7C5A':'90-#7F0000-#AB5651',stroke:a?'#fff':'#926060'}]))}},
function(){this.tags&&this.tags.remove()});lines.selectColumn(function(){_.win.x_start=this.x},
function(){var x1,x2,i=0,new_times=[],new_values=[],h=times.length/400;if(this.x<_.win.x_start){x2=_.win.x_start;x1=this.x}else{x1=_.win.x_start-32;x2=this.x-32}_.win.x_start=0;_('#'+id+'-hover')[0].style.width=0;if(x2-x1>5){while(times[i]){if(h*x1<i+1&&h*x2>i-1){new_times.push(times[i]);new_values.push(values[i])}i++}wp_build_chart(id,width,height,new_times,new_values,ms,err,traces,codes,timeout,1)}},
function(){if(_.win.x_start){var x1,x2,h=_('#'+id+'-hover')[0].style;if(this.x<_.win.x_start){x2=_.win.x_start;x1=this.x}else{x1=_.win.x_start;x2=this.x}h.width=x2-x1-3+'px';h.left=13+x1+'px'}}
);

}
r.g.txtattr.font='12px Helvetica,sans-serif';
}

