
function smeTitleDropdown(selectedParam)
{

if (typeof selectedParam == 'undefined' || selectedParam == '')
{
selectedParam = "";
}
document.writeln('<option value="">Please select</option>');
for(var i=0; i < titleList.length; i++)
{
if(titleList[i] == selectedParam)
{
document.writeln('<option value="' + titleList[i] + '" selected>' + titleList[i] + '</option>');
}
else
{
document.writeln('<option value="' + titleList[i] + '">' + titleList[i] + '</option>');
}
}
}
function smeDropdown(selectedArray,selectedParam,plsSel,id,plsSelValue)
{
var hasId = true;
if (typeof id == 'undefined' || id == '' || id == null)
{
id= "";
hasId = false;
}
if (typeof selectedParam == 'undefined' || selectedParam == '' || selectedParam == null)
{
selectedParam = "";
}
if(hasId)
{
var el=document.getElementById(id);
el.remove(0);
if (typeof plsSel != 'boolean' || plsSel)
{
var opt0 = document.createElement("OPTION");
el.appendChild(opt0);
opt0.text = plsSel;
if ( typeof plsSelValue == 'undefined' )
{
opt0.value = plsSel;
}
else
{
opt0.value = plsSelValue;
}
}
for(var i=0; i < selectedArray.length; i++)
{
var opt = document.createElement("OPTION");
el.appendChild(opt);
opt.value = selectedArray[i++];
opt.text =selectedArray[i];

if(opt.value.toLowerCase() == selectedParam.toLowerCase())
{
opt.selected = true;
}
}
}
else
{


if (typeof plsSel != 'boolean' || plsSel)
{
document.writeln('<option value="">' + plsSelect + '</option>');
}
for(var i=0; i < selectedArray.length; i++)
{
if(selectedArray[i].toLowerCase() == selectedParam.toLowerCase())
{
document.writeln('<option value="' + selectedArray[i++] + '" selected>' + selectedArray[i] + '</option>');
}
else
{
document.writeln('<option value="' + selectedArray[i++] + '">' + selectedArray[i] + '</option>');
}
}
}
}
function smeCountryDropdown (countryCode, selectedParam, plsSel, id)
{	
var hasId = true;
var selectedArray;
if (typeof id == 'undefined' || id == '' || id == null)
{
id= "";
hasId = false;
}




if (typeof selectedParam == 'undefined' || selectedParam == '')
{
selectedParam = "";
}


if (typeof countryCode == 'undefined' || countryCode == '' || countryCode == null)
{
selectedArray = countryList;
}
else if (countryCode == "GB" || countryCode == "IE" || countryCode == "IR" || countryCode == "UK")
{
selectedArray = countryListUKorI;
}
else if (countryCode == "US" || countryCode == "CA")
{
selectedArray = countryListUSorCA;
}
else
{
selectedArray = countryList;
}
if(hasId)
{
var el=document.getElementById(id);
el.remove(0);


if (typeof plsSel != 'boolean' || plsSel)
{
var opt0 = document.createElement("OPTION");
el.appendChild(opt0);
if ( typeof plsSel == 'boolean' && plsSel == true )
{
opt0.text = plsSelect;
opt0.value = "";
}
else
{
opt0.text = plsSel;
opt0.value = plsSel;
}
}
for(var i=0; i < selectedArray.length; i++)
{
var opt = document.createElement("OPTION");
el.appendChild(opt);
opt.value = selectedArray[i++];
opt.text =selectedArray[i];
if(opt.value.toLowerCase() == selectedParam.toLowerCase())
{
opt.selected = true;
}
}
}
else
{
if (typeof plsSel != 'boolean' || plsSel)
{
document.writeln('<option value="">' + plsSelect + '</option>');
}
for(var i=0; i < selectedArray.length; i++)
{
if(selectedArray[i].toLowerCase() == selectedParam.toLowerCase())
{
document.writeln('<option value="' + selectedArray[i++] + '" selected>' + selectedArray[i] + '</option>');
}
else
{
document.writeln('<option value="' + selectedArray[i++] + '">' + selectedArray[i] + '</option>');
}
}
}
}
function buttonGoBack(formParam)
{
with(formParam)
{
eId.value = eIdGoBack.value;
submit();
}
}
function buttonCancel(formParam)
{
with(formParam)
{
eId.value = eIdCancel.value;
submit();
}
}
function buttonPrevious(formParam)
{
with(formParam)
{
eId.value = eIdPrevious.value;
submit();
}
}
function buttonNext(formParam)
{
with(formParam)
{
eId.value = eIdNext.value;
submit();
}
}
function cb_buildTrail(trailPos, crumbs)
{
var tableWidth = crumbs.length * 150;
document.writeln('<center>');
document.writeln('<table width="' + tableWidth + '" cellpadding="0" cellspacing="3" border="0">');
document.writeln('<tr><td colspan="' + (crumbs.length + 2) + '" height="15"><img src="/cms/s.gif" height="1" width="1" alt=""></td></tr>');
document.writeln('<tr>');
document.writeln('<td width="20"><img src="/cms/s.gif" height="1" width="1"></td>');
for(var i=1; i<=crumbs.length;i++)
{
if(i==trailPos)
{
document.writeln('<td class="statusbarselected">' + i + '</td>');
}
else
{
document.writeln('<td class="statusbarnotselected">' + i + '</td>');
}
}
document.writeln('<td width="20"><img src="/cms/s.gif" height="1" width="1" alt=""></td>');
document.writeln('</tr>');
document.writeln('<tr>');
document.writeln('<td width="20"><img src="/cms/s.gif" height="1" width="1" alt=""></td>');
for(var i=1; i<=crumbs.length;i++)
{
if(i==trailPos)
{
document.writeln('<td class="nlselectedsteptxt" align="center">' + crumbs[i-1] + '</td>');
}
else
{
document.writeln('<td class="nlnonselectedsteptxt" align="center">' + crumbs[i-1] + '</td>');
}
}
document.writeln('<td width="20"><img src="/cms/s.gif" height="1" width="1"></td>');
document.writeln('</tr>');
document.writeln('<tr><td colspan="' + (crumbs.length + 2) + '" height="15"><img src="/cms/s.gif" height="1" width="1"></td></tr>');
document.writeln('</table>');
document.writeln('</center>');
}
function smeShowDiv( id, show )
{
if( show )
{
getElm( id ).style.display = block;
}
else
{
getElm( id ).style.display = none;
}
}
function smeHighLightTab( container, selected, contents )
{

smeSelectTab( selected, contents );


var children = container.childNodes;
for( var y = 0; y < children.length; y++ )
{
var x = children[ y ];
if( x !== selected )
{
smeDeselectTab( x );
}
}
}

