var ns4 = document.layers;
var op5 = (navigator.userAgent.indexOf("Opera 5") != -1)
	|| (navigator.userAgent.indexOf("Opera/5") != -1);
var op6 = (navigator.userAgent.indexOf("Opera 6") != -1)
	|| (navigator.userAgent.indexOf("Opera/6") != -1);
var mouseX = 0;
var mouseY = 0;
function _get$() {
    var elements = new Array();
    for (var i = 0; i < arguments.length; i++) {
        var element = arguments[i];
        if (typeof element == 'string')
            element = document.getElementById(element);

        if (arguments.length == 1)
            return element;

        elements.push(element);
    }
}

function GetScrollTop() {
    var pos = 0;
    if (window.pageYOffset) {
        pos = window.pageYOffset;
    }
    else if (document.documentElement && document.documentElement.scrollTop) {
        pos = document.documentElement.scrollTop;
    }
    else if (document.body) {
        pos = document.body.scrollTop;
    }
    return pos;
}

function GetScrollLeft() {
    var pos = 0;
    if (window.pageXOffset) {
        pos = window.pageXOffset;
    }
    else if (document.documentElement && document.documentElement.scrollLeft) {
        pos = document.documentElement.scrollLeft;
    }
    else if (document.body) {
        pos = document.body.scrollLeft;
    }
    return pos;
}

function GetHeight(elem) {
    if (ns4) {
        xPos = elem.clip.height;
    }
    else if (op5) {
        xPos = elem.style.pixelHeight;
    }
    else {
        xPos = elem.offsetHeight;
    }
    return xPos;
}

function GetWidth(elem) {
    if (ns4) {
        xPos = elem.clip.width;
    }
    else if (op5) {
        xPos = elem.style.pixelWidth;
    }
    else {
        xPos = elem.offsetWidth;
    }
    return xPos;
}

function getMousePos(e)
{
    if (!e)
        var e = window.event || window.Event;

    if (typeof e.pageX != 'undefined')
    {
        mouseX = e.pageX;
        mouseY = e.pageY;
    } else
    {
        if (document.body)
        {
            mouseX = e.clientX + GetScrollLeft();
            mouseY = e.clientY + GetScrollTop();
        }
    }
}
if (!window.Silverlight)
{
    window.Silverlight = { };
}

// Silverlight control instance counter for memory mgt
Silverlight._silverlightCount = 0;
Silverlight.fwlinkRoot='http://go2.microsoft.com/fwlink/?LinkID=';  
Silverlight.onGetSilverlight = null;
Silverlight.onSilverlightInstalled = function () {window.location.reload(false);};

