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);

}

function createMovie ( fname, url, width, height, vars ) 
{
	document.write('<div id=' + fname + '></div>');
	var d = document.getElementById(fname);
	
	var flashCode ;
	
	flashCode = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' +  width + '" height="' +  height+ '"> <param name="movie" value="' +  url + '" /> <param name="quality" value="high" />  <param name="wmode" value="transparent" />  <param name="FlashVars" value="' + vars + '" />  <embed src="' +  url + '" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' +  width + '" height="' +  height+ '"></embed></object>';
	
	d.innerHTML = flashCode;
}

function show(divName)
{
	e = document.getElementById(divName);
	e.style.display =  "block";
	return false;
	
}
function hide(divName)
{

	e = document.getElementById(divName);
	e.style.display = "none";
	return false;
}

function outlineRed(divName)

{ 
	e = document.getElementById(divName);
	e.style.borderColor = "red";
	e.style.borderStyle = "solid";
	e.style.borderWidth = "1px";
	return false;
}

function outlineNone(divName)

{
	e = document.getElementById(divName);
	e.style.borderColor = "red";
	e.style.borderStyle = "none";
	e.style.borderWidth = "1px";
	return false;
}

function clearAlias()
{
	document.loginFormTop.username.value = '';	
}
function clearPass()
{
	document.loginFormTop.password.value = '';	
}

function show_2(divName)
{
	e = document.getElementById(divName);
	e.style.visibility =  "visible";
	return false;
	
}
function hide_2(divName)
{

	e = document.getElementById(divName);
	e.style.visibility = "hidden";
	return false;
}


$(function() {
	$(".highlights tr:even, #vendorList tr:even").attr("class", "alt");
	var $tabs_content = $("#home-tabs-content");
	if ($tabs_content.length > 0) {
		var curPane = "";
		
		$("#home-tabs a").click(function() {
			window.location.hash = $(this).attr("href");
			return false;
		});
		
		$(window).bind('hashchange', function() {
			curPane = window.location.hash;

			if (curPane) {
				$tabs_content
					.slideUp('fast')
					.find(".pane").hide('fast').end()
					.find(curPane).show('fast').end()
					.slideDown('slow');
				/*$("#home-tabs-content .pane:not("+curPane+")").slideUp('fast', function() {
					$(curPane).slideDown('slow');
				});*/
				$("#home-tabs .selected").removeClass('selected');
				$("#home-tabs a[href="+curPane+"]").addClass('selected');
			} else {
				$("#home-tabs-content .pane:not(#porque-jogar-no-bbn)").fadeOut('fast').addClass('hidden');
				$("#home-tabs a:first").addClass('selected');
			}
		});
		
		$(window).trigger('hashchange');
	}
});