
var rootPath = 'http://sstest.concoursecommunications.com/hotspot/';
var rootPathScript = 'http://sstest.concoursecommunications.com/scripts/';
var secureRootPath = 'https://www.concoursecommunications.com/ss/hotspot/';

function writeHeaderMap(){

	  document.write('<map name="Map">');
	  document.write('<area shape="rect" coords="-1,0,43,27" href="https://hotspot.concoursecommunications.com/login">');
	  document.write('<area shape="rect" id="priceLink" coords="46,-1,91,25" href="' + rootPath + airportCode + '/price.html">');
	  document.write('<area shape="rect" id="supportLink" coords="93,0,165,27" href="' + rootPath + airportCode + '/support.html">');
	  document.write('</map>');

}

function writeNavLinks(){
	
		document.write('<a href="' + rootPath + airportCode + '/accountinfo.html" class="bodyGray">My Account</a><br>');
		document.write('<a href="https://wireless.nnu.com/concourse1_test/' + airportCode + '/register_py" class="bodyGray">Sign Up</a><br>');
		document.write('<a href="' + rootPath + airportCode + '/coupon.html" class="bodyGray">Have a Coupon?</a><br>');
		document.write('<a href="' + rootPath + airportCode + '/partners.html" class="bodyGray">Partners</a><br>');
		document.write('<a href="' + rootPath + airportCode + '/map_overview.asp?loccode=' + airportCode + '" class="bodyGray">Hotspot Coverage</a><br>');
		document.write('<a href="' + rootPath + airportCode + '/privacy.html" class="bodyGray">Privacy</a><br>');
		document.write('<a href="' + rootPath + airportCode + '/contact.html" class="bodyGray">Contact Us</a><br>');
}



function writeLargeTitle(){

	document.write(largeTitle);

}

function writeNNUFormHeader(){

	document.write('<form name="login_form" action="https://wireless.nnu.com/concourse1/' + airportCode + '/login_py">');
}

function writeEmailFormHeader(){

	document.write('<form name="remindMe" action="' + rootPathScript + 'sendemail.asp" method="post">');
	document.write('<input type=hidden name=airport value="' + airportCode + '">');
}

function writeSmallTitle(){

	document.write(smallTitle);

}

function appendRealm(form){
	
	if (form.user.value.indexOf(form.ispSelect.options[form.ispSelect.selectedIndex].value) == -1){
		
		//Sprint is a suffix realm
		if (form.ispSelect.options[form.ispSelect.selectedIndex].value  == "@wifi.sprintpcs.com"){
			form.user.value  = form.user.value + form.ispSelect.options[form.ispSelect.selectedIndex].value; 		
		}else{
			form.user.value  = form.ispSelect.options[form.ispSelect.selectedIndex].value + form.user.value; 		
		}
	}

}

function appendAAURealm(form){
	
	//if (form.user.value.indexOf(form.ispSelect.options[form.ispSelect.selectedIndex].value) == -1){
		
		form.user.value  = "AAU/" + form.user.value; 		
		
	//}

}

function setCode(form){

	form.action = rootPathScript + 'ProcessCoupon.asp';	
	form.location.value  = airportCode; 		
}

function writeHeaderWithBanner(){

	header('idtbanner.jpg');
}


function writeHeader(){
	
	header(null);
}
	