//////////////////////////////////////////////////////////////////
// isInstalled, checks to see if the correct version is installed
//////////////////////////////////////////////////////////////////
Silverlight.isInstalled = function(version)
{
    var isVersionSupported=false;
    var container = null;
    
    try 
    {
        var control = null;
        
        try
        {
            control = new ActiveXObject('AgControl.AgControl');
            if ( version == null )
            {
                isVersionSupported = true;
            }
            else if ( control.IsVersionSupported(version) )
            {
                isVersionSupported = true;
            }
            control = null;
        }
        catch (e)
        {
            var plugin = navigator.plugins["Silverlight Plug-In"] ;
            if ( plugin )
            {
                if ( version === null )
                {
                    isVersionSupported = true;
                }
                else
                {
                    var actualVer = plugin.description;
                    if ( actualVer === "1.0.30226.2")
                        actualVer = "2.0.30226.2";
                    var actualVerArray =actualVer.split(".");
                    while ( actualVerArray.length > 3)
                    {
                        actualVerArray.pop();
                    }
                    while ( actualVerArray.length < 4)
                    {
                        actualVerArray.push(0);
                    }
                    var reqVerArray = version.split(".");
                    while ( reqVerArray.length > 4)
                    {
                        reqVerArray.pop();
                    }
                    
                    var requiredVersionPart ;
                    var actualVersionPart
                    var index = 0;
                    
                    
                    do
                    {
                        requiredVersionPart = parseInt(reqVerArray[index]);
                        actualVersionPart = parseInt(actualVerArray[index]);
                        index++;
                    }
                    while (index < reqVerArray.length && requiredVersionPart === actualVersionPart);
                    
                    if ( requiredVersionPart <= actualVersionPart && !isNaN(requiredVersionPart) )
                    {
                        isVersionSupported = true;
                    }
                }
            }
        }
    }
    catch (e) 
    {
        isVersionSupported = false;
    }
    if (container) 
    {
        document.body.removeChild(container);
    }
    
    return isVersionSupported;
}
Silverlight.WaitForInstallCompletion = function()
{
    if ( ! Silverlight.isBrowserRestartRequired && Silverlight.onSilverlightInstalled )
    {
        try
        {
            navigator.plugins.refresh();
        }
        catch(e)
        {
        }
        if ( Silverlight.isInstalled(null) )
        {
            Silverlight.onSilverlightInstalled();
        }
        else
        {
              setTimeout(Silverlight.WaitForInstallCompletion, 3000);
        }    
    }
}
Silverlight.__startup = function()
{
    Silverlight.isBrowserRestartRequired = Silverlight.isInstalled(null);//(!window.ActiveXObject || Silverlight.isInstalled(null));
    if ( !Silverlight.isBrowserRestartRequired)
    {
        Silverlight.WaitForInstallCompletion();
    }
    if (window.removeEventListener) { 
       window.removeEventListener('load', Silverlight.__startup , false);
    }
    else { 
        window.detachEvent('onload', Silverlight.__startup );
    }
}

if (window.addEventListener) 
{
    window.addEventListener('load', Silverlight.__startup , false);
}
else 
{
    window.attachEvent('onload', Silverlight.__startup );
}

///////////////////////////////////////////////////////////////////////////////
// createObject();  Params:
// parentElement of type Element, the parent element of the Silverlight Control
// source of type String
// id of type string
// properties of type String, object literal notation { name:value, name:value, name:value},
//     current properties are: width, height, background, framerate, isWindowless, enableHtmlAccess, inplaceInstallPrompt:  all are of type string
// events of type String, object literal notation { name:value, name:value, name:value},
//     current events are onLoad onError, both are type string
// initParams of type Object or object literal notation { name:value, name:value, name:value}
// userContext of type Object
/////////////////////////////////////////////////////////////////////////////////

Silverlight.createObject = function(source, parentElement, id, 
properties, events, initParams, userContext, altHtml)
{
    var slPluginHelper = new Object();
    var slProperties = properties;
    var slEvents = events;
    
    slPluginHelper.version = slProperties.version;
    slProperties.source = source;    
    slPluginHelper.alt = slProperties.alt;
    
    //rename properties to their tag property names
    if ( initParams )
        slProperties.initParams = initParams;
    if ( slProperties.isWindowless && !slProperties.windowless)
        slProperties.windowless = slProperties.isWindowless;
    if ( slProperties.framerate && !slProperties.maxFramerate)
        slProperties.maxFramerate = slProperties.framerate;
    if ( id && !slProperties.id)
        slProperties.id = id;
    
    // remove elements which are not to be added to the instantiation tag
    delete slProperties.ignoreBrowserVer;
    delete slProperties.inplaceInstallPrompt;
    delete slProperties.version;
    delete slProperties.isWindowless;
    delete slProperties.framerate;
    delete slProperties.data;
    delete slProperties.src;
    delete slProperties.alt;


    // detect that the correct version of Silverlight is installed, else display install

    if (Silverlight.isInstalled(slPluginHelper.version))
    {
        //move unknown events to the slProperties array
        for (var name in slEvents)
        {
            if ( slEvents[name])
            {
                if ( name == "onLoad" && typeof slEvents[name] == "function" && slEvents[name].length != 1 )
                {
                    var onLoadHandler = slEvents[name];
                    slEvents[name]=function (sender){ return onLoadHandler(document.getElementById(id), userContext, sender)};
                }
                var handlerName = Silverlight.__getHandlerName(slEvents[name]);
                if ( handlerName != null )
                {
                    slProperties[name] = handlerName;
                    slEvents[name] = null;
                }
                else
                {
                    throw "typeof events."+name+" must be 'function' or 'string'";
                }
            }
        }
        slPluginHTML = Silverlight.buildHTML(slProperties);
    }
    //The control could not be instantiated. Show the installation prompt
    else 
    {
        slPluginHTML = altHtml;//+Silverlight.buildPromptHTML(slPluginHelper);
    }

    // insert or return the HTML
    if(parentElement)
    {
        parentElement.innerHTML = slPluginHTML;
    }
    else
    {
        return slPluginHTML;
    }

}

