try {
  document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}

function imgRO(imgName,imgSrc) {
	if (document.images) {
		document[imgName].src = imgSrc;
	}
}

function goPage(thePage,theWidth,theHeight) {
	window.open(thePage,'','scrollbars=0,toolbar=0,left=30,top=30,resizable=no,width='+theWidth+',height='+theHeight);
}

function goPage2(thePage,theWidth,theHeight) {
	window.open(thePage,'','scrollbars=yes,toolbar=0,left=30,top=30,resizable=yes,width='+theWidth+',height='+theHeight+'');
}

function goPage3(thePage) {
	window.open(thePage,'','');
}

function jump(thePage) {
	document.location.href=thePage;
}

function ecmsExit(theWin,theLink) {
	alert(ecmsExitText(theWin));
	if (theWin==0) {
		document.location.href=theLink;
	} else {
		window.open(theLink,'');
	}
}

function showBox(theBox,theVisibility,saveCookie) {
    var d0 = "block";
    var d1 = "none";
    if (theVisibility==1) {
        d0 = "none";
        d1 = "block";
    }
    try {
        gbid(theBox+'0').style.display=d0;
    } catch(e){}
    try {
        gbid(theBox+'1').style.display=d1;
    } catch(e){}
    if (saveCookie==1) {
		document.cookie = theBox+"="+theVisibility;
    }
}

function ajaxFunction(){
  var objXMLHttp=null;
  try {
    // Firefox, Opera 8.0+, Safari
    objXMLHttp=new XMLHttpRequest();
  }
  catch (e) {
    // Internet Explorer
    try {
      objXMLHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e) {
      try {
        objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch (e) {
        objXMLHttp=null;
      }
    }
  }
  return objXMLHttp;
}

function gbid(theID) {
	return document.getElementById(theID);
}

navArray = new Array();

function arNavEnter(c,v) {
	if (isNaN(navArray[c])) {
		navArray[c]=0;
	}
	navArray[c]+=v;
	var p=gbid(c+'a').className.indexOf('-parent')>-1;
	if (navArray[c]>0) {
		gbid(c).className='ar-nav-entry-hover';
		p ? gbid(c+'_').className='ar-nav-sub-hover' : void(0);
	} else {
			setTimeout("arNavExit('"+c+"',"+p+")",5);
	}
}

function arNavExit(c,p) {
	if (navArray[c]<1) {
		gbid(c).className='ar-nav-entry';
		p ? gbid(c+'_').className='ar-nav-sub' : void(0);
	}
}

function ecmsCommentMode(f,m) {
    var theForm=eval('document.commentForm'+f);
	theForm.commentMode.value=m;
	theForm.submit();
}

function arGoMemberLibrary(p,aff,af,mode) {
    goPage2('library.asp?profile='+p+'&libraryMode='+mode+
    '&affParent='+aff+'&af='+af,780,560);
}

function arUpdateImageField(af) {
    try{
    gbid('apEditImageInput').value=af;
    gbid('apEditImagePreview').src='file.asp?type=thumb&id=' + af;
    } catch(ex) {}
}

function arEventKey(ev) {
    if (ev.which) {
        return ev.which;
    } else {
        return ev.keyCode;
    }
}

function arFPGPrevious(id,n) {
    gbid(id).fpg_previous.value=n;
    gbid(id).submit();
}
