function submit_onclick(butname)
{
    if(butname=="Login")
    {
        if(document.frm.txtEmailId.value=="")
        {
            alert("UserId can't be empty.");
            document.frm.txtEmailId.focus();
            return false;
        }

            if(document.frm.txtPassword.value=="" )
            {
                    alert("Password can't be empty");
                    document.frm.txtPassword.focus();
                    return false;
            }
           
            
            document.frm.txthidval1.value = "Login";
        return;
    }
             
}

//------------------------------------------------------event.php----------------------------------------------------------

 function submit_event(butname)
{
		
  document.frm.hidval1.value = "Add";
  with (frm)
  {	
  	
	var strMsg="";
	//if (txtEventTitle.value==null || txtEventTitle.value=="")
	//{
	//    strMsg="\nEvent Title is Blank.";
	//}
	if (txtEventText.value==null || txtEventText.value=="")
	{
		strMsg="\nEvent Text is Blank.";
	}
	if (txtVenueAddress.value==null || txtVenueAddress.value=="")
	{
		strMsg="\nEvent Venue is Blank.";
	}
	if (txtEventDate.value==null || txtEventDate.value=="")
	{
		strMsg="\nEvent Date is Blank.";
	}
	if (txtEventTime.value==null || txtEventTime.value=="")
	{
		strMsg="\nEvent Time is Blank.";
	}
	if (txtPlaceCode.value==null || txtPlaceCode.value=="")
	{
		strMsg="\nEvent Place is Blank.";
	}

	if(strMsg!="")
	{
	    alert("Error(s) found:\n"+strMsg);
	    txtEventText.focus();
	    return false;
	}
	document.frm.action="event.php?Action=Add";
	document.frm.submit();

  }
}

//----------------------------------Vacancy/popupsearch/popupsearchnew.php files---------------------------------------

function submit_vacancy(butname)
{
	
  document.frm.hidval1.value = "Add";
  with (frm)
  {
	var strMsg="";
	
	if (txtDisplayEndDate.value==null || txtDisplayEndDate.value=="")
	{
		strMsg="\nDisplay End Date is Blank.";
	}
	if (txtBriefDescription.value==null || txtBriefDescription.value=="")
	{
	    strMsg="\nJob Title is Blank.";
	}
	if (txtJobKeywords.value==null || txtJobKeywords.value=="")
	{
		strMsg="\nJob Keywords is Blank.";
	}
	if (my_upload.value==null || my_upload.value=="")
	{
		strMsg="\nFile is Blank.";
	}
	if (txtPlaceCode.value==null || txtPlaceCode.value=="")
	{
		strMsg="\nPlace is Blank.";
	}
	
	if(strMsg!="")
	{
	    alert("Error(s) found:\n"+strMsg);
	    txtDisplayEndDate.focus();
	    return false;
	}
	document.frm.action="popupsearchnew.php?Action=Add";
	document.frm.submit();

  }
}

//------------------------------------------createaudio.php files----------------------------------------------------------

function submit_audio(butname)
{
	
  document.frm.hidval1.value = "Add";
  with (frm)
  {
	var strMsg="";
	if (txtSize.value==null || txtSize.value=="")
	{
	    strMsg="\nSize is Blank.";
	}
	if (txtDescriptionInKannada.value==null || txtDescriptionInKannada.value=="")
	{
		    strMsg="\nTitle is Blank.";
	}
	if (txtDurationInMinutes.value==null || txtDurationInMinutes.value=="")
	{
		    strMsg="\nDuration is Blank.";
	}
	if (txtJobKeywords.value==null || txtJobKeywords.value=="")
	{
		    strMsg="\Keyword is Blank.";
	}
	if (my_upload.value==null || my_upload.value=="")
	{
		strMsg="\nFile is Blank.";
	}


	if(strMsg!="")
	{
	    alert("Error(s) found:\n"+strMsg);
	    txtDescriptionInKannada.focus();
	    return false;
	}
	document.frm.action="createaudio.php?Action=Add";
	document.frm.submit();

  }
}


//------------------------------------------createtext.php files----------------------------------------------------------

function submit_text(butname)
{
		
  document.frm.hidval1.value = "Add";
    with (frm)
    {
  	var strMsg="";
  	if (txtDescriptionInKannada.value==null || txtDescriptionInKannada.value=="")
	{
	    strMsg="\nTitle is Blank.";
  	}
  	if (txtSize.value==null || txtSize.value=="")
  	{
  	    strMsg="\nSize is Blank.";
  	}
  	
  	if (txtJobKeywords.value==null || txtJobKeywords.value=="")
  	{
  		    strMsg="\Keyword is Blank.";
  	}
  	if (my_upload.value==null || my_upload.value=="")
	{
		strMsg="\nFile is Blank.";
	}
  	if(strMsg!="")
  	{
  	    alert("Error(s) found:\n"+strMsg);
  	    txtDescriptionInKannada.focus();
  	    return false;
	}
	document.frm.action="createtext.php?Action=Add";
	document.frm.submit();

  }
}



//------------------------------------------createform.php files----------------------------------------------------------

function submit_form(butname)
{
	
  document.frm.hidval1.value = "Add";
  with (frm)
  {
	var strMsg="";
	if (txtDescriptionInKannada.value==null || txtDescriptionInKannada.value=="")
	{
	    strMsg="\nTitle is Blank.";
	}
	if (txtSize.value==null || txtSize.value=="")
	{
	    strMsg="\nSize is Blank.";
	}
	
	if (txtJobKeywords.value==null || txtJobKeywords.value=="")
	{
	   strMsg="\Keyword is Blank.";
  	}
  	if (my_upload.value==null || my_upload.value=="")
	{
	   strMsg="\nFile is Blank.";
	}
	if(strMsg!="")
	{
	    alert("Error(s) found:\n"+strMsg);
	    txtDescriptionInKannada.focus();
	    return false;
	}
	document.frm.action="createform.php?Action=Add";
	document.frm.submit();

  }
}



//------------------------------------------createlink.php files----------------------------------------------------------

function submit_file(butname)
{
	
  document.frm.hidval1.value = "Add";
  with (frm)
  {
	var strMsg="";
	if (txtSize.value==null || txtSize.value=="")
	{
	    strMsg="\nSize is Blank.";
	}
	if (txtDescriptionInKannada.value==null || txtDescriptionInKannada.value=="")
	{
		    strMsg="\nTitle is Blank.";
	}
	if (txtJobKeywords.value==null || txtJobKeywords.value=="")
	{
		  strMsg="\Keyword is Blank.";
  	}
  	if (my_upload.value==null || my_upload.value=="")
	{
		  strMsg="\nFile is Blank.";
	}
	if (txtPlaceCode.value==null || txtPlaceCode.value=="")
	{
		strMsg="\nPlace is Blank.";
	}
	
	if(strMsg!="")
	{
	    alert("Error(s) found:\n"+strMsg);
	    txtSize.focus();
	    return false;
	}
	document.frm.action="createlink.php?Action=Add";
	document.frm.submit();

  }
}

//------------------------------------------createfile.php files----------------------------------------------------------

function submit_link(butname)
{
	
  document.frm.hidval1.value = "Add";
  with (frm)
  {
	var strMsg="";
	if (txtUrl.value==null || txtUrl.value=="")
	{
	    strMsg="\nURL is Blank.";
	}
	if (txtDescriptionInKannada.value==null || txtDescriptionInKannada.value=="")
	{
	    strMsg="\nTitle is Blank.";
	}
	
	if (txtJobKeywords.value==null || txtJobKeywords.value=="")
	{
		strMsg="\Keyword is Blank.";
  	}
  	if (txtPlaceCode.value==null || txtPlaceCode.value=="")
	{
		strMsg="\nPlace is Blank.";
	}
	

	if(strMsg!="")
	{
	    alert("Error(s) found:\n"+strMsg);
	    txtDescriptionInKannada.focus();
	    return false;
	}
	document.frm.action="createfile.php?Action=Add";
	document.frm.submit();

  }
}



