
function popUp(URL) {
	day = new Date();
	id = "fhmrf";
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=0,width=750,height=500');");
	eval("page" + id + ".focus();");
}

function navSubmit($step){
	document.nav.action = "grant_" + $step + ".php";
	document.nav.submit();
}

function submitGrant($dir){
	
	document.grant.dir.value = $dir;
	document.grant.submit();
	
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		menu_about_us_over = newImage("images/menu_about_us-over.gif");
		menu_contact_over = newImage("images/menu_contact-over.gif");
		menu_calendar_over = newImage("images/menu_calendar-over.gif");
		menu_research_over = newImage("images/menu_research-over.gif");
		menu_awards_over = newImage("images/menu_awards-over.gif");
		menu_supporters_over = newImage("images/menu_supporters-over.gif");
		preloadFlag = true;
	}
}

function scrollerObj(name,initH,initW,heightB,widthB,content,initBg,Bg,speed,initFl){
	this.name=name;
	this.initH=initH;
	this.initW=initW;
	this.heightB=heightB;
	this.widthB=widthB;
	this.content=content;
	this.initBg=initBg;
	this.Bg=Bg;
	this.iniFl=initFl;
	this.speed=parseInt(speed);
	this.timer = name + "Timer";
	this.elem;
	this.getElement = getElement;
	this.createLayer=createLayer;
	this.scrollLayer = scrollLayer;
	this.scrollLoop=scrollLoop;
	this.createLayer();
	this.getElement();
	this.scrollLayer();
}

function scrollLoop(s){
	this.speed = s;
}

function scrollLayer(){
	//alert("elem left:" + this.elem.style.left + "\noffset width:" + this.elem.offsetWidth); 
	if(parseInt(this.elem.style.left) + (this.elem.offsetWidth) > 0){

		this.elem.style.left = parseInt(this.elem.style.left)-this.speed;
		//this.elem.style.top = parseInt(this.elem.style.top)-this.speed;

		//alert(parseInt(this.elem.style.left)+"\n"+this.elem.id);

	}else {
		//alert(this.initH);
		this.elem.style.left = this.initW;
	}
}




function getElement(){
	if(document.getElementById){
		this.elem = document.getElementById(this.name);
	} else if (document.all){
		this.elem = document.all[name];
	} else if (document.layers){
		this.elem = document.layers[name];
	}
}

//**pretty obvious - if NS4 - please upgrade to a standard compliant browser**//

function createLayer(){

	if(document.getElementById || document.all){

		document.write('<div id="layer'+this.name+'" style="position:relative;overflow:hidden;float:'+this.initFl+';border:0px solid black;width:'+this.initW+'px;height:'+this.initH+'px;" onMouseover="'+this.name+'.scrollLoop(0)" onMouseout="'+this.name+'.scrollLoop('+this.speed+')">');

		document.write('<div id="'+this.name+'" style="position:absolute;top:0px;color: #515054;left:'+this.initW+'px;border:0px solid black;width:'+this.widthB+'px;height:'+this.heightB+'px;">');

		document.write(this.content);

		document.write('<\/div><\/div>');

	} else if(document.layers){

		document.write('<ilayer name="'+this.name+'" width="'+this.widthB+'" height="'+this.heightB+'">'+this.content+'<\/ilayer>');

		return;

	}

	if(this.scrollLayer){

		this.timer = setInterval(this.name+'.scrollLayer()','60');

	}

}
