//paging homepage

var iSelNR_Box = 1;

function news_rotate_prev()
{
	iSelNR_Box -= 1;
	if (iSelNR_Box  < 1)  {
		iSelNR_Box = 5;
	}
	news_rotate_sel(iSelNR_Box);
}

function news_rotate_next()
{
	iSelNR_Box += 1;
	if (iSelNR_Box  > 5)  {
		iSelNR_Box = 1;
	}
	news_rotate_sel(iSelNR_Box);
}

function news_rotate_num(num)
{
	iSelNR_Box = num;
	if (iSelNR_Box  > 5)  {
		iSelNR_Box = 1;
	}
	news_rotate_sel(iSelNR_Box);
}

function news_rotate_sel(iTr){
	for (var i=1;i<=5;i++)
		{
			if (i.toString() == iTr) 
			{
				//alert('tr_p' + i + ':block');
				document.getElementById('news_rotate_' + i).style.display = 'block';
				document.getElementById('tr_h' + i).className='active';
			}
			else
			{
				//alert('tr_p' + i + ':none');
				document.getElementById('news_rotate_' + i).style.display = 'none';
				document.getElementById('tr_h' + i).className='inactive';
			}
		}
}

function fApplyClass(sObj, sClas){
	if(document.getElementById && document.createTextNode)
	{
	  if(document.getElementById(sObj))
	  {
	    document.getElementById(sObj).className=sClas;
	  }
	}
}

function wndOpenTransferMoney(sURL) {
  var iWidth = 400;
  var iHeight = 400;
  var iLeft = (((window.screen.availWidth - iWidth) / 2));
  var iTop = (((window.screen.availHeight - iHeight) / 2))
  if (iTop < 30) { iTop = 1 }
  if (iLeft < 30) { iLeft = 1 }
  window.open(sURL, "tm", 'top=' + iTop + ', left=' + iLeft + ', width=' + iWidth + ', height=' + iHeight + ', location=no, address=no, scrollbars=no, resizable=no, status=no')
}

function wndOpenTransferMoneyWC(sURL, pok_sho_co, pok_ses_id, pok_cus_id, pok_cst_id, pok_cus_ac) {
  var iWidth = 400;
  var iHeight = 400;
  var iLeft = (((window.screen.availWidth - iWidth) / 2));
  var iTop = (((window.screen.availHeight - iHeight) / 2))
  if (iTop < 30) { iTop = 1 }
  if (iLeft < 30) { iLeft = 1 }
  window.open(sURL + "?type=force&pok_sho_co=" + pok_sho_co + "&pok_ses_id=" + pok_ses_id + "&pok_cus_id=" + pok_cus_id + "&pok_cst_id=" + pok_cst_id + "&pok_cus_ac=" + pok_cus_ac, "tm", 'top=' + iTop + ', left=' + iLeft + ', width=' + iWidth + ', height=' + iHeight + ', location=no, address=no, scrollbars=no, resizable=no, status=no')
}

function wndGotoInCasino(sURL, pok_sho_co, pok_ses_id, pok_cus_id, pok_cst_id, pok_cus_ac) {
  window.location.href = sURL + "?type=force&pok_sho_co=" + pok_sho_co + "&pok_ses_id=" + pok_ses_id + "&pok_cus_id=" + pok_cus_id + "&pok_cst_id=" + pok_cst_id + "&pok_cus_ac=" + pok_cus_ac
}

function wndGotoInCasinoGame(sURL, sGameID, pok_sho_co, pok_ses_id, pok_cus_id, pok_cst_id, pok_cus_ac) {
  var iWidth = 800;
  var iHeight = 600;
  var iLeft = (((window.screen.availWidth - iWidth) / 2));
  var iTop = (((window.screen.availHeight - iHeight) / 2))
  if (iTop < 30) { iTop = 1 }
  if (iLeft < 30) { iLeft = 1 }
  window.open(sURL + "?type=force_game&game=" + sGameID + "&pok_sho_co=" + pok_sho_co + "&pok_ses_id=" + pok_ses_id + "&pok_cus_id=" + pok_cus_id + "&pok_cst_id=" + pok_cst_id + "&pok_cus_ac=" + pok_cus_ac, "gm_in", 'top=' + iTop + ', left=' + iLeft + ', width=' + iWidth + ', height=' + iHeight + ', location=no, address=no, scrollbars=no, resizable=no, status=no')
}

function wndOpenJClient(sURL){
	var iWidth=990;
	var iHeight=600;
	var iLeft = (((window.screen.availWidth-iWidth)/2));
	var iTop = (((window.screen.availHeight-iHeight)/2))
	if (iTop<30) {iTop=1}
	if (iLeft<30) {iLeft=1}
	window.open(sURL, "", 'top=' + iTop + ', left=' + iLeft + ', width=' + iWidth + ', height=' + iHeight + ', location=no, address=no, scrollbars=no, resizable=no, status=no')
}

