﻿// JScript File

//========================================================================================
function allowonlyintegers()
	{
		if((window.event.keyCode >57 || window.event.keyCode<48))
		{  
			window.alert("Please Enter the Numeric numbers.");
			event.keyCode=0;   
			window.event.returnValue=false;
		}
	}

//=====================================================================================

function confirmDelete()
{
   
    if (confirm("Are You Sure want to delete this records?"))
        {
        return true;
        }
 return false;
}

//======================================================================================
function chk_blank()
{    
    if(document.form1.txtsearch.value == "")
    {
    alert("Blank field search not allowed.");
    return false;
    }
}
//=====================================================================================

function validate_login()
{
	var doc = document.form1;
	
	if (doc.txtloginname.value == "" || doc.txtpwd.value == ""||doc.txtcpwd.vaue=="")
	{
		alert("Fill in all ' * ' marked fields!.....");
		return false;
	}
	
	if(doc.txtpwd.value !="")
	{
	    if (doc.txtpwd.value != doc.txtcpwd.value) 
	    {
		    alert("Password and Confirm Password not matchning.");
		    return false;
	    }
	}
	
}
// ===================================================================================

//Gridview color change

var oldgridSelectedColor;
    function setMouseOverColor(element)
    {
        oldgridSelectedColor = element.style.backgroundColor ;
        element.style.backgroundColor='#C1BB4F';
        element.style.cursor='hand';
        //element.style.textDecoration='underline';
    }
    function setMouseOutColor(element)
    {
        element.style.backgroundColor=oldgridSelectedColor;
        element.style.textDecoration='none';
    }

     
//==================================================================================

//Open Poop On Click or Onmoseover ....

function CreatepopUp(url) 
{
var Popup;

Popup = window.open(url, "Popup",'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=900,height=600,left = 200,top = 202'); 
Popup.focus();

}

//=================================================================================
function CreatepopUp2(url) 
{
var Popup;
Popup = window.open(url, "Popup",'toolbar=0,scrollbars=0,location=0, directories=0, status=0,statusbar=0,menubar=0,resizable=0,width=420,height=375,left = 200,top = 202'); 
Popup.focus();

}

//=================================================================================
function CreatepopUpTraining(url) 
{
var Popup;
Popup = window.open(url, "Popup",'toolbar=0,scrollbars=auto,location=0, directories=0, menubar=0 status=0,statusbar=0,menubar=0,resizable=0,width=550,height=450,left = 200,top = 202'); 
Popup.focus();

}



//=================================================================================
function CreatepopUp3(url) 
{
var Popup;
Popup = window.open(url, "Popup",'toolbar=0,scrollbars=yes,location=0, directories=0, status=0,statusbar=0,menubar=0,resizable=0,width=500,height=600,left = 500,top = 202'); 
Popup.focus();

}

//=================================================================================
function CreatepopUp4(url) 
{
var Popup;
Popup = window.open(url, "Popup",'toolbar=0,scrollbars=yes,location=0, directories=0, status=0,statusbar=0,menubar=0,resizable=0,width=500,height=350,left = 500,top = 202'); 
Popup.focus();

}

//=================================================================================

//all CheckBox  checked in GridView
function HighlightRow(chkB)
{
var IsChecked = chkB.checked;           
if(IsChecked)
  {
       chkB.parentElement.parentElement.style.backgroundColor='#fffff'; 
       chkB.parentElement.parentElement.style.color='Blue';
  }
  else
  {
       chkB.parentElement.parentElement.style.backgroundColor='#fffff';
       chkB.parentElement.parentElement.style.color='white';
  }
}
    
    
function SelectAllCheckboxesSpecific(spanChk)
       {
           var IsChecked = spanChk.checked;
           var Chk = spanChk;
              Parent = document.getElementById('gvNewslist');          
              var items = Parent.getElementsByTagName('input');                         
              for(i=0;i<items.length;i++)
              {               
                  if(items[i].id != Chk && items[i].type=="checkbox")
                  {           
                      if(items[i].checked!= IsChecked)
                      {    
                          items[i].click();    
                      }
                  }
              }            
       }      
        
        
