// functions loaded at end of page.
//	validatelogin 03/27/08
//	IsUrlSafe 06/11/09
//	newAction 06/24/09
//	fixloginurl 06/06/09
//	ExternalLinks 03/09/07
//	writelogin 03/04/07
//	CheckKeyValue 04/01/08
//	SubmitForm	12/06/05
//	ProgressBar	01/22/09
//	hidestatus	11/07/05
//	DoubleClickTrapper 04/01/08
//	tablestylerows.js	03/21/09
//	Google 04/27/06

function validatelogin(){if(document.getElementById('username')&&document.getElementById('username').value===''){alert('Please enter your username.');document.getElementById('username').focus();document.getElementById('username').className='inputfocus';return false;}if(document.getElementById('login')&&document.getElementById('login').value===''){alert('Please enter your username.');document.getElementById('login').focus();document.getElementById('login').className='inputfocus';return false;}if(document.getElementById('pass')&&document.getElementById('pass').value===''){alert('Please enter your password.');document.getElementById('pass').focus();document.getElementById('pass').className='inputfocus';return false;}return true;}
function IsUrlSafe(url){if(url==undefined){url=document.URL;}url=url.toLowerCase();if(url.search('https://www.intercepteft.com')>-1||url.search('https://www.interceptcorporation.com')>-1||url.search('http://demo.intercepteft.com')>-1){return true;}var componentList=url.split('/'),szDomain=componentList[2];if('testwebrickgregdavid'.search(szDomain)>-1){return true;}else{return false;}}
function newAction(actionUrl){var szProtocol,szOrigDomain,url,proposedurl,componentList=(actionUrl).split('/'),clLength=componentList.length,szOrigPath=componentList[clLength-1];
	url=document.URL.toLowerCase();componentList=url.split('/');szOrigDomain=componentList[2];szProtocol=componentList[0];
	proposedurl=szProtocol+'//'+szOrigDomain+'/'+szOrigPath;if(IsUrlSafe(proposedurl)){return proposedurl;}
	proposedurl='https://'+szOrigDomain+'/'+szOrigPath;if(IsUrlSafe(proposedurl)){return proposedurl;}
	return 'https://www.intercepteft.com/'+szOrigPath;
}
function fixloginurl(formname){if(formname==undefined){formname='loginform';}if(document.getElementById(formname)){var formaction=document.getElementById(formname).action,newurl=newAction(formaction);document.getElementById(formname).action=newurl;}}
function externalLinks(){if(!document.getElementsByTagName){return;}var anchors=document.getElementsByTagName("a");for(var i=0;i<anchors.length;i++){var anchor=anchors[i];if(anchor.getAttribute("href")&&anchor.getAttribute("rel")=="external"){anchor.target="_blank";}}}
function checkkeyvalue(key,formname,input1,input2){if(key!=13) return;if(document.getElementById(input1).value>""&&document.getElementById(input2).value>""){DoubleClickTrapperCounter++;trapTheClick=true;document.getElementById(formname).submit();}else{return;}}
//	submitform
function submitForm(dnum){var undefined,divname='pdiva'+(dnum==undefined?'':dnum);if(document.getElementById(divname)){document.getElementById(divname).className='';progress_update(dnum);}return true;}
//	progressbar
var pInterval=1000;var pTimer;var pAt=0;
function progress_clear(pEnd,dnum){dnum=(dnum==undefined?'':dnum);for(var i=1;i<=pEnd;i++){document.getElementById('p'+dnum+i).className='hidden';pAt=0;}}
function progress_update(dnum){dnum=(dnum==undefined?'':dnum);var pEnd=count_div();document.getElementById('pdiva'+dnum).className='';document.getElementById('pdivb'+dnum).className='';pAt++;if(pAt>pEnd)progress_clear(pEnd);else document.getElementById('p'+dnum+pAt).className='progstyle';pTimer=setTimeout('progress_update('+dnum+')',pInterval);}
function progress_stop(rname,dnum){dnum=(dnum==undefined?'':dnum);clearTimeout(pTimer,dnum);progress_clear();try{document.getElementById('pdiva'+dnum).className='hidden';document.getElementById('pdivb'+dnum).className='hidden';}catch(err){}if(document.getElementById('storedname'))rname.value=document.getElementById('storedname').value;}
function progressInit(isInt,dnum){dnum=(dnum==undefined?'':dnum);document.writeln('<table border="0" cellpadding="0" cellspacing="0" style="margin:0 auto 5px auto;background:transparent;text-align:left">');document.writeln('<tr valign="bottom"><td width="2" style="background:transparent"><small><img src="\/images\/pixel.gif" height="14" width="1" alt="" \/><\/small><\/td><td id="pdiva'+dnum+'" class="hidden" style="background:transparent"><small>Please wait...&nbsp; &nbsp;<\/small><\/td><\/tr>');if(isInt){var image1=new Image(),image2=new Image(),image3=new Image(),image4=new Image();image1.src='/images/int/p1.gif';image2.src='/images/int/p2.gif';image3.src='/images/int/p3.gif';image4.src='/images/int/p4.gif';var sp1='<span class="hidden" id="p'+dnum,sp2='"><img src="\/images\/int\/p',sp3='.gif" width="16" height"14" alt="" \/><\/span>';document.writeln('<tr valign="middle"><td width="2" style="background:transparent"><img src="\/images\/pixel.gif" height="17" width="1" alt="" \/><\/td>'+'<td id="pdivb'+dnum+'" class="hidden" style="background:transparent">'+sp1+'1'+sp2+'1'+sp3+sp1+'2'+sp2+'2'+sp3+sp1+'3'+sp2+'3'+sp3+sp1+'4'+sp2+'4'+sp3);}else{document.writeln('<tr valign="top"><td width="2" style="background:transparent"><img src="\/images\/pixel.gif" height="16" width="1" alt="" \/><\/td><td width="120" id="pdivb'+dnum+'" class="hidden" style="font:normal 10pt arial;text-align:left;background:transparent"><span class="hidden" id="p'+dnum+'1">\u2588<\/span><span class="hidden" id="p'+dnum+'2">\u2588<\/span><span class="hidden" id="p'+dnum+'3">\u2588<\/span><span class="hidden" id="p'+dnum+'4">\u2588<\/span><span class="hidden" id="p'+dnum+'5">\u2588<\/span><span class="hidden" id="p'+dnum+'6">\u2588<\/span><span class="hidden" id="p'+dnum+'7">\u2588<\/span><span class="hidden" id="p'+dnum+'8">\u2588<\/span>');}document.writeln('<\/td><\/tr><\/table>');}
function count_div(){var lni=0;while(document.getElementById('p'+(lni+1))!==null){lni++;}
	return lni;}