///////////////////////////////////////////////////////////////////////////////
//
//  create HTML that instantiates the control
//
///////////////////////////////////////////////////////////////////////////////
Silverlight.buildHTML = function( slProperties)
{
    var htmlBuilder = [];

    htmlBuilder.push('<object type=\"application/x-silverlight\" data="data:application/x-silverlight,"');
    if ( slProperties.id != null )
    {
        htmlBuilder.push(' id="' + slProperties.id + '"');
    }
    if ( slProperties.width != null )
    {
        htmlBuilder.push(' width="' + slProperties.width+ '"');
    }
    if ( slProperties.height != null )
    {
        htmlBuilder.push(' height="' + slProperties.height + '"');
    }
    htmlBuilder.push(' >');
    
    delete slProperties.id;
    delete slProperties.width;
    delete slProperties.height;
    
    for (var name in slProperties)
    {
        if (slProperties[name])
        {
            htmlBuilder.push('<param name="'+Silverlight.HtmlAttributeEncode(name)+'" value="'+Silverlight.HtmlAttributeEncode(slProperties[name])+'" />');
        }
    }
    htmlBuilder.push('<\/object>');
    return htmlBuilder.join('');
}




// createObjectEx, takes a single parameter of all createObject parameters enclosed in {}
Silverlight.createObjectEx = function(params)
{
    var parameters = params;
    var html = Silverlight.createObject(parameters.source, parameters.parentElement, parameters.id, parameters.properties, parameters.events, parameters.initParams, parameters.context);
    if (parameters.parentElement == null)
    {
        return html;
    }
}

///////////////////////////////////////////////////////////////////////////////////////////////
// Builds the HTML to prompt the user to download and install Silverlight
///////////////////////////////////////////////////////////////////////////////////////////////
Silverlight.buildPromptHTML = function(slPluginHelper)
{
    var slPluginHTML = "";
    var urlRoot = Silverlight.fwlinkRoot;
    var shortVer = slPluginHelper.version ;
    if ( slPluginHelper.alt )
    {
        slPluginHTML = slPluginHelper.alt;
    }
    else
    {
        if (! shortVer )
        {
            shortVer="";
        }
        slPluginHTML = "<a href='javascript:Silverlight.getSilverlight(\"{1}\");' style='text-decoration: none; color: #555555; font-size: 10px;'>Enhanced View Not Shown</a>";
        slPluginHTML = slPluginHTML.replace('{1}', shortVer );
        slPluginHTML = slPluginHTML.replace('{2}', urlRoot + '108181');
    }
    
    return slPluginHTML;
}


Silverlight.getSilverlight = function(version)
{
    if (Silverlight.onGetSilverlight )
    {
        Silverlight.onGetSilverlight();
    }
    
    var shortVer = "";
    var reqVerArray = String(version).split(".");
    if (reqVerArray.length > 1)
    {
        var majorNum = parseInt(reqVerArray[0] );
        if ( isNaN(majorNum) || majorNum < 2 )
        {
            shortVer = "1.0";
        }
        else
        {
            shortVer = reqVerArray[0]+'.'+reqVerArray[1];
        }
    }
    
    var verArg = "";
    
    if (shortVer.match(/^\d+\056\d+$/) )
    {
        verArg = "&v="+shortVer;
    }
    
    Silverlight.followFWLink("114576" + verArg);
}


