var qsImgButtonArr = new Array();

//button class
function qsImgButton(_img) {	
	this.imgLo = new Image();
	this.imgHi = new Image();
	
	this.imgLo.src = _img.src;
	this.imgHi.src = _img.src.replace('_lo-','_hi-');
	
	_img.button = this;
	
	_img.lo = qsImgButtonLo;
	_img.hi = qsImgButtonHi;
	
	_img.onmouseout = _img.lo;
	_img.onmouseover = _img.hi;
	
}

function qsImgButtonLo(){
	this.src = this.button.imgLo.src
}

function qsImgButtonHi(){
	this.src = this.button.imgHi.src;
}

//initialize button
function qsImgButtonInit(_lyr){
	
	if(_lyr == null){
		_lyr = document;
	}
	
	for(var i=0; i < _lyr.images.length;i++){
		if(_lyr.images[i].name.indexOf('nav_home') != -1){
			qsImgButtonArr[_lyr.images[i].name] = new qsImgButton(_lyr.images[i]);
		}
	}
}

function launchGame(url,name,width,height,scrollbars,toolbar,location,directories,status,menubar,resizable) {
	
	
	popWidth = width;
	popHeight = height;
	PosX = (screen.width/2)-(popWidth/2);
	PosY = (screen.height/2)-(popHeight/2);
	
	refQuizshowPopup = window.open(url,
				name,
				'width=' + width 
				+ ',height=' + height 
				+ ',scrollbars=' + scrollbars 
				+ ',toolbar=' + toolbar 
				+ ',location=' + location 
				+ ',directories=' + directories 
				+ ',status=' + status 
				+ ',menubar=' + menubar 
				+ ',resizable=' + resizable
				+ ',top=' + PosY
				+ ',left=' + PosX);
	if (refQuizshowPopup)
		return false;
	else
		return true;
}

function openSantaRunChallenge(url) {
	launchGame(url, 'santarunPopup', 911, 676);
}