//	hidestatus
function hs(){window.status='';return true;}
//	DoubleClickTrapper
var trapTheClick,TrapClicksForHowManySeconds=60,AlertBoxMessage="One click is sufficient. The server should respond momentarily.",TrapTime=0,DoubleClickTrapperCounter=0;
function DoubleClickTrapper(){DoubleClickTrapperCounter++;trapTheClick=false;valueToReturn=true;if(DoubleClickTrapperCounter>1){trapTheClick=true;}if(trapTheClick===true){var tDate=new Date;if(TrapTime===0){TrapTime=tDate.valueOf();}else{var localTrapTime=tDate.valueOf();if((localTrapTime-TrapTime)>(TrapClicksForHowManySeconds*1000)){TrapTime=0;trapTheClick=false;DoubleClickTrapperCounter=0;}}}if(trapTheClick===true){valueToReturn=false;alert(AlertBoxMessage);}return valueToReturn;}
//	tablestylerows.js
function hasClass(obj){var result=false;if(obj.getAttributeNode("class")!==null){result=obj.getAttributeNode("class").value;}return result;}
function stripe(id,initial){var temp=navigator.userAgent.indexOf("MSIE");var isIE=temp!=-1;var browserVers=parseFloat(navigator.userAgent.substr(temp+5));if(!(isIE&&browserVers<6)){var alt=initial,table=document.getElementById(id);if(!table){return;}var tbodies=table.getElementsByTagName("tbody");for(var h=0;h<tbodies.length;h++){var trs=tbodies[h].getElementsByTagName("tr");for(var i=0;i<trs.length;i++){var mytr=trs[i];if(mytr.className=='hidden'){continue;}if(!hasClass(mytr)&&!mytr.style.backgroundColor){if(alt){mytr.className='altcolor';}}alt=!alt;}}}}
// Google Highlighter
// Copyright(C)2001 - 2003
// Cal Henderson <cal@iamcal.com>
// Thanks to Ian Beveridge for bugfixes
// This code may be freely redistributed,
// providing this message remains intact.
//Script featured on & available at Dynamic Drive (http://www.dynamicdrive.com)
//Changes: Modification to window.onload code
var google_text_color='#000000';var google_link_colors=new Array('#ffff66','#a0ffff','#99ff99','#ff9999','#ff66ff');
function init_google(){externalLinks();var pattern=/google\./i;if(pattern.exec(document.referrer)!==null){var url_parts=document.referrer.split('?');if(url_parts[1]){var url_args=url_parts[1].split('&');for(var i=0;i<url_args.length;i++){var keyval=url_args[i].split('=');if(keyval[0]=='q'){go_google(decode_url(keyval[1]));return;}}}}}
function decode_url(url){return unescape(url.replace(/\+/g,' '));}
function go_google(terms){terms=terms.replace(/\"/g,"");var terms_split=terms.split(' ');var c=0;for(var i=0; i<terms_split.length; i++){highlight_google(terms_split[i],document.body,google_link_colors[c]);c=(c==google_link_colors.length-1)?0:c+1;}}
function highlight_google(term,container,color){var term_low=term.toLowerCase();for(var i=0;i<container.childNodes.length;i++){var node=container.childNodes[i];if(node.nodeType==3){var data=node.data;var data_low=data.toLowerCase();if(data_low.indexOf(term_low)!=-1){var new_node=document.createElement('SPAN');node.parentNode.replaceChild(new_node,node);var result;while((result=data_low.indexOf(term_low))!=-1){new_node.appendChild(document.createTextNode(data.substr(0,result)));new_node.appendChild(create_node_google(document.createTextNode(data.substr(result,term.length)),color));data=data.substr(result+term.length);data_low=data_low.substr(result+term.length);}new_node.appendChild(document.createTextNode(data));}}else{highlight_google(term,node,color);}}}
function create_node_google(child,color){var node=document.createElement('SPAN');node.style.backgroundColor=color;node.style.color=google_text_color;node.appendChild(child);return node;}
if(window.addEventListener){window.addEventListener("load",init_google,false);}else if(window.attachEvent){window.attachEvent("onload",init_google);}else if(document.getElementById) window.onload=init_google;
