// JavaScript Document

// ---------for mother tongue-----------------

function addSrcToDestListM() {
mtongue = window.document.forms[0].mtongue;
mtongue1 = window.document.forms[0].mtongue1; 
var len = mtongue.length;
for(var i = 0; i < mtongue1.length; i++) {
if ((mtongue1.options[i] != null) && (mtongue1.options[i].selected)) {
//Check if this value already exist in the destList or not
//if not then add it otherwise do not add it.
var found = false;
for(var count = 0; count < len; count++) {
if (mtongue.options[count] != null) {
if (mtongue1.options[i].text == mtongue.options[count].text) {
mtongue.options[i].selected;
found = true;
break;
      }
   }
}
if (found != true) {
mtongue.options[len] = new Option(mtongue1.options[i].text); 
len++;
         }
      }
   }
}
// Deletes from the destination list.
function deleteFromDestListM() {
var mtongue  = window.document.forms[0].mtongue;
var len = mtongue.options.length;
for(var i = (len-1); i >= 0; i--) {
if ((mtongue.options[i] != null) && (mtongue.options[i].selected == true)) {
mtongue.options[i] = null;
      }
   }
}

function selectFromDestListM() {
var mtongue  = window.document.forms[0].mtongue;
for (i=0; i<mtongue.length; i++) { 
mtongue.options[i].selected = true; 
}
}

//--------------------------- Religion ------------------------------------

function addSrcToDestListR() {
lstreligion = window.document.forms[0].lstreligion;
lstreligion1 = window.document.forms[0].lstreligion1; 
var len = lstreligion.length;
for(var i = 0; i < lstreligion1.length; i++) {
if ((lstreligion1.options[i] != null) && (lstreligion1.options[i].selected)) {
//Check if this value already exist in the destList or not
//if not then add it otherwise do not add it.
var found = false;
for(var count = 0; count < len; count++) {
if (lstreligion.options[count] != null) {
if (lstreligion1.options[i].text == lstreligion.options[count].text) {
//lstreligion.options[i].selected;
found = true;
break;
      }
   }
}
if (found != true) {
lstreligion.options[len] = new Option(lstreligion1.options[i].text); 
len++;
         }
      }
   }
}
// Deletes from the destination list.
function deleteFromDestListR() {
var lstreligion  = window.document.forms[0].lstreligion;
var len = lstreligion.options.length;
for(var i = (len-1); i >= 0; i--) {
if ((lstreligion.options[i] != null) && (lstreligion.options[i].selected == true)) {
lstreligion.options[i] = null;
      }
   }
}

function selectFromDestListR() {
var lstreligion  = window.document.forms[0].lstreligion;
for (i=0; i<lstreligion.length; i++) { 
lstreligion.options[i].selected = true; 
}
}

//--------------------------- Caste ------------------------------------

function addSrcToDestListC() {
caste = window.document.forms[0].caste;
caste1 = window.document.forms[0].caste1; 
var len = caste.length;
for(var i = 0; i < caste1.length; i++) {
if ((caste1.options[i] != null) && (caste1.options[i].selected)) {
//Check if this value already exist in the destList or not
//if not then add it otherwise do not add it.
var found = false;
for(var count = 0; count < len; count++) {
if (caste.options[count] != null) {
if (caste1.options[i].text == caste.options[count].text) {
found = true;
break;
      }
   }
}
if (found != true) {
caste.options[len] = new Option(caste1.options[i].text); 
len++;
         }
      }
   }
}
// Deletes from the destination list.
function deleteFromDestListC() {
var caste  = window.document.forms[0].caste;
var len = caste.options.length;
for(var i = (len-1); i >= 0; i--) {
if ((caste.options[i] != null) && (caste.options[i].selected == true)) {
caste.options[i] = null;
      }
   }
}

function selectFromDestListC() {
var caste  = window.document.forms[0].caste;
for (i=0; i<caste.length; i++) { 
caste.options[i].selected = true; 
}
}


//--------------------------- State ------------------------------------

function addSrcToDestListS() {
lststate = window.document.forms[0].lststate;
lststate1 = window.document.forms[0].lststate1; 
var len = lststate.length;
for(var i = 0; i < lststate1.length; i++) {
if ((lststate1.options[i] != null) && (lststate1.options[i].selected)) {
//Check if this value already exist in the destList or not
//if not then add it otherwise do not add it.
var found = false;
for(var count = 0; count < len; count++) {
if (lststate.options[count] != null) {
if (lststate1.options[i].text == lststate.options[count].text) {
found = true;
break;
      }
   }
}
if (found != true) {
lststate.options[len] = new Option(lststate1.options[i].text); 
len++;
         }
      }
   }
}
// Deletes from the destination list.
function deleteFromDestListS() {
var lststate  = window.document.forms[0].lststate;
var len = lststate.options.length;
for(var i = (len-1); i >= 0; i--) {
if ((lststate.options[i] != null) && (lststate.options[i].selected == true)) {
lststate.options[i] = null;
      }
   }
}

function selectFromDestListS() {
var lststate  = window.document.forms[0].lststate;
for (i=0; i<lststate.length; i++) { 
lststate.options[i].selected = true; 
}
}



//--------------------------- Education ------------------------------------

function addSrcToDestListE() {
cmbedu = window.document.forms[0].cmbedu;
cmbedu1 = window.document.forms[0].cmbedu1; 
var len = cmbedu.length;
for(var i = 0; i < cmbedu1.length; i++) {
if ((cmbedu1.options[i] != null) && (cmbedu1.options[i].selected)) {
//Check if this value already exist in the destList or not
//if not then add it otherwise do not add it.
var found = false;
for(var count = 0; count < len; count++) {
if (cmbedu.options[count] != null) {
if (cmbedu1.options[i].text == cmbedu.options[count].text) {
found = true;
break;
      }
   }
}
if (found != true) {
cmbedu.options[len] = new Option(cmbedu1.options[i].text); 
len++;
         }
      }
   }
}
// Deletes from the destination list.
function deleteFromDestListE() {
var cmbedu  = window.document.forms[0].cmbedu;
var len = cmbedu.options.length;
for(var i = (len-1); i >= 0; i--) {
if ((cmbedu.options[i] != null) && (cmbedu.options[i].selected == true)) {
cmbedu.options[i] = null;
      }
   }
}

function selectFromDestListE() {
var cmbedu  = window.document.forms[0].cmbedu;
for (i=0; i<cmbedu.length; i++) { 
cmbedu.options[i].selected = true; 
}
}