function SelectAllCheckboxesMoreSpecific(spanChk)
       {
           var IsChecked = spanChk.checked;
           var Chk = spanChk;
              Parent = document.getElementById('gvNewslist');                                                   
              for(i=0;i< Parent.rows.length;i++)
              {     
                  var tr = Parent.rows[i];                                                 
                  var td = tr.firstChild;         
                  var item =  td.firstChild;                     
                  if(item.id != Chk && item.type=="checkbox")
                  {           
                      if(item.checked!= IsChecked)
                      {    
                          item.click();    
                      }
                  }
              }            
       }
//==================================================================================


//all CheckBox  checked in GridView
function HighlightRow4(chkB)
{
var IsChecked = chkB.checked;           
if(IsChecked)
  {
       chkB.parentElement.parentElement.style.backgroundColor='#fffff'; 
       chkB.parentElement.parentElement.style.color='Blue';
  }
  else
  {
       chkB.parentElement.parentElement.style.backgroundColor='#fffff';
       chkB.parentElement.parentElement.style.color='white';
  }
}
    
    
function SelectAllCheckboxesSpecific4(spanChk)
       {
           var IsChecked = spanChk.checked;
           var Chk = spanChk;
              Parent = document.getElementById('gvnewslist');          
              var items = Parent.getElementsByTagName('input');                         
              for(i=0;i<items.length;i++)
              {               
                  if(items[i].id != Chk && items[i].type=="checkbox")
                  {           
                      if(items[i].checked!= IsChecked)
                      {    
                          items[i].click();    
                      }
                  }
              }            
       }      
        
        
function SelectAllCheckboxesMoreSpecific4(spanChk)
       {
           var IsChecked = spanChk.checked;
           var Chk = spanChk;
              Parent = document.getElementById('gvnewslist');                                                   
              for(i=0;i< Parent.rows.length;i++)
              {     
                  var tr = Parent.rows[i];                                                 
                  var td = tr.firstChild;         
                  var item =  td.firstChild;                     
                  if(item.id != Chk && item.type=="checkbox")
                  {           
                      if(item.checked!= IsChecked)
                      {    
                          item.click();    
                      }
                  }
              }            
       }
//==================================================================================


//all CheckBox  checked in GridView
function HighlightRow5(chkB)
{
var IsChecked = chkB.checked;           
if(IsChecked)
  {
       chkB.parentElement.parentElement.style.backgroundColor='#fffff'; 
       chkB.parentElement.parentElement.style.color='Blue';
  }
  else
  {
       chkB.parentElement.parentElement.style.backgroundColor='#fffff';
       chkB.parentElement.parentElement.style.color='white';
  }
}
    
    
function SelectAllCheckboxesSpecific5(spanChk)
       {
           var IsChecked = spanChk.checked;
           var Chk = spanChk;
              Parent = document.getElementById('gvnewslist');          
              var items = Parent.getElementsByTagName('input');                         
              for(i=0;i<items.length;i++)
              {               
                  if(items[i].id != Chk && items[i].type=="checkbox")
                  {           
                      if(items[i].checked!= IsChecked)
                      {    
                          items[i].click();    
                      }
                  }
              }            
       }      
        
        
function SelectAllCheckboxesMoreSpecific5(spanChk)
       {
           var IsChecked = spanChk.checked;
           var Chk = spanChk;
              Parent = document.getElementById('gvnewslist');                                                   
              for(i=0;i< Parent.rows.length;i++)
              {     
                  var tr = Parent.rows[i];                                                 
                  var td = tr.firstChild;         
                  var item =  td.firstChild;                     
                  if(item.id != Chk && item.type=="checkbox")
                  {           
                      if(item.checked!= IsChecked)
                      {    
                          item.click();    
                      }
                  }
              }            
       }
//==================================================================================