function header(banner){

	
		document.write('<body>');
		document.write('<table width="760" border="0" align="center" cellpadding="0" cellspacing="0" background="images/topBarBlueBk.gif">');
		document.write('  <tr>');
		document.write('    <td width="16"><img src="images/topBarBlueLeft.gif" width="16" height="38"></td>');
		document.write('    <td width="190">&nbsp;</td>');
		document.write('    <td width="159" valign="top"><img src="images/topnav.gif" width="159" height="28" border="0" usemap="#Map"></td>');
		document.write('    <td width="379">&nbsp;</td>');
		document.write('    <td width="16" align="right"><img src="images/topBarBlueRight.gif" width="16" height="38"></td>');
		document.write('  </tr>');
		document.write('</table>');
		document.write('<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">');
		document.write('  <tr>');
		document.write('    <td rowspan="2"><a href="' + airportLogoLink  + '"><img src="images/logo.gif" width="206" height="88" border="0" align="absmiddle"></a></td>');
		document.write('     <td width="417" height="55" valign="middle"><span class="headerTitleBlue_msp">');

		writeLargeTitle();

		document.write('	</span><br>      </td>');
		document.write('    <td width="135" rowspan="8" valign="top"><table width="135" border="0" align="left" cellpadding="0" cellspacing="0">');
		document.write('      <tr>');
		document.write('        <td colspan="2"><img src="images/spacer.gif" width="1" height="5"></td>');
		document.write('      </tr>');
		document.write('      <tr>');
		document.write('        <td>&nbsp;</td>');
		if (banner != null) {
			document.write('        <td><a href="' + rootPathScript + 'banner.asp"><img alt="Top Ad" border="0" src="images/' + banner + '" style="background-color: #336699"></a></td>');

		}else{
			document.write('        <td>&nbsp;</td>');	
		}
		document.write('      </tr>');
		document.write('      <tr>');
		document.write('        <td colspan="2"><img src="' + rootPath + '/' + airportCode + '/images/' + airportCode + '_spacer.gif" width="1" height="5"></td>');
		document.write('      </tr>');
		document.write('      <tr>');
		document.write('        <td width="8">&nbsp;</td>');
		document.write('        <td>&nbsp;</td>');
		document.write('      </tr>');
		document.write('    </table></td>');
		document.write('  </tr>');
		document.write('  <tr>');
		document.write('    <td height="33" valign="top"><span class="headerTitleGray">');

		writeSmallTitle();

		document.write('	</span></td>');
		document.write('  </tr>');
		document.write('  <tr>');
		document.write('    <td colspan="2"><img src="images/spacer.gif" width="8" height="6" align="absmiddle"></td>');
		document.write('  </tr>');
		document.write('  <tr>');
		document.write('    <td colspan="2"><span class="headerSmallGrayDark"><img src="images/spacer.gif" width="8" height="22" align="absmiddle"></span></td>');
		document.write('  </tr>');
		document.write('  <tr>');
		document.write('    <td colspan="2"><img src="images/spacer.gif" width="8" height="6" align="absmiddle"></td>');
		document.write('  </tr>');

}

function writeFooter(){

	document.write('<tr>');
	document.write('    <td colspan="2"><table width="100%" height="20"  border="0" cellpadding="0" cellspacing="0">');
	document.write('      <tr>');
	document.write('        <td height="20"><img src="images/horizDotsRow.gif" width="623" height="20"></td>');
	document.write('      </tr>');
	document.write('    </table></td>');
	document.write('  </tr>');
	document.write('  <tr>');
	document.write('    <td colspan="2" align="left" valign="top"><table width="100%" height="155"  border="0" cellpadding="0" cellspacing="0">');
	document.write('      <tr>');
	document.write('        <td width="10" rowspan="3">&nbsp;</td>');
	document.write('        <td height="60" valign="top"><a href="http://www.concoursecommunications.com" target="_blank"><img src="images/poweredBy.gif" width="105" height="60" border="0" align="top"></a></td>');
	document.write('        <td width="10" rowspan="3">&nbsp;</td>');
	document.write('        <td width="10" rowspan="3">&nbsp;</td>');
	document.write('        <td width="191" rowspan="3" valign="top"><span class="bodyOrangeStrong">Free Sites!</span>');

	writeFreeLinks();

	document.write('		</td>');
	document.write('        <td width="10" rowspan="3">&nbsp;</td>');
	document.write('        <td width="10" rowspan="3">&nbsp;</td>');
	document.write('        <td width="191" rowspan="3" valign="top">');

	writeNavLinks();

	document.write('		</td>');
	document.write('      </tr>');
	document.write('      <tr>');
	document.write('        <td height="35" valign="top" class="copyright">&copy;2004 Concourse Communications Group, LLC &bull; All Rights Reserved</td>');
	document.write('      </tr>');
	document.write('      <tr>');
	document.write('        <td height="60" valign="middle">&nbsp;</td>');
	document.write('      </tr>');
	document.write('    </table></td>');
	document.write('  </tr>');
	document.write('</table>');

	writeHeaderMap();

	document.write('</body>');

}