///////////////////////////////////////////////////////////////////////////////////////////////
/// Navigates to a url based on fwlinkid
///////////////////////////////////////////////////////////////////////////////////////////////
Silverlight.followFWLink = function(linkid)
{
    top.location=Silverlight.fwlinkRoot+String(linkid);
}












///////////////////////////////////////////////////////////////////////////////////////////////
/// Encodes special characters in input strings as charcodes
///////////////////////////////////////////////////////////////////////////////////////////////
Silverlight.HtmlAttributeEncode = function( strInput )
{
      var c;
      var retVal = '';

    if(strInput == null)
      {
          return null;
    }
      
      for(var cnt = 0; cnt < strInput.length; cnt++)
      {
            c = strInput.charCodeAt(cnt);

            if (( ( c > 96 ) && ( c < 123 ) ) ||
                  ( ( c > 64 ) && ( c < 91 ) ) ||
                  ( ( c > 43 ) && ( c < 58 ) && (c!=47)) ||
                  ( c == 95 ))
            {
                  retVal = retVal + String.fromCharCode(c);
            }
            else
            {
                  retVal = retVal + '&#' + c + ';';
            }
      }
      
      return retVal;
}
///////////////////////////////////////////////////////////////////////////////
//
//  Default error handling function to be used when a custom error handler is
//  not present
//
///////////////////////////////////////////////////////////////////////////////

Silverlight.default_error_handler = function (sender, args)
{
    var iErrorCode;
    var errorType = args.ErrorType;

    iErrorCode = args.ErrorCode;

    var errMsg = "\nSilverlight error message     \n" ;

    errMsg += "ErrorCode: "+ iErrorCode + "\n";


    errMsg += "ErrorType: " + errorType + "       \n";
    errMsg += "Message: " + args.ErrorMessage + "     \n";

    if (errorType == "ParserError")
    {
        errMsg += "XamlFile: " + args.xamlFile + "     \n";
        errMsg += "Line: " + args.lineNumber + "     \n";
        errMsg += "Position: " + args.charPosition + "     \n";
    }
    else if (errorType == "RuntimeError")
    {
        if (args.lineNumber != 0)
        {
            errMsg += "Line: " + args.lineNumber + "     \n";
            errMsg += "Position: " +  args.charPosition + "     \n";
        }
        errMsg += "MethodName: " + args.methodName + "     \n";
    }
    alert (errMsg);
}

///////////////////////////////////////////////////////////////////////////////////////////////
/// Releases event handler resources when the page is unloaded
///////////////////////////////////////////////////////////////////////////////////////////////
Silverlight.__cleanup = function ()
{
    for (var i = Silverlight._silverlightCount - 1; i >= 0; i--) {
        window['__slEvent' + i] = null;
    }
    Silverlight._silverlightCount = 0;
    if (window.removeEventListener) { 
       window.removeEventListener('unload', Silverlight.__cleanup , false);
    }
    else { 
        window.detachEvent('onunload', Silverlight.__cleanup );
    }
}
///////////////////////////////////////////////////////////////////////////////////////////////
/// Releases event handler resources when the page is unloaded
///////////////////////////////////////////////////////////////////////////////////////////////
Silverlight.__getHandlerName = function (handler)
{
    var handlerName = "";
    if ( typeof handler == "string")
    {
        handlerName = handler;
    }
    else if ( typeof handler == "function" )
    {
        if (Silverlight._silverlightCount == 0)
        {
            if (window.addEventListener) 
            {
                window.addEventListener('onunload', Silverlight.__cleanup , false);
            }
            else 
            {
                window.attachEvent('onunload', Silverlight.__cleanup );
            }
        }
        var count = Silverlight._silverlightCount++;
        handlerName = "__slEvent"+count;
        
        window[handlerName]=handler;
    }
    else
    {
        handlerName = null;
    }
    return handlerName;
}