//all CheckBox  checked in GridView
function HighlightRow2(chkB)
{
var IsChecked = chkB.checked;           
if(IsChecked)
  {
       chkB.parentElement.parentElement.style.backgroundColor='#fffff'; 
       chkB.parentElement.parentElement.style.color='Blue';
  }
  else
  {
       chkB.parentElement.parentElement.style.backgroundColor='#fffff';
       chkB.parentElement.parentElement.style.color='white';
  }
}
    
    
function SelectAllCheckboxesSpecific2(spanChk)
       {
           var IsChecked = spanChk.checked;
           var Chk = spanChk;
              Parent = document.getElementById('gvmemberlist');          
              var items = Parent.getElementsByTagName('input');                         
              for(i=0;i<items.length;i++)
              {               
                  if(items[i].id != Chk && items[i].type=="checkbox")
                  {           
                      if(items[i].checked!= IsChecked)
                      {    
                          items[i].click();    
                      }
                  }
              }            
       }      
        
        
function SelectAllCheckboxesMoreSpecific2(spanChk)
       {
           var IsChecked = spanChk.checked;
           var Chk = spanChk;
              Parent = document.getElementById('gvmemberlist');                                                   
              for(i=0;i< Parent.rows.length;i++)
              {     
                  var tr = Parent.rows[i];                                                 
                  var td = tr.firstChild;         
                  var item =  td.firstChild;                     
                  if(item.id != Chk && item.type=="checkbox")
                  {           
                      if(item.checked!= IsChecked)
                      {    
                          item.click();    
                      }
                  }
              }            
       }
//==================================================================================

//Popup News lIst ..............

function popupNewsList()
{         
    var Popup;
    Popup=window.open("PopupNewsList.aspx","List",'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=0,width=1000,height=600,left = 150,top = 150'); 
    Popup.focus();
    return false;
}

function GetRowValueNewsLIst(val1,val2)
{
    // hardcoded value used to minimize the code. 
    // ControlID can instead be passed as query string to the popup window
    window.opener.document.getElementById("txttilte").value = val1;
    window.opener.document.getElementById("HFNewsId").value = val2;
    window.close();
}
//================================================================================


//Popup News lIst for Competion..............

function popupNewsListc()
{         
    var Popup;
    Popup=window.open("PopupNewsListc.aspx","List",'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=0,width=1000,height=600,left = 150,top = 150'); 
    Popup.focus();
    return false;
}

function GetRowValueNewsLIstc(val1,val2)
{
    // hardcoded value used to minimize the code. 
    // ControlID can instead be passed as query string to the popup window
    window.opener.document.getElementById("txttilte").value = val1;
    window.opener.document.getElementById("HFNewsId").value = val2;
    window.close();
}
//================================================================================

//Popup News lIst english  .............

function popupNewsList_en()
{         
    var Popup;
    Popup=window.open("PopupNewsList_en.aspx","List",'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=0,width=1000,height=600,left = 150,top = 150'); 
    Popup.focus();
    return false;
}

function GetRowValueNewsLIst_en(val1,val2)
{
    // hardcoded value used to minimize the code. 
    // ControlID can instead be passed as query string to the popup window
    window.opener.document.getElementById("txttilte").value = val1;
    window.opener.document.getElementById("HFNewsId").value = val2;
    window.close();
}
//================================================================================
//Popup Event lIst ..............

function popupEventList()
{         
    var Popup;
    Popup=window.open("PopupEventList.aspx","List",'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=0,width=1000,height=600,left = 150,top = 150'); 
    Popup.focus();
    return false;
}

function GetRowValueEventLIst(val1,val2)
{
    // hardcoded value used to minimize the code. 
    // ControlID can instead be passed as query string to the popup window
    window.opener.document.getElementById("txttilte").value = val1;
    window.opener.document.getElementById("HFNewsId").value = val2;
    window.close();
}
//================================================================================
//Popup Event lIst en..............

function popupEventList_en()
{         
    var Popup;
    Popup=window.open("PopupEventList_en.aspx","List",'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=0,width=1000,height=600,left = 150,top = 150'); 
    Popup.focus();
    return false;
}

