function findPosX(obj)
{
  var curleft = 0;
  if(obj.offsetParent)
      while(1) 
      {
        curleft += obj.offsetLeft;
        if(!obj.offsetParent)
          break;
        obj = obj.offsetParent;
      }
  else if(obj.x)
      curleft += obj.x;
  return curleft;
}

function findPosY(obj)
{
  var curtop = 0;
  if(obj.offsetParent)
      while(1)
      {
        curtop += obj.offsetTop;
        if(!obj.offsetParent)
          break;
        obj = obj.offsetParent;
      }
  else if(obj.y)
      curtop += obj.y;
  return curtop;
}

function getSizeXY() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  //window.alert( 'Width = ' + myWidth );
  //window.alert( 'Height = ' + myHeight );
  
  return [myWidth, myHeight];
}

function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}

function showBox(idVal) {
	var wSize 	= getSizeXY();
	var wScroll	= getScrollXY();

	var box = document.getElementById(idVal);
	box.style.left = parseInt(wSize[0])/2+parseInt(wScroll[0])-205;
	box.style.top  = parseInt(wSize[1])/2+parseInt(wScroll[1])-125;
	
	box.style.display = 'block';
}

function hideBox(idVal) {
	document.getElementById(idVal).style.display = 'none';
}

function hideAllBoxes() {
	document.getElementById('termsAndConditions').style.display = 'none';
	document.getElementById('moneyGramPayment').style.display = 'none';
	document.getElementById('westerunionPayment').style.display = 'none';
	document.getElementById('enableCookies').style.display = 'none';
	
}

function showFeedback(idVal, whichOne) {
	if (whichOne == 'full') {
		document.getElementById('fb_full_' + idVal).style.display = 'block';
		document.getElementById('fb_short_' + idVal).style.display = 'none';
		document.getElementById('fb_qs_' + idVal).style.display = 'block';
	} else {
		document.getElementById('fb_full_' + idVal).style.display = 'none';
		document.getElementById('fb_short_' + idVal).style.display = 'block';
		document.getElementById('fb_qs_' + idVal).style.display = 'none';
	}
}

function CharactersLeft(obj) {
	var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : "";
	if (obj.getAttribute && obj.value.length>mlength)
		obj.value=obj.value.substring(0,mlength)
}

function kickOff() {
 	$.ajax({
	  url: 'ajax/kickoff.php',
	  success: function(data) {
	    if (data=="kick") {
	    	clearTimeout(psnNrBct);
	    }
	    else if (data=="ban") {
	    	window.location="banned.html";
	    }
	    else {
	    	setTimeout("kickOff();", 30000);
	    }
	  }
	});
}