if (document.attachEvent)
{
    document.attachEvent("onmousemove", function() { getMousePos(event); });
}
else
{
    window.addEventListener("mousemove", function(e) { getMousePos(e); }, false);
}

var maxSteps = 10;
var TogStartX = 0;
var TogStartY = 0; 
function __Toggle(id, w, h,  left, top) {

    var newView = _get$(id).style.display == "none" ? "block" : "none";
  
    TogStartX = mouseX;
    TogStartY = mouseY;

    if (_get$(id + "_state"))
        _get$(id + "_state").value = newView == "block" ? "1" : "0";

    var originalPosition = _get$(id).style.position;
    _get$(id).style.overflow = "hidden";

    if (newView == "block") {
        _get$(id).style.height = "0px";
        _get$(id).style.display = "block";
        OnAnimTimer(id, 0, newView, w, h, top, left, originalPosition);

    }
    else {

        _get$(id).style.display = "block";
        OnAnimTimer(id, 0, newView, w, h, top, left, originalPosition);
    }
}

function OnAnimTimer(id, step, view, w, h, top, left, originalPosition) {

    if (!_get$(id))
        return;
    
    var Wend = view == "block" ? w : 1;
    var Wstart = view == "block" ? 1 : w;
    var width = EaseInOut(Wstart, Wend, maxSteps, step, 1);

    var Hend = view == "block" ? h : 1;
    var Hstart = view == "block" ? 1 : h;
    var height = EaseInOut(Hstart, Hend, maxSteps, step, 1);

    var Lend = view == "block" ? left : left+w+100;
    var Lstart = view == "block" ? TogStartX : left;
    var fleft = EaseInOut(Lstart, Lend, maxSteps, step, 1);

    var Tend = view == "block" ? top : TogStartY;
    var Tstart = view == "block" ? TogStartY : top;
    var ftop = EaseInOut(Tstart, Tend, maxSteps, step, 1);
    
    if (step == maxSteps) {
        if (view == "block") {
            //_get$(id).style.height = null;
            _get$(id).style.height = h + 'px';
            _get$(id).style.width = w + 'px';
            _get$(id).style.left = left + 'px';
            _get$(id).style.top = top + 'px';
        }
        else {
            _get$(id).style.display = 'none';
        }
        _get$(id).style.position = originalPosition;
    }
    else {
        _get$(id).style.height = height + 'px';
        _get$(id).style.width = width + 'px';
        _get$(id).style.left = fleft + 'px';
        _get$(id).style.top = ftop + 'px';
        setTimeout("OnAnimTimer('" + id + "', " + (step + 1).toString() + ", '" + view + "', " + w + ", " + h + ", " + top + ", " + left + ", '" + originalPosition + "');", 10);
    }
}

function EaseInOut(minValue, maxValue, totalSteps, actualStep, powr) {
    //Generic Animation Step Value Generator By www.hesido.com
    totalSteps = Math.max(totalSteps, 1)
    var delta = maxValue - minValue;
    var stepp = minValue + (Math.pow(((1 / totalSteps) * actualStep), powr) * delta);
    return Math.ceil(stepp)
}
function KillBox(id) {
    if (_get$(id))
        _get$(id).style.display='none';
                
    if (_get$("FlyBg"))
        document.body.removeChild(_get$("FlyBg"));
}
function FlyBox(id, w, h, pos, bg, opacity) {

    var bg = document.createElement("div");
    bg.id = "FlyBg"
   
    bg.style.zIndex = 100;
    bg.style.backgroundColor = '#000000';
    bg.style.opacity = opacity;
    bg.style.width = GetWidth(document.body)+"px";
    bg.style.height = GetHeight(document.body) + "px";
    bg.style.top = "0px";
    bg.style.left = "0px";
    // bg.style.display = 'none';
    if (document.all) {
        document.body.insertAdjacentElement("afterBegin", bg);
        bg.style.position = "absolute";
    }
    else {
        bg.style.position = "fixed";
        document.body.appendChild(bg);
    }
   // __Toggle("FlyBg");

    var div = _get$(id);
    div.style.display = 'none';
    div.style.zIndex = 1001;
    div.style.position = 'absolute';
    div.style.width = "0px";
    div.style.height = "0px";
    __Toggle(id, w, h, ((GetWidth(document.body) / 2) - (w / 2)),
                ((GetHeight(document.body) / 2) - (h / 2)));
}

