﻿// Copyright (c) 2009 Language Analytics LLC //
// Build 4276 //
var s_undoText="",s_typedCount=0,s_clip,s_copyMessageTimeout;function noYamli(){return typeof Yamli!="object"||!Yamli.isSupported()
}function getQuery(){var b=[],a=location.hash.substring(1);if(a.length===0){return b
}a=a.replace(/\+/g," ");var d=a.split("&"),c;for(c=0;c<d.length;++c){var g=d[c].split("="),e=decodeURIComponent(g[0]),f=e;
if(g.length==2){f=decodeURIComponent(g[1])}b[e]=f}return b}function resetControls(){var e=document.getElementById("editor"),g=document.getElementById("align_left_link"),a=document.getElementById("align_left_active"),b=document.getElementById("align_right_link"),f=document.getElementById("align_right_active"),d=document.getElementById("enable_link"),c=document.getElementById("disable_link");
if(e.yamliManager.getDirection()=="rtl"){g.style.display="inline";a.style.display="none";
b.style.display="none";f.style.display="inline"}else{g.style.display="none";a.style.display="inline";
b.style.display="inline";f.style.display="none"}if(e.yamliManager.getEnabled()){d.style.display="none";
c.style.display="inline"}else{d.style.display="inline";c.style.display="none"}e.yamliManager.resetLayout();
e.focus()}function alignLeft(){if(noYamli()){return}var a=document.getElementById("editor");
a.yamliManager.setDirection("ltr");document.getElementById("text_direction").value="ltr";
resetControls()}function alignRight(){if(noYamli()){return}var a=document.getElementById("editor");
a.yamliManager.setDirection("rtl");document.getElementById("text_direction").value="rtl";
resetControls()}function enableYamli(){if(noYamli()){return}var a=document.getElementById("editor");
a.yamliManager.setEnabled(true);resetControls()}function disableYamli(){if(noYamli()){return
}var a=document.getElementById("editor");a.yamliManager.setEnabled(false);resetControls()
}function showTips(a){if(noYamli()){return}var b=document.getElementById("show_tips_link");
var d=document.getElementById("hide_tips_link");var c=document.getElementById("div_tips");
if(a){b.style.display="none";d.style.display="inline";c.style.display="block"}else{b.style.display="inline";
d.style.display="none";c.style.display="none"}}function prepCopy(){s_clip.setText(document.getElementById("editor").value)
}function copyToClipboard(){if(window.clipboardData&&navigator.userAgent.toLowerCase().indexOf("msie 6.0")!=-1){window.clipboardData.setData("Text",document.getElementById("editor").value)
}}function hideCopyMessage(){s_copyMessageTimeout=undefined;document.getElementById("copy_message").style.display="none"
}function showCopyMessage(){document.getElementById("copy_message").style.display="inline";
if(s_copyMessageTimeout){clearTimeout(s_copyMessageTimeout)}s_copyMessageTimeout=setTimeout(hideCopyMessage,3000)
}function showClearMessage(){document.getElementById("clear_message").style.display="inline"
}function hideClearMessage(){document.getElementById("clear_message").style.display="none"
}function hideMessages(){hideCopyMessage();hideClearMessage()}function showMsInstructions(){if(navigator.userAgent.toLowerCase().indexOf("windows")>-1){document.getElementById("ms_instructions").style.visibility="visible"
}}var flashCount,flashInterval;function onFlash(){if(flashCount>8){$("#ms_instructions").removeClass("flash");
clearInterval(flashInterval);flashInterval=0;return}$("#ms_instructions").toggleClass("flash");
++flashCount}function flashMsInstructions(){if(navigator.userAgent.toLowerCase().indexOf("windows")>-1){flashCount=0;
clearInterval(flashInterval);flashInterval=setInterval(onFlash,200)}}function doCopy(){if(noYamli()||document.getElementById("copy_link").disabled){return
}hideMessages();copyToClipboard();showCopyMessage();flashMsInstructions();if(typeof _gat=="object"){pageTracker._trackPageview("/editor/doCopy")
}}function doClear(){if(noYamli()||document.getElementById("clear_link").disabled){return
}hideMessages();var a=document.getElementById("editor");s_undoText=a.value;a.value="";
showClearMessage();if(typeof _gat=="object"){pageTracker._trackPageview("/editor/doClear")
}}function undoClear(){var a=document.getElementById("editor");a.value=s_undoText;
hideClearMessage()}function hideInst(){document.getElementById("div_inst").style.display="none";
document.getElementById("div_tips_box").style.display="block";Yamli.I.setCookie("hide_inst",1,1825)
}function heartBeat(){if(typeof _gat=="object"){pageTracker._trackPageview("/editor/evHeatBeat")
}}function onKeyUp(){hideMessages();++s_typedCount;var a=document.getElementById("editor");
if(s_typedCount>25||a.value.split(" ").length>5){hideInst();Yamli.I.removeEvent(a,"keyup",onKeyUp)
}if(s_typedCount==3){if(typeof _gat=="object"){pageTracker._trackPageview("/editor/evTyped")
}setInterval(heartBeat,20000)}}function doPrint(){if(noYamli()||document.getElementById("print_link").disabled){return
}hideMessages();var a=document.getElementById("editor_form");a.action="/editor/print.aspx";
a.submit();if(typeof _gat=="object"){pageTracker._trackPageview("/editor/doPrint")
}}function doSave(){if(noYamli()||document.getElementById("save_link").disabled){return
}hideMessages();var a=document.getElementById("editor_form");a.action="/editor/save.ashx";
a.submit();if(typeof _gat=="object"){pageTracker._trackPageview("/editor/doSave")
}}function onCheckin(){var a=document.getElementById("editor");Yamli.I.addEvent(a,"keydown",hideMessages);
Yamli.I.addEvent(a,"keyup",onKeyUp);Yamli.I.addEvent(a,"change",hideMessages);resetControls();
document.getElementById("div_controls").style.display="block";document.getElementById("save_link").disabled=false;
document.getElementById("print_link").disabled=false;document.getElementById("copy_link").disabled=false;
document.getElementById("clear_link").disabled=false;var b=getQuery().text;if(b&&b.length>0){a.value=b;
a.yamliManager.setSelection(b.length,b.length)}ZeroClipboard.setMoviePath("/js/ZeroClipboard.swf");
s_clip=new ZeroClipboard.Client();s_clip.setCSSEffects(true);s_clip.addEventListener("mouseOver",prepCopy);
s_clip.addEventListener("mouseDown",doCopy);Yamli.I.addEvent(window,"resize",function(){s_clip.reposition()
});s_clip.glue("copy_link");showMsInstructions();Yamli.I.addEvent(document.getElementById("editor"),"copy",flashMsInstructions)
};
