
$(document).ready(function(){navList();});navList=function(){if(document.all&&document.getElementById&&document.getElementById("nav")){navRoot=document.getElementById("nav");for(i=0;i<navRoot.childNodes.length;i++){node=navRoot.childNodes[i];if(node.nodeName=="LI"){node.onmouseover=function(){this.className+=" over";}
node.onmouseout=function(){this.className=this.className.replace(" over","");}}}}}
preloader=function()
{var i=0;imageObj=new Image();images=new Array();images[0]="/images/nav/nav1_sub1_off.jpg";images[1]="/images/nav/nav1_sub1_on.jpg";images[2]="/images/nav/nav1_sub2_off.jpg";images[3]="/images/nav/nav1_sub2_on.jpg";images[4]="/images/nav/nav1_sub3_off.jpg";images[5]="/images/nav/nav1_sub3_on.jpg";images[6]="/images/nav/nav1_sub4_off.jpg";images[7]="/images/nav/nav1_sub4_on.jpg";for(i=0;i<=3;i++)
{imageObj.src=images[i];}}
confirmMe=function(outputLayer,outputCopy){document.getElementById(outputLayer).innerHTML=outputCopy;}
tabchange=function(object){tabRoot=document.getElementById("tabs");aTags=tabRoot.getElementsByTagName("a");for(i=0;i<aTags.length;i++){$(aTags[i]).removeClass("down");contentTabName="tab"+(i+1)+"content";document.getElementById(contentTabName).style.display="none";}
$(object).addClass("down");contentTabToShow=object.id+"content";document.getElementById(contentTabToShow).style.display="block";}
abstractControl=function(object,abstractNum){abstractName="#abstract_"+abstractNum;if(object.className=="icn_read"){object.className="icn_unread";object.innerHTML="Back to Summary";$(abstractName).show();}
else if(object.className=="icn_unread"){object.className="icn_read";object.innerHTML="Read Abstract";$(abstractName).hide();}}
function fieldClear(obj){if(obj.Val){if(obj.value==''){obj.value=obj.Val;obj.Val=null;obj.first=null;}
else{obj.Val=null;}}else if(!obj.first){obj.Val=obj.value;obj.value='';obj.first='true';}}
function fieldEmpty(obj){if(obj.value=="Email Address"){obj.value="";}}
function fieldReFill(obj){if(obj.value==""){obj.value="Email Address";}}
function popOpen(id,topOffset){if(!topOffset)topOffset=100;setSize(topOffset);var overShade=document.getElementById(id);var topPad=pos+topOffset;overShade.style.height=(ph-topPad)+'px';overShade.style.width=pw+'px';overShade.style.paddingTop=topPad+'px';overShade.style.display='block';if(navigator.appVersion.match(/MSIE 6.0/)){coverSelects(overShade);}}
function textCounter(fieldid,maxlimit){field=document.getElementById(fieldid);if(field.value.length>maxlimit)
field.value=field.value.substring(0,maxlimit);}
function disablesubmitbtn(){if(!theForm.onsubmit||(theForm.onsubmit()!=false)){}}
function applypopOpen(id,topOffset,cId){if(!topOffset)topOffset=100;setSize(topOffset);var overShade=document.getElementById(id);var topPad=pos+topOffset;overShade.style.height=(ph-topPad)+'px';overShade.style.width=pw+'px';overShade.style.paddingTop=topPad+'px';overShade.style.display='block';if(navigator.appVersion.match(/MSIE 6.0/)){coverSelects(overShade);}
if(id=='paste_resume')
{var elemrm=document.getElementById('resumeuploadmain');var elemralt=document.getElementById('resumeuploadalternative');var elemtxtRes=document.getElementById(cId);elemtxtRes.value='2';elemrm.style.display='none';elemrm.style.visibility='hidden';elemralt.style.display='block';elemralt.style.visibility='visible';}
else if(id=='paste_letter')
{var elemcm=document.getElementById('coverletter');var elemcalt=document.getElementById('coverletteralternative');var elemtxtCover=document.getElementById(cId);elemtxtCover.value='2';elemcm.style.display='none';elemcm.style.visibility='hidden';elemcalt.style.display='block';elemcalt.style.visibility='visible';}}
function togglediv(id){if(id=='paste_resume')
{var elemrm=document.getElementById('resumeuploadmain');var elemralt=document.getElementById('resumeuploadalternative');elemrm.style.display='none';elemrm.style.visibility='hidden';elemralt.style.display='block';elemralt.style.visibility='visible';}
else if(id=='paste_letter')
{var elemcm=document.getElementById('coverletter');var elemcalt=document.getElementById('coverletteralternative');elemcm.style.display='none';elemcm.style.visibility='hidden';elemcalt.style.display='block';elemcalt.style.visibility='visible';}}
function showhidediv(id,cId){if(id=='paste_resume')
{var elemrm=document.getElementById('resumeuploadmain');var elemralt=document.getElementById('resumeuploadalternative');var elemtxtRes=document.getElementById(cId);elemtxtRes.value='1';elemrm.style.display='block';elemrm.style.visibility='visible';elemralt.style.display='none';elemralt.style.visibility='hidden';}
else if(id=='paste_letter')
{var elemcm=document.getElementById('coverletter');var elemcalt=document.getElementById('coverletteralternative');var elemtxtCover=document.getElementById(cId);elemtxtCover.value='1';elemcm.style.display='block';elemcm.style.visibility='visible';elemcalt.style.display='none';elemcalt.style.visibility='hidden';}}
function popClose(id,cId){if(cId==null)
{document.getElementById(id).style.display="";if(navigator.appVersion.match(/MSIE 6.0/)){document.getElementById("popup-cover").outerHTML="";}
return false;}else{if(id=='paste_resume')
{var elemrm=document.getElementById('resumeuploadmain');var elemralt=document.getElementById('resumeuploadalternative');var elemtxtRes=document.getElementById(cId);elemtxtRes.value='1';elemrm.style.display='block';elemrm.style.visibility='visible';elemralt.style.display='none';elemralt.style.visibility='hidden';}
else if(id=='paste_letter')
{var elemcm=document.getElementById('coverletter');var elemcalt=document.getElementById('coverletteralternative');var elemtxtCover=document.getElementById(cId);elemtxtCover.value='1';elemcm.style.display='block';elemcm.style.visibility='visible';elemcalt.style.display='none';elemcalt.style.visibility='hidden';}}}
function setSize(topOffset){if(window.pageYOffset!=null){pos=window.pageYOffset;ph=document.documentElement.scrollHeight;pw=document.documentElement.scrollWidth;if(document.body.scrollHeight>document.documentElement.scrollHeight){ph=document.body.scrollHeight;pw=document.body.scrollWidth;}}else if(document.documentElement.scrollTop>document.body.scrollTop){pos=document.documentElement.scrollTop;ph=document.documentElement.scrollHeight;pw=document.documentElement.scrollWidth;if(document.documentElement.clientHeight>document.documentElement.scrollHeight){ph=document.documentElement.clientHeight;}}else if(document.body!=null){pos=document.body.scrollTop;ph=document.body.scrollHeight;pw=document.body.scrollWidth;if(document.documentElement.scrollHeight>document.body.scrollHeight){ph=document.documentElement.scrollHeight;}
ph=ph+pos+topOffset;}}
function coverSelects(par){var covHeight=document.body.scrollHeight+"px";var coverFrame="<IFRAME id='popup-cover' style='";coverFrame=coverFrame+"height:"+covHeight+";' ";coverFrame=coverFrame+"src='javascript:false;' frameBorder='0' scrolling='no'></IFRAME>";par.insertAdjacentHTML("afterEnd",coverFrame);}
function showHideEmploymentCopy(sel){var selectedItem=sel.value;var myDiv=document.getElementById('ctl00_bodyPlaceHolder_employmentMsg');if(selectedItem=='EMP'){myDiv.style.display='block';document.getElementById("ctl00_bodyPlaceHolder_tidVal").value="EMP";}else{myDiv.style.display='none';document.getElementById("ctl00_bodyPlaceHolder_tidVal").value="";}}
function xValidateEmail(xES){var xVE=true;var xA=xES.indexOf("@");var xB=xES.substring(0,xA);var xD=xES.length-1;var xE=xES.lastIndexOf(".");var xC=xES.substring(xA+1,xE);var xF=(xD)-(xE+1);if(xA==-1){xVE=false;}
if(xA!=xES.lastIndexOf("@")){xVE=false;}
if(xCheckSUVC(xB)!=true){xVE=false;}
if(xB.length<1){xVE=false;}
if(xCheckSUVC(xC)!=true){xVE=false;}
if(xC.length<1){xVE=false;}
if(xCheckSUVC(xES.substr(xE+1,xD))!=true){xVE=false;}
if(xF<1||xF>3){xVE=false;}
return xVE;}
function xCheckSUVC(xESS){var xV=true;var xUC=new Array("!","£","$","%","^","&","*","+","=","?",":",";","'"," "," ",'"',"~","#","/");for(var i=0;i<=xUC.length-1;i++){if(xESS.indexOf(xUC[i],0)!=-1){xV=false;break;}}
return xV;}
function getCookie(c_name)
{if(document.cookie.length>0)
{c_start=document.cookie.indexOf(c_name+"=");if(c_start!=-1)
{c_start=c_start+c_name.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1)c_end=document.cookie.length
return unescape(document.cookie.substring(c_start,c_end));}}
return"";}
function getTrackingURL(page_name,file_name)
{var id=getCookie("UserID");var page_url=document.URL;if(page_url.indexOf('default.aspx',0)!=-1){baseUrl="tracking.aspx?UserID=";}else{baseUrl="../tracking.aspx?UserID=";}
if(file_name==null)
var trackingURL=baseUrl+id+"&PageID="+page_name;else
var trackingURL=baseUrl+id+"&PageID="+page_name+"&FileID="+file_name;return trackingURL;}
function setTrackingTag(page_name,file_name)
{trackUrl(getTrackingURL(page_name,file_name));}
function trackUrl(trackingURL)
{var xmlHttp;try
{xmlHttp=new XMLHttpRequest();}
catch(e)
{try
{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e)
{try
{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e)
{alert("Incompatible browser!");return false;}}}
xmlHttp.onreadystatechange=function()
{if(xmlHttp.readyState==4)
{var dummy=xmlHttp.responseText;}}
xmlHttp.open("GET",trackingURL,true);xmlHttp.send(null);}
function getHttpRequest()
{var xmlHttp;try
{xmlHttp=new XMLHttpRequest();}
catch(e)
{try
{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e)
{try
{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e)
{alert("Incompatible browser!");return false;}}}
return xmlHttp;}
function entsub(event,elementid,divid,errordivid,trackingTag){var key;if(window.event)
key=window.event.keyCode;else
key=event.which;if(key==13)
{checkSubscribeKMI(elementid,divid,errordivid,trackingTag);return true;}
else
return true;}
function checkSubscribeKMI(elementid,divid,errordivid,trackingTag){var emailaddr=document.getElementById(elementid).value;if(xValidateEmail(emailaddr)){$.get('RequestProcessor.aspx',{username:'hondajet',password:'hondajet',inquiryCd:"SUB",emailAddress:emailaddr,RequestType:"Subscription"},function(xml){c=String(xml);var mpos=c.indexOf('message',0)+8;var qpos=c.indexOf('/message',mpos)-1;var message=c.substring(mpos,qpos);if(message)
{confirmMe(divid,message);}});}else{if(emailaddr==""){errorMsg="Required Field";}else{errorMsg="We're sorry - our system does not recognize the format of your email address. Please re-enter.";}
confirmMe(errordivid,errorMsg);}}
function resizeFrame(frameID,height){parent.document.getElementById(frameID).height=height;}
function getmailtoString(emailalias,emailext,postapplied)
{document.write('<a href="../uploadresume/index.aspx?email='+emailalias+'&id=ft&post='+postapplied+'\" class=arrow_link>');document.write('Apply Now'+'</a>');}
function vIE(){return (navigator.appName=='Microsoft Internet Explorer')?parseFloat((new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})")).exec(navigator.userAgent)[1]):-1;}
function dumpElement(elem){if(vIE!=-1){document.getElementById(elem).innerHTML='';rebuildFLVPLayer();}}
function rebuildFLVPLayer(){var so = new SWFObject("../flash/flvplayer.swf", "hj_flvplayer", "494", "404", "8", "FFFFFF");so.addVariable("url_handler", "../RequestProcessor.aspx");so.addVariable("videofile", "http://vivacast.streamlogics.com/hondajet/WireFrame.1.2.flv");so.addParam("scale", "noscale");so.addParam("wmode", "transparent");so.write("flashvid");}
function liveCharCount(currCount,maxChars,outputElement){document.getElementById(outputElement).innerHTML=currCount}
function omnitureTrackingSend (myChannel,mSubSection,myContentType,myPageName) {
    var vars = new Object();
    if(myChannel!=null)vars.channel=myChannel;
    if(mSubSection!=null)vars.prop26=mSubSection;
    if(myContentType!=null)vars.prop28=myContentType;
    if(myPageName!=null)vars.pageName=myPageName;
    s.t(vars);
}var allowSend = true;
function sendMessageToDealer(dealerEmailElementId, senderNameElementId, senderEmailElementId, senderPhoneElementId, messageElementId){
	if(allowSend) {
	if(location.href.indexOf("staging.")> -1 || location.href.indexOf("pat.") > -1 || location.href.indexOf("localhost") > -1) {
		var dealerEmail = "gnettles@sapient.com";
		var bccEmail = "gnettles@sapient.com";
	} else {
		var dealerEmail = document.getElementById(dealerEmailElementId).value;
		var bccEmail = "sales@haci.honda.com";
	}
	var senderName = document.getElementById(senderNameElementId).value;
	var senderEmail = document.getElementById(senderEmailElementId).value;
	
	var senderPhone = document.getElementById(senderPhoneElementId).value;
	var message = document.getElementById(messageElementId).value;
	var errordivid = "emailErrorDiv";
	allowSend = false;
		if(senderName == "" || message == "" || senderEmail == "") {
		errorMsg = "Please fill out all required fields.";
		allowSend = true;
		confirmMe(errordivid, errorMsg);
		return;
	}
	if(document.getElementById("reqValFirstName").style.display != "none" || document.getElementById("regExValFirstName").style.display != "none" || document.getElementById("reqValEmail").style.display != "none" || document.getElementById("RegularExpressionValidator10").style.display != "none" || document.getElementById("USPhoneValidator").style.display != "none" || document.getElementById("nonUSPhoneValidator").style.display != "none" || document.getElementById("regExValComments").style.display != "none") {
	    allowSend = true;
	    return;
	} 
	if(xValidateEmail(senderEmail)){
		$.get('RequestProcessor.aspx',
		{ username: 'hondajet', password: 'hondajet', dealerEmail: dealerEmail, dealerBCC: bccEmail, senderName: senderName, senderEmail: senderEmail, senderPhone: senderPhone, messageBody: message, RequestType:"MessageDealer"},
		   function(xml){
				c = String(xml);
				var mpos 		= c.indexOf('message', 0) + 8;
				var qpos 		= c.indexOf('/message', mpos) - 1;
				var message 	= c.substring(mpos, qpos);
				if (c.indexOf("pass")!=-1){   
				    document.getElementById("confirmContent").style.display="block";
				    document.getElementById("formContent").style.display="none"; 
				} else {
				    errorMsg = "We're sorry there was an error sending your message. Please close the window and try again."
				    confirmMe(errordivid, errorMsg);
				    allowSend = true;
				}
		   }
		 );
	} else {
	    allowSend = true;
	    if(senderEmail == ""){
	        errorMsg = "Required Field";
	    } else {
	        errorMsg = "We're sorry - our system does not recognize the format of your email address. Please re-enter.";
	    }
		confirmMe(errordivid, errorMsg);
	}
	}	
}