function GetRowValueEventLIst_en(val1,val2)
{
    // hardcoded value used to minimize the code. 
    // ControlID can instead be passed as query string to the popup window
    window.opener.document.getElementById("txttilte").value = val1;
    window.opener.document.getElementById("HFNewsId").value = val2;
    window.close();
}
//================================================================================

//Popup Traning lIst ..............

function popupTraningList()
{         
    var Popup;
    Popup=window.open("PopupTraningList.aspx","List",'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=0,width=1000,height=600,left = 150,top = 150'); 
    Popup.focus();
    return false;
}

function GetRowValueTraningLIst(val1,val2)
{
    // hardcoded value used to minimize the code. 
    // ControlID can instead be passed as query string to the popup window
    window.opener.document.getElementById("txttilte").value = val1;
    window.opener.document.getElementById("HFTraningId").value = val2;
    window.close();
}
//================================================================================

//Popup Traning lIst en ..............

function popupTraningList_en()
{         
    var Popup;
    Popup=window.open("PopupTraningList_en.aspx","List",'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=0,width=1000,height=600,left = 150,top = 150'); 
    Popup.focus();
    return false;
}

function GetRowValueTraningLIst_en(val1,val2)
{
    // hardcoded value used to minimize the code. 
    // ControlID can instead be passed as query string to the popup window
    window.opener.document.getElementById("txttilte").value = val1;
    window.opener.document.getElementById("HFTraningId").value = val2;
    window.close();
}
//================================================================================
//Popup Traning lIst ..............

function popupAdvList()
{         
    var Popup;
    Popup=window.open("PopupAdvList.aspx","List",'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=0,width=1000,height=600,left = 150,top = 150'); 
    Popup.focus();
    return false;
}

function GetRowValueAdvLIst(val1,val2)
{
    // hardcoded value used to minimize the code. 
    // ControlID can instead be passed as query string to the popup window
    window.opener.document.getElementById("txttilte").value = val1;
    window.opener.document.getElementById("HFAdvId").value = val2;
    window.close();
}
//===============================================================================

//Popup Advertisment lIst ..............

function popupAdvListc()
{         
    var Popup;
    Popup=window.open("PopupAdvListc.aspx","List",'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=0,width=1000,height=600,left = 150,top = 150'); 
    Popup.focus();
    return false;
}

function GetRowValueAdvLIstc(val1,val2)
{
    // hardcoded value used to minimize the code. 
    // ControlID can instead be passed as query string to the popup window
    window.opener.document.getElementById("txttilte").value = val1;
    window.opener.document.getElementById("HFAdvId").value = val2;
    window.close();
}
//===============================================================================

//Popup Adv  lIst _en  ..............

function popupAdvList_en()
{         
    var Popup;
    Popup=window.open("PopupAdvList_en.aspx","List",'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=0,width=1000,height=600,left = 150,top = 150'); 
    Popup.focus();
    return false;
}

function GetRowValueAdvLIst_en(val1,val2)
{
    // hardcoded value used to minimize the code. 
    // ControlID can instead be passed as query string to the popup window
    window.opener.document.getElementById("txttilte").value = val1;
    window.opener.document.getElementById("HFAdvId").value = val2;
    window.close();
}
//================================================================================

function validate_News()
{
	var doc = document.form1;
	
	if (doc.txttilte.value == "")
	{
		alert("Fill in all ' * ' marked fields!.....");
		return false;
	}	
	
}
// ================================================================================

function validate_NewsSelect()
{
	var doc = document.form1;
	
	if (doc.txttilte.value == "")
	{
		alert("Fill in all ' * ' marked fields!.....");
		return false;
	}	
	
}
// ===================================================================================

function validate_Traning()
{
	var doc = document.form1;
	
	if (doc.txttilte.value == ""||doc.txtdesc.value == ""||doc.txtregion.value == ""||doc.txtwilayat.value == ""||doc.txtdetails.value == "")
	{
		alert("Fill in all ' * ' marked fields!.....");
		return false;
	}	
	
}
// ===================================================================================


