
var t=0; 
IE4 = (document.all);
NS4 = (document.layers);

if (NS4) document.captureEvents(Event.KEYPRESS);
document.onkeypress = doKey;
//document.form1.bn.focus();

function doKey(e) {
try{
  whichASC = (NS4) ? e.which : event.keyCode;
  //whichKey = String.fromCharCode(whichASC).toLowerCase();

  switch (whichASC) {
    case 13:
    //alert('oleys' + t);
    if(t==1){
		document.form1._ctl1_b1.focus();
		if(check()){
		
			document.form1._ctl1_b1.click();
		}
		else{
		//alert('hata');
		return false;
		}
		//document.form1._ctl1_txtUser.focus();
    }else if(t==3){
    
		//alert('from search');
    
    }
    else if(t==4){
		document.form1._ctl3_b1.focus();
		if(check()){
		
			document.form3._ctl1_b1.click();
		}
		else{
		//alert('hata');
		return false;
		}
    }
    else{
   // alert('none');
		document.form1.bn.focus();
    }
    
    break;
   
    
    default:
	
    break;
  }
  }
  catch(er){}
  
}

function trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}

function OpenPopup(url){
var pop;

	pop = window.open(url , 'PopUpWindow','width=385,height=228,left=200,top=250');

}
function OpenPopup(url,width,height){
var pop;

	pop = window.open(url , 'PopUpWindow','scrollbars=yes,width=' + width + ',height='+ height +',left=20,top=20');

}

function OpenPopup1(url,width,height,name){
var pop;

	pop = window.open(url , name,'scrollbars=yes,width=' + width + ',height='+ height +',left=20,top=20');

}
function OpenPopup2(url,width,height,name){
var pop;

	pop = window.open(url , name,'scrollbars=no,width=' + width + ',height='+ height +',left=20,top=20');

}
function OpenPopup3(url,name){
var pop;

	pop = window.open(url , name);

}

var popUp; 

function OpenCalendar(idname, postBack)
{
	//alert(idname);
//window.open('PopupCalendar.aspx');	
	//popUp = window.open('PopupCalendar.aspx?formname=' + document.forms[0].name + 
	//	'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value + '&postBack=' + postBack, 
	//	'popupcal', 
	//	'width=165,height=208,left=200,top=250');
popUp = window.open('PopupCalendar.aspx?formname=' + document.forms[0].name + '&id=' + idname + '&selected=none' + '&postBack=' + postBack,'popupcal','width=185,height=228,left=200,top=250');

}

function IsNumeric(sText)
{    
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;
 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
        Char = sText.charAt(i); 
         if (ValidChars.indexOf(Char) == -1) 
         {
           IsNumber = false;
         }
      }
      
     return IsNumber;            
   }


function SetDate(formName, id, newDate, postBack)
{
	
	//eval('var theform = document.' + formName + ';');
	
	eval('var theform = document.form1;');
	popUp.close();
	
	//alert(id);
	//theform.elements[id].value = newDate;
	theform.elements[id].value = newDate;
	//if (postBack)
	//	__doPostBack(id,'');
}
function check(){
if (navigator.userAgent.indexOf("Opera")!=-1
		 && document.getElementById) type="OP"; 
if (document.all) type="IE"; 
//For Netscape version 4 :
if (document.layers) type="NN"; 
//Mozila e.g. Netscape 6 upwards
if (!document.all && document.getElementById) type="MO"; 
return type;
}
function AddFavorites(){
	window.external.AddFavorite('http://www.ozyeniakyuz.com','Öz Yeni Akyüz Sürücü Kursu');
}
function SetMyHome(){
	this.style.behavior='url(#default#homepage)';
	this.setHomePage('http://www.ozyeniakyuz.com');
}
//sample check()
//type=check();
//if (type=="IE")