function oninitgenerate(){}
function onshowgenerate(){var a=getBG();if(document.getElementById("advanced"))document.getElementById("advanced").checked=parseInt(a.lpGetPref("generate_advanced",0));document.getElementById("length").value=parseInt(a.lpGetPref("generate_length",8));document.getElementById("upper").checked=parseInt(a.lpGetPref("generate_upper",1));document.getElementById("lower").checked=parseInt(a.lpGetPref("generate_lower",1));document.getElementById("digits").checked=parseInt(a.lpGetPref("generate_digits",1));
document.getElementById("special").checked=parseInt(a.lpGetPref("generate_special",0));document.getElementById("mindigits").value=parseInt(a.lpGetPref("generate_mindigits",1));document.getElementById("ambig").checked=parseInt(a.lpGetPref("generate_ambig",0));document.getElementById("reqevery").checked=parseInt(a.lpGetPref("generate_reqevery",1));if(document.getElementById("advanced")&&document.getElementById("advanced").checked==0)document.getElementById("advancedoptions").style.display="none";create_combo("password",
[]);dogenerate();a.g_checkgeneratepasswordcallback=function(){g_generate_found=true;sr(document,"generatesave","value","Accept");sr(document,"generateclose","value","Cancel")};if(g_ischrome)a.get_selected_tab(null,function(c){if(g_generate_url=="")g_generate_url=c.url;if(!g_tabid)g_tabid=c.id;a.sendCS(g_tabid,{cmd:"checkgeneratepassword"})});else if(g_issafari||g_isopera){if(g_isopera){g_generate_url=a.g_generate_url;if(g_generate_url=="")g_generate_url=a.g_generate_url_prev}else if(g_issafari)if(typeof g_generate_url==
"undefined"){g_generate_url=a.getcurrenturl();g_tabid=a.getcurrenttabid()}a.checkgeneratepassword(g_tabid)}}
function onhidegenerate(){var a=getBG();if(document.getElementById("advanced"))a.lpPutUserPref("generate_advanced",document.getElementById("advanced").checked?1:0);a.lpPutUserPref("generate_length",document.getElementById("length").value);a.lpPutUserPref("generate_upper",document.getElementById("upper").checked?1:0);a.lpPutUserPref("generate_lower",document.getElementById("lower").checked?1:0);a.lpPutUserPref("generate_digits",document.getElementById("digits").checked?1:0);a.lpPutUserPref("generate_special",
document.getElementById("special").checked?1:0);a.lpPutUserPref("generate_mindigits",document.getElementById("mindigits").value);a.lpPutUserPref("generate_ambig",document.getElementById("ambig").checked?1:0);a.lpPutUserPref("generate_reqevery",document.getElementById("reqevery").checked?1:0);a.lpWriteAllPrefs();if(g_issafari||g_isopera)a.update_prefs("generate")}
function dogenerate(){var a=document.getElementById("length").value,c=document.getElementById("upper").checked,d=document.getElementById("lower").checked,h=document.getElementById("digits").checked,g=document.getElementById("special").checked,f=document.getElementById("mindigits").value,i=document.getElementById("ambig").checked,b=document.getElementById("reqevery").checked;document.getElementById("password").style.fontFamily="courier";document.getElementById("password").value=lpCreatePass(a,c,d,
h,g,f,i,b);getBG().g_genpws.unshift(document.getElementById("password").value);getBG().g_genpws.length>20&&getBG().g_genpws.splice(20,getBG().g_genpws.length-20);repopulate_combo("password",getBG().g_genpws);document.getElementById("page_passwordmeterback")&&update_password_meter("",document.getElementById("password").value)}
function dosave(a){var c=getBG(),d=document.getElementById("password").value;if(typeof g_generate_found=="undefined")g_generate_found=false;g_generate_found||(typeof c.copytoclipboard=="function"?c.copytoclipboard(d):Clipboard.copy(d));c.savePassword(d,g_generate_url,g_tabid,!g_generate_found);if(a)setTimeout(function(){getBG().closePop()},0);else typeof g_ismenu!="undefined"&&g_ismenu?setTimeout(function(){window.close()},0):setTimeout(function(){getBG().closecurrenttab("")},0)}
function lpCreatePass(a,c,d,h,g,f,i,b){if(typeof a=="undefined")a=8+get_random(0,1);if(typeof c=="undefined")c=true;if(typeof d=="undefined")d=true;if(typeof h=="undefined")h=true;if(typeof g=="undefined")g=false;if(typeof f=="undefined")f=0;if(typeof i=="undefined")i=false;if(typeof b=="undefined")b=true;var j=0,l=0,m=0;if(b)j=l=m=1;b=[];if(d&&j>0)for(var e=0;e<j;e++)b[b.length]="L";if(c&&l>0)for(e=0;e<l;e++)b[b.length]="U";if(h&&f>0)for(e=0;e<f;e++)b[b.length]="D";if(g&&m>0)for(e=0;e<m;e++)b[b.length]=
"S";for(;b.length<a;)b[b.length]="A";b.sort(function(){return get_random(0,1)*2-1});f="";j="abcdefghjkmnpqrstuvwxyz";i||(j+="ilo");if(d)f+=j;d="ABCDEFGHJKMNPQRSTUVWXYZ";i||(d+="ILO");if(c)f+=d;c="23456789";i||(c+="10");if(h)f+=c;if(g)f+="!@#$%^&*";h="";for(g=0;g<a;g++){var k;switch(b[g]){case "L":k=j;break;case "U":k=d;break;case "D":k=c;break;case "S":k="!@#$%^&*";break;case "A":k=f}e=get_random(0,k.length-1);h+=k.charAt(e)}return h}
function showhideadv(){var a=document.getElementById("advancedoptions");a.style.display=a.style.display=="none"?"":"none"};