//all CheckBox  checked in GridView
//function HighlightRow3(chkB)
//{
//var IsChecked = chkB.checked;           
//if(IsChecked)
//  {
//       chkB.parentElement.parentElement.style.backgroundColor='#fffff'; 
//       chkB.parentElement.parentElement.style.color='Blue';
//  }
//  else
//  {
//       chkB.parentElement.parentElement.style.backgroundColor='#fffff';
//       chkB.parentElement.parentElement.style.color='white';
//  }
//}
    
    
function SelectAllCheckboxesSpecific3(spanChk)
       {
           var IsChecked = spanChk.checked;
           var Chk = spanChk;
              Parent = document.getElementById('gvtraninglist');          
              var items = Parent.getElementsByTagName('input');                         
              for(i=0;i<items.length;i++)
              {               
                  if(items[i].id != Chk && items[i].type=="checkbox")
                  {           
                      if(items[i].checked!= IsChecked)
                      {    
                          items[i].click();    
                      }
                  }
              }            
       }      
        
        
function SelectAllCheckboxesMoreSpecific3(spanChk)
       {
           var IsChecked = spanChk.checked;
           var Chk = spanChk;
              Parent = document.getElementById('gvtraninglist');                                                   
              for(i=0;i< Parent.rows.length;i++)
              {     
                  var tr = Parent.rows[i];                                                 
                  var td = tr.firstChild;         
                  var item =  td.firstChild;                     
                  if(item.id != Chk && item.type=="checkbox")
                  {           
                      if(item.checked!= IsChecked)
                      {    
                          item.click();    
                      }
                  }
              }            
       }
//==================================================================================

function Tender_Insert()
{
	var doc = document.form1;
	
	if (doc.txttilte.value == "" ||doc.FileUpload1.value=="")
	{
		alert("Fill in all ' * ' marked fields!.....");
		return false;
	}
	
//	if(doc.FileUpload1.value!="")
//	{	
//		
//	 var file =doc.FileUpload1.value;
//	 
//	 //Setting the extension array for diff. type of text files 
//     //var extArray = new Array(".pdf"); 
//	
//     var extArray = new Array(".txt", ".doc",".docx", ".rtf", ".pdf", ".sxw", ".odt",".stw", ".html", ".htm", ".sdw", ".vor");   
// 
//     //getting the file name
//       while (file.indexOf("\\") != -1)
//         file = file.slice(file.indexOf("\\") + 1);         
//         
//     //Getting the file extension 
//                         
//       var ext = file.slice(file.indexOf(".")).toLowerCase();            

//        for(var i=0; i<extArray.length; i++)
//        {
//            if(extArray[i]==ext)
//            {
//            return true;
//            }
//        }
//        
//         alert("Please only upload files that end in type: " 
//           + (extArray.join("  ")) + "\nPlease select a new "
//           + "file to upload and submit again.");
//            //file.focus();
//           return false;     
//   }

   
    if(doc.FileUpload2.value!="")
	{		
		
	 var file2 =doc.FileUpload2.value; 
	
	 
	 //Setting the extension array for diff. type of text files 
     //var extArray = new Array(".pdf"); 
	
     var extArray2 = new Array(".zip",".rar");   
 
     //getting the file name
       while (file2.indexOf("\\") != -1)
         file2 = file2.slice(file2.indexOf("\\") + 1);         
         
     //Getting the file extension 
                         
       var ext2 = file2.slice(file2.indexOf(".")).toLowerCase();            

        for(var i=0; i<extArray2.length; i++)
        {
            if(extArray2[i]==ext2)
            {
            return true;
            }
        }
        
         alert("Please only upload files that end in type: " 
           + (extArray2.join("  ")) + "\nPlease select a new "
           + "file to upload and submit again.");
            //file.focus();
           return false; 
   } 
   
    
}
// ================================================================================

//Popup Tender lIst ..............

function popupTenderList()
{         
    var Popup;
    Popup=window.open("PopupTenderList.aspx","List",'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=0,width=1000,height=600,left = 150,top = 150'); 
    Popup.focus();
    return false;
}

