﻿// JScript File
// JScript File
function LogOut(){
     window.open('../../IpsLogin.aspx','_top');
    }

function OpenModalFrmParam(urlForm,pValues,iWidth,iHeight){
      window.showModalDialog(urlForm + pValues ,'','dialogWidth:' + iWidth + 'px;' + 'dialogHeight:' + iHeight + 'px');
     }

function OpenModalFrm(urlForm,iWidth,iHeight){
    window.showModalDialog(urlForm,'','dialogWidth:' + iWidth + 'px;' + 'dialogHeight:' + iHeight + 'px');
   // return false;
}
function openCustoWindow(urlForm,iheight,iwidth,ileft,itop){
     window.open(urlForm,"_blank", "height=" + iheight + ",width=" + iwidth + ",toolbar=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=no,left=" + ileft + ",top=" + itop);
     return false;
     
}
function openCustoWindowResizable(urlForm,iheight,iwidth,ileft,itop){
     window.open(urlForm,"_blank", "height=" + iheight + ",width=" + iwidth + ",toolbar=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=yes,left=" + ileft + ",top=" + itop);
     return false;
     
}
function openCustoWindow3(urlForm,pValues,iWidth,iHeight){
     window.open(urlForm + pValues ,'','dialogWidth:' + iWidth + 'px;' + 'dialogHeight:' + iHeight + 'px')
     return false;
     
}
function openCustoWindow2(urlForm,iheight,iwidth,ileft,itop){
     window.open(urlForm,"_self", "height=" + iheight + ",width=" + iwidth + ",toolbar=no,directories=no,status=no, menubar=yes,scrollbars=yes,resizable=no,left=" + ileft + ",top=" + itop);
     return false;
}

/*
  Auother Diyaiddin S. Bader
   TxtId : Text Box ID
   sValue : Value 
   Used : When Open Popup Window The Chiled Window Passed Value For Opener Window
*/
function PassValue(TxtId1,txtId2,sValue1,sValue2){
        try
         {   
          window.opener.document.getElementById(TxtId1).value=sValue1;
          window.opener.document.getElementById(txtId2).value=sValue2;
          window.opener.document.getElementById(TxtId1).focus();
          if (TxtId1=='txtCityCode'){
          CleareOPenertxtValue('txtVillageCode','txtVillageDes','txtTownCode','txtTownDes');
          }
          if (TxtId1=='txtVillageCode'){
          CleareOPenertxtValue('txtTownCode','txtTownDes');
          }
           if (TxtId1=='txtSourceType'){
          CleareOPenertxtValue('txtClasifCode','txtClasifCodeDes');
          }
          }
         catch(e){}
		 window.close();
}

function Pass3Value(TxtId1,txtId2,txtId3,sValue1,sValue2,sValue3){
        try
         {   
          window.opener.document.getElementById(TxtId1).value=sValue1;
          window.opener.document.getElementById(txtId2).value=sValue2;
          window.opener.document.getElementById(txtId3).value=sValue3;
          }
         catch(e){}
		 window.close();
}
function CleareOPenertxtValue(){
var argv=CleareOPenertxtValue.arguments;
 var argc=argv.length;
  for (var icount=0 ; icount < argc ; icount ++ ){
           window.opener.document.getElementById(argv[icount]).value='';
          }  
}
function PassOneValue(TxtId1,sValue1){
          window.opener.document.getElementById(TxtId1).value=sValue1;
          window.opener.document.getElementById(TxtId1).focus();
           window.close();
 }         
function OpenModalFrm(urlForm,iWidth,iHeight){
    window.showModalDialog(urlForm,'','dialogWidth:' + iWidth + 'px;' + 'dialogHeight:' + iHeight + 'px');
    return false;

}

function OpenModalOpen(urlForm,iWidth,iHeight){
    window.Open(urlForm,'','dialogWidth:' + iWidth + 'px;' + 'dialogHeight:' + iHeight + 'px');
    return false;

}
function First(){
	document.getElementById('imgbtnFirst').disabled=true;
	document.getElementById('imgbtnPrev').disabled=true;
	document.getElementById('imgbtnLast').disabled=false;
	document.getElementById('imgbtnNext').disabled=false;
	
    document.getElementById('imgbtnFirst').src='../../Images/button/lastright_g.gif';
    document.getElementById('imgbtnPrev').src='../../Images/button/right_g.gif';
    document.getElementById('imgbtnLast').src='../../Images/button/lastleft.gif';
    document.getElementById('imgbtnNext').src='../../Images/button/left.gif';
    return false;     
}

function Prev_Next(){
	document.getElementById('imgbtnFirst').disabled=false;
	document.getElementById('imgbtnPrev').disabled=false;
	document.getElementById('imgbtnLast').disabled=false;
	document.getElementById('imgbtnNext').disabled=false;
	
    document.getElementById('imgbtnFirst').src='../../Images/button/lastright.gif';
    document.getElementById('imgbtnPrev').src='../../Images/button/right.gif';
    document.getElementById('imgbtnLast').src='../../Images/button/lastleft.gif';
    document.getElementById('imgbtnNext').src='../../Images/button/left.gif';
    return false;     
}

