String.prototype.trim =  function(){ return this.replace(/(^\s+)|\s+$/g,"");};
String.prototype.lTrim = function(){ return this.replace(/(^\s+)/g,"");};
String.prototype.rTrim = function(){ return this.replace(/\s+$/g,"");};
String.prototype.isBlank = function() {if(this==null){return true;}for(var i=0;i<this.length;i++) {if ((this.charAt(i)!=' ')&&(this.charAt(i)!="\t")&&(this.charAt(i)!="\n")&&(this.charAt(i)!="\r")){return false;}}return true;};
String.prototype.isNull = function(){return (this==null);};
String.prototype.isInteger = function(){if (this.isBlank()){return false;}for(var i=0;i<this.length;i++){if(!isDigit(this.charAt(i))){return false;}}return true;}
String.prototype.isNumeric = function(){return(parseFloat(this,10)==(this*1));};
//String.prototype.allDigit = function()
//{
//    for(i=0; i< this.length; i++)
//    {
//        if(!isDigit(this[i]))
//        {
//            return false;
//        }
//    }
//    return true;
//}
function isDigit(num) {if (num.length>1){return false;}var string="1234567890";if (string.indexOf(num)!=-1){return true;}return false;};


function initFlash()
{
    theObjects = document.getElementsByTagName("object"); 
for (var i = 0; i < theObjects.length; i++) { 
theObjects[i].outerHTML = theObjects[i].outerHTML; 
}
}

function getClientIDVar(object, cntName)
{
   splitVars =  object.id.split('_');
    return splitVars[0] + "_" + splitVars[1] + "_" + cntName;
}

function bookmarksite(title,url)
{
if( window.sidebar && window.sidebar.addPanel ) {
    window.sidebar.addPanel( title, url, '' );
} else if( window.external && ( navigator.platform == 'Win32' ||
      ( window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1 ) ) ) {
    window.external.AddFavorite( url, title );
} else if( window.opera && window.print ) {
    return true;
} else if( document.layers ) {
   ;
} else {
   ;
}
}
function seekCheckedInList(controlHeader, seekVal)
{
	var i = 0;
	var ok = false;
	while (GE(controlHeader + i) != null)
	{
		if (GE(controlHeader + i).checked && GE(controlHeader + i).value == seekVal)
		{
			ok = true;
			break;
		}
		i++;
	}
	return ok;	
}

function ValidateControlGroups(txtBoxName, validatorName)
{
    GE(txtBoxName).value = '1';
     VE(validatorName, true);  
}

//function ValidateControlGroups(frm, btnName)
//{
//    var btn = frm[btnName]
//	var valid
//	for (var x = 0;x < btn.length; x++)
//	{
//		valid = btn[x].checked
//		if (valid) 
//		{
//		    args.IsValid = true;
//		    break;
//		}
//	}
//	if(!valid)
//	    args.IsValid = false;
//}

function SetActivityAllValidators(mode)
{
	for (i = 0; i < Page_Validators.length; i++) 
			ValidatorEnable( Page_Validators[i], mode);
}

function SetVis(controlName, mode)
{
	if (mode)
		SV(controlName);
	else
		SI(controlName);
}

function SI(controlName)
{
	GE(controlName).style.display = "none";
}

function SV(controlName)
{
	GE(controlName).style.display = "";
}

function GE(controlName)
{
	var control = document.getElementById(controlName);
	return control;
}

function VE(id,value)
{
	ValidatorEnable(GE(id),value);
}

function fnTrapKD(btn, event)
{
        if (event.keyCode == 13)
		{
			event.returnValue=false;
			event.cancel = true;
			document.getElementById(btn).click();
		}
}


function fnSafeTrapKD(btn, txtBx1, txtBx2, event)
{
 if (document.all || document.getElementById || document.layers)
 {
	if (document.getElementById(txtBx1).value != '' && document.getElementById(txtBx2).value != '')
	{//autocomplete sorununu çözer
		if (event.keyCode == 13)
		{
			event.returnValue=false;
			event.cancel = true;
			document.getElementById(btn).click();
		}
	}
 }
}



var x="1";
var isBackButtonUsed;
function handleBackButton(){
    isBackButtonUsed = (x != this.document.forms[0]._a1.value);  
    this.document.forms[0]._a1.value=2;
    this.document.forms[0]._a1.defaultValue=2;
}