function GetRowValueTenderLIst(val1,val2)
{
    // hardcoded value used to minimize the code. 
    // ControlID can instead be passed as query string to the popup window
    window.opener.document.getElementById("txttilte").value = val1;
    window.opener.document.getElementById("HFNewsId").value = val2;
    window.close();
}
//================================================================================

//Popup Tender lIst english ..............

function popupTenderList_en()
{         
    var Popup;
    Popup=window.open("PopupTenderList_en.aspx","List",'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=0,width=1000,height=600,left = 150,top = 150'); 
    Popup.focus();
    return false;
}

function GetRowValueTenderLIst_en(val1,val2)
{
    // hardcoded value used to minimize the code. 
    // ControlID can instead be passed as query string to the popup window
    window.opener.document.getElementById("txttilte").value = val1;
    window.opener.document.getElementById("HFNewsId").value = val2;
    window.close();
}
//================================================================================


function Tender_Modify()
{
	var doc = document.form1;
	
	if (doc.txttilte.value == "")
	{
		alert("Fill in all ' * ' marked fields!.....");
		return false;
	}
	
//	if(doc.FileUpload1.value!="")
//	{	
//		
//	 var file =doc.FileUpload1.value;
//	 
//	 //Setting the extension array for diff. type of text files 
//     //var extArray = new Array(".pdf"); 
//	
//     var extArray = new Array(".txt", ".doc",".docx", ".rtf", ".pdf", ".sxw", ".odt",".stw", ".html", ".htm", ".sdw", ".vor");   
// 
//     //getting the file name
//       while (file.indexOf("\\") != -1)
//         file = file.slice(file.indexOf("\\") + 1);         
//         
//     //Getting the file extension 
//                         
//       var ext = file.slice(file.indexOf(".")).toLowerCase();            

//        for(var i=0; i<extArray.length; i++)
//        {
//            if(extArray[i]==ext)
//            {
//            return true;
//            }
//        }
//        
//         alert("Please only upload files that end in type: " 
//           + (extArray.join("  ")) + "\nPlease select a new "
//           + "file to upload and submit again.");
//            //file.focus();
//           return false;     
//   }

   
    if(doc.FileUpload2.value!="")
	{		
		
	 var file2 =doc.FileUpload2.value;	 
	
	 
	 //Setting the extension array for diff. type of text files 
     //var extArray = new Array(".pdf"); 
	
     var extArray2 = new Array(".zip",".rar");   
 
     //getting the file name
       while (file2.indexOf("\\") != -1)
         file2 = file2.slice(file2.indexOf("\\") + 1);         
         
     //Getting the file extension 
                         
       var ext2 = file2.slice(file2.indexOf(".")).toLowerCase();            

        for(var i=0; i<extArray2.length; i++)
        {
            if(extArray2[i]==ext2)
            {
            return true;
            }
        }
        
         alert("Please only upload files that end in type: " 
           + (extArray2.join("  ")) + "\nPlease select a new "
           + "file to upload and submit again.");
            //file.focus();
           return false; 
   } 
   
    
}
// ================================================================================

//Feedback .....

function FeedBAck_Insert()
{
	var doc = document.form1;
	
	if (doc.txtname.value == "" ||doc.txtemail.value==""||doc.txtQuestion.value=="")
	{
		alert("Fill in all ' * ' marked fields!.....");
		return false;
	}
	
	if(doc.txtemail.value != "")
       {       
            if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(doc.txtemail.value))        
                          
            var i ="";                    
             else 
             {                                              
            alert('Please enter a valid email id.');
            return false;  
            } 
        }
	
}
//=================================================================================
function Regform3()
{
	var doc = document.form1;
	
	if (doc.txtname.value == "" ||doc.txtemail.value==""||doc.txtfname.value=="" ||doc.txtidcardno.value=="" ||doc.txtdob.value=="" ||doc.txtdob.value=="")
	{
		alert("Fill in all ' * ' marked fields!.....");
		return false;
	}
	
	if(doc.txtemail.value != "")
       {       
            if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(doc.txtemail.value))        
                          
            var i ="";                    
             else 
             {                                              
            alert('Please enter a valid email id.');
            return false;  
            } 
        }
	
}
//=================================================================================
	




