//<!---Start Javascript
/*************************************************************************************************************/

var imgPath = null;
var rootPath = null;
function InitRelCode() {
	var iImg;
	var tObj;

	if(!document.layers) {
		iImg = document.images['ImagePath'];
		tObj = iImg;
	} else {
		tObj = document.layers['folderPath'];
		if(tObj) {
			iImg = tObj.document.images['ImagePath'];
		}
	}
	if(!tObj) {
		window.setTimeout("InitRelCode()", 1500);
		return false;
	}

	imgPath = _gp(iImg.src);
	rootPath = _gp2(iImg.src)

	return true;
}
	
function _gp(p) { return p.substr(0,p.lastIndexOf("/")+1); }
function _gp2(p) { return p.substr(0,p.lastIndexOf("images/")); }



var navImagePath = "images/nav/";

//This function randomly chooses a new banner and displays it in the screen.
function change() {
	//Randomly choses a number between - 0 to 12
	var number = Math.floor(Math.random()*14);
	//Banner Alternate Statement
	var bannerAlt = "Congressman Frank Lucas, Representing the People of the 3rd District of Oklahoma"
	//Banner Width	
	var bannerWidth = "640";
	//Banner Height
	var bannerHeight = "113";
	//Banner Border
	var bannerBorder = "0";
	// File Informaiton
	var fileName = "banner";//name of the file, from the start to before the "."
	var fileExtension = ".jpg"; //.gif,.jpg,.png
	//Final Image
	var bannerImage = '<img src="'+fileName+number+fileExtension+'" width="640" height="113" '+
						' border="'+bannerBorder+'" alt="'+bannerAlt+'">';
	//window.alert(bannerImage);
	//Write the Image
	document.write(bannerImage);
}

/*************************************************************************************************************/

//This function handles rollover images
function navSwap(imgName,img) {
	//window.alert(imgName)
	document.images[imgName].src = img+'.gif';
}

/*************************************************************************************************************/
//This function handles Email validation

function isEmail(s) {
	var i = 1;
	var sLength = s.length;
	while ((i < sLength) && (s.charAt(i) != "@")) { i++ }
		if ((i >= sLength) || (s.charAt(i) != "@")) return false; else i += 2;
	while ((i < sLength) && (s.charAt(i) != ".")) { i++ }
		if ((i >= sLength) || (s.charAt(i) != ".")) return false; else return true;
}
/*************************************************************************************************************/
//This function writes Quick Links Section for the left nav
function quickLinks() {

	var quickLinks = new Array();
	quickLinks[0] = "about_bio.htm|Learn about Frank"
	quickLinks[1] = "services_casework.htm|Federal Agency Help"
	quickLinks[2] = "services_grants.htm|Federal Grant Assistance"
	//quickLinks[3] = "filename|Name"


document.write('<tr><td class="navLeftHead">Quick Links</td></tr>')
document.write('<tr><td bgcolor="#ffffff" class="normal"><ul class="ulLeftNav">');
	for (var i=0; i<quickLinks.length; i++) { 
		var linksplit = quickLinks[i].split("|");
			document.write('<li class="liLeftNav"><a href="http://www.house.gov/lucas/'+linksplit[0]+'" class="sidelink">'+linksplit[1]+'</a></li>');
	}
document.write('</ul></td></tr>');
}


/*************************************************************************************************************/
//This function writes Your Interests Section for the left nav
function yourInterests() {
	//The following lists all the Your Interests items
	var yourInterests = new Array();
	yourInterests[0] = "issues_sm_bus.htm|I'm involved in a small business."
	yourInterests[1] = "issues_ag_assistance.htm|I'm connected to agriculture."
	yourInterests[2] = "issues_oil_gas_sector.htm|I work in the oil and gas sector."
	yourInterests[3] = "issues_seniors.htm|I'm a senior citizen."
	yourInterests[4] = "issues_parent.htm|I'm a parent."
	yourInterests[5] = "issues_veterans.htm|I'm a Veteran."
	yourInterests[6] = "issues_students.htm|I'm a student.",
	yourInterests[7] = "services_dcvisit.htm|I'm coming to Washington D.C."
	yourInterests[8] = "issues_reporter.htm|I'm a reporter."
	//yourInterests[9] = "issue.htm|I'm a reporter."

document.write('<tr><td class="navLeftHead">Your Interests</td></tr>')
document.write('<tr><td bgcolor="#ffffff" class="normal"><ul class="ulLeftNav">');
	for (var i=0; i<yourInterests.length; i++) { 
		var linksplit = yourInterests[i].split("|");
			document.write('<li class="liLeftNav"><a href="http://www.house.gov/lucas/'+linksplit[0]+'" class="sidelink">'+linksplit[1]+'</a></li>');
	}
document.write('</ul></td></tr>');
}