function writeSingleSession(){

	document.write('<tr>');
	document.write('    <td colspan="2" valign="top"><table width="623" height="217" border="0" align="center" cellpadding="0" cellspacing="0">');
	document.write('      <tr>');
	document.write('        <td width="201" align="left" valign="top"><table width="201" height="217" border="0" align="left" cellpadding="0" cellspacing="0" bgcolor="#FFFFCC">');
	document.write('          <tr>');
	document.write('            <td colspan="2"><img src="images/spacer.gif" width="1" height="10"></td>');
	document.write('          </tr>');
	document.write('          <tr>');
	document.write('            <td><img src="images/spacer.gif" width="1" height="1"></td>');
	document.write('            <td width="191" valign="top"><img src="images/singleSessionUsers.gif" width="182" height="39"></td>');
	document.write('          </tr>');
	document.write('          <tr>');
	document.write('            <td width="10" height="133" rowspan="3">&nbsp;</td>');
	document.write('            <td width="191" height="40" valign="bottom" class="bodyBlack">I\'d like to sign on for a <br>');
	document.write('          one-time session <a href="' + rootPath + airportCode + '/price.html" class="bodyOrangeLink">@ $6.95</a></td>');
	document.write('          </tr>');
	document.write('          <tr>');
	document.write('            <td height="31" valign="middle"><a href="https://wireless.nnu.com/concourse1/' + airportCode + '/register_py"><img src="images/signon_orange.gif" alt="Single Session Users Sign On" name="signOn" width="60" height="19" border="0" align="top" id="signOn"></a></td>');
	document.write('          </tr>');


}

function writeRedirectXML(){

	document.write('<!--');
	document.write('<?xml version="1.0" encoding="UTF-8"?>');
	document.write('<WISPAccessGatewayParam');
	document.write('  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"');
	document.write('  xsi:noNamespaceSchemaLocation="http://www.acmewisp.com/WISPAccessGatewayParam.xsd">');
	document.write('  <Redirect>');
	document.write('    <AccessProcedure>1.0</AccessProcedure>');
	document.write('    <AccessLocation>12</AccessLocation>');
	document.write('    <LocationName>');
	document.write(smallTitle);
	document.write('    </LocationName>');
	document.write('    <LoginURL>%link-login%</LoginURL>');
	document.write('    <MessageType>100</MessageType>');
	document.write('    <ResponseCode>0</ResponseCode>');
	document.write('  </Redirect>');
	document.write('</WISPAccessGatewayParam>');
	document.write('-->');

}

function PageQuery(q) {
	if(q.length > 1) this.q = q.substring(1, q.length);
	else this.q = null;
	this.keyValuePairs = new Array();
	if(q) {
		for(var i=0; i < this.q.split("&").length; i++) {
			this.keyValuePairs[i] = this.q.split("&")[i];
		}
	}
	
	this.getKeyValuePairs = function() { return this.keyValuePairs; }
	this.getValue = function(s) {
		for(var j=0; j < this.keyValuePairs.length; j++) {
			if(this.keyValuePairs[j].split("=")[0] == s)
				return this.keyValuePairs[j].split("=")[1];
		}
		return false;
	}
	this.getParameters = function() {
		var a = new Array(this.getLength());
		for(var j=0; j < this.keyValuePairs.length; j++) {
			a[j] = this.keyValuePairs[j].split("=")[0];
		}
		return a;
	}
	this.getLength = function() { return this.keyValuePairs.length; } 
}

function queryString(key){
	var page = new PageQuery(window.location.search); 
	return unescape(page.getValue(key)); 
}

function writeDestination(){

	document.write('<input type="hidden" name="dst" value="' + queryString("dst") + '">');
}