function CollectFormData()
{
    var s = "";
    var keys = new Array();
    var values = new Array();

    for (var i = 0; i < document.forms[0].elements.length; i++)
    {
        var el = document.forms[0].elements[i];
       
        if ((el.tagName == 'INPUT'
            || el.tagName == 'SELECT' || el.tagName == 'TEXTAREA')
            && el.name
            && el.name != '__VIEWSTATE')
        {
            if ((el.type == 'radio' || el.type == 'checkbox') && !el.checked)
                continue;

            var idx = -1;
            var thisName = el.name.toLowerCase();
            for (var x = 0; x < keys.length; x++)
            {
                if (keys[x] == thisName)
                {
                    idx = x;
                    break;
                }
            }

            if (idx == -1)
            {
                keys.push(thisName);
                values.push(el.value);
                idx = keys.length - 1;
            }
            else
                values[idx] += "," + el.value;

        }
    }
    for (var i = 0; i < keys.length; i++)
    {
        if (s)
            s += "&";
        s += keys[i] + '=' + URLEncode( values[i] );
    }
    //alert(s);
    return s;
}
function OnEnterKeyDown(event, command) {
    if (event.keyCode == 13) {
        if (command)
            eval(command);
        if (!document.all)
            event.preventDefault();
        else
            event.returnValue = false;
    }

}


var _StickyPresent;
var _StickyFormIntro;
var _StickyFormTitle;
var _StickyPercent;
var _StickyComparison;
var _StickyColour;
function GetStickyPresent() { return _StickyPresent; }
function GetStickyFormIntro() { return _StickyFormIntro; }
function GetStickyFormTitle() { return _StickyFormTitle; }
function GetStickyPercent() { return _StickyPercent; }
function GetStickyComparison() { return _StickyComparison; }
function GetStickyColour() { return _StickyColour; }

function MakeSticky(title, percent, comparison, form_introduction, colour)
{
	return;

    _StickyPresent = true;
    _StickyPercent = percent;
    _StickyFormTitle = title;
    _StickyComparison = comparison;
    _StickyFormIntro = form_introduction;
    _StickyColour = colour;
    if (!_StickyColour)
        _StickyColour = "Yellow";

    var alternative = "<div style='text-align:center;position: absolute; width: 225px;'><a href='javascript:Silverlight.getSilverlight(\"2.0.31005.0\");' style='text-decoration: none; color: #555555; font-size: 10px;' title='Click to install Silverlight 2.0 plugin'>Enhanced View Not Shown</a></div><a href=\"javascript:OpenStickyForm();\"><img src=\"http://ylf.com.au/ylf.asmx/GetSticky?t=" + URLEncode(title) + "&b=" + URLEncode(percent) + "&i=" + URLEncode(comparison) + "&c=" + URLEncode(_StickyColour) + "\" /></a>";
    
    Silverlight.createObject("http://ylf.com.au/xap/SilverlightApplication2.xap",        // source
                document.getElementById('silverlightControlHost'),                              // parentElement   
                "slPlugin",                                                                     // id for generated object element
                { width: "250", height: "185", background: "#00FFFFFF", windowless: "true", version: "2.0.31005.0", enableHtmlAccess:"true" }, // properties
                {},                                                                             // events
                "",                                                       // initParameters
                "context",
                alternative                                                                       // context helper for onLoad handler.  
            );
    var StickyForm = document.createElement("span");
    StickyForm.setAttribute('id', "StickyForm");
    document.forms[0].appendChild(StickyForm);
}
function CreateStickyElements()
{
    var s = "";
    s += "<div style=\"position:absolute; width:25px; height:270px;\">";
   // s += "<a href=\"javascript:OpenStickyForm();\"><img src=\"http://ylf.com.au/ylf.asmx/GetSticky?w=180&h=160&t="+URLEncode(title)+"&b="+URLEncode(percent.toString())+"&i="+URLEncode(comparison)+"\" /></a>";
   s += "<object data=\"data:application/x-silverlight,\" type=\"application/x-silverlight-2\" width=\"250\" height=\"270\">";
    s += "			<param name=\"source\" value=\"/xap/SilverlightApplication2.xap\"/>";
    s += "		<param name=\"onerror\" value=\"onSilverlightError\" />";
    s += "	<param name=\"background\" value=\"#00FFFFFF\" />";
    s += "<param name=\"minRuntimeVersion\" value=\"2.0.31005.0\" />";
    s += "<param name=\"autoUpgrade\" value=\"true\" />";
    s += "<param name=\"windowless\" value=\"true\" />";
    s += "		<a href=\"http://go.microsoft.com/fwlink/?LinkID=124807\" style=\"text-decoration: none;\">";
    s += "		<img src=\"http://go.microsoft.com/fwlink/?LinkId=108181\" alt=\"Get Microsoft Silverlight\" style=\"border-style: none\"/>";
    s += "</a>";
    s += "</object>";
		
    s += "</div>";//<span id='StickyForm'></span>
    
    document.write(s);
    var StickyForm = document.createElement("span");
    StickyForm.setAttribute('id', "StickyForm");
    document.forms[0].appendChild(StickyForm);
}

