$(document).ready(function(){ 
						   
	// Unobtrusive JavaScript: Remove Unwanted Link Border Outlines
	// @ http://www.mikesmullin.com/2006/06/16/removing-the-dotted-outline-from-focused-links
	
	var runOnLoad = new Array();
	window.onload = function() {
		for(var i = 0; i < runOnLoad.length; i++) runOnLoad[i]() 
	}
	if(document.getElementsByTagName)
	for(var i in a = document.getElementsByTagName('a')) {
		a[i].onmousedown = function() { 
			this.blur();                 // most browsers 
			this.hideFocus = true;       // internet explorer
			this.style.outline = 'none'; // mozilla
		}   
		a[i].onmouseout = a[i].onmouseup = function() { 
			this.blur();                 // most browsers 
			this.hideFocus = false;      // internet explorer    
			this.style.outline = null;   // mozilla 
		}
	}
	
	/**	Email input background
	***************************/	
	function swopInputBackground(e){	
		var emailInput = $(e+' .inputText');			   
		emailInput.addClass('inputEmailBg');
		emailInput.focus(function(){
				$(this).removeClass('inputEmailBg');
			}
		),
		emailInput.blur(function(){
				if ($(this).val() == "") $(this).addClass('inputEmailBg');
			}
		);		
	}
	if(	$('#download').length > 0){
		swopInputBackground('#download');
	}
	if(	$('#download_content').length > 0){
		swopInputBackground('#download_content');
	}

	/**	Featured Games
	***************************/
	if(	$('#slideContainer').length > 0){
		$('#slideContainer')
		.after('<div id="nav"><a id="nav_prev" href="#">Prev</a> <a id="nav_next" href="#">Next</a></div>')
		.cycle({ 
			fx:     'fade', 
			speed:  'medium', 
			timeout: 0, 
			next:   '#nav_next', 
			prev:   '#nav_prev',
			before: removeCaption,
			after: insertCaption
		});
	}
	
	function removeCaption() { 
		$('#caption').html('');
	}
	function insertCaption() {	
		$('#caption').html(this.title);
	}	
	

	
}); 

function revealModal()
{
window.onscroll = function () { document.getElementById('modal_Optin').style.top = document.body.scrollTop; };
document.getElementById('modal_Optin').style.display = "block";
document.getElementById('modal_Optin').style.top = document.body.scrollTop;
}
function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toUTCString());
}
function getCookie(c_name)
{
if (document.cookie.length>0)
{
c_start=document.cookie.indexOf(c_name + "=");
if (c_start!=-1)
{
c_start=c_start + c_name.length+1;
c_end=document.cookie.indexOf(";",c_start);
if (c_end==-1) c_end=document.cookie.length;
return unescape(document.cookie.substring(c_start,c_end));
}
}
return "";
}
function echeck(str)
{
var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){
alert("Invalid E-mail Address")
return false
}

if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
alert("Invalid E-mail Address")
return false
}

if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
alert("Invalid E-mail Address")
return false
}

if (str.indexOf(at,(lat+1))!=-1){
alert("Invalid E-mail Address")
return false
}

if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
alert("Invalid E-mail Address")
return false
}

if (str.indexOf(dot,(lat+2))==-1){
alert("Invalid E-mail Address")
return false
}

if (str.indexOf(" ")!=-1){
alert("Invalid E-mail Address")
return false
}

return true					
}

function ValidateForm()
{
var emailID=document.download.from;

if ((emailID.value==null)||(emailID.value=="")){
alert("Please Enter your Email Address")
emailID.focus()
return false
}
if (echeck(emailID.value)==false){
emailID.value=""
emailID.focus()
return false
}
/*
var nameID = prompt ("Please enter your Name to continue");
if ((nameID==null)||(nameID=="")){
alert("Please Enter your First and Last Names")
return false
}
document.download.name.value = nameID;
*/
return true
}

function download_instructions()
{
setTimeout('window.location = "/getting-started"',6000);
}
var win=null;function NewWindow(mypage,myname,w,h,scroll,pos){if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';win=window.open(mypage,myname,settings);} 
