function openwindowlink(url) {
  newwin = window.open(url, 'Game','scrollbars=0,resizable=1,height=475,width=600');
}

function openWindow(form, popName, widthVal, heightVal, resizeVal){
		//alert("form="+form+"\npopName="+popName+"\nwidthVal="+widthVal+"\nheightVal="+heightVal+"\nresizeVal="+resizeVal);
		var xx = null;
		// convert heightVal to integer to allow for addition of 50px for TopPosition
		heightVal = parseInt(heightVal);
		LeftPosition = (screen.width) ? (screen.width-widthVal)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-(heightVal+50))/2 : 0;
		if (LeftPosition < 0) {	LeftPosition = 0;}
		if (TopPosition < 0) {	TopPosition = 0;}
		windowprops = "left="+LeftPosition+",top="+TopPosition+",width="+widthVal+",height="+heightVal+",location=no,scrollbars=no,menubars=no,toolbars=no,resizable="+resizeVal+",fullscreen=no";
		xx = window.open("", popName, windowprops);
		form.target=popName;
		form.submit();
		xx.focus();
		return false;
	}
function submitForm(form){
		form.submit();
		return false;
	}

function popFreeGame(URL, popName){
		var xx = null;
		LeftPosition = (screen.width) ? (screen.width-600)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-525)/2 : 0;
		windowprops = "left="+LeftPosition+",top="+TopPosition+",height=475,width=600,location=no,scrollbars=no,menubars=no,toolbars=no,resizable=no,fullscreen=no";
		xx = window.open(URL, popName, windowprops);
		xx.focus();
	}

function calcPrizeStrings75(){
  var prize ='';

  //IF THERE ARE TWO FIXED PRIZES THIS SHOULD RUN
  if (document.forms[0].prizeString[0]!=null && document.forms[0].prizeString[1]!=null) {
	for (x=0; x < 75;x++) {
	  prize = prize + document.forms[0].call[x].value;
	  if(x < 74) {
		prize = prize + ',';
	  }
	}
	document.forms[0].prizeString[0].value=prize;
	prize='';
	for (x=75; x < 150;x++) {
	  prize = prize + document.forms[0].call[x].value;
	  if(x < 149) {
		prize = prize + ',';
	  }
	}
	document.forms[0].prizeString[1].value=prize;
  }

  //IF THERE IS JUST ONE THEN RUN THIS
  if (document.forms[0].prizeString !='undefined') {
	  for (x=0; x < 75;x++) {
		prize = prize + document.forms[0].call[x].value;
		if(x < 74) {
		  prize = prize + ',';
		}
	  }
	  document.forms[0].prizeString.value=prize;
  }

}


function calcPrizeStrings90(){
  var prize ='';

  //IF THERE ARE MORE THAN ONE FIXED PRIZES THIS SHOULD RUN
  if (document.forms[0].prizeString[0]!=null && document.forms[0].prizeString[1]!=null) {
	for (x=0; x < 90;x++) {
	  prize = prize + document.forms[0].call[x].value;
	  if(x < 89) {
		prize = prize + ',';
	  }
	}
	document.forms[0].prizeString[0].value=prize;
	prize='';
	for (x=90; x < 180;x++) {
	  prize = prize + document.forms[0].call[x].value;
	  if(x < 179) {
		prize = prize + ',';
	  }
	}
	document.forms[0].prizeString[1].value=prize;
	//IF THE THIRD ONE EXISTS THEN SET THAT PRIZE STRING AS WELL
	if(document.forms[0].prizeString[2]!=null) {
	  prize='';
	  for (x=180; x < 270;x++) {
	   prize = prize + document.forms[0].call[x].value;
		if(x < 269) {
	  prize = prize + ',';
		}
	  }
	  document.forms[0].prizeString[2].value=prize;
	}

  }

  //IF THERE IS JUST ONE THEN RUN THIS
  if (document.forms[0].prizeString !='undefined') {
	  for (x=0; x < 75;x++) {
		prize = prize + document.forms[0].call[x].value;
		if(x < 74) {
		  prize = prize + ',';
		}
	  }
	  document.forms[0].prizeString.value=prize;
  }
}

//Oct 14, 2003
//simple utility for notification, not refined, included for prototyping
//jr
function openMessageWindow(msg, height, width) {
  newwin = window.open('', 'Message','scrollbars=0,resizable=1,height=' + height + ',width=' + width);
  newwin.document.write(msg);
  newwin.document.close();

}

function showMessage(msg) {
  alert(msg);

}

var pop = null;
function popWindow(URL, myWidth, myHeight){
	LeftPosition = (screen.width) ? (screen.width-myWidth)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-myHeight)/2 : 0;
	specs ='height='+myHeight+',width='+myWidth+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no,resizable=yes,toolbar=no, menubar=no'
	pop = window.open(URL,"GroopzLiveHelp",specs);
	pop.focus();
}

function popDownload(){
	var tvbDL = null;
	var specs = null;
	specs = "left=100,top=150,width=460,height=200,location=no,scrollbars=no,menubars=no,toolbars=no,resizable=no,fullscreen=no";
	tvblDL = window.open("popbingodl.action","TVBDownload",specs)
	tvblDL.focus();
	return false;
}

var help = null;

