/**
 * hides a given div by id
 */
function showDiv(divId,show,e) {
    var w = 425;
	var h = 320;
	var cover = document.getElementById('cover');
	var flash = document.getElementById('flash');
	var IE5 = false;
	var NN4 = false;
	var NN6 = false;
	var OPA = false;
	
	if(navigator.userAgent.toLowerCase().indexOf("opera")+1) {OPA=true;}
	else if(document.all){ IE5=true;}
	else if(document.layers){ NN4=true;}
	else if(document.getElementById){ NN6=true;}
	
	// get the object
	obj = getObject(divId);
	
	// return if the object is null
	if (obj == null) {
		return;
	}
	
	if(NN4 || NN6) {
		xc=Math.round((window.innerWidth/2)-(w/2));
		yc=Math.round((window.innerHeight/2)-(h/2));
	} else {
		xc=Math.round((document.body.clientWidth/2)-(w/2));
		yc=Math.round((document.body.clientHeight/2)-(h/2));
	}
	// reposition div
	if(this.NN4) {
		obj.moveTo(xc,yc);
	} else {
		obj.style.left = xc + "px";
		obj.style.top = yc + "px";
	}
	
    obj.style.display = show ? 'block' : 'none';
  	obj.style.visibility = show ? 'visible' : 'hidden';
  	cover.style.display = show ? 'block' : 'none';
  	if(flash) {
  		flash.style.visibility = show ? 'hidden' : 'visible';
  	}
}

/**
 * Retrieves an object based on id
 */
function getObject(divId) {
	var obj;
	if ( document.getElementById ) {
		obj = document.getElementById(divId);
	} else if ( document.all ) {
		obj = document.all.item(divId);
	} else {
		obj = null;
	}
	return obj;
}

/**
 * Centers an object on the screen
 */
function center(object)
 {
  object.style.marginLeft = "-" + parseInt(object.offsetWidth / 2) + "px";
  object.style.marginTop = "-" + parseInt(object.offsetHeight / 2) + "px";
 }

