Skip to content

Instantly share code, notes, and snippets.

@foolip
Created September 17, 2016 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save foolip/5dad6b61d8ee36e61d829dbf112c153b to your computer and use it in GitHub Desktop.
Save foolip/5dad6b61d8ee36e61d829dbf112c153b to your computer and use it in GitHub Desktop.
/*
FILE ARCHIVED ON 14:58:33 Sep 1, 2011 AND RETRIEVED FROM THE
INTERNET ARCHIVE ON 20:49:32 Sep 17, 2016.
JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.
ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
SECTION 108(a)(3)).
*/
var loadX = 0;
var loadY = 0;
var isMCS = false;
var travelInsuranceFlag = -1;
function setSafariXY(xf, yf, xs, ys) {
if (browserType == "Safari") {
loadX = xs;
loadY = ys;
} else {
loadX = xf;
loadY = yf;
}
}
function Sarissa() {}
Sarissa.PARSED_OK = "Document contains no parsing errors";
Sarissa.IS_ENABLED_TRANSFORM_NODE = false;
Sarissa.IS_ENABLED_XMLHTTP = false;
Sarissa.IS_ENABLED_SELECT_NODES = false;
var _sarissa_iNsCounter = 0;
var _SARISSA_IEPREFIX4XSLPARAM = "";
var _SARISSA_HAS_DOM_IMPLEMENTATION = document.implementation && true;
var _SARISSA_HAS_DOM_CREATE_DOCUMENT = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.createDocument;
var _SARISSA_HAS_DOM_FEATURE = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.hasFeature;
var _SARISSA_IS_MOZ = _SARISSA_HAS_DOM_CREATE_DOCUMENT && _SARISSA_HAS_DOM_FEATURE;
var _SARISSA_IS_SAFARI = (navigator.userAgent && navigator.vendor && (navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1 || navigator.vendor.indexOf("Apple") != -1));
var _SARISSA_IS_IE = document.all && window.ActiveXObject && navigator.userAgent.toLowerCase().indexOf("msie") > -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1;
if (!window.Node || !window.Node.ELEMENT_NODE) {
var Node = {
ELEMENT_NODE: 1,
ATTRIBUTE_NODE: 2,
TEXT_NODE: 3,
CDATA_SECTION_NODE: 4,
ENTITY_REFERENCE_NODE: 5,
ENTITY_NODE: 6,
PROCESSING_INSTRUCTION_NODE: 7,
COMMENT_NODE: 8,
DOCUMENT_NODE: 9,
DOCUMENT_TYPE_NODE: 10,
DOCUMENT_FRAGMENT_NODE: 11,
NOTATION_NODE: 12
};
}
if (_SARISSA_IS_IE) {
_SARISSA_IEPREFIX4XSLPARAM = "xsl:";
var _SARISSA_DOM_PROGID = "";
var _SARISSA_XMLHTTP_PROGID = "";
pickRecentProgID = function(idList, enabledList) {
var bFound = false;
for (var i = 0; i < idList.length && !bFound; i++) {
try {
var oDoc = new ActiveXObject(idList[i]);
o2Store = idList[i];
bFound = true;
for (var j = 0; j < enabledList.length; j++) {
if (i <= enabledList[j][1]) {
Sarissa["IS_ENABLED_" + enabledList[j][0]] = true;
}
}
} catch (objException) {}
}
if (!bFound) {
throw "Could not retreive a valid progID of Class: " + idList[idList.length - 1] + ". (original exception: " + e + ")";
}
idList = null ;
return o2Store;
}
;
_SARISSA_DOM_PROGID = pickRecentProgID(["Msxml2.DOMDocument.4.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"], [["SELECT_NODES", 2], ["TRANSFORM_NODE", 2]]);
_SARISSA_XMLHTTP_PROGID = pickRecentProgID(["Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"], [["XMLHTTP", 4]]);
_SARISSA_THREADEDDOM_PROGID = pickRecentProgID(["MSXML2.FreeThreadedDOMDocument.4.0", "MSXML2.FreeThreadedDOMDocument.3.0"]);
_SARISSA_XSLTEMPLATE_PROGID = pickRecentProgID(["Msxml2.XSLTemplate.4.0", "MSXML2.XSLTemplate.3.0"], [["XSLTPROC", 2]]);
pickRecentProgID = null ;
Sarissa.getDomDocument = function(sUri, sName) {
var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID);
if (sName) {
if (sUri) {
oDoc.loadXML("<a" + _sarissa_iNsCounter + ":" + sName + " xmlns:a" + _sarissa_iNsCounter + '="' + sUri + '" />');
++_sarissa_iNsCounter;
} else {
oDoc.loadXML("<" + sName + "/>");
}
}
return oDoc;
}
;
Sarissa.getParseErrorText = function(oDoc) {
var parseErrorText = Sarissa.PARSED_OK;
if (oDoc.parseError != 0) {
parseErrorText = "XML Parsing Error: " + oDoc.parseError.reason + "\nLocation: " + oDoc.parseError.url + "\nLine Number " + oDoc.parseError.line + ", Column " + oDoc.parseError.linepos + ":\n" + oDoc.parseError.srcText + "\n";
for (var i = 0; i < oDoc.parseError.linepos; i++) {
parseErrorText += "-";
}
parseErrorText += "^\n";
}
return parseErrorText;
}
;
Sarissa.setXpathNamespaces = function(oDoc, sNsSet) {
oDoc.setProperty("SelectionLanguage", "XPath");
oDoc.setProperty("SelectionNamespaces", sNsSet);
}
;
XSLTProcessor = function() {
this.template = new ActiveXObject(_SARISSA_XSLTEMPLATE_PROGID);
this.processor = null ;
}
;
XSLTProcessor.prototype.importStylesheet = function(xslDoc) {
var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID);
converted.loadXML(xslDoc.xml);
this.template.stylesheet = converted;
this.processor = this.template.createProcessor();
this.paramsSet = new Array();
}
;
XSLTProcessor.prototype.transformToDocument = function(sourceDoc) {
this.processor.input = sourceDoc;
var outDoc = new ActiveXObject(_SARISSA_DOM_PROGID);
this.processor.output = outDoc;
this.processor.transform();
return outDoc;
}
;
XSLTProcessor.prototype.setParameter = function(nsURI, name, value) {
if (nsURI) {
this.processor.addParameter(name, value, nsURI);
} else {
this.processor.addParameter(name, value);
}
if (!this.paramsSet["" + nsURI]) {
this.paramsSet["" + nsURI] = new Array();
}
this.paramsSet["" + nsURI][name] = value;
}
;
XSLTProcessor.prototype.getParameter = function(nsURI, name) {
nsURI = nsURI || "";
if (nsURI in this.paramsSet && name in this.paramsSet[nsURI]) {
return this.paramsSet[nsURI][name];
} else {
return null ;
}
}
;
} else {
if (_SARISSA_HAS_DOM_CREATE_DOCUMENT) {
Sarissa.__handleLoad__ = function(oDoc) {
if (!oDoc.documentElement || oDoc.documentElement.tagName == "parsererror") {
oDoc.parseError = -1;
}
Sarissa.__setReadyState__(oDoc, 4);
}
;
_sarissa_XMLDocument_onload = function() {
Sarissa.__handleLoad__(this);
}
;
Sarissa.__setReadyState__ = function(oDoc, iReadyState) {
oDoc.readyState = iReadyState;
if (oDoc.onreadystatechange != null && typeof oDoc.onreadystatechange == "function") {
oDoc.onreadystatechange();
}
}
;
Sarissa.getDomDocument = function(sUri, sName) {
var oDoc = document.implementation.createDocument(sUri ? sUri : "", sName ? sName : "", null );
oDoc.addEventListener("load", _sarissa_XMLDocument_onload, false);
return oDoc;
}
;
if (window.XMLDocument) {
XMLDocument.prototype.onreadystatechange = null ;
XMLDocument.prototype.parseError = 0;
var _SARISSA_SYNC_NON_IMPLEMENTED = false;
XMLDocument.prototype._sarissa_load = XMLDocument.prototype.load;
XMLDocument.prototype.load = function(sURI) {
var oDoc = document.implementation.createDocument("", "", null );
Sarissa.copyChildNodes(this, oDoc);
this.parseError = 0;
Sarissa.__setReadyState__(this, 1);
try {
if (this.async == false && _SARISSA_SYNC_NON_IMPLEMENTED) {
var tmp = new XMLHttpRequest();
tmp.open("GET", sURI, false);
tmp.send(null );
Sarissa.__setReadyState__(this, 2);
Sarissa.copyChildNodes(tmp.responseXML, this);
Sarissa.__setReadyState__(this, 3);
} else {
this._sarissa_load(sURI);
}
} catch (objException) {
this.parseError = -1;
} finally {
if (this.async == false) {
Sarissa.__handleLoad__(this);
}
}
return oDoc;
}
;
} else {
if (document.implementation && document.implementation.hasFeature && document.implementation.hasFeature("LS", "3.0")) {
Document.prototype.async = true;
Document.prototype.onreadystatechange = null ;
Document.prototype.parseError = 0;
Document.prototype.load = function(sURI) {
var parser = document.implementation.createLSParser(this.async ? document.implementation.MODE_ASYNCHRONOUS : document.implementation.MODE_SYNCHRONOUS, null );
if (this.async) {
var self = this;
parser.addEventListener("load", function(e) {
self.readyState = 4;
Sarissa.copyChildNodes(e.newDocument, self.documentElement, false);
self.onreadystatechange.call();
}, false);
}
try {
var oDoc = parser.parseURI(sURI);
} catch (e) {
this.parseError = -1;
}
if (!this.async) {
Sarissa.copyChildNodes(oDoc, this.documentElement, false);
}
return oDoc;
}
;
Sarissa.getDomDocument = function(sUri, sName) {
return document.implementation.createDocument(sUri ? sUri : "", sName ? sName : "", null );
}
;
}
}
}
}
if (!window.DOMParser) {
DOMParser = function() {}
;
if (_SARISSA_IS_SAFARI) {
DOMParser.prototype.parseFromString = function(sXml, contentType) {
if (contentType.toLowerCase() != "application/xml") {
throw 'Cannot handle content type: "' + contentType + '"';
}
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "data:text/xml;charset=utf-8," + encodeURIComponent(str), false);
xmlhttp.send(null );
return xmlhttp.responseXML;
}
;
} else {
if (Sarissa.getDomDocument && Sarissa.getDomDocument() && "loadXML"in Sarissa.getDomDocument()) {
DOMParser.prototype.parseFromString = function(sXml, contentType) {
var doc = Sarissa.getDomDocument();
doc.loadXML(sXml);
return doc;
}
;
}
}
}
if (window.XMLHttpRequest) {
Sarissa.IS_ENABLED_XMLHTTP = true;
} else {
if (_SARISSA_IS_IE) {
XMLHttpRequest = function() {
return new ActiveXObject(_SARISSA_XMLHTTP_PROGID);
}
;
Sarissa.IS_ENABLED_XMLHTTP = true;
}
}
if (!window.document.importNode && _SARISSA_IS_IE) {
try {
window.document.importNode = function(oNode, bChildren) {
var importNode = document.createElement("div");
if (bChildren) {
importNode.innerHTML = Sarissa.serialize(oNode);
} else {
importNode.innerHTML = Sarissa.serialize(oNode.cloneNode(false));
}
return importNode.firstChild;
}
;
} catch (e) {}
}
if (!Sarissa.getParseErrorText) {
Sarissa.getParseErrorText = function(oDoc) {
var parseErrorText = Sarissa.PARSED_OK;
if (oDoc && oDoc.parseError && oDoc.parseError != 0) {
if (oDoc.documentElement.tagName == "parsererror") {
parseErrorText = oDoc.documentElement.firstChild.data;
parseErrorText += "\n" + oDoc.documentElement.firstChild.nextSibling.firstChild.data;
} else {
parseErrorText = Sarissa.getText(oDoc.documentElement);
}
}
return parseErrorText;
}
;
}
Sarissa.getText = function(oNode, deep) {
var s = "";
var nodes = oNode.childNodes;
for (var i = 0; i < nodes.length; i++) {
var node = nodes[i];
var nodeType = node.nodeType;
if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) {
s += node.data;
} else {
if (deep == true && (nodeType == Node.ELEMENT_NODE || nodeType == Node.DOCUMENT_NODE || nodeType == Node.DOCUMENT_FRAGMENT_NODE)) {
s += Sarissa.getText(node, true);
}
}
}
return s;
}
;
if (window.XMLSerializer) {
Sarissa.serialize = function(oDoc) {
var s = null ;
if (oDoc) {
s = oDoc.innerHTML ? oDoc.innerHTML : (new XMLSerializer()).serializeToString(oDoc);
}
return s;
}
;
} else {
if (Sarissa.getDomDocument && (Sarissa.getDomDocument("", "foo", null )).xml) {
Sarissa.serialize = function(oDoc) {
var s = null ;
if (oDoc) {
s = oDoc.innerHTML ? oDoc.innerHTML : oDoc.xml;
}
return s;
}
;
XMLSerializer = function() {}
;
XMLSerializer.prototype.serializeToString = function(oNode) {
return oNode.xml;
}
;
}
}
Sarissa.stripTags = function(s) {
return s.replace(/<[^>]+>/g, "");
}
;
Sarissa.clearChildNodes = function(oNode) {
while (oNode.firstChild) {
oNode.removeChild(oNode.firstChild);
}
}
;
Sarissa.copyChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) {
if ((!nodeFrom) || (!nodeTo)) {
throw "Both source and destination nodes must be provided";
}
if (!bPreserveExisting) {
Sarissa.clearChildNodes(nodeTo);
}
var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument;
var nodes = nodeFrom.childNodes;
if (ownerDoc.importNode && (!_SARISSA_IS_IE)) {
for (var i = 0; i < nodes.length; i++) {
nodeTo.appendChild(ownerDoc.importNode(nodes[i], true));
}
} else {
for (var i = 0; i < nodes.length; i++) {
nodeTo.appendChild(nodes[i].cloneNode(true));
}
}
}
;
Sarissa.moveChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) {
if ((!nodeFrom) || (!nodeTo)) {
throw "Both source and destination nodes must be provided";
}
if (!bPreserveExisting) {
Sarissa.clearChildNodes(nodeTo);
}
var nodes = nodeFrom.childNodes;
if (nodeFrom.ownerDocument == nodeTo.ownerDocument) {
while (nodeFrom.firstChild) {
nodeTo.appendChild(nodeFrom.firstChild);
}
} else {
var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument;
if (ownerDoc.importNode && (!_SARISSA_IS_IE)) {
for (var i = 0; i < nodes.length; i++) {
nodeTo.appendChild(ownerDoc.importNode(nodes[i], true));
}
} else {
for (var i = 0; i < nodes.length; i++) {
nodeTo.appendChild(nodes[i].cloneNode(true));
}
}
Sarissa.clearChildNodes(nodeFrom);
}
}
;
Sarissa.xmlize = function(anyObject, objectName, indentSpace) {
indentSpace = indentSpace ? indentSpace : "";
var s = indentSpace + "<" + objectName + ">";
var isLeaf = false;
if (!(anyObject instanceof Object) || anyObject instanceof Number || anyObject instanceof String || anyObject instanceof Boolean || anyObject instanceof Date) {
s += Sarissa.escape("" + anyObject);
isLeaf = true;
} else {
s += "\n";
var itemKey = "";
var isArrayItem = anyObject instanceof Array;
for (var name in anyObject) {
s += Sarissa.xmlize(anyObject[name], (isArrayItem ? 'array-item key="' + name + '"' : name), indentSpace + " ");
}
s += indentSpace;
}
return s += (objectName.indexOf(" ") != -1 ? "</array-item>\n" : "</" + objectName + ">\n");
}
;
Sarissa.escape = function(sXml) {
return sXml.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
}
;
Sarissa.unescape = function(sXml) {
return sXml.replace(/&apos;/g, "'").replace(/&quot;/g, '"').replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&amp;/g, "&");
}
;
function $get_JsElement() {
var element = null ;
if (arguments.length == 1) {
element = document.getElementById(arguments[0]);
} else {
if (arguments.length == 2) {
element = eval("document." + arguments[0] + ".elements['" + arguments[1] + "']");
}
}
return element;
}
function $loadCookieValueOnPage() {
if (getCookie(arguments[2]) != null ) {
if (arguments[0] == "forTextField") {
$get_JsElement(arguments[1], arguments[2]).value = getCookie(arguments[2]);
} else {
if (arguments[0] == "forSelect") {
for (k = 0; k < $get_JsElement(arguments[1], arguments[2]).options.length; k++) {
if ($get_JsElement(arguments[1], arguments[2]).options[k].value == getCookie(arguments[2])) {
$get_JsElement(arguments[1], arguments[2]).options[k].selected = true;
break;
}
}
}
}
}
}
function showHideDiv(divid, displayFlag, divType, divObj) {
if (divType == "p") {
var posx = 0;
var posy = 0;
var xOffset = 0;
var yOffset = 0;
var obj = document.getElementById(divObj);
if (obj.offsetParent) {
while (obj.offsetParent) {
posx += obj.offsetLeft;
posy += obj.offsetTop;
obj = obj.offsetParent;
}
} else {
if (obj.x) {
posx += obj.x;
posy += obj.y;
}
}
xOffset = 10;
yOffset = 0;
if (divid == "wtRedress") {
xOffset = 0;
} else {
if (divid == "privacyNotice") {
xOffset = 130;
}
}
document.getElementById(divid).style.left = (posx + xOffset);
document.getElementById(divid).style.top = (posy + yOffset);
}
if (displayFlag) {
document.getElementById(divid).style.display = "block";
} else {
document.getElementById(divid).style.display = "none";
}
}
var fixedConfiguratedDate = "";
var calType = "other";
var o_navigator = navigator.userAgent.toLowerCase();
var isMacIE = (o_navigator.indexOf("msie 5") > -1 && o_navigator.indexOf("mac") > -1) ? 1 : 0;
var isPCIE6 = (o_navigator.indexOf("msie 6") > -1) ? 1 : 0;
var isChrome = (o_navigator.indexOf("chrome") > -1) ? 1 : 0;
var isPCIE = (o_navigator.indexOf("msie") > -1 && !isMacIE && o_navigator.indexOf("opera") == -1) ? 1 : 0;
var isFF = (o_navigator.indexOf("mac") == -1 && o_navigator.indexOf("firefox") > -1) ? 1 : 0;
var isOpera = o_navigator.indexOf("opera") > -1 ? 1 : 0;
var isKHTML = o_navigator.indexOf("khtml") > -1 ? 1 : 0;
var isSafari = (o_navigator.indexOf("mac") > -1 && o_navigator.indexOf("safari") > -1) ? 1 : 0;
var isMacFF = (o_navigator.indexOf("mac") > -1 && o_navigator.indexOf("firefox") > -1) ? 1 : 0;
var mArray = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var dArray = new Array("S","M","T","W","T","F","S");
var datesArray = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
var today = "";
var yearShowFlg = false;
var showYear = "";
if (typeof fixedateForAddPoints == "undefined") {
today = new Date();
} else {
var fixedateForAddPointsParse = Date.parse(fixedateForAddPoints);
yearShowFlg = true;
today = new Date(fixedateForAddPointsParse);
}
var cD = today.getDay();
var cT = today.getDate();
var cM = today.getMonth();
var cMDs = datesArray[cM];
var cY = today.getFullYear();
var newT = cT;
var newM = cM;
var newY = cY;
var newDs = cMDs;
var newD = cD;
var numCalendars = 2;
var calDirection = "";
var calopen = 0;
var o_windowparent = top;
var o_input = 0;
var o_month = 0;
var o_date = 0;
var o_iframecal = 0;
var o_from;
var o_to;
var v_from;
var v_to;
var d_makefrom = 0;
var d_maketo = 0;
var s_lang = "us";
var o_currentDate = false;
var i_firstMonth = cM;
var i_sfirstYear = cY;
var i_sfirstMonth = cM;
var i_ofirstYear = cY;
var i_ofirstMonth = cM;
var b_calinit = 0;
var o_row = null ;
var i_numcal = 0;
var o_calbody = null ;
var s_jscall = (isPCIE) ? "parent." : "";
var s_closecal = "";
var b_date331 = 0;
var a_input = 0;
var o_parent;
var s_inputtype = "object";
var a_v_input = null ;
var FieldClicked = null ;
var departDate = "";
var flgDorR = "";
var flgRetName = "";
var flgDateDisable = "";
var chk = "";
var chkExccessbags = "true";
var TOTALBAGSDEP = 0;
var TotalSelectValue = 0;
var TotalSelectValueRet = 0;
var TotalSubDep = 0;
var TotalSubRet = 0;
var TotalDepRet = 0;
var guestsize = 0;
var chkAjaxDiv;
var chkAjaxDivSecond;
var secondDiv;
var pointsDivId;
var showPointsDivId;
var addFieldId = "";
var discontinue = 0;
var callErrorFun = 0;
var excessBagsString = "";
var excessBagsStringRet = "";
var tempguestBag = 0;
var guestHaveExcessBags = 0;
var allowFree_Bags = 0;
var xmlhttp = new XMLHttpRequest();
var chkxmlhttp = new XMLHttpRequest();
var formTripType = null ;
var iswap = 0;
var X = 0;
var Y = 0;
var linkCnt = 0;
var maxheight = 240;
var c1;
var c2;
var thisobj = "undefined";
var checkval = "undefined";
var depLeg1Guest = "";
var depLeg2Guest = "";
var retLeg1Guest = "";
var retLeg2Guest = "";
var depLeg1Seat = "";
var depLeg2Seat = "";
var retLeg1Seat = "";
var retLeg2Seat = "";
var guestArray = new Array();
var seatArray = new Array();
var seatDepConnectArray = new Array();
var guestArrayRet = new Array();
var seatArrayRet = new Array();
var seatRetConnectArray = new Array();
var gnum = "";
var gnumRet = "";
var ajaxDiv;
var alreadyCheckedInDep = "false";
var alreadyCheckedInRet = "false";
var mywindow;
var mywindowForHtml;
var wichSelected;
var tabVal = "";
var ajaxDiv;
var seatMapAjaxDiv;
var activatedTab = "";
var tabSelect = "1";
var tbSelect = "1";
var logInVal = "Email, Alias or Elevate#";
var loginModuleOrRest = "login";
var holdInnerHtml = "";
var expiredays = 0;
var FrmToSubmit = "";
var buttonURL = "";
var flgMsg = false;
var xAxis = "";
var yAxis = "";
var X1 = 0;
var Y1 = 0;
var disableIds = 0;
var rUInRegistrationProcess = "No";
var movex = 0;
var movey = 0;
var xdiff = 0;
var ydiff = 0;
var ystart = 0;
var xstart = 0;
var a = 0;
var isScroll = "Yes";
var positionDivFare;
var actualDiv;
var checkSearchTypeLink;
var imgObj;
var fltStatusErrorsRequired = "To find the flight you need, we need a valid flight number or city pair.";
var fltStatusErrorsUnknown = "Unknown error: Contact admin";
var fltStatusErrorsServiceRequired = "No data matches your selection criteria.";
var fltStatusErrorsInValidFltNo = "The flight number you have chosen does not fly on this date. Please choose another day.";
var fltStatusErrorsInValidFltNoNotNum = "Flight numbers must be numeric only.";
var fltStatusErrorsInValidCityPair = "The city pair you have selected does not match the correct flight number. Please double check them and try again.";
var fltStatusErrorsNoFltGivenDate = "Sorry, there are not any flights for the date you have requested.";
var fltStatuserrorsnoData = "No Data Available for this date or selected City Pair.";
var IsNumber = true;
function addElement(parentId, eleType, eleName, eleValue) {
var parentObj = document.getElementById(parentId);
var element = document.createElement("input");
element.setAttribute("type", eleType);
element.setAttribute("value", eleValue);
element.setAttribute("name", eleName);
parentObj.appendChild(element);
}
function createForm(frmName, frmAction) {
var formElement = document.createElement("form");
formElement.setAttribute("name", frmName);
formElement.setAttribute("id", frmName);
formElement.setAttribute("method", "post");
return formElement;
}
function joinElevate(fName, mName, lName, address1, address2, city, state, country, zipCode) {
var joinElevateReqForm = createForm("requestProfileForm", "joinElevate.do");
var frmParentObj = document.getElementById("joinElevateDiv");
frmParentObj.appendChild(joinElevateReqForm);
joinElevateReqForm.action = "joinElevate.do";
joinElevateReqForm.method = "POST";
addElement(joinElevateReqForm.id, "hidden", "method", "joinElevate");
addElement(joinElevateReqForm.id, "hidden", "fName", fName);
addElement(joinElevateReqForm.id, "hidden", "mName", mName);
addElement(joinElevateReqForm.id, "hidden", "lName", lName);
addElement(joinElevateReqForm.id, "hidden", "address1", address1);
addElement(joinElevateReqForm.id, "hidden", "address2", address2);
addElement(joinElevateReqForm.id, "hidden", "city", city);
addElement(joinElevateReqForm.id, "hidden", "state", state);
addElement(joinElevateReqForm.id, "hidden", "country", country);
addElement(joinElevateReqForm.id, "hidden", "zipCode", zipCode);
joinElevateReqForm.submit();
}
function getAnchorPosition(anchorname) {
var useWindow = false;
var coordinates = new Object();
var x = 0
, y = 0;
var use_gebi = false
, use_css = false
, use_layers = false;
if (document.getElementById) {
use_gebi = true;
} else {
if (document.all) {
use_css = true;
} else {
if (document.layers) {
use_layers = true;
}
}
}
if (use_gebi && document.all) {
x = AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
y = AnchorPosition_getPageOffsetTop(document.all[anchorname]);
} else {
if (use_gebi) {
var o = document.getElementById(anchorname);
x = AnchorPosition_getPageOffsetLeft(o);
y = AnchorPosition_getPageOffsetTop(o);
} else {
if (use_css) {
x = AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
y = AnchorPosition_getPageOffsetTop(document.all[anchorname]);
} else {
if (use_layers) {
var found = 0;
for (var i = 0; i < document.anchors.length; i++) {
if (document.anchors[i].name == anchorname) {
found = 1;
break;
}
}
if (found == 0) {
coordinates.x = 0;
coordinates.y = 0;
return coordinates;
}
x = document.anchors[i].x;
y = document.anchors[i].y;
} else {
coordinates.x = 0;
coordinates.y = 0;
return coordinates;
}
}
}
}
coordinates.x = x;
coordinates.y = y;
return coordinates;
}
function getAnchorWindowPosition(anchorname) {
var coordinates = getAnchorPosition(anchorname);
var x = 0;
var y = 0;
if (document.getElementById) {
if (isNaN(window.screenX)) {
x = coordinates.x - document.body.scrollLeft + window.screenLeft;
y = coordinates.y - document.body.scrollTop + window.screenTop;
} else {
x = coordinates.x + window.screenX + (window.outerWidth - window.innerWidth) - window.pageXOffset;
y = coordinates.y + window.screenY + (window.outerHeight - 24 - window.innerHeight) - window.pageYOffset;
}
} else {
if (document.all) {
x = coordinates.x - document.body.scrollLeft + window.screenLeft;
y = coordinates.y - document.body.scrollTop + window.screenTop;
} else {
if (document.layers) {
x = coordinates.x + window.screenX + (window.outerWidth - window.innerWidth) - window.pageXOffset;
y = coordinates.y + window.screenY + (window.outerHeight - 24 - window.innerHeight) - window.pageYOffset;
}
}
}
coordinates.x = x;
coordinates.y = y;
return coordinates;
}
function AnchorPosition_getPageOffsetLeft(el) {
var ol = el.offsetLeft;
while ((el = el.offsetParent) != null ) {
ol += el.offsetLeft;
}
return ol;
}
function AnchorPosition_getWindowOffsetLeft(el) {
return AnchorPosition_getPageOffsetLeft(el) - document.body.scrollLeft;
}
function AnchorPosition_getPageOffsetTop(el) {
var ot = el.offsetTop;
while ((el = el.offsetParent) != null ) {
ot += el.offsetTop;
}
return ot;
}
function AnchorPosition_getWindowOffsetTop(el) {
return AnchorPosition_getPageOffsetTop(el) - document.body.scrollTop;
}
function findFirstDay() {
firstDay = new Date();
firstDay.setDate(1);
firstDay.setMonth(newM);
firstDay.setFullYear(newY);
return firstDay.getDay();
}
function setDateLimit(DateLimit1) {
fixedConfiguratedDate = DateLimit1;
}
function check331(d_date) {
var b_check331;
ConParseDate = Date.parse(fixedConfiguratedDate);
ConfiguratedDate = new Date(ConParseDate);
if (ConfiguratedDate > d_date) {
b_check331 = 0;
} else {
b_check331 = 1;
}
return b_check331;
}
function vm_setupCal() {
i_numcal = 0;
if (calType == "home") {
makeCal(cM);
} else {
vm_makeCal(cM);
}
}
function preventClose(evt) {
if (isKHTML || isOpera) {
evt.stopPropagation();
}
}
function ty_makeDate(which) {
d_makedate = new Date(newY,newM,which);
b_date331 = check331(d_makedate);
if ((flgDorR == "return_date.png" || flgDorR == "Return_date.gif" || flgRetName == "flightSearch.returnDateMC.MMDDYYYY") && flgDateDisable != "") {
var flgDateDisableDay = flgDateDisable.getDate();
var flgDateDisableMonth = flgDateDisable.getMonth();
var flgDateDisableYear = flgDateDisable.getFullYear();
if ((flgDateDisableDay > which && flgDateDisableMonth == newM && flgDateDisableYear == newY) || b_date331) {
s_makeDate = "<td class='calDateOff' width='18' height='16'>&nbsp;";
s_makeDate += which;
} else {
if (d_makefrom || d_maketo) {
if (flgDorR == "Return_date.gif" || flgDorR == "return_date.png" || flgRetName == "flightSearch.returnDateMC.MMDDYYYY") {
d_makefrom = d_maketo;
}
if (d_makedate.toString() == d_makefrom.toString()) {
s_makeDate = "<td class='calDateSel' width='18' height='16'>";
} else {
if (d_makedate > d_makefrom && d_makedate < d_maketo && d_makefrom) {
s_makeDate = "<td class='calDateOff' width='18' height='16'>";
} else {
s_makeDate = "<td class='calDate' width='18' height='16'>";
}
}
} else {
s_makeDate = "<td class='calDate' width='18' height='16'>";
}
if (d_makedate.toString() == d_makefrom.toString()) {
s_makeDate += "<a href='#' id='idmake_Date' onclick='" + s_jscall + "ty_setDate(" + newM + "," + which + ",this.parentNode," + newY + ");return false;' style='color:#FFFFFF;TEXT-DECORATION: none;'>";
} else {
s_makeDate += "&nbsp;<a href='#' id='idmake_Date1' onclick='" + s_jscall + "ty_setDate(" + newM + "," + which + ",this.parentNode," + newY + ");return false;' class='calDateA'>";
}
s_makeDate += which;
s_makeDate += "</a>";
}
} else {
if ((cT > which && cM == newM && cY == newY) || b_date331) {
s_makeDate = "<td class='calDateOff' width='18' height='16'>&nbsp;";
s_makeDate += which;
} else {
if (d_makefrom || d_maketo) {
if (flgDorR == "Return_date.gif" || flgDorR == "return_date.png" || flgRetName == "flightSearch.returnDateMC.MMDDYYYY") {
d_makefrom = d_maketo;
}
if (d_makedate.toString() == d_makefrom.toString()) {
s_makeDate = "<td class='calDateSel' width='18' height='16'>";
} else {
if (d_makedate > d_makefrom && d_makedate < d_maketo && d_makefrom) {
s_makeDate = "<td class='calDateOff' width='18' height='16'>";
} else {
s_makeDate = "<td class='calDate' width='18' height='16'>";
}
}
} else {
s_makeDate = "<td class='calDate' width='18' height='16'>";
}
if (d_makedate.toString() == d_makefrom.toString()) {
s_makeDate += "<a href='#' id='idmake_Date2' onclick='" + s_jscall + "ty_setDate(" + newM + "," + which + ",this.parentNode," + newY + ");return false;' style='color:#FFFFFF;TEXT-DECORATION: none;'>";
} else {
s_makeDate += "&nbsp;<a href='#' id='idmake_Date3' onclick='" + s_jscall + "ty_setDate(" + newM + "," + which + ",this.parentNode," + newY + ");return false;' class='calDateA'>";
}
s_makeDate += which;
s_makeDate += "</a>";
}
}
s_makeDate += "</td>";
return s_makeDate;
}
function ty_maketr(what) {
s_tr = "<tr>";
s_tr += what;
s_tr += "</tr>";
return s_tr;
}
function ty_changeMonths(which) {
calopen = 0;
i_numcal = 0;
o_calbody.innerHTML = "";
if (which < 0) {
which = 11;
newY--;
}
if (calType == "home") {
makeCal(which);
} else {
vm_makeCal(which);
}
setTimeout("calopen = 1", 100);
}
var o_cal1 = ""
, o_cal2 = "";
var calBaseWidth = 0;
if (isPCIE == 1 || isSafari) {
calBaseWidth = "358";
} else {
calBaseWidth = "357";
}
var tableOpen1 = "<tr><td colspan='3' align='center' valign='top'><table width='357' border='0' cellpadding='0' cellspacing='0'><tr><td width='13' rowspan='2' align='left' valign='top' background='/web/20110901145833/https://static.virginamerica.com/images/calender_lt.png' style='background-repeat:repeat-y;'><img src='/web/20110901145833/https://static.virginamerica.com/images/spacer.gif' width='13' height='8' /></td><td height='3' align='left' valign='top' bgcolor='#ffffff' ><img src='/web/20110901145833/https://static.virginamerica.com/images/spacer.gif' width='15' height='3' /></td><td width='14' rowspan='2' align='left' valign='top' background='/web/20110901145833/https://static.virginamerica.com/images/calender_rt.png' style='background-repeat:repeat-y;'><img src='/web/20110901145833/https://static.virginamerica.com/images/spacer.gif' width='14' height='8' /></td></tr><tr><td align='left' valign='top' bgcolor='#e6e6e6'><table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td width='" + innerCalW + "' align='center' valign='top' bgcolor='#e6e6e6'>";
var tableClose1 = "</td></tr></table></td></tr><tr><td width='" + calBaseWidth + "' height='10' colspan='3' align='left' valign='top'><img src='/web/20110901145833/https://static.virginamerica.com/images/calender_base.png' width='" + calBaseWidth + "' height='10' /></td></tr></table>";
var tdFor3rdTable = "</td><td width='7' height='19' align='left' valign='top'><img src='/web/20110901145833/https://static.virginamerica.com/images/spacer.gif' width='7' height='96' /></td><td width='" + innerCalW + "' align='left' valign='top' >";
function vm_makeCal(whichMonth) {
o_calnext = "";
b_calinit = 1;
o_cal = "";
o_caltr = "";
o_caltd = "";
newM = whichMonth;
if (newM < cM) {
newY = newY;
}
if (newY < cY) {
newY = cY;
}
if (newM >= 12) {
newM = whichMonth - 12;
newY++;
}
if (i_numcal == 0) {
i_firstMonth = newM;
switch (s_inputtype) {
case "object":
i_ofirstMonth = newM;
i_ofirstYear = newY;
break;
default:
i_sfirstMonth = newM;
i_sfirstYear = newY;
}
}
newDs = datesArray[newM];
isLeap = (newY % 4 == 0 && (newY % 100 != 0 || newY % 400 == 0)) ? 1 : 0;
if (newM == 1) {
newDs = newDs + isLeap;
}
newD = findFirstDay();
countDay = newD;
s_calclass = (calDirection == "vertical") ? "calTableH" : "calTableH";
var changeTDTOTABLEValue = "";
o_cal += "<table month='" + newM + "' year='" + newY + "' width='" + innerCalW + "' border='0' cellspacing='0' cellpadding='0' style='border:1px solid #f7f7f7;background-color:#ffffff;'>";
o_caltr += "<tr>";
o_caltd += "<td height='20' align='center' valign='top' class='calMon' background='/web/20110901145833/https://static.virginamerica.com/images/month_bg.png' colspan=7>";
changeTDTOTABLEValue = mArray[newM];
o_caltd += "RWTCMT";
o_caltd += "</td>";
o_caltr += o_caltd;
o_caltr += "</tr>";
o_cal += o_caltr;
o_caltd = "";
o_caltd += "<td height='14' align='left' valign='top' colspan=7 ><img src='/web/20110901145833/https://static.virginamerica.com/images/day_name.png' width='" + innerCalW + "' height='14' /></td>";
o_caltd += "<tr><td ></td><td colspan=5><img src='/web/20110901145833/https://static.virginamerica.com/images/spacer.gif'></td><td></td>";
o_caltr = ty_maketr(o_caltd);
o_cal += o_caltr;
o_caltd = "";
i_calRows = 0;
for (d = 1; d <= newDs; d++) {
if (d == 1) {
for (bd = 0; bd < newD; bd++) {
o_caltd += "<td width='18' height='16' align='left' valign='top'><img src='/web/20110901145833/https://static.virginamerica.com/images/spacer.gif' width='18' height='16' /></td>";
}
}
o_caltd += ty_makeDate(d);
countDay++;
if (countDay == 7) {
countDay = 0;
o_caltr = ty_maketr(o_caltd);
o_cal += o_caltr;
o_caltd = "";
i_calRows++;
}
if (d == newDs && countDay != 0) {
for (bd = countDay; bd < 7; bd++) {
o_caltd += "<td width='18' height='16' align='left' valign='top'><img src='/web/20110901145833/https://static.virginamerica.com/images/spacer.gif' width='18' height='16' /></td>";
}
o_caltr = ty_maketr(o_caltd);
o_cal += o_caltr;
o_caltd = "";
i_calRows++;
}
}
if (i_calRows < 6) {
o_caltd = "";
for (bd = 0; bd < 7; bd++) {
o_caltd += "<td width='18' height='16' align='left' valign='top'><img src='/web/20110901145833/https://static.virginamerica.com/images/spacer.gif' width='18' height='16' /></td>";
}
o_caltr = ty_maketr(o_caltd);
o_cal += o_caltr;
}
o_cal += "</table>";
if (i_numcal == 0) {
if (newM == cM && newY == cY) {
o_cal1 = "";
} else {
o_cal1 = "<a href='#' id='idcal1' onclick='" + s_jscall + "ty_changeMonths(" + i_firstMonth + "-1);" + s_jscall + "preventClose(event);return false;'><img src='/web/20110901145833/https://static.virginamerica.com/images/calender_prev.png' border='0' /></a>";
}
o_calprev = '<div style="float:left;">' + o_cal1 + "</div>";
} else {}
o_calbody.innerHTML += o_cal;
i_numcal++;
if (i_numcal == numCalendars && !b_date331) {
o_cal2 = "<a href='#' id='idcal2' onclick='" + s_jscall + "ty_changeMonths(" + i_firstMonth + "+1);" + s_jscall + "preventClose(event);return false;'><img src='/web/20110901145833/https://static.virginamerica.com/images/calender_nxt.png' border='0' /></a>";
} else {
o_cal2 = "";
}
o_calnext = '<div style="float:right;">' + o_cal2 + "</div>";
var monthtable1 = "<table width='150' border='0' cellspacing='0' cellpadding='0'><tr><td align='left' valign='top' width='5' height='19'><img src='/web/20110901145833/https://static.virginamerica.com/images/spacer.gif' width='5' height='19' border='0' /></td><td width='16' align='left' valign='top'>";
var monthtable2 = "</td><td width='5' align='center' valign='middle' class='style9'><img src='/web/20110901145833/https://static.virginamerica.com/images/spacer.gif' width='5' height='19' border='0' /></td></tr></table>";
if (i_numcal < numCalendars) {
changeTDTOTABLEValue = monthtable1 + "</td><td align='center' valign='middle' class='calMonthTitle'>" + changeTDTOTABLEValue + "</td><td width='16' align='center' valign='middle' class='style9'>&nbsp;" + monthtable2;
o_cal1 = o_calbody.innerHTML;
o_calbody.innerHTML = "";
o_cal1 = o_cal1.replace("RWTCMT", changeTDTOTABLEValue);
} else {
changeTDTOTABLEValue = monthtable1 + "&nbsp;</td><td align='center' valign='middle' class='calMonthTitle'>" + changeTDTOTABLEValue + "</td><td width='16' align='center' valign='middle' class='style9'>" + monthtable2;
o_cal2 = o_calbody.innerHTML;
o_cal2 = o_cal2 + "</td></tr></table>";
o_calbody.innerHTML = "";
o_cal2 = o_cal2.replace("RWTCMT", changeTDTOTABLEValue);
}
if (i_numcal < numCalendars) {
vm_makeCal(newM + 1);
zzzz++;
} else {
if (i_firstMonth > newM) {
newY--;
}
}
if (zzzz % 2 == 0) {
if (isPCIE == 1) {
document.getElementById("calframe").style.height = "192px";
}
o_calbody.innerHTML = s_closecal + tableOpen1 + o_cal1 + tdFor3rdTable + o_cal2 + o_calprev + o_calnext + tableClose1;
zzzz = 1;
}
}
var zzzz = 1;
function ty_setDate(whatMonth, whatDate, whatTD, whatYear) {
o_currentDate = whatTD;
o_currentDate.className = "calDateSel";
if (typeof (o_input) == "object") {
o_input.value = (s_lang == "us") ? (whatMonth + 1) + "/" + whatDate + "/" + whatYear : whatDate + "/" + (whatMonth + 1) + "/" + whatYear;
} else {
document.getElementById(a_v_input[0]).selectedIndex = whatMonth;
document.getElementById(a_v_input[1]).selectedIndex = whatDate - 1;
}
closeCal();
}
function hideCalendar() {
o_caldiv.style.display = "none";
if (o_parent && calType != "home") {
o_parent.className = "cbrow";
}
}
function splitDate(s_input, s_mode) {
this.delimitor = (s_input.indexOf("/") > -1) ? "/" : (s_input.indexOf(".") > -1) ? "." : (s_input.indexOf("-") > -1) ? "-" : (s_input.indexOf(",") > -1) ? "," : "/";
a_input = s_input.split(this.delimitor);
this.date = -1;
this.month = -1;
this.year = -1;
if (a_input.length == 3 && !isNaN(a_input[0]) && !isNaN(a_input[1]) && !isNaN(a_input[2])) {
this.month = (s_mode == "us") ? parseInt(a_input[0], 10) - 1 : parseInt(a_input[1], 10) - 1;
this.date = (s_mode == "us") ? parseInt(a_input[1], 10) : parseInt(a_input[0], 10);
this.year = a_input[2];
if (this.month > 11 || this.month < 0) {
this.month = -1;
}
if (this.date > 31 || this.month < 0) {
this.date = -1;
}
i_yrlength = this.year.toString().length;
if (i_yrlength == 2) {
this.year = "20" + this.year;
}
if (i_yrlength < 1 || i_yrlength == 3 || this.year < cY) {
this.year = -1;
}
}
}
var o_caldiv = 0;
var t_calcloser = null ;
function buildDate(s_monthdate) {
a_monthdate = s_monthdate.split("|");
bd_oMonth = document.getElementById(a_monthdate[0]);
bd_oDate = document.getElementById(a_monthdate[1]);
i_month = bd_oMonth.selectedIndex + 1;
i_date = bd_oDate.selectedIndex + 1;
s_date = "";
s_date = i_month + "/" + i_date + "/";
s_date += (i_month - 1 < cM) ? cY + 1 : cY;
return s_date;
}
var s_lastinputtype = null ;
function makeCalendar(v_input, s_from, s_to, s_mode) {
o_input = v_input;
if (document.getElementById(s_from).value == "" || document.getElementById(s_from).value == "mm/dd/yyyy") {
call_from_date_month = new Date().getMonth() + 1;
call_from_date_date = new Date().getDate();
call_from_date_year = new Date().getFullYear();
document.getElementById(s_from).value = call_from_date_month + "/" + call_from_date_date + "/" + call_from_date_year;
}
var calCSS = null ;
if (calType == "home") {
calCSS = document.getElementById("cssId");
} else {
calCSS = document.getElementById("calendarcss");
}
if (isPCIE == 1) {
document.getElementById("calbox").innerHTML = '<iframe id="calframe" src="javascript:\'calendar\'" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" src="html/SSLIframeFixed.html" ></iframe>';
s_iecalcss = "<link rel='STYLESHEET' type='text/css' href='" + calCSS.href + "' />";
o_califrame = document.getElementById("calframe");
calframe.document.open();
calframe.document.write("<html><head>" + s_iecalcss + "</head><body id='calbox' class='calendar'></body></html>");
calframe.document.close();
}
i_numcal = 0;
if (isPCIE) {
document.getElementById("calframe").className = "calframe";
}
if (calType == "home") {
o_calbody = (isPCIE) ? document.getElementById("calbox") : document.getElementById("calbox");
} else {
o_calbody = (isPCIE) ? calframe.document.getElementById("calbox") : document.getElementById("calbox");
}
o_calbody.innerHTML = "";
o_udate = (typeof (o_input) == "object") ? new splitDate(o_input.value,"us") : new splitDate(buildDate(o_input),"us");
a_from = s_from.split("|");
v_from = (a_from.length == 1) ? new splitDate(document.getElementById(s_from).value,s_mode) : new splitDate(buildDate(s_from),s_mode);
a_to = s_to.split("|");
v_to = (a_to.length == 2) ? new splitDate(buildDate(s_to),s_mode) : (document.getElementById(s_to)) ? new splitDate(document.getElementById(s_to).value,s_mode) : new splitDate("",s_mode);
d_makefrom = (v_from.month != -1) ? new Date(v_from.year,v_from.month,v_from.date) : 0;
d_maketo = (v_to.month != -1) ? new Date(v_to.year,v_to.month,v_to.date) : 0;
switch (b_calinit) {
case 0:
if (o_udate.month != -1 && o_udate.year != -1 && o_udate.date != -1) {
newY = o_udate.year;
newM = o_udate.month;
newD = o_udate.date;
if (calType == "home") {
makeCal(o_udate.month);
} else {
vm_makeCal(o_udate.month);
}
} else {
if (o_udate != document.getElementById(s_from) && d_makefrom) {
newY = v_from.year;
newM = v_from.month;
newD = v_from.date;
if (calType == "home") {
makeCal(v_from.month);
} else {
vm_makeCal(v_from.month);
}
} else {
if (o_udate != document.getElementById(s_to) && d_maketo) {
newY = v_to.year;
newM = v_to.month;
newD = v_to.date;
if (calType == "home") {
makeCal(v_to.month);
} else {
vm_makeCal(v_to.month);
}
} else {
newY = cY;
newM = cM;
newD = cD;
if (calType == "home") {
makeCal(cM);
} else {
vm_makeCal(cM);
}
}
}
}
break;
default:
switch (s_inputtype) {
case "object":
newM = i_ofirstMonth;
newY = i_ofirstYear;
break;
default:
newM = i_sfirstMonth;
newY = i_sfirstYear;
}
if (calType == "home") {
makeCal(newM);
} else {
vm_makeCal(newM);
}
}
s_lastinputtype = typeof (o_input);
}
var p, EX1, EX2, EY1, EY2;
function openCal(v_input, s_from, s_to, s_cal, s_parent, s_mode, s_caldir, pos1, pos2, imageName) {
flgDorR = imageName;
flgRetName = s_from;
var retLocalVar = s_from;
var dpDtStr = "";
cM = today.getMonth();
cY = today.getFullYear();
if (document.flightSearchRTForm) {
for (i = 0; i < document.flightSearchRTForm.elements.length; i++) {
if (document.flightSearchRTForm.elements[i].name == "flightSearch.depDate.MMDDYYYY") {
dpDtStr = document.flightSearchRTForm.elements[i].value;
}
}
} else {
if (document.flightSearchForm) {
for (i = 0; i < document.flightSearchForm.elements.length; i++) {
if (document.flightSearchForm.elements[i].name == "flightSearch.depDate.MMDDYYYY") {
dpDtStr = document.flightSearchForm.elements[i].value;
}
}
}
}
if (imageName == "Return_date.png" || (retLocalVar == "flightSearch.returnDateMC.MMDDYYYY") || imageName == "return_date.png") {
if (dpDtStr == "" || dpDtStr == "mm/dd/yyyy") {
i_ofirstMonth = new Date().getMonth();
flgDateDisable = new Date();
} else {
flgDateDisable = new Date(dpDtStr);
i_ofirstMonth = new Date(dpDtStr).getMonth();
cM = i_ofirstMonth;
cY = flgDateDisable.getFullYear();
}
}
s_closecal = "<table border='0' cellpadding='0' cellspacing='0'><tr><td width='280' height='22' align='left' valign='top' ><img src='/web/20110901145833/https://static.virginamerica.com/images/" + imageName + "' /></td><td align='right' valign='top' style='background:url(/web/20110901145833/https://static.virginamerica.com/images/cal-top-bg.png) repeat-x;' ><a href='#' id='idclose' onclick='" + s_jscall + "closeCal();return false;'><img src='/web/20110901145833/https://static.virginamerica.com/images/view_cross_bt.png' border='0'/></a></td><td width='14' align='left' valign='top' ><img src='/web/20110901145833/https://static.virginamerica.com/images/depart_date_rt.png' width='14' height='31' /></td></tr>";
FieldClicked = v_input.name;
displayImage = imageName;
if (o_parent) {
o_parent.className = "cbrow";
}
clearTimeout(t_calcloser);
s_inputtype = typeof (v_input);
a_v_input = null ;
calopen = 0;
o_caldiv = document.getElementById(s_cal);
o_caldiv.style.display = "block";
o_caldiv.className = "calboxon";
makeCalendar(v_input, s_from, s_to, s_mode);
o_inputright = v_input;
o_parent = document.getElementById(s_parent);
o_cal = document.getElementById(s_cal);
o_parent.className += " cbrowon";
i_calx = parseInt(o_inputright.offsetLeft) + parseInt(o_inputright.offsetWidth);
i_caly = parseInt(o_parent.offsetTop) + (parseInt(o_parent.offsetHeight) / 2) - (parseInt(o_cal.offsetHeight) / 2);
p = getXandY(v_input);
EX1 = p.x;
EX2 = (v_input.offsetWidth - pos1 + EX1) + "px";
EY1 = p.y;
EY2 = EY1;
o_cal.style.left = EX2;
o_cal.style.top = (EY2 + pos2 - 23) + "px";
setTimeout("calopen = 1", 100);
}
function closeCal() {
if (o_caldiv && calopen) {
t_calcloser = setTimeout("hideCalendar()", 100);
if (document.getElementById("BookFlightDiv") && document.getElementById("BookFlightDiv").style.display != "none" && document.flightSearchForm) {
if (FieldClicked == "flightSearch.depDate.MMDDYYYY" || FieldClicked == "flightSearch.depDateMC.MMDDYYYY") {
updateDepDateInForm();
} else {
updateRetDateInForm();
}
} else {
if (FieldClicked == "flightSearch.depDate.MMDDYYYY" && document.flightSearchOWForm != null && document.flightSearchMCForm != null ) {
dateRT();
} else {
if (FieldClicked == "flightSearch.returnDate.MMDDYYYY" && document.flightSearchMCForm != null ) {
dateReturnRT();
} else {
if (FieldClicked == "flightSearch.depDateOW.MMDDYYYY" && document.flightSearchRTForm != null && document.flightSearchMCForm != null ) {
dateOW();
} else {
if (FieldClicked == "flightSearch.depDateMC.MMDDYYYY" && document.flightSearchRTForm != null && document.flightSearchOWForm != null ) {
dateMC();
} else {
if (FieldClicked == "flightSearch.depDateMC.MMDDYYYY" && document.flightSearchRTForm != null && document.flightSearchOWForm != null ) {
dateMC();
} else {
if (FieldClicked == "flightSearch.returnDateMC.MMDDYYYY" && document.flightSearchRTForm != null ) {
dateReturnMC();
} else {}
}
}
}
}
}
}
}
calopen = 0;
}
window.onclick = closeCal;
window.document.onclick = closeCal;
function chkBagsAction(chkBtn) {
if (chk != "cancelAction") {
ShowCheckBags();
} else {
onBackShowPnrHome();
}
document.getElementById("bagAddition").style.display = "none";
}
function showPopUp(chkBtn) {
chk = "cancelAction";
document.getElementById("bagAddition").style.display = "block";
showWaitImage();
}
function showPopUpContinue(thisId) {
if (chkExccessbags == "true") {
var X;
var Y;
var c = getAnchorPosition(thisId.id);
X = c.x;
Y = c.y - 30;
document.getElementById("bagAddition").style.left = X - 150;
document.getElementById("bagAddition").style.top = Y;
document.getElementById("bagAddition").style.display = "block";
} else {
ShowCheckBags();
}
}
function disable(tabId) {
document.getElementById(tabId).innerHTML = "<img src='/web/20110901145833/https://static.virginamerica.com/images/Travel_mng_red.gif'>";
}
function hide(arg) {
document.getElementById(arg).style.display = "none";
}
function show(arg1) {
document.getElementById(arg1).style.display = "block";
}
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/, "");
}
;
var ajaxDepTotal = "";
function callCalCulateAmountURL(chkURL, totalGuests, OandDInd, cabinClass) {
var guestNos;
var guestBags = "";
var thetime = new Date();
var dummy = "" + thetime.getHours() + thetime.getMinutes() + thetime.getSeconds();
if (chkURL == "depURL") {
var guestNos = totalGuests;
for (loop = 0; loop < totalGuests; loop++) {
objname = "checkInTotalBags1.totalBags" + "[" + loop + "]";
objvalue = document.checkInExtraPayForm.elements[objname].value;
guestBags = guestBags + "," + objvalue;
}
}
if (chkURL == "retURL") {
var guestNos = totalGuests;
for (loop = 0; loop < totalGuests; loop++) {
objname = "checkInTotalBags1.bags[" + OandDInd + "].bagsName[" + loop + "]";
objvalue = document.checkInExtraPayForm.elements[objname].value;
guestBags = guestBags + "," + objvalue;
}
}
var myurl = "calulateTotalBagAmount.do?method=calCulateAmount&totalGuest=" + guestNos + "&totalBags=" + guestBags + "&chkUrl=" + chkURL + "&cabinClass=" + cabinClass + "&OandDInd=" + OandDInd;
myurl = myurl + "&dummy=" + dummy;
xmlhttp.open("GET", myurl, true);
xmlhttp.onreadystatechange = handleResponseForAmount;
xmlhttp.send("");
window.focus();
}
function handleResponseForAmount() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
if ((xmlhttp.responseText).trim() == "AjaxSessionTimeOut") {
window.location = "/home.do?method=virginAmerica&sessionState=sessionTimeOut";
} else {
if ((xmlhttp.responseText).indexOf("esc-sign") == -1) {
document.getElementById("loadingAnimationDiv").style.display = "none";
document.getElementById("travelupdate").innerHTML = xmlhttp.responseText;
document.getElementById("errorOnChkInBags").style.display = "none";
document.getElementById("conBtnShow").style.display = "block";
document.getElementById("conBtnHide").style.display = "none";
} else {
document.getElementById("loadingAnimationDiv").style.display = "none";
document.getElementById("errorOnChkInBags").innerHTML = xmlhttp.responseText;
document.getElementById("errorOnChkInBags").style.display = "block";
if (document.checkInExtraPayForm.elements["checkInTotalBags1.totalBags[0]"]) {
for (loop = 0; loop < 10; loop++) {
objname = "checkInTotalBags1.totalBags" + "[" + loop + "]";
if (document.checkInExtraPayForm.elements[objname]) {
document.checkInExtraPayForm.elements[objname].options[0].selected = "selected";
}
}
}
if (document.checkInExtraPayForm.elements["checkInTotalBags1.totalBags1[0]"]) {
for (loop = 0; loop < 10; loop++) {
objname = "checkInTotalBags1.totalBags1" + "[" + loop + "]";
if (document.checkInExtraPayForm.elements[objname]) {
document.checkInExtraPayForm.elements[objname].options[0].selected = "selected";
}
}
}
document.getElementById("conBtnShow").style.display = "none";
document.getElementById("conBtnHide").style.display = "block";
}
}
}
}
}
var checkval = "undefined";
function ShowCheckBags_updated() {
checkInExtraPayForm.submit();
document.getElementById("conBtnShow").style.display = "none";
document.getElementById("conBtnHide").style.display = "block";
}
function setDefaultTab(tabID) {
hide("divVI");
hide("divCHF");
hide("divCF");
show(tabID);
}
var redid = "";
function setDefTab(redid) {
if (redid == "tripid") {
document.getElementById(redid).src = "/web/20110901145833/https://static.virginamerica.com/images/your_trip_red.gif";
}
if (redid == "chid") {
document.getElementById(redid).src = "/web/20110901145833/https://static.virginamerica.com/images/change_flight_red.gif";
}
if (redid == "canid") {
document.getElementById(redid).src = "/web/20110901145833/https://static.virginamerica.com/images/cancel_flight_red.gif";
}
}
var tripid1 = "";
var chid1 = "";
var canid1 = "";
function changePIC(tripid1, chid1, canid1) {
if (typeof (currentTripType) != "undefined") {
currentTripType = tripid1;
}
document.getElementById(tripid1).src = "/web/20110901145833/https://static.virginamerica.com/images/your_trip_grey.gif";
document.getElementById(chid1).src = "/web/20110901145833/https://static.virginamerica.com/images/change_flight_grey.gif";
document.getElementById(canid1).src = "/web/20110901145833/https://static.virginamerica.com/images/cancel_flight_grey.gif";
}
function setDiv(divID) {
document.getElementById("tripid").style.display = "none";
document.getElementById("chid").style.display = "none";
document.getElementById("canid").style.display = "none";
document.getElementById(divID).style.display = "block";
}
function onBackShowPnrHome() {
document.checkInExtraPayForm.method.value = "managePnr";
document.checkInExtraPayForm.action = "yourTrip.do";
document.checkInExtraPayForm.submit();
}
function originRT() {
for (i = 0; i < document.flightSearchRTForm.elements.length; i++) {
elementName = document.flightSearchRTForm.elements[i].name;
if (elementName == "flightSearch.origin") {
for (j = 0; j < document.flightSearchOWForm.elements.length; j++) {
elementName2 = document.flightSearchOWForm.elements[j].name;
if (elementName2 == "flightSearch.origin") {
document.flightSearchOWForm.elements[j].selectedIndex = document.flightSearchRTForm.elements[i].selectedIndex;
break;
}
}
for (k = 0; k < document.flightSearchMCForm.elements.length; k++) {
elementName3 = document.flightSearchMCForm.elements[k].name;
if (elementName3 == "flightSearch.origin") {
document.flightSearchMCForm.elements[k].selectedIndex = document.flightSearchRTForm.elements[i].selectedIndex;
break;
}
}
break;
}
}
}
function DestinationRT() {
for (i = 0; i < document.flightSearchRTForm.elements.length; i++) {
elementName = document.flightSearchRTForm.elements[i].name;
if (elementName == "flightSearch.destination") {
for (j = 0; j < document.flightSearchOWForm.elements.length; j++) {
elementName2 = document.flightSearchOWForm.elements[j].name;
if (elementName2 == "flightSearch.destination") {
document.flightSearchOWForm.elements[j].selectedIndex = document.flightSearchRTForm.elements[i].selectedIndex;
break;
}
}
for (k = 0; k < document.flightSearchMCForm.elements.length; k++) {
elementName3 = document.flightSearchMCForm.elements[k].name;
if (elementName3 == "flightSearch.destination") {
document.flightSearchMCForm.elements[k].selectedIndex = document.flightSearchRTForm.elements[i].selectedIndex;
break;
}
}
break;
}
}
}
function originOW() {
for (i = 0; i < document.flightSearchOWForm.elements.length; i++) {
elementName = document.flightSearchOWForm.elements[i].name;
if (elementName == "flightSearch.origin") {
for (j = 0; j < document.flightSearchRTForm.elements.length; j++) {
elementName2 = document.flightSearchRTForm.elements[j].name;
if (elementName2 == "flightSearch.origin") {
document.flightSearchRTForm.elements[j].selectedIndex = document.flightSearchOWForm.elements[i].selectedIndex;
break;
}
}
for (k = 0; k < document.flightSearchMCForm.elements.length; k++) {
elementName3 = document.flightSearchMCForm.elements[k].name;
if (elementName3 == "flightSearch.origin") {
document.flightSearchMCForm.elements[k].selectedIndex = document.flightSearchOWForm.elements[i].selectedIndex;
break;
}
}
break;
}
}
}
function DestinationOW() {
for (i = 0; i < document.flightSearchOWForm.elements.length; i++) {
elementName = document.flightSearchOWForm.elements[i].name;
if (elementName == "flightSearch.destination") {
for (j = 0; j < document.flightSearchRTForm.elements.length; j++) {
elementName2 = document.flightSearchRTForm.elements[j].name;
if (elementName2 == "flightSearch.destination") {
document.flightSearchRTForm.elements[j].selectedIndex = document.flightSearchOWForm.elements[i].selectedIndex;
break;
}
}
for (k = 0; k < document.flightSearchMCForm.elements.length; k++) {
elementName3 = document.flightSearchMCForm.elements[k].name;
if (elementName3 == "flightSearch.destination") {
document.flightSearchMCForm.elements[k].selectedIndex = document.flightSearchOWForm.elements[i].selectedIndex;
break;
}
}
break;
}
}
}
function originMC() {
for (i = 0; i < document.flightSearchMCForm.elements.length; i++) {
elementName = document.flightSearchMCForm.elements[i].name;
if (elementName == "flightSearch.origin") {
for (j = 0; j < document.flightSearchOWForm.elements.length; j++) {
elementName2 = document.flightSearchOWForm.elements[j].name;
if (elementName2 == "flightSearch.origin") {
document.flightSearchOWForm.elements[j].selectedIndex = document.flightSearchMCForm.elements[i].selectedIndex;
break;
}
}
for (k = 0; k < document.flightSearchRTForm.elements.length; k++) {
elementName3 = document.flightSearchRTForm.elements[k].name;
if (elementName3 == "flightSearch.origin") {
document.flightSearchRTForm.elements[k].selectedIndex = document.flightSearchMCForm.elements[i].selectedIndex;
break;
}
}
break;
}
}
}
function DestinationMC() {
for (i = 0; i < document.flightSearchMCForm.elements.length; i++) {
elementName = document.flightSearchMCForm.elements[i].name;
if (elementName == "flightSearch.destination") {
for (j = 0; j < document.flightSearchOWForm.elements.length; j++) {
elementName2 = document.flightSearchOWForm.elements[j].name;
if (elementName2 == "flightSearch.destination") {
document.flightSearchOWForm.elements[j].selectedIndex = document.flightSearchMCForm.elements[i].selectedIndex;
break;
}
}
for (k = 0; k < document.flightSearchRTForm.elements.length; k++) {
elementName3 = document.flightSearchRTForm.elements[k].name;
if (elementName3 == "flightSearch.destination") {
document.flightSearchRTForm.elements[k].selectedIndex = document.flightSearchMCForm.elements[i].selectedIndex;
break;
}
}
break;
}
}
}
function dateRT() {
for (i = 0; i < document.flightSearchRTForm.elements.length; i++) {
elementName = document.flightSearchRTForm.elements[i].name;
if (elementName == "flightSearch.depDate.MMDDYYYY") {
for (j = 0; j < document.flightSearchOWForm.elements.length; j++) {
elementName2 = document.flightSearchOWForm.elements[j].name;
if (elementName2 == "flightSearch.depDateOW.MMDDYYYY") {
document.flightSearchOWForm.elements[j].value = document.flightSearchRTForm.elements[i].value;
break;
}
}
for (k = 0; k < document.flightSearchMCForm.elements.length; k++) {
elementName3 = document.flightSearchMCForm.elements[k].name;
if (elementName3 == "flightSearch.depDateMC.MMDDYYYY") {
document.flightSearchMCForm.elements[k].value = document.flightSearchRTForm.elements[i].value;
break;
}
}
break;
}
}
}
function dateReturnRT() {
for (i = 0; i < document.flightSearchRTForm.elements.length; i++) {
elementName = document.flightSearchRTForm.elements[i].name;
if (elementName == "flightSearch.returnDate.MMDDYYYY") {
for (k = 0; k < document.flightSearchMCForm.elements.length; k++) {
elementName3 = document.flightSearchMCForm.elements[k].name;
if (elementName3 == "flightSearch.returnDateMC.MMDDYYYY") {
document.flightSearchMCForm.elements[k].value = document.flightSearchRTForm.elements[i].value;
break;
}
}
break;
}
}
}
function dateReturnMC() {
for (i = 0; i < document.flightSearchRTForm.elements.length; i++) {
elementName = document.flightSearchMCForm.elements[i].name;
if (elementName == "flightSearch.returnDateMC.MMDDYYYY") {
for (k = 0; k < document.flightSearchRTForm.elements.length; k++) {
elementName3 = document.flightSearchRTForm.elements[k].name;
if (elementName3 == "flightSearch.returnDate.MMDDYYYY") {
document.flightSearchRTForm.elements[k].value = document.flightSearchMCForm.elements[i].value;
break;
}
}
break;
}
}
}
function dateOW() {
for (i = 0; i < document.flightSearchOWForm.elements.length; i++) {
elementName = document.flightSearchOWForm.elements[i].name;
if (elementName == "flightSearch.depDateOW.MMDDYYYY") {
for (j = 0; j < document.flightSearchRTForm.elements.length; j++) {
elementName2 = document.flightSearchRTForm.elements[j].name;
if (elementName2 == "flightSearch.depDate.MMDDYYYY") {
document.flightSearchRTForm.elements[j].value = document.flightSearchOWForm.elements[i].value;
break;
}
}
for (k = 0; k < document.flightSearchMCForm.elements.length; k++) {
elementName3 = document.flightSearchMCForm.elements[k].name;
if (elementName3 == "flightSearch.depDateMC.MMDDYYYY") {
document.flightSearchMCForm.elements[k].value = document.flightSearchOWForm.elements[i].value;
break;
}
}
break;
}
}
}
function dateMC() {
for (i = 0; i < document.flightSearchMCForm.elements.length; i++) {
elementName = document.flightSearchMCForm.elements[i].name;
if (elementName == "flightSearch.depDateMC.MMDDYYYY") {
for (j = 0; j < document.flightSearchOWForm.elements.length; j++) {
elementName2 = document.flightSearchOWForm.elements[j].name;
if (elementName2 == "flightSearch.depDateOW.MMDDYYYY") {
document.flightSearchOWForm.elements[j].value = document.flightSearchMCForm.elements[i].value;
break;
}
}
for (k = 0; k < document.flightSearchRTForm.elements.length; k++) {
elementName3 = document.flightSearchRTForm.elements[k].name;
if (elementName3 == "flightSearch.depDate.MMDDYYYY") {
document.flightSearchRTForm.elements[k].value = document.flightSearchMCForm.elements[i].value;
break;
}
}
break;
}
}
}
function adultRT() {
for (i = 0; i < document.flightSearchRTForm.elements.length; i++) {
elementName = document.flightSearchRTForm.elements[i].name;
if (elementName == "flightSearch.adults") {
for (j = 0; j < document.flightSearchOWForm.elements.length; j++) {
elementName2 = document.flightSearchOWForm.elements[j].name;
if (elementName2 == "flightSearch.adults") {
document.flightSearchOWForm.elements[j].selectedIndex = document.flightSearchRTForm.elements[i].selectedIndex;
break;
}
}
for (k = 0; k < document.flightSearchMCForm.elements.length; k++) {
elementName3 = document.flightSearchMCForm.elements[k].name;
if (elementName3 == "flightSearch.adults") {
document.flightSearchMCForm.elements[k].selectedIndex = document.flightSearchRTForm.elements[i].selectedIndex;
break;
}
}
break;
}
}
}
function adultOW() {
for (i = 0; i < document.flightSearchOWForm.elements.length; i++) {
elementName = document.flightSearchOWForm.elements[i].name;
if (elementName == "flightSearch.adults") {
for (j = 0; j < document.flightSearchRTForm.elements.length; j++) {
elementName2 = document.flightSearchRTForm.elements[j].name;
if (elementName2 == "flightSearch.adults") {
document.flightSearchRTForm.elements[j].selectedIndex = document.flightSearchOWForm.elements[i].selectedIndex;
break;
}
}
for (k = 0; k < document.flightSearchMCForm.elements.length; k++) {
elementName3 = document.flightSearchMCForm.elements[k].name;
if (elementName3 == "flightSearch.adults") {
document.flightSearchMCForm.elements[k].selectedIndex = document.flightSearchOWForm.elements[i].selectedIndex;
break;
}
}
break;
}
}
}
function adultMC() {
for (i = 0; i < document.flightSearchMCForm.elements.length; i++) {
elementName = document.flightSearchMCForm.elements[i].name;
if (elementName == "flightSearch.adults") {
for (j = 0; j < document.flightSearchOWForm.elements.length; j++) {
elementName2 = document.flightSearchOWForm.elements[j].name;
if (elementName2 == "flightSearch.adults") {
document.flightSearchOWForm.elements[j].selectedIndex = document.flightSearchMCForm.elements[i].selectedIndex;
break;
}
}
for (k = 0; k < document.flightSearchRTForm.elements.length; k++) {
elementName3 = document.flightSearchRTForm.elements[k].name;
if (elementName3 == "flightSearch.adults") {
document.flightSearchRTForm.elements[k].selectedIndex = document.flightSearchMCForm.elements[i].selectedIndex;
break;
}
}
break;
}
}
}
function childRT() {
for (i = 0; i < document.flightSearchRTForm.elements.length; i++) {
elementName = document.flightSearchRTForm.elements[i].name;
if (elementName == "flightSearch.kids") {
for (j = 0; j < document.flightSearchOWForm.elements.length; j++) {
elementName2 = document.flightSearchOWForm.elements[j].name;
if (elementName2 == "flightSearch.kids") {
document.flightSearchOWForm.elements[j].selectedIndex = document.flightSearchRTForm.elements[i].selectedIndex;
break;
}
}
for (k = 0; k < document.flightSearchMCForm.elements.length; k++) {
elementName3 = document.flightSearchMCForm.elements[k].name;
if (elementName3 == "flightSearch.kids") {
document.flightSearchMCForm.elements[k].selectedIndex = document.flightSearchRTForm.elements[i].selectedIndex;
break;
}
}
break;
}
}
}
function childOW() {
for (i = 0; i < document.flightSearchOWForm.elements.length; i++) {
elementName = document.flightSearchOWForm.elements[i].name;
if (elementName == "flightSearch.kids") {
for (j = 0; j < document.flightSearchRTForm.elements.length; j++) {
elementName2 = document.flightSearchRTForm.elements[j].name;
if (elementName2 == "flightSearch.kids") {
document.flightSearchRTForm.elements[j].selectedIndex = document.flightSearchOWForm.elements[i].selectedIndex;
break;
}
}
for (k = 0; k < document.flightSearchMCForm.elements.length; k++) {
elementName3 = document.flightSearchMCForm.elements[k].name;
if (elementName3 == "flightSearch.kids") {
document.flightSearchMCForm.elements[k].selectedIndex = document.flightSearchOWForm.elements[i].selectedIndex;
break;
}
}
break;
}
}
}
function childMC() {
for (i = 0; i < document.flightSearchMCForm.elements.length; i++) {
elementName = document.flightSearchMCForm.elements[i].name;
if (elementName == "flightSearch.kids") {
for (j = 0; j < document.flightSearchOWForm.elements.length; j++) {
elementName2 = document.flightSearchOWForm.elements[j].name;
if (elementName2 == "flightSearch.kids") {
document.flightSearchOWForm.elements[j].selectedIndex = document.flightSearchMCForm.elements[i].selectedIndex;
break;
}
}
for (k = 0; k < document.flightSearchRTForm.elements.length; k++) {
elementName3 = document.flightSearchRTForm.elements[k].name;
if (elementName3 == "flightSearch.kids") {
document.flightSearchRTForm.elements[k].selectedIndex = document.flightSearchMCForm.elements[i].selectedIndex;
break;
}
}
break;
}
}
}
function infantRT() {
for (i = 0; i < document.flightSearchRTForm.elements.length; i++) {
elementName = document.flightSearchRTForm.elements[i].name;
if (elementName == "flightSearch.infants") {
for (j = 0; j < document.flightSearchOWForm.elements.length; j++) {
elementName2 = document.flightSearchOWForm.elements[j].name;
if (elementName2 == "flightSearch.infants") {
document.flightSearchOWForm.elements[j].selectedIndex = document.flightSearchRTForm.elements[i].selectedIndex;
break;
}
}
for (k = 0; k < document.flightSearchMCForm.elements.length; k++) {
elementName3 = document.flightSearchMCForm.elements[k].name;
if (elementName3 == "flightSearch.infants") {
document.flightSearchMCForm.elements[k].selectedIndex = document.flightSearchRTForm.elements[i].selectedIndex;
break;
}
}
break;
}
}
}
function infantOW() {
for (i = 0; i < document.flightSearchOWForm.elements.length; i++) {
elementName = document.flightSearchOWForm.elements[i].name;
if (elementName == "flightSearch.infants") {
for (j = 0; j < document.flightSearchRTForm.elements.length; j++) {
elementName2 = document.flightSearchRTForm.elements[j].name;
if (elementName2 == "flightSearch.infants") {
document.flightSearchRTForm.elements[j].selectedIndex = document.flightSearchOWForm.elements[i].selectedIndex;
break;
}
}
for (k = 0; k < document.flightSearchMCForm.elements.length; k++) {
elementName3 = document.flightSearchMCForm.elements[k].name;
if (elementName3 == "flightSearch.infants") {
document.flightSearchMCForm.elements[k].selectedIndex = document.flightSearchOWForm.elements[i].selectedIndex;
break;
}
}
break;
}
}
}
function infantMC() {
for (i = 0; i < document.flightSearchMCForm.elements.length; i++) {
elementName = document.flightSearchMCForm.elements[i].name;
if (elementName == "flightSearch.infants") {
for (j = 0; j < document.flightSearchOWForm.elements.length; j++) {
elementName2 = document.flightSearchOWForm.elements[j].name;
if (elementName2 == "flightSearch.infants") {
document.flightSearchOWForm.elements[j].selectedIndex = document.flightSearchMCForm.elements[i].selectedIndex;
break;
}
}
for (k = 0; k < document.flightSearchRTForm.elements.length; k++) {
elementName3 = document.flightSearchRTForm.elements[k].name;
if (elementName3 == "flightSearch.infants") {
document.flightSearchRTForm.elements[k].selectedIndex = document.flightSearchMCForm.elements[i].selectedIndex;
break;
}
}
break;
}
}
}
function Get_Cookie(name) {
var start = document.cookie.indexOf(name + "=");
var len = start + name.length + 1;
if ((!start) && (name != document.cookie.substring(0, name.length))) {
return null ;
}
if (start == -1) {
return null ;
}
var end = document.cookie.indexOf(";", len);
if (end == -1) {
end = document.cookie.length;
}
return unescape(document.cookie.substring(len, end));
}
function Set_Cookie(name, value, expires, path, domain, secure) {
var today = new Date();
today.setTime(today.getTime());
if (expires) {
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date(today.getTime() + (expires));
document.cookie = name + "=" + escape(value) + ((expires) ? ";expires=" + expires_date.toGMTString() : "") + ((path) ? ";path=" + path : "") + ((domain) ? ";domain=" + domain : "") + ((secure) ? ";secure" : "");
}
function Delete_Cookie(name, path, domain) {
if (Get_Cookie(name)) {
document.cookie = name + "=" + ((path) ? ";path=" + path : "") + ((domain) ? ";domain=" + domain : "") + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
}
function discookie() {
var gg = Get_Cookie("cv");
}
function MM_swapImgRestore() {
var i, x, a = document.MM_sr;
for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) {
x.src = x.oSrc;
}
}
function MM_preloadImages() {
var d = document;
if (d.images) {
if (!d.MM_p) {
d.MM_p = new Array();
}
var i, j = d.MM_p.length, a = MM_preloadImages.arguments;
for (i = 0; i < a.length; i++) {
if (a[i].indexOf("#") != 0) {
d.MM_p[j] = new Image;
d.MM_p[j++].src = a[i];
}
}
}
}
function MM_findObj(n, d) {
var p, i, x;
if (!d) {
d = document;
}
if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
d = parent.frames[n.substring(p + 1)].document;
n = n.substring(0, p);
}
if (!(x = d[n]) && d.all) {
x = d.all[n];
}
for (i = 0; !x && i < d.forms.length; i++) {
x = d.forms[i][n];
}
for (i = 0; !x && d.layers && i < d.layers.length; i++) {
x = MM_findObj(n, d.layers[i].document);
}
if (!x && d.getElementById) {
x = d.getElementById(n);
}
return x;
}
function MM_swapImage() {
var i, j = 0, x, a = MM_swapImage.arguments;
document.MM_sr = new Array;
for (i = 0; i < (a.length - 2); i += 3) {
if ((x = MM_findObj(a[i])) != null ) {
document.MM_sr[j++] = x;
if (!x.oSrc) {
x.oSrc = x.src;
}
x.src = a[i + 2];
}
}
}
function submitFormForChangeSeat(indxNum, segmentNum, whichFlow, firstClassCutOff) {
showWaitImage();
window.location.href = "showChangeSeatMap.do?method=showSeatMapForChange&tabSelected=" + indxNum + "&activeSegmentIndex=" + segmentNum + "&whichFlow=" + whichFlow + "&firstClassCutOff=" + firstClassCutOff;
}
function replaceAll(st) {
var i = st.length;
for (var m = 0; m < i; m++) {
if (st.indexOf("/") != -1) {
st = st.replace("/", "'");
}
if (st.indexOf("?") != -1) {
st = st.replace("?", '"');
}
}
return st;
}
function showPrintWindow() {
var p = self.print();
return p;
}
var OSDetect = {
init: function() {
this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version";
this.OS = this.searchString(this.dataOS) || "an unknown OS";
},
searchString: function(data) {
for (var i = 0; i < data.length; i++) {
var dataString = data[i].string;
var dataProp = data[i].prop;
this.versionSearchString = data[i].versionSearch || data[i].identity;
if (dataString) {
if (dataString.indexOf(data[i].subString) != -1) {
return data[i].identity;
}
} else {
if (dataProp) {
return data[i].identity;
}
}
}
},
searchVersion: function(dataString) {
var index = dataString.indexOf(this.versionSearchString);
if (index == -1) {
return;
}
return parseFloat(dataString.substring(index + this.versionSearchString.length + 1));
},
dataBrowser: [{
string: navigator.userAgent,
subString: "Chrome",
identity: "Chrome"
}, {
string: navigator.userAgent,
subString: "OmniWeb",
versionSearch: "OmniWeb/",
identity: "OmniWeb"
}, {
string: navigator.vendor,
subString: "Apple",
identity: "Safari"
}, {
prop: window.opera,
identity: "Opera"
}, {
string: navigator.vendor,
subString: "iCab",
identity: "iCab"
}, {
string: navigator.vendor,
subString: "KDE",
identity: "Konqueror"
}, {
string: navigator.userAgent,
subString: "Firefox",
identity: "Firefox"
}, {
string: navigator.vendor,
subString: "Camino",
identity: "Camino"
}, {
string: navigator.userAgent,
subString: "Netscape",
identity: "Netscape"
}, {
string: navigator.userAgent,
subString: "MSIE",
identity: "Explorer",
versionSearch: "MSIE"
}, {
string: navigator.userAgent,
subString: "Gecko",
identity: "Mozilla",
versionSearch: "rv"
}, {
string: navigator.userAgent,
subString: "Mozilla",
identity: "Netscape",
versionSearch: "Mozilla"
}],
dataOS: [{
string: navigator.platform,
subString: "Win",
identity: "Windows"
}, {
string: navigator.platform,
subString: "Mac",
identity: "Mac"
}, {
string: navigator.platform,
subString: "Linux",
identity: "Linux"
}]
};
function callPBPassForHTML(btnId, oandDId, whichlegNo, flightNo, ffNumber, numberInParty, onHome) {
var top = 10;
var left = 180;
var width = 845;
var height = 700;
OSDetect.init();
var guestname;
var urls = "";
if (btnId.indexOf("/") != -1) {
guestname = replaceAll(btnId);
} else {
if (btnId.indexOf("?") != -1) {
guestname = replaceAll(btnId);
} else {
guestname = btnId;
}
}
var osdetect = OSDetect.OS;
var browserdetect = OSDetect.browser;
if (onHome == "onHome") {
urls = "checkInPrintBoardingPassForHtml.do?method=printBoardingPassForSingleGuest&indexNum=";
} else {
urls = "checkInPrintBoardingPassForHtmlSSL.do?method=printBoardingPassForSingleGuest&indexNum=";
}
urls = urls + guestname + "&oandDId=" + oandDId + "&legNo=" + whichlegNo + "&flightNo=" + flightNo + "&ffNumber=" + ffNumber + "&numberInParty=" + numberInParty + "&OSDetect=" + osdetect + "&browserdetect=" + browserdetect;
mywindowForHtml = window.open("/html/Virgin_America_Boarding_Pass.html", "BoardingPass", "toolbar=no,location=no,directories=no,menubar=yes,scrollbars=yes,top=" + top + ", left=" + left + ", width=" + width + ",height=" + height);
ajaxToGeneratePdfHTML(urls);
}
function printAllBoardingPassInHTMLView() {
var top = 10;
var left = 180;
var width = 845;
var height = 700;
OSDetect.init();
var osdetect = OSDetect.OS;
var browserdetect = OSDetect.browser;
var urls = "checkInPrintBoardingPassSSL.do?method=printAllBoardingPassInHTMLView&indexNum=" + "forAllGuest" + "&OSDetect=" + osdetect + "&browserdetect=" + browserdetect;
mywindowForHtml = window.open("/html/Virgin_America_Boarding_Pass.html", "BoardingPass", "toolbar=no,status=yes,menubar=yes,scrollbars=yes,resizable=no, top=" + top + ", left=" + left + ", width=" + width + ",height=" + height);
ajaxToGeneratePdfHTML(urls);
}
function ajaxToGeneratePdfHTML(myurl) {
xmlhttp = new XMLHttpRequest();
var thetime = new Date();
var dummy = "" + thetime.getHours() + thetime.getMinutes() + thetime.getSeconds();
myurl = myurl + "&dummy=" + dummy;
xmlhttp.open("POST", myurl, true);
xmlhttp.onreadystatechange = handleResponsePrintBoardingPassForHTML;
xmlhttp.send("");
}
function handleResponsePrintBoardingPassForHTML() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
var resText = xmlhttp.responseText;
if (resText.trim() == "AjaxSessionTimeOut") {
mywindowForHtml.close();
window.location = "/home.do?method=virginAmerica&sessionState=sessionTimeOut";
} else {
if (resText.trim() == "PrintBoardingPassError") {
mywindowForHtml.close();
if (document.getElementById("PDF_ERROR_MESSAGE_POPUP")) {
document.getElementById("PDF_ERROR_MESSAGE_POPUP").style.display = "block";
}
} else {
var topSSL = 10;
var leftSSL = 180;
var widthSSL = 845;
var heightSSL = 700;
var fileNameUpdated = resText.replace(/[\r\n]/g, "");
var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf("msie") != -1) {
var statusX = "";
do {
statusX = mywindowForHtml.document.readyState;
} while (statusX != "complete");mywindowForHtml.document.getElementById("pdfhtml").innerHTML = fileNameUpdated;
} else {
mywindowForHtml.document.getElementById("pdfhtml").innerHTML = fileNameUpdated;
}
}
}
}
}
}
function showPrintItinerary() {
var pageId = "viewItinerary";
if (s.pageName) {
if (s.pageName.indexOf("View Itinerary") != -1) {
pageId = "viewItinerary";
} else {
if (s.pageName.indexOf("Check-in") != -1) {
pageId = "checkIn";
} else {
if (s.pageName.indexOf("Change Flight") != -1) {
pageId = "changeFlight";
} else {
if (s.pageName.indexOf("Cancel Flight") != -1) {
pageId = "cancelFlight";
}
}
}
}
}
var disp_setting = "toolbar=no,location=no,directories=no,menubar=yes,";
disp_setting += "scrollbars=yes,width=736, height=670, left=0, top=0";
var urls = "checkInPrintItinerary.do?method=printItinerary&pageId=" + pageId;
window.open(urls, "", disp_setting);
}
function insertGuestSeat(num, gu, ss) {
gnum = num;
var ind = num;
var guest = gu;
var seat = ss;
guestArray[ind] = guest;
seatArray[ind] = seat;
}
function insertGuestSeat1(num, gu, ss) {
gnumRet = num;
var ind = num;
var guest = gu;
var seat = ss;
guestArrayRet[ind] = guest;
seatArrayRet[ind] = seat;
}
function insertDepConnectGuestSeat(num, ss) {
seatDepConnectArray[num] = ss;
}
function insertRetConnectGuestSeat(num, ss) {
seatRetConnectArray[num] = ss;
}
function ShowCheckBags1(e) {
checkInBagForm.submit();
}
var thisId;
function CheckInInfoPopUp(buttonId) {
thisId = buttonId;
var X;
var Y;
var c = getAnchorPosition(thisId.id);
X = c.x;
Y = c.y + 25;
document.getElementById("CheckInInFo").style.left = X - 50;
document.getElementById("CheckInInFo").style.top = Y - 30;
document.getElementById("CheckInInFo").style.display = "block";
}
function showElevateExpPopUp(buttonId, popupId) {
getAnchorXY(buttonId);
document.getElementById(popupId).style.left = X1 - 50;
document.getElementById(popupId).style.top = Y1 - 30;
document.getElementById(popupId).style.display = "block";
}
function ShowCheckBags(thisId) {
document.getElementById("CheckInInFo").style.display = "none";
var X;
var Y;
var c = getAnchorPosition(thisId.id);
X = c.x;
Y = c.y + 25;
if (alreadyCheckedInDep == "false") {
if (checkval == "undefined") {
document.checkInBagForm.checkChange.value = "no";
}
checkInBagForm.submit();
} else {
document.getElementById("alreadyCheckedIn").style.left = X - 100;
document.getElementById("alreadyCheckedIn").style.top = Y - 30;
document.getElementById("alreadyCheckedIn").style.display = "block";
}
}
var guestTypeArr = new Array();
var gFNameArr = new Array();
var gLNameArr = new Array();
var ins = 0;
var rins = 0;
var guestNumberInParty = "";
var guestRetNumberInParty = "";
var OandDSize = 0;
function checkInClickIt(thisobj, whichLeg, OandDInd, flightNo, num, numberInParty, guestStatus) {
if (guestStatus == "checkInRestricted") {
setPosition(thisobj, document.getElementById("petSSRMsgId"), -20, 20);
document.getElementById("petSSRMsgId").style.display = "block";
if (thisobj.checked) {
thisobj.checked = false;
}
} else {
var s = new Array();
var checkBoxId = "";
var checkBox = "";
var guestId = "";
var guestObj = "";
var selGuestsId = "";
var selGuests = "";
var seatId = "";
var seatObj = "";
var selSeatsId = "";
var selSeats = "";
var connSeatId = "";
var connSeatObj = "";
var selConnSeatsId = "";
var selConnSeats = "";
var selNumInParId = "";
var selRewNoId = "";
var selEleVAId = "";
var eleVAIdObj = "";
var selRewardNos = "";
var RowNum = "Row" + OandDInd;
var RowNumRet = "Row#" + OandDInd;
var x = document.checkInBagForm;
var guestNumberInParty = "";
var numInPartyId = "";
var guestseqno = "";
var selGTId = "";
var selGTId = "";
var eleGTObj = "";
var guestType = "";
for (i = 0; i < guestSize; i++) {
if (whichLeg == "Depart") {
checkBoxId = "DepRow" + i;
} else {
checkBoxId = "Ret" + RowNum + i;
}
checkBox = document.getElementById(checkBoxId);
if (checkBox != null ) {
if (checkBox.checked) {
checkval = checkBox;
if (whichLeg == "Depart") {
guestId = "depRow#" + i;
seatId = "depSeatRow" + i;
connSeatId = "depSeatConnRow" + i;
selEleVAId = "depEleVARow" + i;
} else {
guestId = "ret" + RowNumRet + i;
seatId = "seat" + RowNum + i;
connSeatId = "seatConn" + RowNum + i;
selEleVAId = "retEleVARow" + OandDInd + i;
}
guestNumberInParty = guestNumberInParty + ";" + numInPartyArray[OandDInd].split(";")[i];
var selGname = gFNameArr[i] + "_" + gLNameArr[i];
selGuests = selGuests + ";" + selGname;
seatObj = document.getElementById(seatId).innerHTML;
selSeats = selSeats + ";" + seatObj;
if (document.getElementById(connSeatId)) {
connSeatObj = document.getElementById(connSeatId).innerHTML;
selConnSeats = selConnSeats + ";" + connSeatObj;
}
if (document.getElementById(selEleVAId)) {
eleVAIdObj = document.getElementById(selEleVAId).innerHTML;
selRewardNos = selRewardNos + ";" + eleVAIdObj;
} else {
selRewardNos = selRewardNos + ";" + " ";
}
guestType = guestType + ";" + guestTypeArr[i];
document.checkInBagForm.checkChange.value = "checked";
}
}
}
if (whichLeg == "Depart") {
selGuestsId = "checkInTotalBags.depLeg1";
selSeatsId = "checkInTotalBags.depLeg1Seat";
selConnSeatsId = "checkInTotalBags.depLeg2Seat";
numInPartyId = "checkInTotalBags.strDepNumberInParty";
selRewNoId = "checkInTotalBags.rewNumDep";
selGTId = "checkInTotalBags.depGuestType";
x.elements[selGTId].value = guestType;
x.elements[numInPartyId].value = guestNumberInParty;
} else {
selGuestsId = "checkInTotalBags.selGuests[" + (OandDInd - 1) + "]";
selSeatsId = "checkInTotalBags.selSeats[" + (OandDInd - 1) + "]";
selConnSeatsId = "checkInTotalBags.selConnSeats[" + (OandDInd - 1) + "]";
selNumInParId = "checkInTotalBags.selNumInParty[" + (OandDInd - 1) + "]";
selRewNoId = "checkInTotalBags.selRewNos[" + (OandDInd - 1) + "]";
selGTId = "checkInTotalBags.selGuestType[" + (OandDInd - 1) + "]";
x.elements[selGTId].value = guestType;
x.elements[selNumInParId].value = guestNumberInParty;
}
x.elements[selGuestsId].value = selGuests;
x.elements[selSeatsId].value = selSeats;
if (document.getElementById(connSeatId)) {
x.elements[selConnSeatsId].value = selConnSeats;
}
x.elements["checkInTotalBags.depSelect"].value = "notSelect";
if (whichLeg != "Depart") {
x.elements["checkInTotalBags.retSelect"].value = "notSelect";
}
x.elements[selRewNoId].value = selRewardNos;
for (i = 0; i < OandDSize; i++) {
for (k = 0; k < guestSize; k++) {
if (i == 0) {
checkBoxId = "DepRow" + k;
} else {
checkBoxId = "RetRow" + i + k;
}
checkBox = document.getElementById(checkBoxId);
if (checkBox != null ) {
if (checkBox.checked) {
if (i == 0) {
x.elements["checkInTotalBags.depSelect"].value = "select";
} else {
x.elements["checkInTotalBags.retSelect"].value = "select";
}
break;
}
}
}
}
if (x.elements["checkInTotalBags.depSelect"].value == "notSelect" && (x.elements["checkInTotalBags.retSelect"].value == "notSelect" || x.elements["checkInTotalBags.retSelect"].value == "")) {
checkval = "undefined";
}
}
}
function disable(tabId) {
document.getElementById(tabId).innerHTML = "<img src='/web/20110901145833/https://static.virginamerica.com/images/Travel_mng_red.gif'/>";
}
function hide(arg) {
document.getElementById(arg).style.display = "none";
}
function show(arg1) {
document.getElementById(arg1).style.display = "block";
}
function setDefaultTab(tabID) {
hide("divVI");
hide("divCHF");
hide("divCF");
show(tabID);
}
var redid = "";
function setDefTab(redid) {
if (redid == "tripid") {
document.getElementById(redid).src = "/web/20110901145833/https://static.virginamerica.com/images/your_trip_red.gif";
}
if (redid == "chid") {
document.getElementById(redid).src = "/web/20110901145833/https://static.virginamerica.com/images/change_flight_red.gif";
}
if (redid == "canid") {
document.getElementById(redid).src = "/web/20110901145833/https://static.virginamerica.com/images/cancel_flight_red.gif";
}
}
var tripid1 = "";
var chid1 = "";
var canid1 = "";
function changePIC(tripid1, chid1, canid1) {
document.getElementById(tripid1).src = "/web/20110901145833/https://static.virginamerica.com/images/your_trip_grey.gif";
document.getElementById(chid1).src = "/web/20110901145833/https://static.virginamerica.com/images/change_flight_grey.gif";
document.getElementById(canid1).src = "/web/20110901145833/https://static.virginamerica.com/images/cancel_flight_grey.gif";
}
function setDiv(divID) {
document.getElementById("tripid").style.display = "none";
document.getElementById("chid").style.display = "none";
document.getElementById("canid").style.display = "none";
document.getElementById(divID).style.display = "block";
}
function ajaxPnrDisplay(myurl, div, id) {
ajaxDiv = div;
if (ajaxDiv == "body") {
showWaitImage();
}
showWaitImage();
xmlhttp = new XMLHttpRequest();
var thetime = new Date();
var dummy = "" + thetime.getHours() + thetime.getMinutes() + thetime.getSeconds();
myurl = myurl + "&dummy=" + dummy;
ajaxDiv = div;
xmlhttp.open("POST", myurl, true);
xmlhttp.onreadystatechange = handleResponsePnrDisplay;
xmlhttp.send("");
}
function handleResponsePnrDisplay() {
var ind = -1;
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
var PNRResponseText = xmlhttp.responseText;
document.getElementById("loadingAnimationDiv").style.display = "none";
if (PNRResponseText.trim() == "AjaxSessionTimeOut") {
window.location = "/home.do?method=virginAmerica&sessionState=sessionTimeOut";
} else {
if (PNRResponseText.search("btn_find_flight.gif") == -1) {
document.getElementById(ajaxDiv).innerHTML = PNRResponseText;
if (ajaxDiv == "chkInRightBarError") {
document.getElementById(ajaxDiv).innerHTML = PNRResponseText;
ajaxPnrDisplay("upadteRightBarWithAjax.do?method=updateRightBarAjax", "chkInRightBarError");
} else {
if (ajaxDiv == "body") {
ajaxPnrDisplay("postUpdateTitleBar.do?method=updateTitleBar", "postTitleBarDiv");
}
}
} else {
document.getElementById("chkInRightBarError").innerHTML = PNRResponseText;
}
}
}
}
}
function ajaxPnrDisplayForPoints(myurl, div, id) {
if (div == "body") {
showWaitImage();
}
$("#" + div).load(myurl, "", done);
function done() {
document.getElementById("loadingAnimationDiv").style.display = "none";
if (div == "body") {
ajaxPnrDisplayPoints("postUpdateTitleBar.do?method=updateTitleBar", "postTitleBarDiv");
}
}
}
var windowObject = "";
function sendEmailPNRResult(pnrNumber, linkId) {
ajaxEmailPNRResult(pnrNumber, linkId);
linkId = linkId;
showWaitImage();
}
var email;
function sendEmail() {
showWaitImage();
email = document.getElementById("viewItineraryEmail").value;
var pnrNumber = document.getElementById("pnrNumber").value;
var includeBillingInfo = document.getElementById("viewItineraryEmailBilling").checked;
var linkId = "sendEmilId";
ajaxEmailPNRResult(pnrNumber, email, linkId, includeBillingInfo);
}
function closeSendEmailPopUp(arg) {
document.getElementById(arg).style.display = "none";
}
function ajaxEmailPNRResult(pnrNumber, email, linkId, includeBillingInfo) {
xmlhttp = new XMLHttpRequest();
var thetime = new Date();
var dummy = "" + thetime.getHours() + thetime.getMinutes() + thetime.getSeconds();
if (includeBillingInfo == true) {
var myUrl = "printUniversalReceipt.do?method=printUniversalReceipt&pnrNumber=" + pnrNumber + "&emailId=" + email + "&includeBillingInfo=" + includeBillingInfo;
} else {
var myUrl = "sendEmailItinerary.do?method=sendEmailItinerary&pnrNumber=" + pnrNumber + "&emailId=" + email + "&includeBillingInfo=" + includeBillingInfo;
}
myUrl = myUrl + "&dummy=" + dummy;
ajaxDiv = linkId;
xmlhttp.open("POST", myUrl, true);
xmlhttp.onreadystatechange = handleResponseEmailPNRResult;
xmlhttp.send("");
}
function handleResponseEmailPNRResult() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
if ((xmlhttp.responseText).trim() == "Success") {
popupOverlay("popup-emailItinerary-confirm.jsp", "Email Itinerary &amp; Receipt", 350, this, false, 0, 0, false, email);
} else {
popupOverlay("popup-emailItinerary-error.jsp", "Email Itinerary &amp; Receipt", 350, this, false, 0, 0, false);
}
closeWaitImage();
}
}
}
function addEvent(elm, evType, fn, useCapture) {
if (elm.addEventListener) {
elm.addEventListener(evType, fn, useCapture);
return true;
} else {
if (elm.attachEvent) {
var r = elm.attachEvent("on" + evType, fn);
return r;
} else {
elm["on" + evType] = fn;
}
}
}
function setFocusOnBtn() {
if (document.getElementById("divRT").style.display == "block") {
document.getElementById("RoundWaySearch").focus();
}
}
function setFocusOnBtnForOW() {
if (document.getElementById("divOW").style.display == "block") {
document.getElementById("OneWaySearch").focus();
}
}
function setFocusOnBtnForMC() {
if (document.getElementById("divMC").style.display == "block") {
document.getElementById("MultiSearch").focus();
}
}
function loadDivForCookie() {
if (getCookie("TT") == "rt" || getCookie("TT") == null ) {
changeTabImg("rt");
wichSelected = "divRT";
setDefaultTab("divRT");
} else {
if (getCookie("TT") == "ow") {
changeTabImg("ow");
wichSelected = "divOW";
setDefaultTab("divOW");
} else {
if (getCookie("TT") == "mc") {
changeTabImg("mc");
wichSelected = "divMC";
setDefaultTab("divMC");
}
}
}
}
function checkDate(datevalue) {
var date = "";
for (j = 0; j < document.flightSearchRTForm.elements.length; j++) {
if (document.flightSearchRTForm.elements[j].name == datevalue) {
date = document.flightSearchRTForm.elements[j].value;
break;
}
}
var index = j;
s;
if ((date.length == 2) || (date.length == 5)) {
var separator = "/";
date = date.concat(separator);
document.flightSearchRTForm.elements[index].value = date;
}
}
function changeContent() {
document.getElementById("BF_collopse").background = "/web/20110901145833/https://static.virginamerica.com/images/Title_book_flights_expanded.gif";
var x = document.getElementById("BF_table").rows[1].cells;
x[0].innerHTML = "<img src='/web/20110901145833/https://static.virginamerica.com/images/title_bookflight_footer.gif'/>";
}
var browserType;
if (document.layers) {
browserType = "nn4";
}
if (document.all) {
browserType = "ie";
}
if (window.navigator.userAgent.toLowerCase().match("gecko")) {
browserType = "gecko";
}
function hide(arg2) {
if (browserType == "gecko") {
document.poppedLayer = eval("document.getElementById(arg2)");
} else {
if (browserType == "ie") {
document.poppedLayer = eval("document.all[arg2]");
} else {
document.poppedLayer = eval("document.layers[arg2]");
}
}
document.poppedLayer.style.display = "none";
}
function show(arg2) {
if (browserType == "gecko") {
document.poppedLayer = eval("document.getElementById(arg2)");
} else {
if (browserType == "ie") {
document.poppedLayer = eval("document.all[arg2]");
} else {
document.poppedLayer = eval("document.layers[arg2]");
}
}
document.poppedLayer.style.display = "block";
}
function setDefaultTab(tabID) {
tabVal = tabID;
if (document.getElementById("homeErrorMessageDiv")) {
if (wichSelected != tabID) {
document.getElementById("homeErrorMessageDiv").style.display = "none";
} else {
document.getElementById("homeErrorMessageDiv").style.display = "block";
}
}
hide("divRT");
hide("divOW");
hide("divMC");
show(tabID);
}
function setFormFareType(tabID) {
var thisForm = null ;
if (formTripType == "rt") {
thisForm = "flightSearchRTForm";
}
if (formTripType == "ow") {
thisForm = "flightSearchOWForm";
}
if (formTripType == "mc") {
thisForm = "flightSearchMCForm";
}
if (eval("document." + thisForm)) {
var formVal = eval("document." + thisForm + ".elements['flightSearch.fareFormatType'].value");
if (tabID == "rt") {
thisForm = "flightSearchRTForm";
}
if (tabID == "ow") {
thisForm = "flightSearchOWForm";
}
if (tabID == "mc") {
thisForm = "flightSearchMCForm";
}
var obj = eval("document." + thisForm + ".elements['flightSearch.fareFormatType']");
obj.value = formVal;
}
}
function changePIC(tabID, nameIMG) {
if (typeof (currentTripType) != "undefined") {
currentTripType = tabID;
}
var obj;
document.getElementById("rt").className = "flightOptionRTDefault";
document.getElementById("ow").className = "flightOptionOWDefault";
document.getElementById("mc").className = "flightOptionMCDefault";
obj = document.getElementById("rta");
obj.disabled = false;
obj.style.cursor = "pointer";
obj = document.getElementById("owa");
obj.disabled = false;
obj.style.cursor = "pointer";
obj = document.getElementById("mca");
obj.disabled = false;
obj.style.cursor = "pointer";
document.getElementById(tabID).className = nameIMG;
obj = document.getElementById(tabID + "a");
obj.style.cursor = "text";
obj.disabled = true;
if (formTripType) {
setFormFareType(tabID);
}
if (document.getElementById("searchPromoCode")) {
if (document.getElementById("searchPromoCode").style.display = "block") {
document.getElementById("searchPromoCode").style.display = "none";
}
}
}
function changePICT(tabID, nameIMG) {
var obj;
document.getElementById("rt").src = "/web/20110901145833/https://static.virginamerica.com/images/tab_rt1_default.gif";
document.getElementById("ow").src = "/web/20110901145833/https://static.virginamerica.com/images/tab_ow1_default.gif";
document.getElementById("mc").src = "/web/20110901145833/https://static.virginamerica.com/images/tab_mc1_default.gif";
obj = document.getElementById("rt").parentNode;
obj.disabled = false;
obj.style.cursor = "pointer";
obj = document.getElementById("ow").parentNode;
obj.disabled = false;
obj.style.cursor = "pointer";
obj = document.getElementById("mc").parentNode;
obj.disabled = false;
obj.style.cursor = "pointer";
document.getElementById(tabID).src = nameIMG;
obj = document.getElementById(tabID).parentNode;
obj.style.cursor = "text";
obj.disabled = true;
if (document.getElementById("searchPromoCode")) {
if (document.getElementById("searchPromoCode").style.display = "block") {
document.getElementById("searchPromoCode").style.display = "none";
}
}
}
function changeImageOnMouseOverOrOut(obj, IMG) {
obj.src = IMG;
}
function resetDiv(divID) {
document.getElementById("divRT").style.display = "none";
document.getElementById("divOW").style.display = "none";
document.getElementById("divMC").style.display = "none";
document.getElementById(divID).style.display = "block";
}
function loadDataFromCookies() {
for (j = 0; j < document.flightSearchRTForm.elements.length; j++) {
var obj = document.flightSearchRTForm.elements[j];
if (obj.name == "flightSearch.origin") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
} else {
if (obj.name == "flightSearch.destination") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
} else {
if (obj.name == "flightSearch.depDate.MMDDYYYY") {
obj.value = ((getCookie(obj.name) != null ) && (Date.parse(getCookie(obj.name)) >= (Date.parse(new Date()) - 24 * 60 * 60 * 1000))) ? getCookie(obj.name) : (obj.value);
} else {
if (obj.name == "flightSearch.returnDate.MMDDYYYY") {
obj.value = ((getCookie(obj.name) != null ) && (Date.parse(getCookie(obj.name)) >= (Date.parse(new Date()) - 24 * 60 * 60 * 1000))) ? getCookie(obj.name) : (obj.value);
} else {
if (obj.name == "flightSearch.adults") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
} else {
if (obj.name == "flightSearch.kids") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
} else {
if (obj.name == "flightSearch.infants") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
}
}
}
}
}
}
}
}
for (j = 0; j < document.flightSearchOWForm.elements.length; j++) {
var obj = document.flightSearchOWForm.elements[j];
if (obj.name == "flightSearch.origin") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
} else {
if (obj.name == "flightSearch.destination") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
} else {
if (obj.name == "flightSearch.depDateOW.MMDDYYYY") {
obj.value = ((getCookie(obj.name) != null ) && (Date.parse(getCookie(obj.name)) >= (Date.parse(new Date()) - 24 * 60 * 60 * 1000))) ? getCookie(obj.name) : (obj.value);
} else {
if (obj.name == "flightSearch.adults") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
} else {
if (obj.name == "flightSearch.kids") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
} else {
if (obj.name == "flightSearch.infants") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
}
}
}
}
}
}
}
for (j = 0; j < document.flightSearchMCForm.elements.length; j++) {
var obj = document.flightSearchMCForm.elements[j];
if (obj.name == "flightSearch.origin") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
} else {
if (obj.name == "flightSearch.destination") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
} else {
if (obj.name == "flightSearch.depDateMC.MMDDYYYY") {
obj.value = ((getCookie(obj.name) != null ) && (Date.parse(getCookie(obj.name)) >= (Date.parse(new Date()) - 24 * 60 * 60 * 1000))) ? getCookie(obj.name) : (obj.value);
} else {
if (obj.name == "flightSearch.originMC") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
} else {
if (obj.name == "flightSearch.destinationMC") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
} else {
if (obj.name == "flightSearch.returnDateMC.MMDDYYYY") {
obj.value = ((getCookie(obj.name) != null ) && (Date.parse(getCookie(obj.name)) >= (Date.parse(new Date()) - 24 * 60 * 60 * 1000))) ? getCookie("flightSearch.returnDate.MMDDYYYY") : (obj.value);
} else {
if (obj.name == "flightSearch.adults") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
} else {
if (obj.name == "flightSearch.kids") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
} else {
if (obj.name == "flightSearch.infants") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
}
}
}
}
}
}
}
}
}
}
}
function loadFlightStatusDataFromCookies() {
for (j = 0; j < document.flightStatusForm.elements.length; j++) {
var obj = document.flightStatusForm.elements[j];
if (obj.name == "flightStatus.flightDate") {
if (getCookie(obj.name) != null ) {
obj.selectedIndex = getCookie(obj.name);
}
} else {
if (obj.name == "flightStatus.flightNumber") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
} else {
if (obj.name == "flightStatus.origin") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
} else {
if (obj.name == "flightStatus.destination") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
}
}
}
}
}
}
function getCookie(name) {
var dcookie = document.cookie;
var cname = name + "=";
var clen = dcookie.length;
var cbegin = 0;
while (cbegin < clen) {
var vbegin = cbegin + cname.length;
if (dcookie.substring(cbegin, vbegin) == cname) {
var vend = dcookie.indexOf(";", vbegin);
if (vend == -1) {
vend = clen;
}
return unescape(dcookie.substring(vbegin, vend));
}
cbegin = dcookie.indexOf(" ", cbegin) + 1;
if (cbegin == 0) {
break;
}
}
return null ;
}
function checkformRail(o_form) {
s_action = "";
a_radio = o_form.railoption;
for (var i = 0; i < a_radio.length; i++) {
if (a_radio[i].checked) {
s_action = a_radio[i].value;
}
}
window.location = s_action;
}
function closeDivSign(divIdForClose) {
if (document.getElementById(divIdForClose)) {
document.getElementById(divIdForClose).style.display = "none";
}
if (loginModuleOrRest == "restLogin") {
if (document.getElementById("submitForgot")) {
document.getElementById("submitForgot").href = "javascript:createURLandSubmit('forgetPasswordRestModule');";
}
}
if (divIdForClose == "editForm") {
closeDivSign("deleteFromDBMsgBox");
}
}
function openWindowForReViewItinerary(openUrl) {
var top = 50;
var left = 200;
var width = 770;
var height = 680;
window.open(openUrl, "", "toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no, top=" + top + ", left=" + left + ", width=" + width + ",height=" + height);
}
function onChangeLogin(tObj) {
logInVal = tObj.value;
}
function logOut() {
document.goProfileHome.action = "/logOut.do";
document.goProfileHome.method.value = "logOut";
document.goProfileHome.submit();
}
function createURLandSubmit(method, fltMethod) {
var url = "";
var i = 0;
if (method == "forgetPassword") {
url = "/forgetPassword.do?divNo=1&fltMethod=" + fltMethod + "&";
setObjOffset(document.getElementById("placeToOpenDiv"), document.getElementById("SignIn"), 0, 0);
for (i = 0; i < document.forgetPasswordForm.elements.length; i++) {
url = url + document.forgetPasswordForm.elements[i].name + "=" + document.forgetPasswordForm.elements[i].value;
if (i != (document.forgetPasswordForm.elements.length - 1)) {
url = url + "&";
}
}
url = url + "&loginId=" + document.getElementById("EmailAddress").value;
showWaitImage();
ajaxProfile(url, "SignIn");
}
if (method == "forgetPasswordRestModule") {
url = "/forgetPassword.do?divNo=1&fltMethod=" + fltMethod + "&";
setObjOffset(document.getElementById("openForgotPassword"), document.getElementById("SignIn"), 0, 0);
for (i = 0; i < document.forgetPasswordForm.elements.length; i++) {
url = url + document.forgetPasswordForm.elements[i].name + "=" + document.forgetPasswordForm.elements[i].value;
if (i != (document.forgetPasswordForm.elements.length - 1)) {
url = url + "&";
}
}
url = url + "&loginId=" + document.getElementById("EmailAddress").value;
showWaitImage();
ajaxProfileInRestModules(url, "SignIn");
}
if (method == "changePassword") {
url = "/changePassword.do?divNo=2&fltMethod=" + fltMethod + "&";
for (i = 0; i < document.changePasswordForm.elements.length; i++) {
url = url + document.changePasswordForm.elements[i].name + "=" + document.changePasswordForm.elements[i].value;
if (i != (document.changePasswordForm.elements.length - 1)) {
url = url + "&";
}
}
showWaitImage();
ajaxProfile(url, "SignIn");
}
}
function goToRegisterPageFromCompanion() {
document.goProfileHome.action = "goForCompanionRegister.do";
document.goProfileHome.method.value = "logOut";
document.goProfileHome.submit();
}
var isOk = false;
var isAnswered = false;
var funcName = "";
var divId2Delete = "";
var indexVal = "";
function confirmationBeforeDelete(whereOpen, whichData, funcname, divid2Delete, indexval) {
funcName = funcname;
divId2Delete = divid2Delete;
indexVal = indexval;
var wObj = document.getElementById("deleteFromDBMsgBox");
setPosition(whereOpen, wObj, 160, 0);
wObj.style.display = "block";
}
function retOkVal() {
isOk = true;
deleteVal();
closeDivSign("deleteFromDBMsgBox");
return isOk;
}
function deleteVal() {
if (isOk) {
str = funcName + "('" + divId2Delete + "','" + indexVal + "')";
eval(str);
}
}
function openPreAndNext(responseDiv, moveType) {
var url = "";
url = "nextAndPreviousAccountAction.do?method=nextAndPreviousAccountInfo&moveType=" + moveType;
ajaxProfile(url, responseDiv);
}
function openPreAndNextPoints(responseDiv, moveType) {
var url = "";
url = "nextAndPreviousAccountActionPoints.do?method=nextAndPreviousAccountInfoPoints&moveType=" + moveType;
ajaxProfile(url, responseDiv);
}
function openPreAndNextFF(responseDiv, moveType, currentNo) {
var url = "";
if (responseDiv == "futureFltDiv") {
url = "nextAndPreviousFutureFlightAction.do?method=nextAndPreviousFutureFlightInfo&moveType=" + moveType + "&currentPageNo=" + currentNo + "&divId=" + responseDiv;
} else {
url = "nextAndPreviousFutureFlightAction.do?method=nextAndPreviousFutureFlightInfo&moveType=" + moveType + "&currentPageNo=" + currentNo + "&divId=";
}
ajaxProfile(url, responseDiv);
}
var activityFirstDataInd;
var activitySecDataInd;
var activityPastDataInd;
function openPreAndNextActivity(responseDiv, moveType, currentNo) {
var url = "";
url = "nextAndPreviousElevateActivityAction.do?method=nextAndPreviousElevateActivityInfo&moveType=" + moveType + "&currentPageNo=" + currentNo;
ajaxProfile(url, responseDiv);
}
function populateActivityData(sortBtnId, responseDiv) {
activityFirstDataInd = document.signInForm.activityFirstData.selectedIndex;
activitySecDataInd = document.signInForm.activitySecData.selectedIndex;
activityPastDataInd = document.signInForm.activityPastData.selectedIndex;
var activityFirstData = document.signInForm.activityFirstData.value;
var activitySecData = document.signInForm.activitySecData.value;
var activityPastData = document.signInForm.activityPastData.value;
showWaitImage();
url = "nextAndPreviousElevateActivityAction.do?method=populateSelectedData&activityFirstData=" + activityFirstData + "&activitySecData=" + activitySecData + "&activityPastData=" + activityPastData;
ajaxProfile(url, responseDiv);
}
function openDivForSignIn(obj1, divNo, fltMethod) {
var myUrl = "";
obj1 = document.getElementById("placeToOpenDiv");
loginModuleOrRest = "login";
setPosition(obj1, document.getElementById("SignIn"), 5, 20);
if (document.getElementById("trSignIn").style.display != "none") {
document.getElementById("trSignIn").style.display = "none";
}
if (document.getElementById("SignIn").style.display != "none") {
document.getElementById("SignIn").style.display = "none";
}
myUrl = "/signIn.jsp?divNo=" + divNo + "&fltMethod=" + fltMethod + "&loginName=" + logInVal;
if (fltMethod != "undefined") {
ajaxProfile(myUrl, "SignIn");
}
}
function openDivForSignInInRestModules(obj1, divNo) {
var myUrl = "";
loginModuleOrRest = "restLogin";
if (obj1.id == "CheckInopenForgotPassword" || obj1.id == "ChangeFlightopenForgotPassword" || obj1.id == "CancelFlightopenForgotPassword") {
document.getElementById("SignIn").style.top = $("#forgotpass").offset().top + "px";
document.getElementById("SignIn").style.left = $("#forgotpass").offset().left + "px";
} else {
setObjOffset(obj1, document.getElementById("SignIn"), 0, 0);
}
myUrl = "/signIn.jsp?divNo=" + divNo + "&loginName=" + logInVal;
if (document.getElementById("SignIn").style.display != "none") {
document.getElementById("SignIn").style.display = "none";
}
ajaxProfileInRestModules(myUrl, "SignIn");
}
function ajaxProfileInRestModules(myurl, div1) {
xmlhttp = new XMLHttpRequest();
var thetime = new Date();
var dummy = "" + thetime.getHours() + thetime.getMinutes() + thetime.getSeconds();
myurl = myurl + "&dummy=" + dummy;
ajaxDiv = div1;
xmlhttp.open("POST", myurl, true);
chkURL = myurl;
xmlhttp.onreadystatechange = handleResponseInRestModules;
xmlhttp.send("");
}
var chkURL = "";
function handleResponseInRestModules() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
document.getElementById(ajaxDiv).innerHTML = xmlhttp.responseText;
if (document.getElementById("submitForgot") != null ) {
document.getElementById("submitForgot").href = "javascript:createURLandSubmit('forgetPasswordRestModule');";
}
document.getElementById(ajaxDiv).style.display = "block";
if (document.getElementById("submitForgot") != null && document.getElementById("closeHref")) {
document.getElementById("closeHref").href = "javascript:closeDivSign('SignIn');";
}
if (document.getElementById("submitForgot") != null ) {
document.getElementById("cancleHref").href = "javascript:closeDivSign('SignIn');";
}
if (document.getElementById("submitForgot") != null ) {
document.getElementById("changeImage").style.backgroundImage = "";
}
closeWaitImage();
}
}
}
function openDivForEdit(objEditId, idObjID, urlToOpen) {
var myUrl;
var divN = objEditId;
var idObj = document.getElementById(idObjID);
var objEdit = document.getElementById(objEditId);
if (!(divN == "divPI" || divN == "divTD" || divN == "divPass" || divN == "divAdd" || divN == "divCCI" || divN == "divFP" || divN == "divTC" || divN == "divIT")) {
closeDivSign("deleteFromDBMsgBox");
showWaitImage();
} else {
closeWaitImage();
}
getAnchorXY(idObjID);
objEdit.style.left = X1 - 250;
objEdit.style.top = Y1 + 10;
if (objEdit.id == "accountDivDisplay") {
setPosition(idObj, objEdit, 0, 200);
}
objEdit.style.display = "block";
myUrl = urlToOpen;
ajaxProfile(myUrl, objEdit.id);
}
function openDivForEditUpdated(objEdit, idObj, urlToOpen) {
var myUrl;
var divN = objEdit.id;
if (!(divN == "divPI" || divN == "divPass" || divN == "divAdd" || divN == "divCCI" || divN == "divFP" || divN == "divTC" || divN == "divIT" || divN == "OptIn")) {
closeDivSign("deleteFromDBMsgBox");
objEdit.innerHTML = "";
} else {
document.getElementById("editForm").innerHTML = "";
}
if (objEdit.id == "accountDivDisplay") {
setPosition(idObj, objEdit, 0, 200);
}
objEdit.style.display = "block";
myUrl = urlToOpen;
showWaitImage();
ajaxProfileUpdated(myUrl, objEdit.id);
}
function ajaxProfileForPassword(myurl, div1) {
xmlhttp = new XMLHttpRequest();
var thetime = new Date();
var dummy = "" + thetime.getHours() + thetime.getMinutes() + thetime.getSeconds();
myurl = myurl + "&dummy=" + dummy;
ajaxDiv = div1;
xmlhttp.open("POST", myurl, true);
chkURL = myurl;
xmlhttp.onreadystatechange = handleResponseForPassword;
xmlhttp.send("");
}
function handleResponseForPassword() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
document.getElementById(ajaxDiv).innerHTML = xmlhttp.responseText;
document.getElementById(ajaxDiv).style.display = "block";
enablePage();
if ((ajaxDiv == "divPI" || ajaxDiv == "divPass" || ajaxDiv == "divAdd" || ajaxDiv == "divCCI" || ajaxDiv == "divFP" || ajaxDiv == "divTC" || ajaxDiv == "divIT" || ajaxDiv == "OptIn") ) {
document.getElementById("editForm").style.display = "none";
}
}
}
}
function disablePage() {
document.getElementById("disableTotalPage").style.top = 0;
document.getElementById("disableTotalPage").style.left = 0;
document.getElementById("disableTotalPage").style.height = getXandY($get_JsElement("ContainerFooter")).y;
document.getElementById("disableTotalPage").style.width = 1050;
document.getElementById("disableTotalPage").style.display = "block";
}
function enablePage() {
if (document.getElementById("disableTotalPage")) {
document.getElementById("disableTotalPage").style.display = "none";
}
}
function clearCheckBox() {
for (i = 0; i < document.modifyProfileForm.elements.length; i++) {
var chkObj = document.modifyProfileForm.elements[i];
if (chkObj.name == "interestVal") {
chkObj.checked = false;
}
}
}
function ajaxProfile(myurl, div1) {
xmlhttp = new XMLHttpRequest();
var thetime = new Date();
var dummy = "" + thetime.getHours() + thetime.getMinutes() + thetime.getSeconds();
myurl = myurl + "&dummy=" + dummy;
ajaxDiv = div1;
xmlhttp.open("POST", myurl, true);
chkURL = myurl;
xmlhttp.onreadystatechange = handleResponse;
xmlhttp.send("");
}
function ajaxProfileUpdated(myurl, div1) {
myurl = encodeURI(myurl);
$("#" + div1).load(myurl, "", done);
enablePage();
function done() {
if ((div1 == "divPI" || div1 == "divPass" || div1 == "divAdd" || div1 == "divCCI" || div1 == "divFP" || div1 == "divTC" || div1 == "divIT" || div1 == "OptIn") ) {
document.getElementById("editForm").style.display = "none";
}
closeWaitImage();
}
}
function ajaxProfileAlt(myurl, div1) {
$("#" + div1).load(myurl, "", done);
enablePage();
function done() {}
}
var chkURL = "";
function handleResponse() {
var h = 0;
var ind = 0;
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
if ((xmlhttp.responseText).trim() == "AjaxSessionTimeOut") {
window.location = "/home.do?method=virginAmerica&sessionState=sessionTimeOut";
} else {
if ((xmlhttp.responseText).search("bg_ForgetPassword") != -1) {
ind = (xmlhttp.responseText).search("bg_ForgetPassword");
} else {
if ((xmlhttp.responseText).search("bg_Sign-in") != -1) {
ind = (xmlhttp.responseText).search("bg_Sign-in");
}
}
}
if ((xmlhttp.responseText).substring(ind, ind + 10) == "bg_Sign-in") {
h = 104;
} else {
if ((xmlhttp.responseText).substring(ind, ind + 17) == "bg_ForgetPassword") {
h = 142;
}
}
if ((xmlhttp.responseText).search("PasswordResetEmailSent") != -1) {
var s = s_gi(setOmnitureEnv());
s.linkTrackVars = "events";
s.linkTrackEvents = "event27";
s.events = "event27";
s.tl(true, "o", "Forgot Password");
}
if (loginModuleOrRest == "restLogin") {
h = 0;
}
document.getElementById(ajaxDiv).innerHTML = xmlhttp.responseText;
document.getElementById(ajaxDiv).style.display = "block";
enablePage();
if (loginModuleOrRest == "restLogin") {
if (document.getElementById("changeImage")) {
document.getElementById("closeHref").href = "javascript:closeDivSign('SignIn');";
document.getElementById("changeImage").style.backgroundImage = "url('/web/20110901145833/https://static.virginamerica.com/images/bg_ForgetPasswordWithoutSignIn.gif')";
}
}
if (ajaxDiv == "elevateActivitiesDiv") {
if (document.getElementById("activityFirstData")) {
document.signInForm.activityFirstData.selectedIndex = activityFirstDataInd;
document.signInForm.activitySecData.selectedIndex = activitySecDataInd;
document.signInForm.activityPastData.selectedIndex = activityPastDataInd;
}
}
if (document.getElementById("loadingAnimationDiv")) {
document.getElementById("loadingAnimationDiv").style.display = "none";
}
xmlhttp = null ;
}
}
}
function submitFormLogAfterChangePassword(URLParameters) {
var loginURL = "";
loginURL = "/signInLogin.do" + URLParameters + "&reDirect=no";
ajaxProfileSignIn(loginURL, "loginWindowDiv");
}
function submitFormLog(formName, statusBooking) {
var loginURL = "";
var signLoginId = document.signInForm.loginId.value;
for (i = 0; i < document.signInForm.elements.length; i++) {
if (document.signInForm.elements[i].name == "password") {
var signPassword = document.signInForm.elements[i].value;
break;
}
}
if (rUInRegistrationProcess == "Yes") {
document.signInForm.action = "/signInFromRegister.do";
document.signInForm.submit();
} else {
if (statusBooking == "booking") {
loginURL = "/signInLogin.do?method=signIn&loginId=" + signLoginId + "&password=" + signPassword + "&reDirect=no";
} else {
loginURL = "/signInLogin.do?method=signIn&loginId=" + signLoginId + "&password=" + signPassword + "&reDirect=yes";
}
ajaxProfileSignIn(loginURL, "loginWindowDiv");
}
showWaitImage();
}
function ajaxProfileSignIn(myurl, div1) {
xmlhttp = new XMLHttpRequest();
var thetime = new Date();
var dummy = "" + thetime.getHours() + thetime.getMinutes() + thetime.getSeconds();
myurl = myurl + "&dummy=" + dummy;
ajaxDiv = div1;
xmlhttp.open("POST", myurl, true);
xmlhttp.onreadystatechange = handleResponseSignIn;
xmlhttp.send("");
}
function handleResponseSignIn() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
document.getElementById(ajaxDiv).innerHTML = xmlhttp.responseText;
document.getElementById(ajaxDiv).style.display = "block";
closeWaitImage();
}
}
}
function showRolloverImage(imgId, imgName) {
if (imgId.src.indexOf("cl") == -1) {
imgId.src = "/web/20110901145833/https://static.virginamerica.com/images/" + imgName + "_roll.gif";
} else {
imgId.src = "/web/20110901145833/https://static.virginamerica.com/images/" + imgName + "_roll_cl.gif";
}
}
function restoreImage(imgId, imgName) {
if (imgId.src.indexOf("cl") == -1) {
imgId.src = "/web/20110901145833/https://static.virginamerica.com/images/" + imgName + ".gif";
} else {
imgId.src = "/web/20110901145833/https://static.virginamerica.com/images/" + imgName + "_cl.gif";
}
}
function showElevatePointsDivArea(divId, activeImg, tbSelect) {
document.getElementById("elevateActivities").src = "/web/20110901145833/https://static.virginamerica.com/images/btn_the_basics.gif";
document.getElementById("elevateContact").src = "/web/20110901145833/https://static.virginamerica.com/images/btn_account_activitty.gif";
document.getElementById("elevatePreferences").src = "/web/20110901145833/https://static.virginamerica.com/images/btn_preferences.gif";
document.getElementById("elevateActivitiesDiv").style.display = "none";
document.getElementById("elevateContactDiv").style.display = "none";
document.getElementById("elevatePreferencesDiv").style.display = "none";
document.getElementById("showNeedPointsDiv").style.display = "none";
document.getElementById("needPointsResultDiv").style.display = "none";
document.getElementById("upComingFlightImageId").style.display = "none";
document.getElementById("forGotPointImageId").style.display = "none";
document.getElementById("elevatePointsExplainDivId").style.display = "none";
document.getElementById("requestElevatePointsImageId").style.display = "block";
document.getElementById("elevateExpandHtmlId").style.display = "block";
divId.src = activeImg;
tbSelect = tabSelect;
document.getElementById("pointHistoryDiv").style.display = "block";
}
var elevatePointsActiveImage;
function showFullActivity() {
showLoadingImageonPopUp("pointHistoryFromTheBasic");
window.location = "/signIn.do?method=homeProfileWithPagination&showActivity=true";
}
function showDivArea(divId, activeImg, tbSelect) {
if (tbSelect == 1) {
myUrl = "showPreferences.do?method=showPrefrences&forwardPage=elevateActivity";
if (divId != "pointHistoryFromTheBasic") {
showLoadingImageonPopUp(divId);
}
showElevatePointDetailsAjax(myUrl, divId, activeImg);
} else {
if (tbSelect == 3) {
myUrl = "showPreferences.do?method=showPrefrences&forwardPage=contactInfo";
showLoadingImageonPopUp(divId);
showElevatePointDetailsAjax(myUrl, divId, activeImg);
} else {
if (tbSelect == 5) {
myUrl = "showPreferences.do?method=showPrefrences&forwardPage=preferences";
showLoadingImageonPopUp(divId);
showElevatePointDetailsAjax(myUrl, divId, activeImg);
} else {
if (tbSelect == 4) {
myUrl = "showPreferences.do?method=showPrefrences&forwardPage=pointsExpSummary";
showLoadingImageonPopUp(divId);
showElevatePointDetailsAjax(myUrl, divId, activeImg);
} else {
document.getElementById("elevateActivities").src = "/web/20110901145833/https://static.virginamerica.com/images/btn_the_basics.gif";
document.getElementById("elevateContact").src = "/web/20110901145833/https://static.virginamerica.com/images/btn_account_activitty.gif";
document.getElementById("elevatePreferences").src = "/web/20110901145833/https://static.virginamerica.com/images/btn_preferences.gif";
document.getElementById("elevateActivitiesDiv").style.display = "none";
document.getElementById("elevateContactDiv").style.display = "none";
document.getElementById("elevatePreferencesDiv").style.display = "none";
document.getElementById("showNeedPointsDiv").style.display = "none";
document.getElementById("needPointsResultDiv").style.display = "none";
divId.src = activeImg;
divAreaId = divId.id + "Div";
tbSelect = tabSelect;
if (divAreaId == "elevateActivitiesDiv") {
document.getElementById("upComingFlightImageId").style.display = "none";
document.getElementById("forGotPointImageId").style.display = "block";
document.getElementById("elevateExpandHtmlId").style.display = "block";
document.getElementById("requestElevatePointsImageId").style.display = "none";
document.getElementById("elevatePointsExplainDivId").style.display = "none";
document.getElementById("elevateExpandHtmlIdPref").style.display = "none";
} else {
if (divAreaId == "elevatePreferencesDiv") {
s.event12 = "Elevate Preferences";
document.getElementById("upComingFlightImageId").style.display = "none";
document.getElementById("forGotPointImageId").style.display = "none";
document.getElementById("elevateExpandHtmlId").style.display = "none";
document.getElementById("elevatePointsExplainDivId").style.display = "none";
document.getElementById("requestElevatePointsImageId").style.display = "none";
document.getElementById("elevateExpandHtmlIdPref").style.display = "block";
} else {
if (divAreaId == "elevateContactDiv") {
s.event15 = "Past Flights";
document.getElementById("upComingFlightImageId").style.display = "none";
document.getElementById("forGotPointImageId").style.display = "none";
document.getElementById("elevateExpandHtmlId").style.display = "block";
document.getElementById("elevatePointsExplainDivId").style.display = "none";
document.getElementById("requestElevatePointsImageId").style.display = "block";
document.getElementById("elevateExpandHtmlIdPref").style.display = "none";
}
}
}
document.getElementById(divAreaId).style.display = "block";
showLoadingImageClose();
}
}
}
}
var s_code = s.t();
if (s_code) {
document.write(s_code);
}
}
function showElevatePointDetailsAjax(myurl, div, activeImg) {
xmlhttp = new XMLHttpRequest();
var thetime = new Date();
var dummy = "" + thetime.getHours() + thetime.getMinutes() + thetime.getSeconds();
myurl = myurl + "&dummy=" + dummy;
ajaxDiv = div;
elevatePointsActiveImage = activeImg;
xmlhttp.open("POST", myurl, true);
xmlhttp.onreadystatechange = handleResponseElevatePointDetails;
xmlhttp.send("");
}
function handleResponseElevatePointDetails() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
var ElevatePointResponseText = xmlhttp.responseText;
if (ElevatePointResponseText.trim() == "AjaxSessionTimeOut") {
window.location = "/home.do?method=virginAmerica&sessionState=sessionTimeOut";
} else {
if (ajaxDiv == "elevateActivities" || ajaxDiv == "expPointsLinkDivId" || ajaxDiv == "pointHistoryFromTheBasic") {
document.getElementById("elevateActivitiesDiv").style.display = "none";
document.getElementById("elevateContactDiv").style.display = "none";
document.getElementById("elevatePreferencesDiv").style.display = "none";
document.getElementById("elevateActivitiesDiv").style.display = "block";
document.getElementById("elevateActivitiesDiv").innerHTML = xmlhttp.responseText;
document.getElementById("elevateActivities").className = "current";
document.getElementById("elevateContact").className = "";
document.getElementById("elevatePreferences").className = "";
document.getElementById("eleActivityRightContantDivId").style.display = "";
document.getElementById("myContactInfoRightContentDivId").style.display = "none";
document.getElementById("preferencesRightContentDivId").style.display = "none";
document.getElementById("myAccountRightContentDivId").style.display = "none";
if (typeof (activityFirstDataInd) != "undefined" && typeof (activitySecDataInd) != "undefined" && typeof (activityPastDataInd) != "undefined") {
if (document.signInForm) {
document.signInForm.activityFirstData.selectedIndex = activityFirstDataInd;
document.signInForm.activitySecData.selectedIndex = activitySecDataInd;
document.signInForm.activityPastData.selectedIndex = activityPastDataInd;
}
}
showLoadingImageClose();
} else {
if (ajaxDiv == "elevateContact") {
document.getElementById("elevateActivitiesDiv").style.display = "none";
document.getElementById("elevateContactDiv").style.display = "none";
document.getElementById("elevatePreferencesDiv").style.display = "none";
document.getElementById("elevateContactDiv").style.display = "block";
document.getElementById("elevateContactDiv").innerHTML = xmlhttp.responseText;
document.getElementById("elevateActivities").className = "";
document.getElementById("elevateContact").className = "current";
document.getElementById("elevatePreferences").className = "";
document.getElementById("eleActivityRightContantDivId").style.display = "none";
document.getElementById("myContactInfoRightContentDivId").style.display = "";
document.getElementById("preferencesRightContentDivId").style.display = "none";
document.getElementById("myAccountRightContentDivId").style.display = "none";
showLoadingImageClose();
} else {
if (ajaxDiv == "elevatePreferences") {
document.getElementById("elevateActivitiesDiv").style.display = "none";
document.getElementById("elevateContactDiv").style.display = "none";
document.getElementById("elevatePreferencesDiv").style.display = "none";
document.getElementById("elevatePreferencesDiv").style.display = "block";
document.getElementById("elevatePreferencesDiv").innerHTML = xmlhttp.responseText;
document.getElementById("elevateActivities").className = "";
document.getElementById("elevateContact").className = "";
document.getElementById("elevatePreferences").className = "current";
document.getElementById("eleActivityRightContantDivId").style.display = "none";
document.getElementById("myContactInfoRightContentDivId").style.display = "none";
document.getElementById("preferencesRightContentDivId").style.display = "";
document.getElementById("myAccountRightContentDivId").style.display = "none";
showLoadingImageClose();
}
}
}
}
}
}
}
var chkAccountDetailsRS = "false";
var chkPointActivityDetailsRS = "false";
var arrowImgId;
function callAjaxFunction(objDivId, imgId) {
imgObj = document.getElementById(imgId);
arrowImgId = imgId;
if (chkAccountDetailsRS == "false" && objDivId == "messageDisplay" && document.getElementById(objDivId).style.display == "none") {
showWaitImage();
myUrl = "elevateAccountDetails.do?method=elevateBookingDetails";
retreiveAccountDetails(myUrl, objDivId);
chkAccountDetailsRS = "false";
} else {
if (chkPointActivityDetailsRS == "false" && objDivId == "messageActivity" && document.getElementById(objDivId).style.display == "none") {
showWaitImage();
myUrl = "elevateAccountDetails.do?method=elevatePointsActivity";
retreiveAccountDetails(myUrl, objDivId);
chkPointActivityDetailsRS = "false";
} else {
if (document.getElementById(objDivId).style.display == "none") {
imgObj.setAttribute("src", "/web/20110901145833/https://static.virginamerica.com/images/arrowDown.gif");
document.getElementById(objDivId).style.display = "";
if (objDivId == "messageDisplay") {
document.getElementById("messageActivity").style.display = "none";
document.getElementById("ptDivImgId").setAttribute("src", "/web/20110901145833/https://static.virginamerica.com/images/arrowRight.gif");
}
if (objDivId == "messageActivity") {
document.getElementById("messageDisplay").style.display = "none";
document.getElementById("msgDivImgId").setAttribute("src", "/web/20110901145833/https://static.virginamerica.com/images/arrowRight.gif");
}
} else {
imgObj.setAttribute("src", "/web/20110901145833/https://static.virginamerica.com/images/arrowRight.gif");
document.getElementById(objDivId).style.display = "none";
}
}
}
}
function retreiveAccountDetails(myurl, divId) {
xmlhttp = new XMLHttpRequest();
var thetime = new Date();
var dummy = "" + thetime.getHours() + thetime.getMinutes() + thetime.getSeconds();
myurl = myurl + "&dummy=" + dummy;
ajaxDiv = divId;
xmlhttp.open("POST", myurl, true);
xmlhttp.onreadystatechange = handleResponseAccountDetails;
xmlhttp.send("");
}
function handleResponseAccountDetails() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
var responseText = xmlhttp.responseText;
if (responseText.trim() == "AjaxSessionTimeOut") {
window.location = "/home.do?method=virginAmerica&sessionState=sessionTimeOut";
} else {
document.getElementById("loginWindowDiv").innerHTML = xmlhttp.responseText;
document.getElementById("loginWindowDiv").style.display = "";
document.getElementById(ajaxDiv).style.display = "";
var img = document.getElementById(arrowImgId);
img.setAttribute("src", "/web/20110901145833/https://static.virginamerica.com/images/arrowDown.gif");
if (ajaxDiv == "messageActivity" && document.getElementById("messageDisplay").style.display != "none") {
document.getElementById("messageDisplay").style.display = "none";
document.getElementById("msgDivImgId").setAttribute("src", "/web/20110901145833/https://static.virginamerica.com/images/arrowRight.gif");
}
if (ajaxDiv == "messageDisplay") {
if (document.getElementById("messageActivity").style.display != "none") {
document.getElementById("messageActivity").style.display = "none";
document.getElementById("ptDivImgId").setAttribute("src", "/web/20110901145833/https://static.virginamerica.com/images/arrowRight.gif");
}
}
showLoadingImageClose();
}
}
}
}
function showCkInHome(pnr, id) {
var x = document.pnrDetailForm.elements["pnrDetail.pnrNo"];
x.value = pnr;
if (arguments[2] != null ) {
document.pnrDetailForm.elements["pnrDetail.lastName"].value = arguments[2];
}
if (id != null && id == "") {
document.pnrDetailForm.fromManageTravel.value = "no";
}
if (arguments[3] != null ) {
if (arguments[3] == "viewItinerary") {
document.pnrDetailForm.elements["method"].value = "viewItinerary";
} else {
document.pnrDetailForm.elements["method"].value = "manage";
}
}
document.pnrDetailForm.submit();
showWaitImage();
}
function getPageSizeWithScroll() {
if (window.innerHeight && window.scrollMaxY) {
yWithScroll = window.innerHeight + window.scrollMaxY;
xWithScroll = window.innerWidth + window.scrollMaxX;
} else {
if (document.body.scrollHeight > document.body.offsetHeight) {
yWithScroll = document.body.scrollHeight;
xWithScroll = document.body.scrollWidth;
} else {
yWithScroll = document.body.offsetHeight + document.body.offsetTop;
xWithScroll = document.body.offsetWidth + document.body.offsetLeft;
}
}
arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
return arrayPageSizeWithScroll;
}
function GetXmlHttpObject() {
var xmlHttp = null ;
try {
xmlHttp = new XMLHttpRequest();
} catch (e) {
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
function closeFareRulDiv(divId) {
document.getElementById(divId).style.display = "none";
}
function toggleTaxesAnFee(objId) {
var imgObj = document.getElementById(objId);
if (document.getElementById("passengerChargeId").style.display != "none") {
imgObj.src = "/web/20110901145833/https://static.virginamerica.com/images/taxFeesExpand.gif";
document.getElementById("passengerChargeId").style.display = "none";
document.getElementById("securityFeeId").style.display = "none";
document.getElementById("segmentFeeId").style.display = "none";
if (document.getElementById("travelInsurenceId") != null ) {
document.getElementById("travelInsurenceId").style.display = "none";
}
} else {
imgObj.src = "/web/20110901145833/https://static.virginamerica.com/images/taxFeesCollapse.gif";
document.getElementById("passengerChargeId").style.display = "";
document.getElementById("securityFeeId").style.display = "";
document.getElementById("segmentFeeId").style.display = "";
if (document.getElementById("travelInsurenceId") != null ) {
document.getElementById("travelInsurenceId").style.display = "";
}
}
}
function showRolloverImageNor(imgId, imgName) {
imgId.src = "/web/20110901145833/https://static.virginamerica.com/images/" + imgName + "_roll.gif";
}
function restoreImageNor(imgId, imgName) {
imgId.src = "/web/20110901145833/https://static.virginamerica.com/images/" + imgName + ".gif";
}
function addEvent() {
var ni = document.getElementById("myDiv");
var numi = document.getElementById("theValue");
var num = (document.getElementById("theValue").value - 1) + 2;
numi.value = num;
var divIdName = "my" + num + "DivEMail";
var newdiv = document.createElement("div");
newdiv.setAttribute("id", divIdName);
newdiv.innerHTML = "<table cellpadding=0 cellspacing=0 border=0 width=416><tr><td width=31></td><td width=110 class=pageBody9><strong>Email Address:</strong></td><td width=110><input name=modifyProfileModel.emailaddress[" + num + "] type=text class=pageBody9 size=25 ></td><td><img src=/web/20110901145833/https://static.virginamerica.com/images/spacer.gif width=3 /></td><td><img src=/web/20110901145833/https://static.virginamerica.com/images/btn_delete.gif onmouseover=\"showRolloverImage(this,'btn_delete');MakeCursor(this);\" onmouseout=restoreImage(this,'btn_delete') alt=Delete title=Delete onclick=\"removeEvent('" + divIdName + "','myDiv','mail');resetMailElementName();\"></td><td></td></tr><tr><td colspan=4><img src=/web/20110901145833/https://static.virginamerica.com/images/spacer.gif width=1 height=3></td></tr></table>";
CntAddElements("cntMailElements");
ni.appendChild(newdiv);
}
function addEventForPhone() {
var ni = document.getElementById("myDivPhone");
var numi = document.getElementById("theValuePhone");
var num = (document.getElementById("theValuePhone").value - 1) + 2;
numi.value = num;
var divIdName = "my" + num + "Div4Phone";
var newdiv = document.createElement("div");
newdiv.setAttribute("id", divIdName);
newdiv.innerHTML = "<table cellpadding=0 cellspacing=0 border=0 width=416><tr><td width=31><input type=radio value=phone" + num + " name=phonePrimary onclick=setRadioVal(this.value,'personalInfo',0);></td><td width=110 class=pageBody9><select name=modifyProfileModel.phonetypenew[" + num + "] class=pageBody9 style='width:100px;'><option selected=selected value=''>Select Type</option><option value=office>Business</option><option value=Home>Home</option><option value=Mobile>Mobile</option></select></td><td width=110><input name=modifyProfileModel.phonenumbernew[" + num + "] type=text value='' class=pageBody9 size=25 ></td><td><img src=/web/20110901145833/https://static.virginamerica.com/images/spacer.gif width=3 /></td><td><img src=/web/20110901145833/https://static.virginamerica.com/images/btn_delete.gif onmouseover=\"showRolloverImage(this,'btn_delete');MakeCursor(this);\" onmouseout=restoreImage(this,'btn_delete') alt=Delete title=Delete onclick=\"removeEvent('" + divIdName + "','myDivPhone','phone');resetElementName(" + num + ');"></td><td></td></tr><tr><td colspan=4><img src=/web/20110901145833/https://static.virginamerica.com/images/spacer.gif width=1 height=3></td></tr></table>';
CntAddElements("cntMailElements");
ni.appendChild(newdiv);
}
function removeEvent(divNum, myDivID, whichEl) {
var d = document.getElementById(myDivID);
var olddiv = document.getElementById(divNum);
if (whichEl == "mail") {
CntRemoveElements("theValue");
} else {
if (whichEl == "phone") {
CntRemoveElements("theValuePhone");
}
}
d.removeChild(olddiv);
}
function addEventForCreditCard() {
var ni = document.getElementById("myDivCard");
var i = 0;
var numi = document.getElementById("theValueCard");
var num = (parseInt(numi.value) - 1) + 2;
numi.value = num;
for (i = 0; i < document.modifyProfileForm.elements.length; i++) {
if (document.modifyProfileForm.elements[i].name == "modifyProfileModel.cardCount") {
document.modifyProfileForm.elements[i].value = num;
}
}
var divIdName = "myDivCreditCard" + num;
var newdiv = document.createElement("div");
newdiv.setAttribute("id", divIdName);
ni.appendChild(newdiv);
openDivForEdit(divIdName, divIdName, "editCreditCardInfoInProfileIterateAdd.jsp?divNum=" + num);
}
function addEventForCompanion() {
var ni = document.getElementById("myDivCompanion");
var i = 0;
var numi = document.getElementById("theValueCompanion");
var num = (parseInt(numi.value) - 1) + 2;
numi.value = num;
var divIdName = "nameDivParent" + num;
var newdiv = document.createElement("div");
newdiv.setAttribute("id", divIdName);
ni.appendChild(newdiv);
openDivForEdit(divIdName, divIdName, "editTravelCompanionsInProfileAdd.jsp?divNum=" + num);
}
function CntAddElements(elementId) {
var cntAdd = 0;
cntAdd = document.getElementById(elementId).value;
document.getElementById(elementId).value = (cntAdd) - (-1);
}
function CntRemoveElements(elementId) {
var cntRem = 0;
cntRem = document.getElementById(elementId).value;
document.getElementById(elementId).value = cntRem - 1;
}
function showHideLayer(anchorObj, divID, imgName, divIDSpace) {
divId = document.getElementById(divID);
if (divIDSpace != "no") {
divIDSpace = document.getElementById(divIDSpace);
}
if (divId.style.display != "none") {
anchorObj.className = "collapsed";
divId.style.display = "none";
if (divIDSpace != "no") {
divIDSpace.style.display = "block";
}
if (document.getElementById("toggleTrigger")) {
document.getElementById("toggleTrigger").innerHTML = "Show Details";
}
} else {
anchorObj.className = "collapseBtn";
divId.style.display = "";
if (divIDSpace != "no") {
divIDSpace.style.display = "none";
}
if (document.getElementById("toggleTrigger")) {
document.getElementById("toggleTrigger").innerHTML = "Hide Details";
}
}
}
function showHideLayerOnLoad() {
var divId;
var activeImg;
if (tabSelect == 1) {
divId = "theBasics";
activeImg = "/web/20110901145833/https://static.virginamerica.com/images/btn_the_basics_sel.gif";
} else {
if (tabSelect == 2) {
divId = "accountActivity";
activeImg = "/web/20110901145833/https://static.virginamerica.com/images/btn_account_activitty_sel.gif";
} else {
if (tabSelect == 3) {
divId = "futureFlights";
activeImg = "/web/20110901145833/https://static.virginamerica.com/images/btn_future_flights_sel.gif";
} else {
if (tabSelect == 4) {
divId = "preferences";
activeImg = "/web/20110901145833/https://static.virginamerica.com/images/btn_preferences_sel.gif";
} else {
divId = "theBasics";
activeImg = "/web/20110901145833/https://static.virginamerica.com/images/btn_the_basics_sel.gif";
}
}
}
}
showDivArea(document.getElementById(divId), activeImg, tabSelect);
}
function resetElementName(num) {
var elcnt = 0;
var dlNum = parseInt(num);
var radioDelNum;
for (i = 0; i < document.modifyProfileForm.elements.length; i++) {
if (document.modifyProfileForm.elements[i].name.length > 32) {
if (document.modifyProfileForm.elements[i].name.substring(0, 33) == "modifyProfileModel.phonenumbernew") {
document.modifyProfileForm.elements[i].name = "modifyProfileModel.phonenumbernew[" + elcnt + "]";
elcnt = elcnt + 1;
}
}
}
elcnt = 0;
for (i = 0; i < document.modifyProfileForm.elements.length; i++) {
if (document.modifyProfileForm.elements[i].name.length > 30) {
if (document.modifyProfileForm.elements[i].name.substring(0, 31) == "modifyProfileModel.phonetypenew") {
document.modifyProfileForm.elements[i].name = "modifyProfileModel.phonetypenew[" + elcnt + "]";
elcnt = elcnt + 1;
}
}
}
elcnt = 0;
for (i = 0; i < document.modifyProfileForm.elements.length; i++) {
if (document.modifyProfileForm.elements[i].name == "phonePrimary") {
document.modifyProfileForm.elements[i].value = "phone" + elcnt;
elcnt = elcnt + 1;
}
}
}
function resetMailElementName() {
var elcnt = 0;
for (i = 0; i < document.modifyProfileForm.elements.length; i++) {
if (document.modifyProfileForm.elements[i].name.length > 30) {
if (document.modifyProfileForm.elements[i].name.substring(0, 31) == "modifyProfileModel.emailaddress") {
document.modifyProfileForm.elements[i].name = "modifyProfileModel.emailaddress[" + elcnt + "]";
elcnt = elcnt + 1;
}
}
}
}
function resetElementNamePhoneRun(num) {
var elcnt = 0;
var hiddCnt = parseInt(num);
for (i = 0; i < document.modifyProfileForm.elements.length; i++) {
if (document.modifyProfileForm.elements[i].name.length > 32) {
if (document.modifyProfileForm.elements[i].name.substring(0, 33) == "modifyProfileModel.phonenumbernew") {
if (i >= num && elcnt > num) {
document.modifyProfileForm.elements[i].name = "modifyProfileModel.phonenumbernew[" + (elcnt - 1) + "]";
document.modifyProfileForm.elements[i].value = document.modifyProfileForm.elements[i].name;
if (parseInt(document.getElementById("theValuePhone").value) >= (hiddCnt + 1)) {
document.getElementById("positionDiv" + hiddCnt + "").value = hiddCnt - 1;
hiddCnt = hiddCnt + 1;
}
}
elcnt = elcnt + 1;
}
}
}
document.getElementById("theValuePhone").value = parseInt(document.getElementById("theValuePhone").value) - 1;
}
function deleteLayer(id) {
if (document.layers && document.layers[id]) {
document.layers[id].visibility = "hide";
delete document.layers[id];
}
}
function setAliasValue(val) {
for (i = 0; i < document.requestProfileForm.elements.length; i++) {
if (document.requestProfileForm.elements[i].name == "createProfile.emailSecond") {
document.requestProfileForm.elements[i].value = val;
}
}
}
function setAliasModifyValue(val) {
for (i = 0; i < document.modifyProfileForm.elements.length; i++) {
if (document.modifyProfileForm.elements[i].name == "modifyProfileModel.alias") {
document.modifyProfileForm.elements[i].value = val;
}
}
}
function resetElementNameAddress(num) {
var elcnt = 0;
var name;
var elPosition;
var elIntPosition;
for (i = 0; i < document.modifyProfileForm.elements.length; i++) {
name = document.modifyProfileForm.elements[i].name;
name = name.split("[");
if (!(name[1] == null || name[i] == "")) {
elPosition = name[1].split("]");
if (!(elPosition[0] == null || elPosition[0] == "")) {
elIntPosition = parseInt(elPosition[0]);
if (i >= num && elIntPosition > num) {
document.modifyProfileForm.elements[i].name = name[0] + "[" + (elIntPosition - 1) + "]";
}
}
}
}
document.getElementById("theValueAddress").value = document.getElementById("theValueAddress").value - 1;
}
function addEventForAddress() {
var i = 0;
var ni = document.getElementById("myDivAddress");
var i = 0;
var numi = document.getElementById("theValueAddress");
var num = (parseInt(numi.value) - 1) + 2;
numi.value = num;
for (i = 0; i < document.modifyProfileForm.elements.length; i++) {
if (document.modifyProfileForm.elements[i].name == "modifyProfileModel.addressCnt") {
document.modifyProfileForm.elements[i].value = num;
}
}
var divIdName = "myDivAddress" + num;
var newdiv = document.createElement("div");
newdiv.setAttribute("id", divIdName);
ni.appendChild(newdiv);
openDivForEdit(divIdName, "editBtnAddress", "editAddressInProfileIterateAdd.jsp?divNum=" + num);
}
function removeEventForAddress(divNum, myDivID, whichEl) {
document.getElementById(divNum).style.display = "none";
var olddiv = olddiv.parentNode;
var d = document.getElementById(myDivID);
d.removeChild(olddiv);
}
function populateOmnitureVariable(modify) {
s.events = "event9";
if (modify == "personal") {
s.eVar24 = "Edit Personal Information";
} else {
if (modify == "creditCard") {
s.eVar24 = "Edit Credit Card Information";
} else {
if (modify == "password") {
s.eVar24 = "Edit Password";
} else {
if (modify == "address") {
s.eVar24 = "Edit Address Information";
} else {
if (modify == "companion") {
s.eVar24 = "Edit Companion";
} else {
if (modify == "attribute") {
s.eVar24 = "Edit Attribute";
} else {
if (modify == "interest") {
s.eVar24 = "Edit Interest";
}
}
}
}
}
}
}
var s_code = s.t();
if (s_code) {
document.write(s_code);
}
}
function createUrlPersonalInfo(place, frm) {
closeDivSign("deleteFromDBMsgBox");
disablePage();
populateOmnitureVariable(frm);
var url = null ;
var postionDiv = "testPosition";
if (frm == "personal") {
url = "modifyProfile.do?div=11";
document.modifyProfileForm.elements["modifyProfileModel.cntPhone"].value = document.getElementById("theValuePhone").value;
document.modifyProfileForm.elements["modifyProfileModel.cntEMail"].value = document.getElementById("theValue").value;
for (i = 0; i < document.modifyProfileForm.elements.length; i++) {
if (document.modifyProfileForm.elements[i].name != "phonePrimary") {
url = url + "&" + document.modifyProfileForm.elements[i].name + "=" + document.modifyProfileForm.elements[i].value;
}
}
openDivForEditUpdated(document.getElementById("editForm"), document.getElementById("editPersonalOpen"), url);
}
if (frm == "creditCard") {
url = "modifyCreditCardProfile.do?div=11";
var t = 0;
for (i = 0; i < document.modifyProfileForm.elements.length; i++) {
if (document.modifyProfileForm.elements[i].name == "modifyProfileModel.cardCount") {
document.modifyProfileForm.elements[i].value = document.getElementById("theValueCard").value;
}
if (document.modifyProfileForm.elements[i].type != "radio") {
url = url + "&" + document.modifyProfileForm.elements[i].name + "=" + document.modifyProfileForm.elements[i].value;
}
}
openDivForEditUpdated(document.getElementById("editForm"), document.getElementById("editCreditCOpen"), url);
}
if (frm == "password") {
url = "modifyPasswordProfile.do?div=11";
var val = "";
for (i = 0; i < document.modifyProfileForm.elements.length; i++) {
val = document.modifyProfileForm.elements[i].value;
val = val.replace("+", "PLUS");
url = url + "&" + document.modifyProfileForm.elements[i].name + "=" + document.modifyProfileForm.elements[i].value;
}
url = url.replace(/PLUS/g, "%2B");
openDivForEditUpdated(document.getElementById("editForm"), document.getElementById("editPasswordOpen"), url);
}
if (frm == "address") {
url = "modifyAddressProfile.do?div=11";
for (i = 0; i < document.modifyProfileForm.elements.length; i++) {
if (document.modifyProfileForm.elements[i].name == "modifyProfileModel.addressCnt") {
document.modifyProfileForm.elements[i].value = document.getElementById("theValueAddress").value;
}
}
var totalElement = ((parseInt(document.getElementById("theValueAddress").value) + 1) * 11) + 3;
var nameVal;
for (i = 0; i < document.modifyProfileForm.elements.length; i++) {
nameVal = document.modifyProfileForm.elements[i].name.split("_");
if (nameVal[0] != "radioAddress") {
url = url + "&" + document.modifyProfileForm.elements[i].name + "=" + document.modifyProfileForm.elements[i].value;
}
}
openDivForEditUpdated(document.getElementById("editForm"), document.getElementById("editBtnAddress"), url);
}
if (frm == "companion") {
url = "modifyCompanionProfile.do?div=11";
for (i = 0; i < document.modifyProfileForm.elements.length; i++) {
if (document.modifyProfileForm.elements[i].name == "modifyProfileModel.companionTotal") {
document.modifyProfileForm.elements[i].value = document.getElementById("theValueCompanion").value;
}
if (document.modifyProfileForm.elements[i].name != "") {
url = url + "&" + document.modifyProfileForm.elements[i].name + "=" + document.modifyProfileForm.elements[i].value;
}
}
openDivForEditUpdated(document.getElementById("editForm"), document.getElementById("companion"), url);
}
if (frm == "attribute") {
url = "modifyAttributeProfile.do?div=11";
for (i = 0; i < document.modifyProfileForm.elements.length; i++) {
url = url + "&" + document.modifyProfileForm.elements[i].name + "=" + document.modifyProfileForm.elements[i].value;
}
openDivForEditUpdated(document.getElementById("editForm"), document.getElementById("editFightPOpen"), url);
}
if (frm == "interest") {
url = "modifyAttributeProfile.do?div=11&method=modifyInterest";
var selectedString = "";
var chkcnt = 0;
for (i = 0; i < document.modifyProfileForm.elements.length; i++) {
if (document.modifyProfileForm.elements[i].name == "interestVal") {
if (document.modifyProfileForm.elements[i].checked) {
if (chkcnt > 0) {
selectedString = selectedString + ",";
}
selectedString = selectedString + document.modifyProfileForm.elements[i].value;
chkcnt = chkcnt + 1;
}
}
}
url = url + "&modifyProfileModel.interestVal=" + selectedString;
openDivForEditUpdated(document.getElementById("editForm"), document.getElementById("editInterestOpen"), url);
}
}
function goToPrefrence() {
showDivArea(document.getElementById("preferences"), "/web/20110901145833/https://static.virginamerica.com/images/btn_preferences_sel.gif");
}
function divhideFunctionError(divID) {
var x = document.getElementById(divID);
if (x.style.display == "block" || x.style.display == "inline") {
x.style.display = "none";
iswap = 0;
} else {
if (x.style.display == "none" || x.style.display == "") {
x.style.display = "inline";
}
}
}
function setRadioVal(RdVal, editType, cntPos) {
var icnt = 0;
if (editType == "personalInfo") {
for (i = 0; icnt < document.modifyProfileForm.elements.length; icnt++) {
if (document.modifyProfileForm.elements[icnt].name == "modifyProfileModel.phonePrimary") {
document.modifyProfileForm.elements[icnt].value = RdVal;
}
}
}
if (editType == "personalInfoEmail") {
for (i = 0; icnt < document.modifyProfileForm.elements.length; icnt++) {
if (document.modifyProfileForm.elements[icnt].name == "modifyProfileModel.emailtype") {
document.modifyProfileForm.elements[icnt].value = RdVal;
}
}
}
if (editType == "addressInfo") {
for (i = 0; icnt < document.modifyProfileForm.elements.length; icnt++) {
if (document.modifyProfileForm.elements[icnt].name == "modifyProfileModel.addressPrimary[" + cntPos + "]") {
document.modifyProfileForm.elements[icnt].value = RdVal;
}
}
}
if (editType == "addressInfoPrimary") {
for (i = 0; icnt < document.modifyProfileForm.elements.length; icnt++) {
if (document.modifyProfileForm.elements[icnt].name == "modifyProfileModel.whichPrimary") {
document.modifyProfileForm.elements[icnt].value = RdVal;
}
}
}
if (editType == "cardInfoPrimary") {
for (i = 0; icnt < document.modifyProfileForm.elements.length; icnt++) {
if (document.modifyProfileForm.elements[icnt].name == "modifyProfileModel.whichPrimaryCard") {
document.modifyProfileForm.elements[icnt].value = RdVal;
}
}
}
}
function deleteCreditCard(divId2Delete, blockNum) {
document.getElementById(divId2Delete).innerHTML = "";
resetElementNameCard(blockNum);
}
function deleteCreditCardSession(divId2Delete, blockNum) {
var delct = 0;
var i1 = 0;
delct = parseInt(document.getElementById("sessionDelCard").value);
for (i1 = 0; i1 < document.modifyProfileForm.elements.length; i1++) {
if (document.modifyProfileForm.elements[i1].name == "modifyProfileModel.delCardArry") {
if (document.modifyProfileForm.elements[i1].value == null || document.modifyProfileForm.elements[i1].value == "") {
document.modifyProfileForm.elements[i1].value = blockNum;
} else {
document.modifyProfileForm.elements[i1].value = document.modifyProfileForm.elements[i1].value + "|" + blockNum;
}
}
if (document.modifyProfileForm.elements[i1].name == "modifyProfileModel.delCardcount") {
document.modifyProfileForm.elements[i1].value = parseInt(document.modifyProfileForm.elements[i1].value) + 1;
}
}
resetElementNameCard(blockNum);
document.getElementById("theValueCard").value = (parseInt(document.getElementById("theValueCard").value) - 1);
document.getElementById("sessionDelCard").value = delct + 1;
}
function resetElementNameCard(div2Delete, numDiv) {
var cnt = document.getElementById("theValueCard").value;
var obj = document.getElementById(div2Delete);
var num = parseInt(numDiv);
obj.outerHTML = "";
var i = 0;
for (i = num + 1; i <= cnt; i++) {
document.getElementById("myDivCreditCard" + i).id = "myDivCreditCard" + (i - 1);
document.getElementById("divRelVal" + i).id = (i - 1);
document.getElementById("divRelVal" + (i - 1)).value = "divRelVal" + (i - 1);
document.getElementById("myDivCreditCard" + (i - 1)).id = "myDivCreditCard" + (i - 1);
}
}
function deletePhoneSession(divId2Delete, blockNum) {
var url = "modifyProfile.do?method=deletePhoneInfo&delCardInfo=" + blockNum;
openDivForEditUpdated(document.getElementById("editForm"), document.getElementById("testPosition"), url);
}
function deleteEmailSession(divId2Delete, blockNum) {
var url = "modifyCreditCardProfile.do?method=deleteEmailInfo&delCardInfo=" + blockNum;
openDivForEditUpdated(document.getElementById("editForm"), document.getElementById("testPosition"), url);
}
function deleteAddressSession(divId2Delete, blockNum) {
var url = "modifyCreditCardProfile.do?method=deleteAddressInfo&delCardInfo=" + blockNum;
openDivForEditUpdated(document.getElementById("editForm"), document.getElementById("testPosition"), url);
}
function deleteCreditCardSession(divId2Delete, blockNum) {
var url = "modifyCreditCardProfile.do?method=deleteCardInfo&delCardInfo=" + blockNum;
openDivForEditUpdated(document.getElementById("editForm"), document.getElementById("testPosition"), url);
}
function deleteCompanionSession(divId2Delete, blockNum) {
var url = "modifyCreditCardProfile.do?method=deleteCompanionInfo&delCardInfo=" + blockNum;
openDivForEditUpdated(document.getElementById("editForm"), document.getElementById("companion"), url);
}
function divResetGeneralFunction(DivName, TotalTxt, parentDiv, FunctionIn) {
var cnt;
var nameDiv;
var tempDivName = DivName.split("myBtn");
DivName = "myDivCreditCard" + tempDivName[1];
if (FunctionIn == "CCard") {
nameDiv = "myDivCreditCard";
}
cnt = parseInt(document.getElementById(TotalTxt).value);
var obj = document.getElementById(DivName);
num1 = obj.id.split(nameDiv);
num = parseInt(num1[1]);
var a1 = document.getElementById(parentDiv);
a1.removeChild(obj);
var i = 0;
for (i = num + 1; i <= cnt; i++) {
document.getElementById(nameDiv + i).id = nameDiv + (i - 1);
document.getElementById("myBtn" + i).id = "myBtn" + (i - 1);
document.getElementById("divAddress" + i).id = "divAddress" + (i - 1);
for (i1 = 0; i1 < document.modifyProfileForm.elements.length; i1++) {
if (document.modifyProfileForm.elements[i1].name == "rdoCCType" + i) {
document.modifyProfileForm.elements[i1].name = "rdoCCType" + (i - 1);
}
if (document.modifyProfileForm.elements[i1].name == "radioAddress_" + i) {
document.modifyProfileForm.elements[i1].name = "radioAddress_" + (i - 1);
}
}
}
resetCreditCard(tempDivName[1]);
cnt = cnt - 1;
document.getElementById(TotalTxt).value = cnt;
}
function divResetGeneralFunctionForCompanion(DivName, TotalTxt, parentDiv, FunctionIndx) {
var cnt;
var nameDiv;
nameDiv = "companionDiv";
nameDivParent = "nameDivParent";
cnt = parseInt(document.getElementById(TotalTxt).value);
var obj = document.getElementById(DivName);
num1 = FunctionIndx;
num = parseInt(num1);
var a1 = obj.parentNode;
a1.removeChild(obj);
var i = 0;
for (i = num + 1; i <= cnt; i++) {
document.getElementById(nameDiv + i).id = nameDiv + (i - 1);
document.getElementById(nameDivParent + i).id = nameDivParent + (i - 1);
document.getElementById(i).id = "" + (i - 1);
}
resetCompanion(num);
cnt = cnt - 1;
document.getElementById(TotalTxt).value = cnt;
}
function divResetGeneralFunctionAddress(DivName, TotalTxt, parentDiv, FunctionIn) {
var cnt;
var nameDiv;
var tempDivName = DivName.split("myBtn");
DivName = "myDivAddress" + tempDivName[1];
if (FunctionIn == "Address") {
nameDiv = "myDivAddress";
}
cnt = parseInt(document.getElementById(TotalTxt).value);
var obj = document.getElementById(DivName);
num1 = obj.id.split(nameDiv);
num = parseInt(num1[1]);
var a1 = document.getElementById(parentDiv);
a1.removeChild(obj);
var i = 0;
for (i = num + 1; i <= cnt; i++) {
document.getElementById(nameDiv + i).id = nameDiv + (i - 1);
document.getElementById("myBtn" + i).id = "myBtn" + (i - 1);
}
resetAddress(tempDivName[1]);
cnt = cnt - 1;
document.getElementById(TotalTxt).value = cnt;
}
function resetCreditCard(num) {
var i1 = 0;
var i = 0;
var name = "";
for (i = 0; i < document.modifyProfileForm.elements.length; i++) {
name = document.modifyProfileForm.elements[i].name;
name = name.split("[");
if (!(name[0] == null || name[0] == "")) {
if (name[0] != "modifyProfileModel.delCard") {
if (!(name[1] == null || name[i] == "")) {
elPosition = name[1].split("]");
if (!(elPosition[0] == null || elPosition[0] == "")) {
elIntPosition = parseInt(elPosition[0]);
if (i >= num && elIntPosition > num) {
document.modifyProfileForm.elements[i].name = name[0] + "[" + (elIntPosition - 1) + "]";
}
}
}
}
}
}
}
function resetAddress(num) {
var i1 = 0;
var i = 0;
var name = "";
for (i = 0; i < document.modifyProfileForm.elements.length; i++) {
name = document.modifyProfileForm.elements[i].name;
name = name.split("[");
if (!(name[0] == null || name[0] == "")) {
if (name[0] != "modifyProfileModel.delCard") {
if (!(name[1] == null || name[i] == "")) {
elPosition = name[1].split("]");
if (!(elPosition[0] == null || elPosition[0] == "")) {
elIntPosition = parseInt(elPosition[0]);
if (i >= num && elIntPosition > num) {
document.modifyProfileForm.elements[i].name = name[0] + "[" + (elIntPosition - 1) + "]";
}
}
}
}
}
}
}
function resetCompanion(num) {
var i1 = 0;
var i = 0;
var name = "";
for (i = 0; i < document.modifyProfileForm.elements.length; i++) {
name = document.modifyProfileForm.elements[i].name;
name = name.split("[");
if (!(name[0] == null || name[0] == "")) {
if (name[0] != "modifyProfileModel.companionTotal") {
if (!(name[1] == null || name[i] == "")) {
elPosition = name[1].split("]");
if (!(elPosition[0] == null || elPosition[0] == "")) {
elIntPosition = parseInt(elPosition[0]);
if (i >= num && elIntPosition > num) {
document.modifyProfileForm.elements[i].name = name[0] + "[" + (elIntPosition - 1) + "]";
}
}
}
}
}
}
}
function showNormalPasswordGuest(thisobj) {
if (thisobj.value == "") {
var obj = document.getElementById("divpassnewGuest");
thisobj.name = "pass*";
document.getElementById("passwordGuestDiv").style.display = "block";
document.getElementById("divpassnewGuest").style.display = "none";
for (i = 0; i < document.signInGuestForm.elements.length; i++) {
if (document.signInGuestForm.elements[i].name == "password") {
document.signInGuestForm.elements[i].value = "Password";
document.signInGuestForm.elements[i].focus();
break;
}
}
}
}
function showPasswordInNewPass(nameVal, hideDiv, showDiv) {
var obj = document.getElementById(hideDiv);
obj.innerHTML = "";
document.getElementById(hideDiv).style.display = "none";
document.getElementById(showDiv).style.display = "block";
for (i = 0; i < document.changePasswordForm.elements.length; i++) {
if (document.changePasswordForm.elements[i].name == nameVal) {
document.changePasswordForm.elements[i].focus();
break;
}
}
}
function showAddress(divName, rdoIndex, indx) {
var newYesOrNo = "No";
var txtVal = "modifyProfileModel.useAddress[" + indx + "]";
if (rdoIndex == "0") {
document.getElementById(divName).style.display = "none";
} else {
document.getElementById(divName).style.display = "inline";
newYesOrNo = "Yes";
}
for (i = 0; i < document.modifyProfileForm.elements.length; i++) {
if (document.modifyProfileForm.elements[i].name == txtVal) {
document.modifyProfileForm.elements[i].value = newYesOrNo;
}
}
}
function managePnrOnFlightHistoryPage(pnrValue, isBooker, linkId) {
document.getElementById("pnrValue").value = pnrValue;
document.getElementById("isbookre").value = isBooker;
document.pnrDetailForm.submit();
showWaitImage();
}
function managePnrOnLoginWindow(pnrValue, isBooker) {
document.getElementById("pnrValueLoginWindow").value = pnrValue;
document.getElementById("isbookreLoginWindow").value = isBooker;
document.managePnrOnLoginWindow.submit();
showWaitImage();
}
function checkOptOptions(ajaxDiv) {
var optionString = "";
var chkBoxCnt = 0;
while (eval("document.getElementById" + '("' + "optcheck" + chkBoxCnt + '")')) {
var x = eval("document.getElementById" + '("' + "optcheck" + chkBoxCnt + '")');
if (x.checked == true) {
optionString = optionString + x.value + "-true,";
} else {
optionString = optionString + x.value + "-false,";
}
chkBoxCnt++;
}
disablePage();
showWaitImage();
setPosition(document.getElementById(ajaxDiv), document.getElementById("editForm"), -200, 30);
var myUrl = "updateOptIn.do?method=modifyOptInOptions&optInFlag=" + optionString;
$("#editForm").load(myUrl, "", done);
enablePage();
function done() {
closeWaitImage();
}
}
function closeOpenAjax(divName) {
if (document.getElementById(divName)) {
if (document.getElementById(divName).style.display == "block") {
document.getElementById(divName).style.display = "none";
} else {
document.getElementById(divName).style.display = "block";
}
}
}
function closeDivWindow(divName) {
if (document.getElementById(divName)) {
document.getElementById(divName).style.display = "none";
}
}
function openPreAndNextAddress(responseDiv, moveType) {
var url = "";
url = "nextAndPreviousAdressesInfo.do?method=nextAndPreviousAdressesInfo&moveType=" + moveType;
ajaxProfile(url, responseDiv);
}
function showManageAddressesSubmit(ImageId, divName) {
var positionObj = ImageId;
myUrl = "showManageAddressesAction.do?method=showManageAddresses";
ajaxShow(myUrl, divName);
showWaitImage();
setPosition(document.getElementById(positionObj), document.getElementById(divName), 100, -20);
}
function addManageAddressesSubmit(ImageId, divName) {
var positionObj = ImageId;
myUrl = "showManageAddressesAction.do?method=addManageAddresses";
ajaxUpdate(myUrl, divName, "no");
}
function deleteManageAddressesSubmit(divName, addressId) {
myUrl = "updateManageAddressesAction.do?method=deleteManageAddresses&addressId=" + addressId;
if (document.getElementById("viewPricingAllDiv")) {
holdInnerHtml = document.getElementById("viewPricingAllDiv").innerHTML;
}
ajaxUpdate(myUrl, divName, "no");
}
function updateManageAddressesSubmit(ImageId, divName) {
var updateAddressUrl = null ;
var positionObj = ImageId;
updateAddressUrl = "updateManageAddressesAction.do?method=modifyManageAddresses";
for (i = 0; i < document.modifyAddressForm.elements.length; i++) {
updateAddressUrl = updateAddressUrl + "&" + document.modifyAddressForm.elements[i].name + "=" + document.modifyAddressForm.elements[i].value;
}
if (document.getElementById("viewPricingAllDiv")) {
holdInnerHtml = document.getElementById("viewPricingAllDiv").innerHTML;
}
ajaxUpdate(updateAddressUrl, divName, "no");
}
function updateGuestPage() {
if (document.getElementById("viewPricingAllDiv")) {
document.getElementById("viewPricingAllDiv").innerHTML = holdInnerHtml;
}
if (document.getElementById("showManageAddressesDiv")) {
document.getElementById("showManageAddressesDiv").style.display = "none";
}
if (document.getElementById("showEditContactInfoDiv")) {
document.getElementById("showEditContactInfoDiv").style.display = "none";
}
}
function ajaxShow(myurl, div) {
document.getElementById(div).style.display = "none";
xmlhttp = new XMLHttpRequest();
var thetime = new Date();
var dummy = "" + thetime.getHours() + thetime.getMinutes() + thetime.getSeconds();
myurl = myurl + "&dummy=" + dummy;
ajaxDiv = div;
xmlhttp.open("POST", myurl, true);
xmlhttp.onreadystatechange = handleResponseShow;
xmlhttp.send("");
}
function handleResponseShow() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
if (ajaxDiv == "showManageAddressesDiv") {
document.getElementById(ajaxDiv).innerHTML = '<iframe frameborder="0" style="position:absolute;top:0px;left:0px;width:590px;height:395px;" src="html/SSLIframeFixed.html"></iframe>' + '<div style="position: relative;">' + xmlhttp.responseText + "</div>";
} else {
document.getElementById(ajaxDiv).innerHTML = xmlhttp.responseText;
}
document.getElementById("loadingAnimationDiv").style.display = "none";
document.getElementById(ajaxDiv).style.display = "block";
}
}
}
function ajaxUpdate(myurl, div, modeType) {
document.getElementById(div).style.display = "none";
showWaitImage();
xmlhttp = new XMLHttpRequest();
var thetime = new Date();
var dummy = "" + thetime.getHours() + thetime.getMinutes() + thetime.getSeconds();
myurl = myurl + "&dummy=" + dummy;
xmlhttp.open("POST", myurl, true);
xmlhttp.onreadystatechange = handleResponseUpdate;
xmlhttp.send("");
}
function handleResponseUpdate() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
document.getElementById("loadingAnimationDiv").style.display = "none";
document.getElementById(ajaxDiv).style.display = "block";
var resTxt = xmlhttp.responseText;
if (resTxt.indexOf("/web/20110901145833/https://static.virginamerica.com/images/travel_text_bg.gif") != -1) {
document.getElementById("viewPricingAllDiv").innerHTML = xmlhttp.responseText;
document.getElementById("showNewAddressWindow").style.display = "none";
document.getElementById("loadingAnimationDiv").style.display = "none";
document.getElementById("divAddress0").style.display = "block";
} else {
if (resTxt.indexOf("/web/20110901145833/https://static.virginamerica.com/images/VA_Purchase_BuyTicket_heade.gif") != -1) {
document.getElementById("sect").innerHTML = xmlhttp.responseText;
} else {
document.getElementById(ajaxDiv).innerHTML = '<iframe frameborder="0" style="position:absolute;top:0px;left:0px;width:590px;height:395px;" src="html/SSLIframeFixed.html"></iframe>' + '<div style="position: relative;">' + xmlhttp.responseText + "</div>";
if (document.getElementById("showNewAddressWindow")) {
document.getElementById("showNewAddressWindow").style.display = "none";
}
document.getElementById("loadingAnimationDiv").style.display = "none";
if (document.getElementById("divAddress0")) {
document.getElementById("divAddress0").style.display = "block";
}
}
}
}
}
}
function signInFromTravellerAndPurchaseSubmit(pageValue) {
if (pageValue == "changeFlight" || pageValue == "cancelFlight" || pageValue == "CheckIn" || pageValue == "manageTravel") {
document.signInForm.method.value = "signInPnr";
document.signInForm.action = "signInPnr.do";
} else {
if (pageValue == "secureFlight") {
document.signInForm.method.value = "signInFromTravellerAndPurchase";
document.signInForm.action = "signIn.do";
} else {
document.signInForm.method.value = "signInFromTravellerAndPurchase";
document.signInForm.action = "/signInTravellerAndPurchase.do";
}
}
document.signInForm.fltMethod.value = pageValue;
document.signInForm.submit();
document.getElementById("submitID").innerHTML = '<img src="/web/20110901145833/https://static.virginamerica.com/images/btn_sign-in.gif" height="20" width="63" alt="Sign In" title="Sign In" border="0" />';
showWaitImage();
}
function signInElevateHome(pageValue) {
document.signInForm.method.value = "signInFromHome";
document.signInForm.fltMethod.value = pageValue;
document.signInForm.action = "/signInTravellerAndPurchase.do";
document.signInForm.submit();
document.getElementById("submitID").innerHTML = '<img src="/web/20110901145833/https://static.virginamerica.com/images/btn_sign-in.gif" height="20" width="63" alt="Sign In" title="Sign In" border="0" />';
showWaitImage();
}
function MakeCursor(abh) {
abh.style.cursor = "pointer";
}
function enterSignInlogin(thisobj) {
var TestVar2 = thisobj.value;
TestVar2 = TestVar2.replace(/^\s+/, "");
if (TestVar2 == "") {
TestVar2 = "Email, Alias or Elevate#";
thisobj.value = TestVar2;
}
}
function enterSignloginclk(thisobj) {
TestVar2 = "Email, Alias or Elevate#";
if (thisobj.value == TestVar2) {
thisobj.value = TestVar2;
thisobj.focus();
thisobj.select();
}
}
function signInAnswerclk(thisobj) {
TestVar2 = "Answer";
if (thisobj.value == TestVar2) {
thisobj.value = TestVar2;
thisobj.focus();
thisobj.select();
}
}
function signInAnswer(thisobj) {
var TestVar2 = thisobj.value;
TestVar2 = TestVar2.replace(/^\s+/, "");
if (TestVar2 == "") {
TestVar2 = "Answer";
thisobj.value = TestVar2;
}
}
function enterEmailAddress(thisobj) {
var TestVar4 = thisobj.value;
TestVar4 = TestVar4.replace(/^\s+/, "");
if (TestVar4 == "") {
TestVar4 = "Email Address";
thisobj.value = TestVar4;
}
}
function enterEmailAddressclk(thisobj) {
TestVar4 = "Email Address";
if (thisobj.value == TestVar4) {
thisobj.value = TestVar4;
thisobj.focus();
thisobj.select();
}
}
function entername(thisobj) {
var TestVar = thisobj.value;
TestVar = TestVar.replace(/^\s+/, "");
if (TestVar == "") {
TestVar = "Last Name";
thisobj.value = TestVar;
}
}
function enternameclk(thisobj) {
TestVar = "Last Name";
if (thisobj.value == TestVar) {
thisobj.value = TestVar;
thisobj.focus();
thisobj.select();
}
}
function enterpnr(thisobj) {
var TestVar1 = thisobj.value;
TestVar1 = TestVar1.replace(/^\s+/, "");
if (TestVar1 == "") {
TestVar1 = "Confirmation Code";
thisobj.value = TestVar1;
}
}
function enterpnrclk(thisobj) {
TestVar1 = "Confirmation Code";
if (thisobj.value == TestVar1) {
thisobj.value = TestVar1;
thisobj.focus();
thisobj.select();
}
}
function enterlogin(thisobj) {
var TestVar2 = thisobj.value;
TestVar2 = TestVar2.replace(/^\s+/, "");
if (TestVar2 == "") {
TestVar2 = "Email, Alias or Elevate#";
thisobj.value = TestVar2;
}
}
function enterloginclk(thisobj) {
TestVar2 = "Email, Alias or Elevate#";
if (thisobj.value == TestVar2) {
thisobj.value = TestVar2;
thisobj.focus();
thisobj.select();
}
}
function enterpassword(thisobj) {
var TestVar3 = thisobj.value;
TestVar3 = TestVar3.replace(/^\s+/, "");
if (TestVar3 == "") {
TestVar3 = "Password";
thisobj.value = TestVar3;
}
}
function enterpasswordclk(thisobj) {
TestVar3 = "Password";
thisobj.value = TestVar3;
thisobj.focus();
thisobj.select();
}
function enterpassclk(thisobj) {
TestVar3 = "Password";
thisobj.value = TestVar3;
thisobj.focus();
thisobj.select();
}
function setCss(frm, id, cssName) {
$get_JsElement(frm, id).className = cssName;
}
function setCss(obj, cssName) {
obj.className = cssName;
}
function toggleFields(thisobj) {
if (thisobj.parentNode.id == "nor_FieldDivId") {
thisobj.parentNode.style.display = "none";
$get_JsElement("pass_FieldDivId").style.display = "block";
$get_JsElement("pass_FieldDivId").firstChild.value = "";
$get_JsElement("pass_FieldDivId").firstChild.focus();
} else {
if (thisobj.parentNode.id == "pass_FieldDivId" && thisobj.value == "") {
thisobj.parentNode.style.display = "none";
$get_JsElement("nor_FieldDivId").style.display = "block";
$get_JsElement("nor_FieldDivId").firstChild.value = "Password";
$get_JsElement("nor_FieldDivId").firstChild.focus();
}
}
}
function toggleFieldsDisplay(id1, id2) {
$get_JsElement(id1).style.display = "none";
if (id2 == "corp1") {
$get_JsElement("corp1").style.display = "block";
$get_JsElement("sustHrefId").className = "selected";
$get_JsElement("corp2").style.display = "none";
$get_JsElement("commHrefId").className = "";
}
if (id2 == "corp2") {
$get_JsElement("corp2").style.display = "block";
$get_JsElement("commHrefId").className = "selected";
$get_JsElement("corp1").style.display = "none";
$get_JsElement("sustHrefId").className = "";
}
$get_JsElement("aboutusCorporate").href = "aboutus.do?pageName=aboutusCorporate";
}
var character;
var browserAgent;
function returnChar(e) {
var n = navigator;
browserAgent = n.userAgent;
var code;
if (!e) {
var e = window.event;
}
if (e.keyCode) {
code = e.keyCode;
} else {
if (e.which) {
code = e.which;
}
}
var char1 = String.fromCharCode(code);
character = char1;
}
function showPassword(thisobj, passwordFirstDiv, passwordSecondDiv, formName, eventProcedure) {
returnChar(eventProcedure);
var obj = document.getElementById(passwordFirstDiv);
thisobj.name = "pass1";
var documentForm = eval("document." + formName);
document.getElementById(passwordFirstDiv).style.display = "none";
document.getElementById(passwordSecondDiv).style.display = "block";
for (i = 0; i < documentForm.elements.length; i++) {
if (documentForm.elements[i].name == "password") {
if (browserAgent.indexOf("MSIE") != -1) {
documentForm.elements[i].value = "";
} else {
documentForm.elements[i].value = "";
}
documentForm.elements[i].focus();
break;
}
}
}
function showPasswordOnRightClick(thisobj, passwordFirstDiv, passwordSecondDiv, formName, eventProcedure) {
if (eventProcedure.button == 2) {
returnChar(eventProcedure);
var obj = document.getElementById(passwordFirstDiv);
thisobj.name = "pass1";
var documentForm = eval("document." + formName);
document.getElementById(passwordFirstDiv).style.display = "none";
document.getElementById(passwordSecondDiv).style.display = "block";
for (i = 0; i < documentForm.elements.length; i++) {
if (documentForm.elements[i].name == "password") {
if (browserAgent.indexOf("MSIE") != -1) {
documentForm.elements[i].value = "";
} else {
documentForm.elements[i].value = "";
}
documentForm.elements[i].focus();
break;
}
}
}
}
function showMessageForUsers(linkId, popUpId) {
setPosition(document.getElementById(linkId), document.getElementById(popUpId), 180, -45);
document.getElementById(popUpId).style.display = "block";
}
function closeMsgWinForUsers() {
document.getElementById("MessageForUsers").style.display = "none";
document.showNeedPointsForm.submit();
}
function showNormalPasswordGenView(thisobj) {
if (thisobj.value == "") {
var obj = document.getElementById("divpassnewGuest");
thisobj.name = "pass*";
document.getElementById("passwordGuestDiv").style.display = "block";
document.getElementById("divpassnewGuest").style.display = "none";
for (i = 0; i < document.signInForm.elements.length; i++) {
if (document.signInForm.elements[i].name == "password") {
document.signInForm.elements[i].value = "Password";
document.signInForm.elements[i].focus();
break;
}
}
}
}
function showNormalPasswordGen(thisobj) {
if (thisobj.value == "") {
var obj = document.getElementById("divpassnewGuest");
thisobj.name = "pass*";
document.getElementById("passwordGuestDiv").style.display = "block";
document.getElementById("divpassnewGuest").style.display = "none";
for (i = 0; i < document.signInPnrForm.elements.length; i++) {
if (document.signInPnrForm.elements[i].name == "password") {
document.signInPnrForm.elements[i].value = "Password";
document.signInPnrForm.elements[i].focus();
break;
}
}
}
}
function showNormalPassword(thisobj) {
if (thisobj.value == "") {
var obj = document.getElementById("divpassnew");
thisobj.name = "pass*";
document.getElementById("passwordDiv").style.display = "block";
document.getElementById("divpassnew").style.display = "none";
for (i = 0; i < document.signInForm.elements.length; i++) {
if (document.signInForm.elements[i].name == "password") {
document.signInForm.elements[i].focus();
break;
}
}
}
}
function enterflight(thisobj) {
var TestVar2 = thisobj.value;
if (TestVar2 == "") {
TestVar2 = "Flight Number";
thisobj.value = TestVar2;
}
}
function enterflightclk(thisobj) {
TestVar2 = "Flight Number";
if (thisobj.value == "Flight Number") {
thisobj.value = TestVar2;
thisobj.focus();
thisobj.select();
}
}
function setVariables() {
if (document.getElementById("bottomMove")) {
if (navigator.appName == "Netscape") {
v = ".top=";
h = ".left=";
dS = "document.";
sD = "";
y = "window.pageYOffset";
x = 0;
iW = "window.innerWidth";
iH = "window.innerHeight";
} else {
h = ".pixelLeft=";
v = ".pixelTop=";
dS = "";
sD = ".style";
y = "document.body.scrollTop";
x = 0;
iW = "document.body.clientWidth";
iH = "document.body.clientHeight";
}
object = "scrollYTS";
checkLocationA();
}
}
function showHideNewAddressDiv(beanValue, loopId) {
if (beanValue == "newCard") {
document.getElementById("newCardDivOnPopUp" + loopId).style.display = "block";
document.getElementById("div123" + loopId).style.overflow = "auto";
}
if (beanValue == "savedCard") {
document.getElementById("newCardDivOnPopUp" + loopId).style.display = "none";
document.getElementById("div123" + loopId).style.overflow = "auto";
}
}
function changeAddress(addressSize) {
for (i = 0; i < addressSize; i++) {
if (document.getElementById("dynamicAddressDiv" + i)) {
document.getElementById("dynamicAddressDiv" + i).style.display = "none";
}
}
if (document.getElementsByName("viewPurchaseModel.savedAddressName")) {
if (document.getElementsByName("viewPurchaseModel.savedAddressName")[0]) {
var addressIndex = document.getElementsByName("viewPurchaseModel.savedAddressName")[0].selectedIndex;
}
}
var divName = "dynamicAddressDiv" + addressIndex;
if (document.getElementById(divName)) {
document.getElementById(divName).style.display = "block";
}
}
var divToOpenByAjax;
var refDiv;
var addNewAddress = new Array(2);
function openDivForManageCreditCard(divToOpen, posDiv) {
var ajaxUrl = "";
ajaxUrl = "manageCreditCard.do?method=manageCreditCard";
refDiv = posDiv;
ajaxToOpenDiv(ajaxUrl, divToOpen);
}
function openCloseNewCardDiv(beanValue, isReset) {
if (beanValue == "savedCard" || beanValue == "VirginAmericaSignatureCard") {
if (document.getElementById("newCardDiv")) {
document.getElementById("newCardDiv").style.display = "none";
}
}
if (beanValue == "newCard") {
if (document.getElementById("newCardDiv")) {
if (document.getElementById("newCardDiv").style.display == "none") {
var form;
if (document.receiptForm) {
form = document.receiptForm;
} else {
if (document.checkInDetailForm) {
form = document.checkInDetailForm;
} else {
form = document.purchaseForm;
}
}
if (isReset != "no") {
form.elements["viewPurchaseModel.cardNo"].value = "";
if (form.elements["viewPurchaseModel.nameOnCard"]) {
form.elements["viewPurchaseModel.nameOnCard"].value = "";
} else {
if (form.elements["viewPurchaseModel.firstName"]) {
form.elements["viewPurchaseModel.firstName"].value = "";
}
}
form.elements["viewPurchaseModel.cardType"].selectedIndex = 0;
form.elements["viewPurchaseModel.date"].value = "00";
form.elements["viewPurchaseModel.year"].value = "1";
if (form.elements["viewPurchaseModel.cardNickName"]) {
form.elements["viewPurchaseModel.cardNickName"].value = "";
}
}
var els = document.getElementById("newCardDiv").getElementsByTagName("*");
for (var i = 0, j = els.length; i < j; i++) {
if (els[i].className == "style8_error") {
els[i].className = "style8";
} else {
if (els[i].className == "Guest_input_TextType_error") {
els[i].className = "Guest_input_TextType";
} else {
if (els[i].tagName == "IMG" && els[i].getAttribute("src").indexOf("Error_logo_horizontal.gif") != -1) {
els[i].setAttribute("src", "/web/20110901145833/https://static.virginamerica.com/images/spacer.gif");
}
}
}
}
}
document.getElementById("newCardDiv").style.display = "block";
}
}
}
function openCloseNewAddresssDiv(beanValue) {
if (beanValue == "savedAddress") {
if (document.getElementById("newAddressDiv")) {
document.getElementById("newAddressDiv").style.display = "none";
}
}
if (beanValue == "newAddress") {
if (document.getElementById("newAddressDiv")) {
document.getElementById("newAddressDiv").style.display = "block";
}
}
}
function openCloseNewAddressDiv(beanValue) {
if (beanValue == "useOldAddress") {
if (document.getElementById("showNewAddressWindow")) {
document.getElementById("showNewAddressWindow").style.display = "none";
}
}
if (beanValue == "useNewAddress") {
if (document.getElementById("showNewAddressWindow")) {
document.getElementById("showNewAddressWindow").style.display = "block";
}
}
}
function updateCreditCardUrl() {
var updateCreditUrl = null ;
var loop = 0;
updateCreditUrl = "editCreditCardPurchase.do?method=editCreditCardPurchase";
for (i = 0; i < document.modifyProfileForm.elements.length; i++) {
if (document.modifyProfileForm.elements[i].type == "radio") {
if (document.modifyProfileForm.elements[i].checked) {
if (document.modifyProfileForm.elements[i].value == "new") {
addNewAddress[loop] = "new";
loop++;
}
if (document.modifyProfileForm.elements[i].value == "stored") {
addNewAddress[loop] = "stored";
loop++;
}
updateCreditUrl = updateCreditUrl + "&" + document.modifyProfileForm.elements[i].name + "=" + document.modifyProfileForm.elements[i].value;
}
} else {
updateCreditUrl = updateCreditUrl + "&" + document.modifyProfileForm.elements[i].name + "=" + document.modifyProfileForm.elements[i].value;
}
}
ajaxToOpenDiv(updateCreditUrl, "sect");
}
function addCreditCardPurchase() {
var addCardUrl = null ;
addCardUrl = "addCreditCardPurchase.do?method=addCreditCard";
ajaxToOpenDiv(addCardUrl, "manageCreditCardDiv");
}
function moveCreditCardPurchase(movetype) {
var addCardUrl = null ;
addCardUrl = "moveCreditCardPurchase.do?method=moveCreditCard&moveType=" + movetype;
ajaxToOpenDiv(addCardUrl, "manageCreditCardDiv");
}
function deleteCreditCardPurchase(cardId) {
var addCardUrl = null ;
addCardUrl = "deleteCreditCardPurchase.do?method=deleteCreditCard&cardId=" + cardId;
if (cardId == 0) {
ajaxToOpenDiv(addCardUrl, "manageCreditCardDiv");
} else {
ajaxToOpenDiv(addCardUrl, "sect");
}
}
function updatePurchasePage(eId) {
var updateUrl = null ;
updateUrl = "updatePurchasePage.do?method=homeProfileWithPagination&entity=" + eId;
ajaxToOpenDiv(updateUrl, "sect");
}
function ajaxToOpenDiv(myurl, div1) {
if (div1 != "sect") {
document.getElementById(div1).style.display = "none";
showWaitImage();
disableTotalpage();
} else {
document.getElementById("manageCreditCardDiv").style.display = "none";
if (document.getElementById("showManageAddressesDiv")) {
document.getElementById("showManageAddressesDiv").style.display = "none";
}
disableTotalpage();
showWaitImage();
}
xmlhttp = new XMLHttpRequest();
var thetime = new Date();
var dummy = "" + thetime.getHours() + thetime.getMinutes() + thetime.getSeconds();
myurl = myurl + "&dummy=" + dummy;
divToOpenByAjax = div1;
xmlhttp.open("POST", myurl, true);
chkURL = myurl;
xmlhttp.onreadystatechange = handleResponseEditCreditCard;
xmlhttp.send("");
}
function handleResponseEditCreditCard() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
if (xmlhttp.responseText.indexOf("/web/20110901145833/https://static.virginamerica.com/images/manageCreditCard.gif") != -1) {
document.getElementById("manageCreditCardDiv").innerHTML = '<iframe frameborder="0" style="position:absolute;top:0px;left:0px;width:590px;height:395px;" src="html/SSLIframeFixed.html"></iframe>' + '<div style="position: relative;">' + xmlhttp.responseText + "</div>";
divToOpenByAjax = "manageCreditCardDiv";
} else {
document.getElementById(divToOpenByAjax).innerHTML = xmlhttp.responseText;
}
document.getElementById("loadingAnimationDiv").style.display = "none";
document.getElementById(divToOpenByAjax).style.display = "block";
document.getElementById("disableTotalPage").style.display = "none";
if ((document.getElementById("manageCreditCardDiv").innerHTML).indexOf("Your Information has not been successfully updated") != -1) {
document.getElementById("manageCreditCardDiv").style.display = "block";
setPosition(document.getElementById(refDiv), document.getElementById("manageCreditCardDiv"), 215, -20);
}
if (divToOpenByAjax != "sect") {
setPosition(document.getElementById(refDiv), document.getElementById(divToOpenByAjax), 215, -20);
for (k = 0; k < addNewAddress.length; k++) {
if (addNewAddress[k] == "new") {
showHideNewAddressDiv("newCard", k);
addNewAddress[k] = "";
}
}
}
}
}
}
function setPositionTravelExp() {
var toplength = "";
toplength = document.getElementById("scrollYTS").style.top;
if (toplength == "") {
document.getElementById("scrollYTS").style.top = "0pt";
}
var length = document.getElementById("scrollYTS").style.top.split("p");
var totalLength = eval(document.getElementById("bottomMove").offsetTop) + eval(length[0]) + 250;
if (totalLength > getXandY(document.getElementById("ContainerFooter")).y) {
var difference = totalLength - document.getElementById("bottomLimitForScroll").offsetTop - 60;
var YtsTop = eval(length[0] - difference);
if (YtsTop < 4) {
if (document.getElementById("upperLimitForScroll")) {
document.getElementById("scrollYTS").style.top = document.getElementById("upperLimitForScroll").style.top;
}
} else {
document.getElementById("scrollYTS").style.top = YtsTop;
}
if (document.getElementById("upperLimitForScroll")) {
checkLocation();
}
}
}
function checkLocation() {
if (document.getElementById("bottomMove")) {
yy = eval(y);
ydiff = ystart - yy;
if (isScroll == "Yes") {
if ((ydiff < (-1)) || (ydiff > (1))) {
movey = Math.round(ydiff / 10),
ystart -= movey;
}
varEndPoint = ystart;
if (document.getElementById("bodyEnd").offsetTop < document.getElementById("bottomLimitForScroll").offsetTop) {}
if (document.getElementById("bottomLimitForScroll").offsetTop < varEndPoint + (document.getElementById("bottomMove").offsetTop - document.getElementById("topMove").offsetTop) + 150) {} else {
if (document.getElementById("upperLimitForScroll").offsetTop < 0) {} else {
document.getElementById("scrollYTS").style.top = ystart;
}
}
}
setTimeout("checkLocation()", 1);
}
}
function checkLocationA() {
ystart = eval(y);
xstart = eval(x);
}
function delayLogo() {
eval(dS + object + sD + v + 0);
eval(dS + object + sD + h + (-200));
object = "scrollYTS";
}
function closeFareRulDiv(divName) {
document.getElementById(positionDivFare).style.display = "none";
document.getElementById("disableTotalPage").style.display = "none";
isScroll = "Yes";
}
function showPromoCodeDiv(LinkId) {
document.getElementById("promoCodeErrTxt").innerHTML = 'If you happen to have a Virgin America promo code, enter it here and click the "Apply" button to cash in for a lower fare or special offer.';
document.getElementById("searchWinFrm").style.height = 118;
setSafariXY(200, 120, 140, 100);
setPosition(LinkId, document.getElementById("searchPromoCode"), loadX, loadY);
document.getElementById("searchPromoCode").style.display = "block";
document.getElementById("promoCodeText").value = "";
document.getElementById("promoCodeText").focus();
checkSearchTypeLink = LinkId;
}
function removePromoCode(pageName) {
if (document.getElementById("loadingAnimationDiv")) {
showWaitImage();
} else {
showWaitImage();
}
var removePromoUrl = "promoCodeRemove.do?method=removePromoCode&pageName=" + pageName;
promoCodeRemoveAjax(removePromoUrl);
}
var removePromoCodeXmlhttp = new XMLHttpRequest();
function promoCodeRemoveAjax(url) {
removePromoCodeXmlhttp.open("POST", url, true);
removePromoCodeXmlhttp.onreadystatechange = handleResponseRemovePromoCode;
removePromoCodeXmlhttp.send("");
}
function handleResponseRemovePromoCode() {
if (removePromoCodeXmlhttp.readyState == 4) {
if (removePromoCodeXmlhttp.status == 200) {
var resTxt = removePromoCodeXmlhttp.responseText;
ajax("updateTitleBar.do?method=updateTitleBar", "titleBarDiv");
document.getElementById("PromoCodeDetail").innerHTML = resTxt;
enableDisablePointOption(false);
if (document.getElementById("loadingAnimationDiv")) {
$get_JsElement("loadingAnimationDiv").style.display = "none";
}
}
}
}
function ajax(myurl, div) {
var thetime = new Date();
var dummy = "" + thetime.getHours() + thetime.getMinutes() + thetime.getSeconds();
myurl = myurl + "&dummy=" + dummy;
xmlhttp.open("POST", myurl, true);
ajaxDiv = div;
xmlhttp.onreadystatechange = handleResponseSelectUpdateTitleBar;
xmlhttp.send("");
}
function handleResponseSelectUpdateTitleBar() {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/, "");
}
;
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
if ((xmlhttp.responseText).trim() == "AjaxSessionTimeOut") {
window.location = "/home.do?method=virginAmerica&sessionState=sessionTimeOut";
} else {
if ((xmlhttp.responseText).trim() == "AjaxError") {
window.location = "/home.do?method=virginAmerica&fromErrorPage=fromErrorPage";
} else {
if (document.getElementById(ajaxDiv)) {
document.getElementById(ajaxDiv).innerHTML = xmlhttp.responseText;
}
showLoadingImageClose();
}
}
}
}
}
function searchPromoCodeVal() {
var tripType = "other";
if (document.getElementById("divOW").style.display == "block") {
tripType = "OW";
}
if (document.getElementById("promoCodeText").value != "") {
document.flightSearchOWForm.elements["flightSearch.searchPromoCode"].value = document.getElementById("promoCodeText").value;
document.flightSearchRTForm.elements["flightSearch.searchPromoCode"].value = document.getElementById("promoCodeText").value;
document.flightSearchMCForm.elements["flightSearch.searchPromoCode"].value = document.getElementById("promoCodeText").value;
document.getElementById("promoCodeText").focus();
} else {
document.flightSearchOWForm.elements["flightSearch.searchPromoCode"].value = "";
document.flightSearchRTForm.elements["flightSearch.searchPromoCode"].value = "";
document.flightSearchMCForm.elements["flightSearch.searchPromoCode"].value = "";
}
var promoUrl = "promoCodeApply.do?method=applyPromoCode&certCode=" + document.getElementById("promoCodeText").value + "&tripType=" + tripType;
showWaitImage(checkSearchTypeLink);
promoCodeAjax(promoUrl);
}
var promoCodeXmlhttp = new XMLHttpRequest();
function promoCodeAjax(url) {
promoCodeXmlhttp.open("POST", url, true);
promoCodeXmlhttp.onreadystatechange = handleResponsePromoCode;
promoCodeXmlhttp.send("");
}
function handleResponsePromoCode() {
if (promoCodeXmlhttp.readyState == 4) {
if (promoCodeXmlhttp.status == 200) {
var resTxt = promoCodeXmlhttp.responseText;
var errorElements = getElementsByClassName("errorLabel");
if (errorElements) {
for (i = 0; i < errorElements.length; i++) {
errorElements[i].className = errorElements[i].className.replace("errorLabel", "");
}
}
if (document.getElementById("BookFlightDiv")) {
var els = document.getElementById("BookFlightDiv").getElementsByTagName("*");
for (var i = 0, j = els.length; i < j; i++) {
if (els[i].className == "error") {
els[i].className = "";
} else {
if (els[i].className != "ErrorMessage" && els[i].className.indexOf("Error") != -1) {
els[i].className = els[i].className.substring(0, els[i].className.indexOf("Error"));
}
}
}
}
if (resTxt.indexOf("esc-sign") == -1 && resTxt.indexOf("escSignImg") == -1) {
document.getElementById("PromoCodeDetail").innerHTML = resTxt;
$get_JsElement("ErrorMessage").style.display = "none";
enableDisablePointOption(true);
ajax("updateTitleBar.do?method=updateTitleBar", "titleBarDiv");
} else {
$get_JsElement("ErrorMessage").style.display = "block";
$get_JsElement("promoCodeText").className = "promocode_error";
if (document.getElementById("homeErrorMessageDiv")) {
document.getElementById("homeErrorMessageDiv").style.display = "block";
}
if (typeof (wichSelected) != "undefined" && typeof (currentTripType) != "undefined") {
if (currentTripType == "ow") {
wichSelected = "divOW";
} else {
if (currentTripType == "rt") {
wichSelected = "divRT";
} else {
wichSelected = "divMC";
}
}
}
errorPresent = true;
$get_JsElement("ErrorMessage").innerHTML = resTxt;
increaseErrorCount("promoCode", document.estara_form);
}
}
showLoadingImageClose();
if (document.getElementById("loadingAnimationDiv")) {
prvTripType = currentTripType;
$get_JsElement("loadingAnimationDiv").style.display = "none";
}
}
}
function enableDisablePointOption(optionFlg) {
flg = false;
for (frmCnt = 0; frmCnt < document.forms.length; frmCnt++) {
for (eleCnt = 0; eleCnt < document.forms[frmCnt].elements.length; eleCnt++) {
ele = document.forms[frmCnt].elements[eleCnt];
if ((ele.name == "fareFormatType" || ele.name == "flightSearch.fareFormatType") && ele.value == "Points") {
if (optionFlg) {
ele.disabled = "disabled";
ele.checked = false;
} else {
ele.disabled = false;
}
flg = true;
break;
}
}
if (flg) {
break;
}
}
}
function callWantPromoCode() {
document.MeetVaForm.method.value = "showWantMeetVa";
document.MeetVaForm.action = "wantPromoCode.do";
document.MeetVaForm.submit();
}
function closeDiv(divID) {
document.getElementById(divID).style.display = "none";
}
function chVarDisable() {
disableIds = 0;
}
function SS_MakeCursor(arg, btnIds) {
if (disableIds == 1) {
arg.style.cursor = "default";
}
if (disableIds == 0) {
arg.style.cursor = "pointer";
if (btnIds == "continue") {
MM_swapImage("continue", "", "/web/20110901145833/https://static.virginamerica.com/images/btn_GoOn_roll.gif", 1);
}
if (btnIds == "previous") {
MM_swapImage("previous", "", "/web/20110901145833/https://static.virginamerica.com/images/btn_GoBack_roll.gif", 1);
}
}
}
function getAnchorXY(VF_id) {
var c = getAnchorPosition(VF_id);
X1 = c.x;
Y1 = c.y;
}
function MakeCursor(arg) {
arg.style.cursor = "pointer";
}
function isValidDate(dateStr) {
var bool = true;
if (dateStr != "" && dateStr != "----------------------------") {
var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{2}|\d{4})$/;
var matchArray = dateStr.match(datePat);
if (dateStr == "mm/dd/yyyy" || dateStr == "") {
dateStr = "";
return true;
}
if (matchArray != null ) {
month = matchArray[1];
day = matchArray[3];
year = matchArray[4];
if (month < 1 || month > 12) {
document.getElementById("textMessage").innerHTML = "Month must be between 1 and 12.";
document.getElementById("formatMessage").style.display = "block";
bool = false;
}
if (day < 1 || day > 31) {
document.getElementById("textMessage").innerHTML = "Day must be between 1 and 31.";
document.getElementById("formatMessage").style.display = "block";
bool = false;
}
if ((month == 4 || month == 6 || month == 9 || month == 11) && day == 31) {
document.getElementById("textMessage").innerHTML = "Month " + month + " doesn't have 31 days!";
document.getElementById("formatMessage").style.display = "block";
bool = false;
}
if (month == 2) {
var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
if (day > 29 || (day == 29 && !isleap)) {
document.getElementById("textMessage").innerHTML = "February " + year + " doesn't have " + day + " days!";
document.getElementById("formatMessage").style.display = "block";
bool = false;
}
}
if (year.length != 4) {
document.getElementById("textMessage").innerHTML = "Year format should be in 'yyyy'.";
document.getElementById("formatMessage").style.display = "block";
bool = false;
}
} else {
document.getElementById("textMessage").innerHTML = "Please provide proper date format (mm/dd/yyyy)";
document.getElementById("formatMessage").style.display = "block";
bool = false;
}
}
return bool;
}
function checkDateAndSubmit(date1, date2, frm, buttonName, searchPage) {
if (document.getElementById("titleBarDiv")) {
updateTitileBar("updateTitleBar.do?method=updateTitleBar&atHome=atHome", "titleBarDiv");
}
if (searchPage) {
if (searchPage == "true") {
if (document.getElementById("divRT").style.display == "block") {
date1 = document.flightSearchRTForm.elements["flightSearch.depDate.MMDDYYYY"].value;
date2 = document.flightSearchRTForm.elements["flightSearch.returnDate.MMDDYYYY"].value;
frm = document.flightSearchRTForm;
} else {
if (document.getElementById("divOW").style.display == "block") {
date1 = document.flightSearchOWForm.elements["flightSearch.depDateOW.MMDDYYYY"].value;
date2 = "mm/dd/yyyy";
frm = document.flightSearchOWForm;
} else {
date1 = document.flightSearchMCForm.elements["flightSearch.depDateMC.MMDDYYYY"].value;
date2 = document.flightSearchMCForm.elements["flightSearch.returnDateMC.MMDDYYYY"].value;
frm = document.flightSearchMCForm;
}
}
}
}
var dt = (new Date().getMonth() + 1) + "/" + new Date().getDate() + "/" + (new Date().getYear() + 1900);
var dt1 = (new Date().getMonth() + 1) + "/" + new Date().getDate() + "/" + (new Date().getYear());
var date11 = new Date(date1);
var date22 = new Date(date2);
var expiredays = 30;
var exdate = new Date();
exdate.setDate(exdate.getDate() + expiredays);
if (frm.name == "flightSearchRTForm") {
setCookie("TT", "rt", exdate);
} else {
if (frm.name == "flightSearchOWForm") {
setCookie("TT", "ow", exdate);
} else {
setCookie("TT", "mc", exdate);
}
}
if (frm.action.indexOf("ScheduleResult") != -1) {
frm.elements["flightSearch.adults"].value = "1";
frm.elements["flightSearch.kids"].value = "0";
}
setCookies();
if (isValidDate(date1) && isValidDate(date2)) {
if ((((date1 + "") == (dt + "") && (date2 + "") == (dt + "")) || ((date1 + "") == (dt1 + "") && (date2 + "") == (dt1 + ""))) && (date1 + "") != "mm/dd/yyyy" && (date1 + "") != "") {
FrmToSubmit = frm;
buttonURL = buttonName;
flgMsg = false;
if (arguments[5] != null ) {
sameDayFlightsMessageOpen("false", arguments[5]);
} else {
sameDayFlightsMessageOpen("false");
}
} else {
if (((date1 + "") == (date2 + "")) && (date2 + "") != (dt + "") && (date1 + "") != "mm/dd/yyyy" && (date1 + "") != "") {
flgMsg = true;
FrmToSubmit = frm;
buttonURL = buttonName;
if (arguments[5] != null ) {
sameDayFlightsMessageOpen("false", arguments[5]);
} else {
sameDayFlightsMessageOpen("false");
}
} else {
if ((((date1 + "") == (dt + "") && (date2 + "") != (dt + "")) || ((date1 + "") == (dt1 + "") && (date2 + "") != (dt1 + ""))) && (date1 + "") != "mm/dd/yyyy" && (date1 + "") != "") {
FrmToSubmit = frm;
flgMsg = false;
buttonURL = buttonName;
if (arguments[5] != null ) {
setSafariXY(450, 375, 300, 90);
} else {
setSafariXY(150, 100, 150, 90);
}
setPosition(buttonURL, document.getElementById("message"), loadX, loadY);
document.getElementById("message").style.left = "46%";
document.getElementById("message").style.display = "block";
document.getElementById("timePopUp").focus();
} else {
if ((((date1 + "") != (dt + "") && (date2 + "") == (dt + "")) || ((date1 + "") != (dt1 + "") && (date2 + "") == (dt1 + ""))) && (date1 + "") != "mm/dd/yyyy" && (date1 + "") != "") {
FrmToSubmit = frm;
flgMsg = false;
buttonURL = buttonName;
if (arguments[5] != null ) {
setSafariXY(450, 375, 300, 90);
} else {
setSafariXY(450, 100, 150, 90);
}
setPosition(buttonURL, document.getElementById("message"), loadX, loadY);
document.getElementById("message").style.left = "46%";
document.getElementById("message").style.display = "block";
document.getElementById("timePopUp").focus();
} else {
showWaitImage();
frm.submit();
}
}
}
}
}
}
function updateTitileBar(myurl, div) {
var thetime = new Date();
var dummy = "" + thetime.getHours() + thetime.getMinutes() + thetime.getSeconds();
myurl = myurl + "&dummy=" + dummy;
ajaxDiv = div;
xmlhttp.open("POST", myurl, true);
xmlhttp.onreadystatechange = handleResponseofTitleBar;
xmlhttp.send("");
}
function handleResponseofTitleBar() {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/, "");
}
;
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
if ((xmlhttp.responseText).trim() == "AjaxSessionTimeOut") {
window.location = "/home.do?method=virginAmerica&sessionState=sessionTimeOut";
} else {
document.getElementById(ajaxDiv).innerHTML = xmlhttp.responseText;
}
}
}
}
function changeFlightStatusDestinationFields(x, desValue, pageId) {
var temp1 = document.flightStatusForm.elements["flightStatus.destination"];
var selInd = 0;
if (x != 0) {
for (m = temp1.options.length - 1; m > 0; m--) {
temp1.options[m] = null ;
}
}
for (i = 0; i < group[x].length; i++) {
temp1.options[i] = new Option(group[x][i].text,group[x][i].value);
if (group[x][i].value == desValue) {
selInd = i;
}
}
if (desValue == "To") {
temp1.options[0].selected = true;
} else {
temp1.options[selInd].selected = true;
}
if (pageId) {
fltStsloadComboBox();
}
}
function fltStsloadComboBox() {
$("#fltStsDesDiv a").remove();
$("#fltStsDesDiv div").remove();
$("#fltStsDesDiv select").selectbox({
debug: false
});
}
function IsNumeric(strString) {
var strValidChars = "0123456789.-";
var strChar;
var blnResult = true;
if (strString.length == 0) {
return false;
}
for (i = 0; i < strString.length && blnResult == true; i++) {
strChar = strString.charAt(i);
if (strValidChars.indexOf(strChar) == -1) {
blnResult = false;
}
}
return blnResult;
}
function getXandY(oElement) {
if (oElement) {
if (oElement != null ) {
var r = 0;
r = {
x: oElement.offsetLeft,
y: oElement.offsetTop
};
while (oElement != null ) {
r.x += oElement.offsetLeft;
r.y += oElement.offsetTop;
oElement = oElement.offsetParent;
}
return r;
}
}
}
function setObjOffset(oElement, divObj, lftDis, topDis) {
if (oElement) {
var offsetParent = oElement.offsetParent;
var parent = oElement.parentNode;
var r = {
x: oElement.offsetLeft,
y: oElement.offsetTop
};
while (offsetParent) {
r.x += offsetParent.offsetLeft;
r.y += offsetParent.offsetTop;
offsetParent = offsetParent.offsetParent;
}
divObj.style.left = (r.x + lftDis) + "px";
divObj.style.top = (r.y + topDis) + "px";
}
}
function showLoading(oElement) {
var loadingObj = document.getElementById("loadingAnimationDiv");
if (oElement) {
var offsetParent = oElement.offsetParent;
var parent = oElement.parentNode;
var r = {
x: oElement.offsetLeft,
y: oElement.offsetTop
};
while (offsetParent) {
r.x += offsetParent.offsetLeft;
r.y += offsetParent.offsetTop;
offsetParent = offsetParent.offsetParent;
}
loadingObj.style.left = (r.x - 10) + "px";
loadingObj.style.top = (r.y - 50) + "px";
}
loadingObj.style.display = "block";
}
function setPosition(oElement, divObj, lftDis, topDis) {
if (oElement) {
divObj.style.left = (getXandY(oElement).x - lftDis) + "px";
divObj.style.top = (getXandY(oElement).y - topDis) + "px";
}
}
function setCookies() {
var i = 0;
var expiredays = 30;
var exdate = new Date();
exdate.setDate(exdate.getDate() + expiredays);
var mcDepDate2 = "";
for (j = 0; j < document.flightSearchRTForm.elements.length; j++) {
var obj = document.flightSearchRTForm.elements[j];
if (obj.name == "flightSearch.origin") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.destination") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.depDate.MMDDYYYY") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.returnDate.MMDDYYYY") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.adults") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.kids") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.infants") {
setCookie(obj.name, escape(obj.value), exdate);
}
}
}
}
}
}
}
}
for (j = 0; j < document.flightSearchOWForm.elements.length; j++) {
var obj = document.flightSearchOWForm.elements[j];
if (obj.name == "flightSearch.origin") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.destination") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.depDateOW.MMDDYYYY") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.adults") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.kids") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.infants") {
setCookie(obj.name, escape(obj.value), exdate);
}
}
}
}
}
}
}
for (j = 0; j < document.flightSearchMCForm.elements.length; j++) {
var obj = document.flightSearchMCForm.elements[j];
if (obj.name == "flightSearch.origin") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.destination") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.depDateMC.MMDDYYYY") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.originMC") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.destinationMC") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.returnDateMC.MMDDYYYY") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.adults") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.kids") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.infants") {
setCookie(obj.name, escape(obj.value), exdate);
}
}
}
}
}
}
}
}
}
}
}
function setFlightStatusCookies() {
var i = 0;
var expiredays = 30;
var exdate = new Date();
exdate.setDate(exdate.getDate() + expiredays);
var mcDepDate2 = "";
for (j = 0; j < document.flightStatusForm.elements.length; j++) {
var obj = document.flightStatusForm.elements[j];
if (obj.name == "flightStatus.flightDate") {
setCookie(obj.name, escape(obj.selectedIndex), exdate);
} else {
if (obj.name == "flightStatus.flightNumber") {
setCookie(obj.name, obj.value, exdate);
} else {
if (obj.name == "flightStatus.origin") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightStatus.destination") {
setCookie(obj.name, escape(obj.value), exdate);
}
}
}
}
}
}
function setCookieArray(name) {
this.length = setCookieArray.arguments.length - 1;
for (var i = 0; i < this.length; i++) {
this[i + 1] = setCookieArray.arguments[i + 1];
setCookie(name + i, this[i + 1], expdate);
}
}
function setCookie(name, value, expires) {
if (!expires) {
expires = new Date();
}
document.cookie = name + "=" + escape(value) + "; expires=" + expires.toGMTString() + "; path=/";
}
function decision(message, submitFrm) {
FrmToSubmit = submitFrm;
decisionYes();
}
function decisionYes() {
document.getElementById("messageShortjourney").style.display = "none";
if (flgMsg) {
FrmToSubmit.submit();
showWaitImage(buttonURL);
} else {
setPosition(buttonURL, document.getElementById("message"), 150, 100);
document.getElementById("message").style.display = "block";
}
}
function decisionNo(divIDForHide) {
document.getElementById(divIDForHide).style.display = "none";
}
function shrtFrmSubmit(divIDForHide) {
FrmToSubmit.submit();
showWaitImage();
document.getElementById("message").style.display = "none";
}
function sameDayFlightsMessageOpen(checkFlag) {
if (checkFlag == "false") {
if (arguments[1] != null ) {
setSafariXY(435, 375, 300, 90);
} else {
setSafariXY(150, 100, 150, 90);
}
setPosition(buttonURL, document.getElementById("SameDayFlightsMessageId"), loadX, loadY);
document.getElementById("SameDayFlightsMessageId").style.left = "45%";
document.getElementById("SameDayFlightsMessageId").style.display = "block";
}
}
function sameDayFlightsMessageClose(closeType) {
if (closeType == "true") {
if (flgMsg) {
FrmToSubmit.submit();
if (arguments[1] != null ) {
showWaitImage(buttonURL, arguments[1]);
} else {
showWaitImage(buttonURL);
}
} else {
document.getElementById("SameDayFlightsMessageId").style.display = "none";
if (arguments[1] != null ) {
setSafariXY(435, 375, 300, 90);
} else {
setSafariXY(150, 100, 150, 90);
}
if (document.flightSearchForm && document.getElementById("btnModifySearch")) {
$("#message").css({
top: ($("#btnModifySearch").offset().top) + "px",
left: ($("#btnModifySearch").offset().left - 60) + "px"
});
} else {
setPosition(buttonURL, document.getElementById("message"), loadX, loadY);
document.getElementById("message").style.left = "45%";
}
document.getElementById("message").style.display = "block";
}
document.getElementById("SameDayFlightsMessageId").style.display = "none";
} else {
document.getElementById("message").style.display = "none";
document.getElementById("SameDayFlightsMessageId").style.display = "none";
}
}
function checkFax(faxType, event) {
var faxNo = "";
var key = "";
var type = false;
type = CheckNumeric(event);
if (type) {
for (j = 0; j < document.receiptForm.elements.length; j++) {
if (document.receiptForm.elements[j].name == faxType) {
faxNo = document.receiptForm.elements[j].value;
break;
}
}
var index = j;
if ((faxNo.length == 3) || (faxNo.length == 7)) {
var separator = "-";
faxNo = faxNo.concat(separator);
document.receiptForm.elements[index].value = faxNo;
}
if ((faxNo.length == 13) && (faxNo.search(/-/) >= 0)) {
var str1 = faxNo.slice(0, 3);
var str2 = faxNo.slice(4, 7);
var str3 = faxNo.slice(8);
faxNo = str1 + str2 + str3;
document.receiptForm.elements[index].value = faxNo;
}
}
}
function CheckNumeric(e) {
var KeyID = (window.event) ? event.keyCode : e.keyCode;
if (KeyID == 8) {
return false;
} else {
return true;
}
}
function changeImageOnMouseOverOrOut(obj, IMG) {
obj.src = IMG;
obj.style.cursor = "pointer";
}
function divhideFunctionTravel2(divID, clickedObject, toChangeIMG, toChangeIMGCol) {
var x = document.getElementById(divID);
if (x.style.display == "block") {
x.style.display = "none";
clickedObject.src = toChangeIMGCol;
} else {
if (x.style.display == "none" || x.style.display == "") {
x.style.display = "block";
clickedObject.src = toChangeIMG;
}
}
}
function viewFare(viewFare_id) {
var x = "";
getAnchorXY(viewFare_id);
document.getElementById("viewFare").style.left = X1 - 412;
document.getElementById("viewFare").style.top = Y1 + 15;
document.getElementById("viewFare").style.position = "absolute";
document.getElementById("viewFare").style.display = "block";
}
function CreateProfileForm() {
document.createProfileForm.method.value = "createProfile";
document.createProfileForm.submit();
}
function fareRulesDescriptionPopUp(fareBaseCode, fareBaseCodeS, route, routeS, clickObjId, pnrNumber) {
showWaitImage();
var thisXoffset = 0;
var thisYoffset = 0;
var URL = "fareRuleDescription.do?method=fareRuleDescription&fareBaseCode=" + fareBaseCode + "&fareBaseCodeS=" + fareBaseCodeS + "&route=" + route + "&routeS=" + routeS;
if (pnrNumber) {
URL = URL + "&pnrNumber=" + pnrNumber;
}
var xmlHttp = $.ajax({
type: "GET",
url: URL,
dataType: "html",
success: function(html) {
$(xmlHttp.responseText).find("#fareRulesText").html();
$("#popupMsgArea").html($(xmlHttp.responseText).find("#fareRulesText").html());
$("#popupMsgArea").find("table").width(525);
$("#AcceptId").show();
$("#popupTitle").html("Fare Rules");
$("#popupTitle").html("Fare Rules");
$("#popupTable").width(525);
$("#popupFrame").width(525);
$("#popupFrame").height($("#popupId").height());
if (clickObjId.indexOf("ffReviewFareRules") != -1) {
thisXoffset = -350;
thisYoffset = -200;
document.getElementById("fareRulesBodyTable").style.width = "450";
document.getElementById("fareRulesBodyTable").style.marginLeft = "0px";
}
$("#popupId").css({
top: ($("#" + clickObjId).offset().top - ($("#popupId").height()) - thisYoffset) + "px",
left: ($("#" + clickObjId).offset().left - ($("#popupId").width() / 2) - thisXoffset) + "px"
});
$("#popupId").show();
closeWaitImage();
}
});
}
function callFareRulesDescription(fareBaseCode, fareBaseCodeS, route, routeS, psDiv, actDiv) {
positionDivFare = psDiv;
actualDiv = actDiv;
NewMyUrl = "fareRuleDescription.do?method=fareRuleDescription&fareBaseCode=" + fareBaseCode + "&fareBaseCodeS=" + fareBaseCodeS + "&route=" + route + "&routeS=" + routeS;
FareRulesAjax(NewMyUrl, "viewFareRuleDes");
}
function disableTotalpage() {
document.getElementById("disableTotalPage").style.top = 0;
document.getElementById("disableTotalPage").style.left = 0;
document.getElementById("disableTotalPage").style.height = getXandY(document.getElementById("ContainerFooter")).y;
document.getElementById("disableTotalPage").style.width = 950;
document.getElementById("disableTotalPage").style.display = "block";
}
function enableTotalPage() {
document.getElementById("disableTotalPage").style.display = "none";
}
var FareRulesXmlhttp = new XMLHttpRequest();
var FareRulesAjaxDiv = null ;
function FareRulesAjax(myurl2, div) {
var thetime1 = new Date();
var dummy = "" + thetime1.getHours() + thetime1.getMinutes() + thetime1.getSeconds();
myurl2 = myurl2 + "&dummy=" + dummy;
FareRulesAjaxDiv = div;
FareRulesXmlhttp.open("GET", myurl2, true);
FareRulesXmlhttp.onreadystatechange = handleResponseFareRules;
FareRulesXmlhttp.send(null );
}
function handleResponseFareRules() {
if (FareRulesXmlhttp.readyState == 4) {
if (FareRulesXmlhttp.status == 200) {
document.getElementById(positionDivFare).style.display = "block";
if (positionDivFare == "viewFareRuleDiv") {
document.getElementById("viewFareRuleInnerDiv").innerHTML = FareRulesXmlhttp.responseText;
}
if (positionDivFare == "viewFareRuleDesT") {
document.getElementById("viewFareRuleDesInnerT").innerHTML = FareRulesXmlhttp.responseText;
}
if (positionDivFare == "viewFareRuleDesR") {
document.getElementById("viewFareRuleDesInnerR").innerHTML = FareRulesXmlhttp.responseText;
}
if (positionDivFare == "viewFareRuleDesB") {
document.getElementById("viewFareRuleDesInnerB").innerHTML = FareRulesXmlhttp.responseText;
}
if (positionDivFare == "viewFareRuleDesTB") {
document.getElementById("viewFareRuleDesInnerTB").innerHTML = FareRulesXmlhttp.responseText;
}
if (positionDivFare == "viewFareRuleDesTBS") {
document.getElementById("viewFareRuleDesInnerTBS").innerHTML = FareRulesXmlhttp.responseText;
}
if (document.all) {
if (actualDiv != "fareRuleDescription_cancel" && actualDiv != "fareRuleDescription_R") {
document.getElementById(positionDivFare).style.left = document.getElementById(actualDiv).offsetLeft - 300;
}
}
if (navigator.userAgent.indexOf("Safari") != -1) {
if (actualDiv != "fareRuleDescription_cancel") {
document.getElementById(positionDivFare).style.left = document.getElementById(actualDiv).offsetLeft - 300;
}
}
var posx = 0;
var posy = 0;
var xOffset = 0;
var yOffset = 0;
var obj = document.getElementById(actualDiv);
if (obj.offsetParent) {
while (obj.offsetParent) {
posx += obj.offsetLeft;
posy += obj.offsetTop;
obj = obj.offsetParent;
}
} else {
if (obj.x) {
posx += obj.x;
posy += obj.y;
}
}
xOffset = -300;
yOffset = 0;
if (actualDiv.indexOf("two") != -1 || actualDiv.indexOf("mid") != -1) {
yOffset = -200;
}
if (actualDiv.indexOf("two") != -1 && isPCIE6 == 1) {
yOffset = -200;
}
if (actualDiv.indexOf("two") != -1 && isFF == 1) {
yOffset = -250;
}
document.getElementById(positionDivFare).style.left = (posx + xOffset);
document.getElementById(positionDivFare).style.top = (posy + yOffset);
isScroll = "No";
}
}
}
var vision = "";
var people = "";
var press = "";
var navthisid = "";
function changeNavTitleBarImage() {
document.getElementById("Vision").src = "/web/20110901145833/https://static.virginamerica.com/images/btn_what_we_about_off.gif";
document.getElementById("People").src = "/web/20110901145833/https://static.virginamerica.com/images/btn_people_off.gif";
document.getElementById("Press").src = "/web/20110901145833/https://static.virginamerica.com/images/btn_press_off.gif";
}
function navmouseover(imgCurrObj, thisid) {
if (thisid == "Vision") {
if (vision == "") {
MakeCursor(imgCurrObj);
MM_swapImage("Vision", "", "/web/20110901145833/https://static.virginamerica.com/images/btn_what_we_about_on.gif", 1);
}
}
if (thisid == "People") {
if (people == "") {
MakeCursor(imgCurrObj);
MM_swapImage("People", "", "/web/20110901145833/https://static.virginamerica.com/images/btn_people_on.gif", 1);
}
}
if (thisid == "Press") {
if (press == "") {
MakeCursor(imgCurrObj);
MM_swapImage("Press", "", "/web/20110901145833/https://static.virginamerica.com/images/btn_press_on.gif", 1);
}
}
}
function callMeetVaPages(thisid) {
navthisid = thisid;
document.MeetVaForm.method.value = "showMeetVa";
if (thisid == "Vision") {
if (vision == "") {
document.MeetVaForm.NavChImage.value = "Vision";
document.MeetVaForm.action = "meetVa.do";
}
}
if (thisid == "People") {
if (people == "") {
document.MeetVaForm.NavChImage.value = "People";
document.MeetVaForm.action = "meetVaTeam.do";
}
}
if (thisid == "People1") {
if (people == "") {
document.MeetVaForm.NavChImage.value = "People";
document.MeetVaForm.action = "meetVaTeam1.do";
}
}
if (thisid == "People2") {
if (people == "") {
document.MeetVaForm.NavChImage.value = "People";
document.MeetVaForm.action = "meetVaTeam2.do";
}
}
if (thisid == "People3") {
if (people == "") {
document.MeetVaForm.NavChImage.value = "People";
document.MeetVaForm.action = "meetVaTeam3.do";
}
}
if (thisid == "People4") {
if (people == "") {
document.MeetVaForm.NavChImage.value = "People";
document.MeetVaForm.action = "meetVaTeam4.do";
}
}
if (thisid == "People5") {
if (people == "") {
document.MeetVaForm.NavChImage.value = "People";
document.MeetVaForm.action = "meetVaTeam5.do";
}
}
if (thisid == "People6") {
if (people == "") {
document.MeetVaForm.NavChImage.value = "People";
document.MeetVaForm.action = "meetVaTeam6.do";
}
}
if (thisid == "People7") {
if (people == "") {
document.MeetVaForm.NavChImage.value = "People";
document.MeetVaForm.action = "meetVaTeam7.do";
}
}
if (thisid == "People8") {
if (people == "") {
document.MeetVaForm.NavChImage.value = "People";
document.MeetVaForm.action = "meetVaTeam8.do";
}
}
if (thisid == "People9") {
if (people == "") {
document.MeetVaForm.NavChImage.value = "People";
document.MeetVaForm.action = "meetVaTeam9.do";
}
}
if (thisid == "People10") {
if (people == "") {
document.MeetVaForm.NavChImage.value = "People";
document.MeetVaForm.action = "meetVaTeam10.do";
}
}
if (thisid == "People11") {
if (people == "") {
document.MeetVaForm.NavChImage.value = "People";
document.MeetVaForm.action = "meetVaTeam11.do";
}
}
if (thisid == "Press") {
if (press == "") {
document.MeetVaForm.NavChImage.value = "Press";
document.MeetVaForm.action = "meetVaPress.do";
}
}
document.MeetVaForm.submit();
}
function openWinPrintItinerary(actionUrl) {
var disp_setting = "toolbar=no,location=no,directories=no,menubar=yes,";
disp_setting += "scrollbars=yes,width=762, height=670, left=0, top=0";
var urls = actionUrl;
window.open(urls, "", disp_setting);
}
function openChangeSeatPrintItinerary(actionUrl) {
var disp_setting = "toolbar=no,location=no,directories=no,menubar=yes,";
disp_setting += "scrollbars=yes,width=650, height=670, left=0, top=0";
var urls = actionUrl;
window.open(urls, "", disp_setting);
}
function closeWindow() {
self.close();
}
function CallElevate() {
location.href = "whatIseleVAte.do?method=showwhatIseleVAte";
}
function hidePopUp() {
document.getElementById("Hrefmessage").style.display = "none";
}
function sumitSearchWithEnterKey(enterId, evt) {
if (window.event) {
Key = window.event.keyCode;
} else {
if (evt) {
Key = evt.which;
}
}
if (Key == 13) {
document.getElementById(enterId).onclick();
return false;
} else {
return true;
}
}
var clearPopupInterval;
var counter = 20;
function updatePopup(pageName, title, popupWidth, clkObj, showBtn, lftMrg, rgtMrg, decision, openParameter, functionCalled) {
if (clearPopupInterval) {
clearInterval(clearPopupInterval);
counter = 20;
}
$("#popupMsgArea").load(pageName, "cache:false", done);
function done() {
document.getElementById("AcceptId").style.display = "none";
document.getElementById("popupTitle").innerHTML = title;
var popupElement = document.getElementById("popupTable");
popupElement.style.width = eval(popupWidth);
var popupFrame = document.getElementById("popupFrame");
setObjOffset(clkObj, document.getElementById("popupId"), lftMrg, rgtMrg);
if (eval(showBtn)) {
document.getElementById("AcceptId").style.display = "block";
}
if (eval(decision)) {
var el = document.getElementById("AcceptId");
document.getElementById("declinedId").style.display = "block";
el.setAttribute("onclick", functionCalled + ";closePopup('popupId');");
}
var popupDiv = document.getElementById("popupId");
document.getElementById("popupId").style.display = "block";
popupFrame.style.width = eval(popupWidth) - 20;
popupFrame.style.height = popupDiv.offsetHeight - 20;
if (openParameter) {
document.getElementById("popUpOpenParameter").innerHTML = openParameter;
}
if (document.getElementById("loadingAnimationDiv")) {
closeWaitImage();
}
}
}
function closePopup(divId) {
if (clearPopupInterval) {
clearInterval(clearPopupInterval);
counter = 20;
}
document.getElementById(divId).style.display = "none";
}
function goBackToTravelManager(formName) {
frmObj = eval("document." + formName);
frmObj.submit();
}
function callJobsPages(thisid) {
if (thisid == "jobsWhyVA") {
document.privacyPolicy.method.value = "showjobs";
document.privacyPolicy.action = "jobsWhyVA.do";
document.privacyPolicy.submit();
}
if (thisid == "jobsAlex") {
document.privacyPolicy.method.value = "showjobs";
document.privacyPolicy.action = "jobsAlex.do";
document.privacyPolicy.submit();
}
if (thisid == "jobsDiversity") {
document.privacyPolicy.method.value = "showjobs";
document.privacyPolicy.action = "jobsDiversity.do";
document.privacyPolicy.submit();
}
if (thisid == "jobsGetToKnowUs") {
document.privacyPolicy.method.value = "showjobs";
document.privacyPolicy.action = "jobsGetToKnowUs.do";
document.privacyPolicy.submit();
}
if (thisid == "jobsGetToKnowUsJessica") {
document.privacyPolicy.method.value = "showjobs";
document.privacyPolicy.action = "jobsGetToKnowUsJessica.do";
document.privacyPolicy.submit();
}
if (thisid == "jobsJoinTheTeam") {
document.privacyPolicy.method.value = "showjobs";
document.privacyPolicy.action = "jobsJoinTheTeam.do";
document.privacyPolicy.submit();
}
if (thisid == "jobsBenefits") {
document.privacyPolicy.method.value = "showjobs";
document.privacyPolicy.action = "jobsBenefits.do";
document.privacyPolicy.submit();
}
}
function showLoadingImageonPopUp(buttonName) {
var cPopup = getAnchorPosition(buttonName);
var xp = cPopup.x;
var yp = cPopup.y - 10;
if (document.getElementById("loadingAnimationDiv")) {
showWaitImage();
}
}
function showLoadingImageOpenWithAllValues(buttonName, first, second) {
showWaitImage();
}
function showLoadingImageOpen(buttonName) {
showWaitImage();
}
function showLoadingImageClose() {
if (document.getElementById("loadingAnimationDiv")) {
document.getElementById("loadingAnimationDiv").style.display = "none";
}
}
function _showLoadingImageOpen(buttonName) {
showWaitImage();
}
function showPopUp(positionId, tarGetId, setX, setY) {
setPosition($get_JsElement(positionId), $get_JsElement(tarGetId), setX, setY);
$get_JsElement(tarGetId).style.display = "block";
}
function _showLoadingImageClose() {
if (document.getElementById("loadingAnimationDiv")) {
document.getElementById("loadingAnimationDiv").style.display = "none";
}
}
function setDateInWannaBookFlightWindow(tripType, currentDate, segmentNumber) {
if (tripType == "rt") {
if (segmentNumber == 0) {
document.flightSearchRTForm.elements["flightSearch.depDate.MMDDYYYY"].value = currentDate;
} else {
document.flightSearchRTForm.elements["flightSearch.returnDate.MMDDYYYY"].value = currentDate;
}
} else {
if (tripType == "mc") {
if (segmentNumber == 0) {
document.flightSearchMCForm.elements["flightSearch.depDateMC.MMDDYYYY"].value = currentDate;
} else {
document.flightSearchMCForm.elements["flightSearch.returnDateMC.MMDDYYYY"].value = currentDate;
}
} else {
if (tripType == "ow") {
if (segmentNumber == 0) {
document.flightSearchOWForm.elements["flightSearch.depDateOW.MMDDYYYY"].value = currentDate;
}
}
}
}
}
function showScheduleDetials(obj, flightNumber, aircarftType, airPort, journeyTime) {
document.getElementById("flightNumberSpanId").innerHTML = flightNumber;
document.getElementById("aircarftSpanId").innerHTML = aircarftType;
document.getElementById("airPortSpanId").innerHTML = airPort;
document.getElementById("journeTimeSpanId").innerHTML = journeyTime;
document.getElementById("totalJourneTimeSpanId").innerHTML = journeyTime;
var positionObj = "loadImgCenter1";
setPosition(obj, document.getElementById("flightScheduleDetialsDiv"), 50, 30);
document.getElementById("flightScheduleDetialsDiv").style.display = "block";
}
function ChangeGuestType(optval, obj) {
var option = obj.options;
if (optval == "Mr") {
option.selectedIndex = 0;
}
if (optval == "Mrs") {
option.selectedIndex = 0;
}
if (optval == "Miss (Adult)") {
option.selectedIndex = 0;
}
if (optval == "Miss (Child)") {
option.selectedIndex = 2;
}
if (optval == "Ms") {
option.selectedIndex = 0;
}
if (optval == "Mstr (Child)") {
option.selectedIndex = 2;
}
}
function fltErrorMessages(error1, error2, error3, error4, error5, error6, error7, error8) {
fltStatusErrorsRequired = error1;
fltStatusErrorsUnknown = error2;
fltStatusErrorsServiceRequired = error3;
fltStatusErrorsInValidFltNo = error4;
fltStatusErrorsInValidFltNoNotNum = error5;
fltStatusErrorsInValidCityPair = error6;
fltStatusErrorsNoFltGivenDate = error7;
fltStatuserrorsnoData = error8;
}
var img_ID = "";
var idArray = new Array("1A","2A","1C","2C","1D","2D","1F","2F","1B","2B");
var firstClass = "false";
function ShowExitRowDiv(img_id) {
img_ID = img_id;
for (var i = 0; i < idArray.length; i++) {
if (idArray[i] == img_ID) {
img_ID = "firstClass";
}
}
if ((!isMCS) || (img_ID == "firstClass")) {
if (img_ID == "firstClass") {
x = document.getElementById("FirstClassInformation");
} else {
x = document.getElementById("PremiumSeatInformation");
}
getAnchorXY(img_id);
x.style.left = X1 + 14;
x.style.top = Y1 + 14;
x.style.position = "absolute";
x.style.display = "block";
}
}
var checkX = 0;
var checkY = 0;
function ShowExitRowDivOnSelect(img_id) {
img_ID = img_id;
for (var i = 0; i < idArray.length; i++) {
if (idArray[i] == img_ID) {
img_ID = "firstClass";
}
}
if (img_ID == "firstClass") {
x = document.getElementById("FirstClassInformation");
} else {
x = document.getElementById("PremiumSeatInformation");
}
getAnchorXY(img_id);
x.style.left = X1 - checkX + 8;
x.style.top = Y1 - checkY + 8;
x.style.position = "absolute";
x.style.display = "block";
}
function HideExitRowDiv() {
if (img_ID != "") {
if (img_ID == "firstClass") {
document.getElementById("FirstClassInformation").style.display = "none";
} else {
document.getElementById("ExitSeatInformation").style.display = "none";
}
document.getElementById("PremiumSeatInformation").style.display = "none";
img_ID = "";
}
}
var elevateIdValidated = "";
var elevateLabelId = "";
function showTestField(elevateDivId, addDivId) {
document.getElementById(addDivId).style.display = "none";
document.getElementById(elevateDivId).style.display = "block";
}
var guestFFProg;
var elevateIdValidated;
var guestIndex;
var ffprogramlist;
var selectedFFPProgram;
function addElevateIdAction(guestFirstName, guestLastName, guestInd, pnrNo, guestID) {
guestIndex = guestInd;
var guestFirstLastName = guestFirstName + " " + guestLastName;
ffprogramlist = document.getElementById("ffProgram" + guestInd);
guestFFProg = ffprogramlist.options[ffprogramlist.selectedIndex].value;
selectedFFPProgram = ffprogramlist.options[ffprogramlist.selectedIndex].text;
elevateIdValidated = document.getElementById("ffpNumber" + guestInd).value;
if (elevateIdValidated == "Add #") {
elevateIdValidated = "";
}
var urls = "addElevateId.do?method=addelevateId&elevateIdParam=" + elevateIdValidated + "&guestFirstLastName=" + guestFirstLastName + "&guestInd=" + guestInd + "&guestFFProg=" + guestFFProg + "&pnrNo=" + pnrNo + "&guestID=" + guestID;
ajaxToaddElevateId(urls);
showWaitImage();
}
function ajaxToaddElevateId(myurl) {
xmlhttp = new XMLHttpRequest();
var thetime = new Date();
var dummy = "" + thetime.getHours() + thetime.getMinutes() + thetime.getSeconds();
myurl = myurl + "&dummy=" + dummy;
xmlhttp.open("POST", myurl, true);
xmlhttp.onreadystatechange = handleResponseForAddElevateId;
xmlhttp.send("");
}
function handleResponseForAddElevateId() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
if (xmlhttp.responseText.trim() == "AjaxSessionTimeOut") {
window.location = "/home.do?method=virginAmerica&sessionState=sessionTimeOut";
} else {
if (xmlhttp.responseText.trim() == "success") {
if (guestIndex.length == 2) {
guestIndex = "0" + guestIndex.substring(1, 2);
while (document.getElementById("ajaxRefreshDiv1" + guestIndex)) {
document.getElementById("ajaxRefreshDiv1" + guestIndex).innerHTML = "<div>" + selectedFFPProgram + "</div>";
document.getElementById("ajaxRefreshDiv2" + guestIndex).innerHTML = "<div>" + elevateIdValidated + "</div>";
if (document.getElementById("points" + guestIndex)) {
document.getElementById("points" + guestIndex).style.display = "block";
}
if (document.getElementById("addBtn" + guestIndex)) {
document.getElementById("addBtn" + guestIndex).innerHTML = "";
}
if (document.getElementById("ajaxRefreshDiv1" + guestIndex).innerHTML) {
if (document.getElementById("ajaxRefreshDiv1" + guestIndex).innerHTML.indexOf("America") < 0) {
if (document.getElementById("points" + guestIndex)) {
document.getElementById("points" + guestIndex).style.display = "none";
document.getElementById("points" + guestIndex).innerHTML = "";
}
}
}
guestIndex = eval(eval(guestIndex) + 10);
}
} else {
document.getElementById("ajaxRefreshDiv1" + guestIndex).innerHTML = "<div>" + ffprogramlist.options[ffprogramlist.selectedIndex].text + "</div>";
document.getElementById("ajaxRefreshDiv2" + guestIndex).innerHTML = "<div>" + elevateIdValidated + "</div>";
if (document.getElementById("points" + guestIndex)) {
document.getElementById("points" + guestIndex).style.display = "block";
}
if (document.getElementById("addBtn" + guestIndex)) {
document.getElementById("addBtn" + guestIndex).innerHTML = "";
}
if (document.getElementById("ajaxRefreshDiv1" + guestIndex).innerHTML) {
if (document.getElementById("ajaxRefreshDiv1" + guestIndex).innerHTML.indexOf("America") < 0) {
if (document.getElementById("points" + guestIndex)) {
document.getElementById("points" + guestIndex).style.display = "none";
document.getElementById("points" + guestIndex).innerHTML = "";
}
}
}
}
if (document.getElementById("btnJoinElevate" + guestIndex)) {
document.getElementById("btnJoinElevate" + guestIndex).innerHTML = "";
document.getElementById("btnJoinElevate" + guestIndex).className = "";
}
if (document.getElementById("validationMessageDiv")) {
document.getElementById("validationMessageDiv").innerHTML = "";
}
} else {
document.getElementById("validationMessageDiv").innerHTML = xmlhttp.responseText;
}
}
showLoadingImageClose();
}
}
}
function showPopupWithGrayBG(ancorObj) {
stopIt = "false";
var x = document.getElementById("PopoupOnGrayDiv");
var c1 = getAnchorPosition("HowItWorks");
x.style.left = c1.x;
x.style.top = c1.y;
x.style.display = "block";
if (document.getElementById("prem_hint")) {
document.getElementById("prem_hint").style.background = "#FFB2B5";
}
}
function popUpHowWorks(divId) {
var x = document.getElementById("PopoupOnGrayDiv");
var c1 = getAnchorPosition(divId);
x.style.left = c1.x;
x.style.top = c1.y;
x.style.display = "block";
stopIt = "true";
}
function showTermsCondition(divId) {
var x = document.getElementById("tirmsDiv");
var c1 = getAnchorPosition(divId);
x.style.left = c1.x;
x.style.top = c1.y - 50;
x.style.display = "block";
}
function closeDivs() {
if (document.getElementById("PopoupPointBetaAlert") != null ) {
document.getElementById("PopoupPointBetaAlert").style.display = "none";
}
if (document.getElementById("PopoupOnGrayDiv") != null ) {
document.getElementById("PopoupOnGrayDiv").style.display = "none";
}
if (document.getElementById("prem_hint") != null ) {
document.getElementById("prem_hint").style.background = "#ffffff";
}
}
function showPrintableView(firstname, lastname, elevateNo) {
var disp_setting = "toolbar=no,location=no,directories=no,menubar=no,status=no,";
disp_setting += "scrollbars=yes,width=650, height=670, left=0, top=0";
var url = "html/elevate_card_print.html?&fn=" + firstname + "&ln=" + lastname + "&eN=" + elevateNo;
window.open(url, "", disp_setting);
}
function passwordStrength(password) {
var desc = new Array();
desc[0] = "Very Weak";
desc[1] = "Weak";
desc[2] = "Better";
desc[3] = "Medium";
desc[4] = "Strong";
desc[5] = "Strongest";
var score = 0;
if (password.length > 6) {
score++;
}
if ((password.match(/[a-z]/)) && (password.match(/[A-Z]/))) {
score++;
}
if (password.match(/\d+/)) {
score++;
}
if (password.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/)) {
score++;
}
if (password.length > 12) {
score++;
}
document.getElementById("passwordDescription").innerHTML = desc[score];
document.getElementById("passwordStrength").className = "strength" + score;
}
function applyCreditFile(id, div) {
saveTravelInsurance();
showWaitImage();
var travelInsuranceFlagRetain = travelInsuranceFlag;
var size = document.getElementsByName("checkBoxCreditFile").length;
var creditFile = "";
for (creditLoop = 0; creditLoop < size; creditLoop++) {
if (document.getElementsByName("checkBoxCreditFile")[creditLoop].checked) {
creditFile = creditFile + document.getElementsByName("checkBoxCreditFile")[creditLoop].id + "-";
}
}
var URL = "applyCreditFile.do?method=apply&creditFiles=" + creditFile;
$.ajax({
type: "POST",
url: URL,
cache: false,
dataType: "html",
success: function(html) {
$("#" + div).html(html.trim());
travelInsuranceFlag = travelInsuranceFlagRetain;
showLoadingImageClose();
if (html.trim().indexOf("errormessage_hold") != -1) {
window.scrollTo(0, 0);
}
retainTravelInsurance();
}
});
}
function removeCreditFile(creditFile, id, div) {
showWaitImage();
saveTravelInsurance();
var travelInsuranceFlagRetain = travelInsuranceFlag;
var URL = "removeCreditFile.do?method=remove&creditFiles=" + creditFile;
$.ajax({
type: "POST",
url: URL,
cache: false,
dataType: "html",
success: function(html) {
travelInsuranceFlag = travelInsuranceFlagRetain;
$("#" + div).html(html.trim());
showLoadingImageClose();
retainTravelInsurance();
}
});
}
function showHideAddCreditFile() {
if (document.getElementsByName("checkBoxAddCreditFile")[0].checked) {
document.getElementById("addCreditFileDiv").style.display = "block";
} else {
document.getElementById("addCreditFileDiv").style.display = "none";
}
}
function addCreditFile(id, div) {
showWaitImage();
var fileNumber = document.getElementById("creditFileNumber").value;
var firstName = document.getElementById("firstName").value;
var lastName = document.getElementById("lastName").value;
saveTravelInsurance();
var travelInsuranceFlagRetain = travelInsuranceFlag;
var URL = "addCreditFile.do?method=add&creditFileNumber=" + fileNumber + "&firstName=" + firstName + "&lastName=" + lastName;
$.ajax({
type: "POST",
url: URL,
cache: false,
dataType: "html",
success: function(html) {
travelInsuranceFlag = travelInsuranceFlagRetain;
$("#" + div).html(html.trim());
showLoadingImageClose();
if (html.indexOf("errormessage_hold") != -1) {
window.scrollTo(0, 0);
}
retainTravelInsurance();
}
});
}
function addCreditFilePostBooking(id, div, module) {
showWaitImage();
var fileNumber = document.getElementById("creditFileNumber").value;
var firstName = document.getElementById("firstName").value;
var lastName = document.getElementById("lastName").value;
if (module == "changeSeat") {
var URL = "addCreditFileChangeSeat.do?method=add&creditFileNumber=" + fileNumber + "&firstName=" + firstName + "&lastName=" + lastName;
} else {
if (module == "changeFlight") {
var URL = "addCreditFileChangeFlight.do?method=add&creditFileNumber=" + fileNumber + "&firstName=" + firstName + "&lastName=" + lastName;
}
}
$("#" + div).load(URL, "", showLoadingImageClose);
}
function setFareFarmatType(fareFormatValue, windowPositionId) {
if (fareFormatValue == "Points") {
if (document.getElementById("promoDetailRT")) {
document.getElementById("promoDetailRT").style.display = "none";
document.getElementById("promoDetailOW").style.display = "none";
document.getElementById("promoDetailMC").style.display = "none";
}
if (document.getElementById("promoDetails")) {
document.getElementById("promoDetails").style.display = "none";
if (document.getElementById("promoDetailDivider")) {
document.getElementById("promoDetailDivider").style.display = "none";
}
}
if (document.getElementById("PromoCodeDiv")) {
document.getElementById("PromoCodeDiv").style.display = "none";
if (document.getElementById("promoDetailDivider")) {
document.getElementById("promoDetailDivider").style.display = "none";
}
}
} else {
if (document.getElementById("promoDetailRT")) {
document.getElementById("promoDetailRT").style.display = "block";
document.getElementById("promoDetailOW").style.display = "block";
document.getElementById("promoDetailMC").style.display = "block";
}
if (document.getElementById("promoDetails")) {
document.getElementById("promoDetails").style.display = "block";
if (document.getElementById("promoDetailDivider")) {
document.getElementById("promoDetailDivider").style.display = "";
}
}
if (document.getElementById("PromoCodeDiv")) {
document.getElementById("PromoCodeDiv").style.display = "block";
if (document.getElementById("promoDetailDivider")) {
document.getElementById("promoDetailDivider").style.display = "";
}
}
document.getElementById("PopoupPointBetaAlert").style.display = "none";
}
if (document.flightSearchRTForm) {
document.flightSearchRTForm.elements["flightSearch.fareFormatType"].value = fareFormatValue;
}
if (document.flightSearchMCForm) {
document.flightSearchMCForm.elements["flightSearch.fareFormatType"].value = fareFormatValue;
}
if (document.flightSearchOWForm) {
document.flightSearchOWForm.elements["flightSearch.fareFormatType"].value = fareFormatValue;
}
}
function addTravelInsurance(checkbox, pageName) {
if (document.getElementById("totalTop")) {
var divObjs = document.getElementById("totalTop").getElementsByTagName("div");
for (i = 0; i < divObjs.length; i++) {
if (divObjs[i].getAttribute("id") && divObjs[i].style.display != "none") {
if (divObjs[i].getAttribute("id").indexOf("travelExpWithTotal") >= 0 && checkbox.value == "on") {
return;
} else {
if (divObjs[i].getAttribute("id").indexOf("travelExpWithoutTotal") >= 0 && checkbox.value == "off") {
return;
}
}
}
}
}
var addressCheckBoxStat = "false";
if (document.receiptForm.elements["viewPurchaseModel.info"]) {
addressCheckBoxStat = document.receiptForm.elements["viewPurchaseModel.info"].checked;
}
var addNewAddressStatus = false;
if (document.getElementById("newAddressDiv") && document.getElementById("newAddressDiv").style.display != "none") {
addNewAddressStatus = true;
}
var addNewCardStatus = false;
if (document.getElementById("newCardDiv") && document.getElementById("newCardDiv").style.display != "none") {
addNewCardStatus = true;
}
var URL = "";
if (pageName == "payment") {
URL = "addRemoveTravelInsurance.do?method=travelInsurance&checked=" + checkbox.value + "&addressCheckBox=" + addressCheckBoxStat;
}
if (pageName == "review") {
URL = "addRemoveTravelInsuranceReview.do?method=travelInsurance&checked=" + checkbox.value;
}
var parms = "";
if (document.receiptForm) {
for (var i = 0; i < document.receiptForm.elements.length; i++) {
var element = document.receiptForm.elements[i];
if (i == 0) {
parms = parms + element.name + "=" + element.value;
} else {
if (element.name == "viewPurchaseModel.wanaSaveCard" && element.checked != true) {
continue;
}
parms = parms + "&" + element.name + "=" + element.value;
}
}
}
$.ajax({
type: "POST",
url: URL,
data: parms,
dataType: "html",
cache: false,
complete: function() {
document.getElementById("loadingAnimationDiv").style.display = "none";
if (checkbox.value == "on") {
if (document.getElementById("travelExpWithInsurance")) {
document.getElementById("travelExpWithInsurance").style.display = "block";
}
document.getElementById("travelExpWithInsurance1").style.display = "block";
document.getElementById("travelExpWithTotal").style.display = "block";
document.getElementById("travelExpWithoutTotal").style.display = "none";
document.getElementById("totalBottom").innerHTML = document.getElementById("totalTop").innerHTML;
} else {
if (document.getElementById("travelExpWithInsurance")) {
document.getElementById("travelExpWithInsurance").style.display = "none";
}
document.getElementById("travelExpWithInsurance1").style.display = "none";
document.getElementById("travelExpWithoutTotal").style.display = "block";
document.getElementById("travelExpWithTotal").style.display = "none";
document.getElementById("totalBottom").innerHTML = document.getElementById("totalTop").innerHTML;
}
if (addNewAddressStatus) {
document.getElementById("newAddressDiv").style.display = "block";
if (document.receiptForm.elements["viewPurchaseModel.useSavedAddress"]) {
for (i = 0; i < document.receiptForm.elements["viewPurchaseModel.useSavedAddress"].length; i++) {
if (document.receiptForm.elements["viewPurchaseModel.useSavedAddress"][i].value == "newAddress") {
document.receiptForm.elements["viewPurchaseModel.useSavedAddress"][i].checked = true;
}
}
}
}
if (addNewCardStatus) {
document.getElementById("newCardDiv").style.display = "block";
if (document.receiptForm.elements["viewPurchaseModel.useSavedCard"]) {
for (i = 0; i < document.receiptForm.elements["viewPurchaseModel.useSavedCard"].length; i++) {
if (document.receiptForm.elements["viewPurchaseModel.useSavedCard"][i].value == "newCard") {
document.receiptForm.elements["viewPurchaseModel.useSavedCard"][i].checked = true;
}
}
}
}
if ($("#ContainerRight").length > 0 && $("#ContainerMiddle").length > 0) {
$("#ContainerRight").height(($("#ContainerMiddle").height() - 20));
}
},
success: function(html) {
$("#body").html(html.trim());
}
});
}
function showHideTaxDetails() {
if (document.getElementById("PFC").style.display == "block" || document.getElementById("PFC").style.display == "") {
document.getElementById("PFC").style.display = "none";
document.getElementById("PFC1").style.display = "none";
document.getElementById("securityFee").style.display = "none";
document.getElementById("securityFee1").style.display = "none";
document.getElementById("segmentFee").style.display = "none";
document.getElementById("segmentFee1").style.display = "none";
document.getElementById("taxImage").innerHTML = '<img alt="" src="/web/20110901145833/https://static.virginamerica.com/images/taxFeesExpand.gif" onclick="javascript:showHideTaxDetails()" onMouseOver="MakeCursor(this)"/>';
} else {
document.getElementById("PFC").style.display = "block";
document.getElementById("PFC1").style.display = "block";
document.getElementById("securityFee").style.display = "block";
document.getElementById("securityFee1").style.display = "block";
document.getElementById("segmentFee").style.display = "block";
document.getElementById("segmentFee1").style.display = "block";
document.getElementById("taxImage").innerHTML = '<img alt="" src="/web/20110901145833/https://static.virginamerica.com/images/taxFeesCollapse.gif" onclick="javascript:showHideTaxDetails()" onMouseOver="MakeCursor(this)"/>';
}
}
function showHideAIGTaxDetails(taxId, flight) {
if (flight == "original") {
if (document.getElementById("taxBreakdown").style.display == "block" || document.getElementById("taxBreakdown").style.display == "") {
document.getElementById("taxBreakdown").style.display = "none";
document.getElementById("taxImageAig").innerHTML = '<img alt="" id="' + taxId + '" src="/web/20110901145833/https://static.virginamerica.com/images/taxFeesExpand.gif" onclick="javascript:showHideAIGTaxDetails(this.id,' + "'" + flight + "'" + ')" onMouseOver="MakeCursor(this)"/>';
} else {
document.getElementById("taxBreakdown").style.display = "block";
document.getElementById("taxImageAig").innerHTML = '<img alt="" id="' + taxId + '" src="/web/20110901145833/https://static.virginamerica.com/images/taxFeesCollapse.gif" onclick="javascript:showHideAIGTaxDetails(this.id,' + "'" + flight + "'" + ')" onMouseOver="MakeCursor(this)"/>';
}
} else {
if (document.getElementById("taxBreakdownNew").style.display == "block" || document.getElementById("taxBreakdownNew").style.display == "") {
document.getElementById("taxBreakdownNew").style.display = "none";
document.getElementById("taxImageNew").innerHTML = '<img alt="" id="' + taxId + '" src="/web/20110901145833/https://static.virginamerica.com/images/taxFeesExpand.gif" onclick="javascript:showHideAIGTaxDetails(this.id,' + "'" + flight + "'" + ')" onMouseOver="MakeCursor(this)"/>';
} else {
document.getElementById("taxBreakdownNew").style.display = "block";
document.getElementById("taxImageNew").innerHTML = '<img alt="" id="' + taxId + '" src="/web/20110901145833/https://static.virginamerica.com/images/taxFeesCollapse.gif" onclick="javascript:showHideAIGTaxDetails(this.id,' + "'" + flight + "'" + ')" onMouseOver="MakeCursor(this)"/>';
}
}
}
function showCompanionsList(objId) {
document.getElementById(objId).style.width = "420px";
document.getElementById(objId).style.display = "inline";
}
function ChangeFormValue(optval, num) {
var values = new String(optval);
var str = optval.split("|");
var titleObj = document.displayPurchaseForm.elements["viewPurchase.title[" + num + "]"];
var option = titleObj.options;
titleObj.value = str[0];
var prefix = str[0];
if (prefix == "Mr") {
option.selectedIndex = 0;
}
if (prefix == "Mrs") {
option.selectedIndex = 1;
}
if (prefix == "Miss (Adult)") {
option.selectedIndex = 2;
}
if (prefix == "Miss (Child)") {
option.selectedIndex = 3;
}
if (prefix == "Ms") {
option.selectedIndex = 4;
}
if (prefix == "Mstr (Child)") {
option.selectedIndex = 5;
}
ChangeGuestType(prefix, document.displayPurchaseForm.elements["viewPurchase.guestType[" + num + "]"]);
document.displayPurchaseForm.elements["viewPurchase.firstName[" + num + "]"].value = str[1];
document.displayPurchaseForm.elements["viewPurchase.lastName[" + num + "]"].value = str[2];
document.displayPurchaseForm.elements["viewPurchase.guestNumber[" + num + "]"].value = str[3];
}
function switchPaymentType(paymentType, id) {
showWaitImage();
document.barForm.method.value = "switchPaymentType";
document.barForm.tabSelect.value = "5";
document.barForm.action = "switchPaymentType.do?paymentType=" + paymentType;
document.barForm.submit();
}
var maintain_CCPreScreenStatus;
var myBarclaysCreditCardwWindow;
function openBarclaysCreditCard(firstDivId, secondDivId, statusId) {
if (firstDivId != "BarclaysPreapprovedRightBarID") {
document.getElementById(firstDivId).style.display = "none";
}
formDataHex = regenMD5(document.barclaysCreditCardPromptForm, statusId);
document.barclaysCreditCardPromptForm.SIGNATURE.value = formDataHex;
openPopUp();
}
function openPopUp() {
document.barclaysCreditCardPromptForm.target = "BarclaysCreditCardPopUpWindow";
var elementsToBeUpper = "FIRSTNAME,LASTNAME,EMAIL,ADDRESS1,CITY,STATE,POSTALCODE,ADDRESS2";
for (eleCnt = 0; eleCnt < document.barclaysCreditCardPromptForm.elements.length; eleCnt++) {
objectEle = document.barclaysCreditCardPromptForm.elements[eleCnt];
if (elementsToBeUpper.indexOf(objectEle.name) > -1) {
objectEle.value = (objectEle.value).toUpperCase();
}
}
document.barclaysCreditCardPromptForm.submit();
}
function regenMD5(f, statusId) {
plain = "";
plain += "SESSION=" + f.SESSION.value;
plain += ":RETURL=" + f.RETURL.value;
plain += ":SESSIONSTATE=" + f.SESSIONSTATE.value;
if (statusId == "APPROVED") {
plain += ":PRESCREENID=" + f.PRESCREENID.value;
} else {
plain += ":PRESCREENID=";
}
plain += ":LASTNAME=" + f.LASTNAME.value;
plain += ":PASSWORD=" + f.PASSWORD.value;
return hex_md5(plain);
}
function statusUpdatePreScreenWithAJAX(firstDivId, actionMode, CCPreSceeenId, CCPreScreenStatus, ccFName, ccLName) {
myUrl = "creditCardPostBack.do?method=getClosePreApprovedScreen&actionMode=" + actionMode + "&CCPreSceeenId=" + CCPreSceeenId + "&CCPreScreenStatus=" + CCPreScreenStatus + "&ccFName=" + ccFName + "&ccLName=" + ccLName;
var thetime = new Date();
var dummy = "" + thetime.getHours() + thetime.getMinutes() + thetime.getSeconds();
myUrl = myUrl + "&dummy=" + dummy;
if (actionMode == "yes") {
maintain_CCPreScreenStatus = CCPreScreenStatus;
myBarclaysCreditCardwWindow = window.open("/html/Virgin_America_Credit_Card.html", "BarclaysCreditCardPopUpWindow", "toolbar=no,status=yes,menubar=no,location=no,scrollbars=yes,resizable=no, top=" + 200 + ", left=" + 100 + ", width=" + 840 + ",height=" + 700);
ajaxOpenVACreditCard(myUrl, firstDivId);
} else {
ajaxVACreditCardWithBarclays(myUrl, firstDivId);
document.getElementById("BarclaysPreapprovedID").style.display = "none";
}
document.getElementById("disableTotalPage").style.display = "none";
}
function ajaxVACreditCardWithBarclays(myurl, div1) {
xmlhttp = new XMLHttpRequest();
var thetime = new Date();
var dummy = "" + thetime.getHours() + thetime.getMinutes() + thetime.getSeconds();
myurl = myurl + "&dummy=" + dummy;
ajaxDiv = div1;
xmlhttp.open("POST", myurl, true);
xmlhttp.onreadystatechange = handleResponseVACreditCardWithBarclays;
xmlhttp.send("");
}
function handleResponseVACreditCardWithBarclays() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
if (xmlhttp.responseText != "") {}
}
}
}
var isBCCError = false;
function ajaxOpenVACreditCard(myurl, div1) {
$.ajax({
type: "POST",
url: myurl,
cache: false,
dataType: "script",
success: function(html) {
if (document.getElementById("isBCCError")) {
if (document.getElementById("isBCCError").value == "true") {
isBCCError = true;
}
}
if (document.getElementById(div1)) {
document.getElementById(div1).style.display = "none";
}
if (!isBCCError) {
if (document.getElementById("BarclaysCreditCardPopUp")) {
document.getElementById("BarclaysCreditCardPopUp").style.display = "block";
}
openBarclaysCreditCard("BarclaysPreapprovedID", "BarclaysCreditCardPopUp", maintain_CCPreScreenStatus);
}
}
});
}
var s_account = setOmnitureEnv();
var s = s_gi(s_account);
s.currencyCode = "USD";
s.trackDownloadLinks = true;
s.trackExternalLinks = true;
s.trackInlineStats = true;
s.linkDownloadFileTypes = "exe,zip,wav,mp3,mov,mpg,avi,wmv,doc,pdf,xls";
s.linkInternalFilters = "javascript:,virginamerica.com";
s.linkLeaveQueryString = false;
s.linkTrackVars = "None";
s.linkTrackEvents = "None";
s.usePlugins = true;
function s_doPlugins(s) {
if (s.events) {
if (s.events.indexOf("event1") > -1) {
s.prop18 = "start";
s.gtctype = "booking";
}
if (s.events.indexOf("purchase") > -1) {
s.prop18 = "stop";
s.gtctype = "booking";
s.prop19 = "Booking Process";
}
if (s.events.indexOf("event45") > -1) {
s.prop18 = "start";
s.gtctype = "Check-In";
}
if (s.events.indexOf("event7") > -1) {
s.prop18 = "stop";
s.gtctype = "Check-In";
s.prop19 = "Check-In";
}
if (s.events.indexOf("event17") > -1) {
s.prop18 = "start";
s.gtctype = "ChangeSeat";
}
if (s.events.indexOf("event20") > -1) {
s.prop18 = "stop";
s.gtctype = "ChangeSeat";
s.prop19 = "Change Seat";
}
if (s.events.indexOf("event46") > -1) {
s.prop18 = "start";
s.gtctype = "ChangeFlight";
}
if (s.events.indexOf("event11") > -1) {
s.prop18 = "stop";
s.gtctype = "ChangeFlight";
s.prop19 = "Change Flight";
}
if (s.events.indexOf("event48") > -1) {
s.prop18 = "start";
s.gtctype = "Cancel";
}
if (s.events.indexOf("event10") > -1) {
s.prop18 = "stop";
s.gtctype = "Cancel";
s.prop19 = "Cancel Flight";
}
s.prop18 = s.getTimeToComplete(s.prop18, s.gtctype, 0);
if (s.events.indexOf("event44") > -1) {
s.events = s.getValOnce(s.events, "event44", 0);
}
}
s.campaign = s.getQueryParam("tid");
if (!s.campaign) {
s.campaign = s.getQueryParam("cid");
s.campaign = s.getValOnce(s.campaign, "extcmpgn", 0);
}
if (!s.eVar44) {
s.eVar44 = s.getQueryParam("eid");
}
if (!s.campaign) {
s.campaign = s.getQueryParam("eid");
}
if (!s.eVar30) {
s.eVar30 = s.getQueryParam("int");
s.eVar30 = s.getValOnce(s.eVar30, "intcmpgn", 0);
}
var temphr = s.getTimeParting("h", "-8", new Date().getFullYear());
var tempday = s.getTimeParting("d", "-8", new Date().getFullYear());
var tempweek = s.getTimeParting("w", "-8", new Date().getFullYear());
if (temphr) {
s.prop14 = s.eVar19 = tempweek + " : " + tempday + " : " + temphr;
}
if (s.prop20) {
s.eVar31 = s.prop20;
}
if (s.eVar30) {
s.prop17 = s.eVar30;
}
if (s.prop21) {
s.eVar42 = s.prop21;
}
if (s.prop22) {
s.eVar43 = s.prop22;
}
if (s.campaign) {
s.eVar41 = s.campaign;
}
}
s.doPlugins = s_doPlugins;
s.getQueryParam = new Function("p","d","u","" + "var s=this,v='',i,t;d=d?d:'';u=u?u:(s.pageURL?s.pageURL:s.wd.locati" + "on);if(u=='f')u=s.gtfs().location;while(p){i=p.indexOf(',');i=i<0?p" + ".length:i;t=s.p_gpv(p.substring(0,i),u+'');if(t)v+=v?d+t:t;p=p.subs" + "tring(i==p.length?i:i+1)}return v");
s.p_gpv = new Function("k","u","" + "var s=this,v='',i=u.indexOf('?'),q;if(k&&i>-1){q=u.substring(i+1);v" + "=s.pt(q,'&','p_gvf',k)}return v");
s.p_gvf = new Function("t","k","" + "if(t){var s=this,i=t.indexOf('='),p=i<0?t:t.substring(0,i),v=i<0?'T" + "rue':t.substring(i+1);if(p.toLowerCase()==k.toLowerCase())return s." + "epa(v)}return ''");
s.getValOnce = new Function("v","c","e","" + "var s=this,k=s.c_r(c),a=new Date;e=e?e:0;if(v){a.setTime(a.getTime(" + ")+e*86400000);s.c_w(c,v,e?a:0);}return v==k?'':v");
s.getTimeParting = new Function("t","z","y","" + "dc=new Date('1/1/2000');f=15;ne=8;if(dc.getDay()!=6||" + "dc.getMonth()!=0){return'Data Not Available'}else{;z=parseInt(z);" + "if(y=='2009'){f=8;ne=1};gmar=new Date('3/1/'+y);dsts=f-gmar.getDay(" + ");gnov=new Date('11/1/'+y);dste=ne-gnov.getDay();spr=new Date('3/'" + "+dsts+'/'+y);fl=new Date('11/'+dste+'/'+y);cd=new Date();" + "if(cd>spr&&cd<fl){z=z+1}else{z=z};utc=cd.getTime()+(cd.getTimezoneO" + "ffset()*60000);tz=new Date(utc + (3600000*z));thisy=tz.getFullYear(" + ");var days=['Sunday','Monday','Tuesday','Wednesday','Thursday','Fr" + "iday','Saturday'];if(thisy!=y){return'Data Not Available'}else{;thi" + "sh=tz.getHours();thismin=tz.getMinutes();thisd=tz.getDay();var dow=" + "days[thisd];var ap='AM';var dt='Weekday';var mint='00';if(thismin>3" + "0){mint='30'}if(thish>=12){ap='PM';thish=thish-12};if (thish==0){th" + "ish=12};if(thisd==6||thisd==0){dt='Weekend'};var timestring=thish+'" + ":'+mint+ap;var daystring=dow;var endstring=dt;if(t=='h'){return tim" + "estring}if(t=='d'){return daystring};if(t=='w'){return en" + "dstring}}};");
s.getTimeToComplete = new Function("v","cn","e","" + "var s=this,d=new Date,x=d,k;if(!s.ttcr){e=e?e:0;if(v=='start'||v=='" + "stop')s.ttcr=1;x.setTime(x.getTime()+e*86400000);if(v=='start'){s.c" + "_w(cn,d.getTime(),e?x:0);return '';}if(v=='stop'){k=s.c_r(cn);if(!s" + ".c_w(cn,'',d)||!k)return '';v=(d.getTime()-k)/1000;var td=86400,th=" + "3600,tm=60,r=5,u,un;if(v>td){u=td;un='days';}else if(v>th){u=th;un=" + "'hours';}else if(v>tm){r=2;u=tm;un='minutes';}else{r=.2;u=1;un='sec" + "onds';}v=v*r/u;return (Math.round(v)/r)+' '+un;}}return '';");
s.visitorNamespace = "virginamerica";
s.dc = 112;
var s_code = "", s_objectID;
function s_gi(un, pg, ss) {
var d = "function s_dr" + "(x,o,n){var i=x.indexOf(o);if(i>=0&&x.split)x=(x.split(o)).join(n);" + "else while(i>=0){x=x.substring(0,i)+n+x.substring(i+o.length);i=x.i" + "ndexOf(o)}return x}w.s_dr=s_dr;function s_d(x) {var t='`^@$#',l='01" + "23456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',d,n=0" + ",b,k,w,i=x.lastIndexOf('~~');if(i>0){d=x.substring(0,i);x=x.substri" + "ng(i+2);while(d){w=d;i=d.indexOf('~');if(i>0){w=d.substring(0,i);d=" + "d.substring(i+1)}else d='';b=parseInt(n/62);k=n-b*62;k=t.substring(" + "b,b+1)+l.substring(k,k+1);x=s_dr(x,k,w);n++}for(i=0;i<5;i++){w=t.su" + "bstring(i,i+1);x=s_dr(x,w+' ',w)}}return x}w.s_d=s_d;", c = ".substrin" + "g(~.indexOf(~return ~=fun`K(~){`Os=^u~`t $6~;$6~.toLowerCase()~`cFu" + "n`K('e`s`Os=s_c_il['+@i+']~};s.~.length~.toUpperCase~`cObject~s.wd~" + "t^D~.location~')q='~dynamicAccount~link~s.apv~ction~$l$X~)$6x^X!Obj" + "ect||!Object.prototype||!Object.prototype[x])~@G^Al)@G^Al['+@i+'].m" + "rq(\"'+un+'\")'~var ~s.pt(~ookieDomainPeriods~,`s,'~while(~);s.~.pr" + "otocol~){$6~visitor~=''~:'')~;@F^Vs[k],255)}~s_c2f~javaEnabled~=new" + " ~.lastIndexOf('~tm.get~@5\"$Qs.b.addBehavior('# default# ~onclick~" + "ternalFilters~entElement~Name~javascriptVersion~=parseFloat(~cookie" + "~parseInt(~s.^J~Type~o^joid~browser~','~else~referrer~colorDepth~St" + "ring~.host~s.rep(~}catch(e){~r=s.m(f)?s[f](~}$6~s.un~s.eo~s.sq~t=s." + "ot(o)~track~j='1.~)?'Y':'N'~$dURL~^jc_i~s.ismac~lugins~=='~;for(~Sa" + "mpling~s.rc[un]~s.b.addEventListener~Download~tfs~resolution~.get@I" + "()~s.eh~s.isie~s.vl_l~s.vl_t~Height~t,h){t=t?t~isopera~escape(~scre" + "en.~s.fl(~harCode~&&(~variableProvider~s.gg('objectID')~&&s.~:'';h=" + "h?h~e&&l$kSESSION'~');~f',~_'+~Date~name~home$d~.s_~s.c_r(~s.rl[u~o" + ".href~Lifetime~Width~sEnabled~'){q='~b.attachEvent~&&l$kNONE'){~Ext" + "ernalLinks~this~charSet~onerror~currencyCode~s=s_gi(~e$SElement~;s." + "gl(s.vl_g~.parent~Array~lnk~Opera~eval(~Math.~s.fsg~s.ns6~docum~s.o" + "un~conne~InlineStats~Track~'0123456789~s[k]=~window~onload~Time~s.e" + "pa(~s.c_w(~o.type~(s.ssl~n=s.oid(o)~LeaveQuery~')>=~&&t~'=')~){n=~+" + "1))~' '+~s.t()}~\",''),~=s.oh(o);~+(y<1900?~ingServer~s_gs~true~ses" + "s~campaign~lif~;fun~,100)~s.co(~s._in~x in ~='s_~ffset~s.c_d~'&pe~s" + ".gv(~s.qav~s.pl~=(apn~sqs',q);~Year(~=s.n.app~&&!~(''+~(\")>=~)+'/~" + "',s~s()+':'+~){p=~():''~a):f(~){v=s.n.~channel~if(~un)~.target~o.va" + "lue~etscape~(ns?ns:~s_')t=t~omePage~++}~')<~){x~1);~e))~'+n~height~" + "events~trk~random~code~un,~try{~'MSIE ~.src~INPUT'~floor(~s.pg~s.nu" + "m(~s.ape(~s.c_gd~s.dc~.inner~transa~Events~page~.set~Group,~Match,~" + ".fromC~++){~?'':~!='~='+~(\")<~?'&~+';~(f){~>=5)~&&i>~[b](~=l[n];~~" + "fun`K `ae$p`Ox`X,s=0,e,a,b,c;`S1){e=f`1'\"@z);b=f`1'\\\\',s);c=f`1" + '"\\n",s)`6e<0||(b>=0&&b<$Ie=b`6e<0||(c>=0&&c<$Ie=c`6e>=0$G+=(e>s?' + "f`0s,e)`Y+(e==c?'\\\\n':'\\\\'+f`0e,e@T;s=e+1}`t `2x+f`0s)}`2f}w.`a" + "e=`ae@f`K `aa$p`Os=f`1'(')+1,e=f`1')'),a`X,c;`Ss>=0&&s<e){c=f`0s,s+" + "1)`6c==`s)a+='\",\"';`5(\"\\n\\r\\t \")`1c)<0)a+=c;s$E`2a?'\"'+a+'" + "\"':a}w.`aa=`ae@f`K `a(cc){cc`X+cc;`Ofc='`Of`cFun`K(@z=cc`1';',cc`1" + "'{')),e=cc`d}'),o,a,d,q,c,f,h,x;fc+=`aa(cc)+',\"`Os`C;';c=cc`0s+1,e" + ");s=c`1'fun`K^d`Ss>=0){d=1;q`X;x=0;f=c`0s);a=`aa(f);e=o=c`1'{@z);e+" + "+;`Sd>0){h=c`0e,e+1)`6q`Vh==q@vx)q`X`6h^D\\\\')x=x?0:1;`t x=0}`t{$6" + "h^D\"'||h==\"'\")q=h`6h^D{')d++`6h^D}')d--^1d>0)e$Ec=c`00,s)+'new F" + "un`K('+(a?a+`s`Y+'\"'+`ae(c`0o+1,$I+'\")'+c`0e+$Hs=c`1'fun`K')}fc+=" + '`ae(c)$o`2s");\';@5fc);`2f}w.`a=`a`6pg){fun`K s_co(o){`O^y"_",1,$' + "H`2@ho)}w^jco=s_co@f`K @a($7{`O^y$P1,$H`2@Vw^jgs=@a@f`K s_dc($7{`O^" + "y$P$H`2@Vw^jdc=s_dc;}fun`K s_c($Ppg,ss`4;s._c@kc';`D=@G`6!`D^An){`D" + "^Al`c@2;`D^An=0;}s._il=`D^Al;@i=`D^An;s._il[@i]=s;`D^An++;s.m`3m){`" + "2@wm)`1'{$F0`9fl`3x,l){`2x?@wx)`00,l):x`9co`3o`V!o)`2o;`On`C,x^E@jo" + ")$6x`1'select$F0&&x`1'filter$F0)n[x]=o[x];`2n`9num`3x$G`X+x^E`Op=0;" + "p<x`A;p++)$6(@E')`1x`0p,p@T<0)`20;`21`9rep`3x,o,n){`Oi=x`1o);`Sx$r=" + "0$G=x`00,i)+n+x`0i+o`A);i=x`1o,i+n`A)}`2x`9ape`3x`4,h=@EABCDEF',i,c" + "=s.^v,n,l,e,y`X;c=c?c`B$2`6x$G`X+x`6c^DAUTO'^X'').c^WAt){for(i=0;i<" + "x`A;i$ic=x`0i,i+$Hn=x.c^WAt(i)`6n>127){l=0;e`X;`Sn||l<4){e=h`0n%16," + "n%16+1)+e;n=`nn/16);l$Ey+='%u'+e}`5c^D+')y+='%2B';`t y+=^Tc)}x=y}`t" + "{x=x?`y^T''+x),'+`s%2B'):x`6x&&c^aem==1&&x`1'%u$F0&&x`1'%U$F0){i=x`" + "1'%^d`Si>=0){i++`6h`08)`1x`0i,i+1)`B())>=0)`2x`00,i)+'u00'+x`0i);i=" + "x`1'%',i)}}}}`2x`9epa`3x`4;`2x?un^T`y''+x,'+`s ')):x`9pt`3x,d,f,a`4" + ",t=x,z=0,y,r;`St){y=t`1d);y=y<0?t`A:y;t=t`00,y);^0t,$3t,a)`6r)`2r;z" + "+=y+d`A;t=x`0z,x`A);t=z<x`A?t:''}`2''`9isf`3t,a){`Oc=a`1':')`6c>=0)" + "a=a`00,c)`6t`00,2)^D$C`02);`2(t!`X@Q==a)`9fsf`3t,a`4`6`Pa`Ris^et))@" + "7+=(@7!`X?`s`Y+t;`20`9fs`3x,f`4;@7`X;`Px`Rfs^ef);`2@7`9c_d`X;$Yf`3t" + ",a`4`6!$Wt))`21;`20`9c_gd`3`4,d=`D`F`x^h,n=s.fpC`Q,p`6!n)n=s.c`Q`6d" + "@v@m@Sn?`nn):2;n=n>2?n:2;p=d`d.')`6p>=0){`Sp>=0&&n>1$1d`d.',p-$Hn--" + "}@m=p>0&&`Pd,'.`sc_gd^e0)?d`0p):d}}`2@m`9c_r`3k`4;k=$Xk);`Oc=@Us.d." + "`m,i=c`1@Uk+@R,e=i<0?i:c`1';',i),v=i<0$j@Jc`0i+2+k`A,e<0?c`A:$I;`2v" + "$k[[B]]'?v:''`9c_w`3k,v,e`4,d=$Y(),l=s.`m^n,t;v`X+v;l=l?@wl)`B$2`6^" + "c^st=(v!`X?`nl?l:0):-60)`6t){e`c^g;e$e@I(e^L+(t*1000))}^1k^ss.d.`m=" + "k+'`Lv!`X?v:'[[B]]')$o path=/;'+(^c?' expires$le.toGMT`w()$o'`Y+(d?" + "' domain$ld$o'`Y;`2^kk)==v}`20`9eh`3o,e,r,f`4,b='s^fe+'^f@i,n=-1,l," + "i,x`6!^Ml)^Ml`c@2;l=^Ml^Ei=0;i<l`A&&n<0;i++`Vl[i].o==o&&l[i].e==e)n" + "=i^1n<0@Si;l[n]`C}x$tx.o=o;x.e=e;f=r?x.b:f`6r||f$G.b=r?0:o[e];x.o[e" + "]=f^1x.b$G.o[b]=x.b;`2b}`20`9cet`3f,a,t,o,b`4,r`6`J>=5^X!s.^S||`J>=" + "7))@5'$Q^0$3a)`zr=s.m(t)?s[t](e):t(e)}^d`t{$6^B^au`1$R4@P0)r=s.m(b)" + "?s$sa):b(a);`t{^M(`D,'^w',0,o);^0$3a`Teh(`D,'^w',1)}}`2r`9g^Jet`3e`" + '4;`2`o`9g^Joe`8;^M(@G,"^w",1`Te^J=1;`Oc=s.t()`6c)s.d.write(c`Te^J' + "=0;`2@b'`Tg^Jfb`3a){`2@G`9g^Jf`3w`4,p=w@1,l=w`F;`o=w`6p&&p`F!=l&&p`" + "F`x==l`x){`o=p;`2s.g^Jf(`o)}`2`o`9g^J`3`4`6!`o){`o=`D`6!s.e^J)`o=s." + "cet('g^J^e`o,'g^Jet@z.g^Joe,'g^Jfb')}`2`o`9mrq`3u`4,l=^l],n,r;^l]=0" + "`6l)for(n=0;n<l`A;n$ir$ts.mr(0,0,r.t,r.u,r.r)}`9mr`3@c,q,ta,u,rs`4," + "dc=$Z,t1=s.^6@Z,t2=s.^6@ZSecure,ns=s.`W`jspace,un=u?u:$Bs.f$7,unc=`" + "y$P'_`s-'),r`C,l,imn@ki^f($7,im,b,e`6!rs){rs='http'+@M?'s'`Y+'://'+" + "(t1?@M@Q2?t2:t1):($B@M?'102':unc))+'.'+($Z?$Z:112)+'.2o7.net')@yb/s" + "s/'+^2+'/1/H.14/'+@c+'?[AQB]&ndh=1'+(q?q`Y+'&[AQE]'`6^N@v^B`V`J>5.5" + ")rs=^Vrs,4095);`t rs=^Vrs,2047)}^1s.d.images&&`J>=3^X!s.^S||`J>=7)^" + "X@8<0||`J>=6.1)`V!s.rc)s.rc`C`6!^G){^G=1`6!s.rl)s.rl`C;^ln]`c@2;set" + "@Iout('$6`N,750)}`t{l=^ln]`6l){r.t=ta;r.u=un;r.r=rs;l[l`A]=r;`2''}i" + "mn+='^f^G;^G$Eim=`D[imn]`6!im)im=`D[imn]`cImage;im^jl=0;im.@H`cFun`" + "K('e`s^u^jl=1`6`N);im$S=rs`6rs`1@n=@P0^X!ta||ta^D_self'||ta^D_top'|" + "|(`D.^h@Qa==`D.^h))){b=e`c^g;`S!im^jl&&e^L-b^L<500)e`c^g}`2''}`2'<i" + "m'+'g sr'+'c=\"'+rs+'\" width=1 $K=1 border=0 alt=\"\">'`9gg`3v`4`6" + "!`D['s^fv])`D['s^fv]`X;`2`D['s^fv]`9glf`3t,a`Vt`00,2)^D$C`02);`Os=^" + "u,v=s.gg(t)`6v)s[t]=v`9gl`3v`4`6$V)`Pv`Rgl^e0)`9gv`3v`4;`2s['vpm^fv" + "]?s['vpv^fv]:(s[v]?s[v]`Y`9havf`3t,a`4,b=t`00,4),x=t`04),n=`nx),k='" + "g^ft,m='vpm^ft,q=t,v=s.`I@DVars,e=s.`I@D$c;@F@ot)`6s.@3||^3){v=v?v+" + "`s+^O+`s+^O2:''`6v@v`Pv`Ris^et))s[k]`X`6`E$L'&&e)@Fs.fs(s[k],e)}s[m" + "]=0`6`E`WID`Gvid';`5`E^9^qg'`Z`5`E`u^qr'`Z`5`Evmk`Gvmt';`5`E^v^qce'" + "`6s[k]&&s[k]`B()^DAUTO')@F'ISO8859-1';`5s[k]^aem==2)@F'UTF-8'}`5`E`" + "W`jspace`Gns';`5`Ec`Q`Gcdp';`5`E`m^n`Gcl';`5`E^Y`Gvvp';`5`E^x`Gcc';" + "`5`E$5`Gch';`5`E$b`KID`Gxact';`5`E@d`Gv0';`5`E^K`Gs';`5`E`v`Gc';`5`" + "E`k`Gj';`5`E`b`Gv';`5`E`m^p`Gk';`5`E`r^o`Gbw';`5`E`r^Q`Gbh';`5`E@B`" + "K`p`Gct';`5`E^i`Ghp';`5`Ep^C`Gp';`5$Wx)`Vb^Dprop`Gc$J;`5b^DeVar`Gv$" + "J;`5b^Dhier^qh$J`Z^1s[k]@Q$k`I`j'@Q$k`I`p')@p+='&'+q+'`Ls[k]);`2''`" + "9hav`3`4;@p`X;`P^P`Rhav^e0);`2@p`9lnf`3^R`7^b`7:'';`Ote=t`1@R`6t@Qe" + ">0&&h`1t`0te@T>=0)`2t`00,te);`2''`9ln`3h`4,n=s.`I`js`6n)`2`Pn`Rln^e" + "h);`2''`9ltdf`3^R`7^b`7:'';`Oqi=h`1'?^dh=qi>=0?h`00,qi):h`6t&&h`0h`" + "A-(t`A@T^D.'+t)`21;`20`9ltef`3^R`7^b`7:''`6t&&h`1t)>=0)`21;`20`9lt`" + "3h`4,lft=s.`I^IFile`ps,lef=s.`IEx`h,@e=s.`IIn`h;@e=@e?@e:`D`F`x^h;h" + "=h`7`6s.^6^ILinks&&lft&&`Plft`Rltd^eh))`2'd'`6s.^6^t^Xlef||@e)^X!le" + "f||`Plef`Rlte^eh))^X!@e||!`P@e`Rlte^eh)))`2'e';`2''`9lc`8,b=^M(^u," + '"`g"`T@3=@h^u`Tt(`T@3=0`6b)`2^u$se);`2@b\'`Tbc`8,f`6s.d^ad.all^ad.' + 'all.cppXYctnr)return;^3=^z?^z:e$8;@5"$Q$6^3^X^3.tag`j||^3.par`i||^' + "3@1Nod$I@Vcatch$p}\"`Teo=0'`Toh`3o`4,l=`D`F,h=^m?^m:'',i,j,k,p;i=h`" + "1':^dj=h`1'?^dk=h`1'/')`6h^Xi<0||(j>=0$rj)||(k>=0$rk))$1o`U&&o`U`A>" + "1?o`U:(l`U?l`U`Y;i=l.path^h`d/^dh=(p?p+'//'`Y+(o`x?o`x:(l`x?l`x`Y)+" + "(h`00,1)$k/'?l.path^h`00,i<0?0:i@y'`Y+h}`2h`9ot`3o){`Ot=o.tag`j;t=t" + "@Q`B?t`B$2`6`ESHAPE')t`X`6t`V`E$T&&@L&&@L`B)t=@L`B();`5^m)t='A';}`2" + "t`9oid`3o`4,^5,p,c,n`X,x=0`6t@v`q$1o`U;c=o.`g`6^m^X`EA'||`EAREA')^X" + '!c||!p||p`7`1\'javascript$F0))n@X`5c@S`ys.rep(`ys.rep@wc,"\\r@W"\\' + "n@W\"\\t@W' `s^dx=2}`5$9^X`E$T||`ESUBMIT')@S$9;x=3}`5o$S&&`EIMAGE')" + "n=o$S`6n){`q=^Vn@g;`qt=x}}`2`q`9rqf`3t,un`4,e=t`1@R,u=e>=0?`s+t`00," + "e)+`s:'';`2u&&u`1`s+un+`s)>=0?@Jt`0e@T:''`9rq`3un`4,c=un`1`s),v=^k'" + "s_sq'),q`X`6c<0)`2`Pv,'&`srq^e$7;`2`Pun`Rrq',0)`9sqp`3t,a`4,e=t`1@R" + ",q=e<0$j@Jt`0e+1)`Tsqq[q]`X`6e>=0)`Pt`00,e)`R@s`20`9sqs`3$Pq`4;^4u[" + "un]=q;`20`9sq`3q`4,k@ksq',v=^kk),x,c=0;^4q`C;^4u`C;^4q[q]`X;`Pv,'&`" + "ssqp',0);`P^2`R@sv`X^E@j^4u`M)^4q[^4u[x]]+=(^4q[^4u[x]]?`s`Y+x^E@j^" + "4q`M&&^4q[x]^Xx==q||c<2)){v+=(v$n'`Y+^4q[x]+'`Lx);c$E`2@Kk,v,0)`9wd" + 'l`8,r=@b,b=^M(`D,"@H"),i,o,oc`6b)r=^u$se)^Ei=0;i<s.d.`Is`A;i$io=s' + '.d.`Is[i];oc=o.`g?""+o.`g:""`6(oc`1"@a$m0||oc`1"^joc@x0)&&oc`' + '1".tl$m0)^M(o,"`g",0,s.lc);}`2r^d`Ds`3`4`6`J>3^X!^N||!^B||`J$q`V' + "s.b^a^r)s.^r('`g@z.bc);`5s.b&&^H)^H('click@z.bc,false);`t ^M(`D,'@H" + "',0,`Dl)}`9vs`3x`4,v=s.`W^F,g=s.`W^F$fk@kvsn^f^2+(g?'^fg`Y,n=^kk),e" + "`c^g,y=e.get@t);e$e@ty+10@Y1900:0))`6v){v*=100`6!n`V!@Kk,x,$I`20;n=" + "x^1n%10000>v)`20}`21`9dyasmf`3t,m`Vt&&m&&m`1t)>=0)`21;`20`9dyasf`3t" + ",m`4,i=t?t`1@R:-1,n,x`6i>=0&&m){`On=t`00,i),x=t`0i+1)`6`Px`Rdyasm^e" + "m))`2n}`20`9uns`3`4,x=s.`HSele`K,l=s.`HList,m=s.`H$gn,i;^2=^2`7`6x&" + "&l`V!m)m=`D`F`x`6!m.toLowerCase)m`X+m;l=l`7;m=m`7;n=`Pl,';`sdyas^em" + ")`6n)^2=n}i=^2`1`s`Tfun=i<0?^2:^2`00,i)`9sa`3un`4;^2=un`6!@A)@A=un;" + "`5(`s+@A+`s)`1$7<0)@A+=`s+un;^2s()`9t`3`4,$M=1,tm`c^g,sed=Math&&@6$" + "N?@6$U@6$N()*10000000000000):`e@I(),@c='s'+@6$U`e@I()/10800000)%10+" + "sed,y=`e@t),vt=`e^g(@y'+`eMonth(@y'@Yy+1900:y)+@U`eHour$0`eMinute$0" + "`eSeconds()+@U`eDay()+@U`e@IzoneO@l(),^J=s.g^J(),ta`X,q`X,qs`X@0`Tu" + "ns()`6!s.td){`Otl=^J`F,a,o,i,x`X,c`X,v`X,p`X,bw`X,bh`X,^70',k=@K's_" + "cc`s@b',0^8,hp`X,ct`X,pn=0,ps`6`w&&`w.prototype){^71'`6j.match){^72" + "'`6tm$eUTC^g){^73'`6^N&&^B&&`J$q^74'`6pn.toPrecision){^75';a`c@2`6a" + ".forEach){^76';i=0;o`C;@5'$Qi`cIterator(o)`z}')`6i&&i.next)^77'}}}}" + "^1`J>=4)x=^Uwidth+'x'+^U$K`6s.isns||s.^S`V`J>=3$4`b(^8`6`J>=4){c=^U" + "pixelDepth;bw=`D$a^o;bh=`D$a^Q}}@q=s.n.p^C}`5^N`V`J>=4$4`b(^8;c=^U`" + "v`6`J$q{bw=s.d.@9`i.o@l^o;bh=s.d.@9`i.o@l^Q`6!^B^ab){`fh$D^dhp=s.b." + 'isH$D(tl^8`z}");`fclientCaps^dct=s.b.@B`K`p`z}")}}}`t r`X^1@q)`Sp' + "n<@q`A&&pn<30){ps=^V@q[pn].^h@g$o'`6p`1ps)<0)p+=ps;pn$Es.^K=x;s.`v=" + "c;s.`k=j;s.`b=v;s.`m^p=k;s.`r^o=bw;s.`r^Q=bh;s.@B`K`p=ct;s.^i=hp;s." + "p^C=p;s.td=1^1s.useP^C)s.doP^C(s);`Ol=`D`F,r=^J.@9ent.`u`6!s.^9)s.^" + "9=l`6!s.`u)s.`u=r`6s.@3||^3){`Oo=^3?^3:s.@3`6!o)`2'';`Op=@o'$d`j')," + "w=1,^5,@N,x=`qt,h,l,i,oc`6^3&&o==^3){`So@vn@Q$kBODY'){o=o.par`i?o.p" + "ar`i:o@1Node`6!o)`2'';^5;@N;x=`qt}oc=o.`g?''+o.`g:''`6(oc`1\"@a@x0&" + "&oc`1\"^joc$m0)||oc`1\".tl@x0)`2''}ta=n?o$8:1;h@Xi=h`1'?^dh=s.`I@O`" + "w||i<0?h:h`00,i);l=s.`I`j?s.`I`j:s.ln(h);t=s.`I`p?s.`I`p`7:s.lt(h)`" + "6t^Xh||l))q+=@n=@3^f(`Ed'||`Ee'?$Xt):'o')+(h?@nv1`Lh)`Y+(l?@nv2`Ll)" + "`Y;`t $M=0`6s.^6@C`V!p$1@o'^9^dw=0}^5;i=o.sourceIndex`6^Z@S^Z;x=1;i" + "=1^1p&&n@Q)qs='&pid`L^Vp,255))+(w$npidt$lw`Y+'&oid`L^Vn@g)+(x$noidt" + "$lx`Y+'&ot`Lt)+(i$noi$li`Y}^1!$M@vqs)`2''`6s.p_r)s.p_r();`O$O`X`6$M" + "^avs(sed))$O=s.mr(@c,(vt$nt`Lvt)`Y+s.hav()+q+(qs?qs:s.rq(^2)),ta`Ts" + "q($M$jqs`T@3=^3=s.`I`j=s.`I`p=`D^jobjectID=s.ppu`X`6$V)`D^j@3=`D^je" + "o=`D^j`I`j=`D^j`I`p`X;`2$O`9tl`3o,t,n`4;s.@3=@ho`T`I`p=t;s.`I`j=n;s" + ".t()`9ssl=(`D`F`U`7`1'https@P0`Td=@9ent;s.b=s.d.body;s.n=navigator;" + "s.u=s.n.userAgent;@8=s.u`1'N$A6/^d`Oapn@u`j,v@uVersion,ie=v`1$R'),o" + "=s.u`1'@4 '),i`6v`1'@4@P0||o>0)apn='@4';^N@r^DMicrosoft Internet Ex" + "plorer'`Tisns@r^DN$A'`T^S@r^D@4'`Tismac=(s.u`1'Mac@P0)`6o>0)`J`ls.u" + "`0o+6));`5ie>0){`J=`ni=v`0ie+5))`6`J>3)`J`li)}`5@8>0)`J`ls.u`0@8+10" + "));`t `J`lv`Tem=0`6`w$h^W){i=^T`w$h^W(256))`B(`Tem=(i^D%C4%80'?2:(i" + "^D%U0100'?1:0))}s.sa(un`Tvl_l='`WID,vmk,ppu,^v,`W`jspace,c`Q,`m^n,$" + "d`j,^9,`u,^x';^P=^O+',^Y,$5,server,$d`p,$b`KID,purchaseID,@d,state," + "zip,$L,products,`I`j,`I`p'^E`On=1;n<51;n++)^P+=',prop$J+',eVar$J+'," + "hier$J;^O2='^K,`v,`k,`b,`m^p,`r^o,`r^Q,@B`K`p,^i,p^C';^P+=`s+^O2;s." + "vl_g=^P+',`W^F,`W^F$f`HSele`K,`HList,`H$g^6^ILinks,^6^t,^6@C,`I@O`w" + ",`I^IFile`ps,`IEx`h,`IIn`h,`I@DVars,`I@D$c,`I`js,@3';$V=pg@0)`6!ss)" + "`Ds()}", w = window, l = w.s_c_il, n = navigator, u = n.userAgent, v = n.appVersion, e = v.indexOf("MSIE "), m = u.indexOf("Netscape6/"), a, i, s;
if (un) {
un = un.toLowerCase();
if (l) {
for (i = 0; i < l.length; i++) {
s = l[i];
if (s._c == "s_c") {
if (s.oun == un) {
return s;
} else {
if (s.fs(s.oun, un)) {
s.sa(un);
return s;
}
}
}
}
}
}
eval(d);
c = s_d(c);
i = c.indexOf("function s_c(");
eval(c.substring(0, i));
if (!un) {
return 0;
}
c = c.substring(i);
if (e > 0) {
a = parseInt(i = v.substring(e + 5));
if (a > 3) {
a = parseFloat(i);
}
} else {
if (m > 0) {
a = parseFloat(u.substring(m + 10));
} else {
a = parseFloat(v);
}
}
if (a >= 5 && v.indexOf("Opera") < 0 && u.indexOf("Opera") < 0) {
eval(c);
return new s_c(un,pg,ss);
} else {
s = s_c2f(c);
}
return s(un, pg, ss);
}
s_gi();
var thisDocIDMain = null ;
var thisDocID = "";
var deactivate = false;
var subNavLinkNo = 0;
function selectedTag(moduleIn, deactivateLink) {
if (moduleIn == "flightx") {
thisDocID = "link2";
subNavLinkNo = 0;
} else {
if (moduleIn == "flight") {
thisDocID = "link2";
subNavLinkNo = 0;
} else {
if (moduleIn == "Cruise") {
thisDocID = "link2";
subNavLinkNo = 5;
} else {
if (moduleIn == "Cars") {
thisDocID = "link2";
subNavLinkNo = 3;
} else {
if (moduleIn == "Hotels") {
thisDocID = "link2";
subNavLinkNo = 2;
} else {
if (moduleIn == "manageTravel") {
thisDocID = "link3";
subNavLinkNo = 0;
} else {
if (moduleIn == "ViewItinerary") {
thisDocID = "link3";
subNavLinkNo = 1;
} else {
if (moduleIn == "CheckIn") {
thisDocID = "link3";
subNavLinkNo = 2;
} else {
if (moduleIn == "changeFlight" || moduleIn == "ChangeFlight") {
thisDocID = "link3";
subNavLinkNo = 3;
} else {
if (moduleIn == "cancelFlight" || moduleIn == "CancelFlight") {
thisDocID = "link3";
subNavLinkNo = 4;
} else {
if (moduleIn == "flightStatus") {
thisDocID = "link3";
subNavLinkNo = 5;
} else {
if (moduleIn == "flightAlerts") {
thisDocID = "link3";
subNavLinkNo = 6;
} else {
if (moduleIn == "home") {
thisDocID = "link1";
subNavLinkNo = 0;
} else {
if (moduleIn == "travelinfo" || moduleIn.indexOf("plan") != -1) {
thisDocID = "link5";
subNavLinkNo = 0;
deactivateLink = "deactivate";
} else {
if (moduleIn == "InfoDeskHelp") {
thisDocID = "link8";
subNavLinkNo = 0;
} else {
if (moduleIn == "InfoDeskRouteMap") {
thisDocID = "link5";
subNavLinkNo = 1;
} else {
if (moduleIn == "InfoDeskDestInfo") {
thisDocID = "link5";
subNavLinkNo = 5;
} else {
if (moduleIn == "InfoDeskSchedule") {
thisDocID = "link5";
subNavLinkNo = 6;
} else {
if (moduleIn == "fareToFlyBy") {
thisDocID = "link6";
subNavLinkNo = 1;
deactivateLink = "deactivate";
} else {
if (moduleIn == "Help") {
thisDocID = "link8";
subNavLinkNo = 0;
} else {
if (moduleIn == "shop") {
thisDocID = "link7";
subNavLinkNo = 0;
} else {
if (moduleIn == "shopGC") {
thisDocID = "link7";
subNavLinkNo = 1;
} else {
if (moduleIn == "landingSearch") {
thisDocID = "link1";
subNavLinkNo = 0;
} else {
if (moduleIn == "elevate") {
thisDocID = "link4";
subNavLinkNo = 0;
} else {
if (moduleIn == "EarnPoints") {
thisDocID = "link4";
subNavLinkNo = 2;
deactivateLink = "deactivate";
} else {
if (moduleIn == "EnjoyRewards") {
thisDocID = "link4";
subNavLinkNo = 3;
deactivateLink = "deactivate";
} else {
if (moduleIn == "Partners") {
thisDocID = "link4";
subNavLinkNo = 5;
deactivateLink = "deactivate";
} else {
if (moduleIn == "routemap" || moduleIn.indexOf("flight-routes") != -1) {
thisDocID = "link5";
subNavLinkNo = 1;
deactivateLink = "deactivate";
} else {
if (moduleIn == "entertainment" || moduleIn == "whats_on_board" || moduleIn == "movies" || moduleIn == "meals" || moduleIn == "amenities" || moduleIn == "satellite_tv" || moduleIn == "premium_tv" || moduleIn == "music_videos" || moduleIn == "radio" || moduleIn == "games" || moduleIn == "chat" || moduleIn == "snacks" || moduleIn == "drinks" || moduleIn == "first_class" || moduleIn.indexOf("whats-on-board") != -1) {
thisDocID = "link5";
subNavLinkNo = 2;
deactivateLink = "deactivate";
} else {
if (moduleIn == "cabins") {
thisDocID = "link5";
subNavLinkNo = 3;
deactivateLink = "deactivate";
} else {
if (moduleIn == "airlinepartners" || moduleIn.indexOf("virgin-partners") != -1) {
thisDocID = "link5";
subNavLinkNo = 4;
deactivateLink = "deactivate";
} else {
if (moduleIn == "airportinformation" || moduleIn.indexOf("airportinformation") != -1 || moduleIn.indexOf("san-diego") != -1 || moduleIn.indexOf("logan-bos") != -1 || moduleIn.indexOf("las-vegas") != -1 || moduleIn.indexOf("fort-lauderdale") != -1 || moduleIn.indexOf("los-angeles") != -1 || moduleIn.indexOf("new-york") != -1 || moduleIn.indexOf("san-francisco") != -1 || moduleIn.indexOf("seattle") != -1 || moduleIn.indexOf("toronto") != -1 || moduleIn.indexOf("dulles") != -1) {
thisDocID = "link5";
subNavLinkNo = 5;
deactivateLink = "deactivate";
} else {
if (moduleIn == "clubhouse" || moduleIn.indexOf("airport-lounge") != -1) {
thisDocID = "link5";
subNavLinkNo = 7;
deactivateLink = "deactivate";
} else {
if (moduleIn == "joinElevate") {
thisDocID = "link4";
subNavLinkNo = 1;
deactivateLink = "deactivate";
} else {
if (moduleIn == "buyGiftTransferPoints") {
thisDocID = "link4";
subNavLinkNo = 4;
deactivateLink = "deactivate";
} else {
if (moduleIn == "memberGuide") {
thisDocID = "link4";
subNavLinkNo = 6;
deactivateLink = "deactivate";
} else {
if (moduleIn == "whatIseleVAte") {
thisDocID = "link4";
subNavLinkNo = 0;
deactivateLink = "deactivate";
} else {
if (moduleIn == "dealsHotels") {
thisDocID = "link6";
subNavLinkNo = 3;
deactivateLink = "deactivate";
} else {
if (moduleIn == "dealsCars") {
thisDocID = "link6";
subNavLinkNo = 2;
deactivateLink = "deactivate";
} else {
if (moduleIn == "dealsElevate") {
thisDocID = "link6";
subNavLinkNo = 4;
deactivateLink = "deactivate";
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
thisDocIDMain = thisDocID + "_main";
if (typeof (deactivateLink) != "undefined") {
deactivate = true;
}
}
function setTitle(param) {
if (param == "travelinfo") {
document.title = "Virgin America | Travel Info";
} else {
if (param == "routemap") {
document.title = "Virgin America | Route Map";
} else {
if (param == "entertainment") {
document.title = "Virgin America | What's on Board";
} else {
if (param == "cabins") {
document.title = "Virgin America | Cabins";
} else {
if (param == "airlinepartners") {
document.title = "Virgin America | Airline Partners";
} else {
if (param == "airportinformation") {
document.title = "Virgin America | Airport Info";
} else {
if (param == "clubhouse") {
document.title = "Virgin America | Club House";
} else {
if (param == "aboutusCorporate" || param == "environmentalSustainability" || param == "communitySupport") {
document.title = "Virgin America | Corporate Responsibility";
} else {
if (param == "meetDavidCush" || param == "meetDianaWalke" || param == "meetFrancisFiorillo" || param == "meetJoeHoughton" || param == "meetRickWysong" || param == "meetToddPawlowski" || param == "meetDavePflieger" || param == "meetKenScarince" || param == "meetBobWeatherly" || param == "meetMarketing") {
document.title = "Virgin America | Bios";
} else {
if (param == "press" || param == "photos" || param == "travelAwards") {
document.title = "Virgin America | Press";
} else {
if (param == "aboutusOverview") {
document.title = "Virgin America | About Us";
} else {
if (param == "corporatesales") {
document.title = "Virgin America | Corporate Sales";
} else {
if (param == "whats_on_board" || param == "movies" || param == "meals" || param == "amenities" || param == "snacks" || param == "drinks" || param == "first_class" || param == "satellite_tv" || param == "premium_tv" || param == "music_videos" || param == "radio" || param == "games" || param == "chat") {
document.title = "Virgin America | What's on Board";
} else {
document.title = "Virgin America ";
}
}
}
}
}
}
}
}
}
}
}
}
}
}
function showBodySubNavLinks(thisObj) {
if (thisObj) {
thisObj.className = "selected";
thisObj.href = "javascript:void(0)";
}
}
function showNavigation(navId, subNavNo) {
thisDocID = navId;
subNavLinkNo = subNavNo;
thisDocIDMain = thisDocID + "_main";
intialiseHeader(thisDocID);
}
function intialiseHeader(_thisDocID, deactivateLink, _cursor) {
if ((_thisDocID != "link1") && (_thisDocID != "link8") && (_thisDocID != "link9")) {
if (document.getElementById(_thisDocID)) {
if (typeof (document.getElementById(_thisDocID + "_main").getElementsByTagName("ul")[0]) != "undefined" && document.getElementById(_thisDocID + "_sub")) {
document.getElementById(_thisDocID + "_sub").style.visibility = "visible";
document.getElementById(_thisDocID + "_sub").style.top = 29 + "px";
}
if ((subNavLinkNo == 0) && (_thisDocID == "link2") && document.getElementById(thisDocID + "_sub")) {
document.getElementById(thisDocID + "_sub").getElementsByTagName("li")[subNavLinkNo].className = "selected";
}
if (subNavLinkNo != 0 && document.getElementById(thisDocID + "_sub")) {
document.getElementById(thisDocID + "_sub").getElementsByTagName("li")[subNavLinkNo - 1].className = "selected";
if (deactivateLink && document.getElementById(_thisDocID + "_sub").getElementsByTagName("li")[subNavLinkNo - 1]) {}
}
document.getElementById(_thisDocID).className = _thisDocID + "Selected";
if (_cursor == true) {
document.getElementById(_thisDocID).style.cursor = "pointer";
} else {
document.getElementById(_thisDocID).style.cursor = "pointer";
}
var lastsep = _thisDocID.charAt(4) - 1;
document.getElementById(_thisDocID + "Seperator").className = "noneseperator";
document.getElementById("link" + lastsep + "Seperator").className = "noneseperator";
}
} else {
document.getElementById(_thisDocID).className = _thisDocID + "Selected";
if (_cursor == true) {
document.getElementById(_thisDocID).style.cursor = "pointer";
} else {
document.getElementById(_thisDocID).style.cursor = "pointer";
}
}
}
function deIntialiseHeader(_thisDocID) {
if ((_thisDocID != "link1") && (_thisDocID != "link8") && (_thisDocID != "link9")) {
if (document.getElementById(_thisDocID)) {
document.getElementById(_thisDocID).className = _thisDocID;
document.getElementById(_thisDocID + "_sub").style.visibility = "hidden";
}
var lastsep = _thisDocID.charAt(4) - 1;
document.getElementById(_thisDocID + "Seperator").className = "seperator";
document.getElementById("link" + lastsep + "Seperator").className = "seperator";
}
}
function menuOver(x) {
var imgId = x.parentNode.firstChild.id;
var lastsep = imgId.charAt(4) - 1;
document.getElementById(imgId).className = imgId + "Selected";
if ((imgId != "link1") && (imgId != "link9") && (imgId != "link8")) {
document.getElementById(imgId + "Seperator").className = "noneseperator";
document.getElementById("link" + lastsep + "Seperator").className = "noneseperator";
}
if (document.getElementById(thisDocID)) {
deIntialiseHeader(thisDocID);
}
if (imgId == thisDocID) {
intialiseHeader(imgId, deactivate, false);
} else {
intialiseHeader(imgId, deactivate, true);
}
}
function menuOut(x) {
var imgId = x.parentNode.firstChild.id;
var lastsep = imgId.charAt(4) - 1;
if ((imgId != "link1") && (imgId != "link9") && (imgId != "8")) {
if (imgId != thisDocID) {
document.getElementById(imgId + "Seperator").className = "seperator";
document.getElementById("link" + lastsep + "Seperator").className = "seperator";
}
}
if (imgId == thisDocID) {
document.getElementById(imgId).className = imgId + "Selected";
} else {
document.getElementById(imgId).className = imgId;
deIntialiseHeader(imgId);
intialiseHeader(thisDocID, deactivate);
}
}
var PrevDivId = "BookFlight";
function rollOverChangeImage(obj, IMG, mouseStyle) {
document.getElementById(obj).src = IMG;
document.getElementById(obj).style.cursor = mouseStyle;
}
function showHideDiv(obj) {
document.getElementById(PrevDivId + "Div").style.display = "none";
document.getElementById(PrevDivId + "Img").style.display = "none";
document.getElementById(obj + "Div").style.display = "block";
document.getElementById(obj + "Img").style.display = "block";
PrevDivId = obj;
}
function updateDashbordDiv(divId, signInStatus) {
if (document.getElementById(divId + "Div").innerHTML != "") {
showHideDiv(divId);
} else {
$.ajax({
type: "POST",
url: "updateDashboardTool.do",
data: "divName=" + divId + "&signInStatus=" + signInStatus,
dataType: "html",
success: function(html) {
$get_JsElement("CheckInDiv").innerHTML = "";
$get_JsElement("ChangeFlightDiv").innerHTML = "";
$get_JsElement("CancelFlightDiv").innerHTML = "";
if (html.trim() == "sessionOut") {
window.location = "/home.do?method=virginAmerica&backSessionOut=sessionTimeOut";
} else {
if (html.trim() == "AjaxError") {
window.location = "/home.do?method=virginAmerica&fromErrorPage=fromErrorPage";
} else {
$("#" + divId + "Div").html(html.trim());
showHideDiv(divId);
}
}
}
});
}
}
function togglePromoArea(obj) {
if (document.getElementById("PromoCodeDetail").style.display == "block") {
document.getElementById("PromoCodeDetail").style.display = "none";
obj.className = "imgPromoCode floatLeft";
obj.firstChild.title = "Open";
} else {
document.getElementById("PromoCodeDetail").style.display = "block";
obj.className = "imgPromoCodeSelected floatLeft";
obj.firstChild.title = "Close";
}
}
function applyPromoCode(tripType, pageName) {
var promoUrl = "/promoCodeApply.do?method=applyPromoCode&certCode=" + document.getElementById("promoCodeText").value + "&tripType=" + tripType + "&pageName=" + pageName;
if (document.getElementById("loadingAnimationDiv")) {
showWaitImage();
} else {
showWaitImage();
}
promoCodeAjax(promoUrl);
}
function promoCodeAction(action, pageName) {
var tripType = "other";
showWaitImage();
if (document.getElementById("divOW").style.display == "block") {
tripType = "OW";
}
if (action == "apply") {
var promoUrl = "promoCodeApply.do?method=applyPromoCode&certCode=" + document.getElementById("promoCodeValue").value + "&tripType=" + tripType + "&pageName=" + pageName;
} else {
if (action == "remove") {
var promoUrl = "promoCodeRemove.do?method=removePromoCode&pageName=" + pageName;
}
}
$("#sect").load(promoUrl, "", done);
function done() {
ajax("updateTitleBar.do?method=updateTitleBar", "titleBarDiv");
document.getElementById("loadingAnimationDiv").style.display = "none";
}
}
var mainCalW = "352";
var innerCalW = "160";
var tableOpen = "<tr><td colspan='3' align='left' valign='top'>" + "<table width='352' border='0' cellpadding='0' cellspacing='0'>" + "<tr><td width='13' height='9' rowspan='3' align='left' valign='top' class='calenderLeft'><img src='/web/20110901145833/https://static.virginamerica.com/images/spacer.gif' width='13'/></td>" + "<td style='background-color:#FFFFFF'><img src='/web/20110901145833/https://static.virginamerica.com/images/spacer1.png' width='320' height='9'/></td>" + "<td width='14' height='9' rowspan='3' align='left' valign='top' class='calenderRight'><img src='/web/20110901145833/https://static.virginamerica.com/images/spacer.gif' width='14'/></td></tr>" + "<tr><td align='left' valign='top' >" + "<table width='325' border='0' cellspacing='0' cellpadding='0' style='background-color:#FFFFFF'>" + "<tr><td width=" + innerCalW + " align='left' valign='top' >";
var prev_cal = "";
var next_cal = "";
var tableCloseS = "</td></tr>" + "<tr><td>" + "<table width='325' border='0' cellspacing='0' cellpadding='0' bgcolor='#e5e5e5'>" + "<tr>" + '<td valign="bottom" width="36" height="20">';
var tableCloseM = "</td>" + "<td width='255' height='20'>&nbsp;</td>" + '<td valign="bottom" width="35" height="20">';
var tableCloseL = "</td></tr></table>" + "</td></tr>" + "</table></td></tr>" + "<tr><td width='352' height='14' colspan='3' align='left' valign='top' class='calenderBase'><img src='/web/20110901145833/https://static.virginamerica.com/images/spacer.gif' width='352' height='14' /></td></tr></table>";
var tdFor3rdCalTable = "</td><td width='5' align='left' valign='top'><img src='/web/20110901145833/https://static.virginamerica.com/images/calender_ct.png' width='5' height='136' /></td><td width=" + innerCalW + " align='left' valign='top' >";
function makeCal(whichMonth) {
b_calinit = 1;
o_cal = "";
o_caltr = "";
o_caltd = "";
newM = whichMonth;
if (newM < cM) {
newY = newY;
}
if (newM >= 12) {
newM = whichMonth - 12;
newY++;
}
if (i_numcal == 0) {
i_firstMonth = newM;
switch (s_inputtype) {
case "object":
i_ofirstMonth = newM;
i_ofirstYear = newY;
break;
default:
i_sfirstMonth = newM;
i_sfirstYear = newY;
}
}
newDs = datesArray[newM];
isLeap = (newY % 4 == 0 && (newY % 100 != 0 || newY % 400 == 0)) ? 1 : 0;
if (newM == 1) {
newDs = newDs + isLeap;
}
newD = findFirstDay();
countDay = newD;
s_calclass = (calDirection == "vertical") ? "calTableH" : "calTableH";
var changeTDTOTABLEValue = "";
o_cal += "<table month='" + newM + "' year='" + newY + "' width=" + innerCalW + " border='0' cellspacing='0' cellpadding='0' style='background:color:blue'>";
o_caltd += "<td height='20' align='center' valign='middle' class='calMon' background='/web/20110901145833/https://static.virginamerica.com/images/month_bg.png' colspan=7>";
changeTDTOTABLEValue = mArray[newM];
o_caltd += "RWTCMT";
o_caltd += "</td>";
o_caltr = ty_maketr(o_caltd);
o_cal += o_caltr;
o_caltd = "";
o_caltd += "<td height='14' align='left' valign='top' colspan=7 ><img src='/web/20110901145833/https://static.virginamerica.com/images/day_name.png' width=" + innerCalW + " height='14' /></td>";
o_caltr = ty_maketr(o_caltd);
o_caltd = "";
o_cal += o_caltr;
o_caltd = "<td width='160' bgcolor='#e0e0e0' align='center' colspan=7><table width='158' border='0' cellpadding='0' cellspacing='0' align='center' style='background-color:#FFFFFF'>";
o_caltr = ty_maketr(o_caltd);
o_cal += o_caltr;
o_caltd += "<td ><img src='/web/20110901145833/https://static.virginamerica.com/images/spacer.gif'></td>";
o_caltr = ty_maketr(o_caltd);
o_cal += o_caltr;
o_caltd = "";
i_calRows = 0;
for (d = 1; d <= newDs; d++) {
if (d == 1) {
for (bd = 0; bd < newD; bd++) {
o_caltd += "<td width='18' height='16' align='left' valign='top'><img src='/web/20110901145833/https://static.virginamerica.com/images/spacer.gif' width='18' height='16' /></td>";
}
}
o_caltd += ty_makeDate(d);
countDay++;
if (countDay == 7) {
countDay = 0;
o_caltr = ty_maketr(o_caltd);
o_cal += o_caltr;
o_caltd = "";
i_calRows++;
}
if (d == newDs && countDay != 0) {
for (bd = countDay; bd < 7; bd++) {
o_caltd += "<td width='18' height='16' align='left' valign='top' style='background-color:#FFFFFF'></td>";
}
o_caltr = ty_maketr(o_caltd);
o_cal += o_caltr;
o_caltd = "";
i_calRows++;
}
}
if (i_calRows < 6) {
for (calRow = 1; calRow < (7 - i_calRows); calRow++) {
o_caltd = "";
for (bd = 0; bd < 7; bd++) {
o_caltd += "<td width='18' height='6' style='background-color:#FFFFFF'><img src='/web/20110901145833/https://static.virginamerica.com/images/spacer.gif' width='18' height='16' /></td>";
}
o_caltr = ty_maketr(o_caltd);
o_cal += o_caltr;
}
}
o_cal += "</td></table>";
o_caltd = "<td width=" + innerCalW + " height='5' align='left' style='background-color:#e5e5e5;' colspan='7'><img src='/web/20110901145833/https://static.virginamerica.com/images/calender_bt.png' width=" + innerCalW + " height='5' /></td>";
o_caltr = ty_maketr(o_caltd);
o_cal += o_caltr;
if (i_numcal == 0) {
if (newM == cM && newY == cY) {
prev_cal = "";
} else {
prev_cal = "<a href='#' id='idcal1' onclick='" + s_jscall + "ty_changeMonths(" + i_firstMonth + "-1);" + s_jscall + "preventClose(event);return false;'><img src='/web/20110901145833/https://static.virginamerica.com/images/calender_prev.png' width='36' height='9' border='0' /></a>";
}
}
o_calbody.innerHTML += o_cal;
i_numcal++;
if (i_numcal == numCalendars && !b_date331) {
next_cal = "<a href='#' id='idcal2' onclick='" + s_jscall + "ty_changeMonths(" + i_firstMonth + "+1);" + s_jscall + "preventClose(event);return false;'><img src='/web/20110901145833/https://static.virginamerica.com/images/calender_nxt.png' width='36' height='9' border='0' /></a>";
} else {
next_cal = "";
}
var monthtable1 = "<table width=" + innerCalW + " border='0' cellspacing='0' cellpadding='0'>" + "<tr><td align='left' valign='top' width='5' height='17'><img src='/web/20110901145833/https://static.virginamerica.com/images/spacer.gif' width='5' height='17' border='0' /></td>" + "<td width='16' align='left' valign='top'>";
var monthtable2 = "</td><td width='5' align='center' valign='middle' class='style9'><img src='/web/20110901145833/https://static.virginamerica.com/images/spacer.gif' width='5' height='17' border='0' /></td>" + "</tr></table>";
if (i_numcal < numCalendars) {
o_calbody.innerHTML = o_calbody.innerHTML.replace("RWTCMT", changeTDTOTABLEValue);
o_cal1 = o_calbody.innerHTML;
o_calbody.innerHTML = "";
} else {
o_calbody.innerHTML = o_calbody.innerHTML.replace("RWTCMT", changeTDTOTABLEValue);
o_cal2 = o_calbody.innerHTML;
o_cal2 = o_cal2 + "</td></tr></table>";
o_calbody.innerHTML = "";
}
if (i_numcal < numCalendars) {
makeCal(newM + 1);
zzzz++;
} else {
if (i_firstMonth > newM) {
newY--;
}
}
if (zzzz % 2 == 0) {
o_calbody.innerHTML = s_closecal + tableOpen + o_cal1 + tdFor3rdCalTable + o_cal2 + tableCloseS + prev_cal + tableCloseM + next_cal + tableCloseL;
zzzz = 1;
}
}
function openCalendar(v_input, s_from, s_to, s_cal, s_parent, s_mode, s_caldir, pos1, pos2, imageName) {
calType = "home";
flgDorR = imageName;
var imageClassName;
flgRetName = s_from;
var retLocalVar = s_from;
var dpDtStr = "";
cM = today.getMonth();
cY = today.getFullYear();
v_input.className = "";
if (document.flightSearchForm) {
for (i = 0; i < document.flightSearchForm.elements.length; i++) {
if (document.flightSearchForm.elements[i].name == "flightSearch.depDate.MMDDYYYY") {
dpDtStr = document.flightSearchForm.elements[i].value;
}
}
}
if (imageName == "return_date.png") {
imageClassName = "returnDate";
} else {
imageClassName = "departDate";
}
if (imageName == "return_date.png" || (retLocalVar == "flightSearch.returnDateMC.MMDDYYYY")) {
if (dpDtStr == "" || dpDtStr == "mm/dd/yyyy") {
i_ofirstMonth = new Date().getMonth();
flgDateDisable = new Date();
} else {
flgDateDisable = new Date(dpDtStr);
i_ofirstMonth = new Date(dpDtStr).getMonth();
cM = i_ofirstMonth;
cY = flgDateDisable.getFullYear();
}
}
if (isPCIE) {
s_closecal = "<table width='350' border='0' cellpadding='0' cellspacing='0'>";
} else {
s_closecal = "<table width='350' border='0' cellpadding='0' cellspacing='0' style='margin-left:-2px'>";
}
s_closecal = s_closecal + "<tr><td width='280' height='31' align='left' valign='top' class='" + imageClassName + "' ><img src='/web/20110901145833/https://static.virginamerica.com/images/spacer.gif' width='280' height='31' /></td>" + "<td width='58' align='left' valign='top' class='closeCal' ><a href='#' id='idclose' onclick='" + s_jscall + "closeCal();return false;'><img src='/web/20110901145833/https://static.virginamerica.com/images/spacer.gif' width='58' border='0' height='31'/></a></td>" + "<td width='14' align='left' valign='top' class='departDateRight'><img src='/web/20110901145833/https://static.virginamerica.com/images/spacer.gif' width='14' height='31'/></td></tr>";
FieldClicked = v_input.name;
displayImage = imageName;
clearTimeout(t_calcloser);
s_inputtype = typeof (v_input);
a_v_input = null ;
calopen = 0;
o_caldiv = document.getElementById(s_cal);
o_caldiv.style.display = "block";
o_caldiv.className = "calboxon";
makeCalendar(v_input, s_from, s_to, s_mode);
o_inputright = v_input;
o_parent = document.getElementById(s_parent);
o_cal = document.getElementById(s_cal);
i_calx = parseInt(o_inputright.offsetLeft) + parseInt(o_inputright.offsetWidth);
i_caly = parseInt(o_parent.offsetTop) + (parseInt(o_parent.offsetHeight) / 2) - (parseInt(o_cal.offsetHeight) / 2);
var top = parseInt(($("#BookFlightDiv").height() - 209) / 2);
var divMargin = $("#BookFlightDiv").css("marginLeft");
if (divMargin == "auto") {
divMargin = "0";
} else {
divMargin.replace(/px/, "");
}
var left = parseInt(($("#BookFlightDiv").width() - 350) / 2) + parseInt(divMargin) + 20;
o_cal.style.left = left + "px";
o_cal.style.top = ($("#" + s_parent).offset().top - 150) + "px";
setTimeout("calopen = 1", 100);
}
function loadHomeHeadScripts(thisDate) {
document.write('<style type="text/css">.tabber{display:none;}</style>');
s.pageName = "Home Page";
s.channel = "Home";
fixedConfiguratedDate = thisDate;
$(document).ready(function() {
MM_preloadImages("/web/20110901145833/https://static.virginamerica.com/images/loadingBG.png", "/web/20110901145833/https://static.virginamerica.com/images/homeBgImage.png", "/web/20110901145833/https://static.virginamerica.com/images/rollOver.png", "/web/20110901145833/https://static.virginamerica.com/images/navDashBoard.png");
});
}
function loadOrigins(Origin, Destination) {
var obj = $get_JsElement("flightSearchForm", "flightSearch.origin");
obj.value = Origin;
redirect(obj.selectedIndex);
$get_JsElement("originFltOneMC").selectedIndex = obj.selectedIndex;
obj = $get_JsElement("flightSearchForm", "flightSearch.destination");
obj.value = Destination;
$get_JsElement("destinationFltOneMC").selectedIndex = obj.selectedIndex;
}
function loadMCOrigins(Origin, Destination) {
document.getElementById("originFltTwoMC").value = Origin;
redirectMC(document.getElementById("originFltTwoMC").selectedIndex);
document.getElementById("destinationFltTwoMC").value = Destination;
}
function loadHomeBottomScripts(elevateOrAcct, currentDivId) {
if (errorPresent) {
document.getElementById("ErrorMessage").style.display = "block";
} else {
document.getElementById("ErrorMessage").style.display = "none";
}
var radioObj = document.getElementsByName("flightSearch.tripType");
for (i = 0; i < radioObj.length; i++) {
if (radioObj[i].checked == true) {
changeTripType(radioObj[i].value);
break;
}
}
selectedTag("home");
$(document).ready(function() {
showHideDiv(currentDivId);
});
if (elevateOrAcct == "JoinElevate") {
document.getElementById("joinOrAccount").innerHTML = "<a href='/frequent-flyer/join-elevate.html'>Join Elevate</a>";
} else {
document.getElementById("joinOrAccount").innerHTML = "<a href='signIn.do?method=homeProfileWithPagination'>My Account</a>";
}
var loadFunction = window.onload;
window.onload = function() {
if (loadFunction) {
loadFunction();
}
intialiseHeader(thisDocID, deactivate);
}
;
}
function originRTHome() {
for (i = 0; i < document.flightSearchForm.elements.length; i++) {
elementName = document.flightSearchForm.elements[i].name;
if (elementName == "flightSearch.origin") {
break;
}
}
}
function loadDataFromCookiesHome(tripType) {
for (j = 0; j < document.flightSearchForm.elements.length; j++) {
var obj = document.flightSearchForm.elements[j];
if (obj.name == "flightSearch.origin") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
} else {
if (obj.name == "flightSearch.destination") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
} else {
if (obj.name == "flightSearch.adults") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
if (obj.value != null && obj.value.length > 0) {
document.getElementById("adults").value = obj.value.trim();
document.getElementById("adultsMC").value = obj.value.trim();
}
} else {
if (obj.name == "flightSearch.kids") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
if (obj.value != null && obj.value.length > 0) {
document.getElementById("kids").value = obj.value;
document.getElementById("kidsMC").value = obj.value;
}
} else {
if (obj.name == "flightSearch.infants") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
if (obj.value != null && obj.value.length > 0) {
document.getElementById("infants").value = obj.value;
document.getElementById("infantsMC").value = obj.value;
}
} else {
if (obj.name == "flightSearch.originMC") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
if (obj.value != null && obj.value.length > 0) {
document.getElementById("originFltTwoMC").value = obj.value;
}
} else {
if (obj.name == "flightSearch.destinationMC") {
obj.value = (getCookie(obj.name) != null ) ? getCookie(obj.name) : (obj.value);
if (obj.value != null && obj.value.length > 0) {
document.getElementById("destinationFltTwoMC").value = obj.value;
}
}
}
}
}
}
}
}
if (tripType == "mc") {
if (obj.name == "flightSearch.depDateMC.MMDDYYYY") {
obj.value = ((getCookie(obj.name) != null ) && (Date.parse(getCookie(obj.name)) >= (Date.parse(new Date()) - 24 * 60 * 60 * 1000))) ? getCookie(obj.name) : (obj.value);
} else {
if (obj.name == "flightSearch.returnDateMC.MMDDYYYY") {
obj.value = ((getCookie(obj.name) != null ) && (Date.parse(getCookie(obj.name)) >= (Date.parse(new Date()) - 24 * 60 * 60 * 1000))) ? getCookie("flightSearch.returnDate.MMDDYYYY") : (obj.value);
}
}
} else {
if (tripType == "mc" && obj.name == "flightSearch.depDateOW.MMDDYYYY") {
obj.value = ((getCookie(obj.name) != null ) && (Date.parse(getCookie(obj.name)) >= (Date.parse(new Date()) - 24 * 60 * 60 * 1000))) ? getCookie(obj.name) : (obj.value);
} else {
if (tripType == "rt") {
if (obj.name == "flightSearch.depDate.MMDDYYYY") {
obj.value = ((getCookie(obj.name) != null ) && (Date.parse(getCookie(obj.name)) >= (Date.parse(new Date()) - 24 * 60 * 60 * 1000))) ? getCookie(obj.name) : (obj.value);
} else {
if (obj.name == "flightSearch.returnDate.MMDDYYYY") {
obj.value = ((getCookie(obj.name) != null ) && (Date.parse(getCookie(obj.name)) >= (Date.parse(new Date()) - 24 * 60 * 60 * 1000))) ? getCookie(obj.name) : (obj.value);
}
}
}
}
}
}
origin();
Destination();
updateDepDateInForm();
updateRetDateInForm();
}
function loadDivForCookieHome() {
if (getCookie("TT") == null || getCookie("TT") == "") {
changeTripType("rt");
} else {
document.flightSearchForm.elements["flightSearch.tripType"].value = getCookie("TT");
changeTripType(getCookie("TT"));
}
}
function Destination() {
if (currentTripType == "mc") {
document.flightSearchForm.elements["flightSearch.destination"].selectedIndex = document.getElementById("destinationFltOneMC").selectedIndex;
} else {
document.getElementById("destinationFltOneMC").selectedIndex = document.flightSearchForm.elements["flightSearch.destination"].selectedIndex;
}
}
function origin() {
if (currentTripType == "mc") {
document.flightSearchForm.elements["flightSearch.origin"].selectedIndex = document.getElementById("originFltOneMC").selectedIndex;
var destinationMC = document.getElementById("destinationFltTwoMC").value;
document.getElementById("destinationFltTwoMC").value;
redirectMC(document.getElementById("originFltTwoMC").selectedIndex);
document.getElementById("destinationFltTwoMC").value = destinationMC;
} else {
document.getElementById("originFltOneMC").selectedIndex = document.flightSearchForm.elements["flightSearch.origin"].selectedIndex;
}
var destination = document.flightSearchForm.elements["flightSearch.destination"].value;
redirect(document.flightSearchForm.elements["flightSearch.origin"].selectedIndex);
document.flightSearchForm.elements["flightSearch.destination"].value = destination;
document.getElementById("destinationFltOneMC").value = destination;
}
function updateDepDateInForm() {
if (currentTripType == "mc") {
document.flightSearchForm.elements["flightSearch.depDate.MMDDYYYY"].value = document.flightSearchForm.elements["flightSearch.depDateMC.MMDDYYYY"].value;
document.flightSearchForm.elements["flightSearch.depDateOW.MMDDYYYY"].value = document.flightSearchForm.elements["flightSearch.depDateMC.MMDDYYYY"].value;
} else {
document.flightSearchForm.elements["flightSearch.depDateMC.MMDDYYYY"].value = document.flightSearchForm.elements["flightSearch.depDate.MMDDYYYY"].value;
document.flightSearchForm.elements["flightSearch.depDateOW.MMDDYYYY"].value = document.flightSearchForm.elements["flightSearch.depDate.MMDDYYYY"].value;
}
}
function updateRetDateInForm() {
if (currentTripType == "mc") {
document.flightSearchForm.elements["flightSearch.returnDate.MMDDYYYY"].value = document.flightSearchForm.elements["flightSearch.returnDateMC.MMDDYYYY"].value;
} else {
document.flightSearchForm.elements["flightSearch.returnDateMC.MMDDYYYY"].value = document.flightSearchForm.elements["flightSearch.returnDate.MMDDYYYY"].value;
}
}
function closeDiv(divID) {
document.getElementById(divID).style.display = "none";
}
function closeDashBoardDiv(div) {
document.getElementById(div + "Div").style.display = "none";
document.getElementById(div + "Img").style.display = "none";
}
function showHomeLoader(divId) {
var top = parseInt(($("#" + divId).height() - $("#loadingAnimationDiv").height()) / 2) + 132;
var divMargin = $("#" + divId).css("marginLeft");
if (divMargin == "auto") {
divMargin = "0";
} else {
divMargin.replace(/px/, "");
}
var left = parseInt(($("#" + divId).width() - $("#loadingAnimationDiv").width()) / 2) + parseInt(divMargin);
document.getElementById("loadingAnimationDiv").style.marginTop = top + "px";
document.getElementById("loadingAnimationDiv").style.marginLeft = left + "px";
document.getElementById("loadingAnimationDiv").style.display = "block";
}
var dropDownType = "originDestination";
function updateDropDowns(selectobj, selectedVal) {
if ($(selectobj).parent().attr("id") == "originDiv" || $(selectobj).attr("id") == "originFltOneMC") {
redirect(selectobj.options.selectedIndex);
refreshComboBox("destinationDiv");
refreshComboBox("destinationFltOneMC");
if ($(selectobj).val() == "" && selectedVal.indexOf("Flight") == -1) {
$("#originFltOneMC").parent().find("a").empty().html("<b>Flight 1: </b>" + selectedVal);
} else {
$("#originFltOneMC").parent().find("a").empty().append(selectedVal);
}
$("#originDiv").find("a").empty().append(selectedVal);
if ($(selectobj).attr("id") == "originFltOneMC") {
$("#originDiv select").val($("#originFltOneMC").val());
} else {
$("#originFltOneMC").val($("#originDiv select").val());
}
} else {
if ($(selectobj).attr("id") == "originFltTwoMC") {
redirectMC(selectobj.options.selectedIndex);
refreshComboBox("destinationFltTwoMC");
if ($(selectobj).val() == "" && selectedVal.indexOf("Flight") == -1) {
$("#originFltTwoMC").parent().find("a").empty().append("<b>Flight 2: </b>" + selectedVal);
} else {
$("#originFltTwoMC").parent().find("a").empty().append(selectedVal);
}
} else {
if ($(selectobj).attr("id") == "adults") {
$("#adultsMC").val($(selectobj).val());
$("#adultsMC").parent().find("a").empty().append($(selectobj).val());
} else {
if ($(selectobj).attr("id") == "adultsMC") {
$("#adults").val($(selectobj).val());
$("#adults").parent().find("a").empty().append($(selectobj).val());
} else {
if ($(selectobj).attr("id") == "kids") {
$("#kidsMC").val($(selectobj).val());
$("#kidsMC").parent().find("a").empty().append($(selectobj).val());
} else {
if ($(selectobj).attr("id") == "kidsMC") {
$("#kids").val($(selectobj).val());
$("#kids").parent().find("a").empty().append($(selectobj).val());
} else {
if ($(selectobj).attr("id") == "infants") {
$("#infantsMC").val($(selectobj).val());
$("#infantsMC").parent().find("a").empty().append($(selectobj).val());
} else {
if ($(selectobj).attr("id") == "infantsMC") {
$("#infants").val($(selectobj).val());
$("#infants").parent().find("a").empty().append($(selectobj).val());
} else {
if ($(selectobj).attr("name") == "flightStatus.origin") {
changeFlightStatusDestinationFields(selectobj.options.selectedIndex, "To", "home");
} else {
if ($(selectobj).parent().attr("id") == "destinationDiv" || $(selectobj).attr("id") == "destinationFltOneMC" || $(selectobj).attr("id") == "destinationFltTwoMC") {
if ($(selectobj).parent().attr("id") == "destinationDiv") {
$("#destinationFltOneMC").parent().find("a").empty().append(selectedVal);
$("#destinationFltOneMC").val($(selectobj).val());
} else {
if ($(selectobj).attr("id") == "destinationFltOneMC") {
$("#destinationDiv").find("a").empty().append(selectedVal);
$("#destinationDiv select").val($(selectobj).val());
}
}
}
}
}
}
}
}
}
}
}
}
}
function togglePromoCode(obj, divID) {
if (document.getElementById(divID).style.display == "block") {
document.getElementById(divID).style.display = "none";
obj.src = "/web/20110901145833/https://static.virginamerica.com/images/rightArrow.gif";
obj.alt = "Open";
obj.title = "Open";
} else {
document.getElementById(divID).style.display = "block";
obj.src = "/web/20110901145833/https://static.virginamerica.com/images/downArrow.gif";
obj.alt = "Close";
obj.title = "Close";
}
}
function setCookiesHome() {
var i = 0;
var expiredays = 30;
var exdate = new Date();
exdate.setDate(exdate.getDate() + expiredays);
var mcDepDate2 = "";
for (j = 0; j < document.flightSearchForm.elements.length; j++) {
var obj = document.flightSearchForm.elements[j];
if (obj.name == "flightSearch.origin") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.destination") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.depDate.MMDDYYYY") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.returnDate.MMDDYYYY") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.depDateOW.MMDDYYYY") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.depDateMC.MMDDYYYY") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.originMC") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.destinationMC") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.returnDateMC.MMDDYYYY") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.adults") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.kids") {
setCookie(obj.name, escape(obj.value), exdate);
} else {
if (obj.name == "flightSearch.infants") {
setCookie(obj.name, escape(obj.value), exdate);
}
}
}
}
}
}
}
}
}
}
}
}
}
}
function customRadioOnClick(obj) {
if ($(obj).next("input").attr("name") == "flightSearch.tripType") {
if ($(obj).next("input").attr("value") != currentTripType) {
clearSearchFormErrors();
}
changeTripType($(obj).next("input").attr("value"));
for (i = 0; i < document.flightSearchForm.elements["flightSearch.tripType"].length; i++) {
if ($(obj).next("input").attr("value") == document.flightSearchForm.elements["flightSearch.tripType"][i].value) {
document.flightSearchForm.elements["flightSearch.tripType"][i].checked = true;
}
}
} else {
if ($(obj).next("input").attr("value") == "Points") {
$("#PopoupPointBetaAlert").css({
marginTop: "100px",
marginLeft: "100px"
});
$("#PopoupPointBetaAlert").show();
$("#PromoCodeDiv").hide();
} else {
$("#PopoupPointBetaAlert").hide();
$("#PromoCodeDiv").show();
}
}
}
function clearSearchFormErrors() {
var els = document.getElementById("BookFlightDiv").getElementsByTagName("*");
document.getElementById("ErrorMessage").style.display = "none";
for (var i = 0, j = els.length; i < j; i++) {
if (els[i].className == "error") {
els[i].className = "";
} else {
if (els[i].className != "ErrorMessage" && els[i].className.indexOf("Error") != -1) {
els[i].className = els[i].className.substring(0, els[i].className.indexOf("Error"));
} else {
if (els[i].className.indexOf("errorLabel") != -1) {
els[i].className = els[i].className.replace("errorLabel", "");
}
}
}
}
}
function redirect(x) {
var destOpts = document.flightSearchForm.elements["flightSearch.destination"];
var destOptsMC = document.getElementById("destinationFltOneMC");
var selVal = document.flightSearchForm.elements["flightSearch.destination"].value;
var salValueFlg = 0;
if (x != "0") {
for (m = destOpts.options.length - 1; m > 0; m--) {
destOpts.options[m] = null ;
if (destOptsMC) {
destOptsMC.options[m] = null ;
}
}
for (i = 0; i < group[x].length; i++) {
destOpts.options[i] = new Option(group[x][i].text,group[x][i].value);
if (destOptsMC) {
destOptsMC.options[i] = new Option(group[x][i].text,group[x][i].value);
}
if (group[x][i].value == selVal) {
salValueFlg = i;
}
}
destOpts.options[salValueFlg].selected = true;
if (destOptsMC) {
destOptsMC.options[salValueFlg].selected = true;
}
}
}
function refreshComboBox(id) {
if (id != "destinationDiv") {
$("#" + id).prev().remove();
$("#" + id).prev().remove();
$("#" + id).selectbox({
debug: false
});
} else {
$("#" + id + " a").remove();
$("#" + id + " div").remove();
$("#" + id + " select").selectbox({
debug: false
});
}
}
function enableDisablePointsRadio(flag) {
$("#DisplayPriceDiv").find("input").each(function() {
var boxtype = $(this).attr("type");
if ($(this).val() == "Points") {
if (flag) {
$(this).prev("span").removeClass("cust_" + boxtype + "_on").removeClass("cust_" + boxtype + "_off").addClass("cust_" + boxtype + "_disabled_off").next("input").removeAttr("checked");
$(this).attr("disabled", "disabled");
} else {
$(this).prev("span").removeClass("cust_" + boxtype + "_disabled_off").addClass("cust_" + boxtype + "_off");
$(this).attr("disabled", "false");
}
}
});
}
function changeTripType(tripType) {
if (tripType == "mc") {
document.getElementById("RoundTrip").style.display = "none";
document.getElementById("MultiCity").style.display = "block";
if (document.getElementById("MultiCityOption").style.display == "none") {
document.getElementById("BookExtraThingMulti").style.display = "none";
} else {
document.getElementById("BookExtraThingMulti").style.display = "block";
}
document.getElementById("BookFlightDiv").style.width = "603px";
document.getElementById("BookFlightDivTop").style.width = "593px";
document.getElementById("BookFlightDivBottom").style.width = "593px";
document.getElementById("bookFlightSpacer").style.height = "13px";
} else {
document.getElementById("RoundTrip").style.display = "block";
document.getElementById("ReturnDateDiv").style.display = "block";
document.getElementById("MultiCity").style.display = "none";
document.getElementById("BookFlightDiv").style.width = "485px";
document.getElementById("BookFlightDivTop").style.width = "475px";
document.getElementById("BookFlightDivBottom").style.width = "475px";
document.getElementById("bookFlightSpacer").style.height = "10px";
}
if (tripType == "ow") {
document.getElementById("ReturnDateDiv").style.display = "none";
}
currentTripType = tripType;
setAdultAndInfants("mc", document.getElementById("adults").value, "adultsMC");
}
function redirectMC(x) {
var destOptsMC = document.getElementById("destinationFltTwoMC");
var selValMC = document.getElementById("destinationFltTwoMC").value;
var salValueFlgMC = 0;
if (x != "0") {
for (m = destOptsMC.options.length - 1; m > 0; m--) {
destOptsMC.options[m] = null ;
}
for (i = 0; i < group[x].length; i++) {
destOptsMC.options[i] = new Option(group[x][i].text,group[x][i].value);
if (group[x][i].value == selValMC) {
salValueFlgMC = i;
}
}
destOptsMC.options[salValueFlgMC].selected = true;
}
}
function redirectMCD(x) {
var tempMC1D = document.getElementById("originFltTwoMC");
var selValMCD = document.getElementById("originFltTwoMC").value;
var salValueFlgMCD = 0;
if (x != "0") {
for (m = tempMC1D.options.length - 1; m > 0; m--) {
tempMC1D.options[m] = null ;
}
for (i = 0; i < groupMCD[x].length; i++) {
tempMC1D.options[i] = new Option(groupMCD[x][i].text,groupMCD[x][i].value);
if (groupMCD[x][i].value == selValMCD) {
salValueFlgMCD = i;
}
}
tempMC1D.options[salValueFlgMCD].selected = true;
}
}
function expandBookFlightWindow(flag) {
var expand = false;
if (currentTripType == "mc") {
if (($("#originFltOneMC").val() != "" && $("#destinationFltOneMC").val() != "" && $("#originFltTwoMC").val() != "" && $("#destinationFltTwoMC").val() != "") || flag) {
expand = true;
}
} else {
if (($("#originDiv select").val() != "" && $("#destinationDiv select").val() != "") || flag) {
expand = true;
}
}
if (expand) {
$("#MultiCityOption").show();
$("#RoundTripOption").show();
$("#PricePromoSearchDiv").show();
if (currentTripType == "mc") {
$("#BookExtraThingMulti").show();
}
document.getElementById("bookFlightCollapseExpandBtn").className = "collapse";
setCollapseOnClick();
}
if (document.getElementById("RoundTripOption").style.display = "block") {
if (document.getElementById("btnExpandBFW")) {
document.getElementById("btnExpandBFW").style.display = "none";
}
}
}
function submitSearchForm() {
if (document.getElementById("originFltTwoMC")) {
document.flightSearchForm.elements["flightSearch.originMC"].value = document.getElementById("originFltTwoMC").value;
document.flightSearchForm.elements["flightSearch.destinationMC"].value = document.getElementById("destinationFltTwoMC").value;
}
if (document.getElementById("adults")) {
document.flightSearchForm.elements["flightSearch.adults"].value = document.getElementById("adults").value;
}
if (document.getElementById("kids")) {
document.flightSearchForm.elements["flightSearch.kids"].value = document.getElementById("kids").value;
}
if (document.getElementById("infants")) {
document.flightSearchForm.elements["flightSearch.infants"].value = document.getElementById("infants").value;
}
document.flightSearchForm.elements["flightSearch.depDateOW.MMDDYYYY"].value = document.flightSearchForm.elements["flightSearch.depDate.MMDDYYYY"].value;
if (currentTripType == "mc") {
document.flightSearchForm.elements["flightSearch.origin"].value = document.getElementById("originFltOneMC").value;
document.flightSearchForm.elements["flightSearch.destination"].value = document.getElementById("destinationFltOneMC").value;
if (document.getElementById("adultsMC")) {
document.flightSearchForm.elements["flightSearch.adults"].value = document.getElementById("adultsMC").value;
}
if (document.getElementById("kidsMC")) {
document.flightSearchForm.elements["flightSearch.kids"].value = document.getElementById("kidsMC").value;
}
if (document.getElementById("infantsMC")) {
document.flightSearchForm.elements["flightSearch.infants"].value = document.getElementById("infantsMC").value;
}
}
var modifySearch = false;
if (!document.flightSearchForm.elements["divName"] || document.flightSearchForm.elements["divName"].value != "BookFlight") {
modifySearch = true;
}
var dt = (new Date().getMonth() + 1) + "/" + new Date().getDate() + "/" + (new Date().getYear() + 1900);
var dt1 = (new Date().getMonth() + 1) + "/" + new Date().getDate() + "/" + (new Date().getYear());
var depDateStr = document.flightSearchForm.elements["flightSearch.depDate.MMDDYYYY"].value;
var retDateStr = document.flightSearchForm.elements["flightSearch.returnDate.MMDDYYYY"].value;
if (currentTripType == "ow") {
retDateStr = "";
if (document.flightSearchForm.elements["flightSearch.returnDate.MMDDYYYY"]) {
document.flightSearchForm.elements["flightSearch.returnDate.MMDDYYYY"].value = "";
}
}
var depDate = new Date(depDateStr);
var retDate = new Date(retDateStr);
FrmToSubmit = document.flightSearchForm;
var expiredays = 30;
var exdate = new Date();
exdate.setDate(exdate.getDate() + expiredays);
if (modifySearch) {
if (getCookie("TT") == null || getCookie("TT") == "") {
setCookie("TT", currentTripType, exdate);
}
} else {
setCookie("TT", currentTripType, exdate);
}
setCookiesHome();
$("#formatMessage").css({
top: ($("#SearchFlight").offset().top - 245) + "px",
left: (($("#BookFlightDiv").width() - $("#formatMessage").width()) / 2) + "px"
});
if (isValidDate(depDateStr) && isValidDate(retDateStr)) {
if ((((depDateStr + "") == (dt + "") && (retDateStr + "") == (dt + "")) || ((depDateStr + "") == (dt1 + "") && (retDateStr + "") == (dt1 + ""))) && (depDateStr + "") != "mm/dd/yyyy" && (depDateStr + "") != "") {
flgMsg = false;
if (modifySearch) {
$("#SameDayFlightsMessageId").css({
top: ($("#btnModifySearch").offset().top) + "px",
left: ($("#btnModifySearch").offset().left - 60) + "px"
});
} else {
$("#SameDayFlightsMessageId").css({
top: ($("#SearchFlight").offset().top - 245) + "px",
left: (($("#BookFlightDiv").width() - $("#SameDayFlightsMessageId").width()) / 2) + "px"
});
}
document.getElementById("SameDayFlightsMessageId").style.display = "block";
document.getElementById("sameDayContinueId").focus();
} else {
if (((depDateStr + "") == (retDateStr + "")) && (retDateStr + "") != (dt + "") && (depDateStr + "") != "mm/dd/yyyy" && (depDateStr + "") != "") {
flgMsg = true;
if (modifySearch) {
$("#SameDayFlightsMessageId").css({
top: ($("#btnModifySearch").offset().top) + "px",
left: ($("#btnModifySearch").offset().left - 60) + "px"
});
} else {
$("#SameDayFlightsMessageId").css({
top: ($("#SearchFlight").offset().top - 245) + "px",
left: (($("#BookFlightDiv").width() - $("#SameDayFlightsMessageId").width()) / 2) + "px"
});
}
document.getElementById("SameDayFlightsMessageId").style.display = "block";
document.getElementById("sameDayContinueId").focus();
} else {
if ((((depDateStr + "") == (dt + "") && (retDateStr + "") != (dt + "")) || ((depDateStr + "") == (dt1 + "") && (retDateStr + "") != (dt1 + ""))) && (depDateStr + "") != "mm/dd/yyyy" && (depDateStr + "") != "") {
flgMsg = false;
if (modifySearch) {
$("#message").css({
top: ($("#btnModifySearch").offset().top) + "px",
left: ($("#btnModifySearch").offset().left - 60) + "px"
});
} else {
$("#message").css({
top: ($("#SearchFlight").offset().top - 245) + "px",
left: (($("#BookFlightDiv").width() - $("#message").width()) / 2) + "px"
});
}
document.getElementById("message").style.display = "block";
document.getElementById("timePopUp").focus();
} else {
if ((((depDateStr + "") != (dt + "") && (retDateStr + "") == (dt + "")) || ((depDateStr + "") != (dt1 + "") && (retDateStr + "") == (dt1 + ""))) && (depDateStr + "") != "mm/dd/yyyy" && (depDateStr + "") != "") {
flgMsg = false;
if (modifySearch) {
$("#message").css({
top: ($("#btnModifySearch").offset().top) + "px",
left: ($("#btnModifySearch").offset().left - 60) + "px"
});
} else {
$("#message").css({
top: ($("#SearchFlight").offset().top - 245) + "px",
left: (($("#BookFlightDiv").width() - $("#message").width()) / 2) + "px"
});
}
document.getElementById("message").style.display = "block";
document.getElementById("timePopUp").focus();
} else {
document.flightSearchForm.submit();
if (isPCIE == false) {
setLoadingAniDivLocation();
}
showWaitImage();
}
}
}
}
}
}
function sameDayMessageClose(closeType) {
if (closeType == "true") {
if (flgMsg) {
FrmToSubmit.submit();
showWaitImage();
} else {
document.getElementById("SameDayFlightsMessageId").style.display = "none";
if (document.flightSearchForm) {
if (document.flightSearchForm.elements["divName"] && document.flightSearchForm.elements["divName"].value == "BookFlight") {
$("#message").css({
top: ($("#SearchFlight").offset().top - 245) + "px",
left: (($("#BookFlightDiv").width() - $("#message").width()) / 2) + "px"
});
} else {
$("#message").css({
top: ($("#btnModifySearch").offset().top) + "px",
left: ($("#btnModifySearch").offset().left - 60) + "px"
});
}
} else {
if (document.getElementById("btnSearchFlights")) {
$("#message").css({
top: ($("#btnSearchFlights").offset().top) + "px",
left: ($("#btnSearchFlights").offset().left - 60) + "px"
});
}
}
document.getElementById("message").style.top = "200px";
document.getElementById("message").style.left = "46%";
document.getElementById("message").style.display = "block";
document.getElementById("timePopUp").focus();
}
document.getElementById("SameDayFlightsMessageId").style.display = "none";
} else {
document.getElementById("message").style.display = "none";
document.getElementById("SameDayFlightsMessageId").style.display = "none";
}
}
function getElementsByClassName(classname, node) {
if (!node) {
node = document.getElementsByTagName("body")[0];
}
var a = [];
var re = new RegExp("\\b" + classname + "\\b");
var els = node.getElementsByTagName("*");
for (var i = 0, j = els.length; i < j; i++) {
if (re.test(els[i].className)) {
a.push(els[i]);
}
}
return a;
}
function openConfirmationCodePopUpHome() {
document.getElementById("locateConfirmationDivId").style.top = ($("#locate").offset().top + 15) + "px";
document.getElementById("locateConfirmationDivId").style.left = ($("#locate").offset().left - 150) + "px";
document.getElementById("locateConfirmationDivId").style.display = "block";
}
function css_browser_selector(u) {
var ua = u.toLowerCase()
, is = function(t) {
return ua.indexOf(t) > -1;
}
, g = "gecko"
, w = "webkit"
, s = "safari"
, h = document.getElementsByTagName("html")[0]
, b = [(!(/opera|webtv/i.test(ua)) && /msie\s(\d)/.test(ua)) ? ("ie ie" + RegExp.$1) : is("firefox/2") ? g + " ff2" : is("firefox/3") ? g + " ff3" : is("gecko/") ? g : /opera(\s|\/)(\d+)/.test(ua) ? "opera opera" + RegExp.$2 : is("konqueror") ? "konqueror" : is("chrome") ? w + " " + s + " chrome" : is("applewebkit/") ? w + " " + s + (/version\/(\d+)/.test(ua) ? " " + s + RegExp.$1 : "") : is("mozilla/") ? g : "", is("j2me") ? "mobile" : is("iphone") ? "iphone" : is("ipod") ? "ipod" : is("mac") ? "mac" : is("darwin") ? "mac" : is("webtv") ? "webtv" : is("win") ? "win" : is("freebsd") ? "freebsd" : (is("x11") || is("linux")) ? "linux" : "", "js"];
c = b.join(" ");
h.className += " " + c;
return c;
}
css_browser_selector(navigator.userAgent);
var imageGallery = function() {
var c = 0;
var page = 1;
var idArr = new Array(["A", 65],["B", 205],["C", 355]);
var pageFlag = "true";
var x = 0;
var cval = 0.9;
var ival = 100;
var arg = null ;
var thisObj = null ;
var tempPath = null ;
var vaXML = {
loadXML: function(xmlFile) {
xmlhttp.open("GET", xmlFile, false);
xmlhttp.send("");
xmlDoc = xmlhttp.responseXML;
},
createObjs: function() {
xmlObj = xmlDoc.documentElement;
container.createContainer("ulId");
}
};
var container = {
createContainer: function(ulId) {
var imgPath = null ;
var imgName = null ;
var ulObj = document.createElement("ul");
var imgContainer = null ;
ulObj.setAttribute("id", ulId);
totalImages = xmlObj.getElementsByTagName("image").length;
for (i = 0; i < totalImages; i++) {
if (totalImages % 3 != 0) {
totalImages = totalImages + 1;
}
if (totalImages % 3 == 0) {
totalPages = totalImages / 3;
break;
}
}
pageArr = new Array(totalPages);
for (k = 0; k < 2; k++) {
for (i = 0; i < totalPages; i++) {
if (!pageArr[i]) {
pageArr[i] = new Array(2);
}
if (k == 0) {
pageArr[i][k] = i + 1;
}
if (k == 1) {
if (i == 0) {
pageArr[i][k] = i;
} else {
pageArr[i][k] = 3 * i;
}
}
}
}
for (n = 0; n < totalImages; n++) {
var liObj = document.createElement("li");
var smallImgEl = null ;
slidespeed = xmlObj.getElementsByTagName("slidespeed")[0].firstChild.nodeValue;
var pathInfo = xmlObj.getElementsByTagName("pathinfo")[0];
var imageEl = xmlObj.getElementsByTagName("image")[n];
if (imageEl) {
smallImgEl = imageEl.firstChild;
imgName = smallImgEl.firstChild.nodeValue;
} else {
imgName = "whiteSeat_view.png";
}
imgPath = pathInfo.getAttribute("smallimgpath");
larImgPath = pathInfo.getAttribute("largeimgpath");
hiResImgPath = pathInfo.getAttribute("hiresimgpath");
var imgObj = image.createImageObj(imgPath, imgName, n);
if (imageEl) {
imgContainer = image.createImgContainer(imgObj, imgPath, hiResImgPath, imgName, smallImgEl.getAttribute("size"), imageEl.childNodes[1].getAttribute("size"));
} else {
imgContainer = image.createImgContainer(imgObj, imgPath, larImgPath, imgName, "undefined");
}
if (imageEl) {
liObj.appendChild(imgContainer);
}
if (n < 3) {
liObj.setAttribute("class", "inlineCss");
liObj.setAttribute("className", "inlineCss");
} else {
liObj.setAttribute("class", "noneCss");
liObj.setAttribute("className", "noneCss");
}
ulObj.appendChild(liObj);
}
$get_JsElement("imgGallery").appendChild(ulObj);
ulobj = $get_JsElement("ulId");
$get_JsElement("displayPage").innerHTML = "Displaying: " + page + " of " + totalPages;
}
};
var image = {
index: function() {
if (thisObj.id == idArr[0][0]) {
return ( page * 3 - 3) ;
}
if (thisObj.id == idArr[1][0]) {
return ( page * 3 - 2) ;
}
if (thisObj.id == idArr[2][0]) {
return ( page * 3 - 1) ;
}
},
writeMsg: function() {
msg = xmlObj.getElementsByTagName("image")[image.index()].lastChild.firstChild.nodeValue;
$get_JsElement("seatMsg").innerHTML = msg;
},
createImageObj: function(imgPath, imgName, nval) {
var img = document.createElement("img");
img.setAttribute("src", imgPath + imgName);
if (nval == 0) {
img.setAttribute("class", "selected");
img.setAttribute("className", "selected");
} else {
img.setAttribute("class", "unselected");
img.setAttribute("className", "unselected");
}
if (nval < 3) {
img.setAttribute("id", idArr[nval][0]);
}
return img;
},
createImgContainer: function(imgObj, smallImgPath, hiResImgPath, imgName, imgSize, imgSizeBig) {
var s = "";
var divmain = document.createElement("div");
divmain.setAttribute("class", "imgGalleryThumbnail");
divmain.setAttribute("className", "imgGalleryThumbnail");
var divinner = document.createElement("div");
divinner.setAttribute("class", "podBodyBg");
divinner.setAttribute("className", "podBodyBg");
var h4El = document.createElement("h4");
var h4Text = document.createTextNode("Download");
h4El.appendChild(h4Text);
var pEl = document.createElement("p");
var aEl = document.createElement("a");
s = smallImgPath + imgName;
aEl.setAttribute("href", s);
aEl.setAttribute("target", "_blank");
var aText = document.createTextNode("Small");
aEl.appendChild(aText);
pEl.appendChild(aEl);
var spanEl = document.createElement("span");
var spanText = document.createTextNode(imgSize);
pEl.appendChild(spanEl);
if (imgObj.addEventListener) {
imgObj.addEventListener("click", imageGallery.fadeInEffect, false);
} else {
imgObj.onclick = new Function("imageGallery.fadeInEffect(event);");
}
divinner.appendChild(imgObj);
divinner.appendChild(h4El);
divinner.appendChild(pEl);
pEl = document.createElement("p");
aEl = document.createElement("a");
s = hiResImgPath + imgName;
aEl.setAttribute("href", s);
aEl.setAttribute("target", "_blank");
aText = document.createTextNode("Large");
aEl.appendChild(aText);
pEl.appendChild(aEl);
spanEl = document.createElement("span");
spanText = document.createTextNode(imgSizeBig);
pEl.appendChild(spanEl);
divinner.appendChild(pEl);
divmain.appendChild(divinner);
return divmain;
}
};
var move = {
Left: function() {
if (page != totalPages) {
if (pageFlag == "true" && page == pageArr[page - 1][0]) {
c = pageArr[page - 1][1];
pageFlag = "false";
x = 0;
imageGallery.setBorderWhite();
}
c = c + 1;
liobj = ulobj.getElementsByTagName("li")[c - 1];
liobj.firstChild.firstChild.firstChild.id = "";
liobj.style.display = "none";
liobj = ulobj.getElementsByTagName("li")[c + 2];
if (liobj.firstChild) {
liobj.firstChild.firstChild.firstChild.id = idArr[x][0];
}
liobj.style.display = "inline";
x = x + 1;
t = setTimeout("imageGallery.moveLeft()", slidespeed);
if (c % 3 == 0) {
page = page + 1;
pageFlag = "true";
move.Stop();
$get_JsElement("A").className = "selected";
imageGallery.moveArrow($get_JsElement("A"));
imageGallery.fadeInEffect($get_JsElement("A"));
}
$get_JsElement("displayPage").innerHTML = "Displaying: " + page + " of " + totalPages;
}
},
Right: function() {
if (page != 1) {
if (pageFlag == "true" && page == pageArr[page - 1][0]) {
c = pageArr[page - 1][1];
pageFlag = "false";
x = 2;
imageGallery.setBorderWhite();
}
liobj = ulobj.getElementsByTagName("li")[c + 2];
if (liobj.firstChild) {
liobj.firstChild.firstChild.firstChild.id = "";
}
liobj.style.display = "none";
liobj = ulobj.getElementsByTagName("li")[c - 1];
liobj.firstChild.firstChild.firstChild.id = idArr[x][0];
liobj.style.display = "inline";
c = c - 1;
x = x - 1;
t = setTimeout("imageGallery.moveRight()", slidespeed);
if (c == 0 || c % 3 == 0) {
page = page - 1;
pageFlag = "true";
x = 0;
move.Stop();
document.getElementById("A").className = "selected";
imageGallery.moveArrow($get_JsElement("A"));
imageGallery.fadeInEffect($get_JsElement("A"));
}
$get_JsElement("displayPage").innerHTML = "Displaying: " + page + " of " + totalPages;
}
},
Stop: function() {
clearTimeout(t);
}
};
var fade = {
InEffect: function() {
if (cval == 0.9 || ival == 100) {
if (arg.srcElement) {
thisObj = arg.srcElement;
} else {
thisObj = arg.target;
}
if (thisObj == null ) {
thisObj = arg;
}
$get_JsElement("imgMsg").style.display = "none";
tempPath = larImgPath + (thisObj.src).substring((thisObj.src).lastIndexOf("/") + 1, (thisObj.src).length);
imageGallery.moveArrow(thisObj);
}
largeImgObj.style.opacity = cval;
largeImgObj.style.filter = "alpha(opacity=" + ival + ")";
cval = cval - 0.08;
ival = ival - 8;
r = setTimeout("imageGallery.fadeInEffect()", 25);
if (cval < 0.1 || ival < 10) {
largeImgObj.style.opacity = 0.03;
largeImgObj.style.filter = "alpha(opacity=.3)";
cval = 0;
ival = 0;
fade.Stop();
$get_JsElement("loadingImage").style.display = "block";
setTimeout("imageGallery.insertImg()", 0);
}
},
OutEffect: function() {
$get_JsElement("loadingImage").style.display = "none";
largeImgObj.style.opacity = cval;
largeImgObj.style.filter = "alpha(opacity=" + ival + ")";
cval = cval + 0.05;
ival = ival + 5;
r = setTimeout("imageGallery.fadeOutEffect()", 15);
if (cval > 0.8 || ival > 80) {
largeImgObj.style.opacity = 1;
largeImgObj.style.filter = "alpha(opacity=100)";
cval = 0.9;
ival = 100;
fade.Stop();
image.writeMsg();
$get_JsElement("imgMsg").style.display = "block";
}
},
Stop: function() {
clearTimeout(r);
}
};
var vaIMG = {
loadIMG: function(imgPath) {
try {
var url = "dummy.jsp?imgPath=" + imgPath;
xmlhttp.open("GET", url, false);
xmlhttp.send(null );
xmlhttp.onreadystatechange = vaIMG.insertImg(imgPath);
} catch (e) {}
},
insertImg: function(imgPath) {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
$get_JsElement("imgParentNode").innerHTML = xmlhttp.responseText.trim();
largeImgObj.src = $get_JsElement("largeImgIdTemp").src;
imageGallery.fadeOutEffect();
}
}
}
};
return {
init: function(xmlFile) {
vaXML.loadXML(xmlFile);
vaXML.createObjs();
largeImgObj = $get_JsElement("largeImgId");
},
setBorderWhite: function() {
if ($get_JsElement("A")) {
$get_JsElement("A").className = "unselected";
}
if ($get_JsElement("B")) {
$get_JsElement("B").className = "unselected";
}
if ($get_JsElement("C")) {
$get_JsElement("C").className = "unselected";
}
},
fadeInEffect: function() {
if (arg == null || arg != arguments[0]) {
arg = arguments[0];
}
fade.InEffect();
},
fadeOutEffect: function() {
fade.OutEffect();
},
moveArrow: function(imgObj) {
var imgArrObj = $get_JsElement("imgArr");
imageGallery.setBorderWhite();
if (imgObj.id == "A") {
imgArrObj.style.marginLeft = idArr[0][1] + "px";
}
if (imgObj.id == "B") {
imgArrObj.style.marginLeft = idArr[1][1] + "px";
}
if (imgObj.id == "C") {
imgArrObj.style.marginLeft = idArr[2][1] + "px";
}
imgObj.className = "selected";
},
moveLeft: function() {
move.Left();
},
moveRight: function() {
move.Right();
},
insertImg: function() {
vaIMG.loadIMG(tempPath);
}
};
}();
function changeAirportInfoPage(airport) {
showWaitImage();
if (airport == "SFO") {
window.location.href = "san-francisco-sfo.html";
} else {
if (airport == "BOS") {
window.location.href = "logan-bos.html";
} else {
if (airport == "CUN") {
window.location.href = "cancun-mexico-cun.html";
} else {
if (airport == "ORD") {
window.location.href = "chicago-ord.html";
} else {
if (airport == "DFW") {
window.location.href = "dallas-fort-worth-dfw.html";
} else {
if (airport == "FLL") {
window.location.href = "fort-lauderdale-fll.html";
} else {
if (airport == "LAS") {
window.location.href = "las-vegas.html";
} else {
if (airport == "LAX") {
window.location.href = "los-angeles-lax.html";
} else {
if (airport == "SJD") {
window.location.href = "los-cabos-sjd.html";
} else {
if (airport == "JFK") {
window.location.href = "new-york-jfk.html";
} else {
if (airport == "MCO") {
window.location.href = "orlando-mco.html";
} else {
if (airport == "PVR") {
window.location.href = "puerto-vallarta-pvr.html";
} else {
if (airport == "SAN") {
window.location.href = "san-diego-san.html";
} else {
if (airport == "SEA") {
window.location.href = "seattle-sea.html";
} else {
if (airport == "IAD") {
window.location.href = "dulles-iad.html";
} else {
window.location.href = "airportinformation.html";
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
var setLinkSelected = function(pageName) {
if ($get_JsElement(pageName)) {
$get_JsElement(pageName).className = "selected";
}
if ($get_JsElement(pageName + "Footer")) {
$get_JsElement(pageName + "Footer").className = "selected";
}
}
;
(function() {
var _jQuery = window.jQuery
, _$ = window.$;
var jQuery = window.jQuery = window.$ = function(selector, context) {
return new jQuery.fn.init(selector,context);
}
;
var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/, isSimple = /^.[^:#\[\.]*$/, undefined;
jQuery.fn = jQuery.prototype = {
init: function(selector, context) {
selector = selector || document;
if (selector.nodeType) {
this[0] = selector;
this.length = 1;
return this;
}
if (typeof selector == "string") {
var match = quickExpr.exec(selector);
if (match && (match[1] || !context)) {
if (match[1]) {
selector = jQuery.clean([match[1]], context);
} else {
var elem = document.getElementById(match[3]);
if (elem) {
if (elem.id != match[3]) {
return jQuery().find(selector);
}
return jQuery(elem);
}
selector = [];
}
} else {
return jQuery(context).find(selector);
}
} else {
if (jQuery.isFunction(selector)) {
return jQuery(document)[jQuery.fn.ready ? "ready" : "load"](selector);
}
}
return this.setArray(jQuery.makeArray(selector));
},
jquery: "1.2.6",
size: function() {
return this.length;
},
length: 0,
get: function(num) {
return num == undefined ? jQuery.makeArray(this) : this[num];
},
pushStack: function(elems) {
var ret = jQuery(elems);
ret.prevObject = this;
return ret;
},
setArray: function(elems) {
this.length = 0;
Array.prototype.push.apply(this, elems);
return this;
},
each: function(callback, args) {
return jQuery.each(this, callback, args);
},
index: function(elem) {
var ret = -1;
return jQuery.inArray(elem && elem.jquery ? elem[0] : elem, this);
},
attr: function(name, value, type) {
var options = name;
if (name.constructor == String) {
if (value === undefined) {
return this[0] && jQuery[type || "attr"](this[0], name);
} else {
options = {};
options[name] = value;
}
}
return this.each(function(i) {
for (name in options) {
jQuery.attr(type ? this.style : this, name, jQuery.prop(this, options[name], type, i, name));
}
});
},
css: function(key, value) {
if ((key == "width" || key == "height") && parseFloat(value) < 0) {
value = undefined;
}
return this.attr(key, value, "curCSS");
},
text: function(text) {
if (typeof text != "object" && text != null ) {
return this.empty().append((this[0] && this[0].ownerDocument || document).createTextNode(text));
}
var ret = "";
jQuery.each(text || this, function() {
jQuery.each(this.childNodes, function() {
if (this.nodeType != 8) {
ret += this.nodeType != 1 ? this.nodeValue : jQuery.fn.text([this]);
}
});
});
return ret;
},
wrapAll: function(html) {
if (this[0]) {
jQuery(html, this[0].ownerDocument).clone().insertBefore(this[0]).map(function() {
var elem = this;
while (elem.firstChild) {
elem = elem.firstChild;
}
return elem;
}).append(this);
}
return this;
},
wrapInner: function(html) {
return this.each(function() {
jQuery(this).contents().wrapAll(html);
});
},
wrap: function(html) {
return this.each(function() {
jQuery(this).wrapAll(html);
});
},
append: function() {
return this.domManip(arguments, true, false, function(elem) {
if (this.nodeType == 1) {
this.appendChild(elem);
}
});
},
prepend: function() {
return this.domManip(arguments, true, true, function(elem) {
if (this.nodeType == 1) {
this.insertBefore(elem, this.firstChild);
}
});
},
before: function() {
return this.domManip(arguments, false, false, function(elem) {
this.parentNode.insertBefore(elem, this);
});
},
after: function() {
return this.domManip(arguments, false, true, function(elem) {
this.parentNode.insertBefore(elem, this.nextSibling);
});
},
end: function() {
return this.prevObject || jQuery([]);
},
find: function(selector) {
var elems = jQuery.map(this, function(elem) {
return jQuery.find(selector, elem);
});
return this.pushStack(/[^+>] [^+>]/.test(selector) || selector.indexOf("..") > -1 ? jQuery.unique(elems) : elems);
},
clone: function(events) {
var ret = this.map(function() {
if (jQuery.browser.msie && !jQuery.isXMLDoc(this)) {
var clone = this.cloneNode(true)
, container = document.createElement("div");
container.appendChild(clone);
return jQuery.clean([container.innerHTML])[0];
} else {
return this.cloneNode(true);
}
});
var clone = ret.find("*").andSelf().each(function() {
if (this[expando] != undefined) {
this[expando] = null ;
}
});
if (events === true) {
this.find("*").andSelf().each(function(i) {
if (this.nodeType == 3) {
return;
}
var events = jQuery.data(this, "events");
for (var type in events) {
for (var handler in events[type]) {
jQuery.event.add(clone[i], type, events[type][handler], events[type][handler].data);
}
}
});
}
return ret;
},
filter: function(selector) {
return this.pushStack(jQuery.isFunction(selector) && jQuery.grep(this, function(elem, i) {
return selector.call(elem, i);
}) || jQuery.multiFilter(selector, this));
},
not: function(selector) {
if (selector.constructor == String) {
if (isSimple.test(selector)) {
return this.pushStack(jQuery.multiFilter(selector, this, true));
} else {
selector = jQuery.multiFilter(selector, this);
}
}
var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
return this.filter(function() {
return isArrayLike ? jQuery.inArray(this, selector) < 0 : this != selector;
});
},
add: function(selector) {
return this.pushStack(jQuery.unique(jQuery.merge(this.get(), typeof selector == "string" ? jQuery(selector) : jQuery.makeArray(selector))));
},
is: function(selector) {
return !!selector && jQuery.multiFilter(selector, this).length > 0;
},
hasClass: function(selector) {
return this.is("." + selector);
},
val: function(value) {
if (value == undefined) {
if (this.length) {
var elem = this[0];
if (jQuery.nodeName(elem, "select")) {
var index = elem.selectedIndex
, values = []
, options = elem.options
, one = elem.type == "select-one";
if (index < 0) {
return null ;
}
for (var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++) {
var option = options[i];
if (option.selected) {
value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value;
if (one) {
return value;
}
values.push(value);
}
}
return values;
} else {
return (this[0].value || "").replace(/\r/g, "");
}
}
return undefined;
}
if (value.constructor == Number) {
value += "";
}
return this.each(function() {
if (this.nodeType != 1) {
return;
}
if (value.constructor == Array && /radio|checkbox/.test(this.type)) {
this.checked = (jQuery.inArray(this.value, value) >= 0 || jQuery.inArray(this.name, value) >= 0);
} else {
if (jQuery.nodeName(this, "select")) {
var values = jQuery.makeArray(value);
jQuery("option", this).each(function() {
this.selected = (jQuery.inArray(this.value, values) >= 0 || jQuery.inArray(this.text, values) >= 0);
});
if (!values.length) {
this.selectedIndex = -1;
}
} else {
this.value = value;
}
}
});
},
html: function(value) {
return value == undefined ? (this[0] ? this[0].innerHTML : null ) : this.empty().append(value);
},
replaceWith: function(value) {
return this.after(value).remove();
},
eq: function(i) {
return this.slice(i, i + 1);
},
slice: function() {
return this.pushStack(Array.prototype.slice.apply(this, arguments));
},
map: function(callback) {
return this.pushStack(jQuery.map(this, function(elem, i) {
return callback.call(elem, i, elem);
}));
},
andSelf: function() {
return this.add(this.prevObject);
},
data: function(key, value) {
var parts = key.split(".");
parts[1] = parts[1] ? "." + parts[1] : "";
if (value === undefined) {
var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
if (data === undefined && this.length) {
data = jQuery.data(this[0], key);
}
return data === undefined && parts[1] ? this.data(parts[0]) : data;
} else {
return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function() {
jQuery.data(this, key, value);
});
}
},
removeData: function(key) {
return this.each(function() {
jQuery.removeData(this, key);
});
},
domManip: function(args, table, reverse, callback) {
var clone = this.length > 1, elems;
return this.each(function() {
if (!elems) {
elems = jQuery.clean(args, this.ownerDocument);
if (reverse) {
elems.reverse();
}
}
var obj = this;
if (table && jQuery.nodeName(this, "table") && jQuery.nodeName(elems[0], "tr")) {
obj = this.getElementsByTagName("tbody")[0] || this.appendChild(this.ownerDocument.createElement("tbody"));
}
var scripts = jQuery([]);
jQuery.each(elems, function() {
var elem = clone ? jQuery(this).clone(true)[0] : this;
if (jQuery.nodeName(elem, "script")) {
scripts = scripts.add(elem);
} else {
if (elem.nodeType == 1) {
scripts = scripts.add(jQuery("script", elem).remove());
}
callback.call(obj, elem);
}
});
scripts.each(evalScript);
});
}
};
jQuery.fn.init.prototype = jQuery.fn;
function evalScript(i, elem) {
if (elem.src) {
jQuery.ajax({
url: elem.src,
async: false,
dataType: "script"
});
} else {
jQuery.globalEval(elem.text || elem.textContent || elem.innerHTML || "");
}
if (elem.parentNode) {
elem.parentNode.removeChild(elem);
}
}
function now() {
return +new Date;
}
jQuery.extend = jQuery.fn.extend = function() {
var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
if (target.constructor == Boolean) {
deep = target;
target = arguments[1] || {};
i = 2;
}
if (typeof target != "object" && typeof target != "function") {
target = {};
}
if (length == i) {
target = this;
--i;
}
for (; i < length; i++) {
if ((options = arguments[i]) != null ) {
for (var name in options) {
var src = target[name]
, copy = options[name];
if (target === copy) {
continue;
}
if (deep && copy && typeof copy == "object" && !copy.nodeType) {
target[name] = jQuery.extend(deep, src || (copy.length != null ? [] : {}), copy);
} else {
if (copy !== undefined) {
target[name] = copy;
}
}
}
}
}
return target;
}
;
var expando = "jQuery" + now()
, uuid = 0
, windowData = {}
, exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i
, defaultView = document.defaultView || {};
jQuery.extend({
noConflict: function(deep) {
window.$ = _$;
if (deep) {
window.jQuery = _jQuery;
}
return jQuery;
},
isFunction: function(fn) {
return !!fn && typeof fn != "string" && !fn.nodeName && fn.constructor != Array && /^[\s[]?function/.test(fn + "");
},
isXMLDoc: function(elem) {
return elem.documentElement && !elem.body || elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
},
globalEval: function(data) {
data = jQuery.trim(data);
if (data) {
var head = document.getElementsByTagName("head")[0] || document.documentElement
, script = document.createElement("script");
script.type = "text/javascript";
if (jQuery.browser.msie) {
script.text = data;
} else {
script.appendChild(document.createTextNode(data));
}
head.insertBefore(script, head.firstChild);
head.removeChild(script);
}
},
nodeName: function(elem, name) {
return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
},
cache: {},
data: function(elem, name, data) {
elem = elem == window ? windowData : elem;
var id = elem[expando];
if (!id) {
id = elem[expando] = ++uuid;
}
if (name && !jQuery.cache[id]) {
jQuery.cache[id] = {};
}
if (data !== undefined) {
jQuery.cache[id][name] = data;
}
return name ? jQuery.cache[id][name] : id;
},
removeData: function(elem, name) {
elem = elem == window ? windowData : elem;
var id = elem[expando];
if (name) {
if (jQuery.cache[id]) {
delete jQuery.cache[id][name];
name = "";
for (name in jQuery.cache[id]) {
break;
}
if (!name) {
jQuery.removeData(elem);
}
}
} else {
try {
delete elem[expando];
} catch (e) {
if (elem.removeAttribute) {
elem.removeAttribute(expando);
}
}
delete jQuery.cache[id];
}
},
each: function(object, callback, args) {
var name, i = 0, length = object.length;
if (args) {
if (length == undefined) {
for (name in object) {
if (callback.apply(object[name], args) === false) {
break;
}
}
} else {
for (; i < length; ) {
if (callback.apply(object[i++], args) === false) {
break;
}
}
}
} else {
if (length == undefined) {
for (name in object) {
if (callback.call(object[name], name, object[name]) === false) {
break;
}
}
} else {
for (var value = object[0]; i < length && callback.call(value, i, value) !== false; value = object[++i]) {}
}
}
return object;
},
prop: function(elem, value, type, i, name) {
if (jQuery.isFunction(value)) {
value = value.call(elem, i);
}
return value && value.constructor == Number && type == "curCSS" && !exclude.test(name) ? value + "px" : value;
},
className: {
add: function(elem, classNames) {
jQuery.each((classNames || "").split(/\s+/), function(i, className) {
if (elem.nodeType == 1 && !jQuery.className.has(elem.className, className)) {
elem.className += (elem.className ? " " : "") + className;
}
});
},
remove: function(elem, classNames) {
if (elem.nodeType == 1) {
elem.className = classNames != undefined ? jQuery.grep(elem.className.split(/\s+/), function(className) {
return !jQuery.className.has(classNames, className);
}).join(" ") : "";
}
},
has: function(elem, className) {
return jQuery.inArray(className, (elem.className || elem).toString().split(/\s+/)) > -1;
}
},
swap: function(elem, options, callback) {
var old = {};
for (var name in options) {
old[name] = elem.style[name];
elem.style[name] = options[name];
}
callback.call(elem);
for (var name in options) {
elem.style[name] = old[name];
}
},
css: function(elem, name, force) {
if (name == "width" || name == "height") {
var val, props = {
position: "absolute",
visibility: "hidden",
display: "block"
}, which = name == "width" ? ["Left", "Right"] : ["Top", "Bottom"];
function getWH() {
val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
var padding = 0
, border = 0;
jQuery.each(which, function() {
padding += parseFloat(jQuery.curCSS(elem, "padding" + this, true)) || 0;
border += parseFloat(jQuery.curCSS(elem, "border" + this + "Width", true)) || 0;
});
val -= Math.round(padding + border);
}
if (jQuery(elem).is(":visible")) {
getWH();
} else {
jQuery.swap(elem, props, getWH);
}
return Math.max(0, val);
}
return jQuery.curCSS(elem, name, force);
},
curCSS: function(elem, name, force) {
var ret, style = elem.style;
function color(elem) {
if (!jQuery.browser.safari) {
return false;
}
var ret = defaultView.getComputedStyle(elem, null );
return !ret || ret.getPropertyValue("color") == "";
}
if (name == "opacity" && jQuery.browser.msie) {
ret = jQuery.attr(style, "opacity");
return ret == "" ? "1" : ret;
}
if (jQuery.browser.opera && name == "display") {
var save = style.outline;
style.outline = "0 solid black";
style.outline = save;
}
if (name.match(/float/i)) {
name = styleFloat;
}
if (!force && style && style[name]) {
ret = style[name];
} else {
if (defaultView.getComputedStyle) {
if (name.match(/float/i)) {
name = "float";
}
name = name.replace(/([A-Z])/g, "-$1").toLowerCase();
var computedStyle = defaultView.getComputedStyle(elem, null );
if (computedStyle && !color(elem)) {
ret = computedStyle.getPropertyValue(name);
} else {
var swap = []
, stack = []
, a = elem
, i = 0;
for (; a && color(a); a = a.parentNode) {
stack.unshift(a);
}
for (; i < stack.length; i++) {
if (color(stack[i])) {
swap[i] = stack[i].style.display;
stack[i].style.display = "block";
}
}
ret = name == "display" && swap[stack.length - 1] != null ? "none" : (computedStyle && computedStyle.getPropertyValue(name)) || "";
for (i = 0; i < swap.length; i++) {
if (swap[i] != null ) {
stack[i].style.display = swap[i];
}
}
}
if (name == "opacity" && ret == "") {
ret = "1";
}
} else {
if (elem.currentStyle) {
var camelCase = name.replace(/\-(\w)/g, function(all, letter) {
return letter.toUpperCase();
});
ret = elem.currentStyle[name] || elem.currentStyle[camelCase];
if (!/^\d+(px)?$/i.test(ret) && /^\d/.test(ret)) {
var left = style.left
, rsLeft = elem.runtimeStyle.left;
elem.runtimeStyle.left = elem.currentStyle.left;
style.left = ret || 0;
ret = style.pixelLeft + "px";
style.left = left;
elem.runtimeStyle.left = rsLeft;
}
}
}
}
return ret;
},
clean: function(elems, context) {
var ret = [];
context = context || document;
if (typeof context.createElement == "undefined") {
context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
}
jQuery.each(elems, function(i, elem) {
if (!elem) {
return;
}
if (elem.constructor == Number) {
elem += "";
}
if (typeof elem == "string") {
elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag) {
return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ? all : front + "></" + tag + ">";
});
var tags = jQuery.trim(elem).toLowerCase()
, div = context.createElement("div");
var wrap = !tags.indexOf("<opt") && [1, "<select multiple='multiple'>", "</select>"] || !tags.indexOf("<leg") && [1, "<fieldset>", "</fieldset>"] || tags.match(/^<(thead|tbody|tfoot|colg|cap)/) && [1, "<table>", "</table>"] || !tags.indexOf("<tr") && [2, "<table><tbody>", "</tbody></table>"] || (!tags.indexOf("<td") || !tags.indexOf("<th")) && [3, "<table><tbody><tr>", "</tr></tbody></table>"] || !tags.indexOf("<col") && [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"] || jQuery.browser.msie && [1, "div<div>", "</div>"] || [0, "", ""];
div.innerHTML = wrap[1] + elem + wrap[2];
while (wrap[0]--) {
div = div.lastChild;
}
if (jQuery.browser.msie) {
var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ? div.firstChild && div.firstChild.childNodes : wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ? div.childNodes : [];
for (var j = tbody.length - 1; j >= 0; --j) {
if (jQuery.nodeName(tbody[j], "tbody") && !tbody[j].childNodes.length) {
tbody[j].parentNode.removeChild(tbody[j]);
}
}
if (/^\s/.test(elem)) {
div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]), div.firstChild);
}
}
elem = jQuery.makeArray(div.childNodes);
}
if (elem.length === 0 && (!jQuery.nodeName(elem, "form") && !jQuery.nodeName(elem, "select"))) {
return;
}
if (elem[0] == undefined || jQuery.nodeName(elem, "form") || elem.options) {
ret.push(elem);
} else {
ret = jQuery.merge(ret, elem);
}
});
return ret;
},
attr: function(elem, name, value) {
if (!elem || elem.nodeType == 3 || elem.nodeType == 8) {
return undefined;
}
var notxml = !jQuery.isXMLDoc(elem)
, set = value !== undefined
, msie = jQuery.browser.msie;
name = notxml && jQuery.props[name] || name;
if (elem.tagName) {
var special = /href|src|style/.test(name);
if (name == "selected" && jQuery.browser.safari) {
elem.parentNode.selectedIndex;
}
if (name in elem && notxml && !special) {
if (set) {
if (name == "type" && jQuery.nodeName(elem, "input") && elem.parentNode) {
throw "type property can't be changed";
}
elem[name] = value;
}
if (jQuery.nodeName(elem, "form") && elem.getAttributeNode(name)) {
return elem.getAttributeNode(name).nodeValue;
}
return elem[name];
}
if (msie && notxml && name == "style") {
return jQuery.attr(elem.style, "cssText", value);
}
if (set) {
elem.setAttribute(name, "" + value);
}
var attr = msie && notxml && special ? elem.getAttribute(name, 2) : elem.getAttribute(name);
return attr === null ? undefined : attr;
}
if (msie && name == "opacity") {
if (set) {
elem.zoom = 1;
elem.filter = (elem.filter || "").replace(/alpha\([^)]*\)/, "") + (parseInt(value) + "" == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
}
return elem.filter && elem.filter.indexOf("opacity=") >= 0 ? (parseFloat(elem.filter.match(/opacity=([^)]*)/)[1]) / 100) + "" : "";
}
name = name.replace(/-([a-z])/ig, function(all, letter) {
return letter.toUpperCase();
});
if (set) {
elem[name] = value;
}
return elem[name];
},
trim: function(text) {
return (text || "").replace(/^\s+|\s+$/g, "");
},
makeArray: function(array) {
var ret = [];
if (array != null ) {
var i = array.length;
if (i == null || array.split || array.setInterval || array.call) {
ret[0] = array;
} else {
while (i) {
ret[--i] = array[i];
}
}
}
return ret;
},
inArray: function(elem, array) {
for (var i = 0, length = array.length; i < length; i++) {
if (array[i] === elem) {
return i;
}
}
return -1;
},
merge: function(first, second) {
var i = 0, elem, pos = first.length;
if (jQuery.browser.msie) {
while (elem = second[i++]) {
if (elem.nodeType != 8) {
first[pos++] = elem;
}
}
} else {
while (elem = second[i++]) {
first[pos++] = elem;
}
}
return first;
},
unique: function(array) {
var ret = []
, done = {};
try {
for (var i = 0, length = array.length; i < length; i++) {
var id = jQuery.data(array[i]);
if (!done[id]) {
done[id] = true;
ret.push(array[i]);
}
}
} catch (e) {
ret = array;
}
return ret;
},
grep: function(elems, callback, inv) {
var ret = [];
for (var i = 0, length = elems.length; i < length; i++) {
if (!inv != !callback(elems[i], i)) {
ret.push(elems[i]);
}
}
return ret;
},
map: function(elems, callback) {
var ret = [];
for (var i = 0, length = elems.length; i < length; i++) {
var value = callback(elems[i], i);
if (value != null ) {
ret[ret.length] = value;
}
}
return ret.concat.apply([], ret);
}
});
var userAgent = navigator.userAgent.toLowerCase();
jQuery.browser = {
version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1],
safari: /webkit/.test(userAgent),
opera: /opera/.test(userAgent),
msie: /msie/.test(userAgent) && !/opera/.test(userAgent),
mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent)
};
var styleFloat = jQuery.browser.msie ? "styleFloat" : "cssFloat";
jQuery.extend({
boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",
props: {
"for": "htmlFor",
"class": "className",
"float": styleFloat,
cssFloat: styleFloat,
styleFloat: styleFloat,
readonly: "readOnly",
maxlength: "maxLength",
cellspacing: "cellSpacing"
}
});
jQuery.each({
parent: function(elem) {
return elem.parentNode;
},
parents: function(elem) {
return jQuery.dir(elem, "parentNode");
},
next: function(elem) {
return jQuery.nth(elem, 2, "nextSibling");
},
prev: function(elem) {
return jQuery.nth(elem, 2, "previousSibling");
},
nextAll: function(elem) {
return jQuery.dir(elem, "nextSibling");
},
prevAll: function(elem) {
return jQuery.dir(elem, "previousSibling");
},
siblings: function(elem) {
return jQuery.sibling(elem.parentNode.firstChild, elem);
},
children: function(elem) {
return jQuery.sibling(elem.firstChild);
},
contents: function(elem) {
return jQuery.nodeName(elem, "iframe") ? elem.contentDocument || elem.contentWindow.document : jQuery.makeArray(elem.childNodes);
}
}, function(name, fn) {
jQuery.fn[name] = function(selector) {
var ret = jQuery.map(this, fn);
if (selector && typeof selector == "string") {
ret = jQuery.multiFilter(selector, ret);
}
return this.pushStack(jQuery.unique(ret));
}
;
});
jQuery.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function(name, original) {
jQuery.fn[name] = function() {
var args = arguments;
return this.each(function() {
for (var i = 0, length = args.length; i < length; i++) {
jQuery(args[i])[original](this);
}
});
}
;
});
jQuery.each({
removeAttr: function(name) {
jQuery.attr(this, name, "");
if (this.nodeType == 1) {
this.removeAttribute(name);
}
},
addClass: function(classNames) {
jQuery.className.add(this, classNames);
},
removeClass: function(classNames) {
jQuery.className.remove(this, classNames);
},
toggleClass: function(classNames) {
jQuery.className[jQuery.className.has(this, classNames) ? "remove" : "add"](this, classNames);
},
remove: function(selector) {
if (!selector || jQuery.filter(selector, [this]).r.length) {
jQuery("*", this).add(this).each(function() {
jQuery.event.remove(this);
jQuery.removeData(this);
});
if (this.parentNode) {
this.parentNode.removeChild(this);
}
}
},
empty: function() {
jQuery(">*", this).remove();
while (this.firstChild) {
this.removeChild(this.firstChild);
}
}
}, function(name, fn) {
jQuery.fn[name] = function() {
return this.each(fn, arguments);
}
;
});
jQuery.each(["Height", "Width"], function(i, name) {
var type = name.toLowerCase();
jQuery.fn[type] = function(size) {
return this[0] == window ? jQuery.browser.opera && document.body["client" + name] || jQuery.browser.safari && window["inner" + name] || document.compatMode == "CSS1Compat" && document.documentElement["client" + name] || document.body["client" + name] : this[0] == document ? Math.max(Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]), Math.max(document.body["offset" + name], document.documentElement["offset" + name])) : size == undefined ? (this.length ? jQuery.css(this[0], type) : null ) : this.css(type, size.constructor == String ? size : size + "px");
}
;
});
function num(elem, prop) {
return elem[0] && parseInt(jQuery.curCSS(elem[0], prop, true), 10) || 0;
}
var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ? "(?:[\\w*_-]|\\\\.)" : "(?:[\\w\u0128-\uFFFF*_-]|\\\\.)"
, quickChild = new RegExp("^>\\s*(" + chars + "+)")
, quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)")
, quickClass = new RegExp("^([#.]?)(" + chars + "*)");
jQuery.extend({
expr: {
"": function(a, i, m) {
return m[2] == "*" || jQuery.nodeName(a, m[2]);
},
"#": function(a, i, m) {
return a.getAttribute("id") == m[2];
},
":": {
lt: function(a, i, m) {
return i < m[3] - 0;
},
gt: function(a, i, m) {
return i > m[3] - 0;
},
nth: function(a, i, m) {
return m[3] - 0 == i;
},
eq: function(a, i, m) {
return m[3] - 0 == i;
},
first: function(a, i) {
return i == 0;
},
last: function(a, i, m, r) {
return i == r.length - 1;
},
even: function(a, i) {
return i % 2 == 0;
},
odd: function(a, i) {
return i % 2;
},
"first-child": function(a) {
return a.parentNode.getElementsByTagName("*")[0] == a;
},
"last-child": function(a) {
return jQuery.nth(a.parentNode.lastChild, 1, "previousSibling") == a;
},
"only-child": function(a) {
return !jQuery.nth(a.parentNode.lastChild, 2, "previousSibling");
},
parent: function(a) {
return a.firstChild;
},
empty: function(a) {
return !a.firstChild;
},
contains: function(a, i, m) {
return (a.textContent || a.innerText || jQuery(a).text() || "").indexOf(m[3]) >= 0;
},
visible: function(a) {
return "hidden" != a.type && jQuery.css(a, "display") != "none" && jQuery.css(a, "visibility") != "hidden";
},
hidden: function(a) {
return "hidden" == a.type || jQuery.css(a, "display") == "none" || jQuery.css(a, "visibility") == "hidden";
},
enabled: function(a) {
return !a.disabled;
},
disabled: function(a) {
return a.disabled;
},
checked: function(a) {
return a.checked;
},
selected: function(a) {
return a.selected || jQuery.attr(a, "selected");
},
text: function(a) {
return "text" == a.type;
},
radio: function(a) {
return "radio" == a.type;
},
checkbox: function(a) {
return "checkbox" == a.type;
},
file: function(a) {
return "file" == a.type;
},
password: function(a) {
return "password" == a.type;
},
submit: function(a) {
return "submit" == a.type;
},
image: function(a) {
return "image" == a.type;
},
reset: function(a) {
return "reset" == a.type;
},
button: function(a) {
return "button" == a.type || jQuery.nodeName(a, "button");
},
input: function(a) {
return /input|select|textarea|button/i.test(a.nodeName);
},
has: function(a, i, m) {
return jQuery.find(m[3], a).length;
},
header: function(a) {
return /h\d/i.test(a.nodeName);
},
animated: function(a) {
return jQuery.grep(jQuery.timers, function(fn) {
return a == fn.elem;
}).length;
}
}
},
parse: [/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/, /^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/, new RegExp("^([:.#]*)(" + chars + "+)")],
multiFilter: function(expr, elems, not) {
var old, cur = [];
while (expr && expr != old) {
old = expr;
var f = jQuery.filter(expr, elems, not);
expr = f.t.replace(/^\s*,\s*/, "");
cur = not ? elems = f.r : jQuery.merge(cur, f.r);
}
return cur;
},
find: function(t, context) {
if (typeof t != "string") {
return [t];
}
if (context && context.nodeType != 1 && context.nodeType != 9) {
return [];
}
context = context || document;
var ret = [context], done = [], last, nodeName;
while (t && last != t) {
var r = [];
last = t;
t = jQuery.trim(t);
var foundToken = false
, re = quickChild
, m = re.exec(t);
if (m) {
nodeName = m[1].toUpperCase();
for (var i = 0; ret[i]; i++) {
for (var c = ret[i].firstChild; c; c = c.nextSibling) {
if (c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName)) {
r.push(c);
}
}
}
ret = r;
t = t.replace(re, "");
if (t.indexOf(" ") == 0) {
continue;
}
foundToken = true;
} else {
re = /^([>+~])\s*(\w*)/i;
if ((m = re.exec(t)) != null ) {
r = [];
var merge = {};
nodeName = m[2].toUpperCase();
m = m[1];
for (var j = 0, rl = ret.length; j < rl; j++) {
var n = m == "~" || m == "+" ? ret[j].nextSibling : ret[j].firstChild;
for (; n; n = n.nextSibling) {
if (n.nodeType == 1) {
var id = jQuery.data(n);
if (m == "~" && merge[id]) {
break;
}
if (!nodeName || n.nodeName.toUpperCase() == nodeName) {
if (m == "~") {
merge[id] = true;
}
r.push(n);
}
if (m == "+") {
break;
}
}
}
}
ret = r;
t = jQuery.trim(t.replace(re, ""));
foundToken = true;
}
}
if (t && !foundToken) {
if (!t.indexOf(",")) {
if (context == ret[0]) {
ret.shift();
}
done = jQuery.merge(done, ret);
r = ret = [context];
t = " " + t.substr(1, t.length);
} else {
var re2 = quickID;
var m = re2.exec(t);
if (m) {
m = [0, m[2], m[3], m[1]];
} else {
re2 = quickClass;
m = re2.exec(t);
}
m[2] = m[2].replace(/\\/g, "");
var elem = ret[ret.length - 1];
if (m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem)) {
var oid = elem.getElementById(m[2]);
if ((jQuery.browser.msie || jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2]) {
oid = jQuery('[@id="' + m[2] + '"]', elem)[0];
}
ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];
} else {
for (var i = 0; ret[i]; i++) {
var tag = m[1] == "#" && m[3] ? m[3] : m[1] != "" || m[0] == "" ? "*" : m[2];
if (tag == "*" && ret[i].nodeName.toLowerCase() == "object") {
tag = "param";
}
r = jQuery.merge(r, ret[i].getElementsByTagName(tag));
}
if (m[1] == ".") {
r = jQuery.classFilter(r, m[2]);
}
if (m[1] == "#") {
var tmp = [];
for (var i = 0; r[i]; i++) {
if (r[i].getAttribute("id") == m[2]) {
tmp = [r[i]];
break;
}
}
r = tmp;
}
ret = r;
}
t = t.replace(re2, "");
}
}
if (t) {
var val = jQuery.filter(t, r);
ret = r = val.r;
t = jQuery.trim(val.t);
}
}
if (t) {
ret = [];
}
if (ret && context == ret[0]) {
ret.shift();
}
done = jQuery.merge(done, ret);
return done;
},
classFilter: function(r, m, not) {
m = " " + m + " ";
var tmp = [];
for (var i = 0; r[i]; i++) {
var pass = (" " + r[i].className + " ").indexOf(m) >= 0;
if (!not && pass || not && !pass) {
tmp.push(r[i]);
}
}
return tmp;
},
filter: function(t, r, not) {
var last;
while (t && t != last) {
last = t;
var p = jQuery.parse, m;
for (var i = 0; p[i]; i++) {
m = p[i].exec(t);
if (m) {
t = t.substring(m[0].length);
m[2] = m[2].replace(/\\/g, "");
break;
}
}
if (!m) {
break;
}
if (m[1] == ":" && m[2] == "not") {
r = isSimple.test(m[3]) ? jQuery.filter(m[3], r, true).r : jQuery(r).not(m[3]);
} else {
if (m[1] == ".") {
r = jQuery.classFilter(r, m[2], not);
} else {
if (m[1] == "[") {
var tmp = []
, type = m[3];
for (var i = 0, rl = r.length; i < rl; i++) {
var a = r[i]
, z = a[jQuery.props[m[2]] || m[2]];
if (z == null || /href|src|selected/.test(m[2])) {
z = jQuery.attr(a, m[2]) || "";
}
if ((type == "" && !!z || type == "=" && z == m[5] || type == "!=" && z != m[5] || type == "^=" && z && !z.indexOf(m[5]) || type == "$=" && z.substr(z.length - m[5].length) == m[5] || (type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not) {
tmp.push(a);
}
}
r = tmp;
} else {
if (m[1] == ":" && m[2] == "nth-child") {
var merge = {}
, tmp = []
, test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" || !/\D/.test(m[3]) && "0n+" + m[3] || m[3])
, first = (test[1] + (test[2] || 1)) - 0
, last = test[3] - 0;
for (var i = 0, rl = r.length; i < rl; i++) {
var node = r[i]
, parentNode = node.parentNode
, id = jQuery.data(parentNode);
if (!merge[id]) {
var c = 1;
for (var n = parentNode.firstChild; n; n = n.nextSibling) {
if (n.nodeType == 1) {
n.nodeIndex = c++;
}
}
merge[id] = true;
}
var add = false;
if (first == 0) {
if (node.nodeIndex == last) {
add = true;
}
} else {
if ((node.nodeIndex - last) % first == 0 && (node.nodeIndex - last) / first >= 0) {
add = true;
}
}
if (add ^ not) {
tmp.push(node);
}
}
r = tmp;
} else {
var fn = jQuery.expr[m[1]];
if (typeof fn == "object") {
fn = fn[m[2]];
}
if (typeof fn == "string") {
fn = eval("false||function(a,i){return " + fn + ";}");
}
r = jQuery.grep(r, function(elem, i) {
return fn(elem, i, m, r);
}, not);
}
}
}
}
}
return {
r: r,
t: t
};
},
dir: function(elem, dir) {
var matched = []
, cur = elem[dir];
while (cur && cur != document) {
if (cur.nodeType == 1) {
matched.push(cur);
}
cur = cur[dir];
}
return matched;
},
nth: function(cur, result, dir, elem) {
result = result || 1;
var num = 0;
for (; cur; cur = cur[dir]) {
if (cur.nodeType == 1 && ++num == result) {
break;
}
}
return cur;
},
sibling: function(n, elem) {
var r = [];
for (; n; n = n.nextSibling) {
if (n.nodeType == 1 && n != elem) {
r.push(n);
}
}
return r;
}
});
jQuery.event = {
add: function(elem, types, handler, data) {
if (elem.nodeType == 3 || elem.nodeType == 8) {
return;
}
if (jQuery.browser.msie && elem.setInterval) {
elem = window;
}
if (!handler.guid) {
handler.guid = this.guid++;
}
if (data != undefined) {
var fn = handler;
handler = this.proxy(fn, function() {
return fn.apply(this, arguments);
});
handler.data = data;
}
var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {})
, handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function() {
if (typeof jQuery != "undefined" && !jQuery.event.triggered) {
return jQuery.event.handle.apply(arguments.callee.elem, arguments);
}
});
handle.elem = elem;
jQuery.each(types.split(/\s+/), function(index, type) {
var parts = type.split(".");
type = parts[0];
handler.type = parts[1];
var handlers = events[type];
if (!handlers) {
handlers = events[type] = {};
if (!jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false) {
if (elem.addEventListener) {
elem.addEventListener(type, handle, false);
} else {
if (elem.attachEvent) {
elem.attachEvent("on" + type, handle);
}
}
}
}
handlers[handler.guid] = handler;
jQuery.event.global[type] = true;
});
elem = null ;
},
guid: 1,
global: {},
remove: function(elem, types, handler) {
if (elem.nodeType == 3 || elem.nodeType == 8) {
return;
}
var events = jQuery.data(elem, "events"), ret, index;
if (events) {
if (types == undefined || (typeof types == "string" && types.charAt(0) == ".")) {
for (var type in events) {
this.remove(elem, type + (types || ""));
}
} else {
if (types.type) {
handler = types.handler;
types = types.type;
}
jQuery.each(types.split(/\s+/), function(index, type) {
var parts = type.split(".");
type = parts[0];
if (events[type]) {
if (handler) {
delete events[type][handler.guid];
} else {
for (handler in events[type]) {
if (!parts[1] || events[type][handler].type == parts[1]) {
delete events[type][handler];
}
}
}
for (ret in events[type]) {
break;
}
if (!ret) {
if (!jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem) === false) {
if (elem.removeEventListener) {
elem.removeEventListener(type, jQuery.data(elem, "handle"), false);
} else {
if (elem.detachEvent) {
elem.detachEvent("on" + type, jQuery.data(elem, "handle"));
}
}
}
ret = null ;
delete events[type];
}
}
});
}
for (ret in events) {
break;
}
if (!ret) {
var handle = jQuery.data(elem, "handle");
if (handle) {
handle.elem = null ;
}
jQuery.removeData(elem, "events");
jQuery.removeData(elem, "handle");
}
}
},
trigger: function(type, data, elem, donative, extra) {
data = jQuery.makeArray(data);
if (type.indexOf("!") >= 0) {
type = type.slice(0, -1);
var exclusive = true;
}
if (!elem) {
if (this.global[type]) {
jQuery("*").add([window, document]).trigger(type, data);
}
} else {
if (elem.nodeType == 3 || elem.nodeType == 8) {
return undefined;
}
var val, ret, fn = jQuery.isFunction(elem[type] || null ), event = !data[0] || !data[0].preventDefault;
if (event) {
data.unshift({
type: type,
target: elem,
preventDefault: function() {},
stopPropagation: function() {},
timeStamp: now()
});
data[0][expando] = true;
}
data[0].type = type;
if (exclusive) {
data[0].exclusive = true;
}
var handle = jQuery.data(elem, "handle");
if (handle) {
val = handle.apply(elem, data);
}
if ((!fn || (jQuery.nodeName(elem, "a") && type == "click")) && elem["on" + type] && elem["on" + type].apply(elem, data) === false) {
val = false;
}
if (event) {
data.shift();
}
if (extra && jQuery.isFunction(extra)) {
ret = extra.apply(elem, val == null ? data : data.concat(val));
if (ret !== undefined) {
val = ret;
}
}
if (fn && donative !== false && val !== false && !(jQuery.nodeName(elem, "a") && type == "click")) {
this.triggered = true;
try {
elem[type]();
} catch (e) {}
}
this.triggered = false;
}
return val;
},
handle: function(event) {
var val, ret, namespace, all, handlers;
event = arguments[0] = jQuery.event.fix(event || window.event);
namespace = event.type.split(".");
event.type = namespace[0];
namespace = namespace[1];
all = !namespace && !event.exclusive;
handlers = (jQuery.data(this, "events") || {})[event.type];
for (var j in handlers) {
var handler = handlers[j];
if (all || handler.type == namespace) {
event.handler = handler;
event.data = handler.data;
ret = handler.apply(this, arguments);
if (val !== false) {
val = ret;
}
if (ret === false) {
event.preventDefault();
event.stopPropagation();
}
}
}
return val;
},
fix: function(event) {
if (event[expando] == true) {
return event;
}
var originalEvent = event;
event = {
originalEvent: originalEvent
};
var props = "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");
for (var i = props.length; i; i--) {
event[props[i]] = originalEvent[props[i]];
}
event[expando] = true;
event.preventDefault = function() {
if (originalEvent.preventDefault) {
originalEvent.preventDefault();
}
originalEvent.returnValue = false;
}
;
event.stopPropagation = function() {
if (originalEvent.stopPropagation) {
originalEvent.stopPropagation();
}
originalEvent.cancelBubble = true;
}
;
event.timeStamp = event.timeStamp || now();
if (!event.target) {
event.target = event.srcElement || document;
}
if (event.target.nodeType == 3) {
event.target = event.target.parentNode;
}
if (!event.relatedTarget && event.fromElement) {
event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;
}
if (event.pageX == null && event.clientX != null ) {
var doc = document.documentElement
, body = document.body;
event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
}
if (!event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode)) {
event.which = event.charCode || event.keyCode;
}
if (!event.metaKey && event.ctrlKey) {
event.metaKey = event.ctrlKey;
}
if (!event.which && event.button) {
event.which = (event.button & 1 ? 1 : (event.button & 2 ? 3 : (event.button & 4 ? 2 : 0)));
}
return event;
},
proxy: function(fn, proxy) {
proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++;
return proxy;
},
special: {
ready: {
setup: function() {
bindReady();
return;
},
teardown: function() {
return;
}
},
mouseenter: {
setup: function() {
if (jQuery.browser.msie) {
return false;
}
jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler);
return true;
},
teardown: function() {
if (jQuery.browser.msie) {
return false;
}
jQuery(this).unbind("mouseover", jQuery.event.special.mouseenter.handler);
return true;
},
handler: function(event) {
if (withinElement(event, this)) {
return true;
}
event.type = "mouseenter";
return jQuery.event.handle.apply(this, arguments);
}
},
mouseleave: {
setup: function() {
if (jQuery.browser.msie) {
return false;
}
jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler);
return true;
},
teardown: function() {
if (jQuery.browser.msie) {
return false;
}
jQuery(this).unbind("mouseout", jQuery.event.special.mouseleave.handler);
return true;
},
handler: function(event) {
if (withinElement(event, this)) {
return true;
}
event.type = "mouseleave";
return jQuery.event.handle.apply(this, arguments);
}
}
}
};
jQuery.fn.extend({
bind: function(type, data, fn) {
return type == "unload" ? this.one(type, data, fn) : this.each(function() {
jQuery.event.add(this, type, fn || data, fn && data);
});
},
one: function(type, data, fn) {
var one = jQuery.event.proxy(fn || data, function(event) {
jQuery(this).unbind(event, one);
return (fn || data).apply(this, arguments);
});
return this.each(function() {
jQuery.event.add(this, type, one, fn && data);
});
},
unbind: function(type, fn) {
return this.each(function() {
jQuery.event.remove(this, type, fn);
});
},
trigger: function(type, data, fn) {
return this.each(function() {
jQuery.event.trigger(type, data, this, true, fn);
});
},
triggerHandler: function(type, data, fn) {
return this[0] && jQuery.event.trigger(type, data, this[0], false, fn);
},
toggle: function(fn) {
var args = arguments
, i = 1;
while (i < args.length) {
jQuery.event.proxy(fn, args[i++]);
}
return this.click(jQuery.event.proxy(fn, function(event) {
this.lastToggle = (this.lastToggle || 0) % i;
event.preventDefault();
return args[this.lastToggle++].apply(this, arguments) || false;
}));
},
hover: function(fnOver, fnOut) {
return this.bind("mouseenter", fnOver).bind("mouseleave", fnOut);
},
ready: function(fn) {
bindReady();
if (jQuery.isReady) {
fn.call(document, jQuery);
} else {
jQuery.readyList.push(function() {
return fn.call(this, jQuery);
});
}
return this;
}
});
jQuery.extend({
isReady: false,
readyList: [],
ready: function() {
if (!jQuery.isReady) {
jQuery.isReady = true;
if (jQuery.readyList) {
jQuery.each(jQuery.readyList, function() {
this.call(document);
});
jQuery.readyList = null ;
}
jQuery(document).triggerHandler("ready");
}
}
});
var readyBound = false;
function bindReady() {
if (readyBound) {
return;
}
readyBound = true;
if (document.addEventListener && !jQuery.browser.opera) {
document.addEventListener("DOMContentLoaded", jQuery.ready, false);
}
if (jQuery.browser.msie && window == top) {
(function() {
if (jQuery.isReady) {
return;
}
try {
document.documentElement.doScroll("left");
} catch (error) {
setTimeout(arguments.callee, 0);
return;
}
jQuery.ready();
})();
}
if (jQuery.browser.opera) {
document.addEventListener("DOMContentLoaded", function() {
if (jQuery.isReady) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
if (document.styleSheets[i].disabled) {
setTimeout(arguments.callee, 0);
return;
}
}
jQuery.ready();
}, false);
}
if (jQuery.browser.safari) {
var numStyles;
(function() {
if (jQuery.isReady) {
return;
}
if (document.readyState != "loaded" && document.readyState != "complete") {
setTimeout(arguments.callee, 0);
return;
}
if (numStyles === undefined) {
numStyles = jQuery("style, link[rel=stylesheet]").length;
}
if (document.styleSheets.length != numStyles) {
setTimeout(arguments.callee, 0);
return;
}
jQuery.ready();
})();
}
jQuery.event.add(window, "load", jQuery.ready);
}
jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick," + "mousedown,mouseup,mousemove,mouseover,mouseout,change,select," + "submit,keydown,keypress,keyup,error").split(","), function(i, name) {
jQuery.fn[name] = function(fn) {
return fn ? this.bind(name, fn) : this.trigger(name);
}
;
});
var withinElement = function(event, elem) {
var parent = event.relatedTarget;
while (parent && parent != elem) {
try {
parent = parent.parentNode;
} catch (error) {
parent = elem;
}
}
return parent == elem;
}
;
jQuery(window).bind("unload", function() {
jQuery("*").add(document).unbind();
});
jQuery.fn.extend({
_load: jQuery.fn.load,
load: function(url, params, callback) {
if (typeof url != "string") {
return this._load(url);
}
var off = url.indexOf(" ");
if (off >= 0) {
var selector = url.slice(off, url.length);
url = url.slice(0, off);
}
callback = callback || function() {}
;
var type = "GET";
if (params) {
if (jQuery.isFunction(params)) {
callback = params;
params = null ;
} else {
params = jQuery.param(params);
type = "POST";
}
}
var self = this;
jQuery.ajax({
url: url,
type: type,
dataType: "html",
data: params,
complete: function(res, status) {
if (status == "success" || status == "notmodified") {
self.html(selector ? jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g, "")).find(selector) : res.responseText);
}
self.each(callback, [res.responseText, status, res]);
}
});
return this;
},
serialize: function() {
return jQuery.param(this.serializeArray());
},
serializeArray: function() {
return this.map(function() {
return jQuery.nodeName(this, "form") ? jQuery.makeArray(this.elements) : this;
}).filter(function() {
return this.name && !this.disabled && (this.checked || /select|textarea/i.test(this.nodeName) || /text|hidden|password/i.test(this.type));
}).map(function(i, elem) {
var val = jQuery(this).val();
return val == null ? null : val.constructor == Array ? jQuery.map(val, function(val, i) {
return {
name: elem.name,
value: val
};
}) : {
name: elem.name,
value: val
};
}).get();
}
});
jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i, o) {
jQuery.fn[o] = function(f) {
return this.bind(o, f);
}
;
});
var jsc = now();
jQuery.extend({
get: function(url, data, callback, type) {
if (jQuery.isFunction(data)) {
callback = data;
data = null ;
}
return jQuery.ajax({
type: "GET",
url: url,
data: data,
success: callback,
dataType: type
});
},
getScript: function(url, callback) {
return jQuery.get(url, null , callback, "script");
},
getJSON: function(url, data, callback) {
return jQuery.get(url, data, callback, "json");
},
post: function(url, data, callback, type) {
if (jQuery.isFunction(data)) {
callback = data;
data = {};
}
return jQuery.ajax({
type: "POST",
url: url,
data: data,
success: callback,
dataType: type
});
},
ajaxSetup: function(settings) {
jQuery.extend(jQuery.ajaxSettings, settings);
},
ajaxSettings: {
url: location.href,
global: true,
type: "GET",
timeout: 0,
contentType: "application/x-www-form-urlencoded",
processData: true,
async: true,
data: null ,
username: null ,
password: null ,
accepts: {
xml: "application/xml, text/xml",
html: "text/html",
script: "text/javascript, application/javascript",
json: "application/json, text/javascript",
text: "text/plain",
_default: "*/*"
}
},
lastModified: {},
ajax: function(s) {
s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));
var jsonp, jsre = /=\?(&|$)/g, status, data, type = s.type.toUpperCase();
if (s.data && s.processData && typeof s.data != "string") {
s.data = jQuery.param(s.data);
}
if (s.dataType == "jsonp") {
if (type == "GET") {
if (!s.url.match(jsre)) {
s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?";
}
} else {
if (!s.data || !s.data.match(jsre)) {
s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
}
}
s.dataType = "json";
}
if (s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre))) {
jsonp = "jsonp" + jsc++;
if (s.data) {
s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
}
s.url = s.url.replace(jsre, "=" + jsonp + "$1");
s.dataType = "script";
window[jsonp] = function(tmp) {
data = tmp;
success();
complete();
window[jsonp] = undefined;
try {
delete window[jsonp];
} catch (e) {}
if (head) {
head.removeChild(script);
}
}
;
}
if (s.dataType == "script" && s.cache == null ) {
s.cache = false;
}
if (s.cache === false && type == "GET") {
var ts = now();
var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");
s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : "");
}
if (s.data && type == "GET") {
s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;
s.data = null ;
}
if (s.global && !jQuery.active++) {
jQuery.event.trigger("ajaxStart");
}
var remote = /^(?:\w+:)?\/\/([^\/?#]+)/;
if (s.dataType == "script" && type == "GET" && remote.test(s.url) && remote.exec(s.url)[1] != location.host) {
var head = document.getElementsByTagName("head")[0];
var script = document.createElement("script");
script.src = s.url;
if (s.scriptCharset) {
script.charset = s.scriptCharset;
}
if (!jsonp) {
var done = false;
script.onload = script.onreadystatechange = function() {
if (!done && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete")) {
done = true;
success();
complete();
head.removeChild(script);
}
}
;
}
head.appendChild(script);
return undefined;
}
var requestDone = false;
var xhr = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
if (s.username) {
xhr.open(type, s.url, s.async, s.username, s.password);
} else {
xhr.open(type, s.url, s.async);
}
try {
if (s.data) {
xhr.setRequestHeader("Content-Type", s.contentType);
}
if (s.ifModified) {
xhr.setRequestHeader("If-Modified-Since", jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT");
}
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
xhr.setRequestHeader("Accept", s.dataType && s.accepts[s.dataType] ? s.accepts[s.dataType] + ", */*" : s.accepts._default);
} catch (e) {}
if (s.beforeSend && s.beforeSend(xhr, s) === false) {
s.global && jQuery.active--;
xhr.abort();
return false;
}
if (s.global) {
jQuery.event.trigger("ajaxSend", [xhr, s]);
}
var onreadystatechange = function(isTimeout) {
if (!requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout")) {
requestDone = true;
if (ival) {
clearInterval(ival);
ival = null ;
}
status = isTimeout == "timeout" && "timeout" || !jQuery.httpSuccess(xhr) && "error" || s.ifModified && jQuery.httpNotModified(xhr, s.url) && "notmodified" || "success";
if (status == "success") {
try {
data = jQuery.httpData(xhr, s.dataType, s.dataFilter);
} catch (e) {
status = "parsererror";
}
}
if (status == "success") {
var modRes;
try {
modRes = xhr.getResponseHeader("Last-Modified");
} catch (e) {}
if (s.ifModified && modRes) {
jQuery.lastModified[s.url] = modRes;
}
if (!jsonp) {
success();
}
} else {
jQuery.handleError(s, xhr, status);
}
complete();
if (s.async) {
xhr = null ;
}
}
}
;
if (s.async) {
var ival = setInterval(onreadystatechange, 13);
if (s.timeout > 0) {
setTimeout(function() {
if (xhr) {
xhr.abort();
if (!requestDone) {
onreadystatechange("timeout");
}
}
}, s.timeout);
}
}
try {
xhr.send(s.data);
} catch (e) {
jQuery.handleError(s, xhr, null , e);
}
if (!s.async) {
onreadystatechange();
}
function success() {
if (s.success) {
s.success(data, status);
}
if (s.global) {
jQuery.event.trigger("ajaxSuccess", [xhr, s]);
}
}
function complete() {
if (s.complete) {
s.complete(xhr, status);
}
if (s.global) {
jQuery.event.trigger("ajaxComplete", [xhr, s]);
}
if (s.global && !--jQuery.active) {
jQuery.event.trigger("ajaxStop");
}
}
return xhr;
},
handleError: function(s, xhr, status, e) {
if (s.error) {
s.error(xhr, status, e);
}
if (s.global) {
jQuery.event.trigger("ajaxError", [xhr, s, e]);
}
},
active: 0,
httpSuccess: function(xhr) {
try {
return !xhr.status && location.protocol == "file:" || (xhr.status >= 200 && xhr.status < 300) || xhr.status == 304 || xhr.status == 1223 || jQuery.browser.safari && xhr.status == undefined;
} catch (e) {}
return false;
},
httpNotModified: function(xhr, url) {
try {
var xhrRes = xhr.getResponseHeader("Last-Modified");
return xhr.status == 304 || xhrRes == jQuery.lastModified[url] || jQuery.browser.safari && xhr.status == undefined;
} catch (e) {}
return false;
},
httpData: function(xhr, type, filter) {
var ct = xhr.getResponseHeader("content-type")
, xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0
, data = xml ? xhr.responseXML : xhr.responseText;
if (xml && data.documentElement.tagName == "parsererror") {
throw "parsererror";
}
if (filter) {
data = filter(data, type);
}
if (type == "script") {
jQuery.globalEval(data);
}
if (type == "json") {
data = eval("(" + data + ")");
}
return data;
},
param: function(a) {
var s = [];
if (a.constructor == Array || a.jquery) {
jQuery.each(a, function() {
s.push(encodeURIComponent(this.name) + "=" + encodeURIComponent(this.value));
});
} else {
for (var j in a) {
if (a[j] && a[j].constructor == Array) {
jQuery.each(a[j], function() {
s.push(encodeURIComponent(j) + "=" + encodeURIComponent(this));
});
} else {
s.push(encodeURIComponent(j) + "=" + encodeURIComponent(jQuery.isFunction(a[j]) ? a[j]() : a[j]));
}
}
}
return s.join("&").replace(/%20/g, "+");
}
});
jQuery.fn.extend({
show: function(speed, callback) {
return speed ? this.animate({
height: "show",
width: "show",
opacity: "show"
}, speed, callback) : this.filter(":hidden").each(function() {
this.style.display = this.oldblock || "";
if (jQuery.css(this, "display") == "none") {
var elem = jQuery("<" + this.tagName + " />").appendTo("body");
this.style.display = elem.css("display");
if (this.style.display == "none") {
this.style.display = "block";
}
elem.remove();
}
}).end();
},
hide: function(speed, callback) {
return speed ? this.animate({
height: "hide",
width: "hide",
opacity: "hide"
}, speed, callback) : this.filter(":visible").each(function() {
this.oldblock = this.oldblock || jQuery.css(this, "display");
this.style.display = "none";
}).end();
},
_toggle: jQuery.fn.toggle,
toggle: function(fn, fn2) {
return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ? this._toggle.apply(this, arguments) : fn ? this.animate({
height: "toggle",
width: "toggle",
opacity: "toggle"
}, fn, fn2) : this.each(function() {
jQuery(this)[jQuery(this).is(":hidden") ? "show" : "hide"]();
});
},
slideDown: function(speed, callback) {
return this.animate({
height: "show"
}, speed, callback);
},
slideUp: function(speed, callback) {
return this.animate({
height: "hide"
}, speed, callback);
},
slideToggle: function(speed, callback) {
return this.animate({
height: "toggle"
}, speed, callback);
},
fadeIn: function(speed, callback) {
return this.animate({
opacity: "show"
}, speed, callback);
},
fadeOut: function(speed, callback) {
return this.animate({
opacity: "hide"
}, speed, callback);
},
fadeTo: function(speed, to, callback) {
return this.animate({
opacity: to
}, speed, callback);
},
animate: function(prop, speed, easing, callback) {
var optall = jQuery.speed(speed, easing, callback);
return this[optall.queue === false ? "each" : "queue"](function() {
if (this.nodeType != 1) {
return false;
}
var opt = jQuery.extend({}, optall), p, hidden = jQuery(this).is(":hidden"), self = this;
for (p in prop) {
if (prop[p] == "hide" && hidden || prop[p] == "show" && !hidden) {
return opt.complete.call(this);
}
if (p == "height" || p == "width") {
opt.display = jQuery.css(this, "display");
opt.overflow = this.style.overflow;
}
}
if (opt.overflow != null ) {
this.style.overflow = "hidden";
}
opt.curAnim = jQuery.extend({}, prop);
jQuery.each(prop, function(name, val) {
var e = new jQuery.fx(self,opt,name);
if (/toggle|show|hide/.test(val)) {
e[val == "toggle" ? hidden ? "show" : "hide" : val](prop);
} else {
var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/)
, start = e.cur(true) || 0;
if (parts) {
var end = parseFloat(parts[2])
, unit = parts[3] || "px";
if (unit != "px") {
self.style[name] = (end || 1) + unit;
start = ((end || 1) / e.cur(true)) * start;
self.style[name] = start + unit;
}
if (parts[1]) {
end = ((parts[1] == "-=" ? -1 : 1) * end) + start;
}
e.custom(start, end, unit);
} else {
e.custom(start, val, "");
}
}
});
return true;
});
},
queue: function(type, fn) {
if (jQuery.isFunction(type) || (type && type.constructor == Array)) {
fn = type;
type = "fx";
}
if (!type || (typeof type == "string" && !fn)) {
return queue(this[0], type);
}
return this.each(function() {
if (fn.constructor == Array) {
queue(this, type, fn);
} else {
queue(this, type).push(fn);
if (queue(this, type).length == 1) {
fn.call(this);
}
}
});
},
stop: function(clearQueue, gotoEnd) {
var timers = jQuery.timers;
if (clearQueue) {
this.queue([]);
}
this.each(function() {
for (var i = timers.length - 1; i >= 0; i--) {
if (timers[i].elem == this) {
if (gotoEnd) {
timers[i](true);
}
timers.splice(i, 1);
}
}
});
if (!gotoEnd) {
this.dequeue();
}
return this;
}
});
var queue = function(elem, type, array) {
if (elem) {
type = type || "fx";
var q = jQuery.data(elem, type + "queue");
if (!q || array) {
q = jQuery.data(elem, type + "queue", jQuery.makeArray(array));
}
}
return q;
}
;
jQuery.fn.dequeue = function(type) {
type = type || "fx";
return this.each(function() {
var q = queue(this, type);
q.shift();
if (q.length) {
q[0].call(this);
}
});
}
;
jQuery.extend({
speed: function(speed, easing, fn) {
var opt = speed && speed.constructor == Object ? speed : {
complete: fn || !fn && easing || jQuery.isFunction(speed) && speed,
duration: speed,
easing: fn && easing || easing && easing.constructor != Function && easing
};
opt.duration = (opt.duration && opt.duration.constructor == Number ? opt.duration : jQuery.fx.speeds[opt.duration]) || jQuery.fx.speeds.def;
opt.old = opt.complete;
opt.complete = function() {
if (opt.queue !== false) {
jQuery(this).dequeue();
}
if (jQuery.isFunction(opt.old)) {
opt.old.call(this);
}
}
;
return opt;
},
easing: {
linear: function(p, n, firstNum, diff) {
return firstNum + diff * p;
},
swing: function(p, n, firstNum, diff) {
return ((-Math.cos(p * Math.PI) / 2) + 0.5) * diff + firstNum;
}
},
timers: [],
timerId: null ,
fx: function(elem, options, prop) {
this.options = options;
this.elem = elem;
this.prop = prop;
if (!options.orig) {
options.orig = {};
}
}
});
jQuery.fx.prototype = {
update: function() {
if (this.options.step) {
this.options.step.call(this.elem, this.now, this);
}
(jQuery.fx.step[this.prop] || jQuery.fx.step._default)(this);
if (this.prop == "height" || this.prop == "width") {
this.elem.style.display = "block";
}
},
cur: function(force) {
if (this.elem[this.prop] != null && this.elem.style[this.prop] == null ) {
return this.elem[this.prop];
}
var r = parseFloat(jQuery.css(this.elem, this.prop, force));
return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
},
custom: function(from, to, unit) {
this.startTime = now();
this.start = from;
this.end = to;
this.unit = unit || this.unit || "px";
this.now = this.start;
this.pos = this.state = 0;
this.update();
var self = this;
function t(gotoEnd) {
return self.step(gotoEnd);
}
t.elem = this.elem;
jQuery.timers.push(t);
if (jQuery.timerId == null ) {
jQuery.timerId = setInterval(function() {
var timers = jQuery.timers;
for (var i = 0; i < timers.length; i++) {
if (!timers[i]()) {
timers.splice(i--, 1);
}
}
if (!timers.length) {
clearInterval(jQuery.timerId);
jQuery.timerId = null ;
}
}, 13);
}
},
show: function() {
this.options.orig[this.prop] = jQuery.attr(this.elem.style, this.prop);
this.options.show = true;
this.custom(0, this.cur());
if (this.prop == "width" || this.prop == "height") {
this.elem.style[this.prop] = "1px";
}
jQuery(this.elem).show();
},
hide: function() {
this.options.orig[this.prop] = jQuery.attr(this.elem.style, this.prop);
this.options.hide = true;
this.custom(this.cur(), 0);
},
step: function(gotoEnd) {
var t = now();
if (gotoEnd || t > this.options.duration + this.startTime) {
this.now = this.end;
this.pos = this.state = 1;
this.update();
this.options.curAnim[this.prop] = true;
var done = true;
for (var i in this.options.curAnim) {
if (this.options.curAnim[i] !== true) {
done = false;
}
}
if (done) {
if (this.options.display != null ) {
this.elem.style.overflow = this.options.overflow;
this.elem.style.display = this.options.display;
if (jQuery.css(this.elem, "display") == "none") {
this.elem.style.display = "block";
}
}
if (this.options.hide) {
this.elem.style.display = "none";
}
if (this.options.hide || this.options.show) {
for (var p in this.options.curAnim) {
jQuery.attr(this.elem.style, p, this.options.orig[p]);
}
}
}
if (done) {
this.options.complete.call(this.elem);
}
return false;
} else {
var n = t - this.startTime;
this.state = n / this.options.duration;
this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
this.now = this.start + ((this.end - this.start) * this.pos);
this.update();
}
return true;
}
};
jQuery.extend(jQuery.fx, {
speeds: {
slow: 600,
fast: 200,
def: 400
},
step: {
scrollLeft: function(fx) {
fx.elem.scrollLeft = fx.now;
},
scrollTop: function(fx) {
fx.elem.scrollTop = fx.now;
},
opacity: function(fx) {
jQuery.attr(fx.elem.style, "opacity", fx.now);
},
_default: function(fx) {
fx.elem.style[fx.prop] = fx.now + fx.unit;
}
}
});
jQuery.fn.offset = function() {
var left = 0, top = 0, elem = this[0], results;
if (elem) {
with (jQuery.browser) {
var parent = elem.parentNode
, offsetChild = elem
, offsetParent = elem.offsetParent
, doc = elem.ownerDocument
, safari2 = safari && parseInt(version) < 522 && !/adobeair/i.test(userAgent)
, css = jQuery.curCSS
, fixed = css(elem, "position") == "fixed";
if (elem.getBoundingClientRect) {
var box = elem.getBoundingClientRect();
add(box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft), box.top + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop));
add(-doc.documentElement.clientLeft, -doc.documentElement.clientTop);
} else {
add(elem.offsetLeft, elem.offsetTop);
while (offsetParent) {
add(offsetParent.offsetLeft, offsetParent.offsetTop);
if (mozilla && !/^t(able|d|h)$/i.test(offsetParent.tagName) || safari && !safari2) {
border(offsetParent);
}
if (!fixed && css(offsetParent, "position") == "fixed") {
fixed = true;
}
offsetChild = /^body$/i.test(offsetParent.tagName) ? offsetChild : offsetParent;
offsetParent = offsetParent.offsetParent;
}
while (parent && parent.tagName && !/^body|html$/i.test(parent.tagName)) {
if (!/^inline|table.*$/i.test(css(parent, "display"))) {
add(-parent.scrollLeft, -parent.scrollTop);
}
if (mozilla && css(parent, "overflow") != "visible") {
border(parent);
}
parent = parent.parentNode;
}
if ((safari2 && (fixed || css(offsetChild, "position") == "absolute")) || (mozilla && css(offsetChild, "position") != "absolute")) {
add(-doc.body.offsetLeft, -doc.body.offsetTop);
}
if (fixed) {
add(Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft), Math.max(doc.documentElement.scrollTop, doc.body.scrollTop));
}
}
results = {
top: top,
left: left
};
}
}
function border(elem) {
add(jQuery.curCSS(elem, "borderLeftWidth", true), jQuery.curCSS(elem, "borderTopWidth", true));
}
function add(l, t) {
left += parseInt(l, 10) || 0;
top += parseInt(t, 10) || 0;
}
return results;
}
;
jQuery.fn.extend({
position: function() {
var left = 0, top = 0, results;
if (this[0]) {
var offsetParent = this.offsetParent()
, offset = this.offset()
, parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? {
top: 0,
left: 0
} : offsetParent.offset();
offset.top -= num(this, "marginTop");
offset.left -= num(this, "marginLeft");
parentOffset.top += num(offsetParent, "borderTopWidth");
parentOffset.left += num(offsetParent, "borderLeftWidth");
results = {
top: offset.top - parentOffset.top,
left: offset.left - parentOffset.left
};
}
return results;
},
offsetParent: function() {
var offsetParent = this[0].offsetParent;
while (offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, "position") == "static")) {
offsetParent = offsetParent.offsetParent;
}
return jQuery(offsetParent);
}
});
jQuery.each(["Left", "Top"], function(i, name) {
var method = "scroll" + name;
jQuery.fn[method] = function(val) {
if (!this[0]) {
return;
}
return val != undefined ? this.each(function() {
this == window || this == document ? window.scrollTo(!i ? val : jQuery(window).scrollLeft(), i ? val : jQuery(window).scrollTop()) : this[method] = val;
}) : this[0] == window || this[0] == document ? self[i ? "pageYOffset" : "pageXOffset"] || jQuery.boxModel && document.documentElement[method] || document.body[method] : this[0][method];
}
;
});
jQuery.each(["Height", "Width"], function(i, name) {
var tl = i ? "Left" : "Top"
, br = i ? "Right" : "Bottom";
jQuery.fn["inner" + name] = function() {
return this[name.toLowerCase()]() + num(this, "padding" + tl) + num(this, "padding" + br);
}
;
jQuery.fn["outer" + name] = function(margin) {
return this["inner" + name]() + num(this, "border" + tl + "Width") + num(this, "border" + br + "Width") + (margin ? num(this, "margin" + tl) + num(this, "margin" + br) : 0);
}
;
});
})();
jQuery.ajaxSetup({
dataType: "script",
cache: false
});
function headline_rotate() {
current_headline = (old_headline + 1) % headline_count;
$("div.headline:eq(" + old_headline + ")").animate({
left: -628
}, "slow", function() {
$(this).css("left", "633px");
});
$("div.headline:eq(" + current_headline + ")").show().animate({
left: 0
}, "slow");
old_headline = current_headline;
}
function setSavedCardInForm(cardName, cardType, val) {
cardName.value = val.split("|")[0];
cardType.value = val.split("|")[1];
showHideSecurityCode(cardType.value, "savedCardCodeTd");
}
function showHideSecurityCode(cardType, securityCodeId) {
if (cardType == "UATP") {
document.getElementById(securityCodeId).style.visibility = "hidden";
} else {
document.getElementById(securityCodeId).style.visibility = "visible";
}
}
(function($) {
$.fn.custCheckBox = function(options) {
var defaults = {
disable_all: false,
wrapperclass: "group"
};
var opts = $.extend(defaults, options);
return this.each(function() {
var obj = $(this);
$.fn.buildbox = function(thisElm) {
var currElm = $(thisElm);
$(currElm).css({
display: "none"
}).before('<span class="cust_checkbox">&nbsp;&nbsp;&nbsp;&nbsp;</span>');
var isChecked = $(currElm).attr("checked");
var boxtype = $(currElm).attr("type");
var disabled = $(currElm).attr("disabled");
if (boxtype === "checkbox") {
$(currElm).prev("span").addClass("checkbox");
if (disabled || opts.disable_all) {
boxtype = "checkbox_disabled";
}
} else {
$(currElm).prev("span").addClass("radio");
if (disabled || opts.disable_all) {
boxtype = "radio_disabled";
}
}
if (isChecked) {
$(currElm).prev("span").addClass("cust_" + boxtype + "_on");
} else {
$(currElm).prev("span").addClass("cust_" + boxtype + "_off");
}
if (opts.disable_all) {
$(currElm).attr("disabled", "disabled");
}
}
;
$.fn.buildbox($(obj));
$("." + opts.wrapperclass + " label").unbind().click(function() {
if (!opts.disable_all) {
var custbox = $(this).prev().prev();
var boxtype = $(custbox).next("input").attr("type");
var disabled = $(custbox).next("input").attr("disabled");
if ($(custbox).hasClass("checkbox")) {
if ($(custbox).hasClass("cust_" + boxtype + "_off") && !disabled) {
$(custbox).removeClass("cust_" + boxtype + "_off").addClass("cust_" + boxtype + "_on");
} else {
if (!disabled) {
$(custbox).removeClass("cust_" + boxtype + "_on").addClass("cust_" + boxtype + "_off");
}
}
} else {
if (!disabled) {
$(custbox).parent().find(".cust_checkbox").removeClass("cust_" + boxtype + "_on").addClass("cust_" + boxtype + "_off").next("input").removeAttr("checked");
$(custbox).removeClass("cust_" + boxtype + "_off").addClass("cust_" + boxtype + "_on");
customRadioOnClick($(custbox));
}
}
}
});
$(".cust_checkbox").unbind().click(function() {
if (!opts.disable_all) {
var boxtype = $(this).next("input").attr("type");
var disabled = $(this).next("input").attr("disabled");
if ($(this).hasClass("checkbox")) {
if ($(this).hasClass("cust_" + boxtype + "_off") && !disabled) {
$(this).removeClass("cust_" + boxtype + "_off").addClass("cust_" + boxtype + "_on").next("input").attr("checked", "checked");
} else {
if (!disabled) {
$(this).removeClass("cust_" + boxtype + "_on").addClass("cust_" + boxtype + "_off").next("input").removeAttr("checked");
}
}
} else {
if (!disabled) {
$(this).parent().find(".cust_checkbox").removeClass("cust_" + boxtype + "_on").addClass("cust_" + boxtype + "_off").next("input").removeAttr("checked");
$(this).removeClass("cust_" + boxtype + "_off").addClass("cust_" + boxtype + "_on").next("input").attr("checked", "checked");
customRadioOnClick($(this));
}
}
}
});
});
}
;
})(jQuery);
jQuery.fn.extend({
selectbox: function(options) {
return this.each(function() {
new jQuery.SelectBox(this,options);
});
}
});
jQuery.SelectBox = function(selectobj, options) {
var opt = options || {};
opt.inputClass = opt.inputClass || "selectbox";
opt.inputChBgClass = opt.inputChBgClass || "chInputBg";
opt.containerClass = opt.containerClass || "selectBoxWrapper";
opt.hoverClass = opt.hoverClass || "current";
opt.currentClass = opt.selectedClass || "selected";
opt.firstOptionClass = opt.firstOptionClass || "first";
opt.lastOptionClass = opt.lastOptionClass || "last";
opt.inputClassError = opt.inputClassError || "selectboxError";
opt.inputClassFocus = opt.inputClassFocus || "selectboxFocus";
opt.debug = opt.debug || false;
var LiIndArray = null ;
var fCharInList = new Array();
var tempPressKey = "";
var actLen = 0;
var charInList = false;
var keyCache = "";
var elm_id = selectobj.name;
var active = -1;
var inFocus = false;
var hasfocus = 0;
var clearTimeId = 0;
var $select = $(selectobj);
var $container = setupContainer(opt);
var $input = setupInput(opt);
$select.hide().before($input).before($container);
init();
$input.click(function() {
if (!inFocus) {
$container.toggle();
}
$(selectobj).removeClass("1");
if ($input.hasClass(options.inputClassError)) {
$input.addClass(options.inputClass);
$input.removeClass(options.inputClassError);
}
if ($container.is(":visible")) {
$input.addClass(options.inputChBgClass);
} else {
$input.removeClass(options.inputChBgClass);
$(this).trigger("blur");
}
$input.removeClass(options.inputClassFocus);
}).focus(function() {
if (!$container.is(":visible")) {
$(selectobj).removeClass("1");
$input.removeClass(options.inputClassError);
$input.addClass(options.inputClassFocus);
}
closeCal();
}).keydown(function(event) {
switch (event.keyCode) {
case 38:
event.preventDefault();
moveSelect(-1);
break;
case 40:
event.preventDefault();
moveSelect(1);
break;
case 13:
event.preventDefault();
if ($container.is(":visible")) {
$("li." + opt.currentClass).trigger("click");
} else {
sumitSearchWithEnterKey("SearchFlightBt", event);
}
inFocus = false;
break;
default:
if ($container.is(":visible")) {
setFocusOnList(event);
} else {
clearTimeout(clearTimeId);
suggestNextValue(event);
clearTimeId = setTimeout("keyCache='';", 1000);
}
break;
}
}).blur(function() {
if ($container.is(":visible") && hasfocus > 0) {
if (opt.debug) {
console.log("container visible and has focus");
}
} else {
if (!$container.is(":visible")) {
updateDropDowns(selectobj, $input.html());
}
$input.removeClass(options.inputClassFocus);
$input.addClass(options.inputClass);
hideMe();
}
});
function hideMe() {
hasfocus = 0;
$input.removeClass(options.inputChBgClass);
$input.addClass(options.inputClass);
$container.hide();
}
function init() {
$container.append(getSelectOptions($input.attr("id"))).hide();
var width = $container.css("width");
$container.width(width);
}
function setupContainer(options) {
var container = document.createElement("div");
$container = $(container);
$container.attr("id", elm_id + "_container");
$container.addClass(options.containerClass);
return $container;
}
function suggestNextValue(event) {
var lis = $("li", $container);
var pressKey = String.fromCharCode(event.keyCode);
var matchFound = false;
var firstOpt = -1;
if (!lis) {
return;
}
if (typeof (arguments[1]) == "undefined") {
keyCache += pressKey;
}
var opts = findOptionsForKey();
if (opts.length > 0) {
for (j = 0; j < opts.length; j++) {
if ($input.html().substring(0, 1) == opts[j].substring(0, 1) && opts.length > 1) {
if ($input.html() == opts[j]) {
if ((j + 1) >= opts.length) {
$input.html(opts[0]);
} else {
$input.html(opts[j + 1]);
}
matchFound = true;
break;
}
} else {
$input.html(opts[0]);
matchFound = true;
break;
}
}
}
if (!matchFound) {
if (keyCache.length > 1) {
keyCache = keyCache.substring(keyCache.length - 1, keyCache.length);
suggestNextValue(event, "recursive");
} else {
keyCache = "";
}
}
setCurrentSelected();
}
function findOptionsForKey() {
var lis = $("li", $container);
var opts = new Array();
for (i = 0; i < lis.length; i++) {
if ($(lis[i]).html() != "" && $(lis[i]).html().substring(0, keyCache.length).toUpperCase() == keyCache.toUpperCase()) {
opts.push($(lis[i]).html());
}
}
return opts;
}
function setCurrentSelected() {
var val = "";
var opts = $select.children("option");
for (i = 0; i < opts.length; i++) {
if ($(opts[i]).html() == $input.html()) {
val = $(opts[i]).val();
updateInputValue(val, $(opts[i]).html());
break;
}
}
$select.val(val);
}
function setupInput(options) {
var input = document.createElement("a");
var $input = $(input);
if ($select.attr("title")) {
$input.attr("title", $select.attr("title"));
}
$input.attr("id", elm_id + "_input");
$(input).addClass(options.inputClass);
if ($(selectobj).hasClass("1")) {
$(input).addClass(options.inputClassError);
}
$input.attr("tabIndex", $select.attr("tabIndex"));
return $input;
}
function setFocusOnList(event) {
var k = 0;
var n = 0;
var selectValue = "";
var pressKey = String.fromCharCode(event.keyCode);
$select.children("option").each(function() {
selectValue = $(this).html();
fCharInList[k] = selectValue.substring(0, 1);
if (charInList == false) {
if (pressKey == fCharInList[k]) {
charInList = true;
} else {
charInList = false;
}
}
k++;
});
if (charInList == true) {
charInList = false;
if (tempPressKey != pressKey) {
LiIndArray = new Array();
for (m = 0; m < fCharInList.length; m++) {
selectValue = fCharInList[m];
if (pressKey == selectValue) {
tempPressKey = pressKey;
active = m;
LiIndArray.push(m);
charInList = true;
}
}
actLen = 1;
active = LiIndArray[0];
} else {
var len = LiIndArray.length;
if (len != actLen) {
for (var m = 0; m < len; m++) {
if (active == LiIndArray[m]) {
actLen++;
active++;
break;
}
}
} else {
actLen = 1;
active = LiIndArray[0];
}
}
var lis = $("li", $container);
if (typeof (lis) != "undefined" && typeof ($(lis[active]).html()) != "undefined") {
$("li." + opt.currentClass).removeClass(opt.currentClass);
lis.removeClass(opt.hoverClass);
$(lis[active]).addClass(opt.currentClass);
setCurrentValue($(lis[active]));
}
}
}
function moveSelect(step) {
var lis = $("li", $container);
if (!lis) {
return;
}
for (i = 0; i < lis.length; i++) {
if ($(lis[i]).html() == $input.html()) {
active = i;
break;
}
}
active += step;
if (active < 0) {
active = 0;
} else {
if (active >= lis.size()) {
active = lis.size() - 1;
}
}
if ($container.is(":visible")) {
$(lis[active]).parent().children("li").removeClass(opt.hoverClass);
$(lis[active]).parent().children("li").removeClass(opt.currentClass);
$(lis[active]).addClass(opt.currentClass);
}
var ar = ("" + $(lis[active]).attr("id")).split("_");
var el = ar[ar.length - 1];
$select.val(el);
updateInputValue($select.val(), $(lis[active]).html());
}
function setCurrent() {
var li = $("li." + opt.currentClass, $container).get(0);
var ar = ("" + li.id).split("_");
var el = ar[ar.length - 1];
$select.val(el);
updateInputValue($select.val(), $(li).html());
updateDropDowns(selectobj, $(li).html());
return true;
}
function updateInputValue(val, listVal) {
$input.empty();
if (val == "" && ($select.attr("id") == "originFltOneMC" || $select.attr("id") == "originFltTwoMC")) {
if ($select.attr("id") == "originFltTwoMC") {
$input.html("<b>Flight 2: </b>" + listVal);
} else {
$input.html("<b>Flight 1: </b>" + listVal);
}
} else {
$input.html(listVal);
}
}
function setCurrentValue(li) {
var ar = ("" + li.id).split("_");
var el = ar[ar.length - 1];
$select.val(el);
updateInputValue($select.val(), $(li).html());
}
function getCurrentSelected() {
return $select.val();
}
function getCurrentValue() {
return $input.val();
}
function getSelectOptions(parentid) {
var select_options = new Array();
var ul = document.createElement("ul");
$(ul).bind("mouseleave", function(e) {
$(ul).children("li").each(function() {
var currentVal = $input.html();
if (currentVal == $(this).html() || currentVal.indexOf($(this).html()) != -1) {
$(this).addClass(opt.currentClass);
}
});
});
var lastIdx = $select.children("option").length - 1;
var i = 0;
$select.children("option").each(function() {
var li = document.createElement("li");
li.setAttribute("id", parentid + "_" + $(this).val());
li.innerHTML = $(this).html();
if (opt.debug) {
console.log("options :" + $(this).val() + " [] " + opt.lastOptionClass);
}
if (i == lastIdx) {
$(li).addClass(opt.lastOptionClass);
}
if ($(this).is(":selected")) {
updateInputValue($select.val(), $(li).html());
$(li).addClass(opt.currentClass);
}
ul.appendChild(li);
$(li).mouseover(function(event) {
hasfocus = 1;
if (opt.debug) {
console.log("over on : " + this.id);
}
$(this).parent().children("li").removeClass(opt.currentClass);
jQuery(event.target, $container).addClass(opt.hoverClass);
}).mouseout(function(event) {
hasfocus = -1;
if (opt.debug) {
console.log("out on : " + this.id);
}
jQuery(event.target, $container).removeClass(opt.hoverClass);
}).click(function(event) {
if (opt.debug) {
console.log("click on :" + this.id);
}
$(this).parent().children("li").removeClass(opt.hoverClass);
$(this).parent().children("li").removeClass(opt.currentClass);
$(this).addClass(opt.currentClass);
setCurrent();
hideMe();
});
i++;
});
return ul;
}
}
;
function checkClick(divId) {
var x = document.getElementById(divId);
if (divId == "checkbox10") {
if (document.getElementById(divId).checked && document.getElementById("checkbox11") != null ) {
document.getElementById("checkbox11").checked = true;
}
if (!x.checked && document.getElementById("checkbox11") != null ) {
document.getElementById("checkbox11").checked = false;
}
}
if (divId == "checkbox11") {
if (x.checked) {
document.getElementById("checkbox10").checked = true;
}
if (!x.checked) {
document.getElementById("checkbox10").checked = false;
}
}
if (divId == "checkbox20") {
if (document.getElementById(divId).checked && document.getElementById("checkbox21") != null ) {
document.getElementById("checkbox21").checked = true;
}
if (!x.checked && document.getElementById("checkbox21") != null ) {
document.getElementById("checkbox21").checked = false;
}
}
if (divId == "checkbox21") {
if (x.checked) {
document.getElementById("checkbox20").checked = true;
}
if (!x.checked) {
document.getElementById("checkbox20").checked = false;
}
}
}
function enableEmail() {
if (document.receiptForm.elements["viewPurchaseModel.contact"].checked == true) {
document.receiptForm.elements["viewPurchaseModel.contactEmail"].disabled = false;
}
}
function openTravelFlagCodeDiv(linkId) {
var positionObj = linkId;
setPosition(document.getElementById(positionObj), document.getElementById("travelFlagCodeDiv"), -90, 350);
document.getElementById("travelFlagCodeDiv").style.display = "block";
}
function closeTravelFlagCodeDiv() {
document.getElementById("travelFlagCodeDiv").style.display = "none";
document.barForm.method.value = "viewPurchaseTabLink";
document.barForm.tabSelect.value = "5";
document.barForm.tabFlg.value = "6";
document.barForm.action = "viewPurchaseTabLink.do";
document.barForm.submit();
}
function openTravelInsurancePopupDiv(linkId) {
var positionObj = linkId;
setPosition(document.getElementById(positionObj), document.getElementById("travelInsuranceDes_one"), 300, 150);
document.getElementById("travelInsuranceDes").style.display = "block";
}
function closeTravelInsurancePopupDiv() {
document.getElementById("travelInsuranceDes").style.display = "none";
}
function submitPRForm() {
document.receiptForm.tabNumber.value = "7";
document.receiptForm.tabSelect.value = "7";
document.receiptForm.method.value = "finalReceipt";
document.receiptForm.action = "viewReceipt.do";
if (getCookie("channel_session_id") != null ) {
document.receiptForm.channelId.value = getCookie("channel_session_id");
}
document.getElementById("purchaseBtnHref").style.display = "none";
document.getElementById("purchaseBtnHrefDisabled").style.display = "block";
document.receiptForm.submit();
document.getElementById("transactionImageShow").style.display = "block";
}
var isAdultWithInfant = 0;
var clearPopupInterval;
var counter = 8;
var upGradeType;
var newSeatNumber;
var seatTypeUpgrade;
var currencyCodeDollar = "$";
var currentSeat = "";
var previousStyleClass = "";
var selectedSeat = "";
var selectedSeatId = "";
var selectedSeatClassName = "";
var selectedSeatCabinClass = "";
var selectedSeatStyleClass = "";
var selectedSeatDisplay = "";
var selectedSeatCabinClassDisplay = "";
var selectedSeatType = "";
var nSSIndex = 0;
var nSSIndex1 = 0;
var activeSegment = 0;
var oandDCount = 0;
var activeGuest = 0;
var upgradeAmountMCS = 0;
var fareFormatType = 0;
var restrictGuestArr = "";
var isUpgrSeat = new Array(1);
var aGuestSeatsOrig = new Array(1);
aGuestSeatsOrig[0] = new Array(1);
aGuestSeatsOrig[0][0] = "";
var seatSelectPageId = 0;
function isReaccommodated() {
document.getElementById("diabilityMsgId").style.visibility = "hidden";
for (eachSegCnt = 0; eachSegCnt < aGuestSeats.length; eachSegCnt++) {
for (eachGuestCnt = 0; eachGuestCnt < aGuestSeats[eachSegCnt].length; eachGuestCnt++) {
if (aGuestSeats[eachSegCnt][eachGuestCnt] == "3C" || aGuestSeats[eachSegCnt][eachGuestCnt] == "3D") {
document.getElementById("diabilityMsgId").style.visibility = "visible";
eachSegCnt = aGuestSeats.length;
break;
} else {
if (aGuestSeats[eachSegCnt][eachGuestCnt] == "Not Selected" && seatSelectPageId == 1) {
if (aGuestSeatsOrig[eachSegCnt][eachGuestCnt] == "3C" || aGuestSeatsOrig[eachSegCnt][eachGuestCnt] == "3D") {
document.getElementById("diabilityMsgId").style.visibility = "visible";
eachSegCnt = aGuestSeats.length;
break;
}
}
}
}
}
}
function checkCabinClass(selectedClass, action, seatObject) {
if (clearPopupInterval) {
clearInterval(clearPopupInterval);
counter = 8;
}
var yScrollOffset = f_scrollTop();
var upgradeCost = "";
var popUpHTML = "";
var seat = seatObject.id.substr(7);
var upgrade = true;
var yPosOffSet = 0;
var row = 0;
if (seat.length == 2) {
row = seat.substr(0, 1);
} else {
if (seat.length == 3) {
row = seat.substr(0, 2);
}
}
if (aCabinClass[activeSegmentIndex] != selectedClass) {
if (selectedClass == "FIRST") {
upgradeCost = upgradeAmountFirst;
popUpHTML = "html/popup-seatselect-firstclass.html";
popUpTitle = "First Class";
yPosOffSet = -168;
if (yScrollOffset >= 220) {
yPosOffSet = 25;
}
} else {
if (selectedClass == "MCS") {
if (upgradeAmountMCS < 0 || eval(upgradeAmountMCS.replace(",", "")) == 999999) {
upgrade = false;
popUpHTML = "html/popup-seatselect-maincabin-refundable-hf.html";
popUpTitle = "Main Cabin Select";
yPosOffSet = -150;
if (yScrollOffset >= 325 && row == "3") {
yPosOffSet = 25;
}
} else {
upgradeCost = upgradeAmountMCS;
popUpHTML = "html/popup-seatselect-maincabinselect.html";
popUpTitle = "Main Cabin Select";
yPosOffSet = -185;
if (yScrollOffset >= 325 && row == "3") {
yPosOffSet = 25;
} else {
if (yScrollOffset >= 546 && (row == "10" || row == "9")) {
yPosOffSet = 25;
}
}
}
}
}
}
if (action == "mouseover" && popUpHTML != "") {
if (aCabinClass[activeSegmentIndex] != selectedClass) {
if (upgrade) {
if (fareFormatType == "Dollars") {
upgradeCost = currencyCodeDollar + upgradeCost.split(".")[0] + ".00";
} else {
upgradeCost = upgradeCost.split(".")[0] + " points";
}
}
updatePopup(popUpHTML, popUpTitle, 350, seatObject, false, -150, yPosOffSet, false, upgradeCost);
}
}
if (action == "mouseout") {
closePopup("popupId");
}
}
function changeGuestSegment(type, guest, segment, isPageRefresh, sessionLegIndex, elementId) {
var prevActiveSegment = activeSegment;
var currentActiveGuest = activeGuest;
if (type == "changeGuest") {
if (guest != 99) {
activeGuest = guest;
activeGuestIndex = guest;
}
if (segment != 99) {
activeSegment = segment;
activeSegmentIndex = segment;
}
if (segment == 99) {
activeSegment = prevActiveSegment;
activeSegmentIndex = prevActiveSegment;
activeGuest = guest;
activeGuestIndex = guest;
}
if (guest == 99) {
activeGuest = 0;
activeGuestIndex = 0;
activeSegment = segment;
activeSegmentIndex = segment;
}
var i;
var j;
for (i = 0; i < segmentCount; i++) {
document.getElementById("segment_" + i).className = "ssGuestTableInactive";
for (j = 0; j < paxCount; j++) {
document.getElementById("segmentGuest_" + i + "_" + j).className = "ssGuestTableInactive";
}
}
for (j = 0; j < paxCount; j++) {
document.getElementById("guest_" + j).className = "ssGuestTableInactive";
}
if (activeSegment != prevActiveSegment && activeSegment <= segmentCount) {
if (isPageRefresh != "true") {
reloadSeatMapForThisSegment(activeSegment, prevActiveSegment, sessionLegIndex, elementId);
}
}
document.getElementById("guest_" + activeGuestIndex).className = "ssGuestTableActive";
document.getElementById("segment_" + activeSegmentIndex).className = "ssGuestTableActive";
for (j = 0; j < paxCount; j++) {
document.getElementById("segmentGuest_" + activeSegmentIndex + "_" + j).className = "ssGuestTableActive";
}
for (k = 0; k < segmentCount; k++) {
document.getElementById("segmentGuest_" + k + "_" + activeGuestIndex).className = "ssGuestTableActive";
}
document.getElementById("segmentGuest_" + activeSegmentIndex + "_" + activeGuestIndex).className = "ssGuestTableActiveIntersect";
}
}
function setGuestSeat(seatObject, cabinClass, isExitRow, seatType, isNRSRow) {
var i;
var j;
selectedSeat = seatObject.id.substr(7);
selectedSeatClassName = seatObject.className;
selectedSeatCabinClass = "";
selectedSeatId = seatObject.id;
currentCabinClass = aCabinClass[activeSegmentIndex];
currentSeat = aGuestSeats[activeGuestIndex][activeSegmentIndex];
previousStyleClass = aPrevSeatStyle[activeGuestIndex][activeSegmentIndex];
var anotherGuestsSeat = "false";
var upgradeCost = "";
var popUpHTML = "";
var popUpWidth = "250";
var popUpTitle = "";
var popUpRecline = false;
var popUpMCSExitRow = false;
var popUpUpgrade = false;
var popUpNoUpgrade = false;
var popUpNoUpGrade = false;
if (aGuestSeats[activeGuestIndex][activeSegmentIndex] && (aGuestSeats[activeGuestIndex][activeSegmentIndex] != null && aGuestSeats[activeGuestIndex][activeSegmentIndex] != "" && aGuestSeats[activeGuestIndex][activeSegmentIndex] != notSelected)) {
currentSeat = "seatId_" + aGuestSeats[activeGuestIndex][activeSegmentIndex];
}
if (seatObject.id != currentSeat) {
if (cabinClass == "FIRST") {
selectedSeatCabinClassDisplay = "First";
selectedSeatStyleClass = "ssSeatMapFCSelected";
} else {
if (cabinClass == "MCS") {
selectedSeatCabinClassDisplay = "Main Cabin Select";
selectedSeatStyleClass = "ssSeatMapMCSSelected";
} else {
selectedSeatCabinClassDisplay = "Main Cabin";
selectedSeatStyleClass = "ssSeatMapMCSelected";
}
}
if (cabinClass == "FIRST") {
if (aCabinClass[activeSegmentIndex] == "FIRST") {
selectedSeatCabinClass = "FIRST";
} else {
popUpHTML = "html/popup-seatselect-ug-firstclass.html";
upgradeCost = upgradeAmountFirst;
popUpTitle = "First Class";
yPosOffSet = 0;
popupWidth = 518;
selectedSeatCabinClass = "FIRST";
popUpUpgrade = true;
upGradeType = "FIRST";
}
} else {
if (cabinClass == "MCS" && isExitRow == "false" && aCabinClass[activeSegmentIndex] == "ECONOMY") {
if (upgradeAmountMCS < 0 || eval(upgradeAmountMCS.replace(",", "")) == 999999) {
popUpHTML = "html/popup-seatselect-mcs-cannot-upgrade.html";
popUpTitle = "Main Cabin Select";
popupWidth = 400;
yPosOffSet = 0;
popUpUpgrade = false;
popUpNoUpGrade = true;
} else {
popUpHTML = "html/popup-seatselect-ug-maincabinselect.html";
popUpTitle = "Main Cabin Select";
upgradeCost = upgradeAmountMCS;
yPosOffSet = 0;
popupWidth = 518;
selectedSeatCabinClass = "MCS";
popUpUpgrade = true;
upGradeType = "MCS";
}
} else {
if (cabinClass == "MCS" && isExitRow == "true") {
popupWidth = 518;
if (upgradeAmountMCS < 0 || (eval(upgradeAmountMCS.replace(",", "")) == 999999 && aCabinClass[activeSegmentIndex] == "ECONOMY")) {
popUpHTML = "html/popup-seatselect-mcs-cannot-upgrade.html";
popUpTitle = "Main Cabin Select";
popupWidth = 350;
yPosOffSet = -150;
popUpUpgrade = false;
popUpMCSExitRow = false;
popUpNoUpGrade = true;
} else {
if (aCabinClass[activeSegmentIndex] == "MCS") {
if (restrictGuestArr[activeGuestIndex] && (restrictGuestArr[activeGuestIndex] == "restrict" || restrictGuestArr[activeGuestIndex] == "fullRestrict")) {
popUpHTML = "html/popup-seatselect-restricted.html";
popupWidth = 375;
} else {
popUpHTML = "html/popup-seatselect-maincabinselect-exitrow.html";
}
popUpMCSExitRow = true;
} else {
upgradeCost = upgradeAmountMCS;
upGradeType = "MCS";
if (restrictGuestArr[activeGuestIndex] && (restrictGuestArr[activeGuestIndex] == "restrict" || restrictGuestArr[activeGuestIndex] == "fullRestrict")) {
popUpHTML = "html/popup-seatselect-restricted.html";
popupWidth = 375;
popUpMCSExitRow = true;
} else {
popUpHTML = "html/popup-seatselect-ug-maincabinselect-exitrow.html";
popUpUpgrade = true;
}
}
}
popUpTitle = "Main Cabin Select";
yPosOffSet = 0;
selectedSeatCabinClass = "MCS";
} else {
if (cabinClass == "ECONOMY" && isNRSRow == "true") {
popUpRecline = true;
popUpHTML = "html/popup-seatselect-recline.html";
popUpTitle = "FAA Restrictions";
yPosOffSet = 0;
popupWidth = 400;
selectedSeatCabinClass = "ECONOMY";
}
}
}
}
selectedSeatType = seatType;
selectedSeatCabinClassDisplay = selectedSeatCabinClassDisplay + "/" + selectedSeatType;
for (i = 0; i < paxCount; i++) {
if (aGuestSeats[i][activeSegmentIndex] == selectedSeat) {
anotherGuestsSeat = "true";
}
}
if (anotherGuestsSeat == "false") {
if (popUpUpgrade) {
closePopup("popupId");
newSeatNumber = selectedSeat;
seatTypeUpgrade = seatType;
if (fareFormatType == "Dollars") {
upgradeCost = currencyCodeDollar + upgradeCost;
} else {
upgradeCost = upgradeCost.split(".")[0] + " points";
}
popupOverlay(popUpHTML, popUpTitle, popupWidth, seatObject, false, -200, yPosOffSet, false, upgradeCost);
} else {
if (popUpNoUpGrade) {
closePopup("popupId");
popupOverlay(popUpHTML, popUpTitle, popupWidth, seatObject, false, -200, yPosOffSet, false, "");
} else {
if (popUpRecline == true) {
closePopup("popupId");
popupOverlay(popUpHTML, popUpTitle, popupWidth, seatObject, false, -200, yPosOffSet, false, "", setSeat());
} else {
if (popUpRecline == true) {
closePopup("popupId");
popupOverlay(popUpHTML, popUpTitle, popupWidth, seatObject, false, -200, yPosOffSet, false, "", setSeat());
} else {
if (popUpMCSExitRow == true) {
if (fareFormatType == "Dollars") {
upgradeCost = currencyCodeDollar + upgradeCost;
}
popupOverlay(popUpHTML, popUpTitle, popupWidth, seatObject, false, -200, yPosOffSet, false, upgradeCost);
} else {
setSeat();
}
}
}
}
}
}
} else {
aGuestSeats[activeGuestIndex][activeSegmentIndex] = notSelected;
aPrevSeatStyle[activeGuestIndex][activeSegmentIndex] = "";
aSeatType[activeGuestIndex][activeSegmentIndex] = notSelected;
document.getElementById(seatObject.id).className = previousStyleClass;
var displaySeatVal = "--";
if (seatSelectPageId == 1 && aGuestSeatsOrig[activeGuestIndex][activeSegmentIndex] != "" && aGuestSeatsOrig[activeGuestIndex][activeSegmentIndex] != "Not Selected") {
displaySeatVal = aGuestSeatsOrig[activeGuestIndex][activeSegmentIndex];
displaySeatVal += "3C,3D".indexOf(displaySeatVal.toUpperCase()) >= 0 ? "*" : "";
}
document.getElementById("segmentGuest_" + activeSegmentIndex + "_" + activeGuestIndex).innerHTML = displaySeatVal;
if (seatSelectPageId == 1) {
if (eval(isUpgrSeat[activeLegIndex][activeSegmentIndex])) {
document.getElementById("Guest_" + activeLegIndex + "_" + activeSegmentIndex + "_" + activeGuestIndex).innerHTML = "Not Selected";
} else {
document.getElementById("Guest_" + activeLegIndex + "_" + activeSegmentIndex + "_" + activeGuestIndex).innerHTML = aGuestSeatsOrig[activeGuestIndex][activeSegmentIndex] != "" && aGuestSeatsOrig[activeGuestIndex][activeSegmentIndex] != "Not Selected" ? aGuestSeatsOrig[activeGuestIndex][activeSegmentIndex] : "Not Selected";
}
} else {
document.getElementById("Guest_" + activeLegIndex + "_" + activeSegmentIndex + "_" + activeGuestIndex).innerHTML = "Not Selected";
}
isReaccommodated();
}
function setSeat() {
var setSeat = "true";
for (i = 0; i < paxCount; i++) {
if (aGuestSeats[i][activeSegmentIndex] == selectedSeat) {
setSeat = "false";
break;
}
}
if (setSeat == "true") {
var selectedSeatDisplay = selectedSeat.toUpperCase();
if (currentSeat && currentSeat != notSelected && currentSeat != "") {
document.getElementById(currentSeat).className = previousStyleClass;
}
aGuestSeats[activeGuestIndex][activeSegmentIndex] = selectedSeat;
aPrevSeatStyle[activeGuestIndex][activeSegmentIndex] = seatObject.className;
aSeatType[activeGuestIndex][activeSegmentIndex] = seatType;
document.getElementById(seatObject.id).className = selectedSeatStyleClass;
var selectedSeatDisplayYTS = selectedSeatDisplay;
if (selectedSeatDisplay == "3C" || selectedSeatDisplay == "3D") {
selectedSeatDisplay = selectedSeatDisplay + "*";
}
if (seatSelectPageId == 1 && aGuestSeatsOrig[activeGuestIndex][activeSegmentIndex] != "" && aGuestSeatsOrig[activeGuestIndex][activeSegmentIndex] != "Not Selected") {
selectedSeatDisplay = '<span class="strikeOut">' + aGuestSeatsOrig[activeGuestIndex][activeSegmentIndex] + "</span> /" + selectedSeatDisplay;
}
document.getElementById("segmentGuest_" + activeSegmentIndex + "_" + activeGuestIndex).innerHTML = selectedSeatDisplay + '<br><span style="font-size:9px;font-family:arial;">' + selectedSeatCabinClassDisplay + "</span>";
if (document.getElementById("Guest_" + activeLegIndex + "_" + activeSegmentIndex + "_" + activeGuestIndex)) {
document.getElementById("Guest_" + activeLegIndex + "_" + activeSegmentIndex + "_" + activeGuestIndex).innerHTML = selectedSeatDisplayYTS;
}
setNextGuest();
isReaccommodated();
}
}
}
var methodValueReUse = "";
function upgradeSeat() {
showWaitImage();
document.seatMapForm.guestIndex.value = activeGuestIndex;
document.seatMapForm.newSeatNumber.value = newSeatNumber;
document.seatMapForm.upgradeType.value = upGradeType;
document.seatMapForm.seatType.value = seatTypeUpgrade;
document.seatMapForm.activeSegmentIndex.value = activeSegmentIndex;
document.seatMapForm.selectedSeatsForSegment.value = "";
if (methodValueReUse == null || methodValueReUse == "") {
document.seatMapForm.method.value = "seatUpgrade";
} else {
document.seatMapForm.method.value = methodValueReUse;
}
document.seatMapForm.submit();
}
function setNextGuest() {
var assignedSeatCount = 0;
for (i = 0; i < paxCount; i++) {
if (aGuestSeats[i][activeSegmentIndex] == null || aGuestSeats[i][activeSegmentIndex] == "" || aGuestSeats[i][activeSegmentIndex] == notSelected) {
changeGuestSegment("changeGuest", i, activeSegmentIndex);
break;
}
}
}
function populateSelectedSeats(segmtNumber) {
var seatsForAsegment = "";
var selectedSeatNameTypes = "";
for (j = 0; j < paxCount; j++) {
var seat = aGuestSeats[j][segmtNumber];
var seatType = aSeatType[j][segmtNumber];
if (seatsForAsegment == "" || seatsForAsegment == null ) {
seatsForAsegment = seat;
} else {
seatsForAsegment = seatsForAsegment + "," + seat;
}
if (selectedSeatNameTypes == "" || selectedSeatNameTypes == null ) {
selectedSeatNameTypes = seatType;
} else {
selectedSeatNameTypes = selectedSeatNameTypes + "," + seatType;
}
}
document.seatMapForm.selectedSeatsForSegment.value = seatsForAsegment;
document.seatMapForm.selectedSeatNameTypes.value = selectedSeatNameTypes;
}
function reloadSeatMapForThisSegment(segmentId, prevActiveSegment, sessionLegIndex, elementId) {
showWaitImage();
var thetime = new Date();
var dummy = "" + thetime.getHours() + thetime.getMinutes() + thetime.getSeconds();
var nextAction = "";
if (actionVal == "seatselect" || actionVal == "postseatselect") {
methodValueReUse = "seatselect";
nextAction = "seatselect";
} else {
nextAction = actionVal;
}
myurl = nextAction + ".do?method=" + methodValueReUse + "&activeSegmentIndex=" + segmentId + "&prevActiveSegment=" + prevActiveSegment + "&ajaxCall=true";
if (actionVal == "showChangeSeatMap" || actionVal == "checkInSeatSelect") {
populateSelectedSeats(prevActiveSegment);
myurl = myurl + "&selectedSeatsForSegment=" + document.seatMapForm.selectedSeatsForSegment.value + "&selectedSeatNameTypes=" + document.seatMapForm.selectedSeatNameTypes.value + "";
}
myurl = myurl + "&dummy=" + dummy;
var seatsForAsegment = "";
var selectedSeatNameTypes = "";
for (j = 0; j < paxCount; j++) {
var seat = aGuestSeats[j][prevActiveSegment];
var seatType = aSeatType[j][prevActiveSegment];
if (seatsForAsegment == "" || seatsForAsegment == null ) {
seatsForAsegment = seat;
} else {
seatsForAsegment = seatsForAsegment + "," + seat;
}
if (selectedSeatNameTypes == "" || selectedSeatNameTypes == null ) {
selectedSeatNameTypes = seatType;
} else {
selectedSeatNameTypes = selectedSeatNameTypes + "," + seatType;
}
}
myurl = myurl + "&selectedSeatsForSegment=" + seatsForAsegment + "&selectedSeatNameTypes=" + selectedSeatNameTypes;
myurl = replaceAllFunction(myurl, " ", "%20");
$("#ssSeatMap01").load(myurl, "data:script", showLoadingImageClose);
}
function replaceAllFunction(txt, replace, with_this) {
return txt.replace(new RegExp(replace,"g"), with_this);
}
function submitTab(legIndex) {
showWaitImage();
var seatsForAsegment = "";
var selectedSeatNameTypes = "";
for (j = 0; j < paxCount; j++) {
var seat = aGuestSeats[j][activeSegmentIndex];
var seatType = aSeatType[j][activeSegmentIndex];
if (seatsForAsegment == "" || seatsForAsegment == null ) {
seatsForAsegment = seat;
} else {
seatsForAsegment = seatsForAsegment + "," + seat;
}
if (selectedSeatNameTypes == "" || selectedSeatNameTypes == null ) {
selectedSeatNameTypes = seatType;
} else {
selectedSeatNameTypes = selectedSeatNameTypes + "," + seatType;
}
}
if (!(actionVal == null || actionVal == "")) {
document.seatMapForm.action = actionVal + ".do";
}
if (!(methodValueReUse == null || methodValueReUse == "")) {
document.seatMapForm.method.value = methodValueReUse;
}
document.seatMapForm.selectedSeatsForSegment.value = seatsForAsegment;
document.seatMapForm.selectedSeatNameTypes.value = selectedSeatNameTypes;
document.seatMapForm.tabSelected.value = legIndex;
document.seatMapForm.activeSegmentIndex.value = activeLegIndex;
document.seatMapForm.submit();
}
function handleTabs() {
var tabId = "tab_" + activeLegIndex;
var tripId = "tab_trip_" + activeLegIndex;
var labelId = "tab_label_" + activeLegIndex;
if (document.getElementById(tabId) && document.getElementById(labelId)) {
document.getElementById(tabId).className = "fsTripTypeActive";
document.getElementById(tripId).className = "fsTripTypeNumActive";
document.getElementById(labelId).className = "fsTripTypeLabelActive";
}
disableOtherTabs();
function disableOtherTabs() {
for (i = 0; i < oandDCount; i++) {
if (i != activeLegIndex) {
var tabId = "tab_" + i;
var tripId = "tab_trip_" + i;
var labelId = "tab_label_" + i;
if (document.getElementById(tabId) && document.getElementById(labelId)) {
document.getElementById(tabId).className = "fsTripTypeInactive";
document.getElementById(tripId).className = "fsTripTypeNumInactive";
document.getElementById(labelId).className = "fsTripTypeLabelInactive";
}
}
}
}
}
function validateExitRow(functionType) {
var checkBoxObject = document.getElementById("ssExitRowAccept");
if (checkBoxObject.value == "0") {
var divObject = document.getElementById("exitRowErrorDiv");
var errorMsg = '<table width="100%"><tr><td>';
errorMsg += '<img src="/web/20110901145833/https://static.virginamerica.com/images/esc-sign.gif">';
errorMsg += '</td><td class="font11 validationDefault fontBold">';
errorMsg += "To select this seat, please check the box below to accept the terms and conditions";
errorMsg += "</td></tr></table>";
divObject.style.display = "block";
divObject.innerHTML = errorMsg;
document.getElementById("ssExitRowAcceptContainer").style.backgroundColor = "#993399";
document.getElementById("exitRowTC").className = "validationDefault fontBold";
} else {
closePopup("popupOverlayBg");
if (functionType == "setUpgrade") {
upgradeSeat();
} else {
assignSeat();
}
}
}
function assignSeat() {
var setSeat = "true";
for (i = 0; i < paxCount; i++) {
if (aGuestSeats[i][activeSegmentIndex] == selectedSeat) {
setSeat = "false";
break;
}
}
if (setSeat == "true") {
var selectedSeatDisplay = selectedSeat.toUpperCase();
if (currentSeat && currentSeat != notSelected && currentSeat != "") {
document.getElementById(currentSeat).className = previousStyleClass;
}
if (selectedSeatCabinClass == "FIRST") {
selectedSeatStyleClass = "ssSeatMapFCSelected";
} else {
if (selectedSeatCabinClass == "MCS") {
selectedSeatStyleClass = "ssSeatMapMCSSelected";
} else {
if (selectedSeatCabinClass == "ECONOMY") {
selectedSeatStyleClass = "ssSeatMapMCSelected";
}
}
}
aGuestSeats[activeGuestIndex][activeSegmentIndex] = selectedSeat;
aSeatType[activeGuestIndex][activeSegmentIndex] = selectedSeatType;
aCabinClass[activeSegmentIndex] = selectedSeatCabinClass;
document.getElementById(selectedSeatId).className = selectedSeatStyleClass;
var selectedSeatDisplayYTS = selectedSeatDisplay;
if (selectedSeatDisplay == "3C" || selectedSeatDisplay == "3D") {
selectedSeatDisplay = selectedSeatDisplay + "*";
}
if (seatSelectPageId == 1 && aGuestSeatsOrig[activeGuestIndex][activeSegmentIndex] != "" && aGuestSeatsOrig[activeGuestIndex][activeSegmentIndex] != "Not Selected") {
selectedSeatDisplay = '<span class="strikeOut">' + aGuestSeatsOrig[activeGuestIndex][activeSegmentIndex] + "</span> /" + selectedSeatDisplay;
}
document.getElementById("segmentGuest_" + activeSegmentIndex + "_" + activeGuestIndex).innerHTML = selectedSeatDisplay + '<br><span style="font-size:9px;font-family:arial;">' + selectedSeatCabinClassDisplay + "</span>";
aPrevSeatStyle[activeGuestIndex][activeSegmentIndex] = selectedSeatClassName;
document.getElementById("Guest_" + activeLegIndex + "_" + activeSegmentIndex + "_" + activeGuestIndex).innerHTML = selectedSeatDisplayYTS;
setNextGuest();
isReaccommodated();
}
}
function toggleExitRow() {
var checkBoxObj = document.getElementById("ssExitRowAccept");
if (checkBoxObj.value == "0") {
checkBoxObj.value = "1";
} else {
checkBoxObj.value = "0";
}
}
function goBack() {
document.barForm.method.value = "flightSearchTabLink";
document.barForm.tabSelect.value = "2";
if (actionVal == "seatselect") {
document.barForm.action = "flightSearchTabLink.do";
} else {
if (actionVal == "postseatselect") {
document.barForm.action = "postFlightSearchTabLink.do";
}
}
showWaitImage();
document.barForm.submit();
}
function nextPage() {
showWaitImage();
var seatsForAsegment = "";
var selectedSeatNameTypes = "";
for (j = 0; j < paxCount; j++) {
var seat = aGuestSeats[j][activeSegmentIndex];
var seatType = aSeatType[j][activeSegmentIndex];
if (seatsForAsegment == "" || seatsForAsegment == null ) {
seatsForAsegment = seat;
} else {
seatsForAsegment = seatsForAsegment + "," + seat;
}
if (selectedSeatNameTypes == "" || selectedSeatNameTypes == null ) {
selectedSeatNameTypes = seatType;
} else {
selectedSeatNameTypes = selectedSeatNameTypes + "," + seatType;
}
}
document.seatMapForm.selectedSeatsForSegment.value = seatsForAsegment;
document.seatMapForm.selectedSeatNameTypes.value = selectedSeatNameTypes;
document.seatMapForm.method.value = "viewPricing";
if (actionVal == "seatselect") {
document.seatMapForm.action = "viewPricing.do";
} else {
document.seatMapForm.action = "postViewPricing.do";
}
document.seatMapForm.submit();
}
function selectNextFlightSeats() {
showWaitImage();
var seatsForAsegment = "";
var selectedSeatNameTypes = "";
for (j = 0; j < paxCount; j++) {
var seat = aGuestSeats[j][activeSegmentIndex];
var seatType = aSeatType[j][activeSegmentIndex];
if (seatsForAsegment == "" || seatsForAsegment == null ) {
seatsForAsegment = seat;
} else {
seatsForAsegment = seatsForAsegment + "," + seat;
}
if (selectedSeatNameTypes == "" || selectedSeatNameTypes == null ) {
selectedSeatNameTypes = seatType;
} else {
selectedSeatNameTypes = selectedSeatNameTypes + "," + seatType;
}
}
document.seatMapForm.selectedSeatsForSegment.value = seatsForAsegment;
document.seatMapForm.selectedSeatNameTypes.value = selectedSeatNameTypes;
document.seatMapForm.tabSelected.value = "1";
document.seatMapForm.activeSegmentIndex.value = activeLegIndex;
document.seatMapForm.submit();
}
function availableSeatsPreview(fltBoardPoint, fltOffPoint, fltNumber, fltDate, clickedObj) {
showWaitImage();
actionUrl = "showseatmap.do?method=seatselect&boardPoint=" + fltBoardPoint + "&offPoint=" + fltOffPoint + "&flightNumber=" + fltNumber + "&flightDate=" + fltDate;
updatePopup(actionUrl, "Seats Available on this Flight", 450, clickedObj, false, 50, -120, false);
}
function refreshDiv(url, divid, parameter, isRefresh) {
var respYts = $.post(url, parameter, done, "html");
function done() {
if (isRefresh == "true" && respYts.responseText != "") {
document.getElementById(divid).innerHTML = respYts.responseText;
if (divid == "travelExpeince") {
if (document.getElementById("totalBottom")) {
document.getElementById("totalTop").innerHTML = document.getElementById("totalBottom").innerHTML;
}
}
}
closeWaitImage();
}
}
function addGiftVoucher(id, div) {
showWaitImage();
saveTravelInsurance();
var travelInsuranceFlagRetain = travelInsuranceFlag;
var voucherNumber = document.getElementById("giftVoucherNumber").value;
var transactionNumber = document.getElementById("giftTransactionNumber").value;
var URL = "giftVoucher.do?method=add&giftVoucherNumber=" + voucherNumber + "&giftTransactionNumber=" + transactionNumber;
$.ajax({
type: "POST",
url: URL,
cache: false,
dataType: "html",
success: function(html) {
$("#" + div).html(html.trim());
if (html.trim().indexOf("errormessage_hold") != -1) {
window.scrollTo(0, 0);
}
closeWaitImage();
travelInsuranceFlag = travelInsuranceFlagRetain;
retainTravelInsurance();
}
});
}
function removeGiftVoucher(voucherNumber, id, div) {
showWaitImage();
saveTravelInsurance();
var travelInsuranceFlagRetain = travelInsuranceFlag;
var URL = "giftVoucher.do?method=remove&giftVoucherNumber=" + voucherNumber;
$.ajax({
type: "POST",
url: URL,
cache: false,
dataType: "html",
success: function(html) {
$("#" + div).html(html.trim());
travelInsuranceFlag = travelInsuranceFlagRetain;
retainTravelInsurance();
showLoadingImageClose();
}
});
}
var clearToolTipInterval;
var clearPopupInterval;
var counter = 20;
function checkPopupInterval(divid, intervalId) {
if (divid) {
divToClose = divid;
} else {
divToClose = "popupId";
}
if (intervalId) {
intervalToClear = intervalId;
} else {
intervalToClear = "clearPopUpInterval";
}
if (counter > 0) {
counter--;
} else {
closePopup(divToClose);
window.clearInterval(clearPopupInterval);
counter = 20;
}
}
function popupToolTip(pageName, title, popupWidth, clkObj, showBtn, lftMrg, rgtMrg, decision, openParameter, functionCalled) {
if (clearToolTipInterval) {
clearInterval(clearToolTipInterval);
counter = 20;
}
$("#toolTipMsgArea").load(pageName, "cache:false", toolTip);
function toolTip() {
document.getElementById("toolTipTitle").innerHTML = title;
var popupFrame = document.getElementById("toolTipFrame");
setObjOffset(clkObj, document.getElementById("toolTipId"), lftMrg, rgtMrg);
document.getElementById("toolTipId").style.display = "block";
popupFrame.style.width = eval(popupWidth);
popupFrame.style.height = document.getElementById("toolTipId").offsetHeight;
if (openParameter && openParameter != "") {
document.getElementById("toolTipOpenParameter").innerHTML = openParameter;
}
}
clearToolTipInterval = window.setInterval('checkPopupInterval("toolTipId")', 1000);
}
function f_scrollTop() {
return f_filterResults(window.pageYOffset ? window.pageYOffset : 0, document.documentElement ? document.documentElement.scrollTop : 0, document.body ? document.body.scrollTop : 0);
}
function f_filterResults(n_win, n_docel, n_body) {
var n_result = n_win ? n_win : 0;
if (n_docel && (!n_result || (n_result > n_docel))) {
n_result = n_docel;
}
return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}
function xDocSize() {
var b = document.body
, e = document.documentElement;
var esw = 0
, eow = 0
, bsw = 0
, bow = 0
, esh = 0
, eoh = 0
, bsh = 0
, boh = 0;
if (e) {
esw = e.scrollWidth;
eow = e.offsetWidth;
esh = e.scrollHeight;
eoh = e.offsetHeight;
}
if (b) {
bsw = b.scrollWidth;
bow = b.offsetWidth;
bsh = b.scrollHeight;
boh = b.offsetHeight;
}
return {
w: Math.max(esw, eow, bsw, bow),
h: Math.max(esh, eoh, bsh, boh)
};
}
function getViewableArea() {
if (parseInt(navigator.appVersion) > 3) {
if (navigator.appName == "Netscape") {
winW = window.innerWidth;
winH = window.innerHeight;
}
if (navigator.appName.indexOf("Microsoft") != -1) {
winW = document.body.offsetWidth;
winH = document.body.offsetHeight;
}
}
return winH;
}
function setLoadingAniDivLocation() {
var vHeight = getViewableArea();
var yScrollOffset = f_scrollTop();
var loaderYPosition = vHeight / 2;
loaderYPosition += yScrollOffset;
loaderYPosition += -100;
var hWidth = xDocSize().w;
var loaderXPosition = ((hWidth / 2) - 100);
var loadingAnimationObject = document.getElementById("loadingAnimationBody");
loadingAnimationObject.style.top = loaderYPosition + "px";
loadingAnimationObject.style.left = loaderXPosition + "px";
var loadingAnimationBgObject = document.getElementById("loadingAnimationBodyBg");
loadingAnimationBgObject.style.top = loaderYPosition + "px";
loadingAnimationBgObject.style.left = loaderXPosition + "px";
}
function showWaitImage() {
var vHeight = getViewableArea();
var yScrollOffset = f_scrollTop();
var loaderYPosition = vHeight / 2;
loaderYPosition += yScrollOffset;
loaderYPosition += -100;
var hWidth = xDocSize().w;
var loaderXPosition = ((hWidth / 2) - 110);
if (document.getElementById("loadingAnimationDiv")) {
document.getElementById("loadingAnimationDiv").style.top = "0px";
document.getElementById("loadingAnimationDiv").style.left = "0px";
document.getElementById("loadingAnimationDiv").style.width = hWidth + "px";
document.getElementById("loadingAnimationDiv").style.height = vHeight + "px";
document.getElementById("loadingAnimationDiv").style.display = "block";
document.getElementById("loadingAnimationDisableDiv").style.display = "block";
document.getElementById("loadingAnimationBody").style.left = loaderXPosition;
document.getElementById("loadingAnimationBody").style.top = loaderYPosition;
document.getElementById("loadingAnimationBodyBg").style.left = loaderXPosition;
document.getElementById("loadingAnimationBodyBg").style.top = loaderYPosition;
if (isPCIE6 == 1) {
document.getElementById("loadingDivIFrame").style.top = "0px";
document.getElementById("loadingDivIFrame").style.left = "0px";
document.getElementById("loadingDivIFrame").style.height = xDocSize().h;
document.getElementById("loadingDivIFrame").style.width = hWidth;
document.getElementById("loadingDivIFrame").style.display = "block";
}
}
}
function closeWaitImage() {
if (document.getElementById("loadingAnimationDiv")) {
document.getElementById("loadingAnimationDiv").style.display = "none";
}
}
function getPageSizeWithScroll() {
if (window.innerHeight && window.scrollMaxY) {
yWithScroll = window.innerHeight + window.scrollMaxY;
xWithScroll = window.innerWidth + window.scrollMaxX;
} else {
if (document.body.scrollHeight > document.body.offsetHeight) {
yWithScroll = document.body.scrollHeight;
xWithScroll = document.body.scrollWidth;
} else {
yWithScroll = document.body.offsetHeight;
xWithScroll = document.body.offsetWidth;
}
}
arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
return arrayPageSizeWithScroll;
}
function popupElevateInturrupt() {
var vHeight = getViewableArea();
var yScrollOffset = f_scrollTop();
var loaderYPosition = vHeight / 2;
loaderYPosition += yScrollOffset;
loaderYPosition += -100;
var hWidth = xDocSize().w;
var hHeight = xDocSize().h;
var loaderXPosition = 500;
loaderXPosition = loaderXPosition - 280;
var footerObj = document.getElementById("pageLengthIdentifier");
var footerY = 0;
if (isPCIE == 1 || isSafari == 1) {
var ieOffset = 150;
} else {
if (isMacFF == 1) {
var ieOffset = -250;
} else {
var ieOffset = 100;
}
}
var test = getPageSizeWithScroll();
footerY = arrayPageSizeWithScroll[1] + ieOffset;
if (document.getElementById("elevateInterruptDiv")) {
var inturruptObj = document.getElementById("elevateInterruptDiv");
var inturruptDivObj = document.getElementById("elevateOverlayId");
var inturruptOverlayDivObj = document.getElementById("elevateOverlayBg");
var inturruptIFrameObj = document.getElementById("popupOverlayFrame");
inturruptOverlayDivObj.style.height = footerY + "px";
inturruptDivObj.style.left = loaderXPosition;
inturruptDivObj.style.top = loaderYPosition;
inturruptObj.style.display = "block";
if (isPCIE6 == 1) {
document.getElementById("popupOverlayFrameForIE6").style.display = "block";
}
if (isSafari) {
inturruptOverlayDivObj.style.width = "100%";
}
}
}
function popupOverlay(pageName, title, popupWidth, clkObj, showBtn, lftMrg, rgtMrg, decision, openParameter, functionCalled) {
$("#popupOverlayMsgArea").load(pageName, "", overlay);
function overlay() {
var yScrollOffset = f_scrollTop();
var pageWidth = xDocSize().w;
var pageHeight = xDocSize().h;
var vHeight = getViewableArea();
var xOffSet = popupWidth / 2;
var xLocation = (pageWidth / 2);
xLocation = xLocation - xOffSet;
var yLocation = (vHeight / 2);
yLocation += yScrollOffset;
document.getElementById("popupOverlayTitle").innerHTML = title;
var popupElement = document.getElementById("popupOverlayTable");
var popupFrame = document.getElementById("popupOverlayFrame");
var popupDiv = document.getElementById("popupOverlayBg");
popupElement.style.width = eval(popupWidth);
popupFrame.style.width = eval(popupWidth) - 30;
popupFrame.style.height = popupElement.style.height;
popupDiv.style.height = pageHeight;
if (fareFormatType == "Dollars") {
openParameter = replaceAllFunction(openParameter, ",", "");
openParameter = openParameter.split(".")[0] + ".00";
}
document.getElementById("popupOverlayId").style.left = "50%";
document.getElementById("popupOverlayId").style.top = yLocation;
document.getElementById("popupOverlayBg").style.top = 0;
document.getElementById("popupOverlayBg").style.width = pageWidth + "px";
document.getElementById("popupOverlayBg").style.display = "block";
if (openParameter && openParameter != "") {
if (document.getElementById("popUpOverlayOpenParameter")) {
document.getElementById("popUpOverlayOpenParameter").innerHTML = openParameter;
}
}
}
}
function ciCollapseExpand(divId, btnObject) {
var divObject = document.getElementById(divId);
if (divObject.style.display == "none") {
document.getElementById(divId).style.display = "block";
btnObject.src = "/web/20110901145833/https://static.virginamerica.com/images/btn-checkin-collapse.png";
} else {
document.getElementById(divId).style.display = "none";
btnObject.src = "/web/20110901145833/https://static.virginamerica.com/images/btn-checkin-expand.png";
}
}
function toggleExtraFees(divId) {
var exDiv = document.getElementById(divId);
if (exDiv.style.display == "block") {
exDiv.style.display = "none";
} else {
exDiv.style.display = "block";
}
}
function showDiv(divId) {
var exDiv = document.getElementById(divId);
exDiv.style.display = "block";
}
function hideDiv(divId) {
var exDiv = document.getElementById(divId);
exDiv.style.display = "none";
}
function togglePlusMinus(imgObject) {
if (imgObject.src.indexOf("plus") != -1) {
imgObject.src = "/web/20110901145833/https://static.virginamerica.com/images/icon-minus.png";
} else {
imgObject.src = "/web/20110901145833/https://static.virginamerica.com/images/icon-plus.png";
}
}
function toggleTravelOptionsFlights(newActiveFlight, tabObject) {
for (i = 1; i <= flightCount; i++) {
document.getElementById("fsTripTypeBg0" + i).className = "fsTripTypeInactive";
document.getElementById("fsTripTypeNum0" + i).className = "fsTripTypeNumInactive";
document.getElementById("fsTripTypeLabel0" + i).className = "fsTripTypeLabelInactive";
document.getElementById("toFlight0" + i).style.display = "none";
}
tabObject.className = "fsTripTypeActive";
document.getElementById("fsTripTypeNum0" + newActiveFlight).className = "fsTripTypeNumActive";
document.getElementById("fsTripTypeLabel0" + newActiveFlight).className = "fsTripTypeLabelActive";
document.getElementById("toFlight0" + newActiveFlight).style.display = "block";
}
function imgRollOver(imgObject) {
var imageDir = "";
var imageObj = imgObject.src.substr(imgObject.src.indexOf("images/") + 7);
var imageName = imageObj.substr(0, imageObj.indexOf("."));
var imageType = imageObj.substr(imageObj.indexOf("."));
if (imageName.indexOf("/") != -1) {
imageDir = imageName.substr(0, imageName.indexOf("/") + 1);
imageName = imageName.substr(imageName.indexOf("/") + 1);
}
imgObject.src = "/web/20110901145833/https://static.virginamerica.com/images/" + imageDir + imageName + "-roll" + imageType;
}
function imgRollOut(imgObject) {
var imageDir = "";
var imageObj = imgObject.src.substr(imgObject.src.indexOf("images/") + 7);
var imageName = imageObj.substr(0, imageObj.indexOf("-roll."));
var imageType = imageObj.substr(imageObj.indexOf("."));
if (imageName.indexOf("/") != -1) {
imageDir = imageName.substr(0, imageName.indexOf("/") + 1);
imageName = imageName.substr(imageName.indexOf("/") + 1);
}
imgObject.src = "/web/20110901145833/https://static.virginamerica.com/images/" + imageDir + imageName + imageType;
}
function btnRoll(buttonObject, btnClassName) {
buttonObject.className = btnClassName;
}
var nextDayFlight = new Array(1);
var ajaxDiv;
var seatActionUrl = "seatSelectNew.do";
var fltsInfoIdx = 0;
var fromNextDayMsg = false;
function popFSDivs(e, divID, index) {
var posx = 0;
var posy = 0;
var xOffset = 0;
var yOffset = 0;
var AllPopUpX = 0;
var AllPopUpY = 0;
var obj = document.getElementById("mcPopUpInfoIconDeparture0" + index);
var objFareDetails = document.getElementById("btnFareDetails01");
xOffset = 120;
yOffset = 0;
if (divID == "popupGovFeesAndTaxes") {
obj = document.getElementById("lnkGovernmentFeeTaxes");
yOffset = -130;
}
if (!e) {
var e = window.event;
}
if (e.pageX || e.pageY) {
posx = e.pageX;
} else {
if (e.clientX || e.clientY) {
posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
}
}
if (obj && obj.offsetParent) {
while (obj.offsetParent) {
posy += obj.offsetTop;
obj = obj.offsetParent;
}
} else {
if (obj && obj.x) {
posy += obj.y;
}
}
if (objFareDetails.offsetParent) {
while (objFareDetails.offsetParent) {
AllPopUpX += objFareDetails.offsetLeft;
AllPopUpY += objFareDetails.offsetTop;
objFareDetails = objFareDetails.offsetParent;
}
} else {
if (objFareDetails.x) {
AllPopUpX += objFareDetails.x;
AllPopUpY += objFareDetails.y;
}
}
xOffset = 120;
yOffset = 0;
if (divID == "mcPopUp" || divID == "mcRefundPopUp" || divID == "mcsIuPopUp" || divID == "mcsPopUp" || divID == "fcPopUp" || divID == "fcrPopUp") {
yOffset = 26;
}
if (divID == "allPopUp") {
posx = AllPopUpX - 400;
posy = AllPopUpY + 20;
}
document.getElementById("mcsIuPopUp").style.visibility = "hidden";
document.getElementById("mcsPopUp").style.visibility = "hidden";
document.getElementById("mcPopUp").style.visibility = "hidden";
document.getElementById("mcRefundPopUp").style.visibility = "hidden";
document.getElementById("fcPopUp").style.visibility = "hidden";
document.getElementById("fcrPopUp").style.visibility = "hidden";
document.getElementById("allPopUp").style.visibility = "hidden";
document.getElementById(divID).style.left = (posx - xOffset);
document.getElementById(divID).style.top = (posy + yOffset);
document.getElementById(divID).style.visibility = "visible";
}
function popFSDivsClose(divID) {
if (document.getElementById(divID).style.visibility == "visible") {
document.getElementById(divID).style.visibility = "hidden";
}
}
function toggleModifySearchDiv() {
if (document.getElementById("fsModifySearch").style.display == "block") {
document.getElementById("fsModifySearch").style.display = "none";
document.getElementById("modifySearchArrow").src = "/web/20110901145833/https://static.virginamerica.com/images/fareselect-modifysearch-rightarrow-red.gif";
} else {
document.getElementById("fsModifySearch").style.display = "block";
document.getElementById("modifySearchArrow").src = "/web/20110901145833/https://static.virginamerica.com/images/fareselect-modifysearch-downarrow-red.gif";
}
}
function toggleActiveCell(thisActiveCell, thisActiveRadio, idx) {
var currentActiveCell = document.getElementById(("activeCell" + idx)).value;
var currentActiveRadio = document.getElementById(("activeRadio" + idx)).value;
var currentClass = currentActiveCell.split("|")[2];
if (currentActiveCell && currentActiveCell != "") {
if (currentClass == "MCS" || currentClass == "IUMCS") {
document.getElementById(currentActiveCell).className = "fsTableCellMCS";
} else {
if (currentClass == "FC") {
document.getElementById(currentActiveCell).className = "fsTableCellFC";
} else {
document.getElementById(currentActiveCell).className = "fsTableCell";
}
}
}
if (currentActiveRadio && currentActiveRadio != "") {
document.getElementById(currentActiveRadio).checked = false;
}
document.getElementById(thisActiveCell).className = "fsTableCellActive";
document.getElementById(thisActiveRadio).checked = true;
document.getElementById(("activeCell" + idx)).value = thisActiveCell;
document.getElementById(("activeRadio" + idx)).value = thisActiveRadio;
}
function changeFlightTab(index, currentId, buttonId, isInternational) {
var checkDepart = true;
if (isInternational && isInternational == "true") {
if (!document.getElementById("flightNumber0") && index > 0) {
checkDepart = false;
}
}
if (checkDepart) {
toggleFlightsInfo(index);
toggleActiveTab(currentId);
toggleActiveButtons(buttonId);
} else {
updatePopup("html/popup-fareselect-choosedepartfirst.html", "Select Departing Flight", 350, document.getElementById("pageHeaderBar"), false, 170, 50, false);
}
if (document.getElementById("flight0")) {
document.getElementById("flight0").style.display = "none";
}
if (document.getElementById("flight1")) {
document.getElementById("flight1").style.display = "none";
}
if (document.getElementById("flight" + index)) {
document.getElementById("flight" + index).style.display = "block";
}
}
function toggleFlightsInfo(index) {
currentId = "flightInfo" + index;
var buttonId = "button" + index;
var objs = document.getElementById("fareSelectFlightList").getElementsByTagName("div");
for (i = 0; i < objs.length; i++) {
if (objs[i].id == currentId) {
fltsInfoIdx = index;
objs[i].style.display = "block";
document.getElementById("routeInfo").innerHTML = document.getElementById(("routeInfo" + index)).innerHTML;
document.getElementById(buttonId).style.display = "block";
} else {
if ((objs[i].id).indexOf("flightInfo") >= 0) {
objs[i].style.display = "none";
$("#button" + i).hide();
}
}
}
}
function toggleActiveTab(currentId) {
var objs = document.getElementById("allTabs").getElementsByTagName("td");
for (i = 0; i < objs.length; i++) {
if (objs[i].id == currentId) {
toggleClass(objs[i], "Active");
} else {
if ((objs[i].id).indexOf("tab") >= 0) {
toggleClass(objs[i], "Inactive");
}
}
}
function toggleClass(obj, classType) {
obj.className = "fsTripType" + classType;
var tdObjs = obj.getElementsByTagName("table")[0].getElementsByTagName("tr")[0].getElementsByTagName("td");
for (j = 0; j < tdObjs.length; j++) {
if (tdObjs[j].className.indexOf("fsTripTypeNum") >= 0) {
tdObjs[j].className = "fsTripTypeNum" + classType;
} else {
if (tdObjs[j].className.indexOf("fsTripTypeLabel") >= 0) {
tdObjs[j].className = "fsTripTypeLabel" + classType;
}
}
}
}
}
function toggleActiveButtons(currentId) {
var objs = document.getElementById("continueBtns").getElementsByTagName("div");
for (i = 0; i < objs.length; i++) {
if (objs[i].id == currentId) {
objs[i].style.display = "block";
} else {
if ((objs[i].id).indexOf("button") >= 0) {
objs[i].style.display = "none";
}
}
}
}
function loadFareDetails(fareId, radioValue, flightNumber, airport, fareFormatType, fareLevel, fareBasisCode, mainPoints, mcsPoints, firstPoints, nextDayFlightInd) {
myUrl = "loadFareQuote.do?method=loadFareQuote&fareId=" + fareId + "&fare=" + radioValue + "&flightNumber=" + flightNumber + "&airportName=" + airport + "&fareLevel=" + fareLevel + "&fareFormatType=" + fareFormatType + "&fareBasisCode=" + fareBasisCode + "&mainPoints=" + mainPoints + "&mcsPoints=" + mcsPoints + "&firstPoints=" + firstPoints;
$("#nextDayMsgOKbtn").unbind("click");
$("#nextDayMsgCancelbtn").unbind("click");
if (document.getElementById("errorDiv")) {
document.getElementById("errorDiv").innerHTML = "";
}
fltsInfoIdx = eval(fareId.split("|")[0]);
if (nextDayFlightInd == "true" && (document.getElementById("overNightFlightMessage").style.display == "none" || !fromNextDayMsg)) {
$("#overNightFlightMessage").css({
top: ($(document.getElementById(fareId + "|R")).offset().top - 60) + "px",
left: ($(document.getElementById(fareId + "|R")).offset().left - 110) + "px"
});
$("#nextDayMsgOKbtn").click(function() {
fromNextDayMsg = true;
$(document.getElementById(fareId)).trigger("click");
nextDayFlight[fltsInfoIdx] = true;
$("#overNightFlightMessage").hide();
});
$("#nextDayMsgCancelbtn").click(function() {
if (fareId.split("|")[2] && (fareId.split("|")[2] == "MCS" || fareId.split("|")[2] == "IUMCS")) {
document.getElementById(fareId).className = "fsTableCellMCS";
} else {
if (fareId.split("|")[2] && fareId.split("|")[2] == "FC") {
document.getElementById(fareId).className = "fsTableCellFC";
} else {
document.getElementById(fareId).className = "fsTableCell";
}
}
document.getElementById(fareId + "|R").checked = false;
if (document.getElementById(("activeCell" + fltsInfoIdx)) && document.getElementById(("activeCell" + fltsInfoIdx)).value != "") {
var selectedCell = document.getElementById(("activeCell" + fltsInfoIdx)).value;
toggleActiveCell(selectedCell, selectedCell + "|R", fltsInfoIdx);
}
$("#overNightFlightMessage").hide();
});
$("#overNightFlightMessage").show();
return;
} else {
nextDayFlight[fltsInfoIdx] = false;
}
toggleActiveCell(fareId, fareId + "|R", fltsInfoIdx);
showWaitImage();
fromNextDayMsg = false;
$("#overNightFlightMessage").hide();
disableSelectPage();
if (window.populateOmnitureElements) {
populateOmnitureElements(fltsInfoIdx, airport);
}
if (document.getElementById("postTravelExpeince")) {
ajaxSelect(myUrl, "postTravelExpeince", fareFormatType);
} else {
ajaxSelect(myUrl, "travelExpeince", fareFormatType);
}
}
function disableSelectPage() {
pageSize = getPageSizeWithScroll();
document.getElementById("disableTotalPage").style.width = pageSize[0];
document.getElementById("disableTotalPage").style.height = pageSize[1];
document.getElementById("disableTotalPage").style.left = "0";
document.getElementById("disableTotalPage").style.top = "0";
document.getElementById("disableTotalPage").style.display = "block";
}
function ajaxSelect(myurl, div, fareFormatType) {
var thetime = new Date();
var dummy = "" + thetime.getHours() + thetime.getMinutes() + thetime.getSeconds();
myurl = myurl + "&dummy=" + dummy;
ajaxDiv = div;
fareFormatTypePage = fareFormatType;
xmlhttp.open("POST", myurl, true);
xmlhttp.onreadystatechange = handleResponseSelect;
xmlhttp.send("");
}
function handleResponseSelect() {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/, "");
}
;
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
if ((xmlhttp.responseText).trim() == "AjaxSessionTimeOut") {
window.location = "/home.do?method=virginAmerica&sessionState=sessionTimeOut";
} else {
if ((xmlhttp.responseText).trim() == "AjaxError") {
window.location = "/home.do?method=virginAmerica&fromErrorPage=fromErrorPage";
} else {
if ((xmlhttp.responseText).trim() == "InventoryUpdate" || ((xmlhttp.responseText).length > 4 && (xmlhttp.responseText).substring(0, 5) == "error")) {
if ((xmlhttp.responseText).trim() == "InventoryUpdate") {
document.getElementById("VF_popup").style.display = "block";
} else {
document.getElementById("errorDiv").style.display = "block";
document.getElementById("errorDiv").innerHTML = '<table><tr><td><img src="/web/20110901145833/https://static.virginamerica.com/images/esc-sign.gif" width="40" height="35" alt="" ></td><td><span class="validationDefault">' + (xmlhttp.responseText).substring(6) + "</span></td></tr></table>";
}
if (nextDayFlight[fltsInfoIdx]) {
nextDayFlight[fltsInfoIdx] = false;
}
if (document.getElementById(("activeCell" + fltsInfoIdx)) && document.getElementById(("activeCell" + fltsInfoIdx)).value != "") {
document.getElementById(document.getElementById(("activeCell" + fltsInfoIdx)).value).className = "fsTableCell";
}
if (document.getElementById(("activeRadio" + fltsInfoIdx)) && document.getElementById(("activeRadio" + fltsInfoIdx)).value != "") {
document.getElementById(document.getElementById(("activeRadio" + fltsInfoIdx)).value).checked = false;
}
} else {
if (xmlhttp.responseText.indexOf("esc-sign") >= 0 || xmlhttp.responseText.indexOf("escSignImg") >= 0) {
document.getElementById("errorDiv").style.display = "block";
document.getElementById("errorDiv").innerHTML = xmlhttp.responseText;
document.getElementById("loadingAnimationDiv").style.display = "none";
if (nextDayFlight[fltsInfoIdx]) {
nextDayFlight[fltsInfoIdx] = false;
}
if (document.getElementById(("activeCell" + fltsInfoIdx)) && document.getElementById(("activeCell" + fltsInfoIdx)).value != "") {
document.getElementById(document.getElementById(("activeCell" + fltsInfoIdx)).value).className = "fsTableCell";
}
if (document.getElementById(("activeRadio" + fltsInfoIdx)) && document.getElementById(("activeRadio" + fltsInfoIdx)).value != "") {
document.getElementById(document.getElementById(("activeRadio" + fltsInfoIdx)).value).checked = false;
}
} else {
document.getElementById(ajaxDiv).innerHTML = xmlhttp.responseText;
if (ajaxDiv == "travelExpeince") {
if (document.getElementById("totalBottom")) {
document.getElementById("totalTop").innerHTML = document.getElementById("totalBottom").innerHTML;
}
if (fareFormatTypePage == "Points" && document.getElementById("pointsBottom")) {
document.getElementById("pointsTop").innerHTML = document.getElementById("pointsBottom").innerHTML;
}
ajax("updateTitleBar.do?method=updateTitleBar", "titleBarDiv");
}
if (ajaxDiv == "postTravelExpeince") {
ajax("postUpdateTitleBar.do?method=updateTitleBar", "postTitleBarDiv");
document.getElementById("newFlightTotal").innerHTML = document.getElementById("totalAmountNew").innerHTML;
document.getElementById("originalFlightTotal").innerHTML = document.getElementById("totalAmountoriginal").innerHTML;
}
}
}
document.getElementById("loadingAnimationDiv").style.display = "none";
document.getElementById("disableTotalPage").style.display = "none";
setPositionTravelExp();
}
}
}
document.getElementById("disableTotalPage").style.display = "none";
}
}
function changeTravelDate(offset, OandDetailsNumber) {
fltsInfoIdx = OandDetailsNumber;
if (document.getElementById("errorDiv")) {
document.getElementById("errorDiv").innerHTML = "";
}
var positionObj = "fareSelectCarousel" + OandDetailsNumber;
showWaitImage();
myUrl = "changeTravelDateAction.do?method=changeTravelDate&oandDetailsNumber=" + OandDetailsNumber + "&offset=" + offset;
ajaxWithCache(myUrl, "fareSelectFlightList");
}
function changeWeekSubmit(OandDetailsNumber, weekStatus, oandDetailsListSize) {
fltsInfoIdx = OandDetailsNumber;
if (document.getElementById("errorDiv")) {
document.getElementById("errorDiv").innerHTML = "";
}
var positionObj = "fareSelectCarousel" + OandDetailsNumber;
myUrl = "changeWeekDateAction.do?method=changeWeekDate&oandDetailsNumber=" + OandDetailsNumber + "&weekStatus=" + weekStatus + "&oandDetailsListSize=" + oandDetailsListSize;
showWaitImage();
ajaxWithCache(myUrl, "fareSelectFlightList");
}
function showAllAndDiscountedFlights(showFlightType) {
myUrl = "showAllFlights.do?method=showAllFlights&actionFor=" + showFlightType;
showWaitImage();
ajaxWithCache(myUrl, "fareSelectFlightList");
}
function ajaxWithCache(myurl, div) {
var thetime = new Date();
var dummy = "" + thetime.getHours() + thetime.getMinutes() + thetime.getSeconds();
myurl = myurl + "&dummy=" + dummy;
ajaxDiv = div;
xmlhttp.open("POST", myurl, true);
xmlhttp.onreadystatechange = handleResponseWithCache;
xmlhttp.send("");
}
function handleResponseWithCache() {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/, "");
}
;
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
if ((xmlhttp.responseText).trim() == "AjaxSessionTimeOut") {
window.location = "/home.do?method=virginAmerica&sessionState=sessionTimeOut";
} else {
if ((xmlhttp.responseText.indexOf("esc-sign") >= 0 || xmlhttp.responseText.indexOf("escSignImg") >= 0) && xmlhttp.responseText.indexOf("fsCarouselBgActiveNotAvailable") < 0) {
document.getElementById("errorDiv").innerHTML = xmlhttp.responseText;
document.getElementById("loadingAnimationDiv").style.display = "none";
} else {
document.getElementById(ajaxDiv).innerHTML = xmlhttp.responseText;
var i = 0;
while ($(("#activeCell" + i)).length > 0 && $(("#activeCell" + i)).val() != "") {
toggleActiveCell($(("#activeCell" + i)).val(), $(("#activeCell" + i)).val() + "|R", i);
i++;
}
}
ajax("updateTitleBar.do?method=updateTitleBar", "titleBarDiv");
document.getElementById("loadingAnimationDiv").style.display = "none";
if (document.getElementById("showWIFIDep")) {
if (document.getElementById("flight0") && document.getElementById("WiFiImg0")) {
if (document.getElementById("showWIFIDep").value == "true") {
$get_JsElement("WiFiImg0").src = "/web/20110901145833/https://static.virginamerica.com/images/wifi_rightbar_10282010a.gif";
} else {
$get_JsElement("WiFiImg0").src = "/web/20110901145833/https://static.virginamerica.com/images/wifi_rightbar.gif";
}
}
}
if (document.getElementById("showWIFIRet")) {
if (document.getElementById("flight1") && document.getElementById("WiFiImg1")) {
if (document.getElementById("showWIFIRet").value == "true") {
$get_JsElement("WiFiImg1").src = "/web/20110901145833/https://static.virginamerica.com/images/wifi_rightbar_10282010a.gif";
} else {
$get_JsElement("WiFiImg1").src = "/web/20110901145833/https://static.virginamerica.com/images/wifi_rightbar.gif";
}
}
}
setPositionTravelExp();
}
toggleFlightsInfo(fltsInfoIdx);
toggleActiveButtons(("button" + fltsInfoIdx));
}
}
}
function changeFareFormatType(obj) {
document.displayPricingForm.fareType.value = obj.value;
document.displayPricingForm.oandDetailsNumber.value = fltsInfoIdx;
document.displayPricingForm.method.value = "changeFareInPointsDollar";
document.displayPricingForm.action = "changeFareInPointsDollarAction.do";
document.displayPricingForm.submit();
showWaitImage();
}
function submitSeatForm(obj) {
showWaitImage();
document.displayPricingForm.method.value = "seatselect";
document.displayPricingForm.action = seatActionUrl;
document.displayPricingForm.submit();
}
function pageOverlay(divId, title, popupWidth, clkObj, showBtn, lftMrg, rgtMrg, decision, openParameter, functionCalled) {
$("#popupOverlayMsgArea").html($("#" + divId).html());
$("#" + divId).html("");
var yScrollOffset = f_scrollTop();
var pageWidth = xDocSize().w;
var pageHeight = xDocSize().h;
var vHeight = getViewableArea();
var xOffSet = popupWidth / 2;
var xLocation = (pageWidth / 2);
xLocation = xLocation - xOffSet;
var yLocation = (vHeight / 2);
yLocation += yScrollOffset;
if (navigator.appName.indexOf("Microsoft") != -1) {
pageHeight += 340;
}
document.getElementById("popupOverlayTitle").innerHTML = title;
var popupElement = document.getElementById("popupOverlayTable");
var popupFrame = document.getElementById("popupOverlayFrame");
var popupDiv = document.getElementById("popupOverlayBg");
popupElement.style.width = eval(popupWidth);
popupFrame.style.width = eval(popupWidth);
popupDiv.style.height = pageHeight;
document.getElementById("popupOverlayId").style.left = "50%";
document.getElementById("popupOverlayId").style.top = yLocation;
document.getElementById("popupOverlayBg").style.top = 0;
document.getElementById("popupOverlayBg").style.height = pageHeight + 200 + "px";
document.getElementById("popupOverlayBg").style.width = pageWidth + "px";
document.getElementById("popupOverlayBg").style.display = "block";
if (openParameter && openParameter != "") {
document.getElementById("popUpOverlayOpenParameter").innerHTML = openParameter;
}
}
function ciToggleCheckBoxes(cmObject, cmFormId, paxCount) {
var cmState = cmObject.src;
var cmAppend = "";
var cmFlightId = cmObject.id.substr(11, 1);
var cmFlightIdIndex = cmFlightId - 1;
var cmFormTempId = "";
var cmFormTempValue = "";
var allFlightsPassSelected = 0;
if (cmObject.id.indexOf("_All") != -1) {
if (cmState.indexOf("-off") == -1) {
cmObject.src = "/web/20110901145833/https://static.virginamerica.com/images/icon-checkbox-off.png";
cmAppend = "-off";
cmFormTempValue = "na";
} else {
cmObject.src = "/web/20110901145833/https://static.virginamerica.com/images/icon-checkbox.png";
cmFormTempValue = "selected";
}
for (i = 0; i < paxCount; i++) {
if (document.getElementById("ciCheckBox0" + cmFlightId + "_0" + i).src.indexOf("restricted") == -1 && document.getElementById("ciCheckBox0" + cmFlightId + "_0" + i).src.indexOf("checkedin") == -1 && document.getElementById("ciCheckBox0" + cmFlightId + "_0" + i).src.indexOf("unavailable") == -1) {
document.getElementById("ciCheckBox0" + cmFlightId + "_0" + i).src = "/web/20110901145833/https://static.virginamerica.com/images/icon-checkbox" + cmAppend + ".png";
document.getElementById("guest" + cmFlightId + "_" + i).value = cmFormTempValue;
}
}
} else {
if (cmState.indexOf("-off") == -1) {
cmObject.src = "/web/20110901145833/https://static.virginamerica.com/images/icon-checkbox-off.png";
document.getElementById(cmFormId).value = "na";
document.getElementById("ciCheckBox0" + cmFlightId + "_All").src = "/web/20110901145833/https://static.virginamerica.com/images/icon-checkbox-off.png";
} else {
cmObject.src = "/web/20110901145833/https://static.virginamerica.com/images/icon-checkbox.png";
document.getElementById(cmFormId).value = "selected";
for (i = 0; i < paxCount; i++) {
if (document.getElementById("ciCheckBox0" + cmFlightId + "_0" + i).src.indexOf("-off") != -1) {
allFlightsPassSelected = 1;
}
}
if (allFlightsPassSelected == 0) {
document.getElementById("ciCheckBox0" + cmFlightId + "_All").src = "/web/20110901145833/https://static.virginamerica.com/images/icon-checkbox.png";
}
}
}
}
function ciCollapseExpand(divId, btnObject) {
var divObject = document.getElementById(divId);
if (divObject.style.display == "none") {
document.getElementById(divId).style.display = "block";
btnObject.src = "/web/20110901145833/https://static.virginamerica.com/images/btn-checkin-collapse.png";
} else {
document.getElementById(divId).style.display = "none";
btnObject.src = "/web/20110901145833/https://static.virginamerica.com/images/btn-checkin-expand.png";
}
}
function resetCheckBox(flightCount, guestCount) {
for (j = 0; j < flightCount; j++) {
for (i = 0; i < guestCount; i++) {
if (document.getElementById("ciCheckBox0" + j + "_0" + i)) {
if (document.getElementById("ciCheckBox0" + j + "_0" + i).src.indexOf("-off") != -1 || document.getElementById("ciCheckBox0" + j + "_0" + i).src.indexOf("-restricted") != -1) {
if (document.getElementById("ciCheckBox0" + j + "_All")) {
document.getElementById("ciCheckBox0" + j + "_All").src = "/web/20110901145833/https://static.virginamerica.com/images/icon-checkbox-off.png";
}
break;
}
}
}
}
}
function printBoardingPass(guestID, flightID, showClubHouse) {
var osdetect = OSDetect.OS;
var browserdetect = OSDetect.browser;
var url = "printBoardingPass.do?method=printBoardingPass&guestID=" + guestID + "&flightID=" + flightID + "&OSDetect=" + osdetect + "&browserdetect=" + browserdetect + "&showClubHouse=" + showClubHouse;
mywindowForHtml = window.open("/html/Virgin_America_Boarding_Pass.html", "BoardingPass", "toolbar=no,location=no,directories=no,menubar=yes,scrollbars=yes,top=" + 10 + ",left=" + 180 + ",width=" + 845 + ",height=" + 700);
ajaxToGeneratePdfHTML(url);
}
function changeTab(flightID) {
document.checkInDetailForm.method.value = "changeTab";
document.checkInDetailForm.indexID.value = flightID;
document.checkInDetailForm.submit();
}
function submitCheckInForm(methodName, flightID, actionName, guestID, flightName) {
document.checkInDetailForm.method.value = methodName;
if (flightID && flightID != "") {
document.checkInDetailForm.indexID.value = flightID;
}
if (actionName) {
if (actionName != "") {
document.checkInDetailForm.action = actionName + ".do";
}
}
if (guestID) {
if (guestID != "") {
document.checkInDetailForm.elements["checkInGuestDetails.guestID"].value = guestID;
}
}
if (flightName) {
if (flightName != "") {
document.checkInDetailForm.elements["checkInGuestDetails.flightName"].value = flightName;
}
}
document.checkInDetailForm.submit();
}
function updateCheckInTitleBar() {
var xmlHttp = null ;
xmlHttp = $.post("checkInProgressBar.jsp", "", updateTitle, "html");
function updateTitle() {
document.getElementById("postTitleBarDiv").innerHTML = xmlHttp.responseText;
closeWaitImage();
}
}
function submitCheckInReview() {
if (document.getElementById("transactionImage")) {
document.getElementById("transactionImage").style.display = "block";
}
if (document.getElementById("purchaseButton")) {
document.getElementById("purchaseButton").innerHTML = '<img src="/web/20110901145833/https://static.virginamerica.com/images/btn-purchase.png" >';
}
document.checkInDetailForm.submit();
}
function calculateBagAmount(flightID, numOfGuest) {
showWaitImage();
document.checkInDetailForm.indexID.value = flightID;
var parms = "";
var URL = "checkInAddBags.do?method=calculateBagAmount";
if (document.checkInDetailForm) {
for (var i = 0; i < document.checkInDetailForm.elements.length; i++) {
var element = document.checkInDetailForm.elements[i];
if (i == 0) {
parms = parms + element.name + "=" + element.value;
} else {
parms = parms + "&" + element.name + "=" + element.value;
}
}
}
var respYts = $.post(URL, parms, done, "html");
function done() {
if ((respYts.responseText).indexOf("errormessage_hold") == -1) {
document.getElementById("areaYTS").innerHTML = respYts.responseText;
document.getElementById("errorDiv").style.display = "none";
document.getElementById("GoOnButton").innerHTML = '<img src="/web/20110901145833/https://static.virginamerica.com/images/btn-go-on.gif" alt="Go On" alt="Go On" onmouseover="MakeCursor(this);imgRollOver(this);" onmouseout="imgRollOut(this);" onclick="javascript:document.checkInDetailForm.submit();showWaitImage();">';
updateCheckInTitleBar();
} else {
document.getElementById("errorDiv").innerHTML = respYts.responseText;
document.getElementById("errorDiv").style.display = "block";
window.scrollTo(0, 0);
document.getElementById("GoOnButton").innerHTML = '<img src="/web/20110901145833/https://static.virginamerica.com/images/btn-go-on.gif" alt="Go On" alt="Go On" >';
closeWaitImage();
}
}
}
function nextPageCheckin(actionName, methodName) {
showWaitImage();
var seatsForAsegment = "";
var selectedSeatNameTypes = "";
for (j = 0; j < paxCount; j++) {
var seat = aGuestSeats[j][activeSegmentIndex];
var seatType = aSeatType[j][activeSegmentIndex];
if (seatsForAsegment == "" || seatsForAsegment == null ) {
seatsForAsegment = seat;
} else {
seatsForAsegment = seatsForAsegment + "," + seat;
}
if (selectedSeatNameTypes == "" || selectedSeatNameTypes == null ) {
selectedSeatNameTypes = seatType;
} else {
selectedSeatNameTypes = selectedSeatNameTypes + "," + seatType;
}
}
document.seatMapForm.selectedSeatsForSegment.value = seatsForAsegment;
document.seatMapForm.selectedSeatNameTypes.value = selectedSeatNameTypes;
document.seatMapForm.method.value = methodName;
document.seatMapForm.action = actionName + ".do";
document.seatMapForm.submit();
}
function progressBar(selectedLink) {
document.progressBarForm.action = "checkInProcess.do";
if (selectedLink == "CheckInPayment" || selectedLink == "CheckInReview") {
document.progressBarForm.action = "checkInProcessSecure.do";
}
document.progressBarForm.method.value = "checkInProcess";
document.getElementById("selectedLink").value = selectedLink;
showWaitImage();
document.progressBarForm.submit();
}
function clearText(obj, textValue) {
if (textValue) {
if (obj.value == textValue) {
obj.value = "";
}
} else {
if (obj.value == "Email, Alias or Elevate#") {
obj.value = "";
}
}
}
function changeText(value, areaId) {
document.getElementById(areaId).innerHTML = value;
}
function showText(fieldObj, text) {
if ((fieldObj.value).trim() == "") {
fieldObj.value = text;
}
}
function setText(obj, textValue) {
if (obj.value == "") {
obj.value = textValue;
}
}
function increaseErrorCount(errorType, form) {
var count = 0;
if (form) {
if (errorType == "promoCode") {
count = form.promo_code_error.value;
count++;
form.promo_code_error.value = count;
}
}
}
function submitUpsellOptions(methodName, form, value, action) {
showWaitImage();
form.method.value = methodName;
if (value && value != "") {
var newObject = document.createElement("input");
newObject.name = value;
newObject.type = "hidden";
newObject.value = "on";
form.appendChild(newObject);
}
if (action && action != "") {
form.action = action + ".do";
}
form.submit();
}
function submitFromReview(form) {
if (document.getElementById("transactionImage")) {
document.getElementById("transactionImage").style.display = "block";
}
if (document.getElementById("purchaseButton")) {
document.getElementById("purchaseButton").innerHTML = '<img src="/web/20110901145833/https://static.virginamerica.com/images/btn-purchase.png" >';
}
form.submit();
}
function progressBarUpSell(selectedLink) {
document.progressBarForm.action = "upSellProcess.do";
if (selectedLink == "UPSellPayment" || selectedLink == "UPSellReview") {
document.progressBarForm.action = "upSellProcessSecure.do";
}
document.progressBarForm.method.value = "upSellProcessBar";
document.getElementById("selectedLink").value = selectedLink;
showWaitImage();
document.progressBarForm.submit();
}
function printClubHousePass() {
var osdetect = OSDetect.OS;
var browserdetect = OSDetect.browser;
var url = "printClubHousePass.do?method=getClubHousePass&OSDetect=" + osdetect + "&browserdetect=" + browserdetect;
mywindowForHtml = window.open("/html/Virgin_America_Boarding_Pass.html", "BoardingPass", "toolbar=no,location=no,directories=no,menubar=yes,scrollbars=yes,top=" + 10 + ",left=" + 180 + ",width=" + 845 + ",height=" + 700);
ajaxToGeneratePdfHTML(url);
}
function changeInputType(oldObject, oType, executeOnce, setText) {
var newObject = document.createElement("input");
newObject.type = oType;
if (oldObject.value && oldObject.type == oType) {
newObject.value = oldObject.value;
}
if (setText) {
newObject.value = setText;
}
if (oldObject.name) {
newObject.name = oldObject.name;
}
if (oldObject.id) {
newObject.id = oldObject.id;
}
if (oldObject.className) {
newObject.className = oldObject.className;
}
if (oldObject.size) {
newObject.size = oldObject.size;
}
newObject.onblur = function() {
if (newObject.value == "") {
changeInputType(newObject, "text", true, "Password");
}
}
;
newObject.onfocus = function() {
if (newObject.type == "text") {
changeInputType(newObject, "password", false);
}
}
;
newObject.onkeypress = oldObject.onkeypress;
newObject.onchange = function() {
if (document.signInForm) {
document.signInForm.password.value = newObject.value;
}
}
;
oldObject.parentNode.replaceChild(newObject, oldObject);
if (!executeOnce) {
newObject.focus();
newObject.select();
}
return newObject;
}
function submitPreferences() {
showWaitImage();
var userOptions = "";
for (optCnt = 0; optCnt < document.emailPreferencesForm.preference.length; optCnt++) {
optObject = document.emailPreferencesForm.preference[optCnt];
userOptions = userOptions + optObject.value + "-" + optObject.checked + ",";
}
document.emailPreferencesForm.preferences.value = userOptions;
document.emailPreferencesForm.submit();
}
function makeSubscription() {
myurl = "email-preference-options.do?";
for (optCnt = 0; optCnt < document.emailPreferencesForm.elements.length; optCnt++) {
optObject = document.emailPreferencesForm.elements[optCnt];
myurl = myurl + optObject.name + "=" + optObject.value + "&";
}
$("#ContainerDealsAndOffer").load(myurl, "", done);
function done() {
closeWaitImage();
}
}
function setAdultAndInfants(tripType, paxCount, fieldId) {
var adults = new Array();
var infants = new Array();
var children = new Array();
for (var i = 0; i < 10; i++) {
infants[i] = new Array();
infants[i][0] = i;
infants[i][1] = i;
}
for (var i = 0; i < 9; i++) {
children[i] = new Array();
children[i][0] = i;
children[i][1] = i;
}
for (var i = 0; i < 9; i++) {
adults[i] = new Array();
adults[i][0] = i + 1;
adults[i][1] = i + 1;
}
var thisIndex = 0;
var thisElementIdAppend = "";
if (tripType == "mc") {
thisElementIdAppend = "MC";
} else {
if (tripType == "ow") {
thisElementIdAppend = "OW";
}
}
var currentAdultCount = document.getElementById("adults" + thisElementIdAppend).value;
var currentKidsCount = document.getElementById("kids" + thisElementIdAppend).value;
var currentInfantCount = document.getElementById("infants" + thisElementIdAppend).value;
document.getElementById("adults" + thisElementIdAppend).options.length = 0;
document.getElementById("kids" + thisElementIdAppend).options.length = 0;
document.getElementById("infants" + thisElementIdAppend).options.length = 0;
var paxCeilingAdults = 9 - currentKidsCount;
var paxCeilingKids = 10 - currentAdultCount;
var paxCeilingInfants = parseInt(currentAdultCount) + 1;
for (var j = 0; j < paxCeilingAdults; j++) {
if (isFF == 1 || isMacFF == 1) {
document.getElementById("adults" + thisElementIdAppend).add(new Option(adults[j][0],adults[j][1]), null );
} else {
document.getElementById("adults" + thisElementIdAppend).add(new Option(adults[j][0],adults[j][1]));
}
}
for (var j = 0; j < paxCeilingKids; j++) {
if (isFF == 1 || isMacFF == 1) {
document.getElementById("kids" + thisElementIdAppend).add(new Option(children[j][0],children[j][1]), null );
} else {
document.getElementById("kids" + thisElementIdAppend).add(new Option(children[j][0],children[j][1]));
}
}
for (var j = 0; j < paxCeilingInfants; j++) {
if (isFF == 1 || isMacFF == 1) {
document.getElementById("infants" + thisElementIdAppend).add(new Option(infants[j][0],infants[j][1]), null );
} else {
document.getElementById("infants" + thisElementIdAppend).add(new Option(infants[j][0],infants[j][1]));
}
}
if (currentInfantCount > currentAdultCount) {
document.getElementById("infants" + thisElementIdAppend).options[currentAdultCount].selected = "selected";
if (isPCIE6 == 1) {
document.getElementById("infants" + thisElementIdAppend).options[currentAdultCount].selected = true;
}
}
if (document.getElementById("infantsMC")) {
document.getElementById("infantsMC").value = currentInfantCount;
}
if (document.getElementById("infantsOW")) {
document.getElementById("infantsOW").value = currentInfantCount;
}
if (document.getElementById("infants")) {
document.getElementById("infants").value = currentInfantCount;
}
if (document.getElementById("kidsMC")) {
document.getElementById("kidsMC").value = currentKidsCount;
}
if (document.getElementById("kidsOW")) {
document.getElementById("kidsOW").value = currentKidsCount;
}
if (document.getElementById("kids")) {
document.getElementById("kids").value = currentKidsCount;
}
if (document.getElementById("adultsMC")) {
document.getElementById("adultsMC").value = currentAdultCount;
}
if (document.getElementById("adultsOW")) {
document.getElementById("adultsOW").value = currentAdultCount;
}
if (document.getElementById("adults")) {
document.getElementById("adults").value = currentAdultCount;
}
}
function passportAddReqFieldInd(travelerNum) {
if (document.displayPurchaseForm.elements["viewPurchase.passportCountry[" + travelerNum + "]"].value != "" || document.displayPurchaseForm.elements["viewPurchase.passportNumber[" + travelerNum + "]"].value != "" || document.displayPurchaseForm.elements["viewPurchase.passportExpMonth[" + travelerNum + "]"].value != "" || document.displayPurchaseForm.elements["viewPurchase.passportExpDay[" + travelerNum + "]"].value != "" || document.displayPurchaseForm.elements["viewPurchase.passportExpYear[" + travelerNum + "]"].value != "" || document.displayPurchaseForm.elements["viewPurchase.countryOfResidence[" + travelerNum + "]"].value != "" || document.displayPurchaseForm.elements["viewPurchase.citizenship[" + travelerNum + "]"].value != "") {
document.getElementById("passportCountryTd" + travelerNum).innerHTML = 'Issuing Country <span class="redAsterisk">*</span>';
document.getElementById("passportNumberTd" + travelerNum).innerHTML = 'Passport # <span class="redAsterisk">*</span>';
document.getElementById("passportExpDateTd" + travelerNum).innerHTML = 'Passport Exp. Date <span class="redAsterisk">*</span>';
document.getElementById("countryOfResidenceTd" + travelerNum).innerHTML = 'Country of Residence <span class="redAsterisk">*</span>';
document.getElementById("citizenshipTd" + travelerNum).innerHTML = 'Citizenship <span class="redAsterisk">*</span>';
}
if (document.displayPurchaseForm.elements["viewPurchase.passportCountry[" + travelerNum + "]"].value == "" && document.displayPurchaseForm.elements["viewPurchase.passportNumber[" + travelerNum + "]"].value == "" && document.displayPurchaseForm.elements["viewPurchase.passportExpMonth[" + travelerNum + "]"].value == "" && document.displayPurchaseForm.elements["viewPurchase.passportExpDay[" + travelerNum + "]"].value == "" && document.displayPurchaseForm.elements["viewPurchase.passportExpYear[" + travelerNum + "]"].value == "" && document.displayPurchaseForm.elements["viewPurchase.countryOfResidence[" + travelerNum + "]"].value != "" && document.displayPurchaseForm.elements["viewPurchase.citizenship[" + travelerNum + "]"].value != "") {
document.getElementById("passportCountryTd" + travelerNum).innerHTML = "Issuing Country";
document.getElementById("passportNumberTd" + travelerNum).innerHTML = "Passport #";
document.getElementById("passportExpDateTd" + travelerNum).innerHTML = "Passport Exp. Date";
document.getElementById("countryOfResidenceTd" + travelerNum).innerHTML = "Country of Residence";
document.getElementById("citizenshipTd" + travelerNum).innerHTML = "Citizenship";
}
}
function setOmnitureEnv() {
var omnitureHostName = window.location.hostname;
var omnitureEnv = "vadev";
if (omnitureHostName == "www.virginamerica.com" || omnitureHostName == "virginamerica.com") {
omnitureEnv = "vatest";
}
return omnitureEnv;
}
function submitPnrData() {
$.post("viewReceipt.do?method=submitPnrData");
}
function signInPopUpOverlay(isAjax, tabNumber) {
if (document.getElementById("elevateInterruptDiv")) {
document.getElementById("elevateInterruptDiv").style.display = "none";
}
showWaitImage();
document.signInForm.action = "refer-friend.do";
document.signInForm.submit();
}
function saveTravelInsurance() {
travelInsuranceFlag = -1;
if (document.receiptForm) {
if (document.receiptForm.elements["viewPurchaseModel.travelFlag"]) {
for (i = 0; i < document.receiptForm.elements["viewPurchaseModel.travelFlag"].length; i++) {
if (document.receiptForm.elements["viewPurchaseModel.travelFlag"][i].checked == true) {
travelInsuranceFlag = i;
}
}
}
}
}
function retainTravelInsurance() {
if (document.receiptForm) {
if (document.receiptForm.elements["viewPurchaseModel.travelFlag"]) {
if (travelInsuranceFlag >= 0) {
if (document.receiptForm.elements["viewPurchaseModel.travelFlag"][travelInsuranceFlag]) {
document.receiptForm.elements["viewPurchaseModel.travelFlag"][travelInsuranceFlag].checked = true;
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment