function Pay_onkeypress() 	{
	if (window.event.keyCode < 48 || window.event.keyCode > 57)		return false;		
}

function Amount_onkeypress() {	
	if (window.event.keyCode<48 || window.event.keyCode>57){
	return false;}
}

function Allowed_Inputs(e,truechars){	
	var whichCode = (window.Event) ? e.which : e.keyCode;
	//alert(whichCode);
	for (i=0; i<truechars.length; i++)
	{
		if (whichCode==truechars.charCodeAt(i)) {
			return true;
		}
	}
	return false;
	
}
function popUp(page) {
    window.open(page);
}

function MaxLengthScriptControl(e,thisis,length)
{ 
       var textboxValue=thisis.value; 
       var keyCode = (window.Event) ? event.which : e.keyCode;
       if(textboxValue.length>length)
       {
            if(keyCode!=8 && keyCode!=37 && keyCode!=38 && keyCode!=39 && keyCode!=40 )
            {
               // alert(thisis.value.length);
                if(thisis.value.length>length)
                {
                    thisis.value=textboxValue.substr(0,length);
                }
                return false;
            }
       }
       else
       {
       //   alert(thisis.value.length);
       if(thisis.value.length>length)
       {
            thisis.value=textboxValue.substr(0,length);
       }
       return true;
    
       }
       
}

function not_Allowed_Inputs(e,falsechars){	
	var whichCode = (window.Event) ? e.which : e.keyCode;
	//alert(whichCode);
	for (i=0; i<falsechars.length; i++)
	{	
		if (whichCode==falsechars.charCodeAt(i) || whichCode==34 || whichCode==39) {
			return false;
		}
	}
	return true;
	
}

function Amount_onkeyup(thisis,digit,decimal,e,original,destination) {	

	
	var whichCode = (window.Event) ? e.which : e.keyCode;
	var numeric=thisis.value;
	
	if(numeric=='01')
	{
	    thisis.value=0;
	}
	
	if (whichCode==39 ||  whichCode == 188 || whichCode==110)
	{
	    destination.focus();
	}
	var tempstr,newstr,str,i,str2 ;
	var commapos,aftercomma,commacount;
	//Nusret
	var tempaftercomma;
	//
	
	i=0;
	str = thisis.value;
	decimal=parseFloat(decimal);
	digit=parseFloat(digit);
	
	while ( 15 > i) 
	{
		str = str.replace(".","");
		i=i+1;
	}
	commacount=0;
	commapos=str.indexOf(",");
	
	if (commapos>=0)
	{
		aftercomma=str.substr(commapos);
		str=str.substr(0,commapos);
	}
	else
		aftercomma="";
	
	
	if(str.length>=digit)
	{
		str=str.substr(0,digit);
	}
	if(aftercomma.length>decimal+1)
	{
		if (decimal<=0)
			aftercomma="";
		else
			aftercomma=aftercomma.substr(0,decimal+1);
	}else
	{
		if (decimal<=0)
			aftercomma="";
	}
	
	/*Nusret*/
	if (commapos>=0) 
	{
		tempaftercomma = aftercomma.substr(1,decimal);
		
		//alert(tempaftercomma);	
			
		if (tempaftercomma.indexOf(",")>=0)
			aftercomma = ","
			
	}
	/**/
	if (str.length > 3) 
	{
		tempstr=str;
		newstr="";
		while (tempstr.length>3)
		{
			newstr="."+tempstr.substr(tempstr.length-3)+newstr; 
			tempstr=tempstr.substr(0,tempstr.length-3);
		}
		str=tempstr+newstr+aftercomma;
	}
	else
	{
		if(commapos>=0)
		{
			str=str+aftercomma;
		}
	}
    var firstValue =thisis.value.substr(0,1);

    if(firstValue=='0' && thisis.value.length!=0)

    {

        str='0'; 

    }
    

	thisis.value= str;
}

function limitSize(thisis,maxLength)
{
var str, re;

str = thisis.value;
re = /\./g;
			
str = str.replace(re, "");

if (str.length>maxLength)
{
	str=str.substring(0,maxLength);
}

thisis.value=str;
return true;
}


