var ih_tmr,g_ih_prefix="",g_ih_data="",g_ih_sort_option,g_ih_sort_direction,g_max_len=255;
var g_ih_fn="",g_ih_e=1,g_ih_sl=10,g_ih_eid,g_ih_l=0;
function Init(){
if(top.location.href.indexOf("ihistory")!=-1){
document.location.replace("index.php");
return void (0);
}
var q=fWL().href;
q=q.substr(q.indexOf("?")+1);
var c=q.split("&"),n,v,qv=new Object;
for(var i=0;i<c.length;i++){
n=c[i].substr(0,c[i].indexOf("="));
qv[n]=fDE(c[i].substr(c[i].indexOf("=")+1));
}
g_ih_prefix=qv.prefix;
g_ih_eid=qv.e;
g_ih_fn=qv.f;
g_ih_e=fGC("parameter_history_enabled");
if(g_ih_e==""){
g_ih_e=1;
}
g_ih_data=fGC(g_ih_prefix+"search");
g_ih_data=(!g_ih_data)?"":g_ih_data;
g_ih_sort_option=fGC(g_ih_prefix+"sort_option");
g_ih_sort_option=(g_ih_sort_option==1)?1:0;
g_ih_sort_direction=fGC(g_ih_prefix+"sort_direction");
g_ih_sort_direction=(g_ih_sort_direction=="ASC")?"ASC":"DESC";
ih_fLUV();
g_ih_l=1;
return void (0);
}
function ih_fT(){
ih_tmr=window.setTimeout("ih_fGH()",30000);
return 1;
}
function ih_fGH(){
if(ih_tmr!==undefined){
window.clearTimeout(ih_tmr);
}
if(g_ih_fn!=""){
top.frames[g_ih_fn].h_fHG(g_ih_prefix);
}else{
top.h_fHG(g_ih_prefix);
}
return 1;
}
function ih_fRT(){
if(ih_tmr!==undefined){
window.clearTimeout(ih_tmr);
}
ih_fT();
return 1;
}
function ih_fLD(e){
if(!confirm("Continue to delete this item?   \n\n")){
return 1;
}
var a=g_ih_data.split("^"),_9="",a2;
for(var i=0;i<a.length;i++){
a2=a[i].split("|");
if(a2[0]!=e&&a2[0]!=""){
_9+=a[i]+"^";
}}
if(_9=="^"){
_9="";
}
g_ih_data=_9;
fSC(g_ih_prefix+"search",g_ih_data,0);
ih_fLUV();
return 1;
}
function ih_fLDA(){
if(!confirm("Continue to delete all entries? \n\n")){
return 1;
}
g_ih_data="";
fSC(g_ih_prefix+"search","",0);
ih_fLUV();
return 1;
}
function ih_fLS(){
if(g_ih_data!=""){
var cd=g_ih_data;
if(cd.substr(cd.length-1,1)=="^"){
cd=cd.substr(0,cd.length-1);
}
var _c=cd.split("^");
if(g_ih_sort_option==0){
_c.sort();
if(g_ih_sort_direction!="ASC"){
_c.reverse();
}
}else{
var _d="",a2,t="";
for(var i=0;i<_c.length;i++){
a2=_c[i].split("|");
if(a2.length>=1){
t=a2[0];
a2[0]=a2[1];
a2[1]=t;
_d+=a2.join("|")+"^";
}}
if(_d.substr(_d.length-1,1)=="^"){
_d=_d.substr(0,_d.length-1);
}
_c=_d.split("^");
_c.sort();
if(g_ih_sort_direction!="ASC"){
_c.reverse();
}
_d="";
for(var i=0;i<_c.length;i++){
a2=_c[i].split("|");
if(a2.length>=1){
t=a2[0];
a2[0]=a2[1];
a2[1]=t;
_d+=a2.join("|")+"^";
}}
if(_d.substr(_d.length-1,1)=="^"){
_d=_d.substr(0,_d.length-1);
}
_c=_d.split("^");
}
g_ih_data=_c.join("^")+"^";
}else{
}}
function ih_fLAU(e){
if(!g_ih_e||!e){
return 1;
}
e[0]=e[0].replace("|","");
e[0]=e[0].replace("^","");
var n_s=e.join("|");
var p=g_ih_data.indexOf(n_s);
var d=new Date();
d=Date.parse(d.toLocaleString());
if(p!=-1){
var sp=g_ih_data.lastIndexOf("^",p);
sp=(sp==-1)?0:sp;
sp++;
var ep=g_ih_data.indexOf("|",sp);
var ts=g_ih_data.substr(sp,ep-sp);
g_ih_data=g_ih_data.replace(ts,d);
}else{
ih_fLS();
c_d=g_ih_data;
if(c_d.substr(c_d.length,1)=="^"){
c_d=c_d.substr(0,c_d.length-1);
}
var a=c_d.split("^");
if(a.length>=g_ih_sl){
var iso=g_ih_sort_option;
var isd=g_ih_sort_direction;
if(iso!=0||isd!="DESC"){
g_ih_sort_option=0;
g_ih_sort_direction="DESC";
ih_fLS();
c_d=g_ih_data;
if(c_d.substr(c_d.length,1)=="^"){
c_d=c_d.substr(0,c_d.length-1);
}
a=c_d.split("^");
}
a.pop();
g_ih_data=a.join("^")+"^";
if(iso!=g_ih_sort_option||isd!=g_ih_sort_direction){
g_ih_sort_direction=iso;
g_ih_sort_option=isd;
ih_fLS();
}}
g_ih_data+=d+"|"+n_s+"^";
}
fSC(g_ih_prefix+"search",g_ih_data,0);
ih_fLUV();return 1;
}
function ih_fLUV(){
var a2,t="",s="",sp="",c=0,b="",cl="",f=0;
var h="";
ih_fRT();
if(g_ih_sort_direction=="ASC"){
t="Asc";
s="Change to sort descending";
}else{
s="Change to sort ascending";
t="Desc";
}
a2=fID("a_hfSD");
while(a2.hasChildNodes()){
a2.removeChild(a2.lastChild);
}
a2.appendChild(fTN(t));
a2.title=s;
if(g_ih_sort_option==0){
t="Date";
s="Change to sort by text";
}else{
s="Change to sort by date";
t="Text";
}
a2=fID("a_hfS");
while(a2.hasChildNodes()){
a2.removeChild(a2.lastChild);
}
a2.appendChild(fTN(t));
a2.title=s;
if(fID("ih_data").innerHTML==undefined){
h="<tr class=\"r\"><td style=\"border-top:1px solid #B0C4DE\" class=\"l\">Upgrade to a recent version of a popular browser for this feature.</td></tr>";
f=1;
}else{
if(g_ih_e!=1){
h="<tr><td class=\"or\" style=\"text-align:right\"><a class=\"ih\" href=\"javascript:;\" onclick=\"ih_fRE()\">Re-enable this feature.</a></td></tr>";
f=1;
}else{
if(g_ih_data==""){
c=1;
h="<tr class=\"r\"><td style=\"border-top:1px solid #B0C4DE\" class=\"l\">No recent history found</td></tr>";
}else{
ih_fLS();
var a=g_ih_data.split("^");
for(var i=0;i<a.length;i++){
a2=a[i].split("|");
if(a2.length>=2){
t=a2[0];
s=fDE(a2[1]);
sp=s.replace("\\","");
if(sp.length>g_max_len){
sp=sp.substr(0,g_max_len-3)+"...";
}
c++;
b=((c==1)?" style=\"border-top:1px solid #B0C4DE\" ":"");
cl=((cl=="rh")?"r":"rh");
h+="<tr class=\""+cl+"\"><td class=\"l\" "+b+"><a class=\"ih\" href=\"javascript:;\" onclick=\"ih_fLSEL("+i+")\" title=\"Select\">"+sp+"</a></td><td "+b+"><a class=\"ihd\" href=\"javascript:;\" onclick=\"ih_fLD("+t+")\">Delete</a></td></tr>";
}}}}}
if(!f){
cl=((cl=="rh")?"r":"rh");
b=((c==1)?" style=\"border-top:1px solid #B0C4DE\" ":"");
h+="<tr class=\""+cl+"\"><td colspan=\"2\" style=\"padding-top:3px;border-bottom:0px solid #fff;text-align:right\"><a class=\"ih\" href=\"javascript:;\" onclick=\"ih_fLDF()\" title=\"Delete all items and disabled feature\">Disable feature</a></td></tr>";
}
h="<table summary=\"Parameter history\" class=\"ih\" cellspacing=\"0\">"+h+"</table>";
fID("ih_data").innerHTML=h;
return 1;
}
function ih_fLSO(){
g_ih_sort_option=(g_ih_sort_option==0)?1:0;
fSC(g_ih_prefix+"sort_option",g_ih_sort_option,0);
ih_fLUV();
return 1;
}
function ih_fLSD(){
var t="",tt="";
g_ih_sort_direction=(g_ih_sort_direction=="DESC")?"ASC":"DESC";
fSC(g_ih_prefix+"sort_direction",g_ih_sort_direction,0);
ih_fLUV();
return 1;
}
function ih_fRE(){
g_ih_e=1;
fSC("parameter_history_enabled",1,0);
ih_fLUV();
return 1;
}
function ih_fLDF(){
if(!confirm("Delete all items and disabled this \nWeb site feature?\n\nNote: You will have to refresh the page \nto delete recent history currently displayed \nin other fields.\n\n")){
return 1;
}
var a=new Array("ba_","bw_","aah_","awh_","dirh_addr1_");
var n="",c=document.cookie.split("; "),qv=new Object();
for(var i=0;i<c.length;i++){
for(var i2=0;i2<a.length;i2++){
n=c[i].substr(0,c[i].indexOf("="));
if(n.substr(0,a[i2].length)==a[i2]){
fSC(n,"",0);
}}}
g_ih_data="";
fSC("parameter_history_enabled",0,0);
g_ih_e=0;
ih_fLUV();
ih_fGH();
return 1;
}
function ih_fLSEL(e){
var a=g_ih_data.split("^");
var a2=a[e].split("|");
e=a2[1];
if(g_ih_fn!=""){
top.frames[g_ih_fn].document.getElementById(g_ih_eid).value=e;
}else{
top.document.getElementById(g_ih_eid).value=e;
}
ih_fGH();
return 1;
}
function ih_fKD(evt){
var s=fKC(evt);
if(s==94||s==124){
alert("Carets and bar characters are reserved.   \n\n");
return false;
}return 1;
}
function ih_fZ(){
if(!g_ih_l){
return 1;
}
ih_fRT();
if(g_ih_fn!=""){
if(top.frames[g_ih_fn].h_fZ){
top.frames[g_ih_fn].h_fZ(g_ih_prefix);
}
}else{
if(top.h_fZ){
top.h_fZ(g_ih_prefix);
}}return 1;}
function ih_fVL(){
	
var d=fID('d_body'),q=d.offsetWidth;
if(!q){return 1;}q-=2;
if(d.offsetHeight < d.scrollHeight){q=q-18;}q=q+'px';
var t=g_d.getElementsByTagName('TABLE');
for(i=0;i<t.length;i++){t[i].style.width=q;}
fIS("ih_data").width=q;
return 1;
}