function OpenStickyForm()
{
    _get$('StickyForm').innerHTML = "<div id=\"StickyFormWindow\" style=\"position: absolute; display:none; background: #F5EAAC; color:#2B2C50; padding: 20px;\"></div>";
    FetchAsync("/a/JSFormCallback", "", OnJSFormCallback);
     
}
function StickySubmit()
{
     FetchAsync("/a/JSFormCallback", CollectFormData(), OnJSFormCallback2);
}
function OnJSFormCallback2(html)
{
    _get$('StickyFormWindow').innerHTML = "<a href=\"javascript:;\" onclick=\"KillBox('StickyFormWindow')\" style=\"float:right;color:#2B2C50;font-weight: bold;\">Close</a><h1 style=\"font-family: 'Trebuchet MS'; font-size: 30px;\">"+_StickyFormTitle+"</h1><center>"+html+"</center>";
}
function OnJSFormCallback(html)
{
    _get$('StickyFormWindow').innerHTML = "<a href=\"javascript:;\" onclick=\"KillBox('StickyFormWindow')\" style=\"float:right;color:#2B2C50;font-weight: bold;\">Close</a><h1 style=\"font-family: 'Trebuchet MS'; font-size: 30px;\">"+_StickyFormTitle+"</h1><p style=\"font-size: 12px; margin-bottom: 10px;\">"+_StickyFormIntro+"</p><center>"+html+"</center>";
    FlyBox("StickyFormWindow", 500, 450, 'center', '#000000', 0.7);
}
function HtmlEncode(s)
{
    if (!s)
        return "";

    return s.replace(/"/g, "&quot;").replace(/\</g, "&lt;").replace(/\>/g, "&gt;");
}
function URLEncode(clearString)
{
    var output = '';
    var x = 0;
    clearString = clearString.toString();
    var regex = /(^[a-zA-Z0-9_.]*)/;
    while (x < clearString.length)
    {
        var match = regex.exec(clearString.substr(x));
        if (match != null && match.length > 1 && match[1] != '')
        {
            output += match[1];
            x += match[1].length;
        } else
        {
            if (clearString[x] == ' ')
                output += '+';
            else
            {
                var charCode = clearString.charCodeAt(x);
                var hexVal = charCode.toString(16);
                output += '%' + (hexVal.length < 2 ? '0' : '') + hexVal.toUpperCase();
            }
            x++;
        }
    }
    return output;
}