
function preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}
function findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function changeProp(objName,x,theProp,theValue) { //v3.0
  var obj = findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)) eval("obj."+theProp+"='"+theValue+"'");
}

var submitted = 0;
// usage: <input type="submit" name="update" value="Update" onclick="LockButton(this.form,'update');">
function LockButton (form,element) {
	if ( ! submitted ) { 
       form.elements[element].disabled=true;
       submitted = 1;
       form.submit;
   } else { alert("Form already submitted, please be patient"); }
}

function confirmSubmit() {
	var agree=confirm("Are you sure you wish to delete this contact?");
	if (agree) return true ;
	else return false ;
}

var newwindow = '';
function popitup(url) {
	if (!newwindow.closed && newwindow.location) {
		newwindow.location.href = url;
	}	else {
		newwindow=window.open(url,'name','height=500,width=200');
		if (!newwindow.opener) newwindow.opener = self;
	}
	if (window.focus) { newwindow.focus() }
	return false;
}