function wndOpenBJClient(sURL){
	var iWidth=800;
	var iHeight=600;
	var iLeft = (((window.screen.availWidth-iWidth)/2));
	var iTop = (((window.screen.availHeight-iHeight)/2))
	if (iTop<30) {iTop=1}
	if (iLeft<30) {iLeft=1}
	window.open(sURL, "", 'top=' + iTop + ', left=' + iLeft + ', width=' + iWidth + ', height=' + iHeight + ', location=no, address=no, scrollbars=no, resizable=no, status=no')
}

function wndOpenLiveDemo(sURL){
	var iWidth=820;
	var iHeight=710;
	var iLeft = (((window.screen.availWidth-iWidth)/2));
	var iTop = (((window.screen.availHeight-iHeight)/2))
	if (iTop<30) {iTop=1}
	if (iLeft<30) {iLeft=1}
	window.open(sURL, "", 'top=' + iTop + ', left=' + iLeft + ', width=' + iWidth + ', height=' + iHeight + ', location=no, address=no, scrollbars=no, resizable=no, status=no')
}

function wndOpenRakeStructure(sURL){
	var iWidth=700;
	var iHeight=800;
	var iLeft = (((window.screen.availWidth-iWidth)/2));
	var iTop = (((window.screen.availHeight-iHeight)/2))
	if (iTop<30) {iTop=1}
	if (iLeft<30) {iLeft=1}
	window.open('https://www.poker.gr/rake_structure.html', "", 'top=' + iTop + ', left=' + iLeft + ', width=' + iWidth + ', height=' + iHeight + ', location=no, address=no, scrollbars=no, resizable=no, status=no')
}

function wndOpenPlayerPoints(sURL){
	var iWidth=400;
	var iHeight=400;
	var iLeft = (((window.screen.availWidth-iWidth)/2));
	var iTop = (((window.screen.availHeight-iHeight)/2))
	if (iTop<30) {iTop=1}
	if (iLeft<30) {iLeft=1}
	window.open('https://www.poker.gr/player_points.html', "", 'top=' + iTop + ', left=' + iLeft + ', width=' + iWidth + ', height=' + iHeight + ', location=no, address=no, scrollbars=no, resizable=no, status=no')
}

//GENERIC
function Trim(strInputString){
	strInputString = strInputString + ' '
	objRegExp = /(^ +)|( +$)/i
	return strInputString.replace(objRegExp, "");
}
function blnValidEmail(strInputString){
	var objRegExp = /(^[a-z0-9]+[a-z_\-\.0-9]*@[a-z_\-0-9]+\.[a-z_\-\.0-9]*[a-z0-9]+$)/i
	if (objRegExp.test(strInputString)) {return true;} else {return false;}
}
function blnValidLatinString(strInputString){
	var objRegExp = /(^[a-z ,\-\.\(\)0-9]+$)/i
	if (objRegExp.test(strInputString)) {return true;} else {return false;}
}
function blnIsValidLong(strCheckLong){
	var objRegExp
	strCheckLong = strCheckLong
	objRegExp = /^\d+$/
	return objRegExp.test(strCheckLong);
}
function blnCheckLength(strInputString, lngMin){
	if (strInputString.length >= lngMin) {return true;} else {return false;}
}

//SIGNUP
function DoSignUp(e){
document.body.style.cursor = 'wait';
document.frmMain.action = '/xt_account.asp?act=sin'
document.frmMain.btnSignup.disabled=true;
document.frmMain.submit();
}

//SIGNIN
function DoSignIn(e){
document.body.style.cursor = 'wait';
document.frmSignIn.action = '/xt_account.asp?act=sin'
document.frmSignIn.btnSignIn.disabled=true;
document.frmSignIn.submit();
}

function checkAlias( strAlias ) {
 stringRegex = /[\w{5,12}\-\_\.]/;
 if( !strAlias.match( stringRegex ) ) {
 	alert('Το username πρέπει να αποτελείται από 5 έως 12 λατινικούς χαρακτήρες και νούμερα.');
 	return false;
 }
 	return true;
}

function wndOpenSlideshow(sURL){
	var iWidth=739;
	var iHeight=600;
	var iLeft = (((window.screen.availWidth-iWidth)/2));
	var iTop = (((window.screen.availHeight-iHeight)/2))
	if (iTop<30) {iTop=1}
	if (iLeft<30) {iLeft=1}
	window.open(sURL, "", 'top=' + iTop + ', left=' + iLeft + ', width=' + iWidth + ', height=' + iHeight + ', location=no, address=no, scrollbars=no, resizable=no, status=no')
}

function jToggle(id) {
   var e = document.getElementById(id);
   if(e.style.display == 'block')
      e.style.display = 'none';
   else
      e.style.display = 'block';
}





function show_content(iIndex){
	for (var i=1;i<=5;i++)
		{
			if (i.toString() == iIndex) 
			{
				document.getElementById('content-' + i.toString()).style.display = 'block';
				fApplyClass('tab-' + i.toString(), 'tab-active');
			}
			else
			{
				document.getElementById('content-' + i.toString()).style.display = 'none';
				fApplyClass('tab-' + i.toString(), 'tab-inactive');
			}
		}
}
