/* PRIZEKING JS - SM20042009 */

//setTimeout("showDiv()", 300000); // this is to show the popup that fades the main window etc after 5 minutes

function popUp2(winname,URL,w,h) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;

	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + winname + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width="+w+",height="+h+",left="+winl+",top="+wint+"');");
}

function uppercase()
{
	key = window.event.keyCode;
	if ((key > 0x60) && (key < 0x7B))
	window.event.keyCode = key-0x20;
}


function hideDiv() { 
	if (document.getElementById) { // DOM3 = IE5, NS6 
		document.getElementById('hideshow').style.visibility = 'hidden'; 
	} else { 
		if (document.layers) { // Netscape 4 
			document.hideshow.visibility = 'hidden'; 
		} else { // IE 4 
			document.all.hideshow.style.visibility = 'hidden'; 
		} 
	} 
}
	 
function showDiv() { 
	if (document.getElementById) { // DOM3 = IE5, NS6 
		document.getElementById('hideshow').style.visibility = 'visible'; 
	} else { 
		if (document.layers) { // Netscape 4 
			document.hideshow.visibility = 'visible'; 
		} else { // IE 4 
			document.all.hideshow.style.visibility = 'visible'; 
		} 
	} 
} 

function hideLogin() { 
	if (document.getElementById) { // DOM3 = IE5, NS6 
		document.getElementById('hidelogin').style.visibility = 'hidden'; 
	} else { 
		if (document.layers) { // Netscape 4 
			document.hidelogin.visibility = 'hidden'; 
		} else { // IE 4 
			document.all.hidelogin.style.visibility = 'hidden'; 
		} 
	} 
}
	 
function showLogin() { 
	if (document.getElementById) { // DOM3 = IE5, NS6 
		document.getElementById('hidelogin').style.visibility = 'visible'; 
	} else { 
		if (document.layers) { // Netscape 4 
			document.hidelogin.visibility = 'visible'; 
		} else { // IE 4 
			document.all.hidelogin.style.visibility = 'visible'; 
		} 
	} 
} 

function preloadimages(){
	var myimages=new Array()
	for (i=0;i<preloadimages.arguments.length;i++){
		myimages[i]=new Image()
		myimages[i].src=preloadimages.arguments[i]
	}
}

function preventClose() {
	return "You may be missing out on winning some GREAT PRIZES!";
}
// the issue with this is that it will pop the confirm dialog box when the user refreshes the page or navigates to another page so this is disabled for now
/*window.onbeforeunload = preventClose;*/

function toUnicode(elmnt,content){
    if (content.length==elmnt.maxLength){
      next=elmnt.tabIndex
      if (next<document.forms[0].elements.length){
        document.forms[0].elements[next].focus()
    }
  }
}

function isNumberKey(evt)
{
	
    var charCode = (evt.which) ? evt.which : event.keyCode
    
    if ( charCode > 31 && (charCode < 48 || charCode > 57))
    {

	return false;	
     } 
    else  
    {
	
	return true;
    }
}

/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Cyanide_7 |  */
var isNN = (navigator.appName.indexOf("Netscape")!=-1);

function autoTab(input,len, e) {
  var keyCode = (isNN) ? e.which : e.keyCode; 
  var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
  if(input.value.length >= len && !containsElement(filter,keyCode)) {
    input.value = input.value.slice(0, len);
    input.form[(getIndex(input)+1) % input.form.length].focus();
  }

  function containsElement(arr, ele) {
    var found = false, index = 0;
    while(!found && index < arr.length)
    if(arr[index] == ele)
    found = true;
    else
    index++;
    return found;
  }

  function getIndex(input) {
    var index = -1, i = 0, found = false;
    while (i < input.form.length && index == -1)
    if (input.form[i] == input)index = i;
    else i++;
    return index;
  }
  return true;
}

function popUp(URL,w,h) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;

	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width="+w+",height="+h+",left="+winl+",top="+wint+"');");
}