function Last(){
	document.getElementById('imgbtnFirst').disabled=false;
	document.getElementById('imgbtnPrev').disabled=false;
	document.getElementById('imgbtnLast').disabled=true;
	document.getElementById('imgbtnNext').disabled=true;
	
    document.getElementById('imgbtnFirst').src='../../Images/button/lastright.gif';
    document.getElementById('imgbtnPrev').src='../../Images/button/right.gif';
    document.getElementById('imgbtnLast').src='../../Images/button/lastleft_g.gif';
    document.getElementById('imgbtnNext').src='../../Images/button/left_g.gif';
    return false;     
}

function First_2(){
	document.getElementById('imgbtnFirst2').disabled=true;
	document.getElementById('imgbtnPrev2').disabled=true;
	document.getElementById('imgbtnLast2').disabled=false;
	document.getElementById('imgbtnNext2').disabled=false;
	
    document.getElementById('imgbtnFirst2').src='../../Images/button/lastright_g.gif';
    document.getElementById('imgbtnPrev2').src='../../Images/button/right_g.gif';
    document.getElementById('imgbtnLast2').src='../../Images/button/lastleft.gif';
    document.getElementById('imgbtnNext2').src='../../Images/button/left.gif';
    return false;     
}

function Prev_Next_2(){
	document.getElementById('imgbtnFirst2').disabled=false;
	document.getElementById('imgbtnPrev2').disabled=false;
	document.getElementById('imgbtnLast2').disabled=false;
	document.getElementById('imgbtnNext2').disabled=false;
	
    document.getElementById('imgbtnFirst2').src='../../Images/button/lastright.gif';
    document.getElementById('imgbtnPrev2').src='../../Images/button/right.gif';
    document.getElementById('imgbtnLast2').src='../../Images/button/lastleft.gif';
    document.getElementById('imgbtnNext2').src='../../Images/button/left.gif';
    return false;     
}

function Last_2(){
	document.getElementById('imgbtnFirst2').disabled=false;
	document.getElementById('imgbtnPrev2').disabled=false;
	document.getElementById('imgbtnLast2').disabled=true;
	document.getElementById('imgbtnNext2').disabled=true;
	
    document.getElementById('imgbtnFirst2').src='../../Images/button/lastright.gif';
    document.getElementById('imgbtnPrev2').src='../../Images/button/right.gif';
    document.getElementById('imgbtnLast2').src='../../Images/button/lastleft_g.gif';
    document.getElementById('imgbtnNext2').src='../../Images/button/left_g.gif';
    return false;     
}

function SearchImg (flag){
    document.getElementById('imgbtnSrch').src=(flag) ? '../../Images/button/cancel.gif' : '../../Images/button/search.gif';
}
function loading (flag){
    document.getElementById('imgLoading').style.visibility =(flag) ? 'hidden' : 'visible';
}
function LogoutfromIps(){
    window.open("../../IpsLogin.aspx","_self");
}
function DisableTrans()
{
    document.form1.btntakheen.disabled=true;
    document.form1.btnMaintenance.disabled=true;
}
function EnableTrans()
{
     document.form1.btntakheen.disabled=false;
     document.form1.btnMaintenance.disabled=false;
}
function PassVal(TxtId1,txtId2,obj){
        try
         {   
          window.opener.document.getElementById(TxtId1).value=GetCellValue(obj,'2');
          window.opener.document.getElementById(txtId2).value=GetCellValue(obj,'1');
          window.opener.document.getElementById(TxtId1).focus();
         
          }
         catch(e){}
		 window.close();
}

function PassVal2(txtId1,txtId2,txtId3,obj){
        try
         {
          window.opener.document.getElementById(txtId1).value=GetCellValue(obj,'1');   
          window.opener.document.getElementById(txtId2).value=GetCellValue(obj,'2');
          window.opener.document.getElementById(txtId3).value=GetCellValue(obj,'3');
          window.opener.document.getElementById(txtId1).focus();         
          }
         catch(e){}
		 window.close();
}
function PassVal3(txtId1,txtId2,txtId3,obj){
        try
         {
          window.opener.document.getElementById(txtId1).value=GetCellValue(obj,'2') + "/" + GetCellValue(obj,'1');
          window.opener.document.getElementById(txtId3).value=GetCellValue(obj,'3');
          window.opener.document.getElementById(txtId1).focus();         
          }
         catch(e){}
		 window.close();
}
function SaveScriptVal()
{
 //   if (document.getElementById('txtTENDER_NO').style.visibility !='hidden')
   // {
   // document.getElementById('txtTENDER_NO1').value=document.getElementById('txtTENDER_NO').value;
   // }
    document.getElementById('txtCOST_CODE1').value=document.getElementById('txtCOST_CODE').value;
    document.getElementById('txtDesc1').value=document.getElementById('txtDesc').value;
    document.getElementById('txtTotal1').value=document.getElementById('txtTotal').value;
}

