function openWindow(wURL,wName,wWidth,wHeight,wOptions)
{
sW = Math.round((screen.width/2)-(wWidth/2));
sH = Math.round((screen.height/2)-((wHeight/2)+27));
window.open(wURL,wName,'width='+wWidth+',height='+wHeight+','+wOptions+',left='+sW+',top='+sH);
}

/*
<A HREF="javascript:openWindow('wURL.html','wName','640','480','status=1,scrollbars=1,resizable=1,directories=0')"></A>
*/

function uyeNoSifre()
{
	var uyeNo = document.login.j_username;
	var uyeSifre = document.login.j_password;
	if (uyeNo.value.length != 8 || uyeSifre.value.length != 6 || !IsNumeric(uyeNo.value) || !IsNumeric(uyeSifre.value))
	{
	alert("Üye No/Şifre bilgilerinizi kontrol ediniz!");
	uyeNo.focus();
	return false;
	} else {
	}
    return true;
}

function IsNumeric(data)
{
var ValidChars = "0123456789";
var IsNumber=true;
var Char;
	for (i = 0; i < data.length && IsNumber == true; i++) 
	{
		Char = data.charAt(i); 
		if (ValidChars.indexOf(Char) == -1) {IsNumber = false;}
	}
return IsNumber;
}

function ackapa(x,z){
    
        for(i=1;i<=z;i++){
            document.getElementById("div"+i).style.display='none';
            document.getElementById("img"+i).innerHTML="<img src=\"/images/icons/arrows_greenDark.gif\" alt=\"\" style=\"margin-bottom:3px;padding-right:3px\" width=\"4\" height=\"7\" />";
        }
         document.getElementById("div"+x).style.display='block';
        document.getElementById("img"+x).innerHTML="<img src=\"/images/icons/arrDown_greenDark.gif\" alt=\"\" style=\"margin-bottom:3px\" width=\"7\" height=\"4\" />";
    }


        function changeSection(ID){
            sUrl = ID+".jsp";
            var request = YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);
            location.href=sUrl;
            alert(sUrl)

        }
        function changeSections(ID)
        {
           alert(ID)
            if (ID != ""){
               sUrl =  ID+".jsp";
             //      sUrl =  ID.options[ID.selectedIndex].value;
                alert(sUrl);
               // var request = YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);
                 location.href="/yardim/?page="+sUrl;
            }
        }



            function puanhesapla(showalert){
                var custAmount2
                var custAmount3;
                var custAmount4;

                if((document.form1.amount1.value== "" && document.form1.amount2.value == "" )){
                    if(showalert){
                        alert("Lütfen kupon tutarı giriniz.");
                    }
                    return false;
                }

                if((document.form1.amount1.value== "" && document.form1.amount2.value != "")){
                    custAmount3=0;
                    custAmount4 = document.form1.amount2.value;
                }

                if((document.form1.amount1.value != "" && document.form1.amount2.value == "")){
                    custAmount4=0;
                    custAmount3 = document.form1.amount1.value;
                }

                if((document.form1.amount1.value != "" && document.form1.amount2.value != "")){
                    custAmount4 = document.form1.amount2.value;
                    custAmount3 = document.form1.amount1.value;
                }


                if ((! isAllNumeric(custAmount3,"Lütfen nümerik bir değer giriniz.",showalert)) ||
                    (! isAllNumeric(custAmount4,"Lütfen nümerik bir değer giriniz.",showalert))){
                    return false;
                } else {
                    custAmount2 = custAmount3 + "," + custAmount4;

                    if (replaceAll (custAmount2, ",", ".") <0.01) {
                        if(showalert){
                            alert("En az 0,01 TL girebilirsiniz." );
                        }
                        return false;
                    }
                }

                var x=document.getElementById("tipler");
                var y=document.getElementById("oyun");
                var multiplier;
                var tipOption = x.options[x.selectedIndex].value;
                var oyunOption = y.options[y.selectedIndex].value;

                var toplamTutar  = replaceAll (custAmount2, ",", ".");
                if(toplamTutar<5){
                    if(tipOption==3){
                        if(oyunOption==1){
                            multiplier = 0.50;
                        }else if(oyunOption==2){
                            multiplier = 0.20;
                        }
                    }else if(tipOption==2){
                        if(oyunOption==1){
                            multiplier = 0.45;
                        }else if(oyunOption==2){
                            multiplier = 0.15;
                        }
                    }else if(tipOption==1){
                        if(oyunOption==1){
                            multiplier = 0.40;
                        }else if(oyunOption==2){
                            multiplier = 0.10;
                        }
                    }
                }else if(toplamTutar>=5 && toplamTutar<50){
                    if(tipOption==3){
                        if(oyunOption==1){
                            multiplier = 0.60;
                        }else if(oyunOption==2){
                            multiplier = 0.25;
                        }
                    }else if(tipOption==2){
                        if(oyunOption==1){
                            multiplier = 0.55;
                        }else if(oyunOption==2){
                            multiplier = 0.20;
                        }
                    }else if(tipOption==1){
                        if(oyunOption==1){
                            multiplier = 0.50;
                        }else if(oyunOption==2){
                            multiplier = 0.15;
                        }
                    }
                }else if(toplamTutar>=50 && toplamTutar<100){
                    if(tipOption==3){
                        if(oyunOption==1){
                            multiplier = 0.70;
                        }else if(oyunOption==2){
                            multiplier = 0.30;
                        }
                    }else if(tipOption==2){
                        if(oyunOption==1){
                            multiplier = 0.65;
                        }else if(oyunOption==2){
                            multiplier = 0.25;
                        }
                    }else if(tipOption==1){
                        if(oyunOption==1){
                            multiplier = 0.60;
                        }else if(oyunOption==2){
                            multiplier = 0.20;
                        }
                    }
                }else if(toplamTutar>=100){
                    if(tipOption==3){
                        if(oyunOption==1){
                            multiplier = 0.80;
                        }else if(oyunOption==2){
                            multiplier = 0.35;
                        }
                    }else if(tipOption==2){
                        if(oyunOption==1){
                            multiplier = 0.75;
                        }else if(oyunOption==2){
                            multiplier = 0.30;
                        }
                    }else if(tipOption==1){
                        if(oyunOption==1){
                            multiplier = 0.70;
                        }else if(oyunOption==2){
                            multiplier = 0.25;
                        }
                    }
                }



                if(toplamTutar * multiplier>0){
                    document.getElementById("kazanc").innerHTML = replaceAll ((Math.round(toplamTutar * multiplier*100)/100).toString(), ".", ",");
                }

            
            
        }

