Prototype constructor in javascript

What is the need or use of prototype in java script constructors?
what is the difference between the following two code samples?
/// 1 ///////////////
function cat(name) {
     this.name = name;
     this.talk = function() {
          alert( this.name + " say meeow!" )
this.changename=function(name){
this.name=name
and
/// 2 ///////////////
cat.prototype.changeName = function(name) {
     this.name = name;
Please explain the above code. I have not tried the sample code 1. I just ask you to explain. What is the need for concept of constructor in Java script, if I could call a normal function as a constructor with new operator and treat it as a normal function as such with out a new operator?

What is the similar between Java and Javascript?
The first 4 letters.
While you can usually get away with asking JS questions here because they often relate to web stuff, this type of question is a pure JS question and definitely doesn't belong here. Go find a Javascript forum.

Similar Messages

  • Multiple Effects in line // Effect.Move & updateContent

    Hi all!
    Could anybody kindly help me out? I'm totally confused about
    how to reach the following function:
    I want three actions to be made after another.
    1.) Move the <div id="main> with Effect.Move to a
    defined position, then...
    2.) Update the Content of the element <div
    id="content"> using Utils.updateContent , and if done...
    3.) move the <div id="main"> to a defined position
    again
    The ele and url variables should be passed with the link to
    start this function,
    such as < onClick="myFunction('the_ele', 'the_url.php');
    I could reach a little success, however without the first
    effect, with this one, but how can i add the first effect here,
    since Effect.Move does not support a "finish:"-function (afaik)?
    <script language="javascript" type="text/javascript">
    function myCtL(ele,url){
    Spry.Utils.updateContent(ele, url, function()
    {move_effect2.start();} );
    </script>
    Another possibility may be to make use of a cluster, but i
    don't know how to pass the variables 'ele' and 'url' for the
    UpdateContent function.
    My Cluster-experiment did look like this, however without
    success:
    <script type="text/javascript">
    UltraMove = function(element, options)
    Spry.Effect.Cluster.call(this, options);
    var StartMover = move_effect1;
    var Update = Spry.Utils.updateContent(ele,url);
    var EndMover = move_effect2;
    this.addNextEffect(StartMover);
    this.addNextEffect(CtLdr);
    this.addNextEffect(EndMover);
    UltraMove.prototype = new Spry.Effect.Cluster();
    UltraMove.prototype.constructor = UltraMove;
    </script>
    As you will surely notice, i'm a newbie concernig ajax and js
    and taking a closer look ath the samples and documents has
    extremely confused me! :-)
    Thanks in advance for any kind of help or hint!!!
    Hardy

    Hi Hardy,
    The pattern you seek (effect, update, effect) can be seen in
    this sample:
    http://labs.adobe.com/technologies/spry/samples/utils/update_content.html
    Basically you need to chain your events together by using
    observers or callback functions. In the sample above, this function
    shows the pattern:
    function fadeIt(ele,url){
    Spry.Effect.DoFade('apDiv1',{ duration: 500, from: 100, to:
    0, finish: function() {
    Spry.Utils.updateContent(ele, url, function() {
    Spry.Effect.DoFade('apDiv1',{ duration: 500, from: 0, to:
    100 });
    The function above chains the events together by defining
    callback functions for each step which then trigger the next step.
    --== Kin ==--

  • Tool tip to not move

    Hi I'm a big fan. long time lurker first time poster
    Currently the position of the tool tip depends on where the cursor first hovers over the image.  Is there a way for the tool tip to appear in the same place no mater where the image is hovered?
    below is the js and css
    thanks
    // SpryTooltip.js - version 0.9 - Spry 1.6.1
    (function() { // BeginSpryComponent
    if (typeof Spry == "undefined") window.Spry = {}; if (!Spry.Widget) Spry.Widget = {};
    Spry.Widget.BrowserSniff = function()
    var b = navigator.appName.toString();
    var up = navigator.platform.toString();
    var ua = navigator.userAgent.toString();
    this.mozilla = this.ie = this.opera = this.safari = false;
    var re_opera = /Opera.([0-9\.]*)/i;
    var re_msie = /MSIE.([0-9\.]*)/i;
    var re_gecko = /gecko/i;
    var re_safari = /(applewebkit|safari)\/([\d\.]*)/i;
    var r = false;
    if ( (r = ua.match(re_opera))) {
    this.opera = true;
    this.version = parseFloat(r[1]);
    } else if ( (r = ua.match(re_msie))) {
    this.ie = true;
    this.version = parseFloat(r[1]);
    } else if ( (r = ua.match(re_safari))) {
    this.safari = true;
    if(parseFloat(r[2]) < 420)
    this.version = 2;
    else
    this.version = 3;
    } else if (ua.match(re_gecko)) {
    var re_gecko_version = /rv:\s*([0-9\.]+)/i;
    r = ua.match(re_gecko_version);
    this.mozilla = true;
    this.version = parseFloat(r[1]);
    this.windows = this.mac = this.linux = false;
    this.Platform = ua.match(/windows/i) ? "windows" :
    (ua.match(/linux/i) ? "linux" :
    (ua.match(/mac/i) ? "mac" :
    ua.match(/unix/i)? "unix" : "unknown"));
    this[this.Platform] = true;
    this.v = this.version;
    if (this.safari && this.mac && this.mozilla) {
    this.mozilla = false;
    Spry.is = new Spry.Widget.BrowserSniff();
    Spry.Widget.Tooltip = function(tooltip_element, trigger_selector, options)
    options = Spry.Widget.Utils.firstValid(options, {});
    this.init(trigger_selector, tooltip_element, options);
    if (Spry.Widget.Tooltip.onloadDidFire)
    this.attachBehaviors();
    Spry.Widget.Tooltip.loadQueue.push(this);
    Spry.Widget.Tooltip.prototype.init = function(trigger_element, tooltip_element, options)
    var Utils = Spry.Widget.Utils;
    this.triggerElements = Utils.getElementsByClassName(trigger_element);
    this.tooltipElement = Utils.getElement(tooltip_element);
    options.showDelay = parseInt(Utils.firstValid(options.showDelay, 0), 10);
    options.hideDelay = parseInt(Utils.firstValid(options.hideDelay, 0), 10);
    if (typeof this.triggerElements == 'undefined' || !(this.triggerElements.length > 0))
    this.showError('The element(s) "' + trigger_element + '" do not exist in the page');
    return false;
    if (typeof this.tooltipElement == 'undefined' || !this.tooltipElement)
    this.showError('The element "' + tooltip_element + '" do not exists in the page');
    return false;
    this.listenersAttached = false;
    this.hoverClass = "";
    this.followMouse = false;
    this.offsetX = 15;
    this.offsetY = 15;
    this.closeOnTooltipLeave = false;
    this.useEffect = false;
    Utils.setOptions(this, options);
    this.animator = null;
    for (var i =0; i < this.triggerElements.length; i++)
    if (!this.triggerElements[i].className)
    this.triggerElements[i].className = '';
    if (this.useEffect){
    switch (this.useEffect.toString().toLowerCase()){
    case 'blind': this.useEffect = 'Blind'; break;
    case 'fade': this.useEffect = 'Fade'; break;
    default:
    this.useEffect = false;
    this.visibleTooltip = false;
    // Hack for FF 3 - Safari 3: force painting of the element, in order to have the correct display
    this.tooltipElement.offsetHeight;
    // Optimisation: save browser work if display is already 'none'
    if (Spry.Widget.Utils.getStyleProperty(this.tooltipElement, 'display') != 'none')
    this.tooltipElement.style.display = 'none';
    if (typeof this.offsetX != 'numeric')
    this.offsetX = parseInt(this.offsetX, 10);
    if (isNaN(this.offsetX))
    this.offsetX = 0;
    if (typeof this.offsetY != 'numeric')
    this.offsetY = parseInt(this.offsetY, 10);
    if (isNaN(this.offsetY))
    this.offsetY = 0;
    this.tooltipElement.style.position = 'absolute';
    this.tooltipElement.style.top = '0px';
    this.tooltipElement.style.left = '0px';
    Spry.Widget.Tooltip.onloadDidFire = false;
    Spry.Widget.Tooltip.loadQueue = [];
    Spry.Widget.Tooltip.addLoadListener = function(handler)
    if (typeof window.addEventListener != 'undefined')
    window.addEventListener('load', handler, false);
    else if (typeof document.addEventListener != 'undefined')
    document.addEventListener('load', handler, false);
    else if (typeof window.attachEvent != 'undefined')
    window.attachEvent('onload', handler);
    Spry.Widget.Tooltip.processLoadQueue = function(handler)
    Spry.Widget.Tooltip.onloadDidFire = true;
    var q = Spry.Widget.Tooltip.loadQueue;
    var qlen = q.length;
    for (var i = 0; i < qlen; i++)
    if (!q[i].listenersAttached)
    q[i].attachBehaviors();
    Spry.Widget.Tooltip.addLoadListener(Spry.Widget.Tooltip.processLoadQueue);
    Spry.Widget.Tooltip.prototype.addClassName = function(ele, className)
    if (!ele || !className)
    return;
    if (ele.className.indexOf(className) == -1)
    ele.className += (ele.className ? " " : "") + className;
    Spry.Widget.Tooltip.prototype.removeClassName = function(ele, className)
    if (!ele || !className )
    return;
    ele.className = ele.className.replace(new RegExp("\\s*\\b" + className + "\\b", "g"), "");
    Spry.Widget.Tooltip.prototype.showTooltip = function()
    if (!this.visibleTooltip)
    this.tooltipElement.style.visibility = 'hidden';
    this.tooltipElement.style.zIndex = '9999';
    this.tooltipElement.style.display = 'block';
    Spry.Widget.Utils.putElementAt(this.tooltipElement, this.pos, {x:this.offsetX, y:this.offsetY}, true);
    if(Spry.is.ie && Spry.is.version == '6')
    this.createIframeLayer(this.tooltipElement);
    if (!this.visibleTooltip)
    if (this.useEffect)
    if (typeof this.showEffect == 'undefined')
    this.showEffect = new Spry.Widget.Tooltip[this.useEffect](this.tooltipElement, {from: 0, to: 1});
    this.showEffect.start();
    else
    this.tooltipElement.style.visibility = 'visible';
    this.visibleTooltip = true;
    Spry.Widget.Tooltip.prototype.hideTooltip = function(quick)
    if (this.useEffect && !quick)
    if (typeof this.hideEffect == 'undefined')
    this.hideEffect = new Spry.Widget.Tooltip[this.useEffect](this.tooltipElement, {from: 1, to: 0});
    this.hideEffect.start();
    else
    if (typeof this.showEffect != 'undefined')
    this.showEffect.stop();
    this.tooltipElement.style.display = 'none';
    if(Spry.is.ie && Spry.is.version == '6')
    this.removeIframeLayer(this.tooltipElement);
    if (this.hoverClass && !this.hideTimer)
    for (var i = 0; i < this.triggerElements.length; i++)
    this.removeClassName(this.triggerElements[i], this.hoverClass);
    this.visibleTooltip = false;
    Spry.Widget.Tooltip.prototype.displayTooltip = function(show) {
    if (this.tooltipElement)
    if (this.hoverClass){
    for (var i = 0; i < this.triggerElements.length; i++)
    this.removeClassName(this.triggerElements[i], this.hoverClass);
    if (show)
    if (this.hideTimer)
    clearInterval(this.hideTimer);
    delete(this.hideTimer);
    if (this.hoverClass)
    if (typeof this.triggerHighlight != 'undefined')
    this.addClassName(this.triggerHighlight, this.hoverClass);
    var self = this;
    this.showTimer = setTimeout(function(){self.showTooltip()}, this.showDelay);
    else
    if (this.showTimer)
    clearInterval(this.showTimer);
    delete(this.showTimer);
    var self = this;
    this.hideTimer = setTimeout(function(){self.hideTooltip();}, this.hideDelay);
    this.refreshTimeout();
    Spry.Widget.Tooltip.prototype.onMouseOverTrigger = function(e)
    var target = '';
    if (Spry.is.ie)
    target = e.srcElement;
    else
    target = e.target;
    var contains = Spry.Widget.Utils.contains;
    for (var i = 0; i < this.triggerElements.length; i++)
    if (contains(this.triggerElements[i], target))
    target = this.triggerElements[i];
    break;
    if (i == this.triggerElements.length) return;
    if (this.visibleTooltip && this.triggerHighlight && this.triggerHighlight == target)
    if (this.hideTimer)
    clearInterval(this.hideTimer);
    delete(this.hideTimer);
    if (this.hoverClass)
    if (typeof this.triggerHighlight != 'undefined')
    this.addClassName(this.triggerHighlight, this.hoverClass);
    return;
    var pos = Spry.Widget.Utils.getAbsoluteMousePosition(e);
    this.pos = {x: pos.x + this.offsetX, y: pos.y + this.offsetY};
    this.triggerHighlight = target;
    Spry.Widget.Tooltip.closeAll();
    this.displayTooltip(true);
    Spry.Widget.Tooltip.prototype.onMouseMoveTrigger = function(e)
    var pos = Spry.Widget.Utils.getAbsoluteMousePosition(e);
    this.pos = {x: pos.x + this.offsetX, y: pos.y + this.offsetY};
    if (this.visibleTooltip)
    this.showTooltip();
    Spry.Widget.Tooltip.prototype.onMouseOutTrigger = function(e)
    var target = '';
    if (Spry.is.ie)
    target = e.toElement;
    else
    target = e.relatedTarget;
    var contains = Spry.Widget.Utils.contains;
    for (var i=0; i < this.triggerElements.length; i++)
    if (contains(this.triggerElements[i], target))
    return;
    this.displayTooltip(false);
    Spry.Widget.Tooltip.prototype.onMouseOutTooltip = function(e)
    var target = '';
    if (Spry.is.ie)
    target = e.toElement;
    else
    target = e.relatedTarget;
    var contains = Spry.Widget.Utils.contains;
    if (contains(this.tooltipElement, target))
    return;
    this.displayTooltip(false);
    Spry.Widget.Tooltip.prototype.onMouseOverTooltip = function(e)
    if (this.hideTimer)
    clearInterval(this.hideTimer);
    delete(this.hideTimer);
    if (this.hoverClass)
    if (typeof this.triggerHighlight != 'undefined')
    this.addClassName(this.triggerHighlight, this.hoverClass);
    Spry.Widget.Tooltip.prototype.refreshTimeout = function()
    if (Spry.Widget.Tooltip.refreshTimeout != null)
    clearTimeout(Spry.Widget.Tooltip.refreshTimeout);
    Spry.Widget.Tooltip.refreshTimeout = null;
    Spry.Widget.Tooltip.refreshTimeout = setTimeout(Spry.Widget.Tooltip.refreshAll, 100);
    Spry.Widget.Tooltip.prototype.destroy = function()
    for (var k in this)
    try{
    if (typeof this.k == 'object' && typeof this.k.destroy == 'function') this.k.destroy();
    delete this.k;
    }catch(err){}
    Spry.Widget.Tooltip.prototype.checkDestroyed = function()
    // checks the parent node. If it exists, then the element is still in the DOM
    if (!this.tooltipElement || this.tooltipElement.parentNode == null)
    return true;
    return false;
    Spry.Widget.Tooltip.prototype.attachBehaviors = function()
    var self = this;
    var ev = Spry.Widget.Utils.addEventListener;
    for (var i=0; i< this.triggerElements.length; i++)
    ev(this.triggerElements[i], 'mouseover', function(e) {self.onMouseOverTrigger(e || event); return true;}, false);
    ev(this.triggerElements[i], 'mouseout', function(e) {self.onMouseOutTrigger(e || event); return true;}, false);
    if (this.followMouse)
    ev(this.triggerElements[i], 'mousemove', function(e) {self.onMouseMoveTrigger(e || event); return true;}, false);
    if (this.closeOnTooltipLeave)
    ev(this.tooltipElement, 'mouseover', function(e){self.onMouseOverTooltip(e || event); return true;}, false);
    ev(this.tooltipElement, 'mouseout', function(e){self.onMouseOutTooltip(e || event); return true;}, false);
    this.listenersAttached = true;
    // createIframeLayer for Tooltip
    // creates an IFRAME underneath a tooltip element so that it will show above form controls and ActiveX
    Spry.Widget.Tooltip.prototype.createIframeLayer = function(tooltip)
    if (typeof this.iframeLayer == 'undefined')
    var layer = document.createElement('iframe');
    layer.tabIndex = '-1';
    layer.src = 'javascript:"";';
    layer.scrolling = 'no';
    layer.frameBorder = '0';
    layer.className = 'iframeTooltip';
    tooltip.parentNode.appendChild(layer);
    this.iframeLayer = layer;
    this.iframeLayer.style.left = tooltip.offsetLeft + 'px';
    this.iframeLayer.style.top = tooltip.offsetTop + 'px';
    this.iframeLayer.style.width = tooltip.offsetWidth + 'px';
    this.iframeLayer.style.height = tooltip.offsetHeight + 'px';
    this.iframeLayer.style.display = 'block';
    // removeIframeLayer for Tooltip Element
    // removes an IFRAME underneath a tooltip to reveal any form controls and ActiveX
    Spry.Widget.Tooltip.prototype.removeIframeLayer =  function(tooltip)
    if (this.iframeLayer)
    this.iframeLayer.style.display = 'none';
    Spry.Widget.Tooltip.prototype.showError = function(msg)
    alert('Spry.Widget.Tooltip ERR: ' + msg);
    Spry.Widget.Tooltip.refreshAll = function()
    var q = Spry.Widget.Tooltip.loadQueue;
    var qlen = q.length;
    for (var i = 0; i < qlen ; i++)
    if (q[i].checkDestroyed())
    // the trigger element is no longer in the dom, we should remove the current widget.
    q[i].destroy();
    q.splice(i, 1);
    i--;
    qlen = q.length;
    Spry.Widget.Tooltip.closeAll = function()
    var q = Spry.Widget.Tooltip.loadQueue;
    var qlen = q.length;
    for (var i = 0; i < qlen ; i++)
    if (q[i].visibleTooltip)
    q[i].hideTooltip(true);
    if (q[i].showTimer)
    clearTimeout(q[i].showTimer);
    if (q[i].hideTimer)
    clearTimeout(q[i].hideTimer);
    Spry.Widget.Tooltip.Animator = function(element, opts)
    this.timer = null;
    this.fps = 60;
    this.duration = 500;
    this.startTime = 0;
    this.transition = Spry.Widget.Tooltip.Animator.defaultTransition;
    this.onComplete = null;
    if (typeof element == 'undefined') return;
    this.element = Spry.Widget.Utils.getElement(element);
    Spry.Widget.Utils.setOptions(this, opts, true);
    this.interval = this.duration / this.fps;
    Spry.Widget.Tooltip.Animator.defaultTransition = function(time, begin, finish, duration) { time /= duration; return begin + ((2 - time) * time * finish); };
    Spry.Widget.Tooltip.Animator.prototype.start = function()
    var self = this;
    this.startTime = (new Date).getTime();
    this.beforeStart();
    this.timer = setInterval(function() { self.stepAnimation(); }, this.interval);
    Spry.Widget.Tooltip.Animator.prototype.stop = function()
    if (this.timer)
    clearTimeout(this.timer);
    this.timer = null;
    Spry.Widget.Tooltip.Animator.prototype.stepAnimation = function(){};
    Spry.Widget.Tooltip.Animator.prototype.beforeStart = function(){};
    Spry.Widget.Tooltip.Animator.prototype.destroy = function()
    for (var k in this)
    try
    delete this.k;
    }catch(err){}
    Spry.Widget.Tooltip.Fade = function(element, opts)
    Spry.Widget.Tooltip.Animator.call(this, element, opts);
    if (Spry.is.ie)
    this.origOpacity = this.element.style.filter;
    else
    this.origOpacity = this.element.style.opacity;
    Spry.Widget.Tooltip.Fade.prototype = new Spry.Widget.Tooltip.Animator();
    Spry.Widget.Tooltip.Fade.prototype.constructor = Spry.Widget.Tooltip.Fade;
    Spry.Widget.Tooltip.Fade.prototype.stepAnimation = function()
    var curTime = (new Date).getTime();
    var elapsedTime = curTime - this.startTime;
    var i, obj;
    if (elapsedTime >= this.duration)
    this.beforeStop();
    this.stop();
    return;
    var ht = this.transition(elapsedTime, this.from, this.to - this.from, this.duration);
    if (Spry.is.ie)
    var filter = this.element.style.filter.replace(/alpha\s*\(\s*opacity\s*=\s*[0-9\.]{1,3}\)/, '');
    this.element.style.filter = filter + 'alpha(opacity=' + parseInt(ht * 100, 10) + ')';
    else
    this.element.style.opacity = ht;
    this.element.style.visibility = 'visible';
    this.element.style.display = 'block';
    Spry.Widget.Tooltip.Fade.prototype.beforeStop = function()
    if (this.from > this.to)
    this.element.style.display = 'none';
    if (Spry.is.mozilla)
    this.element.style.filter = this.origOpacity;
    else
    this.element.style.opacity = this.origOpacity;
    Spry.Widget.Tooltip.Blind = function(element, opts)
    this.from = 0;
    this.to = 100;
    Spry.Widget.Tooltip.Animator.call(this, element, opts);
    this.element.style.visibility = 'hidden';
    this.element.style.display = 'block';
    this.origHeight = parseInt(Spry.Widget.Utils.getStyleProperty(this.element, 'height'),10);
    if (isNaN(this.origHeight))
    this.origHeight = this.element.offsetHeight;
    if (this.to == 0)
    this.from = this.origHeight;
    else
    this.to = this.origHeight;
    Spry.Widget.Tooltip.Blind.prototype = new Spry.Widget.Tooltip.Animator();
    Spry.Widget.Tooltip.Blind.prototype.constructor = Spry.Widget.Tooltip.Blind;
    Spry.Widget.Tooltip.Blind.prototype.beforeStart = function()
    this.origOverflow = Spry.Widget.Utils.getStyleProperty(this.element, 'overflow');
    this.element.style.overflow = 'hidden';
    Spry.Widget.Tooltip.Blind.prototype.stepAnimation = function()
    var curTime = (new Date).getTime();
    var elapsedTime = curTime - this.startTime;
    var i, obj;
    if (elapsedTime >= this.duration)
    this.beforeStop();
    this.stop();
    return;
    var ht = this.transition(elapsedTime, this.from, this.to - this.from, this.duration);
    this.element.style.height = Math.floor(ht) + 'px';
    this.element.style.visibility = 'visible';
    this.element.style.display = 'block';
    Spry.Widget.Tooltip.Blind.prototype.beforeStop = function()
    this.element.style.overflow = this.origOverflow;
    if (this.from > this.to)
    this.element.style.display = 'none';
    this.element.style.height = this.origHeight + 'px';
    // Spry.Widget.Utils
    if (!Spry.Widget.Utils) Spry.Widget.Utils = {};
    Spry.Widget.Utils.setOptions = function(obj, optionsObj, ignoreUndefinedProps)
    if (!optionsObj)
    return;
    for (var optionName in optionsObj)
    if (ignoreUndefinedProps && optionsObj[optionName] == undefined)
    continue;
    obj[optionName] = optionsObj[optionName];
    Spry.Widget.Utils.getElement = function(ele)
    if (ele && typeof ele == "string")
    return document.getElementById(ele);
    return ele;
    Spry.Widget.Utils.getElementsByClassName = function(sel)
    if (!sel.length > 0)
    return null;
    var selectors = sel.split(',');
    var el = [];
    for (var i =0; i < selectors.length; i++)
    var cs = selectors[i];
    var chunk = cs.split(' ');
    var parents = [];
    parents[0] = [];
    parents[0][0] = document.body;
    for (var j = 0; j < chunk.length; j++)
    var tokens = Spry.Widget.Utils.getSelectorTokens(chunk[j]);
    for (var k =0; k < parents[j].length; k++)
    var childs = parents[j][k].getElementsByTagName('*');
    parents[j+1] = [];
    for (var l=0; l < childs.length; l++)
    if (Spry.Widget.Utils.hasSelector(childs[l], tokens))
    parents[j+1].push(childs[l]);
    if (parents[j])
    for (var k = 0; k < parents[j].length; k++)
    el.push(parents[j][k]);
    return el;
    Spry.Widget.Utils.firstValid = function()
    var ret = null;
    var a = Spry.Widget.Utils.firstValid;
    for(var i=0; i< a.arguments.length; i++)
    if (typeof(a.arguments[i]) != 'undefined')
    ret = a.arguments[i];
    break;
    return ret;
    Spry.Widget.Utils.getSelectorTokens = function(str)
    str = str.replace(/\./g, ' .');
    str = str.replace(/\#/g, ' #');
    str = str.replace(/^\s+|\s+$/g,"");
    return str.split(' ');
    Spry.Widget.Utils.hasSelector = function(el, tokens)
    for (var i =0; i< tokens.length; i++)
    switch (tokens[i].charAt(0))
    case '.': if (!el.className || el.className.indexOf(tokens[i].substr(1)) == -1) return false; break;
    case '#': if (!el.id || el.id != tokens[i].substr(1)) return false; break;
    default: if (el.nodeName.toLowerCase != tokens[i]) return false; break;
    return true;
    Spry.Widget.Utils.addEventListener = function(element, eventType, handler, capture)
    try
    if (element.addEventListener)
    element.addEventListener(eventType, handler, capture);
    else if (element.attachEvent)
    element.attachEvent("on" + eventType, handler);
    catch (e) {}
    Spry.Widget.Utils.getStyleProperty = function(element, prop)
    var value;
    var camelized = Spry.Widget.Utils.camelize(prop);
    try
    if (element.style)
    value = element.style[camelized];
    if (!value)
    if (document.defaultView && document.defaultView.getComputedStyle)
    var css = document.defaultView.getComputedStyle(element, null);
    value = css ? css.getPropertyValue(prop) : null;
    else if (element.currentStyle)
    value = element.currentStyle[camelized];
    catch (e) {}
    return value == 'auto' ? null : value;
    Spry.Widget.Utils.camelize = function(str)
    if (str.indexOf('-') == -1)
    return str;
    var oStringList = str.split('-');
    var isFirstEntry = true;
    var camelizedString = '';
    for(var i=0; i < oStringList.length; i++)
    if(oStringList[i].length>0)
    if(isFirstEntry)
    camelizedString = oStringList[i];
    isFirstEntry = false;
    else
    var s = oStringList[i];
    camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
    return camelizedString;
    * Spry.Widget.Utils.getPixels
    * returns the value of a CSS property as Int, converting medium to 2
    * @param {DOMElement} m - elements
    * @param {String} s -
    Spry.Widget.Utils.getPixels = function (m, s)
    var v = Spry.Widget.Utils.getStyleProperty(m, s);
    if (v == "medium") {
    v = 2;
    } else {
    v = parseInt(v, 10);
    v = isNaN(v)?0:v;
    return v;
    Spry.Widget.Utils.getAbsoluteMousePosition = function(ev)
    var pos = {x:0, y:0};
    if (ev.pageX)
    pos.x = ev.pageX;
    else if (ev.clientX)
    pos.x = ev.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
    if (isNaN(pos.x)) pos.x = 0;
    if (ev.pageY)
    pos.y = ev.pageY;
    else if (ev.clientY)
    pos.y = ev.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
    if (isNaN(pos.y)) pos.y = 0;
    return pos;
    * Spry.Widget.Utils.getBorderBox
    * returns a border box object (x,y,width,height) which perfectly covers the el element and its borders
    * the x, y are absolute coordinates measured from from the window viewport
    * use the box as the second parameter in Spry.Widget.Utils.setBorderBox
    * @param {DOMElement or String} el -
    * @param {DOMDocument,optional} doc -
    Spry.Widget.Utils.getBorderBox = function (el, doc)
    doc = doc || document;
    if (typeof el == 'string')
    el = doc.getElementById(el);
    if (!el)
    return false;
    if (el.parentNode === null || Spry.Widget.Utils.getStyleProperty(el, 'display') == 'none')
    //element must be visible to have a box
    return false;
    var ret = {x:0, y:0, width:0, height:0};
    var parent = null;
    var box;
    if (el.getBoundingClientRect) { // IE
    box = el.getBoundingClientRect();
    var scrollTop = doc.documentElement.scrollTop || doc.body.scrollTop;
    var scrollLeft = doc.documentElement.scrollLeft || doc.body.scrollLeft;
    ret.x = box.left + scrollLeft;
    ret.y = box.top + scrollTop;
    ret.width = box.right - box.left;
    ret.height = box.bottom - box.top;
    } else if (doc.getBoxObjectFor) { // gecko
    box = doc.getBoxObjectFor(el);
    ret.x = box.x;
    ret.y = box.y;
    ret.width = box.width;
    ret.height = box.height;
    var btw = Spry.Widget.Utils.getPixels(el, "border-top-width");
    var blw = Spry.Widget.Utils.getPixels(el, "border-left-width");
    ret.x -= blw;
    ret.y -= btw;
    } else { // safari/opera
    ret.x = el.offsetLeft;
    ret.y = el.offsetTop;
    ret.width = el.offsetWidth;
    ret.height = el.offsetHeight;
    parent = el.offsetParent;
    if (parent != el)
    while (parent)
    ret.x += parent.offsetLeft;
    ret.y += parent.offsetTop;
    parent = parent.offsetParent;
    var blw = Spry.Widget.Utils.getPixels(el, "border-left-width");
    var btw = Spry.Widget.Utils.getPixels(el, "border-top-width");
    ret.x -= blw;
    ret.y -= btw;
    // opera & (safari absolute) incorrectly account for body offsetTop
    var ua = navigator.userAgent.toLowerCase();
    if (Spry.is.opera || Spry.is.safari && Spry.Widget.Utils.getStyleProperty(el, 'position') == 'absolute')
    ret.y -= doc.body.offsetTop;
    if (el.parentNode)
    parent = el.parentNode;
    else
    parent = null;
    while (parent && parent.tagName != 'BODY' && parent.tagName != 'HTML')
    ret.x -= (isNaN(parent.scrollLeft) ? 0 : parent.scrollLeft);
    ret.y -= (isNaN(parent.scrollTop)  ? 0 : parent.scrollTop);
    if (parent.parentNode)
    parent = parent.parentNode;
    else
    parent = null;
    return ret;
    * Spry.Widget.Utils.setBorderBox
    * puts the element el to the location specified by box
    * @param {DOMElement} el - the element to be placed
    * @param {Object} box - hash containing the x and y coordinates where to put el
    Spry.Widget.Utils.setBorderBox = function (el, box) {
    var pos = Spry.Widget.Utils.getBorderBox(el, el.ownerDocument);
    if (pos === false)
    return false;
    var delta = {
    x:Spry.Widget.Utils.getPixels(el, 'left'),
    y:Spry.Widget.Utils.getPixels(el, 'top')
    var new_pos = {x:0, y:0, w:0, h:0};
    if (typeof box.x == 'number') {
    new_pos.x = box.x - pos.x + delta.x;
    if (typeof box.y == 'number') {
    new_pos.y = box.y - pos.y + delta.y;
    if (typeof box.x == 'number') {
    el.style.left = new_pos.x + 'px';
    if (typeof box.y == 'number') {
    el.style.top = new_pos.y + 'px';
    return true;
    Spry.Widget.Utils.putElementAt = function (source, target, offset, biv)
    biv = Spry.Widget.Utils.firstValid(biv, true);
    var source_box = Spry.Widget.Utils.getBorderBox(source, source.ownerDocument);
    Spry.Widget.Utils.setBorderBox(source, target);
    if (biv)
    Spry.Widget.Utils.bringIntoView(source);
    return true;
    * Spry.Widget.Utils.bringIntoView
    * set the position of the source element so it is completely visible in the window
    * @param {DOMElemenet} source - the element to be
    Spry.Widget.Utils.bringIntoView = function (source) {
    var box = Spry.Widget.Utils.getBorderBox(source, source.ownerDocument);
    if (box === false) {
    return false;
    var current = {
    x:Spry.Widget.Utils.getPixels(source, 'left'),
    y:Spry.Widget.Utils.getPixels(source, 'top')
    var delta = {x:0, y:0};
    var offset_fix = {x:0, y:0};
    var strictm = source.ownerDocument.compatMode == "CSS1Compat";
    var doc = (Spry.is.ie && strictm || Spry.is.mozilla)?source.ownerDocument.documentElement:source.ownerDocument.body;
    offset_fix.x = Spry.Widget.Utils.getPixels(doc, 'border-left-width');
    offset_fix.y = Spry.Widget.Utils.getPixels(doc, 'border-top-width');
    var st = doc.scrollTop;
    var ch = self.innerHeight ? self.innerHeight : doc.clientHeight;
    var t = box.y + (Spry.is.ie?-offset_fix.y:offset_fix.y);
    var b = box.y + box.height + (Spry.is.ie?-offset_fix.y:offset_fix.y);
    if ( b - st > ch) {
    delta.y = ch - (b - st);
    if (t + delta.y < st) {
    delta.y = st-t;
    } else if (t < st) {
    delta.y = st - t;
    if (delta.y != 0) {
    source.style.top = (current.y + delta.y) + 'px';
    var sl = doc.scrollLeft;
    var cw = doc.clientWidth;
    var l = box.x + (Spry.is.ie?-offset_fix.x:offset_fix.x);
    var r = box.x + box.width + (Spry.is.ie?-offset_fix.x:offset_fix.x);
    if ( r - sl > cw) {
    delta.x = cw - (r - sl);
    if (l + delta.x < sl) {
    delta.x = sl-l;
    } else if (l < sl) {
    delta.x = sl - l;
    if (delta.x != 0) {
    source.style.left = (current.x + delta.x) + 'px';
    Spry.Widget.Utils.contains = function (who, what) {
    if (typeof who.contains == 'object') {
    return what && who && (who == what || who.contains(what));
    } else {
    var el = what;
    while(el) {
    try{
    if (el == who) {
    return true;
    el = el.parentNode;
    }catch(a){return false;}
    return false;
    })(); // EndSpryComponent
    @charset "UTF-8";
    /* SpryTooltip.css - version 0.2 - Spry 1.6.1 */
    /* Copyright (c) 2006. Adobe Systems Incorporated. All rights reserved. */
    /* HACK FOR IE: to make sure the tooltips show above form controls, we underlay each tooltip with an iframe */
    .iframeTooltip
    position: absolute;
    z-index: 1010;
    filter:alpha(opacity:0.1);
    .tooltipContent
    font-size: 11px;
    font-style: italic;
    color: #332c40;
    width: 96px;
    height: 51px;
    background: url(../_images/recipe/bubble2.png) no-repeat;
    font-family: "Comic Sans MS", cursive;
    margin: 0px;
    left: -200px;
    top: -200px;
    padding-top: 5px;
    vertical-align: middle;
    position: fixed;

    I couldn't get this script to work with my code:
    <a id="greensource" href="a"><img src="images/greensource.png" alt="Greensource Initiative" width="193" height="71" border="0" usemap="#Map7" id="sprytrigger6" title="Greensource Initiative" />
    <map name="Map7" id="Map7">
    <area shape="rect" coords="-22,-15,197,79" href="#" />
    </map>
    </a>
    <div class="tooltipContent" id="green">
    <div class="secondback">
    <div style="padding: 15px;">
    <h1>GREENSOURCE</h1>
    <h2>INITIATIVE&#8482;</h2>
    <p>Manufactred within Greensource Initiative&#8482; guildelines for use of recycled materials, renewable energy and non-hazardous packaging materials. RoHS Compliant.</p>
    <p class="morebutton"><a href="#">LEARN MORE</a></p>
    </div>
    </div>
    </div>
    <script type="text/javascript">
    <!--
    var sprytooltip7 = new Spry.Widget.Tooltip("green", "#greensource");
    //-->
    </script>
    Maybe someone can point out my problem?
    CSS:
    .tooltipContent
        margin: 0;
        padding: 0;
        background: #FFF url(../images/bottom-gradient.png) repeat-x bottom left;
        font-family: "Myriad Pro", Tahoma, Geneva, sans-serif;
        text-align: left;
        box-shadow: 2px 2px 4px #b6b5b6;
        -webkit-box-shadow: 2px 2px 4px #b6b5b6;
        -moz-box-shadow: 2px 2px 4px #b6b5b6;
        position: fixed;
    #green {
        position: absolute;
        border: none;
        top: 200px;
        left: 200px;

  • Convert path line to polyline?

    Hello,
    anyone here know it's it's possible to convert a path into a polyline?
    I need to save SVG (but polyline, not path)
    Many thanks!
    r.

    Hi
    this is not the best way to do that, but all you need to do it better is inside this stuff (i hope).
    have a look at the examples at the bottom.
    cheers chris
    //11:28 12.03.2010
    //      www.ogebab.de
    //Extension for Illustrator javascript (CS+)
    ------OBJ---- overview----------
         Point()
              x, y
              many functions...
         Line()
              many functions...
         Bezier()
              A, B, C, D
              isLine()
              more functions...
         XpPoint()
              lDir, an, rDir | type: Point
              isCurvePoint()
         Xpath()
              pPoints |type: XpPoint
              beziers
              SetPath()
         Xitem()
              center
              setToCenter()
    //---------- little HELPERS----------------------
    var fmm = 72 / 25.4;
    function NumSort(a, b) {
         return a - b;
    fibonacci = function(n) {
         return Math.round(Math.pow((Math.sqrt(5) + 1) / 2, Math.abs(n))
                   / Math.sqrt(5))
                   * (n < 0 && n % 2 ? -1 : 1);
    function InVal(tx) {
         var inp, pt, t, num, d;
         inp = prompt(tx, "5");
         if (inp != "" && inp != null) {
              t = inp.search(",");
              if (t >= 0) {
                   inp = inp.replace(",", ".");
              t = inp.search("pt");
              if (t >= 0) {
                   pt = 1;
                   num = inp.slice(0, t);
              } else {
                   t = inp.search("mm");
                   if (t >= 0) {
                        pt = 0;
                        num = inp.slice(0, t);
                   } else {
                        t = inp.search("in");
                        if (t >= 0) {
                             pt = 2;
                             num = inp.slice(0, t);
                        } else {
                             pt = 0;
                             num = inp;
                   d = eval(num);
                   if (pt == 0) {
                        d = d * 72.0 / 25.4
                   } else {
                        if (pt == 2) {
                             d = d * 72.0
                   return (d);
              return (null);
    function InNum(tx, n) {
         var inp = prompt(tx, n), t = inp.search(",");
         if (t >= 0) {
              inp = inp.replace(",", ".");
         return eval(inp);
    function GetSelPaths() {
         var pf = app.activeDocument.pathItems, p = new Array();
         for ( var i68 = 0; i68 < pf.length; i68++) {
              if (pf[i68].selected == true) {
                   p.push(pf[i68]);
         return p;
    equate = function(a, b) {
         if (b >= 0)
              return a - b;
         return a + Math.abs(b)
    Array.prototype.turn1 = function() {
         var a = this.shift();
         return this.push(a);
    Array.prototype.insert = function(wert, stelle) {
         var a = this.slice(0, stelle), b = this.slice(stelle);
         b.unshift(wert);
         return (a.concat(b));
    //-----------------------OBJECTS---------------------------------------------------------------------------------------------------
    ////----------intersection section-----
    //--------ignore it until you understand the rest
    //--usage:       Var = new Intersection();
    //--               Var.IfIntersect(bezier,bezier); > if bezier is a line(and you know that), use Line.intersect() instead
    //--               returns Status and (if) Points/Vector2Ds
    //--- a tangent is not a intersection! similar points are SOMETIMES a intersection! ?
    //--------KevLinDev.com--------*  copyright 2002-2003, Kevin Lindsey-----
    Array.prototype.foreach=function(func){for(var i=0;i<this.length;i++)func(this[i]);};
    Array.prototype.map=function(func){var result=new Array();for(var i=0;i<this.length;i++)result.push(func(this[i]));return result;};
    Array.prototype.min=function(){var min=this[0];for(var i=0;i<this.length;i++)if(this[i]<min)min=this[i];return min;}
    Array.prototype.max=function(){var max=this[0];for(var i=0;i<this.length;i++)if(this[i]>max)max=this[i];return max;}
    Polynomial.TOLERANCE=1e-6;
    Polynomial.ACCURACY=6;
    function Polynomial(){this.init(arguments);}
    Polynomial.prototype.init=function(coefs){this.coefs=new Array();for(var i=coefs.length-1;i>=0;i--)this.coefs.push(coefs[i]);};
    Polynomial.prototype.eval=function(x){var result=0;for(var i=this.coefs.length-1;i>=0;i--)result=result*x+this.coefs[i];return result;};
    Polynomial.prototype.multiply=function(that){var result=new Polynomial();for(var i=0;i<=this.getDegree()+that.getDegree();i++)result.coefs.push(0);for(var i=0;i<=this.getDegree();i++)for(var j=0;j<=that.getDegree();j++)result.coefs[i+j]+=this.coefs[i]*that.coefs[j];return result;};
    Polynomial.prototype.divide_scalar=function(scalar){for(var i=0;i<this.coefs.length;i++)this.coefs[i]/=scalar;};
    Polynomial.prototype.simplify=function(){for(var i=this.getDegree();i>=0;i--){if(Math.abs(this.coefs[i])<=Polynomial.TOLERANCE)this.coefs.pop();else break;}};
    Polynomial.prototype.bisection=function(min,max){var minValue=this.eval(min);var maxValue=this.eval(max);var result;if(Math.abs(minValue)<=Polynomial.TOLERANCE)result=min;else if(Math.abs(maxValue)<=Polynomial.TOLERANCE)result=max;else if(minValue*maxValue<=0){var tmp1=Math.log(max-min);var tmp2=Math.log(10)*Polynomial.ACCURACY;var iters=Math.ceil((tmp1+tmp2)/Math.log(2));for(var i=0;i<iters;i++){result=0.5*(min+max);var value=this.eval(result);if(Math.abs(value)<=Polynomial.TOLERANCE){break;}if(value*minValue<0){max=result;maxValue=value;}else{min=result;minValue=value;}}}return result;};
    Polynomial.prototype.toString=function(){var coefs=new Array();var signs=new Array();for(var i=this.coefs.length-1;i>=0;i--){var value=this.coefs[i];if(value!=0){var sign=(value<0)?" - ":" + ";value=Math.abs(value);if(i>0)if(value==1)value="x";else value+="x";if(i>1)value+="^"+i;signs.push(sign);coefs.push(value);}}signs[0]=(signs[0]==" + ")?"":"-";var result="";for(var i=0;i<coefs.length;i++)result+=signs[i]+coefs[i];return result;};
    Polynomial.prototype.getDegree=function(){return this.coefs.length-1;};
    Polynomial.prototype.getDerivative=function(){var derivative=new Polynomial();for(var i=1;i<this.coefs.length;i++){derivative.coefs.push(i*this.coefs[i]);}return derivative;};
    Polynomial.prototype.getRoots=function(){var result;this.simplify();switch(this.getDegree()){case 0:result=new Array();break;case 1:result=this.getLinearRoot();break;case 2:result=this.getQuadraticRoots();break;case 3:result=this.getCubicRoots();break;case 4:result=this.getQuarticRoots();break;default:result=new Array();}return result;};
    Polynomial.prototype.getRootsInInterval=function(min,max){var roots=new Array();var root;if(this.getDegree()==1){root=this.bisection(min,max);if(root!=null)roots.push(root);}else{var deriv=this.getDerivative();var droots=deriv.getRootsInInterval(min,max);if(droots.length>0){root=this.bisection(min,droots[0]);if(root!=null)roots.push(root);for(var i=0;i<=droots.length-2;i++){root=this.bisection(droots[i],droots[i+1]);if(root!=null)roots.push(root);}root=this.bisection(droots[droots.length-1],max);if(root!=null)roots.push(root);}else{root=this.bisection(min,max);if(root!=null)roots.push(root);}}return roots;};
    Polynomial.prototype.getLinearRoot=function(){var result=new Array();var a=this.coefs[1];if(a!=0)result.push(-this.coefs[0]/a);return result;};
    Polynomial.prototype.getQuadraticRoots=function(){var results=new Array();if(this.getDegree()==2){var a=this.coefs[2];var b=this.coefs[1]/a;var c=this.coefs[0]/a;var d=b*b-4*c;if(d>0){var e=Math.sqrt(d);results.push(0.5*(-b+e));results.push(0.5*(-b-e));}else if(d==0){results.push(0.5*-b);}}return results;};
    Polynomial.prototype.getCubicRoots=function(){var results=new Array();if(this.getDegree()==3){var c3=this.coefs[3];var c2=this.coefs[2]/c3;var c1=this.coefs[1]/c3;var c0=this.coefs[0]/c3;var a=(3*c1-c2*c2)/3;var b=(2*c2*c2*c2-9*c1*c2+27*c0)/27;var offset=c2/3;var discrim=b*b/4 + a*a*a/27;var halfB=b/2;if(Math.abs(discrim)<=Polynomial.TOLERANCE)disrim=0;if(discrim>0){var e=Math.sqrt(discrim);var tmp;var root;tmp=-halfB+e;if(tmp>=0)root=Math.pow(tmp,1/3);else root=-Math.pow(-tmp,1/3);tmp=-halfB-e;if(tmp>=0)root+=Math.pow(tmp,1/3);else root-=Math.pow(-tmp,1/3);results.push(root-offset);}else if(discrim<0){var distance=Math.sqrt(-a/3);var angle=Math.atan2(Math.sqrt(-discrim),-halfB)/3;var cos=Math.cos(angle);var sin=Math.sin(angle);var sqrt3=Math.sqrt(3);results.push(2*distance*cos-offset);results.push(-distance*(cos+sqrt3*sin)-offset);results.push(-distance*(cos-sqrt3*sin)-offset);}else{var tmp;if(halfB>=0)tmp=-Math.pow(halfB,1/3);else tmp=Math.pow(-halfB,1/3);results.push(2*tmp-offset);results.push(-tmp-offset);}}return results;};
    Polynomial.prototype.getQuarticRoots=function(){var results=new Array();if(this.getDegree()==4){var c4=this.coefs[4];var c3=this.coefs[3]/c4;var c2=this.coefs[2]/c4;var c1=this.coefs[1]/c4;var c0=this.coefs[0]/c4;var resolveRoots=new Polynomial(1,-c2,c3*c1-4*c0,-c3*c3*c0+4*c2*c0-c1*c1).getCubicRoots();var y=resolveRoots[0];var discrim=c3*c3/4-c2+y;if(Math.abs(discrim)<=Polynomial.TOLERANCE)discrim=0;if(discrim>0){var e=Math.sqrt(discrim);var t1=3*c3*c3/4-e*e-2*c2;var t2=(4*c3*c2-8*c1-c3*c3*c3)/(4*e);var plus=t1+t2;var minus=t1-t2;if(Math.abs(plus)<=Polynomial.TOLERANCE)plus=0;if(Math.abs(minus)<=Polynomial.TOLERANCE)minus=0;if(plus>=0){var f=Math.sqrt(plus);results.push(-c3/4 + (e+f)/2);results.push(-c3/4 + (e-f)/2);}if(minus>=0){var f=Math.sqrt(minus);results.push(-c3/4 + (f-e)/2);results.push(-c3/4 - (f+e)/2);}}else if(discrim<0){}else{var t2=y*y-4*c0;if(t2>=-Polynomial.TOLERANCE){if(t2<0)t2=0;t2=2*Math.sqrt(t2);t1=3*c3*c3/4-2*c2;if(t1+t2>=Polynomial.TOLERANCE){var d=Math.sqrt(t1+t2);results.push(-c3/4 + d/2);results.push(-c3/4 - d/2);}if(t1-t2>=Polynomial.TOLERANCE){var d=Math.sqrt(t1-t2);results.push(-c3/4 + d/2);results.push(-c3/4 - d/2);}}}}return results;};
    function Vector2D(x,y){if(arguments.length>0){this.init(x,y);}}
    Vector2D.prototype.init=function(x,y){this.x=x;this.y=y;};
    Vector2D.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y);};
    Vector2D.prototype.dot=function(that){return this.x*that.x+this.y*that.y;};
    Vector2D.prototype.cross=function(that){return this.x*that.y-this.y*that.x;}
    Vector2D.prototype.unit=function(){return this.divide(this.length());};
    Vector2D.prototype.unitEquals=function(){this.divideEquals(this.length());return this;};
    Vector2D.prototype.add=function(that){return new Vector2D(this.x+that.x,this.y+that.y);};
    Vector2D.prototype.addEquals=function(that){this.x+=that.x;this.y+=that.y;return this;};
    Vector2D.prototype.subtract=function(that){return new Vector2D(this.x-that.x,this.y-that.y);};
    Vector2D.prototype.subtractEquals=function(that){this.x-=that.x;this.y-=that.y;return this;};
    Vector2D.prototype.multiply=function(scalar){return new Vector2D(this.x*scalar,this.y*scalar);};
    Vector2D.prototype.multiplyEquals=function(scalar){this.x*=scalar;this.y*=scalar;return this;};
    Vector2D.prototype.divide=function(scalar){return new Vector2D(this.x/ scalar, this.y /scalar);};
    Vector2D.prototype.divideEquals=function(scalar){this.x/=scalar;this.y/=scalar;return this;};
    Vector2D.prototype.perp=function(){return new Vector2D(-this.y,this.x);};
    Vector2D.fromPoints=function(p1,p2){return new Vector2D(p2.x-p1.x,p2.y-p1.y);};
    Vector2D.prototype.Dot=function (d){
         var ell=app.activeDocument.pathItems.ellipse(this.y + d/2 , this.x - d/2 ,d,d);
         ell.selected=false; return ell
    function Intersection(status){if(arguments.length>0){this.init(status);}}
    Intersection.prototype.init=function(status){this.status=status;this.points=new Array();};
    Intersection.prototype.appendPoint=function(point){this.points.push(point);};
    Intersection.prototype.appendPoints=function(points){this.points=this.points.concat(points);};
    //-by ogebab---Gibt zurück: IntersectionObjekt (Obj.status / Obj.points / Obj.points.t1 / Obj.points.t2)
    Intersection.prototype.IfInterSect=function(seg1,seg2){
         var result;
         if(seg1.type=="bez"){
              if(seg2.type=="line"){
                   result=Intersection.intersectBezier3Line(seg1,seg2);
              }else{
                   result=Intersection.intersectBezier3Bezier3(seg1,seg2);
         }else{
              if(seg2.type=="bez"){
                   result=Intersection.intersectBezier3Line(seg2,seg1);
              }else{
                   result=Intersection.intersectLineLine(seg2,seg1);
         if(result.status=="Intersection"){
              for(var i=0;i<result.points.length ;i++){
                   if(seg1.type=="line"){
                        result.points[i].t1=getTOfPointOnLine(result.points[i], seg1);
                   }else{
                        result.points[i].t1=getTOfPointOnCubicCurve(result.points[i], seg1);
                   if(seg2.type=="line"){
                        result.points[i].t2=getTOfPointOnLine(result.points[i], seg2);
                   }else{
                        result.points[i].t2=getTOfPointOnCubicCurve(result.points[i], seg2);
         return result
    //--(bez, bez)
    Intersection.intersectBezier3Bezier3=function(seg1,seg2){var a,b,c,d;var c13,c12,c11,c10;var c23,c22,c21,c20;var result=new Intersection("No Intersection");a=seg1.A.multiply(-1);b=seg1.B.multiply(3);c=seg1.C.multiply(-3);d=a.add(b.add(c.add(seg1.D)));c13=new Vector2D(d.x,d.y);a=seg1.A.multiply(3);b=seg1.B.multiply(-6);c=seg1.C.multiply(3);d=a.add(b.add(c));c12=new Vector2D(d.x,d.y);a=seg1.A.multiply(-3);b=seg1.B.multiply(3);c=a.add(b);c11=new Vector2D(c.x,c.y);c10=new Vector2D(seg1.A.x,seg1.A.y);a=seg2.A.multiply(-1);b=seg2.B.multiply(3);c=seg2.C.multiply(-3);d=a.add(b.add(c.add(seg2.D)));c23=new Vector2D(d.x,d.y);a=seg2.A.multiply(3);b=seg2.B.multiply(-6);c=seg2.C.multiply(3);d=a.add(b.add(c));c22=new Vector2D(d.x,d.y);a=seg2.A.multiply(-3);b=seg2.B.multiply(3);c=a.add(b);c21=new Vector2D(c.x,c.y);c20=new Vector2D(seg2.A.x,seg2.A.y);var c10x2=c10.x*c10.x;var c10x3=c10.x*c10.x*c10.x;var c10y2=c10.y*c10.y;var c10y3=c10.y*c10.y*c10.y;var c11x2=c11.x*c11.x;var c11x3=c11.x*c11.x*c11.x;var c11y2=c11.y*c11.y;var c11y3=c11.y*c11.y*c11.y;var c12x2=c12.x*c12.x;var c12x3=c12.x*c12.x*c12.x;var c12y2=c12.y*c12.y;var c12y3=c12.y*c12.y*c12.y;var c13x2=c13.x*c13.x;var c13x3=c13.x*c13.x*c13.x;var c13y2=c13.y*c13.y;var c13y3=c13.y*c13.y*c13.y;var c20x2=c20.x*c20.x;var c20x3=c20.x*c20.x*c20.x;var c20y2=c20.y*c20.y;var c20y3=c20.y*c20.y*c20.y;var c21x2=c21.x*c21.x;var c21x3=c21.x*c21.x*c21.x;var c21y2=c21.y*c21.y;var c22x2=c22.x*c22.x;var c22x3=c22.x*c22.x*c22.x;var c22y2=c22.y*c22.y;var c23x2=c23.x*c23.x;var c23x3=c23.x*c23.x*c23.x;var c23y2=c23.y*c23.y;var c23y3=c23.y*c23.y*c23.y;var poly=new Polynomial(-c13x3*c23y3+c13y3*c23x3-3*c13.x*c13y2*c23x2*c23.y+3*c13x2*c13.y*c23.x*c23y2,-6*c13.x*c22.x*c13y2*c23.x*c23.y+6*c13x2*c13.y*c22.y*c23.x*c23.y+3*c22.x*c13y3*c23x2-3*c13x3*c22.y*c23y2-3*c13.x*c13y2*c22.y*c23x2+3*c13x2*c22.x*c13.y*c23y2,-6*c21.x*c13.x*c13y2*c23.x*c23.y-6*c13.x*c22.x*c13y2*c22.y*c23.x+6*c13x2*c22.x*c13.y*c22.y*c23.y+3*c21.x*c13y3*c23x2+3*c22x2*c13y3*c23.x+3*c21.x*c13x2*c13.y*c23y2-3*c13.x*c21.y*c13y2*c23x2-3*c13.x*c22x2*c13y2*c23.y+c13x2*c13.y*c23.x*(6*c21.y*c23.y+3*c22y2)+c13x3*(-c21.y*c23y2-2*c22y2*c23.y-c23.y*(2*c21.y*c23.y+c22y2)),c11.x*c12.y*c13.x*c13.y*c23.x*c23.y-c11.y*c12.x*c13.x*c13.y*c23.x*c23.y+6*c21.x*c22.x*c13y3*c23.x+3*c11.x*c12.x*c13.x*c13.y*c23y2+6*c10.x*c13.x*c13y2*c23.x*c23.y-3*c11.x*c12.x*c13y2*c23.x*c23.y-3*c11.y*c12.y*c13.x*c13.y*c23x2-6*c10.y*c13x2*c13.y*c23.x*c23.y-6*c20.x*c13.x*c13y2*c23.x*c23.y+3*c11.y*c12.y*c13x2*c23.x*c23.y-2*c12.x*c12y2*c13.x*c23.x*c23.y-6*c21.x*c13.x*c22.x*c13y2*c23.y-6*c21.x*c13.x*c13y2*c22.y*c23.x-6*c13.x*c21.y*c22.x*c13y2*c23.x+6*c21.x*c13x2*c13.y*c22.y*c23.y+2*c12x2*c12.y*c13.y*c23.x*c23.y+c22x3*c13y3-3*c10.x*c13y3*c23x2+3*c10.y*c13x3*c23y2+3*c20.x*c13y3*c23x2+c12y3*c13.x*c23x2-c12x3*c13.y*c23y2-3*c10.x*c13x2*c13.y*c23y2+3*c10.y*c13.x*c13y2*c23x2-2*c11.x*c12.y*c13x2*c23y2+c11.x*c12.y*c13y2*c23x2-c11.y*c12.x*c13x2*c23y2+2*c11.y*c12.x*c13y2*c23x2+3*c20.x*c13x2*c13.y*c23y2-c12.x*c12y2*c13.y*c23x2-3*c20.y*c13.x*c13y2*c23x2+c12x2*c12.y*c13.x*c23y2-3*c13.x*c22x2*c13y2*c22.y+c13x2*c13.y*c23.x*(6*c20.y*c23.y+6*c21.y*c22.y)+c13x2*c22.x*c13.y*(6*c21.y*c23.y+3*c22y2)+c13x3*(-2*c21.y*c22.y*c23.y-c20.y*c23y2-c22.y*(2*c21.y*c23.y+c22y2)-c23.y*(2*c20.y*c23.y+2*c21.y*c22.y)),6*c11.x*c12.x*c13.x*c13.y*c22.y*c23.y+c11.x*c12.y*c13.x*c22.x*c13.y*c23.y+c11.x*c12.y*c13.x*c13.y*c22.y*c23.x-c11.y*c12.x*c13.x*c22.x*c13.y*c23.y-c11.y*c12.x*c13.x*c13.y*c22.y*c23.x-6*c11.y*c12.y*c13.x*c22.x*c13.y*c23.x-6*c10.x*c22.x*c13y3*c23.x+6*c20.x*c22.x*c13y3*c23.x+6*c10.y*c13x3*c22.y*c23.y+2*c12y3*c13.x*c22.x*c23.x-2*c12x3*c13.y*c22.y*c23.y+6*c10.x*c13.x*c22.x*c13y2*c23.y+6*c10.x*c13.x*c13y2*c22.y*c23.x+6*c10.y*c13.x*c22.x*c13y2*c23.x-3*c11.x*c12.x*c22.x*c13y2*c23.y-3*c11.x*c12.x*c13y2*c22.y*c23.x+2*c11.x*c12.y*c22.x*c13y2*c23.x+4*c11.y*c12.x*c22.x*c13y2*c23.x-6*c10.x*c13x2*c13.y*c22.y*c23.y-6*c10.y*c13x2*c22.x*c13.y*c23.y-6*c10.y*c13x2*c13.y*c22.y*c23.x-4*c11.x*c12.y*c13x2*c22.y*c23.y-6*c20.x*c13.x*c22.x*c13y2*c23.y-6*c20.x*c13.x*c13y2*c22.y*c23.x-2*c11.y*c12.x*c13x2*c22.y*c23.y+3*c11.y*c12.y*c13x2*c22.x*c23.y+3*c11.y*c12.y*c13x2*c22.y*c23.x-2*c12.x*c12y2*c13.x*c22.x*c23.y-2*c12.x*c12y2*c13.x*c22.y*c23.x-2*c12.x*c12y2*c22.x*c13.y*c23.x-6*c20.y*c13.x*c22.x*c13y2*c23.x-6*c21.x*c13.x*c21.y*c13y2*c23.x-6*c21.x*c13.x*c22.x*c13y2*c22.y+6*c20.x*c13x2*c13.y*c22.y*c23.y+2*c12x2*c12.y*c13.x*c22.y*c23.y+2*c12x2*c12.y*c22.x*c13.y*c23.y+2*c12x2*c12.y*c13.y*c22.y*c23.x+3*c21.x*c22x2*c13y3+3*c21x2*c13y3*c23.x-3*c13.x*c21.y*c22x2*c13y2-3*c21x2*c13.x*c13y2*c23.y+c13x2*c22.x*c13.y*(6*c20.y*c23.y+6*c21.y*c22.y)+c13x2*c13.y*c23.x*(6*c20.y*c22.y+3*c21y2)+c21.x*c13x2*c13.y*(6*c21.y*c23.y+3*c22y2)+c13x3*(-2*c20.y*c22.y*c23.y-c23.y*(2*c20.y*c22.y+c21y2)-c21.y*(2*c21.y*c23.y+c22y2)-c22.y*(2*c20.y*c23.y+2*c21.y*c22.y)),c11.x*c21.x*c12.y*c13.x*c13.y*c23.y+c11.x*c12.y*c13.x*c21.y*c13.y*c23.x+c11.x*c12.y*c13.x*c22.x*c13.y*c22.y-c11.y*c12.x*c21.x*c13.x*c13.y*c23.y-c11.y*c12.x*c13.x*c21.y*c13.y*c23.x-c11.y*c12.x*c13.x*c22.x*c13.y*c22.y-6*c11.y*c21.x*c12.y*c13.x*c13.y*c23.x-6*c10.x*c21.x*c13y3*c23.x+6*c20.x*c21.x*c13y3*c23.x+2*c21.x*c12y3*c13.x*c23.x+6*c10.x*c21.x*c13.x*c13y2*c23.y+6*c10.x*c13.x*c21.y*c13y2*c23.x+6*c10.x*c13.x*c22.x*c13y2*c22.y+6*c10.y*c21.x*c13.x*c13y2*c23.x-3*c11.x*c12.x*c21.x*c13y2*c23.y-3*c11.x*c12.x*c21.y*c13y2*c23.x-3*c11.x*c12.x*c22.x*c13y2*c22.y+2*c11.x*c21.x*c12.y*c13y2*c23.x+4*c11.y*c12.x*c21.x*c13y2*c23.x-6*c10.y*c21.x*c13x2*c13.y*c23.y-6*c10.y*c13x2*c21.y*c13.y*c23.x-6*c10.y*c13x2*c22.x*c13.y*c22.y-6*c20.x*c21.x*c13.x*c13y2*c23.y-6*c20.x*c13.x*c21.y*c13y2*c23.x-6*c20.x*c13.x*c22.x*c13y2*c22.y+3*c11.y*c21.x*c12.y*c13x2*c23.y-3*c11.y*c12.y*c13.x*c22x2*c13.y+3*c11.y*c12.y*c13x2*c21.y*c23.x+3*c11.y*c12.y*c13x2*c22.x*c22.y-2*c12.x*c21.x*c12y2*c13.x*c23.y-2*c12.x*c21.x*c12y2*c13.y*c23.x-2*c12.x*c12y2*c13.x*c21.y*c23.x-2*c12.x*c12y2*c13.x*c22.x*c22.y-6*c20.y*c21.x*c13.x*c13y2*c23.x-6*c21.x*c13.x*c21.y*c22.x*c13y2+6*c20.y*c13x2*c21.y*c13.y*c23.x+2*c12x2*c21.x*c12.y*c13.y*c23.y+2*c12x2*c12.y*c21.y*c13.y*c23.x+2*c12x2*c12.y*c22.x*c13.y*c22.y-3*c10.x*c22x2*c13y3+3*c20.x*c22x2*c13y3+3*c21x2*c22.x*c13y3+c12y3*c13.x*c22x2+3*c10.y*c13.x*c22x2*c13y2+c11.x*c12.y*c22x2*c13y2+2*c11.y*c12.x*c22x2*c13y2-c12.x*c12y2*c22x2*c13.y-3*c20.y*c13.x*c22x2*c13y2-3*c21x2*c13.x*c13y2*c22.y+c12x2*c12.y*c13.x*(2*c21.y*c23.y+c22y2)+c11.x*c12.x*c13.x*c13.y*(6*c21.y*c23.y+3*c22y2)+c21.x*c13x2*c13.y*(6*c20.y*c23.y+6*c21.y*c22.y)+c12x3*c13.y*(-2*c21.y*c23.y-c22y2)+c10.y*c13x3*(6*c21.y*c23.y+3*c22y2)+c11.y*c12.x*c13x2*(-2*c21.y*c23.y-c22y2)+c11.x*c12.y*c13x2*(-4*c21.y*c23.y-2*c22y2)+c10.x*c13x2*c13.y*(-6*c21.y*c23.y-3*c22y2)+c13x2*c22.x*c13.y*(6*c20.y*c22.y+3*c21y2)+c20.x*c13x2*c13.y*(6*c21.y*c23.y+3*c22y2)+c13x3*(-2*c20.y*c21.y*c23.y-c22.y*(2*c20.y*c22.y+c21y2)-c20.y*(2*c21.y*c23.y+c22y2)-c21.y*(2*c20.y*c23.y+2*c21.y*c22.y)),-c10.x*c11.x*c12.y*c13.x*c13.y*c23.y+c10.x*c11.y*c12.x*c13.x*c13.y*c23.y+6*c10.x*c11.y*c12.y*c13.x*c13.y*c23.x-6*c10.y*c11.x*c12.x*c13.x*c13.y*c23.y-c10.y*c11.x*c12.y*c13.x*c13.y*c23.x+c10.y*c11.y*c12.x*c13.x*c13.y*c23.x+c11.x*c11.y*c12.x*c12.y*c13.x*c23.y-c11.x*c11.y*c12.x*c12.y*c13.y*c23.x+c11.x*c20.x*c12.y*c13.x*c13.y*c23.y+c11.x*c20.y*c12.y*c13.x*c13.y*c23.x+c11.x*c21.x*c12.y*c13.x*c13.y*c22.y+c11.x*c12.y*c13.x*c21.y*c22.x*c13.y-c20.x*c11.y*c12.x*c13.x*c13.y*c23.y-6*c20.x*c11.y*c12.y*c13.x*c13.y*c23.x-c11.y*c12.x*c20.y*c13.x*c13.y*c23.x-c11.y*c12.x*c21.x*c13.x*c13.y*c22.y-c11.y*c12.x*c13.x*c21.y*c22.x*c13.y-6*c11.y*c21.x*c12.y*c13.x*c22.x*c13.y-6*c10.x*c20.x*c13y3*c23.x-6*c10.x*c21.x*c22.x*c13y3-2*c10.x*c12y3*c13.x*c23.x+6*c20.x*c21.x*c22.x*c13y3+2*c20.x*c12y3*c13.x*c23.x+2*c21.x*c12y3*c13.x*c22.x+2*c10.y*c12x3*c13.y*c23.y-6*c10.x*c10.y*c13.x*c13y2*c23.x+3*c10.x*c11.x*c12.x*c13y2*c23.y-2*c10.x*c11.x*c12.y*c13y2*c23.x-4*c10.x*c11.y*c12.x*c13y2*c23.x+3*c10.y*c11.x*c12.x*c13y2*c23.x+6*c10.x*c10.y*c13x2*c13.y*c23.y+6*c10.x*c20.x*c13.x*c13y2*c23.y-3*c10.x*c11.y*c12.y*c13x2*c23.y+2*c10.x*c12.x*c12y2*c13.x*c23.y+2*c10.x*c12.x*c12y2*c13.y*c23.x+6*c10.x*c20.y*c13.x*c13y2*c23.x+6*c10.x*c21.x*c13.x*c13y2*c22.y+6*c10.x*c13.x*c21.y*c22.x*c13y2+4*c10.y*c11.x*c12.y*c13x2*c23.y+6*c10.y*c20.x*c13.x*c13y2*c23.x+2*c10.y*c11.y*c12.x*c13x2*c23.y-3*c10.y*c11.y*c12.y*c13x2*c23.x+2*c10.y*c12.x*c12y2*c13.x*c23.x+6*c10.y*c21.x*c13.x*c22.x*c13y2-3*c11.x*c20.x*c12.x*c13y2*c23.y+2*c11.x*c20.x*c12.y*c13y2*c23.x+c11.x*c11.y*c12y2*c13.x*c23.x-3*c11.x*c12.x*c20.y*c13y2*c23.x-3*c11.x*c12.x*c21.x*c13y2*c22.y-3*c11.x*c12.x*c21.y*c22.x*c13y2+2*c11.x*c21.x*c12.y*c22.x*c13y2+4*c20.x*c11.y*c12.x*c13y2*c23.x+4*c11.y*c12.x*c21.x*c22.x*c13y2-2*c10.x*c12x2*c12.y*c13.y*c23.y-6*c10.y*c20.x*c13x2*c13.y*c23.y-6*c10.y*c20.y*c13x2*c13.y*c23.x-6*c10.y*c21.x*c13x2*c13.y*c22.y-2*c10.y*c12x2*c12.y*c13.x*c23.y-2*c10.y*c12x2*c12.y*c13.y*c23.x-6*c10.y*c13x2*c21.y*c22.x*c13.y-c11.x*c11.y*c12x2*c13.y*c23.y-2*c11.x*c11y2*c13.x*c13.y*c23.x+3*c20.x*c11.y*c12.y*c13x2*c23.y-2*c20.x*c12.x*c12y2*c13.x*c23.y-2*c20.x*c12.x*c12y2*c13.y*c23.x-6*c20.x*c20.y*c13.x*c13y2*c23.x-6*c20.x*c21.x*c13.x*c13y2*c22.y-6*c20.x*c13.x*c21.y*c22.x*c13y2+3*c11.y*c20.y*c12.y*c13x2*c23.x+3*c11.y*c21.x*c12.y*c13x2*c22.y+3*c11.y*c12.y*c13x2*c21.y*c22.x-2*c12.x*c20.y*c12y2*c13.x*c23.x-2*c12.x*c21.x*c12y2*c13.x*c22.y-2*c12.x*c21.x*c12y2*c22.x*c13.y-2*c12.x*c12y2*c13.x*c21.y*c22.x-6*c20.y*c21.x*c13.x*c22.x*c13y2-c11y2*c12.x*c12.y*c13.x*c23.x+2*c20.x*c12x2*c12.y*c13.y*c23.y+6*c20.y*c13x2*c21.y*c22.x*c13.y+2*c11x2*c11.y*c13.x*c13.y*c23.y+c11x2*c12.x*c12.y*c13.y*c23.y+2*c12x2*c20.y*c12.y*c13.y*c23.x+2*c12x2*c21.x*c12.y*c13.y*c22.y+2*c12x2*c12.y*c21.y*c22.x*c13.y+c21x3*c13y3+3*c10x2*c13y3*c23.x-3*c10y2*c13x3*c23.y+3*c20x2*c13y3*c23.x+c11y3*c13x2*c23.x-c11x3*c13y2*c23.y-c11.x*c11y2*c13x2*c23.y+c11x2*c11.y*c13y2*c23.x-3*c10x2*c13.x*c13y2*c23.y+3*c10y2*c13x2*c13.y*c23.x-c11x2*c12y2*c13.x*c23.y+c11y2*c12x2*c13.y*c23.x-3*c21x2*c13.x*c21.y*c13y2-3*c20x2*c13.x*c13y2*c23.y+3*c20y2*c13x2*c13.y*c23.x+c11.x*c12.x*c13.x*c13.y*(6*c20.y*c23.y+6*c21.y*c22.y)+c12x3*c13.y*(-2*c20.y*c23.y-2*c21.y*c22.y)+c10.y*c13x3*(6*c20.y*c23.y+6*c21.y*c22.y)+c11.y*c12.x*c13x2*(-2*c20.y*c23.y-2*c21.y*c22.y)+c12x2*c12.y*c13.x*(2*c20.y*c23.y+2*c21.y*c22.y)+c11.x*c12.y*c13x2*(-4*c20.y*c23.y-4*c21.y*c22.y)+c10.x*c13x2*c13.y*(-6*c20.y*c23.y-6*c21.y*c22.y)+c20.x*c13x2*c13.y*(6*c20.y*c23.y+6*c21.y*c22.y)+c21.x*c13x2*c13.y*(6*c20.y*c22.y+3*c21y2)+c13x3*(-2*c20.y*c21.y*c22.y-c20y2*c23.y-c21.y*(2*c20.y*c22.y+c21y2)-c20.y*(2*c20.y*c23.y+2*c21.y*c22.y)),-c10.x*c11.x*c12.y*c13.x*c13.y*c22.y+c10.x*c11.y*c12.x*c13.x*c13.y*c22.y+6*c10.x*c11.y*c12.y*c13.x*c22.x*c13.y-6*c10.y*c11.x*c12.x*c13.x*c13.y*c22.y-c10.y*c11.x*c12.y*c13.x*c22.x*c13.y+c10.y*c11.y*c12.x*c13.x*c22.x*c13.y+c11.x*c11.y*c12.x*c12.y*c13.x*c22.y-c11.x*c11.y*c12.x*c12.y*c22.x*c13.y+c11.x*c20.x*c12.y*c13.x*c13.y*c22.y+c11.x*c20.y*c12.y*c13.x*c22.x*c13.y+c11.x*c21.x*c12.y*c13.x*c21.y*c13.y-c20.x*c11.y*c12.x*c13.x*c13.y*c22.y-6*c20.x*c11.y*c12.y*c13.x*c22.x*c13.y-c11.y*c12.x*c20.y*c13.x*c22.x*c13.y-c11.y*c12.x*c21.x*c13.x*c21.y*c13.y-6*c10.x*c20.x*c22.x*c13y3-2*c10.x*c12y3*c13.x*c22.x+2*c20.x*c12y3*c13.x*c22.x+2*c10.y*c12x3*c13.y*c22.y-6*c10.x*c10.y*c13.x*c22.x*c13y2+3*c10.x*c11.x*c12.x*c13y2*c22.y-2*c10.x*c11.x*c12.y*c22.x*c13y2-4*c10.x*c11.y*c12.x*c22.x*c13y2+3*c10.y*c11.x*c12.x*c22.x*c13y2+6*c10.x*c10.y*c13x2*c13.y*c22.y+6*c10.x*c20.x*c13.x*c13y2*c22.y-3*c10.x*c11.y*c12.y*c13x2*c22.y+2*c10.x*c12.x*c12y2*c13.x*c22.y+2*c10.x*c12.x*c12y2*c22.x*c13.y+6*c10.x*c20.y*c13.x*c22.x*c13y2+6*c10.x*c21.x*c13.x*c21.y*c13y2+4*c10.y*c11.x*c12.y*c13x2*c22.y+6*c10.y*c20.x*c13.x*c22.x*c13y2+2*c10.y*c11.y*c12.x*c13x2*c22.y-3*c10.y*c11.y*c12.y*c13x2*c22.x+2*c10.y*c12.x*c12y2*c13.x*c22.x-3*c11.x*c20.x*c12.x*c13y2*c22.y+2*c11.x*c20.x*c12.y*c22.x*c13y2+c11.x*c11.y*c12y2*c13.x*c22.x-3*c11.x*c12.x*c20.y*c22.x*c13y2-3*c11.x*c12.x*c21.x*c21.y*c13y2+4*c20.x*c11.y*c12.x*c22.x*c13y2-2*c10.x*c12x2*c12.y*c13.y*c22.y-6*c10.y*c20.x*c13x2*c13.y*c22.y-6*c10.y*c20.y*c13x2*c22.x*c13.y-6*c10.y*c21.x*c13x2*c21.y*c13.y-2*c10.y*c12x2*c12.y*c13.x*c22.y-2*c10.y*c12x2*c12.y*c22.x*c13.y-c11.x*c11.y*c12x2*c13.y*c22.y-2*c11.x*c11y2*c13.x*c22.x*c13.y+3*c20.x*c11.y*c12.y*c13x2*c22.y-2*c20.x*c12.x*c12y2*c13.x*c22.y-2*c20.x*c12.x*c12y2*c22.x*c13.y-6*c20.x*c20.y*c13.x*c22.x*c13y2-6*c20.x*c21.x*c13.x*c21.y*c13y2+3*c11.y*c20.y*c12.y*c13x2*c22.x+3*c11.y*c21.x*c12.y*c13x2*c21.y-2*c12.x*c20.y*c12y2*c13.x*c22.x-2*c12.x*c21.x*c12y2*c13.x*c21.y-c11y2*c12.x*c12.y*c13.x*c22.x+2*c20.x*c12x2*c12.y*c13.y*c22.y-3*c11.y*c21x2*c12.y*c13.x*c13.y+6*c20.y*c21.x*c13x2*c21.y*c13.y+2*c11x2*c11.y*c13.x*c13.y*c22.y+c11x2*c12.x*c12.y*c13.y*c22.y+2*c12x2*c20.y*c12.y*c22.x*c13.y+2*c12x2*c21.x*c12.y*c21.y*c13.y-3*c10.x*c21x2*c13y3+3*c20.x*c21x2*c13y3+3*c10x2*c22.x*c13y3-3*c10y2*c13x3*c22.y+3*c20x2*c22.x*c13y3+c21x2*c12y3*c13.x+c11y3*c13x2*c22.x-c11x3*c13y2*c22.y+3*c10.y*c21x2*c13.x*c13y2-c11.x*c11y2*c13x2*c22.y+c11.x*c21x2*c12.y*c13y2+2*c11.y*c12.x*c21x2*c13y2+c11x2*c11.y*c22.x*c13y2-c12.x*c21x2*c12y2*c13.y-3*c20.y*c21x2*c13.x*c13y2-3*c10x2*c13.x*c13y2*c22.y+3*c10y2*c13x2*c22.x*c13.y-c11x2*c12y2*c13.x*c22.y+c11y2*c12x2*c22.x*c13.y-3*c20x2*c13.x*c13y2*c22.y+3*c20y2*c13x2*c22.x*c13.y+c12x2*c12.y*c13.x*(2*c20.y*c22.y+c21y2)+c11.x*c12.x*c13.x*c13.y*(6*c20.y*c22.y+3*c21y2)+c12x3*c13.y*(-2*c20.y*c22.y-c21y2)+c10.y*c13x3*(6*c20.y*c22.y+3*c21y2)+c11.y*c12.x*c13x2*(-2*c20.y*c22.y-c21y2)+c11.x*c12.y*c13x2*(-4*c20.y*c22.y-2*c21y2)+c10.x*c13x2*c13.y*(-6*c20.y*c22.y-3*c21y2)+c20.x*c13x2*c13.y*(6*c20.y*c22.y+3*c21y2)+c13x3*(-2*c20.y*c21y2-c20y2*c22.y-c20.y*(2*c20.y*c22.y+c21y2)),-c10.x*c11.x*c12.y*c13.x*c21.y*c13.y+c10.x*c11.y*c12.x*c13.x*c21.y*c13.y+6*c10.x*c11.y*c21.x*c12.y*c13.x*c13.y-6*c10.y*c11.x*c12.x*c13.x*c21.y*c13.y-c10.y*c11.x*c21.x*c12.y*c13.x*c13.y+c10.y*c11.y*c12.x*c21.x*c13.x*c13.y-c11.x*c11.y*c12.x*c21.x*c12.y*c13.y+c11.x*c11.y*c12.x*c12.y*c13.x*c21.y+c11.x*c20.x*c12.y*c13.x*c21.y*c13.y+6*c11.x*c12.x*c20.y*c13.x*c21.y*c13.y+c11.x*c20.y*c21.x*c12.y*c13.x*c13.y-c20.x*c11.y*c12.x*c13.x*c21.y*c13.y-6*c20.x*c11.y*c21.x*c12.y*c13.x*c13.y-c11.y*c12.x*c20.y*c21.x*c13.x*c13.y-6*c10.x*c20.x*c21.x*c13y3-2*c10.x*c21.x*c12y3*c13.x+6*c10.y*c20.y*c13x3*c21.y+2*c20.x*c21.x*c12y3*c13.x+2*c10.y*c12x3*c21.y*c13.y-2*c12x3*c20.y*c21.y*c13.y-6*c10.x*c10.y*c21.x*c13.x*c13y2+3*c10.x*c11.x*c12.x*c21.y*c13y2-2*c10.x*c11.x*c21.x*c12.y*c13y2-4*c10.x*c11.y*c12.x*c21.x*c13y2+3*c10.y*c11.x*c12.x*c21.x*c13y2+6*c10.x*c10.y*c13x2*c21.y*c13.y+6*c10.x*c20.x*c13.x*c21.y*c13y2-3*c10.x*c11.y*c12.y*c13x2*c21.y+2*c10.x*c12.x*c21.x*c12y2*c13.y+2*c10.x*c12.x*c12y2*c13.x*c21.y+6*c10.x*c20.y*c21.x*c13.x*c13y2+4*c10.y*c11.x*c12.y*c13x2*c21.y+6*c10.y*c20.x*c21.x*c13.x*c13y2+2*c10.y*c11.y*c12.x*c13x2*c21.y-3*c10.y*c11.y*c21.x*c12.y*c13x2+2*c10.y*c12.x*c21.x*c12y2*c13.x-3*c11.x*c20.x*c12.x*c21.y*c13y2+2*c11.x*c20.x*c21.x*c12.y*c13y2+c11.x*c11.y*c21.x*c12y2*c13.x-3*c11.x*c12.x*c20.y*c21.x*c13y2+4*c20.x*c11.y*c12.x*c21.x*c13y2-6*c10.x*c20.y*c13x2*c21.y*c13.y-2*c10.x*c12x2*c12.y*c21.y*c13.y-6*c10.y*c20.x*c13x2*c21.y*c13.y-6*c10.y*c20.y*c21.x*c13x2*c13.y-2*c10.y*c12x2*c21.x*c12.y*c13.y-2*c10.y*c12x2*c12.y*c13.x*c21.y-c11.x*c11.y*c12x2*c21.y*c13.y-4*c11.x*c20.y*c12.y*c13x2*c21.y-2*c11.x*c11y2*c21.x*c13.x*c13.y+3*c20.x*c11.y*c12.y*c13x2*c21.y-2*c20.x*c12.x*c21.x*c12y2*c13.y-2*c20.x*c12.x*c12y2*c13.x*c21.y-6*c20.x*c20.y*c21.x*c13.x*c13y2-2*c11.y*c12.x*c20.y*c13x2*c21.y+3*c11.y*c20.y*c21.x*c12.y*c13x2-2*c12.x*c20.y*c21.x*c12y2*c13.x-c11y2*c12.x*c21.x*c12.y*c13.x+6*c20.x*c20.y*c13x2*c21.y*c13.y+2*c20.x*c12x2*c12.y*c21.y*c13.y+2*c11x2*c11.y*c13.x*c21.y*c13.y+c11x2*c12.x*c12.y*c21.y*c13.y+2*c12x2*c20.y*c21.x*c12.y*c13.y+2*c12x2*c20.y*c12.y*c13.x*c21.y+3*c10x2*c21.x*c13y3-3*c10y2*c13x3*c21.y+3*c20x2*c21.x*c13y3+c11y3*c21.x*c13x2-c11x3*c21.y*c13y2-3*c20y2*c13x3*c21.y-c11.x*c11y2*c13x2*c21.y+c11x2*c11.y*c21.x*c13y2-3*c10x2*c13.x*c21.y*c13y2+3*c10y2*c21.x*c13x2*c13.y-c11x2*c12y2*c13.x*c21.y+c11y2*c12x2*c21.x*c13.y-3*c20x2*c13.x*c21.y*c13y2+3*c20y2*c21.x*c13x2*c13.y,c10.x*c10.y*c11.x*c12.y*c13.x*c13.y-c10.x*c10.y*c11.y*c12.x*c13.x*c13.y+c10.x*c11.x*c11.y*c12.x*c12.y*c13.y-c10.y*c11.x*c11.y*c12.x*c12.y*c13.x-c10.x*c11.x*c20.y*c12.y*c13.x*c13.y+6*c10.x*c20.x*c11.y*c12.y*c13.x*c13.y+c10.x*c11.y*c12.x*c20.y*c13.x*c13.y-c10.y*c11.x*c20.x*c12.y*c13.x*c13.y-6*c10.y*c11.x*c12.x*c20.y*c13.x*c13.y+c10.y*c20.x*c11.y*c12.x*c13.x*c13.y-c11.x*c20.x*c11.y*c12.x*c12.y*c13.y+c11.x*c11.y*c12.x*c20.y*c12.y*c13.x+c11.x*c20.x*c20.y*c12.y*c13.x*c13.y-c20.x*c11.y*c12.x*c20.y*c13.x*c13.y-2*c10.x*c20.x*c12y3*c13.x+2*c10.y*c12x3*c20.y*c13.y-3*c10.x*c10.y*c11.x*c12.x*c13y2-6*c10.x*c10.y*c20.x*c13.x*c13y2+3*c10.x*c10.y*c11.y*c12.y*c13x2-2*c10.x*c10.y*c12.x*c12y2*c13.x-2*c10.x*c11.x*c20.x*c12.y*c13y2-c10.x*c11.x*c11.y*c12y2*c13.x+3*c10.x*c11.x*c12.x*c20.y*c13y2-4*c10.x*c20.x*c11.y*c12.x*c13y2+3*c10.y*c11.x*c20.x*c12.x*c13y2+6*c10.x*c10.y*c20.y*c13x2*c13.y+2*c10.x*c10.y*c12x2*c12.y*c13.y+2*c10.x*c11.x*c11y2*c13.x*c13.y+2*c10.x*c20.x*c12.x*c12y2*c13.y+6*c10.x*c20.x*c20.y*c13.x*c13y2-3*c10.x*c11.y*c20.y*c12.y*c13x2+2*c10.x*c12.x*c20.y*c12y2*c13.x+c10.x*c11y2*c12.x*c12.y*c13.x+c10.y*c11.x*c11.y*c12x2*c13.y+4*c10.y*c11.x*c20.y*c12.y*c13x2-3*c10.y*c20.x*c11.y*c12.y*c13x2+2*c10.y*c20.x*c12.x*c12y2*c13.x+2*c10.y*c11.y*c12.x*c20.y*c13x2+c11.x*c20.x*c11.y*c12y2*c13.x-3*c11.x*c20.x*c12.x*c20.y*c13y2-2*c10.x*c12x2*c20.y*c12.y*c13.y-6*c10.y*c20.x*c20.y*c13x2*c13.y-2*c10.y*c20.x*c12x2*c12.y*c13.y-2*c10.y*c11x2*c11.y*c13.x*c13.y-c10.y*c11x2*c12.x*c12.y*c13.y-2*c10.y*c12x2*c20.y*c12.y*c13.x-2*c11.x*c20.x*c11y2*c13.x*c13.y-c11.x*c11.y*c12x2*c20.y*c13.y+3*c20.x*c11.y*c20.y*c12.y*c13x2-2*c20.x*c12.x*c20.y*c12y2*c13.x-c20.x*c11y2*c12.x*c12.y*c13.x+3*c10y2*c11.x*c12.x*c13.x*c13.y+3*c11.x*c12.x*c20y2*c13.x*c13.y+2*c20.x*c12x2*c20.y*c12.y*c13.y-3*c10x2*c11.y*c12.y*c13.x*c13.y+2*c11x2*c11.y*c20.y*c13.x*c13.y+c11x2*c12.x*c20.y*c12.y*c13.y-3*c20x2*c11.y*c12.y*c13.x*c13.y-c10x3*c13y3+c10y3*c13x3+c20x3*c13y3-c20y3*c13x3-3*c10.x*c20x2*c13y3-c10.x*c11y3*c13x2+3*c10x2*c20.x*c13y3+c10.y*c11x3*c13y2+3*c10.y*c20y2*c13x3+c20.x*c11y3*c13x2+c10x2*c12y3*c13.x-3*c10y2*c20.y*c13x3-c10y2*c12x3*c13.y+c20x2*c12y3*c13.x-c11x3*c20.y*c13y2-c12x3*c20y2*c13.y-c10.x*c11x2*c11.y*c13y2+c10.y*c11.x*c11y2*c13x2-3*c10.x*c10y2*c13x2*c13.y-c10.x*c11y2*c12x2*c13.y+c10.y*c11x2*c12y2*c13.x-c11.x*c11y2*c20.y*c13x2+3*c10x2*c10.y*c13.x*c13y2+c10x2*c11.x*c12.y*c13y2+2*c10x2*c11.y*c12.x*c13y2-2*c10y2*c11.x*c12.y*c13x2-c10y2*c11.y*c12.x*c13x2+c11x2*c20.x*c11.y*c13y2-3*c10.x*c20y2*c13x2*c13.y+3*c10.y*c20x2*c13.x*c13y2+c11.x*c20x2*c12.y*c13y2-2*c11.x*c20y2*c12.y*c13x2+c20.x*c11y2*c12x2*c13.y-c11.y*c12.x*c20y2*c13x2-c10x2*c12.x*c12y2*c13.y-3*c10x2*c20.y*c13.x*c13y2+3*c10y2*c20.x*c13x2*c13.y+c10y2*c12x2*c12.y*c13.x-c11x2*c20.y*c12y2*c13.x+2*c20x2*c11.y*c12.x*c13y2+3*c20.x*c20y2*c13x2*c13.y-c20x2*c12.x*c12y2*c13.y-3*c20x2*c20.y*c13.x*c13y2+c12x2*c20y2*c12.y*c13.x);var roots=poly.getRootsInInterval(0,1);for(var i=0;i<roots.length;i++){var s=roots[i];var xRoots=new Polynomial(c13.x,c12.x,c11.x,c10.x-c20.x-s*c21.x-s*s*c22.x-s*s*s*c23.x).getRoots();var yRoots=new Polynomial(c13.y,c12.y,c11.y,c10.y-c20.y-s*c21.y-s*s*c22.y-s*s*s*c23.y).getRoots();if(xRoots.length>0&&yRoots.length>0){var TOLERANCE=1e-3;checkRoots:for(var j=0;j<xRoots.length;j++){var xRoot=xRoots[j];if(0<=xRoot&&xRoot<=1){for(var k=0;k<yRoots.length;k++){if(Math.abs(xRoot-yRoots[k])<TOLERANCE){result.points.push(c23.multiply(s*s*s).add(c22.multiply(s*s).add(c21.multiply(s).add(c20))));break checkRoots;}}}}}}if(result.points.length>0)result.status="Intersection";return result;};
    //--(bez, line) erwartet trotzdem segment
    Intersection.intersectBezier3Line=function(seg1,seg2){var a,b,c,d;var c3,c2,c1,c0;var cl;var n;var min=seg2.A.min(seg2.D);var max=seg2.A.max(seg2.D);var result=new Intersection("No Intersection");a=seg1.A.multiply(-1);b=seg1.B.multiply(3);c=seg1.C.multiply(-3);d=a.add(b.add(c.add(seg1.D)));c3=new Vector2D(d.x,d.y);a=seg1.A.multiply(3);b=seg1.B.multiply(-6);c=seg1.C.multiply(3);d=a.add(b.add(c));c2=new Vector2D(d.x,d.y);a=seg1.A.multiply(-3);b=seg1.B.multiply(3);c=a.add(b);c1=new Vector2D(c.x,c.y);c0=new Vector2D(seg1.A.x,seg1.A.y);n=new Vector2D(seg2.A.y-seg2.D.y,seg2.D.x-seg2.A.x);cl=seg2.A.x*seg2.D.y-seg2.D.x*seg2.A.y;roots=new Polynomial(n.dot(c3),n.dot(c2),n.dot(c1),n.dot(c0)+cl).getRoots();for(var i=0;i<roots.length;i++){var t=roots[i];if(0<=t&&t<=1){var p5=seg1.A.lerp(seg1.B,t);var p6=seg1.B.lerp(seg1.C,t);var p7=seg1.C.lerp(seg1.D,t);var p8=p5.lerp(p6,t);var p9=p6.lerp(p7,t);var pt10=p8.lerp(p9,t);if(seg2.A.x==seg2.D.x){if(min.y<=pt10.y&&pt10.y<=max.y){result.status="Intersection";result.appendPoint(pt10);}}else if(seg2.A.y==seg2.D.y){if(min.x<=pt10.x&&pt10.x<=max.x){result.status="Intersection";result.appendPoint(pt10);}}else if(pt10.gte(min)&&pt10.lte(max)){result.status="Intersection";result.appendPoint(pt10);}}}return result;};
    //--(line, line) erwartet trotzdem segment
    Intersection.intersectLineLine=function (seg1,seg2){var result;var ua_t=(seg2.D.x-seg2.A.x)*(seg1.A.y-seg2.A.y)-(seg2.D.y-seg2.A.y)*(seg1.A.x-seg2.A.x);var ub_t=(seg1.D.x-seg1.A.x)*(seg1.A.y-seg2.A.y)-(seg1.D.y-seg1.A.y)*(seg1.A.x-seg2.A.x);var u_b=(seg2.D.y-seg2.A.y)*(seg1.D.x-seg1.A.x)-(seg2.D.x-seg2.A.x)*(seg1.D.y-seg1.A.y);if(u_b!=0){var ua=ua_t/u_b;var ub=ub_t/u_b;if(0<=ua&&ua<=1&&0<=ub&&ub<=1){result=new Intersection("Intersection");result.points.push(new Point(seg1.A.x+ua*(seg1.D.x-seg1.A.x),seg1.A.y+ua*(seg1.D.y-seg1.A.y)));}else{result=new Intersection("No Intersection");}}else{if(ua_t==0||ub_t==0){result=new Intersection("Coincident");}else{result=new Intersection("Parallel");}}return result;};
    Intersection.intersectBezier3Circle=function(p1,p2,p3,p4,c,r){return Intersection.intersectBezier3Ellipse(p1,p2,p3,p4,c,r,r);};
    Intersection.intersectBezier3Ellipse=function(p1,p2,p3,p4,ec,rx,ry){var a,b,c,d;var c3,c2,c1,c0;var result=new Intersection("No Intersection");a=p1.multiply(-1);b=p2.multiply(3);c=p3.multiply(-3);d=a.add(b.add(c.add(p4)));c3=new Vector2D(d.x,d.y);a=p1.multiply(3);b=p2.multiply(-6);c=p3.multiply(3);d=a.add(b.add(c));c2=new Vector2D(d.x,d.y);a=p1.multiply(-3);b=p2.multiply(3);c=a.add(b);c1=new Vector2D(c.x,c.y);c0=new Vector2D(p1.x,p1.y);var rxrx=rx*rx;var ryry=ry*ry;var poly=new Polynomial(c3.x*c3.x*ryry+c3.y*c3.y*rxrx,2*(c3.x*c2.x*ryry+c3.y*c2.y*rxrx),2*(c3.x*c1.x*ryry+c3.y*c1.y*rxrx)+c2.x*c2.x*ryry+c2.y*c2.y*rxrx,2*c3.x*ryry*(c0.x-ec.x)+2*c3.y*rxrx*(c0.y-ec.y)+2*(c2.x*c1.x*ryry+c2.y*c1.y*rxrx),2*c2.x*ryry*(c0.x-ec.x)+2*c2.y*rxrx*(c0.y-ec.y)+c1.x*c1.x*ryry+c1.y*c1.y*rxrx,2*c1.x*ryry*(c0.x-ec.x)+2*c1.y*rxrx*(c0.y-ec.y),c0.x*c0.x*ryry-2*c0.y*ec.y*rxrx-2*c0.x*ec.x*ryry+c0.y*c0.y*rxrx+ec.x*ec.x*ryry+ec.y*ec.y*rxrx-rxrx*ryry);
    var roots1=poly.getRootsInInterval(0,1);for(var i=0;i<roots1.length;i++){var t=roots1[i];result.points.push(c3.multiply(t*t*t).add(c2.multiply(t*t).add(c1.multiply(t).add(c0))));}if(result.points.length>0)result.status="Intersection";return result;};
    Intersection.intersectLinePolygon=function(a1,a2,points){var result=new Intersection("No Intersection");var length=points.length;for(var i=0;i<length;i++){var b1=points[i];var b2=points[(i+1)%length];var inter=Intersection.intersectLineLine(a1,a2,b1,b2);result.appendPoints(inter.points);}if(result.points.length>0)result.status="Intersection";return result;};
    Intersection.intersectPolygonPolygon=function(points1,points2){var result=new Intersection("No Intersection");var length=points1.length;for(var i=0;i<length;i++){var a1=points1[i];var a2=points1[(i+1)%length];var inter=Intersection.intersectLinePolygon(a1,a2,points2);result.appendPoints(inter.points);}if(result.points.length>0)result.status="Intersection";return result;};
    //--------------by Andreas Weber-----------------------
    function getTOfPointOnCubicCurve(p0, seg){return getTOfPoint.apply(this, arguments);}
    function getTOfPoint(p0,seg){var p1=seg.A,p2=seg.B,p3=seg.C,p4=seg.D;var ax,bx,cx,dx,ay,by,cy,dy,xl,yl,i,j,k,len1,len2,len3,min,r,round,v;var p0x=p0.x,p0y=p0.y,p1x=p1.x,p1y=p1.y,p2x=p2.x,p2y=p2.y,p3x=p3.x,p3y=p3.y;round=10000;var p4x=p4.x,p4y=p4.y;ax=p4x-3*p3x+3*p2x-p1x;bx=3*p3x-6*p2x+3*p1x;cx=3*p2x-3*p1x;dx=p1x-p0x;ay=p4y-3*p3y+3*p2y-p1y;by=3*p3y-6*p2y+3*p1y;cy=3*p2y-3*p1y;dy=p1y-p0y;min=1/round;if(ax<min&&ax>0-min){ax=0} if(bx<min&&bx>0-min){bx=0} if(cx<min&&cx>0-min){cx=0} if(dx<min&&dx>0-min){dx=0} if(ay<min&&ay>0-min){ay=0} if(by<min&&by>0-min){by=0} if(cy<min&&cy>0-min){cy=0} if(dy<min&&dy>0-min){dy=0} xl=solveCubicPolynomial(ax,bx,cx,dx);yl=solveCubicPolynomial(ay,by,cy,dy);for(i=0,len1=xl.length;i<len1;i++){v=xl[i];if(v!='NAN'){xl[i]=Math.round(v*round)/round;}v=xl[i];if(v<0||v>1){xl.splice(i,1);len1--;i--;}}for(i=0,len1=yl.length;i<len1;i++){v=yl[i];if(v!='NAN'){yl[i]=Math.round(v*round)/round;}v=yl[i];if(v<0||v>1){yl.splice(i,1);len1--;i--;}}if(xl[0]=='NAN'){return yl;}else if(yl[0]=='NAN'){return xl;}else{r=new Array();len1=xl.length;len2=yl.length;for(i=0;i<len1;i++){for(j=0;j<len2;j++){if(xl[i]==yl[j]){for(k=0,len3;k<r.length;k++){if(r[k]==xl[i]){break;}}r.push(xl[i]);yl.splice(j,1);len2--;}}}if(r.length>0){return r;} return[-1];}}
    /*by Aless Lasaruk, adapted by Andreas Weber*/
    function solveCubicPolynomial(a, b, c, d) { var p, q, di, pi; if(a==0){ if(b==0){ if(c==0 && d==0){ return ['NAN']; }else if(c != 0){ return [-d/c]; } }else{ di = c*c-4*b*d; if (di < 0){ return []; }else if(di==0) { return [-c/(2*b)]; }else{ return [(-c + Math.sqrt(di))/(2*b), (-c - Math.sqrt(di))/(2*b)]; } } } p = (3*a*c - b*b)/(3*a*a); q = (2*b*b*b-9*a*b*c+27*a*a*d)/(27*a*a*a); di = q*q/4+p*p*p/27; if(di > 0){ return [crt(-q/2+Math.sqrt(di))+crt(-q/2-Math.sqrt(di))-b/(3*a)]; }else if(di==0) { return [crt(q/2)-b/(3*a), -crt(4*q)-b/(3*a)]; }else{ pi = Math.PI; return [2*Math.sqrt(-p/3)*Math.cos(1/3*Math.acos(-q/2*Math.sqrt(-27/(p*p*p))))- b/(3*a), -2*Math.sqrt(-p/3)*Math.cos(1/3*Math.acos(-q/2*Math.sqrt(-27/(p*p*p)))+ pi/3) - b/(3*a), -2*Math.sqrt(-p/3)*Math.cos(1/3*Math.acos(-q/2*Math.sqrt(-27/(p*p*p)))- pi/3) - b/(3*a) ]; } }
    function crt(x){return x<0 ? -Math.pow(-x,1/3) : Math.pow(x,1/3);}
    function getTOfPointOnLine(pt, seg){return seg.A.distanceFrom(pt)/seg.A.distanceFrom(seg.D);}
    ////----------end of intersection
    // POINT OBJ
    // point und line: basiert auf code: written by Kevin Lindsey
    // ([email protected])
    function Point(x, y) {
         this.name = "_point";
         if (arguments.length == 1) {
              this.x = x[0];
              this.y = x[1]
         if (arguments.length == 2) {
              this.x = x;
              this.y = y
         this.arr = [ this.x, this.y ];
    Point.prototype.lerp = function(that, t) {
         return new Point(this.x + (that.x - this.x) * t, this.y + (that.y - this.y)
                   * t);
    Point.prototype.distanceFrom = function(that) {
         var dx = this.x - that.x;
         var dy = this.y - that.y;
         return Math.sqrt(dx * dx + dy * dy);
    Point.prototype.angle = function(p2) {
         var w = Math.atan2(p2.y - this.y, p2.x - this.x) * 180 / Math.PI;
         if (w < 0) {
              w = w + 360
         return w;
    Point.prototype.plumb = function(lp1, lp2) {
         var x = this.x, y = this.y, x0 = lp1.x, y0 = lp1.y, x1 = lp2.x, y1 = lp2.y;
         if (!(x1 - x0))
              return new Point(x0, y);
         else if (!(y1 - y0))
              return new Point(x, y0);
         var left, tg = -1 / ((y1 - y0) / (x1 - x0));
         var o = {
              x : left = (x1 * (x * tg - y + y0) + x0 * (x * -tg + y - y1))
                        / (tg * (x1 - x0) + y0 - y1),
              y : tg * left - tg * x + y
         return new Point(o.x, o.y);
    Point.prototype.isInHull = function(hull) {// hull? handlungsbedarf
         // wenn hull=bezier
         if (hull.A) {
              hull.pPoints.push(hull.A);
              hull.pPoints.push(hull.B);
              hull.pPoints.push(hull.C);
              hull.pPoints.push(hull.D);
         var w = new Array();
         for ( var i1 = 0; i1 < hull.pPoints.length; i1++) {
              w[i1] = this.angle(hull.pPoints[i1])
         w.sort(NumSort);
         for ( var i = 0; i < w.length; i++) {
              if (i == 0) {
                   if (w[0] + 360 - w[w.length - 1] > 180) {
                        return false
              } else {
                   if (w[i] - w[i - 1] > 180) {
                        return false
         return true
    Point.prototype.Dot = function(d) {
         var ell = app.activeDocument.pathItems.ellipse(this.y + d / 2, this.x - d
                   / 2, d, d);
         ell.selected = false;
         return ell
    Point.prototype.Line = function(pt) {
         var list = [ [ this.x, this.y ], [ pt.x, pt.y ] ], line = app.activeDocument.pathItems
                   .add();
         line.setEntirePath(list);
         return line
    Point.prototype.add = function(that) {
         return new Point(this.x + that.x, this.y + that.y);
    Point.prototype.addEquals = function(that) {
         this.x += that.x;
         this.y += that.y;
         return this;
    Point.prototype.scalarAdd = function(scalar) {
         return new Point(this.x + scalar, this.y + scalar);
    Point.prototype.scalarAddEquals = function(scalar) {
         this.x += scalar;
         this.y += scalar;
         return this;
    Point.prototype.subtract = function(that) {
         return new Point(this.x - that.x, this.y - that.y);
    Point.prototype.subtractEquals = function(that) {
         this.x -= that.x;
         this.y -= that.y;
         return this;
    Point.prototype.scalarSubtract = function(scalar) {
         return new Point(this.x - scalar, this.y - scalar);
    Point.prototype.scalarSubtractEquals = function(scalar) {
         this.x -= scalar;
         this.y -= scalar;
         return this;
    Point.prototype.multiply = function(scalar) {
         return new Point(this.x * scalar, this.y * scalar);
    Point.prototype.multiplyEquals = function(scalar) {
         this.x *= scalar;
         this.y *= scalar;
         return this;
    Point.prototype.divide = function(scalar) {
         return new Point(this.x / scalar, this.y / scalar);
    Point.prototype.divideEquals = function(scalar) {
         this.x /= scalar;
         this.y /= scalar;
         return this;
    Point.prototype.eq = function(that) {
         return (this.x == that.x && this.y == that.y);
    Point.prototype.lt = function(that) {
         return (this.x < that.x && this.y < that.y);
    Point.prototype.lte = function(that) {
         return (this.x <= that.x && this.y <= that.y);
    Point.prototype.gt = function(that) {
         return (this.x > that.x && this.y > that.y);
    Point.prototype.gte = function(that) {
         return (this.x >= that.x && this.y >= that.y);
    Point.prototype.min = function(that) {
         return new Point(Math.min(this.x, that.x), Math.min(this.y, that.y));
    Point.prototype.max = function(that) {
         return new Point(Math.max(this.x, that.x), Math.max(this.y, that.y));
    Point.prototype.toString = function() {
         return this.x + "," + this.y;
    Point.prototype.setXY = function(x, y) {
         this.x = x;
         this.y = y;
    Point.prototype.setFromPoint = function(that) {
         this.x = that.x;
         this.y = that.y;
    Point.prototype.swap = function(that) {
         var x = this.x;
         var y = this.y;
         this.x = that.x;
         this.y = that.y;
         that.x = x;
         that.y = y;
    // LINE OBJ
    function Line(p1, p2) {
         this.p1 = p1;
         this.p2 = p2;
         this.type = this.type()
    Line.prototype.type = function() {
         if (this.p1.x == this.p2.x) {
              return "vert"
         if (this.p1.y == this.p2.y) {
              return "hori"
         return "diag"
    // Steigung
    Line.prototype.slope = function() {
         var p = this.p2.subtract(this.p1);
         return p.y / p.x
    Line.prototype.YatX0 = function() {
         return this.p1.y - this.slope() * this.p1.x
    Line.prototype.isParallel = function(that) {
         if (this.type == "diag" && that.type == "diag") {
              if (this.slope() == that.slope()) {
                   return true
              return false
         if (this.type == that.type)
              return true;
         return false
    Line.prototype.intersect = function(that) {
         var a = this.type, b = that.type, x, y;
         if (this.isParallel(that) == false) {
              if (a == "hori") {
                   y = this.p1.y;
                   if (b == "vert")
                        return new Point(that.p1.x, y);
                   if (b == "diag")
                        return new Point(equate(that.YatX0(), y)
                                  / equate(this.slope(), that.slope()), y)
              if (a == "vert") {
                   x = this.p1.x;
                   if (b == "hori")
                        return new Point(x, that.p1.y);
                   if (b == "diag")
                        return new Point(x, that.slope() * x + that.YatX0())
              if (a == "diag") {
                   if (b == "hori") {
                        y = that.p1.y;
                        x = equate(y, this.YatX0())
                                  / equate(this.slope(), that.slope());
                        return new Point(x, y)
                   if (b == "vert") {
                        x = that.p1.x;
                        y = this.slope() * x + this.YatX0();
                        return new Point(x, y)
                   if (b == "diag") {
                        x = equate(that.YatX0(), this.YatX0())
                                  / equate(this.slope(), that.slope());
                        y = this.slope() * x + this.YatX0();
                        return new Point(x, y)
         return "parallel"
    Line.prototype.plumb = function(pt) { // lotrecht
         var x = pt.x, y = pt.y, x0 = this.p1.x, y0 = this.p1.y, x1 = this.p2.x, y1 = this.p2.y;
         if (!(x1 - x0))
              return new Point(x0, y);
         else if (!(y1 - y0))
              return new Point(x, y0);
         var left, tg = -1 / ((y1 - y0) / (x1 - x0));
         var o = {
              x : left = (x1 * (x * tg - y + y0) + x0 * (x * -tg + y - y1))
                        / (tg * (x1 - x0) + y0 - y1),
              y : tg * left - tg * x + y
         return new Point(o.x, o.y);
    Line.prototype.getT = function(pt) {
         return this.p1.distanceFrom(pt) / this.p1.distanceFrom(this.p2);
    Line.prototype.hasPoint = function(pt) {
         var t = this.getT(pt);
         if (t < 0 || t > 1)
              return t;
         return t
    // BEZIER OBJ
    function Bezier(p1, p2) {
         this.name = "_bezier";
         this.A = p1.an;
         this.B = p1.rDir;
         this.C = p2.lDir;
         this.D = p2.an;
         this.type = this.isLine()
    Bezier.prototype.isLine = function() {
         var self = this;
         if (self.A.x == self.B.x && self.A.y == self.B.y && self.D.x == self.C.x
                   && self.D.y == self.C.y) {
              return "line"
         return "bez"
    Bezier.prototype.PointsForT = function(ti) {
         if (this.type == "bez") {
              this.BT = this.A.lerp(this.B, ti); // new B
              this.tt = this.B.lerp(this.C, ti); // ???
              this.CT = this.C.lerp(this.D, ti); // new C
              this.T1 = this.BT.lerp(this.tt, ti);// new point lDir
              this.T2 = this.tt.lerp(this.CT, ti);// new point rDir
              this.PP = this.T1.lerp(this.T2, ti);// new point an
              this.t = ti;
              this.normale = function() {
                   var n = this.PP.subtract(this.T1), n2 = new Point(-n.y, n.x);
                   return n2.add(this.PP);
              // tangent is T1 or T2
              if (ti <= 0.001) {
                   this.tang = this.T2.angle(this.PP)
              if (ti >= 0.999) {
                   this.tang = this.PP.angle(this.T1)
              if (ti > 0.001 && ti < 0.999) {
                   this.tang = this.T2.angle(this.T1)
         if (this.type == "line") {
              this.PP = this.A.lerp(this.D, ti);
              // return this
         return this
    Bezier.prototype.BezLength = function(tolerance) {
         var seelf = this, len1 = this.A.distanceFrom(this.D), len2 = 0, result = new Array(
                   [ this.A, 0 ]);
         result.push( [ this.D, 1 ]);
         var ri = 1, s = 2, z = 0;
         romberg();
         function romberg() {
              z += 1;
              for (ri; ri < s; ri += 2) {
                   var temp = seelf.PointsForT(ri / s);
                   result = result.insert( [ temp.PP, temp.t ], ri);//
              s = s * 2;
              ri = 1;
              for ( var j = 0; j < result.length; j++) {
                   result[0][2] = len2;
                   if (result[0][1] < 1) {
                        len2 += result[0][0].distanceFrom(result[1][0]);
                   result.turn1();
         while (len2 - len1 > tolerance || z < 5) { //
              len1 = len2;
              len2 = 0;
              romberg();
         return {
              bezLength : len2,
              list : result
         // return len2;
    Bezier.prototype.getTonLength = function(le, tolerance) {
         try {
              var dat = this.BezLength(tolerance)
         } catch (e) {
              return "getLengthFail"
         var lDiff; // var t;
         if (dat.bezLength < le) {
              le -= 0.0001
         if (dat.bezLength < le) {
              alert("getTonLength_toShort \n  " + le + " " + dat.bezLength);
              return "toShort"
         if (dat.bezLength == le)
              return 1;
         if (le == 0)
              return 0
              // if(dat.bezLength>le){alert("getTonLength_toLong \n "+le+"
              // "+dat.bezLength);return "toLong"}
              // if(dat.bezLength==le){le=le-0.1}
         for ( var i = 0; i < dat.list.length; i++) {
              if (dat.list[i][2] > le) {
                   lDiff = (dat.list[i][2] - dat.list[i - 1][2])
                             / (le - dat.list[i - 1][2]);
                   // alert();
                   return dat.list[i - 1][1] + dat.list[1][1] / lDiff;
    // EXTENDED PATHPOINT OBJ
    function XpPoint(ld, an, rd) {
         if (arguments.length < 1)
              return null;
         this.name = "_pPoint";
         if (ld.anchor) { // illustrator pathPoint
              this.lDir = new Point(ld.leftDirection);
              this.an = new Point(ld.anchor);
              this.rDir = new Point(ld.rightDirection);
              this.type = ld.pointType;
         } else if (ld.an) { // pPoint
              this.lDir = ld.lDir;
              this.an = ld.an;
              this.rDir = ld.rDir;
              this.type = ld.type;
         } else if (ld.x) { // point('s)
              if (an)
                   this.an = an
              else
                   this.an = ld;
              this.lDir = ld;
              if (rd)
                   this.rDir = rd
              else
                   this.rDir = ld;
              // this.ai.type=
    // only useful for pathPoints on Beziers, not on rect or line or ....
    XpPoint.prototype.isCurvePoint = function() {
         if ((Math.round((this.rDir.y - this.an.y) / (this.rDir.x - this.an.x)
                   * 1000) == Math.round((this.lDir.y - this.an.y)
                   / (this.lDir.x - this.an.x) * 1000))
                   || (this.rDir.y == this.an.y && this.lDir.y == this.an.y)
                   || (this.rDir.x == this.an.x && this.lDir.x == this.an.x)) {
              return true
         return false
    // EXTENDED PATH OBJ
    Xpath.prototype = new Xitem();
    Xpath.prototype.constructor = Xpath ;
    function Xpath(pfad) {
         Xitem.call(this, pfad);
         this.name = "_Xpath";
         this.ai = pfad;
         if (pfad.pathPoints) {
              this.pPoints = new Array();
              this.pPoints.name = "_pPoints";
              for ( var i = 0; i < pfad.pathPoints.length; i++) {
                   this.pPoints.push(new XpPoint(pfad.pathPoints[i]))
         if (this.pPoints) {
              this.beziers = new Array();
              this.beziers.name = "_beziers";
              var i73 = 0, pts = this.pPoints;
              if (pfad.closed == false)
                   i73++;
              for (i73; i73 < pts.length; i73++) {
                   this.beziers.push(new Bezier(pts[0], pts[1]));
                   pts.turn1()
              pts.turn1()
    Xpath.prototype.SetPath = function() {
         var ancor = new Array(), p = this.pPoints;
         for ( var i1 = 0; i1 < p.length; i1++) {
              ancor.push( [ p[i1].an.x, p[i1].an.y ]);
         var P;
         if (this.ai.pathPoints) {
              P = this.ai.pathPoints.parent
         } else {
              P = app.activeDocument.pathItems.add()
         P.setEntirePath(ancor);
         for ( var i = 0; i < p.length; i++) {
              P.pathPoints[i].rightDirection = [ p[i].rDir.x, p[i].rDir.y ];
              P.pathPoints[i].leftDirection = [ p[i].lDir.x, p[i].lDir.y ];
              if (p[i].type) {
                   P.pathPoints[i].pointType = p[i].type
    // EXTENDED ITEM OBJ
    function Xitem(obj) {
         if (obj) {
              this.name = "_Xitem";
              this.ai = obj;
              Xitem.prototype.center = new Point(this.ai.position[0] + this.ai.width
                        / 2, this.ai.position[1] - this.ai.height / 2);
              Xitem.prototype.bottomLeft = new Point(this.ai.position[0],
                        this.ai.position[1] - this.ai.height);
              Xitem.prototype.topRight = new Point(this.ai.position[0]
                        + this.ai.width, this.ai.position[1]);
    Xitem.prototype.SetToCenter = function(point) {
         this.ai.position = [ point.x - this.ai.width / 2,
                   point.y + this.ai.height / 2 ]
    Xitem.prototype.SetToBottom = function(point) {
         this.ai.position = [ point.x - this.ai.width / 2, point.y + this.ai.height ]
    Xitem.prototype.SetToTop = function(point) {
         this.ai.position = [ point.x - this.ai.width / 2, point.y ]
    Xitem.prototype.inside = function(pt) {
         if (pt.x < this.topRight.x && pt.y < this.topRight.y) {
              if (pt.x > this.bottomLeft.x && pt.y > this.bottomLeft.y) {
                   return true
         return false
    // Xitem.prototype.duplicate=function (){return new Xitem(this.ai.duplicate())};
    // ----------END OF
    // XTENDAIJS----------------------------------------------------------
    function Demo(h) {
         alert("we will take its first 4 pathpoints as points for a beziersegment");
         var pfad = new Xpath(h);
         sel[0].remove();
         var a = pfad.pPoints[1].an;
         var b = pfad.pPoints[2].an;
         var c = pfad.pPoints[3].an;
         var d = pfad.pPoints[0].an;
         var bez = new Bezier( {
              an : a,
              rDir : b
              lDir : c,
              an : d
         }) // ------ (pPoint1 , pPoint2)
         // ------{A,B,C,D} are Points ( with properties x,y)
         var p1 = bez.A.Dot(15), p2 = bez.D.Dot(15);
         redraw()
         alert("These are the anchors");
         // ---------Bezier.Point.function(size)
         var p3 = bez.B.Dot(10), p4 = bez.C.Dot(10);
         // ---------Bezier.Point.function(Point)
         var l1 = bez.A.Line(bez.B), l2 = bez.C.Line(bez.D);
         redraw()
         alert("These are the handles");
         var t03 = bez.PointsForT(0.3);
         t03.PP.Dot(10);
         redraw()
         alert("This is the Point on the Path at T=0.3...");
         bez.B.Line(bez.C);
         t03.BT.Line(t03.tt);
         t03.CT.Line(t03.tt);
         t03.T1.Line(t03.T2);
         redraw()
         alert("... and this is how it was calculated");
         bez.PointsForT(0.1).PP.Dot(10);
         bez.PointsForT(0.2).PP.Dot(10);
         bez.PointsForT(0.5).PP.Dot(10);
         bez.PointsForT(0.4).PP.Dot(10);
         bez.PointsForT(0.6).PP.Dot(10);
         bez.PointsForT(0.7).PP.Dot(10);
         bez.PointsForT(0.8).PP.Dot(10);
         bez.PointsForT(0.9).PP.Dot(10);
         redraw()
         alert("Points from T=0.1 to 0.9");
         var pa1 = new Xpath(pa.add()); //-------- normally created from existing PathItem...
         // -------...then this step is  not necessary:
         pa1.pPoints = [ new XpPoint(a, a, b), new XpPoint(c, d, d) ];
         pa1.SetPath();
         redraw()
         alert("This is the resulting Path \n try to set a point manually at pos t 0.3\n and observe how the handles change");
    function Demo3(PagEitem) {
         var p = new Xpath(PagEitem);
         var pZero = new Point(0, 0);
         alert(p.center);
         p.SetToCenter(pZero);
         redraw();
         alert(p.name);
         alert(p.ai.typename);
         p.SetToCenter( {
              x : 20,
              y : 20
    function Demo2() {
         var pa1 = new Xpath(sel[0]), pa2 = new Xpath(sel[1]);
         for ( var i_1 = 0; i_1 < pa1.beziers.length; i_1++) {
              for ( var i_2 = 0; i_2 < pa2.beziers.length; i_2++) {
                   var inters = new Intersection().IfInterSect(pa1.beziers[i_1],
                             pa2.beziers[i_2]);
                   if (inters.status == "Intersection") {
                        for ( var i_3 = 0; i_3 < inters.points.length; i_3++) {
                             // if you want to know the point...
                             inters.points[i_3].Dot(7);
                             // ...to manipulate path 1...
                             pa1.beziers[i_1].PointsForT(inters.points[i_3].t1).PP
                                       .Dot(15);
                             // ...path 2
                             pa2.beziers[i_2].PointsForT(inters.points[i_3].t2).PP
                                       .Dot(20);
    function polyline(){
         for(var i =0;i<pa.length;i++){
              var polypoints=[];
              var pfad= new Xpath(pa[i]);
              for(var j =0

  • Spry Fade/Blind combo problem

    http://1g2s.arena-i.com/v2/spry-fadeBlind.html
    Click Portfolio
    Page I grabbed the code from : http://labs.adobe.com/technologies/spry/demos/effects/index.html
    I'm having 2 issues
    1 - The fadeBlind is going the full cycle--meaning it fades/blinds in then immediately out.
    I want it to fadeBlind in and stop, then click Close to fadeBlind out and stop.
    2 - I am only able to run the script once for some reason. Clicking portfolio again does nothing.
    Script in effects.js:
    Spry.Effect.FadeBlind = function(element, options)
        Spry.Effect.Cluster.call(this, options);
        this.name = 'FadeBlind';
        var duration = 1000;
        var doToggle = false;
        var from = 0;
        var to = 100;
        if (options)
            if (options.duration) duration = options.duration;
            if (options.toggle) doToggle = options.toggle;
            if (options.from) from = options.from;
            if (options.to) to = options.to;
        var options = {duration: duration, from: from, to: to, toggle: doToggle};
        var blind = new Spry.Effect.Blind(element, options);
        this.addParallelEffect(blind);
        var options = {duration: duration, from: from, to: to, toggle: doToggle};
        var fade = new Spry.Effect.Fade(element, options);
        this.addParallelEffect(fade);
    Spry.Effect.FadeBlind.prototype = new Spry.Effect.Cluster();
    Spry.Effect.FadeBlind.prototype.constructor = Spry.Effect.FadeBlind;
    Link properties :
    I've tried...
    <a onclick="runEffect('FadeBlind', 'portfolio-nav-wrap', {duration:  400, from: '0', to: '100%', toggle: true});" href="#">
    <a onclick="runEffect('FadeBlind', 'portfolio-nav-wrap', {duration:  400, from: '0', to: '100%', toggle: true}); return false;" href="#">
    <a onclick="return runEffect('FadeBlind', 'portfolio-nav-wrap', {duration: 400, from: '0', to: '100%', toggle: true});" href="javascript:void();">
    <a onclick="return runEffect('FadeBlind',  'portfolio-nav-wrap', {duration: 400, from: '0', to: '100%', toggle:  true}); return false;" href="javascript:void();">
    None of the above changes anything. Any help would be appreciated.

    I am using Vista, and Safari 4.0.5
    I actually just figured out a workaround, by programatically setting display to 'block' for a div inside my 'container' div and it seemed to fix the problem.  However I am still curious as to why I was having this problem in the first place.  I've had several 'small' issues with the fade effect in different browsers, and luckily have figured out workarounds for both (the other issue was IE fading into the background color no matter what, which in the case of this site was brown instead of white and looked terrible....).  Thanks for looking at it!
    Dan

  • Play / stop methods

    Hi,
    I have a basic animation with two bindTimelineAction, one listening on "play" and the other on "stop".
    I was not able to figure why, when my animation starts, I can see that both listeners are called, even if my animation isn't in autoplay mode.
    I have dig into the edge javascript file (edge.1.5.0.js) and find that there is a «this.stop();» in the play method.
    d.extend(a.prototype, n.prototype, {constructor: a,play: function(a) {
                this.notifyObservers("play");
                this.stop();
                this.sort();
                this.playing = !0;
                if (this.context)
                    this.context.playDirection = void 0, this.context.executeTriggers = void 0;
                var b = this.getContext(a);
                b.timeline = this;
    There is a good reason for that I guess, anyone ?
    Thanks.

    Using a package, I set up a public class to hold global variables. Once the variable could be accessed from any MC in the movie, I used AS to write/overwrite an array with the names of the clips currently playing.
    Unlike Javascript, the instance name is not enough to access an MC. You must also have the path from where the AS event occurred (in my case, the main timeline).
    I decided that it would be a waste of time to go through and manually figure out the correct information to put into the array. Just navigating the file to implement the test on the first clip change took more time than I would like to admit.
    Plus, I am still not 100% sure it would have worked correctly. Wouldn't it be horrible to test the button between every clip change?
    Instead of continuing with a programmatic solution, I decided to restructure the file. I believe that it was worth my time. Changes are easier, AS works as Adobe intended, and general organization has been restored.

  • Socket callback

    hi there.
    i want my scrip to react on messages from a socket.
    i tried something like this.
    Test.prototype.constructor = Test;
    function Test()
        this.socket = new Socket;
        this.socket.timeout = 10;
        var con = this.socket.open("127.0.0.1:9876","UTF-8");
    Test.prototype.test = function()
        var target = 'indesign-8.0';
        var m = new BridgeTalk();
        m.target = 'indesign-8.0';
            while(true)
            var res = this.socket.read();
            if(res.length > 0)
             m.send();
                alert(res);
                else
                $.sleep(50);
        Model.init();
    var t = new Test();
    t.test();
    this kind of works. an "alert" is shwon every time i send a message from the other side.
    but the while loop will block everything else. is there a way to prevent this?
    i also had the idea to implement a threaded socket in a c++ library, but it seems i can non use callbacks from an external object?
    i can not see a way of calling a javascript function from my c++ library. i can only react on calls.
    please ask if i'm not clear as to what i'm trying to do.
    cheers
    jm

    i thank you again my friend
    i already read the documentation though
    i'm a developer btw. not a designer. so i know some things or two...i may be missing something thought
    cheers!
    jm

  • Fade / Slide Cluster Problems

    Hi, I'm new to Spry so this might have been talked about
    before. I'm trying the Fade / Slide Cluster example here
    http://labs.adobe.com/technologies/spry/articles/effects_coding/index.html
    and I'm getting some errors. I tried the other examples and they
    work fine, but that one gives me these errors in firefox.
    Toggle is not defined; and myFadeSlide has no properties;
    Anyone seen this or came up with a fix?

    That is because the example seems to be missing something.
    The toggle variable is missing + the check if it exists. The
    correct code:
    <script type="text/javascript">
    FadeSlide = function(element, options)
    Spry.Effect.Cluster.call(this, options);
    var duration = 1000;
    var from = 0;
    var to = 100;
    var transition = Spry.fifthTransition;
    var toggle = false;
    if (options)
    if (options.duration != null) duration = options.duration;
    if (options.from != null) from = options.from;
    if (options.to != null) to = options.to;
    if (options.transition != null) transition =
    options.transition;
    if(options.toggle != null) toggle = options.toggle;
    var fadeEffect = new Spry.Effect.Fade(element, {duration:
    duration, from: from, to: to, transition: transition, toggle:
    toggle});
    var blindEffect = new Spry.Effect.Blind(element, {duration:
    duration, from: from, to: to, transition: transition, toggle:
    toggle});
    this.addParallelEffect(fadeEffect);
    this.addParallelEffect(blindEffect);
    FadeSlide.prototype = new Spry.Effect.Cluster();
    FadeSlide.prototype.constructor = FadeSlide;
    </script>
    also
    <script type="text/javascript">
    var myFadeSlide = new FadeSlide("content", {from: "100%", to:
    "0%", duration: 1500, toogle: true}
    </script>
    See the toogle : true, that should be toggle: true

  • Dynamically Adding/Editing/Deleting Tabs on Tabbed Panels

    I am using the tabbed panels and need to know how to
    dynamically create a new tab with javascript with some content
    inside ( and switch to it ). Also, I need to figure out how I can
    delete tabs at "runtime"? I have tried many things to do this, but
    everytime, it has been failing. I need a functions just like this:
    addTab(title, innerHTMLcontent);
    deleteTab(currIndex);
    Also, I think all of the Spry Widgets should have an easy way
    to dynamically change content.

    Hi,
    here is the js file. I am also attaching a sample (I named it
    as Spry.Widget.ExtendedTabbedPanels, may be you could change it).
    Let me know if you face any issues.
    ===================START-JS
    FILE==============================
    var Spry; if (!Spry) Spry = {}; if (!Spry.Widget) Spry.Widget
    = {};
    Spry.Widget.ExtendedTabbedPanels = function(element, opts) {
    Spry.Widget.TabbedPanels.call(this, element, opts);
    Spry.Widget.ExtendedTabbedPanels.prototype = new
    Spry.Widget.TabbedPanels();
    Spry.Widget.ExtendedTabbedPanels.prototype.constructor =
    Spry.Widget.ExtendedTabbedPanels;
    Spry.Widget.ExtendedTabbedPanels.prototype.addTab = function
    (tabname, tabcontent, position) {
    var tabs = this.getTabs();
    if((!position && position != 0)|| position >
    tabs.length)
    position = tabs.length;
    var newtab = tabs[tabs.length - 1].cloneNode(true);
    this.setElementNodeValue(newtab, tabname);
    this.getTabGroup().insertBefore(newtab, tabs[position]);
    var tabContents = this.getContentPanels();
    var newContentPanel = tabContents[tabContents.length -
    1].cloneNode(false);
    newContentPanel.innerHTML = tabcontent;
    this.getContentPanelGroup().insertBefore(newContentPanel,
    tabContents[position]);
    this.addPanelEventListeners(newtab, newContentPanel);
    this.showPanel(position);
    Spry.Widget.ExtendedTabbedPanels.prototype.removeTab =
    function(tabindex) {
    var tabs = this.getTabs();
    if((tabs.length == 1) || (!tabindex && tabindex !=
    0) || tabindex >= tabs.length)
    return false;
    var tabToRemove = tabs[tabindex];
    this.getTabGroup().removeChild(tabToRemove);
    var contentPanelToRemove =
    this.getContentPanels()[tabindex];
    this.getContentPanelGroup().removeChild(contentPanelToRemove);
    this.removePanelEventListeners(tabToRemove,
    contentPanelToRemove);
    if(this.getCurrentTabIndex() == tabindex) {
    if(this.getTabs().length <= tabindex)
    this.showPanel(this.getTabs().length - 1);
    else
    this.showPanel(tabindex);
    Spry.Widget.ExtendedTabbedPanels.removeEventListener =
    function(element, eventType, handler, capture)
    try
    if (element.removeEventListener)
    element.removeEventListener(eventType, handler, capture);
    else if (element.detachEvent)
    element.detachEvent("on" + eventType, handler);
    catch (e) {}
    Spry.Widget.ExtendedTabbedPanels.prototype.removePanelEventListeners
    = function(tab, panel)
    var self = this;
    Spry.Widget.ExtendedTabbedPanels.removeEventListener(tab,
    "click", function(e) { return self.onTabClick(e, tab); }, false);
    Spry.Widget.ExtendedTabbedPanels.removeEventListener(tab,
    "mouseover", function(e) { return self.onTabMouseOver(e, tab); },
    false);
    Spry.Widget.ExtendedTabbedPanels.removeEventListener(tab,
    "mouseout", function(e) { return self.onTabMouseOut(e, tab); },
    false);
    if (this.enableKeyboardNavigation)
    // XXX: IE doesn't allow the setting of tabindex
    dynamically. This means we can't
    // rely on adding the tabindex attribute if it is missing to
    enable keyboard navigation
    // by default.
    // Find the first element within the tab container that has
    a tabindex or the first
    // anchor tag.
    var tabIndexEle = null;
    var tabAnchorEle = null;
    this.preorderTraversal(tab, function(node) {
    if (node.nodeType == 1 /* NODE.ELEMENT_NODE */)
    var tabIndexAttr = tab.attributes.getNamedItem("tabindex");
    if (tabIndexAttr)
    tabIndexEle = node;
    return true;
    if (!tabAnchorEle && node.nodeName.toLowerCase() ==
    "a")
    tabAnchorEle = node;
    return false;
    if (tabIndexEle)
    this.focusElement = tabIndexEle;
    else if (tabAnchorEle)
    this.focusElement = tabAnchorEle;
    if (this.focusElement)
    Spry.Widget.ExtendedTabbedPanels.removeEventListener(this.focusElement,
    "focus", function(e) { return self.onTabFocus(e, tab); }, false);
    Spry.Widget.ExtendedTabbedPanels.removeEventListener(this.focusElement,
    "blur", function(e) { return self.onTabBlur(e, tab); }, false);
    Spry.Widget.ExtendedTabbedPanels.removeEventListener(this.focusElement,
    "keydown", function(e) { return self.onTabKeyDown(e, tab); },
    false);
    Spry.Widget.ExtendedTabbedPanels.prototype.setElementNodeValue
    = function(element, nodevalue) {
    var currentElement = element;
    var tmpElement = this.getElementChildren(element);
    while(tmpElement.length != 0) {
    currentElement = tmpElement[0];
    tmpElement = this.getElementChildren(tmpElement[0]);
    currentElement.innerHTML = nodevalue;
    ====================END JS
    FILE==================================
    ===================SAMPLE
    TEST===================================
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8" />
    <title>Untitled Document</title>
    <link href="SpryAssets/SpryTabbedPanels.css"
    rel="stylesheet" type="text/css" />
    <script src="SpryAssets/SpryTabbedPanels.js"
    type="text/javascript"></script>
    <script src="SpryAssets/SpryExtendedTabbedPanels.js"
    type="text/javascript"></script>
    </head>
    <body>
    <div id="TabbedPanels1" class="TabbedPanels">
    <div class="TabbedPanelsTabGroup">
    <span class="TabbedPanelsTab"
    tabindex="0"><b>Tab 1</b></span>
    <span class="TabbedPanelsTab" tabindex="0">Tab
    2</span>
    </div>
    <div class="TabbedPanelsContentGroup">
    <div class="TabbedPanelsContent">Content 1</div>
    <div class="TabbedPanelsContent">Content 2</div>
    </div>
    </div>
    <input type="text" id="tabname" />
    <input type="text" id="tabcontent" />
    <input type="text" id="position" />
    <input type="button" value="add tab" onclick="add();"
    />
    <input type="button" value="delete tab"
    onclick="TabbedPanels1.removeTab(parseInt(document.getElementById('position').value));"
    />
    <script type="text/javascript">
    <!--
    var TabbedPanels1 = new
    Spry.Widget.ExtendedTabbedPanels("TabbedPanels1");
    function add() {
    var tabTitle = document.getElementById("tabname").value;
    var tabcontent = document.getElementById("tabcontent").value;
    var position = document.getElementById("position").value;
    TabbedPanels1.addTab(tabTitle, tabcontent,
    parseInt(position));
    //-->
    </script>
    </body>
    </html>
    ===================SAMPLE TEST
    END=======================

  • Dashcode Widget for 'URL'

    In Dashcode [latest version of xCode] I have created a widget which when 'Run' in Dashcode opens the Webpage. When dragged into iBooks Author as a URL Widget and tested in iBooks Author it will open the Webpage when loaded onto the 'First Generation' iPad in Preview mode and you tap on the Icon/Image a grey screen opens and top left the 'X' to close and nothing else happens.
    This is the code for the event handler in the Widget.
    function myClickHandler(event)
    // Values you provide
    var websiteURL = "http://en.wikipedia.com/wiki/Air_New_Zealand"; // replace with the website URL to show
    // Show website code
    widget.openURL(websiteURL);
    If required I can post all the code however I thought that would not be necessary given that the above is the only changes I have made.
    Help is always appreciated.. Ant

    Thanks for that information but I have not been able to progress my issue. Perhaps you could send me a working example of the dashcode and I test it to see if it works on my iPad - iBooks Author. It would then be a simple process for me to change the URL [http://] at least it will determine where the point of failure is..... my address is [email protected]..
    And these are a copy of the code:
    This file was generated by Dashcode. 
    You may edit this file to customize your widget or web page
    according to the license.txt file included in the project.
    // Function: load()
    // Called by HTML body element's onload event when the widget is ready to start
    function load()
        dashcode.setupParts();
    // Function: remove()
    // Called when the widget has been removed from the Dashboard
    function remove()
        // Stop any timers to prevent CPU usage
        // Remove any preferences as needed
        // widget.setPreferenceForKey(null, dashcode.createInstancePreferenceKey("your-key"));
    // Function: hide()
    // Called when the widget has been hidden
    function hide()
        // Stop any timers to prevent CPU usage
    // Function: show()
    // Called when the widget has been shown
    function show()
        // Restart any timers that were stopped on hide
    // Function: sync()
    // Called when the widget has been synchronized with .Mac
    function sync()
        // Retrieve any preference values that you need to be synchronized here
        // Use this for an instance key's value:
        // instancePreferenceValue = widget.preferenceForKey(null, dashcode.createInstancePreferenceKey("your-key"));
        // Or this for global key's value:
        // globalPreferenceValue = widget.preferenceForKey(null, "your-key");
    // Function: showBack(event)
    // Called when the info button is clicked to show the back of the widget
    // event: onClick event from the info button
    function showBack(event)
    //    var front = document.getElementById("front");
    //    var back = document.getElementById("back");
    //    if (window.widget) {
    //        widget.prepareForTransition("ToBack");
    //    front.style.display = "none";
    //    back.style.display = "block";
    //    if (window.widget) {
    //        setTimeout('widget.performTransition();', 0);
    // Function: showFront(event)
    // Called when the done button is clicked from the back of the widget
    // event: onClick event from the done button
    function showFront(event)
        var front = document.getElementById("front");
        var back = document.getElementById("back");
        if (window.widget) {
            widget.prepareForTransition("ToFront");
        front.style.display="block";
        back.style.display="none";
        if (window.widget) {
            setTimeout('widget.performTransition();', 0);
    if (window.widget) {
        widget.onremove = remove;
        widget.onhide = hide;
        widget.onshow = show;
        widget.onsync = sync;
    function myClickHandler(event)
      // Values you provide
    var websiteURL = "http://en.wikipedia.com/wiki/Air_New_Zealand";          // replace with the website URL to show
    // Show website code
    widget.openURL(websiteURL);
    And
    This file was generated by Dashcode and is covered by the
    license.txt included in the project.  You may edit this file,
    however it is recommended to first turn off the Dashcode
    code generator otherwise the changes will be lost.
    var dashcodePartSupport = { "imageBgParts": {} };
    if(!window.dashcode){dashcode=new Object()}dashcode.setupParts=function(){if(dashcode.setupParts.called){return }dashcode.setupParts.called=true;var H=[];if(window.dashcodeDataSources&&!dashcode.inDesign){for(var C in dashcodeDataSources){var E=dashcodeDataSources[C];var A=dashcode.setupDataSource(C,E);if(A){A.registerWithName(C)}}}for(var C in dashcodePartSpecs){dashcode.preProcessBindings(dashcodePartSpecs[C])}if(!DC.Sup port.BorderImage){var G=dashcodePartSupport.imageBgParts;for(var B in G){var D=G[B];Element.set3PiecesBorderImage(document.getElementById(B),D[0],D[1],D[2]) }}for(var C in dashcodePartSpecs){var E=dashcodePartSpecs[C];var F=dashcode.setupPart(C,E.creationFunction,E.view,E);if(F&&F.finishLoading){H[H. length]=F}}for(var I=0;I<H.length;I++){H[I].finishLoading()}};dashcode.setupPart=function(elementO rId,creationFunction,viewClass,specDict,relativeController){var object=null;var createFunc=window[creationFunction];var node=elementOrId;if(elementOrId.nodeType!=1){node=document.getElementById(eleme ntOrId)}if(!node){return null}if(createFunc){object=createFunc(node,specDict)}else{var viewClass=null;object=DC.View.fromNode(node);if(object){return object}if(specDict.view){viewClass=eval(specDict.view)}if(dashcode.inDesign){da shcode.preProcessBindings(specDict)}if(!viewClass){viewClass=DC.View.viewClassFo rNode(node,specDict.hasBindings)||DC.View}object=new (viewClass)(node,relativeController,specDict.propertyValues,specDict);node.obje ct=object}return object};dashcode.setupDataSource=function(identifier,specDict){var dsClass=null;var dataSource=null;try{dsClass=specDict.Class?eval(specDict.Class):null}catch(e){} if(!dsClass){console.error("Couldn't create data source "+identifier+". Invalid class specified.");return null}var propertyValues=specDict.propertyValues;dataSource=new dsClass(propertyValues);return dataSource};dashcode.getDataSource=function(A){return DC.dataModel.valueForKey(A)};dashcode.preProcessBindings=function(A){if(A&&A.pr opertyValues&&!A.hasBindings){for(p in A.propertyValues){if(-1!==p.search(/Binding$/)){A.hasBindings=true;if(dashcode. inDesign){delete A.propertyValues[p]}else{break}}}}};if(window.addEventListener){window.addEvent Listener("load",dashcode.setupParts,false)}else{if(window.attachEvent){window.at tachEvent("load",dashcode.setupParts)}}dashcode.getLocalizedString=function(A){t ry{A=localizedStrings[A]||A}catch(B){}return A};dashcode.createInstancePreferenceKey=function(A){return widget.identifier+"-"+A};dashcode.getElementHeight=function(B){var A=B.offsetHeight;if(!A||A==0){A=dashcode.getElementSize(B).height}return A};dashcode.getElementWidth=function(B){var A=B.offsetWidth;if(!A||A==0){A=dashcode.getElementSize(B).width}return A};dashcode.getElementSize=function(B){var A=dashcode.getElementSizesWithAncestor([B],B);return A[0]};dashcode.getElementSizesWithAncestor=function(A,F){if(A.length<1){return[ ]}var B=new Array();var C=A[0].offsetWidth;if(!C||C==0){var G=F;while(G&&(G!=document)){var I=Element.getStyles(G,"display");var H=(I)?I:G.style.display;if((I&&H=="none")||(!I&&H!="block")){B.push({node:G,dis play:G.style.display});G.style.display="block"}G=G.parentNode}}var J=new Array();for(var E=0;E<A.length;E++){J.push({width:A[E].offsetWidth,height:A[E].offsetHeight})}f or(var E=0;E<B.length;E++){var D=B[E].node;D.style.display=B[E].display;if(D.getAttribute("style")==""){D.remo veAttribute("style")}}return J};dashcode.getElementDocumentOffset=function(B){var C=B.offsetParent;var D={x:B.offsetLeft,y:B.offsetTop};if(C){var A=dashcode.getElementDocumentOffset(C);D.x+=A.x;D.y+=A.y}return D};dashcode.pointInElement=function(A,E,D){var C=dashcode.getElementSize(D);var B=dashcode.getElementDocumentOffset(D);if(A>=B.x){if(A>B.x+C.width){return false}if(E>=B.y){if(E>B.y+C.height){return false}}else{return false}}else{return false}return true};dashcode.cloneTemplateElement=function(B,A,C){return DC.View.cloneViewsForTreeNode(B,C,null)};dashcode.processClonedTemplateElement= function(D,C,B,F,E,A){console.error("dashcode.processClonedTemplateElement is no longer available.")};var setupParts=dashcode.setupParts;var getLocalizedString=dashcode.getLocalizedString;var createInstancePreferenceKey=dashcode.createInstancePreferenceKey;var getElementHeight=dashcode.getElementHeight;var getElementWidth=dashcode.getElementWidth;var getElementSize=dashcode.getElementSize;if(!("querySelector" in document)){document.write('<script apple-no-regeneration="yes" type="text/javascript" src="../Parts/core/external/sizzle_c.js"><\/script>')};if("undefined"!==typeof (DC)){throw new Error("Library module (DC) already defined")}var DC={version:"@VERSION@",revision:"@REVISION@",generateUid:(function(){var A=0;return function(){return ++A}})()};DC.Browser={IE:!!(window.attachEvent&&!window.opera)&&(function(){var B=/MSIE (\d+)/;var A=B.exec(navigator.userAgent);return A&&parseInt(A[1],10)})(),Safari:navigator.userAgent.indexOf("AppleWebKit/")>-1, Safari2:(function(){var A=/AppleWebKit\/(\d+(?:\.\d+)?)/;var B=A.exec(navigator.userAgent);return(B&&parseInt(B[1],10)<420)})(),Mozilla:navi gator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")==-1,Mo bileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)};DC.Support={Pro perties:("__defineGetter__" in Object.prototype),QuerySelector:("querySelector" in document),Touches:!!document.createTouch,CSS3ColorModel:false,CSSTransitions:fa lse,BorderImage:(function(){var A=document.createElement("div").style;A.cssText="-webkit-border-image: inherit; -moz-border-image: inherit;";return(A.WebkitBorderImage=="inherit")||(A.MozBorderImage=="inherit") })()};if(DC.Support.Properties){DC.Support.__defineGetter__("CSS3ColorModel",fun ction(){delete this.CSS3ColorModel;var B=document.createElement("span");try{B.style.backgroundColor="rgba(100,100,100, 0.5)";return this.CSS3ColorModel=(B.style.length===1)}catch(A){}return(this.CSS3ColorModel=f alse)});DC.Support.__defineGetter__("CSSTransitions",function(){delete this.CSSTransitions;var B=document.createElement("span");try{B.style.setProperty("-webkit-transition-du ration","1ms","");return this.CSSTransitions=(B.style.length===1)}catch(A){}return(this.CSSTransitions=f alse)})}DC.typeOf=function(B){if(null===B){return"null"}var A=typeof (B);if("object"!==A&&"function"!==A){return A}return Object.prototype.toString.call(B).slice(8,-1).toLowerCase()};DC.compareValues=f unction(F,D){var C=DC.typeOf(F);if(C!==DC.typeOf(D)){var A=String(F);var E=String(D);return A.localeCompare(E)}switch(C){case"null":return 0;case"boolean":case"number":var B=(F-D);if(0===B){return B}return(B<0?-1:1);case"regexp":case"function":break;case"string":case"array":c ase"object":if(F.localeCompare){return F.localeCompare(D)}if(F.compare){return F.compare(D)}break;case"undefined":return true;default:throw new TypeError("Unknown type for comparison: "+C)}return String(F).localeCompare(String(D))};DC.defineError=function(B){function A(C){this.message=C;this.name=B}A.prototype=new Error;A.prototype.constructor=A;A.prototype.name=B;return A};var InvalidArgumentError=DC.defineError("InvalidArgumentError");if("undefined"==typ eof (window.console)){window.console={}}if("undefined"==typeof (window.console.log)){window.console.log=function(){}}if("undefined"==typeof (window.console.error)){window.console.error=function(){}};if("undefined"!==typ eof (window.Prototype)){(function(){var A=["indexOf","lastIndexOf","forEach","filter","map","some","every","reduce","re duceRight"];for(var B=0;B<A.length;++B){delete Array.prototype[A[B]]}})()}Array.prototype.distinct=function(){var B=this.length;var A=new Array(B);var C;var E;var D=0;for(C=0;C<B;++C){E=this[C];if(-1==A.indexOf(E)){A[D++]=E}}A.length=D;return A};Array.prototype.compare=function(B){var D=this.length-B.length;if(0!==D){return D}var E;var A;var C;for(E=0,A=this.length;E<A;++E){C=DC.compareValues(this[E],B[E]);if(0!==C){ret urn C}}return 0};Array.from=function(A,B){return Array.prototype.slice.call(A,B||0)};if(!Array.prototype.reduce){Array.prototype .reduce=function(B){var A=this.length;if(typeof B!="function"){throw new TypeError()}if(0===A&&1===arguments.length){throw new TypeError()}var C=0;if(arguments.length>=2){var D=arguments[1]}else{do{if(C in this){D=this[C++];break}if(++C>=A){throw new TypeError()}}while(true)}for(;C<A;C++){if(C in this){D=B.call(null,D,this[C],C,this)}}return D}}if(!Array.prototype.reduceRight){Array.prototype.reduceRight=function(B){var A=this.length;if(typeof B!="function"){throw new TypeError()}if(0===A&&1===arguments.length){throw new TypeError()}var C=A-1;if(arguments.length>=2){var D=arguments[1]}else{do{if(C in this){D=this[C--];break}if(--C<0){throw new TypeError()}}while(true)}for(;C>=0;C--){if(C in this){D=B.call(null,D,this[C],C,this)}}return D}}if(!Array.indexOf){Array.indexOf=function(C,B,A){return Array.prototype.indexOf.call(C,B,A)}}if(!Array.lastIndexOf){Array.lastIndexOf=f unction(C,B,A){return Array.prototype.lastIndexOf.call(C,B,A)}}if(!Array.forEach){Array.forEach=funct ion(C,A,B){return Array.prototype.forEach.call(C,A,B)}}if(!Array.filter){Array.filter=function(C, A,B){return Array.prototype.filter.call(C,A,B)}}if(!Array.map){Array.map=function(C,A,B){re turn Array.prototype.map.call(C,A,B)}}if(!Array.some){Array.some=function(C,A,B){ret urn Array.prototype.some.call(C,A,B)}}if(!Array.every){Array.every=function(C,A,B){ return Array.prototype.every.call(C,A,B)}}if(!Array.reduce){Array.reduce=function(B,A) {if(arguments.length>2){return Array.prototype.reduce.apply(B,A,arguments[2])}else{return Array.prototype.reduce.apply(B,A)}}}if(!Array.reduceRight){Array.reduceRight=fu nction(B,A){if(arguments.length>2){return Array.prototype.reduceRight.apply(B,A,arguments[2])}else{return Array.prototype.reduceRight.apply(B,A)}}};function Set(){var D=this;if(D.constructor!==Set){D=new Set()}var B=arguments;if(1==B.length&&B[0] instanceof Array){B=B[0]}var C;var A=B.length;for(C=0;C<A;++C){D[B[C]]=true}return D}Set.union=function(C,B){var A=Object.clone(C);if(!B){return A}var D;for(D in B){A[D]=true}return A};Set.intersect=function(C,B){var A=new Set();var D;for(D in C){if(D in B){A[D]=true}}return A};Set.add=function(B,A){B[A]=true;return B};Set.remove=function(B,A){delete B[A];return B};Set.toArray=function(C){var B;var A=[];for(B in C){A.push(B)}return A};Set.forEach=function(E,C,B){var D;var A=0;for(D in E){C.call(B,D,A++)}};Set.join=function(D,B){var C;var A=[];for(C in D){A.push(C)}return A.join(B||"")};var $S=Set;var Class=(function(){function D(I,L){var J;if(!I&&!L){return I}if(!I){J=function(){return L.apply(this,arguments)}}else{var K=/this\.base/.test(I);if(!K&&!L){return I}if(!K){J=function(){L.call(this);return I.apply(this,arguments)}}else{J=function(){var N=this.base;this.base=L||function(){};var M=I.apply(this,arguments);this.base=N;return M}}}J.valueOf=function(){return I};J.toString=function(){return String(I)};return J}function G(I,J){var K=I.prototype.__factory__.apply(I,J);if("function"!==typeof (K)){throw new Error("Factory function doesn't return a function")}K.__factoryFn__=true;return K}function F(K){if(K.__createFactoryObjects){K.__createFactoryObjects();return }var J;var I;for(J in K.__factories__){I=K[J];if(!I.__factoryFn__){continue}K[J]=I.call(K)}}function C(I,K){if(I&&!(I instanceof Function)){throw new Error("Invalid constructor")}if(K&&!(K instanceof Function)){throw new Error("Invalid superclass")}K=K?K.valueOf():null;I=D(I,K);var J;if(I){J=function(){if(!(this instanceof J)){return G(J,arguments)}this.__uid=this.__uid||DC.generateUid();var L=I.apply(this,arguments);if(L){return L}F(this);if(this.__postConstruct instanceof Function){this.__postConstruct()}return this}}else{J=function(){if(!(this instanceof J)){return G(J,arguments)}this.__uid=this.__uid||DC.generateUid();F(this);if(this.__postCo nstruct instanceof Function){this.__postConstruct()}return this}}J.valueOf=function(){return I};J.toString=function(){return String(I||J)};return J}function B(J){function I(){}I.prototype=J.prototype;return new I()}function E(L,J,K){if(!L||!/this\.base/.test(L)){return L}function I(){var N=this.base;this.base=K[J]||function(){};var M=L.apply(this,arguments);this.base=N;return M}I.valueOf=function(){return L};I.toString=function(){return String(L)};return I}function H(J,I,K,L){if(K instanceof Function&&L){var M=K.valueOf();K=E(K,I,L);K.name=I;if(M.__factoryFn__){J.__factories__[I]=K}}J[I ]=K;return K}function A(J){var I;for(I=J.superclass;I;I=I.superclass){if("__subclassCreated__" in I){I.__subclassCreated__(J)}}}return{create:function(L,J){var I;var K={};switch(arguments.length){case 0:throw new TypeError("Missing superclass and declaration arguments");case 1:J=L;L=undefined;break;default:K=B(L);break}if("function"==typeof (J)){J=J();if(!J){throw new Error("Class declaration function did not return a prototype")}}if(J.hasOwnProperty("constructor")){I=J.constructor;delete J.constructor}I=C(I,L);I.prototype=K;I.prototype.constructor=I;I.superclass=L;i f(L){K.__factories__=Object.clone(L.prototype.__factories__)}else{K.__factories_ _={}}I.__class_id__=DC.generateUid();K.__class_id__=DC.generateUid();this.extend (I,J);A(I);return I},findPropertyName:function(L,I){var J;for(var K in L){J=L[K];if(J===I||("function"===typeof (J)&&J.valueOf()===I)){return K}}return null},extend:(function(){if(DC.Support.Properties){return function(I,J){var N=I.prototype;var P=I.superclass&&I.superclass.prototype;var K;for(var O in J){var M=J.__lookupGetter__(O);var L=J.__lookupSetter__(O);if(M||L){M&&N.__defineGetter__(O,M);L&&N.__defineSetter __(O,L)}else{H(N,O,J[O],P)}}return I}}else{return function(I,J){var K=I.prototype;var M=I.superclass&&I.superclass.prototype;for(var L in J){H(K,L,J[L],M)}}}})()}})();if(!Function.prototype.bind){Function.prototype.bi nd=function(C){var A=this;if(!arguments.length){return A}if(1==arguments.length){return function(){return A.apply(C,arguments)}}var B=Array.from(arguments,1);return function(){return A.apply(C,B.concat(Array.from(arguments)))}}}if(!Function.prototype.bindAsEvent Listener){Function.prototype.bindAsEventListener=function(C){var A=this;if(1==arguments.length){return function(D){return A.call(C,D||window.event)}}var B=Array.from(arguments);B.shift();return function(D){return A.apply(C,[D||window.event].concat(B))}}}if(!Function.prototype.delay){Function .prototype.delay=function(D){var B=this;D=D||10;if(arguments.length<2){function A(){B()}return window.setTimeout(A,D)}var C=Array.from(arguments,1);function E(){B.apply(B,C)}return window.setTimeout(E,D)}}if(!Function.prototype.bindAndDelay){Function.prototype .bindAndDelay=function(F,D){var B=this;F=F||B;D=D||10;if(arguments.length<3){function A(){B.call(F)}return window.setTimeout(A,D)}var C=Array.from(arguments,2);function E(){B.apply(F,C)}return window.setTimeout(E,D)}}Function.prototype.sync=function(){var B=arguments.length?this.bind.apply(this,arguments):this;var A={};var C=false;B.stop=function(){C=true};B.waitFor=function(D){A[D]=true;return function(){A[D]=false;for(var E in A){if(A[E]){return }}if(C){return }B()}};return B};Object.clone=function(B){var A=(function(){});A.prototype=B;return new A()};Object.applyDefaults=function(C,B){C=C||{};if(!B){return C}for(var A in B){if(A in C){continue}C[A]=B[A]}return C};Object.extend=function(C,A){C=C||{};for(var B in A){C[B]=A[B]}return C};Object.merge=function(C,A){var B={};var D;for(D in C){B[D]=C[D]}for(D in A){if(D in B){continue}B[D]=A[D]}return B};(function(){var B=Set("file","submit","image","reset","button");var D={};function E(I,H,J){var G=I[H];var F=DC.typeOf(G);if("string"===F){I[H]=[G,J]}else{if("array"===F){G.push(J)}else{ I[H]=J}}}function C(H){var F=H.name;var G=(H.type||"").toLowerCase();if(H.disabled||G in B){return }if("radio"===G||"checkbox"===G){if(H.checked){E(this,F,H.value)}}else{if(H.mul tiple){function I(J){if(J.selected){E(this,F,J.value)}}this[F]=[];Array.forEach(H.options,I,thi s)}else{E(this,F,H.value);if("image"===G){E(this,F+".x",0);E(this,F+".y",0)}}}}O bject.fromForm=function(G){var F={};Array.forEach(G.elements,C,F);return F};function A(H){H=H.split("=");if(1===H.length){return }var F=decodeURIComponent(H[0].trim());var G=decodeURIComponent(H[1].trim())||null;E(this,F,G)}Object.fromQueryString=func tion(G){if("?"==G.charAt(0)){G=G.slice(1)}G=G.split(/\s*&\s*/);var F={};G.forEach(A,F);return F};Object.toQueryString=function(K){if(!K){return""}var H;var J;var F;var G=[];function I(M){if(null!==M&&"undefined"!==typeof (M)){M=encodeURIComponent(M)}var L=M+"";if(L.length){G.push(H+"="+L)}else{G.push(H)}}for(H in K){J=K[H];F=DC.typeOf(J);if("function"===F||J===D[H]){continue}H=encodeURICompo nent(H);if("array"===F){J.forEach(I)}else{I(J)}}return G.join("&")}})();RegExp.escape=function(A){return A.replace(RegExp._escapeRegex,"\\$1")};RegExp.specialCharacters=["/",".","*","+ ","?","|","(",")","[","]","{","}","\\"];RegExp._escapeRegex=new RegExp("(\\"+RegExp.specialCharacters.join("|\\")+")","g");DC.strings={"marker. input.multipleValues":"Multiple Values","marker.input.placeholder":"","marker.input.noSelection":"No Selection","marker.text.multipleValues":"Multiple Values","marker.text.placeholder":"","marker.text.noSelection":"No Selection","error.no_description":"An unspecified error occurred.","error.invalid_value":"This value is not valid.","error.invalid_number":"This value is not a valid number."};DC.localisedString=function(A){return{toString:function(){if(A in DC.strings){return DC.strings[A]}console.log("Localisation missing string for key: "+A);return A}}};var _=DC.localisedString;DC.Error=Class.create({constructor:function(A){Object.exte nd(this,A)},description:_("error.no_description"),recoverySuggestion:null});DC.K eyInfo=Class.create({constructor:function(D,B){var A=DC.KVO.getPropertyMethodsForKeyOnObject(B,D);this.__uid=[B,DC.generateUid()]. join("_");this.reader=A.getter;this.mutator=A.mutator;this.validator=A.validator ;this.key=B;this.mutable=((this.mutator||!this.reader)?true:false);if(!this.read er&&!this.mutator){this.mutable=true}this.changeCount=0;var C=A.value;if(!C){return }var E=DC.typeOf(C);if(E in DC.KVO.typesOfKeyValuesToIgnore||!C._addParentLink){return }C._addParentLink(D,this)},get:function(B){if(this.reader){return this.reader.call(B)}var A;if(this.key in B){A=B[this.key]}else{A=null}if(A&&A._addParentLink){A._addParentLink(B,this)}r eturn A},set:function(B,A){if(this.mutator){this.mutator.call(B,A)}else{B.willChangeV alueForKey(this.key,this);B[this.key]=A;B.didChangeValueForKey(this.key,this)}}, validate:function(B,A){if(!this.validator){return A}return this.validator.call(B,A)},unlinkParentLink:function(){if(!this.parentLink){retu rn }this.parentLink.observer=null;this.parentLink.callback=null;this.parentLink=nu ll}});DC.ChangeType={setting:0,insertion:1,deletion:2,replacement:3};DC.ChangeNo tification=Class.create({constructor:function(D,A,E,C,B){this.object=D;this.chan geType=A;this.newValue=E;this.oldValue=C;this.indexes=B;this.objectKeyPath=[]},t oString:function(){var A="[ChangeNotification changeType: ";switch(this.changeType){case DC.ChangeType.setting:A+="setting";break;case DC.ChangeType.insertion:A+="insertion";break;case DC.ChangeType.deletion:A+="deletion";break;case DC.ChangeType.replacement:A+="replacement";break;default:A+="<<unknown>>";break }A+=" newValue="+this.newValue+" oldValue="+this.oldValue+(this.indexes?" indexes="+this.indexes.join(", "):"")+"]";return A}});DC.ObserverEntry=Class.create({constructor:function(A,C,B){this.observer=A ;this.callback=C;this.context=B},observeChangeForKeyPath:function(A,B){if(!this. callback||!this.observer||-1!==A.objectKeyPath.indexOf(this.observer)){return }this.callback.call(this.observer,A,B,this.context)}});DC.KVO=Class.create({con structor:function(){},__factory__:function(){var B=Array.from(arguments);var A=this;function C(){}return function(){C.prototype=A.prototype;var D=new C();A.prototype.constructor.apply(D,B);return D}},setValueForKeyPath:function(C,D){if(!D||0===D.length){throw new InvalidArgumentError("keyPath may not be empty")}if("string"==typeof (D)){D=D.split(".")}var B=D[0];if(1==D.length){this.setValueForKey(C,B);return }if("@"==B.charAt(0)){return }var A=this.valueForKey(B);if(!A){return }A.setValueForKeyPath(C,D.slice(1))},setValueForKey:function(B,A){if(!A||0===A. length){throw new InvalidArgumentError("key may not be empty")}var C=this.infoForKey(A);if(!C||!C.mutable){return }C.set(this,B)},valueForKeyPath:function(E){if(!E||0===E.length){throw new InvalidArgumentError("keyPath may not be empty")}if("string"==typeof (E)){E=E.split(".")}var D=E[0];if(1==E.length){return this.valueForKey(D)}if("@"==D.charAt(0)){var B=D.substr(1);var A=this.valueForKeyPath(E.slice(1));return DC.ArrayOperator[B](A)}var C=this.valueForKey(D);if("undefined"===typeof (C)||null===C){return undefined}return C.valueForKeyPath(E.slice(1))},valueForKey:function(A){if(!A||0===A.length){thr ow new InvalidArgumentError("the key is empty")}var B=this.infoForKey(A);if(!B){return null}return B.get(this)},validateValueForKeyPath:function(C,D){if(!D||0===D.length){throw new InvalidArgumentError("keyPath may not be empty")}if("string"==typeof (D)){D=D.split(".")}var B=D[0];if(1==D.length){return this.validateValueForKey(C,B)}var A=this.valueForKey(B);if("undefined"===typeof (A)||null===A){return C}return A.validateValueForKeyPath(C,D.slice(1))},validateValueForKey:function(B,A){if(! A||!A.length){throw new InvalidArgumentError("missing key")}var C=this.infoForKey(A);return C.validate(this,B)},observeChildObjectChangeForKeyPath:function(D,C,A){if(DC.KV O.kAllPropertiesKey!=C){C=A+"."+C}else{C=A}var B=Object.clone(D);B.object=this;this.notifyObserversOfChangeForKeyPath(B,C)},in foForKeyPath:function(D){if(!D||0===D.length){throw new InvalidArgumentError("keyPath is empty")}if("string"==typeof (D)){D=D.split(".")}var B=D[0];if(1==D.length){return this.infoForKey(B)}else{if("@"==B.charAt(0)){var C=new DC.KeyInfo(null,null);C.mutable=false;return C}else{var A=this.valueForKey(B);if(!A){return undefined}if(!A.infoForKeyPath){return undefined}return A.infoForKeyPath(D.slice(1))}}},infoForKey:function(A){var B;if(!this.__keys){this.__keys={}}if(DC.KVO.kAllPropertiesKey==A){return null}B=this.__keys[A];if(B){return B}B=new DC.KeyInfo(this,A);this.__keys[A]=B;return B},setKeysTriggerChangeNotificationsForDependentKey:function(D,C){if(!D||!D.len gth){throw new InvalidArgumentError("keys array is not valid")}if(!C){throw new InvalidArgumentError("dependentKey can not be null")}if(-1!==C.indexOf(".")){throw new InvalidArgumentError("dependentKey may not be a key path")}var B;var F;var A;var E;if("string"===typeof (D)){D=[D]}if(!this.__dependentKeys){this.__dependentKeys={}}for(A=0;A<D.length ;++A){B=D[A];if(!B){throw new InvalidArgumentError("key at index "+A+" was null")}if(!(B in this.__dependentKeys)){this.__dependentKeys[B]=[]}DC.KVO.getPropertyMethodsForK eyOnObject(B,this);E=this.__dependentKeys[B];if(-1==E.indexOf(C)){E.push(C)}}},m utableKeys:function(){var D=[];var B;var A;var C;if("__mutableKeys" in this&&this.__mutableKeys.concat){return this.__mutableKeys}var E=Set.union(DC.KVO.keysToIgnore,this.__keysToIgnore);for(B in this){if(B in E||"__"===B.substr(0,2)){continue}A=this[B];if("function"!==typeof (A)){D.push(B);continue}if(1!==A.length||"set"!==B.substr(0,3)){continue}C=B.ch arAt(3);if(C!==C.toUpperCase()){continue}B=C.toLowerCase()+B.substr(4);if(-1===D .indexOf(B)){D.push(B)}}return D},initialiseKeyValueObserving:function(){this.__uid=this.__uid||DC.generateUid ();this.__observers={}},_addParentLink:function(D,E,C){if(!this.hasOwnProperty(" __observers")){this.initialiseKeyValueObserving()}var B=this.__observers[DC.KVO.kAllPropertiesKey];if(!B){B=this.__observers[DC.KVO.k AllPropertiesKey]={}}C=C||E.__uid;if(C in B){return }var A=new DC.ObserverEntry(D,D.observeChildObjectChangeForKeyPath,E?E.key:"");B[C]=A;if(! E){return }E.unlinkParentLink();E.parentLink=A},_removeParentLink:function(C,D,B){if(!thi s.__observers){return }var A=this.__observers[DC.KVO.kAllPropertiesKey];if(!A){A=this.__observers[DC.KVO.k AllPropertiesKey]={}}B=B||D.__uid;if(D&&D.parentLink===A[B]){D.unlinkParentLink( )}delete A[B]},addObserverForKeyPath:function(A,E,D,B){if(!D||0===D.length){throw new InvalidArgumentError("keyPath is empty")}if(!A){throw new InvalidArgumentError("Observer may not be null")}if(!E){E=A.observeChangeForKeyPath}if("string"===typeof (E)){E=A[E]}if(!E){throw new InvalidArgumentError("Missing callback method")}if(!this.hasOwnProperty("__observers")){this.initialiseKeyValueObservi ng()}if(!this.__observers[D]){this.infoForKeyPath(D);this.__observers[D]=[]}var C=new DC.ObserverEntry(A,E,B);this.__observers[D].push(C)},removeObserverForKeyPath:f unction(C,F){if(!F||0===F.length){throw new InvalidArgumentError("keyPath may not be empty")}if(!C){throw new InvalidArgumentError("Observer may not be null")}if(!this.__observers||!this.__observers[F]){return }var E=this.__observers[F];var B=-1;var D;var A=E.length;for(B=0;B<A;++B){D=E[B];if(D.observer==C){E.splice(B,1);return }}},willChangeValueForKey:function(A,C){if(!A){throw new InvalidArgumentError("key may not be null")}C=(C instanceof DC.KeyInfo)?C:this.infoForKey(A);if(!C){return }if(1!==++C.changeCount){return }var B=(this.__dependentKeys&&this.__dependentKeys[A]);if(B){B.forEach(this.willChan geValueForKey,this)}C.previousValue=C.get(this)},forceChangeNotificationForKey:f unction(A,B){if(!A){throw new InvalidArgumentError("key may not be null")}B=(B instanceof DC.KeyInfo)?B:this.infoForKey(A);if(!B){return }if(0!==B.changeCount){return }B.changeCount=1;this.didChangeValueForKey(A,B)},didChangeValueForKey:function( B,F){if(!B){throw new InvalidArgumentError("key may not be null")}F=(F instanceof DC.KeyInfo)?F:this.infoForKey(B);if(!F){return }if(0!==--F.changeCount){return }var C=F.get(this);var A=F.previousValue;F.previousValue=null;if(C!==A){var E=new DC.ChangeNotification(this,DC.ChangeType.setting,C,A);this.notifyObserversOfCha ngeForKeyPath(E,B);if(A&&A._removeParentLink){A._removeParentLink(this,F)}if(C&& C._addParentLink){C._addParentLink(this,F)}}var D=(this.__dependentKeys&&this.__dependentKeys[B]);if(D){D.forEach(this.didChang eValueForKey,this)}},notifyObserversOfChangeForKeyPath:function(J,L){if(!L){thro w new InvalidArgumentError("keyPath may not be null")}if(!this.__observers){return }var G;var F;var H;F=this.__observers[DC.KVO.kAllPropertiesKey];if(F){var E=Object.clone(J);var A=J.objectKeyPath.length;J.objectKeyPath.push(this);for(G in F){var B=F[G];B.observeChangeForKeyPath(E,L)}J.objectKeyPath.length=A}if(DC.KVO.kAllPr opertiesKey==L){return }F=this.__observers[L];if(F&&F.length){H=F.length;for(G=0;G<H;++G){F[G].observe ChangeForKeyPath(J,L)}}var D=L+".";var I=D.length;var K;var M;var P;var O;var C;var N=!(null===J.oldValue||"undefined"===typeof (J.oldValue));for(M in this.__observers){if(M.substr(0,I)!=D){continue}F=this.__observers[M];if(!F||!F .length){continue}K=M.substr(I);O=J.oldValue;if(O&&O.valueForKeyPath){O=O.valueF orKeyPath(K)}else{O=null}C=J.newValue;if(C&&C.valueForKeyPath){C=C.valueForKeyPa th(K)}else{C=null}if(N&&O===C){continue}P=new DC.ChangeNotification(J.object,J.changeType,C,O,J.indexes);H=F.length;for(G=0;G <H;++G){F[G].observeChangeForKeyPath(P,M)}}}});DC.KVO.kAllPropertiesKey="*";DC.K VO.keysToIgnore=$S("__keys","__observers","__keysToIgnore","__dependentKeys","__ mutableKeys","__factories__");DC.KVO.typesOfKeyValuesToIgnore=$S("string","numbe r","boolean","date","regexp","function");DC.KVO.getPropertyMethodsForKeyOnObject =(function(){function B(H,F){F=F||"__kvo_prop_"+H;var G={getter:function(){var I=null;if(F in this){I=this[F]}var J=this.__keys?this.__keys[H]:null;if(!J){return I}if(I&&I._addParentLink){I._addParentLink(this,J)}else{J.unlinkParentLink()}re turn I},mutator:function(I){this.willChangeValueForKey(H);if("undefined"===typeof (I)){I=null}this[F]=I;this.didChangeValueForKey(H);return I}};G.mutator.__key=H;G.getter.__key=H;return G}function C(H,G){function F(J){this.willChangeValueForKey(G);var I=H.call(this,J);this.didChangeValueForKey(G);return I}F.__key=G;F.valueOf=function(){return H};F.toString=function(){return String(H)};return F}function D(F,H){function G(){var I=F.call(this);var J=this.__keys?this.__keys[H]:null;if(!J){return I}if(I&&I._addParentLink){I._addParentLink(this,J)}else{J.unlinkParentLink()}re turn I}G.__key=H;G.valueOf=function(){return F};G.toString=function(){return String(F)};return G}function E(T,K){var M=K.constructor.prototype;var J=(M==K);var L=(M!=Object.prototype&&M!=DC.KVO.prototype)?M:K;var U=T.titleCase();var P="get"+U;var Q="set"+U;var I="validate"+U;var O;var H;var S;var F=K[I];var N=("undefined"!==typeof (O=K.__lookupGetter__(T))&&"undefined"!==typeof (H=K.__lookupSetter__(T)));if(!N){P=(P in K)?P:T;O=K[P];H=K[Q]}if("function"!==typeof (O)){var R="__kvo_prop_"+T;var G=B(T,R);if(T in K){S=K[R]=("undefined"==typeof (O)?null:O);delete K[T]}O=G.getter;H=G.mutator;N=true}else{if(O&&!J){S=O.valueOf().call(K)}if(O&&T !==O.__key){O=D(O,T)}if(H&&T!==H.__key){H=C(H,T)}}if(N){L.__defineGetter__(T,O); L.__defineSetter__(T,H)}else{if(O){if(K.hasOwnProperty(P)){K[P]=O}else{L[P]=O}}i f(H){if(K.hasOwnProperty(Q)){K[Q]=H}else{L[Q]=H}}}return{getter:O,mutator:H,vali dator:F,value:S}}function A(Q,J){var L=J.constructor.prototype;var I=(L==J);var K=(L!=Object.prototype&&L!=DC.KVO.prototype)?L:J;var R=Q.titleCase();var O="set"+R;var N="get"+R;var H="validate"+R;N=(N in J)?N:Q;var M=J[N];var G=J[O];var F=J[H];var P;if("function"!==typeof (M)){if(Q in J){P=M}M=null;G=null}else{if(M&&!I){P=M.valueOf().call(J)}if(M&&Q!==M.__key){M= D(M,Q)}if(G&&Q!==G.__key){G=C(G,Q)}}if(M){if(J.hasOwnProperty(N)){J[N]=M}else{K[ N]=M}}if(G){if(J.hasOwnProperty(O)){J[O]=G}else{K[O]=G}}return{getter:M,mutator: G,validator:F,value:P}}if(DC.Support.Properties){return E}else{return A}})();DC.KVO.adapt=function(B){if(!B){throw new InvalidArgumentError("Can't adapt a null object")}var A;for(A in DC.KVO.prototype){if(A in B){continue}B[A]=DC.KVO.prototype[A]}if("keyDependencies" in B&&!("__dependentKeys" in B)){var C=B.keyDependencies;for(A in C){B.setKeysTriggerChangeNotificationsForDependentKey(C[A],A)}}return B};DC.KVO.adaptTree=function(C){DC.KVO.adapt(C);var B;var A;for(B in C){if(B in DC.KVO.keysToIgnore){continue}A=C[B];if(!A){continue}if(DC.typeOf(A) in DC.KVO.typesOfKeyValuesToIgnore){continue}DC.KVO.adaptTree(A)}return C};DC.KVO.__subclassCreated__=function(A){var D=A.superclass.prototype;var B=A.prototype;if(D.keyDependencies===B.keyDependencies){return }var E=B.keyDependencies||{};for(var C in E){B.setKeysTriggerChangeNotificationsForDependentKey(E[C],C)}};DC.Bindable=Cla ss.create(DC.KVO,{constructor:function(A){this.bindings={};this.__parameters=A;t his.__context=DC.dataModel},__createFactoryObjects:function(){var A=DC.dataModel;var C=this.__context;DC.dataModel=this.__context=this;var D;var B;for(D in this.__factories__){B=this[D];if(!B.__factoryFn__){continue}this[D]=B.call(this )}DC.dataModel=A;this.__context=C},exposedBindings:[],defaultPlaceholders:{},aut omaticallySetupBindings:true,__relativeSource:null,defaultPlaceholderForMarkerWi thBinding:function(B,C){var A=this.defaultPlaceholders[C];if(!A){return null}return A[B]||null},__createObserverMethod:function(B,C){function A(E){if(DC.ChangeType.setting!==E.changeType){throw new InvalidArgumentError('Received invalid change type for synthesized binding observer (name="'+B+'" keyPath="'+C+'")')}var D=E.newValue;this.setValueForKey(E.newValue,B)}return A},bindNameToKeyPath:function(B,G,A){var D;var F;var E={};if(!this.bindings){this.bindings={}}D=this["observe"+B.titleCase()+"Change "]||this.__createObserverMethod(B,G);if(this.bindings[B]){this.bindings[B].unbin d()}var C=this.__context;if("object"===typeof (G)){Object.extend(E,G);G=E.keypath}Object.extend(E,DC.Binding.bindingInfoFromS tring(G));if("transformValue" in E){E.transformer={transformValue:E.transformValue,reverseTransformedValue:E.rev erseTransformedValue||null};delete E.transformValue;delete E.reverseTransformedValue}if("*."===E.keypath.substr(0,2)){if(A){C=A}else{C=new DC.KVO()}E.keypath=E.keypath.substr(2)}E.name=B;E.object=C;E.observer=this;E.ob serverFn=D;F=new DC.Binding(E);F.bind();this.bindings[B]=F},__postConstruct:function(){if(!this. automaticallySetupBindings){return }this.__initialising=true;this.__copyParameters(this.__parameters||{});this.set upBindings();this.updateBindings();this.createObservers();delete this.__initialising},__copyParameters:function(C){var D;var A;var B=DC.KVO.adaptTree;for(D in C){if(-1!==D.search(/Binding$/)){continue}A=C[D];if("object"===DC.typeOf(A)&&!( "addObserverForKeyPath" in A)){B(A)}this[D]=A}this.__parameters=C},bindingInfoForName:function(A){if(!this .__parameters){return null}return this.__parameters[A+"Binding"]},__createAutoObserver:function(C,B){var A=DC.ChangeType.setting;return function(D){if(this.bindings[B]||A==D.changeType){return }C.apply(this,arguments)}},createObservers:function(){var E=this.exposedBindings;var A=E.length;var B;var D;var C;for(B=0;B<A;++B){C=E[B];D=this["observe"+C.titleCase()+"Change"];if(!D){conti nue}D=this.__createAutoObserver(D,C);this.addObserverForKeyPath(this,D,C,"__auto _observer__")}},setupBindings:function(){var D=this.exposedBindings;var B=D.length;var E;var A;var C;for(C=0;C<B;++C){A=D[C];E=this.bindingInfoForName(A);if(!E){continue}this.bin dNameToKeyPath(A,E,this.__relativeSource)}},updateBindings:function(){var E=this.bindings;var D=this.exposedBindings;var B=D.length;var A;var C;for(C=0;C<B;++C){A=E[D[C]];if(!A){continue}A.update()}},unbind:function(){for (var A in this.bindings){this.bindings[A].unbind()}}});DC.Bindable.__subclassCreated__=fu nction(C){var E=C.superclass.prototype;var D=C.prototype;if(D.hasOwnProperty("defaultPlaceholders")){var B=Object.clone(E.defaultPlaceholders);D.defaultPlaceholders=Object.extend(B,D.d efaultPlaceholders)}if(E.exposedBindings===D.exposedBindings&&!D.maskedBindings) {return }var A=(E.maskedBindings===D.maskedBindings)?{}:$S(D.maskedBindings);function F(H){return !(H in A)}var G=E.exposedBindings.filter(F);if(E.exposedBindings!==D.exposedBindings){G=G.con cat(D.exposedBindings.filter(F))}D.exposedBindings=G};DC.SortDescriptor=Class.cr eate({constructor:function(D,A,B){this.keyPath=D;this.ascending=A;this.compariso nFn=B||this.defaultCompare;var C=typeof (this.comparisonFn);if("string"!=C&&"function"!=C){throw new InvalidArgumentError("comparisonFn must be either the name of a method or a function reference")}},resolveComparisonFn:function(B){var A=this.comparisonFn;if("string"===typeof (A)){A=B[A]}if("function"!==typeof (A)){throw new TypeError("comparisonFn does not resolve to a function")}return A},compareObjects:function(C,B){if(!C.valueForKeyPath||!B.valueForKeyPath){thro w new InvalidArgumentError("Objects are not Key Value compliant")}var E=C.valueForKeyPath(this.keyPath);var D=B.valueForKeyPath(this.keyPath);var A=this.resolveComparisonFn(E);return A.call(E,D)},defaultCompare:function(A){return DC.compareValues(this,A)},reversedSortDescriptor:function(){return new DC.SortDescriptor(this.keyPath,!this.ascending,this.comparisonFn)}});DC.ValueTr ansformer=Class.create({transformedValue:function(A){return A},reverseTransformedValue:function(A){return A},__factory__:function(){var B=Array.from(arguments);var A=this;function C(){}return function(){C.prototype=A.prototype;var D=new C();A.prototype.constructor.apply(D,B);return D}}});DC.ValueTransformer.__subclassCreated__=function(A){var C=DC.ValueTransformer.prototype;var B=A.prototype;if(C.reverseTransformedValue==B.reverseTransformedValue){A.protot ype.reverseTransformedValue=null}};DC.transformer={};DC.transformerInstances={}; DC.findTransformerWithName=function(transformerName){var valueTransformer=DC.transformerInstances[transformerName.toLowerCase()];if(valu eTransformer){return valueTransformer}if(-1===transformerName.indexOf(".")){valueTransformer=DC.tran sformer[transformerName]}if(!valueTransformer){try{valueTransformer=eval(transfo rmerName)}catch(e){}}if(!valueTransformer){throw new InvalidArgumentError("The transformerName argument does not specify a valid ValueTransformer: "+transformerName)}if("function"!==typeof (valueTransformer)){return valueTransformer}if(valueTransformer.__factoryFn__){valueTransformer=valueTrans former()}else{valueTransformer=new valueTransformer()}return valueTransformer};DC.registerTransformerWithName=function(B,A){if(!B.transforme dValue){throw new InvalidArgumentError("The valueTransformer argument does not support the ValueTransformer method transformedValue")}A=A.toLowerCase();DC.transformerInstances[A]=B};DC.transform er.Not=Class.create(DC.ValueTransformer,{transformedValue:function(A){return(A?f alse:true)},reverseTransformedValue:function(A){return !!A}});DC.registerTransformerWithName(new DC.transformer.Not(),"not");DC.transformer.Boolean=Class.create(DC.ValueTransfo rmer,{constructor:function(A,B){this.trueValue=A;this.falseValue=B},transformedV alue:function(A){return(A==this.trueValue)},reverseTransformedValue:function(A){ return(A?this.trueValue:this.falseValue)}});DC.transformer.Matches=Class.create( DC.ValueTransformer,{constructor:function(A){this.trueRegex=A},transformedValue: function(A){return this.trueRegex.test(A)}});DC.transformer.Generic=Class.create(DC.ValueTransform er,{constructor:function(A,B){this.modelValues=A;this.displayValues=B},transform edValue:function(B){var A=this.modelValues.indexOf(B);var C;if(-1==A){return C}else{return this.displayValues[A]}},reverseTransformedValue:function(B){var A=this.displayValues.indexOf(B);var C;if(-1==A){return C}else{return this.modelValues[A]}}});DC.transformer.Truncated=Class.create(DC.ValueTransform er,{constructor:function(A){this.max=A||50},ellipsis:String.fromCharCode(8230),t ransformedValue:function(C){if(!C&&0!==C){return C}C=""+C;var A=C.length;if(A<=this.max){return C}var B=this.max/2-2;return[C.substr(0,B),this.ellipsis,C.substr(A-B)].join(" ")}});DC.registerTransformerWithName(new DC.transformer.Truncated(50),"truncated");DC.transformer.StringsToObjects=Class .create(DC.ValueTransformer,{constructor:function(A){this.key=A||"string"},trans formedValue:function(B){if(!B||!B.map){return B}function A(C){var D=new DC.KVO();D[this.key]=C;return D}return B.map(A,this)},reverseTransformedValue:function(B){if(!B||!B.map){return B}function A(C){return C[this.key]}return B.map(A,this)}});DC.registerTransformerWithName(new DC.transformer.StringsToObjects("string"),"StringsToObjects");DC.transformer.Fi rstObject=Class.create(DC.ValueTransformer,{transformedValue:function(A){if(DC.t ypeOf(A)=="array"){return A[0]}return A}});Object.extend(DC,{NoSelectionMarkerType:"noSelection",MultipleValuesMarker Type:"multipleValues",NullValueMarkerType:"nullValue"});DC.Binding=Class.create( {constructor:function(A){Object.extend(this,A);if("string"===typeof (this.transformer)){this.transformer=DC.findTransformerWithName(this.transforme r)}if("function"===typeof (this.transformer)){if(this.transformer.__factoryFn__){this.transformer=this.tr ansformer()}else{this.transformer=new this.transformer()}}this.refresh()},bind:function(){this.object.addObserverForK eyPath(this,this.observeChangeForKeyPath,this.keypath)},unbind:function(){this.o bject.removeObserverForKeyPath(this,this.keypath)},refresh:function(){var A=this.object.valueForKeyPath(this.keypath);this.cachedOriginalValue=A;this.mar kerType=this.markerTypeFromValue(A);if(this.markerType){if((this.markerType+"Pla ceholder") in this){A=this[this.markerType+"Placeholder"]}else{A=this.observer.defaultPlaceho lderForMarkerWithBinding(this.markerType,this.name)}}else{A=this.transformedValu e(A)}this.cachedValue=A},transformedValue:function(A){if(!this.transformer){retu rn A}return this.transformer.transformedValue(A)},validateProposedValue:function(B){if(this .transformer){if(!this.transformer.reverseTransformedValue){throw new Error("Can't validate a value when the transformer doesn't have a reverseTransformedValue method")}B=this.transformer.reverseTransformedValue(B)}var A=this.object.validateValueForKeyPath(B,this.keypath);if(A instanceof DC.Error){return A}return this.transformedValue(A)},setValue:function(A){if(this.cachedValue===A){return }this.markerType=this.markerTypeFromValue(A);this.cachedValue=A;if(this.transfo rmer){if(!this.transformer.reverseTransformedValue){return }A=this.transformer.reverseTransformedValue(A)}this.cachedOriginalValue=A;var B=this.updating;this.updating=true;this.object.setValueForKeyPath(A,this.keypat h);this.updating=B},mutable:function(){if(this.transformer&&!this.transformer.re verseTransformedValue){return false}var A=this.object.infoForKeyPath(this.keypath);return A&&A.mutable},value:function(){return this.cachedValue},update:function(){var B=this.value();var C=new DC.ChangeNotification(this.object,DC.ChangeType.setting,B);this.updating=true;t ry{this.observerFn.call(this.observer,C,this.keypath)}catch(A){console.error('Ex ception while bindng "'+this.name+'" to keypath "'+this.keypath+' ": '+A)}this.updating=false},observerFn:function(C,A,B){},markerTypeFromValue:func tion(A){if(null===A||"undefined"===typeof (A)||""===A){return DC.NullValueMarkerType}if(DC.Markers.MultipleValues===A){return DC.MultipleValuesMarkerType}if(DC.Markers.NoSelection===A){return DC.NoSelectionMarkerType}return null},placeholderValue:function(){var A;if((this.markerType+"Placeholder") in this){A=this[this.markerType+"Placeholder"]}else{A=this.observer.defaultPlaceho lderForMarkerWithBinding(this.markerType,this.name)}if("function"===typeof (A)){A=A.call(this.object)}return A},observeChangeForKeyPath:function(G,A,B){if(this.updating&&G.newValue===this. cachedOriginalValue){return }this.cachedOriginalValue=G.newValue;var E=G.newValue;this.markerType=this.markerTypeFromValue(E);if(this.markerType){E= this.placeholderValue()}else{E=this.transformedValue(E)}var C=Object.clone(G);C.newValue=E;if(DC.ChangeType.setting===G.changeType){this.ca chedValue=E}var F=this.updating;this.updating=true;try{this.observerFn.call(this.observer,C,A,B )}catch(D){console.error('Exception while bindng "'+this.name+'" to keypath "'+this.keypath+' ": '+D)}this.updating=F}});DC.Binding.bindingRegex=/^(.*?)(?:\((.*)\))?$/;DC.Bindi ng.compoundRegex=/^\s*([^&|].*?)\s*(\&\&|\|\|)\s*(\S.+)\s*$/;DC.Binding.bindingI nfoFromString=function(B){var A;var C;A=B.match(DC.Binding.bindingRegex);if(!A||A.length<3){throw new InvalidArgumentError("bindingString isn't in correct format")}var D={keypath:A[1]};if(A[2]){D.transformer=DC.findTransformerWithName(A[2])}return D};Class.extend(Array,{containsObject:function(A){return -1!==this.indexOf(A)},valueForKey:function(D){if(!D||0===D.length){throw new InvalidArgumentError("the key is empty")}if("@count"==D){return this.length}var E=new Array(this.length);var C;var A=this.length;var B;for(C=0;C<A;++C){B=this[C];E[C]=B?B.valueForKey(D):null}return E},setValueForKey:function(D,C){if(!C||0===C.length){throw new InvalidArgumentError("key is empty")}var B;var A=this.length;for(B=0;B<A;++B){this[B].setValueForKey(D,C)}},indexesOfObjects:f unction(E){var D;var B=E.length;var A=[];var C;for(D=0;D<B;++D){C=this.indexOf(E[D]);if(-1===C){continue}A.push(C)}return A},addObject:function(B){var A=this.length;var C=new DC.ChangeNotification(this,DC.ChangeType.insertion,[B],null,[A]);this.push(B);t his.observeElementAtIndex(A);this.notifyObserversOfChangeForKeyPath(C,DC.KVO.kAl lPropertiesKey)},addObjects:function(G){var B=G.length;var E=this.length;var C=[];var A=[];var F=new DC.ChangeNotification(this,DC.ChangeType.insertion,C,null,A);for(index=0;index< B;++index){var D=G[index];this.push(D);this.observeElementAtIndex(E);C.push(D);A.push(E++)}thi s.notifyObserversOfChangeForKeyPath(F,DC.KVO.kAllPropertiesKey)},insertObjectAtI ndex:function(B,A){if(A<0||A>this.length){throw new RangeError("index must be within the bounds of the array")}var C=new DC.ChangeNotification(this,DC.ChangeType.insertion,[B],null,[A]);this.splice(A, 0,B);this.observeElementAtIndex(A);this.notifyObserversOfChangeForKeyPath(C,DC.K VO.kAllPropertiesKey)},insertObjectsAtIndexes:function(E,C){if(E.length!==C.leng th){throw new InvalidArgumentError("length of objects and indexes parameters must be equal")}var A=E.length;var D;var B;for(D=0;D<A;++D){B=C[D];this.splice(B,0,E[D]);this.observeElementAtIndex(B)}v ar F=new DC.ChangeNotification(this,DC.ChangeType.insertion,E,null,C);this.notifyObserve rsOfChangeForKeyPath(F,DC.KVO.kAllPropertiesKey)},replaceObjectAtIndex:function( C,B){var A=this[B];this[B]=C;var D=new DC.ChangeNotification(this,DC.ChangeType.replacement,[C],[A],[B]);this.notifyOb serversOfChangeForKeyPath(D,DC.KVO.kAllPropertiesKey)},replaceObjectsAtIndexes:f unction(F,D){var B=[];var A=F.length;var E;var C;for(E=0;E<A;++E){C=D[E];B[E]=this[C];this.stopObservingElementAtIndex(C);this [C]=F[E];this.observeElementAtIndex(C)}var G=new DC.ChangeNotification(this,DC.ChangeType.replacement,F,null,D);this.notifyObser versOfChangeForKeyPath(G,DC.KVO.kAllPropertiesKey)},removeObject:function(B){var A=this.indexOf(B);if(-1===A){return }this.removeObjectAtIndex(A)},removeObjects:function(D){var A=D.length;var B;for(var C=0;C<A;++C){B=this.indexOf(D[C]);if(-1===B){continue}this.removeObjectAtIndex( B)}},removeObjectsAtIndexes:function(D){var C;var E=D.sort(function(I,H){return H-I});var A=D.length;var B=[];for(C=0;C<A;++C){var F=E[C];this.stopObservingElementAtIndex(F);B.push(this[F]);this.splice(F,1)}var G=new DC.ChangeNotification(this,DC.ChangeType.deletion,null,B,E);this.notifyObserver sOfChangeForKeyPath(G,DC.KVO.kAllPropertiesKey)},removeObjectAtIndex:function(B) {if(B<0||B>=this.length){throw new RangeError("index must be within the bounds of the array")}this.stopObservingElementAtIndex(B);var A=this.splice(B,1);var C=new DC.ChangeNotification(this,DC.ChangeType.deletion,null,A,[B]);this.notifyObserv ersOfChangeForKeyPath(C,DC.KVO.kAllPropertiesKey)},removeAllObjects:function(){v ar D;var C=[];var A=this.length;C.length=A;for(D=0;D<A;++D){this.stopObservingElementAtIndex(D);C [D]=D}var B=this.splice(0,A);var E=new DC.ChangeNotification(this,DC.ChangeType.deletion,null,B,C);this.notifyObserver sOfChangeForKeyPath(E,DC.KVO.kAllPropertiesKey)},objectsAtIndexes:function(C){va r D;var B=[];var A=C.length;B.length=C.length;for(D=0;D<A;++D){B[D]=this[C[D]]}return B},observeChildObjectChangeForKeyPath:function(F,E,B){var D=F.object;var C=this.indexOf(D);if(!this.__uid){this.initialiseKeyValueObserving()}if(-1===C) {D._removeParentLink(this,null,this.__uid);return }var A=new DC.ChangeNotification(D,DC.ChangeType.replacement,[F.newValue],[F.oldValue],[C] );this.notifyObserversOfChangeForKeyPath(A,E)},observeElementAtIndex:function(A) {var B=this[A];if(!B||!B._addParentLink){return }if(!this.__uid){this.initialiseKeyValueObserving()}B._addParentLink(this,null, this.__uid)},stopObservingElementAtIndex:function(A){var B=this[A];if(!B||!B._removeParentLink){return }if(!this.__uid){this.initialiseKeyValueObserving()}B._removeParentLink(this,nu ll,this.__uid)},initialiseKeyValueObserving:function(){var B;var A=this.length;this.__observers={};this.__uid=this.__uid||DC.generateUid();for(B =0;B<A;++B){this.observeElementAtIndex(B)}}});DC.KVO.adapt(Array.prototype);DC.A rrayOperator={avg:function(A){return this.sum(A)/A.length},count:function(A){throw new InvalidArgumentError("@count operator must end the keyPath")},distinctUnionOfArrays:function(A){return this.unionOfArrays(A).distinct()},distinctUnionOfObjects:function(A){return A.distinct()},max:function(D){var B=null;var E;var A;var C;for(E=0,A=D.length;E<A;++E){C=D[E];if(null===B||C>B){B=C}}return B},min:function(C){var E=null;var D;var A;var B;for(D=0,A=C.length;D<A;++D){B=C[D];if(null===E||B<E){E=B}}return E},sum:function(B){var D=0;var A=B.length;var C;for(C=0;C<A;++C){D+=B[C]}return D},unionOfArrays:function(B){var D=[];var A;var C;for(C=0,A=B.length;C<A;++C){D=D.concat(B[C])}return D},unionOfObjects:function(A){return A}};Object.extend(DC,{dataModel:new DC.KVO(),registerModelWithName:function(B,A){DC.dataModel.setValueForKey(B,A)}, unregisterModelWithName:function(A){delete DC.dataModel[A]}});String.prototype.titleCase=function(){return this.charAt(0).toUpperCase()+this.substr(1)};String.prototype.trim=function(){v ar B=this.replace(/^\s+/,"");for(var A=B.length-1;A>0;--A){if(/\S/.test(B.charAt(A))){B=B.substring(0,A+1);break}}re turn B};String.prototype.beginsWith=function(A){return A===this.substring(0,A.length)};if(!String.prototype.localeCompare){String.prot otype.localeCompare=function(A){if(this<A){return -1}else{if(this>A){return 1}else{return 0}}}}String.prototype.expand=function(C,A){function B(F,D){var E=C[D];if(null===E||"undefined"===typeof (E)){return A}return E}return this.replace(/\$\{(\w+)\}/g,B)};var CancelledError=DC.defineError("CancelledError");var InvalidStateError=DC.defineError("InvalidStateError");(function(){var C=-1;var A=0;var B=1;DC.Deferred=Class.create({constructor:function(D){this.canceller=D;this._re sult=null;this._status=C;this._callbacks=[]},_fire:function(D){while(this._callb acks.length){this._status=(D instanceof Error)?B:A;this._result=D;var E=this._callbacks.shift()[this._status];if(!E){continue}D=E(D);if(D instanceof DC.Deferred){var F=this;function G(H){F._fire(H);return H}D.addMethods(G,G);return }}this._status=(D instanceof Error)?B:A;this._result=D},result:function(){return this._result},cancel:function(){if(C!==this._status){throw new InvalidStateError("Can not cancel Deferred because it is already complete")}var D=(this.canceller&&this.canceller());if(!(D instanceof Error)){D=new CancelledError("Deferred operation cancelled")}this.failure(D)},addMethods:function(D,E){this._callbacks.push([D,E ]);if(C===this._status){return this}this._fire(this._result);return this},addCallback:function(D){return this.addMethods(D,null)},addErrorHandler:function(D){return this.addMethods(null,D)},callback:function(D){if(C!==this._status){throw new InvalidStateError("Can not signal callback because Deferred is already complete: result="+D)}this._fire(D)},failure:function(D){if(C!==this._status){throw new InvalidStateError("Can not signal failure because Deferred is already complete: error="+D)}this._fire(D)}})})();window.XHR=(function(){var getTransport=function(){throw new Error("XMLHttpRequest not available.")};if(!DC.Browser.IE){getTransport=function(){return new XMLHttpRequest()}}else{var progIdCandidates=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"];va r len=progIdCandidates.length;var progId;var xhr;for(var i=0;i<len;++i){try{progId=progIdCandidates[i];xhr=new ActiveXObject(progId);getTransport=function(){return new ActiveXObject(progId)};break}catch(e){}}}function send(url,method,options){var timeout;function noop(){}function cancel(){xhr.onreadystatechange=noop;xhr.abort()}function readyStateChanged(xhrEvent){if(4!==xhr.readyState){return }if(timeout){clearTimeout(timeout)}if(xhrSent===false){arguments.callee.delay(0 );return }var status=xhr.status;var succeeded=(status>=200&&status<300)||304==status;if(0===status||"undefined"===t ypeof (status)){var protocol=window.location.protocol;succeeded="file:"===protocol||"chrome:"===pro tocol}var result=xhr.responseText;var err;if(succeeded){if("HEAD"==method){result={};try{var headers=xhr.getAllResponseHeaders();if(headers){headers=headers.split("\n");hea ders.forEach(function(header){var match=header.match(/^([^:]+):(.+)$/m);var name=match[1].trim();result[name]=match[2].trim()})}}catch(e){}}else{var contentType=options.responseContentType||xhr.getResponseHeader("Content-Type"); if(contentType.match(/(?:application\/(?:x-)?json)|(?:text\/json)/)){try{result= eval("("+result+")")}catch(e){err=e;succeeded=false}}if(contentType.match(/(?:ap plication|text)\/xml/)){result=xhr.responseXML}}}else{err=new Error("XHR request failed");err.url=url;err.method=method;err.xhr=xhr;err.status=xhr.status;err.st atusText="Failed to load resource."}if(succeeded){deferred.callback(result)}else{deferred.failure(err)}x hr.onreadystatechange=noop;xhr=null}var xhr=getTransport();var queryString=Object.toQueryString(options.parameters||{});var body=options.body||"";var async=!options.sync;var deferred=new DC.Deferred(cancel);var xhrSent=false;method=(method||"GET").toUpperCase();try{if("GET"==method){if(que ryString&&-1===url.indexOf("?")){url=url+"?"+queryString}else{if(queryString&&-1 !==url.indexOf("?")){url=url+"&"+queryString}else{if("&"===url.slice(-1)){url=ur l+queryString}else{url=url+queryString}}}}if(options.responseContentType&&xhr.ov errideMimeType){xhr.overrideMimeType(options.responseContentType)}if(options.use r){xhr.open(method,url,async,options.user,options.password||"")}else{xhr.open(me thod,url,async)}var headers=options.headers||{};for(var h in headers){xhr.setRequestHeader(h,headers[h])}if("POST"==method){xhr.setRequestHe ader("Content-Type",options.contentType||"application/x-www-form-urlencoded");bo dy=queryString}if(async){xhr.onreadystatechange=readyStateChanged;timeout=setTim eout(function(){xhr.abort()},30000)}xhr.send(body);xhrSent=true;if(!async){ready StateChanged()}}catch(e){var err=new Error("XHR request failed");err.url=url;err.method=method;err.xhr=xhr;err.status=-1;err.statusText ="Failed to load resource.";deferred.failure(err)}return deferred}return{get:function(url,parameters,options){return XHR.request("GET",url,parameters,options)},post:function(url,parameters,options ){return XHR.request("POST",url,parameters,options)},request:function(method,url,paramet ers,options){method=method.toUpperCase();options=options||{};options.parameters= parameters;return send(url,method,options)}}})();DC.Controller=Class.create(DC.Bindable,{construc tor:function(A){this.base(A)},registerWithName:function(A){if(!A){return }this.name=A;DC.registerModelWithName(this,A)}});DC.Markers={MultipleValues:"Th isIsAnUniqueStringThatRepresentsMultipleValues",NoSelection:"ThisIsAnUniqueStrin gThatRepresentsNoSelection"};DC.SelectionProxy=Class.create(DC.KVO,{constructor: function(A){this.controller=A;this.mutable=true},infoForKey:function(B){var A=this.controller.selectedObjects();var C=A.infoForKey(B);C.mutable&=this.mutable;return C},infoForKeyPath:function(C){var A=this.controller.selectedObjects();var B=A.infoForKeyPath(C);B.mutable&=this.mutable;return B},translateValue:function(D){if("array"!==DC.typeOf(D)){return D}if(1===D.length){return D[0]}var C;var A;var B=D[0];for(C=1,A=D.length;C<A;++C){if(0!==DC.compareValues(B,D[C])){return DC.Markers.MultipleValues}}return B},valueForKey:function(C){var B=this.controller.selectedObjects();if(0===B.length){return DC.Markers.NoSelection}var A=B.valueForKey(C);return this.translateValue(A)},validateValueForKeyPath:function(E,F){var B=this.controller.selectedObjects();var A=B.length;var D;if(0===A){return E}var C;for(D=0;D<A;++D){C=B[D].validateValueForKeyPath(E,F);if(C instanceof DC.Error){return C}}return C},valueForKeyPath:function(C){var B=this.controller.selectedObjects();if(0===B.length){return DC.Markers.NoSelection}var A=B.valueForKeyPath(C);return this.translateValue(A)},setValueForKey:function(D,C){if(!this.mutable){return }var B=this.controller.selectedObjects();var A=this.valueForKey(C);B.setValueForKey(D,C);var E=this.valueForKey(C);if(A===E){return }var F=new DC.ChangeNotification(this,DC.ChangeType.setting,E,A);this.notifyObserversOfCha ngeForKeyPath(F,C)},setValueForKeyPath:function(C,F){if(!this.mutable){return }var B=this.controller.selectedObjects();var A=this.valueForKeyPath(F);B.setValueForKeyPath(C,F);var D=this.valueForKeyPath(F);if(A===D){return }var E=new DC.ChangeNotification(this,DC.ChangeType.setting,D,A);this.notifyObserversOfCha ngeForKeyPath(E,F)}});DC.ObjectController=Class.create(DC.Controller,{constructo r:function(A){this.base(A);this.objectClass=DC.KVO;this.__content=null;this.__ed itable=true;this.__selectedObjects=[];this.__selection=new DC.SelectionProxy(this)},observeChildObjectChangeForKeyPath:function(F,E,B){thi s.base(F,E,B);if("selectedObjects"!==B){return }var C="selection."+E;var D=this.valueForKeyPath(C);var A=new DC.ChangeNotification(this,DC.ChangeType.setting,D,null);this.notifyObserversOf ChangeForKeyPath(A,C)},keyDependencies:{},exposedBindings:["editable","content"] ,editable:function(){var A=this.__editable;if(this.bindings.content){A&=this.bindings.content.mutable()} return A},setEditable:function(A){if(this.bindings.content){A&=this.bindings.content.m utable()}if(this.bindings.editable){this.bingings.editable.setValue(A)}this.__ed itable=A},content:function(){return this.__content},setContent:function(A){if(this.bindings.content){this.bindings. content.setValue(A)}this.__content=A;this.willChangeValueForKey("selectedObjects ");if(!A){this.__selectedObjects=[]}else{this.__selectedObjects=[A]}this.didChan geValueForKey("selectedObjects");this.forceChangeNotificationForKey("selection") },selectedObjects:function(){return this.__selectedObjects},selection:function(){return this.__selection}});DC.AjaxController=Class.create(DC.ObjectController,{flushCo ntentBeforeQuery:false,fetchesInitially:true,constructor:function(A){this.queryD elay=0;this.url="";this.method="GET";this.base(A);if(this.parameters){DC.KVO.ada ptTree(this.parameters)}else{this.parameters=new DC.KVO()}this.addObserverForKeyPath(this,this.queryUpdated,"url");this.addObser verForKeyPath(this,this.queryUpdated,"method")},__postConstruct:function(){this. base();if(this.fetchesInitially&&this.url&&this.url.length&&this.validateParamet ers()){this.forceChangeNotificationForKey("url")}},validateParameters:function() {return true},fullURL:function(){var H={};var E=this.parameters.mutableKeys();var A=E.length;var B=this.url;var D;var G;for(var C=0;C<A;++C){G=E[C];if(this.parameters.hasOwnProperty(G)){H[G]=this.parameters[ G]}}D=Object.

  • Sliding Image Question

    I need to have an image appear slightly above the bottom of my web page and then the user clicks the image the image slides up to reveal all of it, then when the user clicks the image again it slides down.
    I did some searching and found an example here
    1. The "Toggle" example in the link below seems to be the closest to what I want but I need it to slide "up" whereas in the example it slides "down". How can I do this?
    http://labs.adobe.com/technologies/spry/samples/effects/slide_sample.html
    2. Where do I put the toggle code (below) from the above link and how do I make it work with my image. For example how do I get my image to slide up and then remain up until the user clicks the image and it slides down.
    <script type="text/javascript">
    var slide_toggle = new Spry.Effect.Slide('slideItUp2', {toggle:true});
    </script>

    The following may help you
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Spry sidebar</title>
    <style>
    .SprySideBar {
        left:0px;
        position:absolute;
        top:140px;
        text-align:left;
    .SprySideBar a{outline:none;}
    .SprySideBarGroup{
        background-color:#F3F3F3;
        border:1px solid #CCCCCC;
        min-height:100px;
        float:left;
        width:auto;
    .SprySideBarContent {
        display:none;
        height:170px;
        overflow:hidden !important;
        width:200px;
    .SprySideBarMenu h1 {
        color:#000;
        font:bold 110% arial;
        margin:10px;
    .SprySideBarMenu ul {
        margin:0px;
        padding:0px;
    .SprySideBarMenu li {
        list-style-type:none;
        margin:0px 10px 3px;
        padding:2px;
        width:170px;
    .SprySideBarMenu li a:link, .SprySideBarMenu li a:visited {
        color:#000;
        display:block;
        font-family:verdana;
        font-size:100%;
        text-decoration:none;
    .SprySideTab, .SprySideTab a{
        float:left;
        height:100px;
        width:28px;
        display:block;
        border:1px solid #CCCCCC;
        background-color:#F3F3F3;
        margin-left:-1px;
        text-decoration:none;
    </style>
    </head>
    <body>
    <div id="example1" class="SprySideBar">
      <div class="SprySideBarGroup">
        <div class="SprySideBarContent">
          <div class="SprySideBarMenu">
            <h1>SprySideBar</h1>
            <ul>
              <li><a href="#">Link 1</a></li>
              <li><a href="#">Link 2</a></li>
              <li><a href="#">Link 3</a></li>
              <li><a href="#">Link 4</a></li>
              <li><a href="#">Link 5</a></li>
            </ul>  
          </div>
        </div>
      </div>
      <a href="javascript://" id="sideBarTab" class="SprySideTab"><em class="em">>></em></a>
    </div>
    <script src="http://labs.adobe.com/technologies/spry/includes_minified/SpryDOMUtils.js"></script>
    <script src="http://labs.adobe.com/technologies/spry/includes_minified/SpryEffects.js"></script>
    <script>
    Spry.Effect.SideBar = function (element, options)
        //this will return a message if u arent using the effect correct.
        if (!this.notStaticAnimator)
            return Spry.Effect.Utils.showInitError('SideBar');
        //Start up the clustering
        Spry.Effect.Cluster.call(this, options);
        //We are goin to create an inline function go gather the children elements for us.
        var getChildren = function(element){
            //create a array
            var children = [];
            //get the first child
            var child = element.firstChild;
            while (child)
                //its an element node proceed, this is required because FF counts the #text nodes and IE doesn't.
                if (child.nodeType == 1 /* Node.ELEMENT_NODE */){
                    children.push(child);
                    if (child.hasChildNodes())
                     // So, first we check if the object is not empty, if the object has child nodes
                       var kids = child.childNodes;
                       for (var i = 0; i < kids.length; i++)
                            if(kids[i].nodeType == 1 /* Node.ELEMENT_NODE */)
                                children.push(kids[i]);
                child = child.nextSibling;
            return children;
        //Let Spry effect get the element for us so we know its correct
        var element = Spry.Effect.getElement(element);
        var content = getChildren(element);
        var menu = getChildren(content[1]);
        /*    Content layout (4 items)
            0 DIV : SprySideBarGroup
            1 DIV : SprySideBarContent
            2 A      : SprySideTab SprySideTabClosed
            3 EM  :
        /*    Menu layout (4 items)
            0 DIV : SprySideBarMenu
            1 H1
            2 UL
        var doFrom = '0%';
        var doTo = '100%';
        var doDuration = 1000;
        var doToggle = false; //toggle false is required to the correct effect direction
        var doTransition = Spry.fifthTransition; //default
        var isOpenIndc = '>>';
        var isCloseIndc = '<<';
        if (options)
            if (options.duration != null) doDuration = Math.ceil(options.duration/2);
            if (options.toggle != null) doToggle = options.toggle;
            if (options.to != null) doTo = options.to;
            if (options.from != null) doFrom = options.from;
            if (options.transition != null) doTransition = options.transition;
            if (options.openIndc != null) isOpenIndc = options.openIndc;
            if (options.closeIndc != null) isCloseIndc = options.closeIndc;
        //lets make it easy for ourselfs and create one options object for both
        var effectoptions = {duration:doDuration, toggle:doToggle, from:doFrom, to:doTo, transition:doTransition};
        var slide = new Spry.Effect.Squish(content[1],effectoptions);
        var fade = new Spry.Effect.Fade(menu[0],effectoptions);
            //how do we want to run this effect?
        this.addParallelEffect(slide);
        this.addParallelEffect(fade);
        this.addObserver({
            onPreEffect:
            function(effect){
                if (effect.direction == Spry.forwards)
                    content[3].innerHTML = isCloseIndc;
                else
                    content[3].innerHTML = isOpenIndc;
    //create the constructor
    Spry.Effect.SideBar.prototype = new Spry.Effect.Cluster();
    Spry.Effect.SideBar.prototype.constructor = Spry.Effect.SideBar;
    /* create a simple effect, and add the start to the tab, and your done  */
    var sidebar = new Spry.Effect.SideBar('example1',{toggle:true,closeIndc:'<<'});
    Spry.Utils.addLoadListener(function(){
        Spry.Utils.addEventListener("sideBarTab", "click", function(){
                sidebar.start()
         }, false);
    </script>
    </body>
    </html>
    Gramps

  • Creating custom javacript object

    Hi
    I was using Extendcript tool and i tried to declare a custom object to instanciate it like:
    function MyObj()
         this.name = "my name";
    var myVar = new MyObj();
    $.write(myVar.name);
    I was expecting "my name"  in the javascript console, but when i run the script in Extendscript tool the debug always halts saying "MyObj does not have a constructor".
    Well, i'm pretty sure it does have a constructor, because when i try do get it from MyObj.prototype.constructor or when i test this code on a browser, it works fine.
    I tried to set explicitly a constructor to it, but no luck.
    Do someone have an explanation on why it does not recognize the constructor when instanciating a custom object?
    or
    Do someone have a better way to create custom objects in a way that i can use it to check "instanceof"?
    Thanks
    Griebel

    MMmmmmm MY BAD!!!
    in fact.... i was not using the word "MyObj".... i was using the word "Custom"... as "function Custom(){}"
    soooo, i guess "Custom" is a reserved word for Extendscript.
    Now testing my own example, it works fine! hahaha
    any ideia on what "Custom" might be?
    Thank you.

  • Can the Plug-in Compete?

    Why hasn't Java become the dominant technology in RIA development?
    I'm not the first person to ask this question, nor will I be the last. It is unbelievable to me that the company that invented the RIA over a decade ago has made little or no progress in this field and presents absolutely no challenge to inferior technologies that came later. JavaScript was named "Java" script deceptively to give it better visibility in the marketplace, but given its dominance in the RIA market, you'd never believe it.
    I have been developing software for over 25 years now with the majority of my experience in C++ development and object-oriented analysis and design. Wanting to move into the web market, I started doing RIA development a few years ago. I was horrified by the development options available to me and the seemingly infinite amount of hoops I had to jump through to get even the simplest application functionality implemented and working correctly. I had been using Java to do backend work and had really come to like it. To me, the ideal situation would be to use Java to do the client-side work as well as the server-side work. Not only would I be using a real OO programming language, I'd also be using a single technology across the board. The problem was that there really was no nice client-side Java solution available. Swing was just too cumbersome and inflexible and other products had similar drawbacks. What I really wanted was a client-side solution that was as easy to use and just as flexible as HTML/CSS for building a UI, but provided the dynamic and robust programming features of Java. So I quit my full-time job about 18 months ago and started designing a Java-based RIA product called the Galileo RIA Framework.
    One of the many frustrations that I had experienced working with JavaScript was the problem of inconsistent appearance and behavior on different browsers; therefore, when I started designing Galileo one of its primary requirements was that it be able to run on all major browsers on all major platforms and produce a consistent looking UI. Knowing the history of the Java Plug-in, I wasn't sure if it would meet this requirement. Much to my relief, it turned out that the latest Java plug-in (1.5 at the time) worked fine with all the latest and greatest browsers (IE, Firefox, Netscape, Opera, Safari, and Camino) on all of my test machines which included Windows XP and Vista, Mac OS-X, and a few Linux distros. This was great. I figured now all I had to do was focus on developing the actual UI framework and I would have the product I had been longing for and a product that the Java community would be excited about.
    I recently released Galileo as a Beta and while many developers who have looked at the product have admitted that it is an impressive product and that they'd like it to gain much success, they are reluctant to use it because it depends on the Java Plug-in. This has been a major disappointment to say the least. I knew that applets had developed a stigma over the years, but I didn't realize how pronounced the distaste for the plug-in had become. The negativity and skepticism within the Java community itself is so overwhelming that any hope for wide acceptance of the plug-in seems impossible. The funny thing is that all the developers I have talked with would like the plug-in to become widely accepted, but in order for it to become widely accepted, it would have to be used, however, most website developers are hesitant to use it, because, well, it's not widely accepted.
    I want to change this. Not only because the success of my product depends on it, but because I would like more job opportunities to be available to me as a Java programmer as the RIA market continues to grow.
    Why did the Java Plug-in fail in the first place?
    My guess is that there were several major reasons for the failure of the Java Plug-in. One, applets and the plug-in were introduced at a time when most users were limited to dial-up access to the internet. Downloading the plug-in and the applets that used it took too long for a normal user's patience. Two, a Swing UI compared to an HTML website designed by a graphics artist looked terrible. Three, platform and browser compatibility may have been an issue also, but not being involved in Java development back then, I don't know if that was an issue or not. Four, it has been said that installation of the Plug-in was not straightforward and could have been difficult for non-developers. Five, the web was still pretty new itself. The concept of the RIA didn't exist; therefore, there wasn't any pressure for websites to be anymore than straight HTML. Adding technology that complicated implementation, limited potential visitors, and looked bad, just didn't make any sense.
    Can the Java Plug-in compete now?
    I'm optimistic it can for several reasons. One, according to the latest statistics I've read, 86% of U.S. internet users now use broadband. Download times for JAR files and other resources have become negligible. Two, Sun has finally decided to rewrite the plug-in making it easier to detect, download, install, and upgrade. Also most major browsers will prompt the user in a standard way to install the plug-in if a page that requires it is loaded. Three, new operating systems / machines are coming with the Java plug-in already installed. I know both my Windows Vista machines from Dell did, my Mini-Mac from Apple did, and several distros of Linux install the plug-in when the OS is installed. Four, installing a plug-in just isn't a big deal for users anymore. According to a June 2008 survey 99% of internet enabled desktops have already installed the Flash plug-in and 85% have Java installed. Five, standard HTML websites are no longer the standard. To be competitive, websites will have to continue to evolve with RIAs being the latest evolutionary step. Where standard HTML sites with bits and pieces of JavaScript could be developed by graphic artists and other non-developer types, RIAs, because of the complicated implementations, require software developers. Where the major driving force in the web development market used to be graphics artists and non-developer types, as the RIA market grows software developers, many of which are Java developers, will become a greater driving force. This opens up more opportunities for Java. And six, with a framework like Galileo which allows easily customizable UI's that can look as good as any HTML/CSS based UI, aesthetics are no longer an issue for Java UI's.
    I was discussing this issue with Marty Hall of www.coreservlets.com this week and here's what he had to say:
    I would love it if a Java-based solution gained some traction in the RIA world. I spend a lot of time doing Ajax training, and right now, Ajax is tremendously complicated for developers. Developers have to learn xhtml, XML, JSON, JavaScript, Prototype, 37 other JavaScript libraries, and a server-side technology (servlets/JSP, PHP, ROR, or whatever). Even with integrated technologies like GWT or JSON-RPC, there are still an awfully lot of underlying technologies for a developer to master, and the interface is still limited by what current browsers can support."
    I really hope your framework catches on. It would be a good thing. You could build apps that were so much better if you had a real programming language and a single underlying technology.
    The more compelling apps out there that get people to install Java in their browsers the better. And the more powerful but simplified GUI frameworks like yours, the better.
    JavaRiaDev.org
    I believe a window of opportunity has opened to give the Java Plug-in a rare second chance. It appears that Sun believes this too, since they have taken the initiative to redesign the plug-in and to create JavaFx. However, with no disrespect to Sun, if Java developers expect the plug-in to succeed due to Sun's efforts alone, I think they are sadly mistaken. In order for the plug-in to succeed, a concerted effort by the Java community will be necessary. For this reason I have created JavaRiaDev.org. The main initiative of this effort will be to pool developer resources to create RIAs that utilize the Java plug-in and appeal to a broad audience by coming up with new ideas for websites, copying successful website ideas and making them better, and/or trying to forge strategic partnerships with existing websites that already have a substantial user base who are looking to upgrade to RIA technology. The second initiative will be to provide the appropriate resources to help other developers interested in Java RIA development. I, of course, will be pushing Galileo, but will welcome the use of any product that promotes the use of the Java plug-in.
    There will no doubt be skeptics in the Java community who say this is a fool's errand. But for those like me who are not content sitting on the sidelines waiting for others to decide their fate, I say join me and help me in my effort to make Java, if not the dominating, at least a viable option for RIA development. Personally I'd like to have an impact that creates the general opinion that any machine connected to the internet that isn't equipped with the Java plug-in is an inconvenience to the user. If a machine has a modern browser there's no reason for it not to have the plug-in.
    If you are interested in becoming a part of this effort, please email me.
    Thanks,
    M. Warble
    [email protected]

    Some people on the forum claim that you can use an iPhone charger with an iPad, but it will charge slowly enough to the point where the iPad won't show charging status.
    You can use the iPhone with either charger, but that doesn't hold true for the iPad, like Kappy says.

  • IWeb and Quicktime Movie Upload 2013

    Three or so years ago, I made a website using iWeb (the last version Apple produced; i.e. the current version), and I included some videos. The videos were from a digital (tape) video camera, edited with iMovie HD, and were old-format 640x480. I managed to work out how to set the movies to start quickly (before fully loading) using iMovie and QuickTime. I dropped the movie into a regular iWeb page, resized it, put the settings up with the iWeb inspector, and all was well. The movies played (and still play) on Safari and Firefox, on my Macs and on an Asus Windows machine I have. (They won't play on my iPad - if anyone can tell me why, I'd be grateful; I'll probably put the original DV through a more recent version of iMovie and QT, and upload again.)
    I want to make another similar website. However, my camera is now a HD tape model, and I have made my peace with iMovie '11 and worked out how to use it. My machine is the latest Mac Mini, and so QT is the latest also. I run Mountain Lion.
    I made a movie with iMovie '11, and exported a quality version. I opened it in QT and chose 'Export for Web' and selected the option which gives me three different sizes. After some struggles, I worked out how to put this into my uploaded iWeb (test) site (although I have to say that the instructions Apple's QT gives are not the clearest), and it works, even on my iPad.
    My questions concern the code which QT says you should upload. The code in the <body>, I understand, and it's obviously necessary to play the movie.
    But about the <head> tag QT says:
    Please note, to properly validate as XHTML, the <style> tag and the first <script> tag should be placed within your page's <head> tag.
    Here's the code QT says to paste into the <head>
    <script src="scripts/prototype.js" language="JavaScript" type="text/javascript"></script>
    <script src="scripts/qtp_poster.js" language="JavaScript" type="text/javascript"></script>
    <link href="stylesheets/qtp_poster.css" rel="StyleSheet" type="text/css" />
    However, the movie playback still seems to work without uploading the code for the <head> of the page.  And there is NO <style> tag, and why only the FIRST <script> tag?
    The <head> on the page iWeb produces for my test page already has a lot of code:
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="Generator" content="iWeb 3.0.4" />
        <meta name="iWeb-Build" content="local-build-20130116" />
        <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
        <meta name="viewport" content="width=950" />
        <title>Ed's Video Test</title>
        <link rel="stylesheet" type="text/css" media="screen,print" href="Eds_Video_Test_files/Eds_Video_Test.css" />
        <!--[if lt IE 8]><link rel='stylesheet' type='text/css' media='screen,print' href='Eds_Video_Test_files/Eds_Video_TestIE.css'/><![endif]-->
        <!--[if gte IE 8]><link rel='stylesheet' type='text/css' media='screen,print' href='Media/IE8.css'/><![endif]-->
        <style type="text/css">
    /*<![CDATA[*/
        @import "Scripts/Widgets/HTMLRegion/Paste.css";
    /*]]>*/
    </style>
        <script type="text/javascript" src="Scripts/iWebSite.js"></script>
        <script type="text/javascript" src="Scripts/iWebImage.js"></script>
        <script type="text/javascript" src="Scripts/iWebMediaGrid.js"></script>
        <script type="text/javascript" src="Scripts/Widgets/SharedResources/WidgetCommon.js"></script>
        <script type="text/javascript" src="Scripts/Widgets/HTMLRegion/Paste.js"></script>
        <script type="text/javascript" src="Eds_Video_Test_files/Eds_Video_Test.js"></script>
      </head>
    Questions:
    1. Should I put the QT code in the <head> tag anyway, even though it seems to work without it?
    2. If I don't put it in, does that mean the choice between the three movies doesn't take place? I don't have a smartphone, but the playback on my 27" screen, my Asus netbook, and on my iPad all look fine without the head code.
    3. If I do put it in, where exactly do I put it, and do I need to replace any of the code that is already there?
    4. The original iWeb drag and drop method still seems to work fine with movies direct from iMovie (and plays even on my iPad), but obviously you can only put one version of the movie on a page. Is there still a good reason for using the multi-size version which involves manually uploading the movie and opening the page after uploading and inserting code for every movie? For example, I have a very fast internet connection. Maybe it's kind to those with a slower connection to put up the smaller movies also?
    And, since I'm here, I have a couple of slightly related questions:
    5. I designed my site (it's non-commercial, just a trip report, but with a lot of pages) to not need any scrolling even on quite a small desktop screen (you click on from page to page like a book, but you can also navigate around sections more easily this way; anyway that's how I like it). But on the iPad, held horizontally, the width is resized to take up the full width of the sceen, so you then need to scroll down. It's really annoying me. Is there some code I could put in to tell the iPad not to do this (there are plenty fewer vertical pixels on my website's pages than on the iPad screen)? (I don't care about phones, because the site is photo-based so looking at it on a phone is pointless in my opinion. And netbooks with only 768 vertical pixels are not particularly important to me either, but the iPad screen is plenty big enough for the site to work the way I want it to.)
    6. And I want to include slideshows of photos without using the iWeb/iPhoto system (which brings up an external window in a different colour). I want the user to be able to see the thumbnails, to start and stop an on-page slideshow, and for me to be able to put captions (descriptions) with the slides. There seem to be a lot of options, and I still haven't finished looking at all the ones I got from the web. But does anyone have a good recommendation - paid or free?
    Thanks for reading this long thread, and for any advice.

    See the second method described on this page for how to add the code to an HTML Snippet...
    http://www.iwebformusicians.com/Website-Movie-Video/Poster-Movie.html
    The prefered method of playing movies on websites is to use an HTML5 player with flash fallback for older browsers. Using this method, you can get away with only one video file - an MP4.
    In this section of iWeb for Musicians you can see examples of several different types of flash fallback players...
    http://www.iwebformusicians.com/Website-Movie-Video/Poster-Movie.html
    The latest version of flowplayer has all the features that I want in a player and allows several movies on a page by loading only the poster image. It has the added advantage of turning off one player when another is selected...
    http://www.iwebformusicians.com/Website-Movie-Video/Flow-Player-5-2.html
    iWeb uses a fixed width page so it is not possible to use it to create a page that will respond to different browser widths. You need to create a version of your site to suit each type of device or use a responsive design like this...
    http://www.ezmacwebdesign.com/responsive-sidebar/
    As far as slideshows are concerned there are just so many of them. See this section of iWeb for Musicians for examples...
    http://www.iwebformusicians.com/Banner-Slideshow/Slideshow-Showcase.html
    Some more examples using iWeb....
    http://www.iwebformusicians.com/iweb-snippets/gallery.html
    http://www.iwebformusicians.com/iweb-snippets/slider.html
    An example of a dual slideshow with a separate window for the image and the caption...
    http://www.iwebformusicians.com/iweb-snippets/map-tutorial.html
    Finer swiping for mobile devices...
    http://www.iwebformusicians.com/iweb-snippets/swipe.html
    A modern slider that uses no javascript and makes use of the new(ish) CSS transitions...
    http://www.iwebformusicians.com/iweb-snippets/flux.html
    Shadowbox is a very versatile version of the Lightbox style...
    http://ezmacwebdesign.com/Demo/shadowbox/shadowbox.html
    ... and can be used as a standalone or along with jQuery, Mootools etc...
    http://ezmacwebdesign.com/Demo/shadowbox/shadowbox.html

  • Quicktime X exports do not play correctly in Firefox

    Get a movie and export it to 'save for web' option 'Computer. Quicktime X will make a folder on your destkop or movie folder. Now open the index file with firefox. click on the movie to play it.
    BROKEN
    On the other end if you drag the movie to the screen it will play in firefox with the quicktim 7 interface...huh?

    Here is my two cents on this subject.
    1) If you follow the direction here (http://www.creativetechs.com/iq/embediphone_friendly_videos_on_yourwebsite.html) at this website using Quicktime 7 it works just fine after you make the necessary changes to the html(i.e. the correct path to your movie/poster image). But if you follow what is essentially the same steps with Quicktime X (where Export for web is now called saved for web instead) I dont get it to work. One major difference is the code that is generated. The scrip that goes in the <head> section if slightly different as they seem to use different java.
    see below
    <head> script with Quick7
    <script src="http://www.apple.com/library/quicktime/scripts/ac_quicktime.js" language="JavaScript" type="text/javascript"></script>
    <script src="http://www.apple.com/library/quicktime/scripts/qtp_library.js" language="JavaScript" type="text/javascript"></script>
    <link href="http://www.apple.com/library/quicktime/stylesheets/qtp_library.css" rel="StyleSheet" type="text/css" />
    <head> script with Quick X
    <script src="http://www.apple.com/library/quicktime/2.0/scripts/prototype.js" language="JavaScript" type="text/javascript"></script>
    <script src="http://www.apple.com/library/quicktime/2.0/scripts/qtp_poster.js" language="JavaScript" type="text/javascript"></script>
    <link href="http://www.apple.com/library/quicktime/2.0/stylesheets/qtp_poster.css" rel="StyleSheet" type="text/css" />
    The other major difference is the <body> code that is generated between the two versions. See below
    Quick7
    <script type="text/javascript"><!--
    QTWritePosterXHTML('Click to Play', 'Amusing-poster.jpg',
    'Amusing.mov',
    '455', '357', '',
    'controller', 'true',
    'autoplay', 'true',
    'bgcolor', 'black',
    'scale', 'aspect');
    //-->
    </script>
    <noscript>
    <object width="455" height="357" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab">
    <param name="src" value="Amusing-poster.jpg" />
    <param name="href" value="Amusing.mov" />
    <param name="target" value="myself" />
    <param name="controller" value="false" />
    <param name="autoplay" value="false" />
    <param name="scale" value="aspect" />
    <embed width="455" height="357" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"
    src="Amusing-poster.jpg"
    href="Amusing.mov"
    target="myself"
    controller="false"
    autoplay="false"
    scale="aspect">
    </embed>
    </object>
    </noscript>
    Quick X
    Now I'm more of designer than a coder, but even I see the huge difference between the two. With Quick X the body code is way less and is a link.
    This would be cool if it worked perfectly, as less code is good with me, but it doesn't. It wont play in Firefox. It works for the most browsers, especially safari.
    When I tried to get to work in Firefox locally on my Mac, I was able to make it play after correcting the html, but it would open in a new page and center the movie all by itself. Not exactly the results I wanted.
    Does anyone have a solution to this problem.
    The new interface with Quick7 looks slick and I would like to use it,but not if its going to be this broken.

Maybe you are looking for

  • Difference between VAT AND EXCISE DUTIES

    HI ginius can any body give the difference between vat and excise duties

  • Code is not working check for solution . The code is not working after look up table.

    In this code i am multiplying two binary images , one is a rectangle and another is an image. i am getting the rectangle, but not the image. The image part is not working after the look up table. Waiting for the solution Attachments: binary morpholog

  • How to compare New and Old long text at PO Line Item

    Hi all, I am Using user exit "EXIT_SAPMM06E_013". In user exit i am trying to compare the old and new values of PO maintain at item level. All this values, i am getting in X and Y structures in user exit For long text there is no Such structures. Whe

  • Set up new Air

    What is the best (fastest?) way to transfer everything from a MacBook Pro to a new MacBook Air? Using Migration Assistant it is telling me it will take 72 hours!!

  • Black and white Photo to Spot Pantone

    hi guys, 1) I have a black and white image, the client wants to print just with one ink, Pantone 425, which is 77% black. Which is the best way to remove the black from the image an replace it with a spot color? 2) Another question, i might have the