﻿function onFocusPassword(ctrl) {
    //document.getElementById(ctrl.id).className = "passwordNone";
}
function onLostFocusPassword(ctrl) {
    /*if (ctrl.value == "") {
    document.getElementById(ctrl.id).className = "password";
    }*/
}
function onFocusUserName(ctrl) {
    //document.getElementById(ctrl.id).className = "usernameNone";
}
function onLostFocusUserName(ctrl) {
    /*if (ctrl.value == "")
    document.getElementById(ctrl.id).className = "username";*/
}



// From Header
var popupWindow = null;
function popupHelp() {

    var mypage = "http://" + document.location.hostname + ":" + document.location.port + "/Help/HelpPopup.aspx";
    var myname = "HelpPopup";
    var w = 715;
    var h = 402;

    var LeftPosition = (screen.width) ? (screen.width - w) / 2 : 100;
    var TopPosition = (screen.height) ? (screen.height - h) / 2 : 100;

    settings = 'width=' + w + ',height=' + h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
    popupWindow = window.open(mypage, myname, settings);

    popupWindow.focus();

}
//var flashPath = 'Content';
//if (document.URL.indexOf("custom_solution.html") >= 0) {
//    flashPath = "..";
//}
//var is_iphone = (navigator.userAgent.toLowerCase().indexOf('iphone') != -1);
//var is_ipad = (navigator.userAgent.toLowerCase().indexOf('ipad') != -1);
var is_Mobile = /android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm(os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent);

//var is_iphone = true;
//alert(navigator.userAgent);
//alert(banner);
Ext.onReady(function () {
    //setTimeout(function () { setTextBoxWidth(); }, 1000);
    //var is_iphone = (agent.indexOf('iphone')!=-1);
    //if (!is_iphone && !is_ipad && !is_Mobile) {
    if (!is_Mobile) {
        if (document.getElementById("divBanner")) {
            var banner = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="1003" height="328"><param name="movie" value="https://dpov9c9vdm61b.cloudfront.net/Content/Flash/Frames_FNL.swf" /><param name="quality" value="high" /><embed src="https://dpov9c9vdm61b.cloudfront.net/Content/Flash/Frames_FNL.swf" quality="high" pluginspage="https://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1003" height="328" wmode="transparent"></object>';
            document.getElementById("divBanner").innerHTML = banner;
        }
    } else {
    if (document.getElementById("divBanner")) {
        var banner = '<img src="https://dpov9c9vdm61b.cloudfront.net/Content/images/banner-mlp.jpg">';
            document.getElementById("divBanner").innerHTML = banner;
        }
    }
})

var moz = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined');
var ie = (typeof window.ActiveXObject != 'undefined');

function applyXSLWithParam(xmlFile, xslFile) {
    if (moz) {
        //create doc to hold xml file and load xml to it
        var xmlDoc = document.implementation.createDocument("", "", null);
        xmlDoc.async = false;
        xmlDoc.load(xmlFile);

        //create doc to hold xsl and load it to doc
        var xslDoc = document.implementation.createDocument("", "", null);
        xslDoc.async = false;
        xslDoc.load(xslFile);

        // process created docs
        var xsltProc = new XSLTProcessor();
        xsltProc.importStylesheet(xslDoc);
        //pass parameter
        //xsltProc.setParameter(null, paramName, paramValue);
        var resultDoc = xsltProc.transformToDocument(xmlDoc);

        //serialise output to string
        var xmlSerial = new XMLSerializer;
        Content = xmlSerial.serializeToString(resultDoc);
    }
    else if (ie) {
        objXML = new ActiveXObject("MSXML2.DOMDocument.3.0");
        objXML.async = false;
        objXML.validateOnParse = false;

        objXSLT = new ActiveXObject("MSXML2.FreeThreadedDOMDocument.3.0");
        objXSLT.async = false;
        objXSLT.validateOnParse = false;

        //Load XML and XSLT documents
        objXML.load(xmlFile);
        objXSLT.load(xslFile);

        objxsltTemplate = new ActiveXObject("MSXML2.XSLTemplate.3.0");
        objxsltTemplate.stylesheet = objXSLT;
        objxsltProcessor = objxsltTemplate.createProcessor();
        objxsltProcessor.input = objXML;
        //objxsltProcessor.addParameter(paramName, paramValue);
        objxsltProcessor.transform();

        Content = objxsltProcessor.output;
    }
    return Content;
}