function popHelp(URL, myWidth, myHeight){

	LeftPosition = (screen.width) ? (screen.width-myWidth)/2 : 0;

	TopPosition = (screen.height) ? (screen.height-myHeight)/2 : 0;

	specs ='height='+myHeight+',width='+myWidth+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,resizable=yes,toolbar=no, menubar=no'

	help = window.open(URL,"BingoDownloadHelp",specs);

	help.focus();

}

function showLayer(layerid){
	document.getElementById(layerid).style.visibility = "visible";
}

function hideLayer(layerid){
	document.getElementById(layerid).style.visibility = 'hidden';
}

function hideAll(){
	var arrImages =  new Array('ORANGE','BLUE','RED','GREEN','FREE');
	var intLength = arrImages.length;
	for (var i = 0; i < intLength; i++) {
	  document.getElementById(arrImages[i]).style.visibility = 'hidden';
   } 
}

function hideAllInfo(){
	var arrInfoDivs =  new Array('ORANGE','BLUE','RED','GREEN','FREE','default_info');
	var intInfoLength = arrInfoDivs.length;
	for (var i = 0; i < intInfoLength; i++) {
	  document.getElementById(arrInfoDivs[i]+'_info').style.visibility = 'hidden';
   }
}
	
function hideblock(layerName)
{
	var element = document.getElementById (layerName);
	element.style.display = "none";
	var element = document.getElementById ('default_info');
	element.style.display = "block";
}
function showblock(layerName2)
{
	var element = document.getElementById (layerName2);
	element.style.display = "block";
	var element = document.getElementById ('default_info');
	element.style.display = "none";
}



function showLayerInfo(layerid){
	hideAllInfo();
	document.getElementById(layerid).style.visibility = "visible";
}

function hideLayerInfo(layerid){
	document.getElementById(layerid).style.visibility = 'hidden';
	showLayer('default_info');
}

var popWD = null;
function popWDWindow(URL, myWidth, myHeight){
	LeftPosition = (screen.width) ? (screen.width-myWidth)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-myHeight)/2 : 0;
	specs ='height='+myHeight+',width='+myWidth+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,resizable=yes,toolbar=no, menubar=no'
	popWD = window.open(URL,"GroopzLiveHelp",specs);
	popWD.focus();
}

function changenav(id){
for(i=1; i<4; i++){
document.getElementById("subnav"+i).style.display="none";
}
document.getElementById(id).style.display="block";
}
function hide(){
	for(i=1; i<4; i++){
	document.getElementById("subnav"+i).style.display="none";
	}
}

function toggle_visibility(id,imgid) {
	var e = document.getElementById(id);
	var img = document.getElementById(imgid);
	if(e.style.display == 'block')
	
	{          e.style.display = 'none';
	img.src = "html/images/plus.gif";		
	}
	else
	{
	  e.style.display = 'block';
	  img.src = "html/images/minus.gif";		  		  
	} 
	}
	
	
function Collapse_All() {	
	
	var e = document.getElementById('form1');
	  e.style.display = 'none';
	  document.getElementById("imageToggle1").src = "html/images/plus.gif";
	 e = document.getElementById('form2');
	  e.style.display = 'none';
	document.getElementById("imageToggle2").src = "html/images/plus.gif";
	e = document.getElementById('form3');
	  e.style.display = 'none';
	document.getElementById("imageToggle3").src = "html/images/plus.gif";
	e = document.getElementById('form4');
	  e.style.display = 'none';
	document.getElementById("imageToggle4").src = "html/images/plus.gif";
	e = document.getElementById('form5');
	  e.style.display = 'none';
	document.getElementById("imageToggle5").src = "html/images/plus.gif";
	}
	function Expand_All() {	
	
	var e = document.getElementById('form1');
	  e.style.display = 'block';
	   document.getElementById("imageToggle1").src = "html/images/minus.gif";
	 e = document.getElementById('form2');
	  e.style.display = 'block';
		document.getElementById("imageToggle2").src = "html/images/minus.gif";
	e = document.getElementById('form3');
	  e.style.display = 'block';
		document.getElementById("imageToggle3").src = "html/images/minus.gif";
	e = document.getElementById('form4');
	  e.style.display = 'block';
		document.getElementById("imageToggle4").src = "html/images/minus.gif";
	e = document.getElementById('form5');
	  e.style.display = 'block';
	   document.getElementById("imageToggle5").src = "html/images/minus.gif";
	
	}

//Fix png transparent issues in IE6
$(document).ready(function(){
	$('.signUpNowLogo').supersleight();
	$("input:visible:enabled:first").focus();
});

function bodyonload()
{
	document.getElementById('wrap').style.visibility='visible';
	document.loginForm.username.focus();
}

function bodyHomeonload()
{
	document.getElementById('wrap').style.visibility='visible';
	document.getElementById('flashBox').style.visibility='visible';
	document.loginForm.username.focus();
}
	
function checkEnter(e,i){ //e is event object passed from function invocation
	var characterCode //literal character code will be stored in this variable
	
	if(e && e.which){ //if which property of event object is supported (NN4)
	e = e
	characterCode = e.which //character code is contained in NN4's which property
	}
	else{
	e = event
	characterCode = e.keyCode //character code is contained in IE's keyCode property
	}
	
	if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
	document.forms[i].submit() //submit the form
	return false
	}
	else{
	return true
	}
}
	