function submit_showvacancydetails(butname)
    { 
    	//alert(butname);
        //if(butname=="add")
        //{ 
         //    document.frm.hidval1.value = "Add";
         //    document.frm.submit();
        //}
        if(butname=="Close")
        {
            document.frm.action = "../Home.php";
            document.frm.submit();
        }
        if(butname=="show")
        { 
             document.frm.hidval2.value = "Show";
             document.frm.submit();
        }
        
}

//------------------------------------------------------------for eventpopup.php--------------------------------------------------------------------------------------------------------------------

function eventviewpopup(EId)
  { 
     var winchild = window.open('eventpopup.php?eid='+EId ,'popUPwindow','dependent=yes, scrollbars=1, 200, 100, resizable=1');
     winchild.focus();
     if (winchild.opener == null) winchild.opener = self;
  } 
  
//---------------------------------------------------------for filepopup.php-----------------------------------------------------------------------------------------------

function fileviewpopup(RId)
  { 
     var winchild = window.open('filepopup.php?rid='+RId ,'popUPwindow','dependent=yes, scrollbars=1,200,100,resizable=1');
     winchild.focus();
     if (winchild.opener == null) winchild.opener = self;
  } 
  
  //---------------------------------------------------------for vacancypopup.php-----------------------------------------------------------------------------------------------
  
  function vacancyviewpopup(JId)
    { 
       var winchild = window.open('vacancypopup.php?jid='+JId ,'popUPwindow','dependent=yes, scrollbars=1,200,100,resizable=1');
       winchild.focus();
       if (winchild.opener == null) winchild.opener = self;
  } 
  
//--------------------------------------------------------------block used in deletion of vacancy-----------------------------------    
function MClick(strAction,strId)
{
	
    if(strAction == "Del")
    {
        if (confirm("Do you really want to Delete?")!=0 )
        {
            document.frm.hidval2.value=strId;
           
            document.frm.hidval1.value=strAction;
            //var strReq=strPage?Action="+strAction;
            //document.frm.action=strReq;
            document.frm.submit();
        }
    }
    else
    {
        document.frm.hidval2.value=strId;
        
        document.frm.hidval1.value=strAction;       // this was the new line added
        //var strReq=strPage?Action="+strAction;
        //document.frm.action=strReq;
        document.frm.submit();
    }
}


//---------------------------------------------------for validation of writeus.php-----------------------------------------

function submit_writeus(butname)
{
	
  document.frm.hidval1.value = "Go";
  with (frm)
  {
	var strMsg="";
	if (txtName.value==null || txtName.value=="")
	{
	    strMsg="\nName is Blank.";
	}
	if (txtTitle.value==null || txtTitle.value=="")
	{
	    strMsg="\nTitle is Blank.";
	}
	//if (my_upload.value==null || my_upload.value=="")
	//{
	//    strMsg="\nFile is Blank.";
	//}
	if (txtMessage.value==null || txtMessage.value=="")
	{
	    strMsg="\nMessage is Blank.";
	}
	if (cmbSubjectInKannada.value==null || cmbSubjectInKannada.value=="")
	{
	    strMsg="\nSubject In Kannada is Blank.";
	}
	if (cmbPlaceCode.value==null || cmbPlaceCode.value=="")
	{
	    strMsg="\nPlace is Blank.";
	}
	
	if(strMsg!="")
	{
	    alert("Error(s) found:\n"+strMsg);
	    txtName.focus();
	    return false;
	}
	
	document.frm.submit();

  }
}


// ------------- block of code that pops up the jobs posted by the non kmitra team (used in postjobs.php) -------------
function jobpopup(JAction,JId)
  { 
     var winchild = window.open('jobpopup.php?jid='+JId+'&act='+JAction ,'popUPwindow','dependent=yes, scrollbars=1, 200, 100, resizable=1');
     winchild.focus();
     if (winchild.opener == null) winchild.opener = self;
  } 
 

// ------------- block of code that pops up the jobs posted by the non kmitra team (used in postjobs.php) -------------
function jobpopup1(JAction,JId)
  { 
     var winchild = window.open('jobpopup1.php?jid='+JId+'&act='+JAction ,'popUPwindow','dependent=yes, scrollbars=1, 200, 100, resizable=1');
     winchild.focus();
     if (winchild.opener == null) winchild.opener = self;
  }   
