
function HideGameArea()
{
    document.getElementById("frameGame").style.visibility = "hidden";
}
    
function CloseLightBoxParentWindow()
{   
    if (window.parent.opener != null)
    {
        window.parent.close();
    }
    else
    {
        CloseLightBox(false);
    }
}
        
function IsPopupBlocker() 
{
	var popupWindow = window.open("","testpopupblocker","width=1,height=1,top=10000,left=10000,status=no,titlebar=no,directories=no");

	if (popupWindow == null || typeof(popupWindow) == "undefined") 
	{
		return true;
	} 
	else 
	{
		popupWindow.blur();
		popupWindow.close();
		return false;
	}
}

var popupWinNumbers = 0;
function MM_openBrWindow(theURL,winName,features) 
{ //v2.0

//    if(IsPopupBlocker())
//    {
//	    alert("Browser popup blocker is active. Please allow this web site and try again.");  
//    }
//    else
//    {
        if (winName != "PlayOnlineCasino" && winName != "PlayBingo" && winName != "PlayGames" && winName != "PlaySlots")
        {
            winName = winName + popupWinNumbers;
        }
        
        window.open(theURL,winName,features);
        
        popupWinNumbers++;
//    }
}

function listen(evnt, elem, func) 
{
    if (elem.addEventListener)  // W3C DOM5.        
    {
        elem.addEventListener(evnt, func, false);
    }
    else if (elem.attachEvent) // IE DOM7.         
    {        
        var r = elem.attachEvent("on" + evnt, func);	
        return r;
    }
    else
    {
        elem["on" + evnt] = func;
    }
}

function OpenFullScreenGameWindow(gameType) 
{
    var frameObj = document.getElementById("frameGame");
    var url = frameObj.src;
       
    var screenWidth = screen.width;
    var screenHeight = screen.height;

    var winName = winName + popupWinNumbers;
    var features = "width=" + screenWidth + ",height=" + screenHeight;
    
    var gameWindow = window.open(url, winName, features);

    listen
    (
        "load", 
        gameWindow.window, 
        function()
        {
            var gameObj; 
            
            switch(gameType)
            {
                case "onlinecasino" : gameObj = gameWindow.window.document.getElementById("flashGameObject");
                    break;
                case "games"        : gameObj = gameWindow.window.document.getElementById("ctl00_ContentPlaceHolder1_finsoftGame1_ifFinsoft");
                    break;
                case "bingo"        : gameObj = gameWindow.window.document.getElementById("ifBingo");
                    break;
            }
            
            if(gameObj)
            {
                gameObj.width = screenWidth;
                gameObj.height = screenHeight;
                
                if (gameType == "bingo")
                {
                    gameObj.style.marginTop = "-40px";
                    gameObj.style.height = screenHeight + "px";
                }
            }
            
            gameWindow.window.opener.close();
        }        
    );
        
    popupWinNumbers++;
}

function openDetail(sayfa2)
{
    open(sayfa2,'window3','left=20,top=20,width=500,height=500,scrollbars=1,status=1')
}

function fineresize()
{
   
    while (document.body.clientHeight < document.body.scrollHeight || document.body.clientWidth < document.body.scrollWidth)
    {	
        var widthDiff = document.body.scrollWidth - document.body.clientWidth;
        var heightDiff = document.body.scrollHeight - document.body.clientHeight;
        //var newWidth= document.body.clientWidth + widthDiff;
        //var newHeight = document.body.clientHeight + heightDiff 
        if (widthDiff>0)
            widthInc=5;
        else
            widthInc=0;
        if (heightDiff>0)
            heightInc=5;
        else
            heightInc=0;
            
	    window.resizeBy(widthInc,heightDiff);
	    //window.resizeTo(newWidth,newHeight);
	   
    }
}

function resizemyWindow(width,height)
{    
    
    window.resizeTo(width,height);
    myWindowWidth = width;
    myWindowHeight = height;
    if( typeof( window.innerWidth ) == 'number' ) 
    {    
      myinnerWidth = window.innerWidth;
      myinnerHeight = window.innerHeight;
    } 
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
	{
	    //IE 6+ in 'standards compliant mode'
	    myinnerWidth = document.documentElement.clientWidth;
	    myinnerHeight = document.documentElement.clientHeight;
	} 
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
	{
	    //IE 4 compatible
	    myinnerWidth = document.body.clientWidth;
	    myinnerHeight = document.body.clientHeight;
	}

     if (myinnerHeight!=height)
   myWindowHeight = myWindowHeight + (height-myinnerHeight);
   window.resizeTo(width,myWindowHeight);      
}

function cvvBox(mode)
{
	if (mode == 'show'){
		document.getElementById("cvv").style.display = 'block';
	}
	else {
		document.getElementById("cvv").style.display = 'none';
	}
}