function Name_onkeypress() {	
	if (window.event.keyCode<65 && window.event.keyCode!=32){
	return false;}
}
//Alias tanımlamada space girişinin engellenmesi 
function Alias_onkeypress_wospace() {	
	if (window.event.keyCode==32){
	return false;}
}
//Aysun
function Name_onkeypressTR() {	
	if (window.event.keyCode<65 && window.event.keyCode!=32){
	return false;}
		
	var validChars="üÜğĞışŞİçÇöÖQqXxWw ";
	for (i=0; i<validChars.length; i++)
	{
		if (window.event.keyCode==validChars.charCodeAt(i)) {
			return false;
		}
	}
}
function Comma(number) {
	number = '' + number;
	if (number.length > 3) {
		var mod = number.length % 3;
		var output = (mod > 0 ? (number.substring(0,mod)) : '');
		for (i=0 ; i < Math.floor(number.length / 3); i++) {
			if ((mod == 0) && (i == 0))
				output += number.substring(mod+ 3 * i, mod + 3 * i + 3);
			else
				output+= '.' + number.substring(mod + 3 * i, mod + 3 * i + 3);
		}
		return (output);
	}
	else return number;
}

function Numeric_Control(e) {	
	//alert(window.event.srcElement.value);
	var whichCode = (window.Event) ? e.which : e.keyCode;
	
	if (whichCode == 13) return true;  // Enter
	if (whichCode == 0) return true;
	if (whichCode == 8) return true;
	if (whichCode == 32) return true;  
	if (whichCode > 57 ){
	return false;}
	if (whichCode < 48){
	return false;}
}

function Only_Numeric(e) {	
	//alert(window.event.srcElement.value);
	var whichCode = (window.Event) ? e.which : e.keyCode;
	
	if (whichCode == 13) return false;  // Enter
	if (whichCode == 44) return false;  // Comma

	if (whichCode > 57 && whichCode<96){
	return false;}
	else if(whichCode > 95 && whichCode < 106){
	return true;}
	if (whichCode < 48 && whichCode > 13){
	return false;}
}
function Only_Account_Numeric(e) {	
	//alert(window.event.srcElement.value);
	var whichCode = (window.Event) ? e.which : e.keyCode;
	if (whichCode < 106 && whichCode > 95){
	return true;}
	if (whichCode == 189) return true;  
	if (whichCode == 109) return true;  
	if (whichCode == 13) return false;  
	if (whichCode == 44) return false;  
	if (whichCode > 57 ){
	return false;}
	if (whichCode < 48 && whichCode > 13){
	return false;}
}
function Only_Numeric2(e,amount) {	
	//alert(window.event.srcElement.value);
	//alert(amount.length.value);
	alert(amount.value);
	var whichCode = (window.Event) ? e.which : e.keyCode;
	
	
	if (whichCode == 13) return true;  // Enter
	if (whichCode == 44) return false;  // Comma

	if (whichCode > 57 ){
	return false;}
	if (whichCode < 48 && whichCode > 13){
	return false;}
}


function PhoneNumber(e)
{
    var whichCode=(window.Event) ?e.which : e.keyCode;
    if(whichCode == 13) return true;// enter
    if(whichCode == 32) return true;// space
    if(whichCode == 40) return true;// (
    if(whichCode == 41) return true;// )
    if(whichCode == 45) return true;// -
    
    if (whichCode > 57 )
    {
	    return false;
	}
	if (whichCode < 48 && whichCode > 13)
	{
	    return false;
	}


}

function Only_Character(e) {	
	//alert(window.event.srcElement.value);
	var whichCode = (window.Event) ? e.which : e.keyCode;
	
	if (whichCode == 13) return true;  // Enter
	if (whichCode == 44) return true;  // Enter
	if (whichCode > 47 && whichCode < 58){
	return false;}
}

function Only_LetterANDDigit(e) {	
	//alert(window.event.srcElement.value);
	var whichCode = (window.Event) ? e.which : e.keyCode;
	//alert(whichCode);
	if (whichCode > 47 && whichCode < 58){
	return true;}
	if (whichCode > 96 && whichCode < 123){
	return true;}	
	if (whichCode > 64 && whichCode < 91){
	return true;}	
	if (whichCode == 13) return true;  // Enter
	if (whichCode == 0) return true;  //Delete etc.
	if (whichCode == 8) return true;
	if (whichCode == 32) return true;  
	return false;

}



function Only_Digit(e) {	
	//alert(window.event.srcElement.value);
	var whichCode = (window.Event) ? e.which : e.keyCode;
	
	if (whichCode == 13) return true;  // Enter
	if (whichCode > 57 ){
	return false;}
	if (whichCode < 48 && whichCode > 13){ 
	return false;}
}