/*************************************************************************************************************/
//This funciton is for writing News Briefs Form

function newsBriefs (){
	document.write('<tr><td class="navLeftHead">Sign up for Lucas News Briefs</td></tr>');
	document.write('<tr><td bgcolor="#ffffff" class="small">You&acute;ll receive timely news on issues in Washington that affect you in the 3rd District.</td></tr><tr>');

	document.write('<form name="newsBriefs" id="newsBriefs" action="/htbin/formproc/lucas/form/ht_newsletter.txt&amp;display=/lucas/thankyou2.htm" method="post" onSubmit="return validateEmail(this);">')
	document.write('<td bgcolor="#ffffff" class="normal" align="center">')
	document.write('<label for="county"><strong>County:</strong></label><br />')
	document.write('<select name="county" id="county">');
	document.write('<option selected>Select County</option>');

	var counties = new Array("Alfalfa","Beaver","Beckham","Blaine","Caddo","Canadian","Cimarron","Creek","Custer","Dewey","Ellis","Garfield","Grant","Greer","Harmon","Harper","Jackson","Kay","Kingfisher","Kiowa","Lincoln","Logan","Major","Noble","Osage","Pawnee","Payne","Roger Mills","Texas","Washita","Woods","Woodward","Outside District");

	for (var i=0; i<counties.length; i++) { 
		document.write('<option value="'+counties[i]+'">'+counties[i]+'</option>');
	}
	document.write('</select><br /><br />');

	document.write('<label for="email"><strong>Email address:</strong></label><br />')
	document.write('<input name="email" id="email" size="12"><br />')
	document.write('<input type="image" src="http://www.house.gov/lucas/images/buttons/send.png" name="Send" title="Send" alt="Send">')
	document.write('</td>');
	document.write('</form></tr>');
}

/*************************************************************************************************************/
//This funciton is for writing Search Thomas Form
//Search 108th Congress Database for Legislation

function searchThomas() {
	document.write('<tr><td class="navLeftHead">Search Current<br />Bill Database</td></tr>');
	document.write('<tr>');
	document.write('<form action="http://thomas.loc.gov/cgi-bin/query" method="post" target="_blank">');
	document.write('<td bgcolor="#ffffff" colspan="2" class="small" align="center">');
	document.write('<label for="label">Word/Phrase:</label><br />');
	document.write('<input type="text" name="queryc108" value size="15" maxlength="50" id="label"><br />');
	document.write('<label for="label2">Bill Number:</label><br />');
	document.write('<input type="text" name="docidc107" value size="15" maxlength="50" id="label2"><br />');
	document.write('Examples:<br/>hr5, s.4, sres50,<br/>sa21, PL108-5 <br /><br />');
	document.write('<input type="image" src="http://www.house.gov/lucas/images/buttons/search.png" title="Search" alt="Search" name="Search">');
	document.write('<br /><br /></td></form></tr>');
}
/*************************************************************************************************************/
//This funciton is for validating email
function validateEmail(frm) {
	with (frm) {
		if (!isEmail(email.value)) { window.alert("The email address you gave is invalid.");email.focus();email.select();return false; }
	}
}
/*************************************************************************************************************/
//This funciton is for searching Lucas website
function searchLucas() {
	document.write('<span class="small"><center><form method="post" action="http://wwws.house.gov/search97cgi/s97_cgi?LUCAS">');
	document.write('<b><label for="search">Search My Site:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label></b>');
	document.write('<input type="hidden" name="Action" value="FilterSearch">');
	document.write('<input type="hidden" name="filter" value="member_srch_flt.hts">');
	document.write('<input type="hidden" name="Collection" value="members">');
	document.write('<input type="hidden" name="ResultTemplate" value="memberresult.hts">');
	document.write('<input type="hidden" name="ViewTemplate" value="memberview.hts">');
	document.write('<input type="hidden" name="SearchPage" value="/MemberSrch.html">');
	document.write('<input type="hidden" name="SourceQueryText" value="SSDD+vdkvgwkey <substring> &quot;/LUCAS/&quot;">');
	document.write('<input type="hidden" name ="ResultCount" value="20">');
	document.write('<input type="text" name="QueryText" size="13" value="" id="search">');
	document.write('&nbsp;<input type="image" src="go_dark.gif" title="Search" alt="Search">');
	document.write('</form></center></span>');
}

//This function initilizes multiple functions and writes the left nav
function leftNav() {
	searchLucas()
	document.write('<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#00659C" class="border1">')
	quickLinks();
	yourInterests();
	newsBriefs();
	searchThomas();
	document.write('</table>')
}


//End Javascript--->