function voucherValueBox(mode)
{
	if (mode == 'show'){
		document.getElementById("voucherValue").style.display = 'block';
	}
	else {
		document.getElementById("voucherValue").style.display = 'none';
	}
}

/*Light box updateprogresbar*/
function closeProgressIndicator() {      
        
//        var iframe = document.getElementById("ctl00_lightbox_contentIframe");
  //      if (iframe.document.readyState == "complete") {
            var progres = document.getElementById('progressIndicator');
            progres.style.display ='none';
      //  }    
    fixCloseButtonPosition();
    fixIframeScroll();
   
}
function wait()
{

}
function showFakeBackground()
{
var fakeBg = parent.document.getElementById('fakeBackground');
var iframe = parent.document.getElementById('ctl00_lightbox_contentIframe');
fakeBg.style.top = iframe.offsetTop + 10 + 'px';
        fakeBg.style.left = iframe.offsetLeft + 10 + 'px';
        fakeBg.style.height = '640px';
        fakeBg.style.width =  iframe.offsetWidth - 10 + 'px';
        fakeBg.style.position = 'absolute';
        fakeBg.style.zIndex = '-1';
        fakeBg.style.display = '';

}

function fixIframeScroll()
{
    var iframe = document.getElementById('ctl00_lightbox_contentIframe');
    
    if(iframe.contentWindow.location.href=='http://www.smartlivecasino.com/Deposit.aspx?load=EntroPayFastLoad' || iframe.contentWindow.location.href=='http://www.smartlivecasino.com/Deposit.aspx?load=EntroPayRegister')
    {
        if(navigator.appName.indexOf('Microsoft') > -1)
        iframe.scrolling = "auto";
        else
        {
        iframe.scrolling = "yes";
        iframe.style.overflow = 'auto';
        }
    }
}

function fixCloseButtonPosition()
{
    var iframe = document.getElementById('ctl00_lightbox_contentIframe');
    var fakeButton = document.getElementById('fakeCloseButton');
    
    if(iframe.src != "about:blank")
    {
        fakeButton.style.top = '0px';
        
        if(navigator.appName.indexOf('Microsoft') > -1)
            fakeButton.style.left = iframe.offsetLeft - 30 + iframe.offsetWidth + 'px';
            else
            fakeButton.style.left = iframe.offsetLeft - 33 + iframe.offsetWidth + 'px';
        fakeButton.style.position = 'absolute';
        fakeButton.style.zIndex = 10002;
        fakeButton.style.display = 'block';
        fakeButton.style.display = '';
    }
}

iframeStatus();


function iframeStatus(){
  if (document.getElementById("ctl00_lightbox_contentIframe"))
    {
         if (document.getElementById('ctl00_lightbox_contentIframe').readyState)
            {
                
                if (document.getElementById('ctl00_lightbox_contentIframe').readyState == "complete" || document.getElementById('ctl00_lightbox_contentIframe').readyState == "interactive")
                        {
                            document.getElementById("progressIndicator").style.display ='none';
                        }
                else
                {
                    document.getElementById("progressIndicator").style.top = -200 + "px";
                    document.getElementById("progressIndicator").style.display ='';
                }
            }
        }
        setTimeout("iframeStatus()",1000)
}  

function getPageWH(xPart) {
    if (typeof window.innerWidth == 'number') {
        pageW = window.innerWidth;
        pageH = window.innerHeight;
    }
    else if (document.documentElement &&
                     document.documentElement.clientWidth) {
        pageW = document.documentElement.clientWidth;
        pageH = document.documentElement.clientHeight;
    }
    else {
        pageW = document.body.clientWidth;
        pageH = document.body.clientHeight;
    }
    if (xPart == "w") return pageW;
    else return pageH
}

var isPointChar;

function IsNumberKey(evt)
{
    
    var charCode = (evt.which) ? evt.which : event.keyCode
    var tmp = isPointChar;
    if(charCode == 44)
        isPointChar = 46;
    else
        isPointChar = charCode;
    if((charCode == 46 || charCode == 44) && (isPointChar == tmp))    
    return false;
    
    if ((charCode > 31 && (charCode < 48 || charCode > 57)) && charCode != 44 && charCode != 46)
        return false;
   
    return true;
}

function IsPhoneNumberKey(evt)
{
    var charCode = (evt.which) ? evt.which : event.keyCode
    if ((charCode > 31 && (charCode < 48 || charCode > 57)) && charCode != 43)
        return false;

    return true;
}

/********************************************************************************************/

function MM_openbrwindow(theURL,winName,features) { //v2.0 
window.open(theURL,winName,features); 
}