function smeSelectTab( tab, contents )
{
tab.className = "smeTabOpen";


var info = document.getElementById( contents );
info.style.display = "block";

var others = info.parentNode.childNodes;
for( var z = 0; z < others.length; z++ )
{
var a = others[ z ];
if( a.nodeType == 1 && a !== info )
{
a.style.display = "none";
}
}
}
function smeDeselectTab( tab )
{
tab.className = "smeTabClosed";
}
function sme_cabinClasses()
{
document.writeln('<option value="econ">Economy (lowest price)</option>');
document.writeln('<option value="econFlex">Economy (flexible ticket)</option>');
document.writeln('<option value="premEcon">Premier Economy (lowest)</option>');
document.writeln('<option value="premEconFlex">Premier Economy (flexible)</option>');
document.writeln('<option value="clubLow">Business/Club (lowest)</option>');
document.writeln('<option value="clubFlex">Business/Club (flexible)</option>');
document.writeln('<option value="firstLow">First (lowest)</option>');
document.writeln('<option value="firstFlex">First (flexible)</option>');
}
function sme_numberDropDown(startNum, maxNum, selectedNum)
{
document.writeln('<option value="">' + plsSelect + '</option>');
for(var i=startNum; i<=maxNum; i++)
{
if (i != selectedNum)
{
document.writeln('<option value="' + i + '">' + i + '</option>');
}
else
{
document.writeln('<option value="' + i + '" selected>' + i + '</option>');
}
}

}
function smeCompleteClaimsFields (count)
{
for(var i=count; i<20; i++)
{
document.writeln('<div id="claimDetails' + i + '">');
document.writeln('<tr>');
document.writeln('<td><input type="text" id="name" name="PassengerLastName' + i + '" size="20" /></td>');
document.writeln('<td><input type="text" id="airlineNo" size="2" name="AirlineNumber' + i + '" /><xsl:text> - </xsl:text><input type="text" id="tktNo" size="8" name="TicketNumber' + i + '" /></td>');
document.writeln('<td><select id="day" name="DayOfFirstFlight' + i + '">');

smeDayDropDownStartBlank();

document.writeln('</td>');
document.writeln('<td style="border-left:0px;"><select id="month" name="MonthOfFirstFlight' + i + '">');

UI_shortMonthDropDownStartBlank();

document.writeln('</td>');

document.writeln('<td style="border-left:0px;"><select id="month" name="YearOfFirstFlight' + i + '">');

smePreviousYearsDropDownStartBlank();

document.writeln('</td></tr></div>');
}
}
function smeClickLink(text, linkurl)
{
document.writeln('<img src="/cms/global/images/icons/smeQuickLinkArrow.gif" alt="'+text+'" /><a style="padding-left:8px; text-decoration:underline; cursor:pointer;" href="'+linkurl+'" title="'+text+'">'+text+'</a>');
}
function validateDateSet( fromDay, fromMonth, fromYear, toDay, toMonth, toYear )
{

var fDay = document.getElementById( fromDay ).value;
var fMonth = document.getElementById( fromMonth ).value;
var fYear = document.getElementById( fromYear ).value;
var tDay = document.getElementById( toDay ).value;
var tMonth = document.getElementById( toMonth ).value;
var tYear = document.getElementById( toYear ).value;


var fDate = new Date( fYear, fMonth, fDay );
var tDate = new Date( tYear, tMonth, tDay );


if( fDate != null && tDate != null )
{


return ( fDate <= tDate );
}
else
{

return false;
}
}
function getMonthIndex( monthName )
{
return refMonth[monthName];
}
function getTodayXmlDate()
{
var today = new Date();
var tDay = today.getDate();
var tMonth = today.getMonth() + 1;
if( tMonth < 10 )
{
tMonth = "0" + tMonth;
}
var tYear = today.getFullYear();
var dateStr = tYear + "-" + tMonth + "-" + tDay;
return dateStr;
}
function hideBLSErrors()
{
if(typeof blsErrors != "undefined")
{
getIdElement("blsErrors").style.display="none";
}
}