function Only_Letter(e) {	

	var whichCode = (window.Event) ? e.which : e.keyCode;
  // alert(whichCode);
	if (whichCode == 13) return true;  
	if (whichCode == 0) return true;  
	if (whichCode == 8) return true;  	
	if (whichCode == 32) return true; 	
	
//bu kısım eğer fonk. master page'den çağrılıyorsa ascıı codelar değiştiğinden çalışmamaktadır.
//	var validChars="ÜĞıŞİÇÖQqXxWw ";
//	for (i=0; i<validChars.length; i++)
//	{		
//		if (whichCode==validChars.charCodeAt(i)) {
//			
//			return true;
//		}	
//		
//		
//	}
if (whichCode == 46) return true;  
	if (whichCode == 221) return true;  
	if (whichCode == 219) return true;  
	if (whichCode == 186) return true; 	
	if (whichCode == 222) return true;  
	if (whichCode == 220) return true;  
	if (whichCode == 191) return true; 	
	if (whichCode == 231) return true;  
	if (whichCode == 199) return true;  
	if (whichCode == 246) return true; 	
	if (whichCode == 214) return true; 	
	if (whichCode == 304) return true; 	
	if (whichCode == 305) return true; 	
	if (whichCode == 350) return true; 	
	if (whichCode == 351) return true; 	
	if (whichCode == 286) return true; 	
	if (whichCode == 287) return true; 	
		if (whichCode == 252) return true; 	
	if ((whichCode >=97 && whichCode <=122) || (whichCode <=90 && whichCode >=65)){
	return true;
	}
	else{
	return false;
	}
	
    
}		

	
function Open(message,titletxt){

var msgWindow; 

	msgWindow=window.open("","Ornek","toolbar=0,top=50,left=50,width=300,height=80,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,copyhistory=0"); 
	msgWindow.document.close(); 
	msgWindow.document.open();
	msgWindow.document.write("<html><head><meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-9'>");
	msgWindow.document.write("<meta http-equiv='Content-Type' content='text/html; charset=windows-1254'>");
	msgWindow.document.write("<title>" + titletxt + "</title></head><body>");
	msgWindow.document.write("<table  width=250 ><tr><td style='FONT: 10px Helvetica, sans-serif, Arial;HEIGHT: 20px'>" + message + "</td></tr></table>");
	msgWindow.document.write("</body>");
	msgWindow.focus();
}	
	
function PadField(thisis, other, len) {
	var	str = thisis.value;
  var i, l = str.length;
  for (i=0; i<len - l; i++)	{
  	str = "0" + str;
  }
	other.value = str;
  return true;
}

function ToUCase(thisis, other) {
	var	str = thisis.value;
	var chr, recStr;
	var i, l = str.length;
	recStr = "";
	for (i=0; i<l; i++)	{
		chr = str.charCodeAt(i);		
		if (chr > 96 && chr < 123){
			chr = chr - 32;
		}
		recStr = recStr + String.fromCharCode(chr);	
	}	
	thisis.value = recStr;
	return true;
}

function autotab(original,destination)
{
	//	var whichCode = (window.Event) ? e.which : e.keyCode;	
			if ( original.value.length == original.getAttribute("maxlength") ){
			    if (destination != null)
				    destination.focus();
			}	
}

function Only_LetterTR(e) {	

	var whichCode = (window.Event) ? e.which : e.keyCode;

	if (whichCode == 13) return true;  
	if (whichCode == 0) return true;  
	if (whichCode == 8) return true; 
		if (whichCode == 32) return true; 
	
	var validChars="üÜğĞışŞİçÇöÖQqXxWw ";

	for (i=0; i<validChars.length; i++)
	{		
		if (whichCode==validChars.charCodeAt(i)) {
			return false;
		}		
	}
	
	if ((whichCode >=97 && whichCode <=122) || (whichCode <=90 && whichCode >=65)){
	return true;}
	
	return false;
	
}
function eraseZero(original)
{
			if(original.value=='0')
			{
	 			
	 			original.value = '';
	 			return false;
	 		}		
}
function kurushOnlyNumeric(e,original,destination)
{
     var whichCode = (window.Event) ? e.which : e.keyCode;
     
     if((whichCode==37 || whichCode==8) && original.value.length==0)
     {
        destination.focus();
	 }	
//	 if(whichCode==9)
//	 {
//	 destination.focus();
//	}

}

function checkMaxLength(e,el) {
    switch(e.keyCode) 
    {
        case 37: // left
            return true;
        case 38: // up
            return true;
        case 39: // right
            return true;
        case 40: // down
            return true;
        case 8: // backspace
            return true;
        case 46: // delete
            return true;
        case 27: // escape
            el.value='';
        return true;
    }
    return (el.value.length<el.getAttribute("MaxLength"));
}
function InsertSube_menu(menuPath){
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,124,0" width="175" height="500">\n');
	document.write('<param name=movie value='+menuPath+'>\n');
	document.write('<param name=quality value=high>\n');
	document.write('<embed src='+menuPath+' quality=high pluginspage="https://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="175" height="500">\n');
	document.write('</embed>\n'); 
	document.write('</object>\n');
}