function isAllNumeric (input, message, showalert) {
	var isNumeric=true;
	var s = input;
	var filteredValues = "1234567890";
	var i;
	var returnString = "";
	if (s !=null){
		for (i = 0; s.length>i; i++) {
			// Search through string
			var c = s.charAt(i);
			if (filteredValues.indexOf(c) > -1){
				isNumeric=true;
			} else{
				isNumeric=false;
				if(showalert){
					alert(message);
				}
				return false;
			}
		}
	}
	return true;
}


function isNumberKey(evt){
 	var charCode = (evt.which) ? evt.which : event.keyCode
	if (charCode > 31 && (charCode <48 || charCode > 57))
		return false;

	return true;
}

function replaceAll( str, from, to ) {
	var idx = str.indexOf( from );
	while ( idx > -1 ) {
		str = str.replace( from, to );
		idx = str.indexOf( from );
	}
	return str;
}


function backupac(){
        document.getElementById("cont").style.display="none";
        document.getElementById("backupstart").style.display="block";
    
}
function dergiiac(){
        document.getElementById("cont").style.display="none";
        document.getElementById("dergistart").style.display="block";
}
function changeDivs() {
    hidediv("bpbakcup");
    showdiv("bpbakcupform");
}
function hidediv(divid) {
    if (document.getElementById) { // DOM3 = IE5, NS6
        document.getElementById(divid).style.display = 'none';
    }
}

function showdiv(divid) {
    if (document.getElementById) { // DOM3 = IE5, NS6
        document.getElementById(divid).style.display = 'block';
    }
}

function emailValidation(entered, alertbox) {
    with (entered) {

        var testresults = false;
        var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
        if (!filter.test(value)) {
            alert(alertbox);
            return false;
        }

        apos = value.indexOf("@");
        dotpos = value.lastIndexOf(".");
        lastpos = value.length - 1;
        if (apos<1 || dotpos - apos<2 || lastpos - dotpos>3 || lastpos - dotpos<2) {
            if (alertbox) {
                alert(alertbox);
            }
            return false;
        } else if ((value.indexOf("yahrereeroo.com.tr") > 0) || (value.indexOf("hoterrermail.com.tr") > 0) || (value.indexOf("excireerrte.com.tr") > 0) || (value.indexOf("lycoererers.com.tr") > 0) || (value.indexOf("mairerrelcity.com.tr") > 0)) {
            alert("Yahoo , Hotmail gibi web tabanli email adresleri geçerli degildir!");
            return false;
        }
        else {
            return true;
        }

    }}
