var iAmMap={"USCitizen":[{"iWantTo":"To get a certificate of citizenship.","url":"/us-citizenship/Certificate-of-Citizenship-Form-N-600.jsp"},{"iWantTo":"To help my child become a U.S. citizen or get proof of U.S. citizenship.","url":"/us-citizenship/Certificate-of-Citizenship-Form-N-600.jsp"},{"iWantTo":"To replace a lost, stolen or destroyed naturalization certificate/certificate of citizenship.","url":"/us-citizenship/Naturalization-Certificate-Citizenship-Form-N-565.jsp"}],"Fiance_k1":[{"iWantTo":"To correct an error on my permanent resident card (green card).","url":"/greencard/renewal-green-card-Form-I-90-replace.jsp"},{"iWantTo":"To get a re-entry permit.","url":"/uscis-forms/Form-I-131-Application-Travel-Document.jsp"},{"iWantTo":"To renew my Permanent Resident Card (green card).","url":"/greencard/renewal-green-card-Form-I-90-replace.jsp"},{"iWantTo":"To replace my lost/damaged permanent resident card (green card).","url":"/greencard/renewal-green-card-Form-I-90-replace.jsp"}],"conditionresident":[{"iWantTo":"To correct an error on my permanent resident card (green card).","url":"/greencard/renewal-green-card-Form-I-90-replace.jsp"},{"iWantTo":"To replace my lost/damaged permanent resident card (green card).","url":"/greencard/renewal-green-card-Form-I-90-replace.jsp"}],"PermanentResident_GreencardHolder":[{"iWantTo":"To apply for U.S. Citizenship.","url":"/us-citizenship/U-S-Citizenship-application-Form-N-400.jsp"},{"iWantTo":"To find out about wartime naturalization.","url":"/us-citizenship/U-S-Citizenship-application-Form-N-400.jsp"},{"iWantTo":"To replace a lost, stolen or destroyed naturalization certificate/certificate of citizenship.","url":"/us-citizenship/Naturalization-Certificate-Citizenship-Form-N-565.jsp"}],"imigrantforms":[{"iWantTo":"Form I-90, Application to Replace or Renew Green card.","url":"/greencard/renewal-green-card-Form-I-90-replace.jsp"},{"iWantTo":"Form N-400, Application for Citizenship (Naturalization)","url":"/us-citizenship/U-S-Citizenship-application-Form-N-400.jsp"},{"iWantTo":"Form N-565, Application for Replacement Citizenship Document","url":"/us-citizenship/Naturalization-Certificate-Citizenship-Form-N-565.jsp"},{"iWantTo":"Form N-600, Application for Certificate of Citizenship","url":"/us-citizenship/Certificate-of-Citizenship-Form-N-600.jsp"},{"iWantTo":"I-131, Application for Travel Document","url":"/uscis-forms/Form-I-131-Application-Travel-Document.jsp"}],"refugeeasylee":[{"iWantTo":"To get a refugee travel document.","url":"/uscis-forms/Form-I-131-Application-Travel-Document.jsp"}]}
var iWanToSize=0;var noSelected=0;var defaultText="Select One";var defaultFrmAction="none";function showIAmList(){noSelected=noSelected+1;if(document.getElementById('iWantToList')!=null||document.getElementById('iWantToList')!=undefined){if(document.getElementById('iWantToList').style.display=="block"){hideTheBlock(document.getElementById('iWantToList'));}}
if(noSelected==1){showTheBlock(document.getElementById('iAmList'));hideTheBlock(document.getElementById('iWantToBlk'));document.getElementById('iAmList').style.marginTop='-8px'}else{showTheBlock(document.getElementById('iWantToBlk'));hideTheBlock(document.getElementById('iAmList'));noSelected=0;}}
function getIWantToList(SEL_iAmObj){var SELECTED_iAmObj=document.getElementById(SEL_iAmObj);noSelected=0;refreshIWanToList();refreshErrorMsg();var iAmObj=document.getElementById('iAm');var iAm=SELECTED_iAmObj.innerHTML;iAm=wrapText(iAm);iAmObj.innerHTML=iAm;iAm_Current=iAm;for(var i=0;i<iAmMap[SELECTED_iAmObj.id].length;i++){var nextIwantTo=iAmMap[SELECTED_iAmObj.id][i].iWantTo;var nextURL=iAmMap[SELECTED_iAmObj.id][i].url;appendIWantToValues(nextIwantTo,nextURL,"list"+i);iWanToSize++;}
hideTheBlock(document.getElementById('iAmList'));showTheBlock(document.getElementById('iWantToBlk'));}
function appendIWantToValues(iWantTo,url,uniqListId){var iWantToULObj=document.getElementById('selected-menu');if(parseInt(uniqListId.substring(4,5))>=5)
{iWantToULObj.setAttribute("class","second-menu-scroll")||iWantToULObj.setAttribute("className","second-menu-scroll");}
var dynaDIV=document.createElement("div");dynaDIV.id=uniqListId;dynaDIV.setAttribute("class","second-menu-list")||dynaDIV.setAttribute("className","second-menu-list");dynaDIV.onmouseover=function(){dynaDIV.style.background="#EBEBEB";}
dynaDIV.onmouseout=function(){dynaDIV.style.background="";}
iWantToULObj.appendChild(dynaDIV);var dynaUL=document.createElement("ul.menulist");dynaDIV.appendChild(dynaUL);var dynaLI=document.createElement("li.options");dynaUL.appendChild(dynaLI);var hrefObj=document.createElement("a");hrefObj.href="javascript:getIWantToURL('"+iWantTo+"','"+url+"')";hrefObj.innerHTML=iWantTo;dynaLI.appendChild(hrefObj);}
function refreshIWanToList(){var iWantToListObj=document.getElementById('selected-menu');if(iWanToSize>0){for(var i=0;i<iWanToSize;i++){var childTag=document.getElementById('list'+i);iWantToListObj.removeChild(childTag);}}
iWantToListObj.setAttribute("class","")||iWantToListObj.setAttribute("className","");iWanToSize=0;defaultFrmAction="none";document.getElementById('iWantTo').innerHTML=defaultText;}
function showIWantToList(){noSelected=noSelected+1;if(noSelected==1){showTheBlock(document.getElementById('iWantToList'));document.getElementById('iWantToList').style.marginTop='-8px';}else{hideTheBlock(document.getElementById('iWantToList'));noSelected=0;}}
function getIWantToURL(SELECTED_iWantTo,selUrl){noSelected=0;var iWantToObj=document.getElementById('iWantTo');iWantToObj.innerHTML=wrapText(SELECTED_iWantTo);iWantTo_Current=SELECTED_iWantTo;hideTheBlock(document.getElementById('iWantToList'));defaultFrmAction=selUrl;}
function selOne(){document.getElementById('iWantTo').innerHTML=defaultText;hideTheBlock(document.getElementById('iWantToList'));defaultFrmAction="none";noSelected=0;}
function goToPage(){refreshErrorMsg();if(defaultFrmAction!="none")
{var where_To_Div=document.getElementById('where-to-start');var where_To_form=document.createElement("form");where_To_form.id="where_To_form";where_To_form.action=defaultFrmAction;where_To_form.method="post";where_To_Div.appendChild(where_To_form);where_To_form.submit();}else{var Where_To_Begin_Txt=document.getElementById('Where_To_Begin_Txt');var dynaP=document.createElement("p");dynaP.id="ErrorMsg";dynaP.setAttribute("class","page-errors")||dynaP.setAttribute("className","page-errors");dynaP.innerHTML="Please select your option to proceed";Where_To_Begin_Txt.appendChild(dynaP);}}
function refreshErrorMsg(){if(document.getElementById('ErrorMsg')!=null||document.getElementById('ErrorMsg')!=undefined){var Where_To_Begin_Txt=document.getElementById('Where_To_Begin_Txt');Where_To_Begin_Txt.removeChild(document.getElementById('ErrorMsg'));}
if(document.getElementById('where_To_form')!=null||document.getElementById('where_To_form')!=undefined){var where_To_Div=document.getElementById('where-to-start');where_To_Div.removeChild(document.getElementById('where_To_form'));}}
function wrapText(text){if(text.length>25){text=text.substring(0,23)+"..";}
return text;}
function showTheBlock(htmlObj){htmlObj.style.display='block';}
function hideTheBlock(htmlObj){htmlObj.style.display='none';}
function respondToClick(event){var a=Event.element(event);if(a!=''||a!=null||a!=undefined){if(a.id!=''){if(a.id=='iAmBlock'||a.id=='iAmList'||a.id=='iAm'||a.id=='iWantToBlk'||a.id=='iWantTo'||a.id=='iWantToList'){return false;}}}
noSelected=0;hideTheBlock(document.getElementById('iAmList'));hideTheBlock(document.getElementById('iWantToList'));showTheBlock(document.getElementById('iWantToBlk'));}
Event.observe(document,'click',respondToClick);
