function ValidKey(key)
{
	if ((key < 48) || (key > 57))
		return false
	return true
}

function ValidMail(eid)
{
	a=eid.indexOf('@')
	b=eid.indexOf('.')
	if(a<1 || b<1 || a==(eid.length-1) || b==(eid.length-1) || Math.abs(a-b)==1)
	{
		return false
	}
	return true
}

function ValidateKey(key,txt)
{
	if(key==46)
	{
		if(txt.indexOf('.')>=0)
			return false
	}
	if ((key < 48) || (key > 57))
		if(key != 46) return false
	return true
}

function Validate2()
{
	if(document.getElementById("SSLC_M").value=="")
	{
		alert("Enter the SSLC % of Marks")
		document.getElementById("SSLC_M").focus()
		return false
	}
	else
	{
		fltM=parseFloat(document.getElementById("SSLC_M").value)
		if(fltM>100)
		{
			alert("Check your percentage of mark in SSLC")
			document.getElementById("SSLC_M").select()
			document.getElementById("SSLC_M").focus()
			return false
		}
	}
	if(document.getElementById("SSLC_Y").value=="")
	{
		alert("Enter the SSLC Year of Passing")
		document.getElementById("SSLC_Y").focus()
		return false
	}
	else
	{
		txtYear=document.getElementById("SSLC_Y").value
		if(txtYear.length<4)
		{
			alert("Enter 4 digit year")
			document.getElementById("SSLC_Y").select()
			document.getElementById("SSLC_Y").focus()
			return false
		}
		curDate=new Date()
		curYear=curDate.getYear()
		if(parseInt(txtYear)>=parseInt(curYear))
		{
			alert("Check your passed year of SSLC")
			document.getElementById("SSLC_Y").select()
			document.getElementById("SSLC_Y").focus()
			return false
		}
	}
	if(document.getElementById("HSC_M").value!="")
	{
		fltM=parseFloat(document.getElementById("HSC_M").value)
		if(fltM>100)
		{
			alert("Check your percentage of mark in HSC")
			document.getElementById("HSC_M").select()
			document.getElementById("HSC_M").focus()
			return false
		}
		if(document.getElementById("HSC_Y").value=="")
		{
			alert("Enter the HSC Year of Passing")
			document.getElementById("HSC_Y").focus()
			return false
		}
		else
		{
			txtYear=document.getElementById("HSC_Y").value
			if(txtYear.length<4)
			{
				alert("Enter 4 digit year")
				document.getElementById("HSC_Y").select()
				document.getElementById("HSC_Y").focus()
				return false
			}
			curDate=new Date()
			curYear=curDate.getYear()
			if(parseInt(txtYear)>=parseInt(curYear))
			{
				alert("Check your passed year of HSC")
				document.getElementById("HSC_Y").select()
				document.getElementById("HSC_Y").focus()
				return false
			}
		}
	}
	if(document.getElementById("UG_Degree").value!="")
	{
		if(document.getElementById("UG_Mark").value=="")
		{
			alert("Enter the UG % of Marks")
			document.getElementById("UG_Mark").focus()
			return false
		}
		else
		{
			fltM=parseFloat(document.getElementById("UG_Mark").value)
			if(fltM>100)
			{
				alert("Check your percentage of mark in UG")
				document.getElementById("UG_Mark").select()
				document.getElementById("UG_Mark").focus()
				return false
			}
		}
		if(document.getElementById("UG_Sub").value=="")
		{
			alert("Enter the UG Subject")
			document.getElementById("UG_Sub").focus()
			return false
		}
		if(document.getElementById("UG_Year").value=="")
		{
			alert("Enter the UG Year of Passing")
			document.getElementById("UG_Year").focus()
			return false
		}
		else
		{
			txtYear=document.getElementById("UG_Year").value
			if(txtYear.length<4)
			{
				alert("Enter 4 digit year")
				document.getElementById("UG_Year").select()
				document.getElementById("UG_Year").focus()
				return false
			}
			curDate=new Date()
			curYear=curDate.getYear()
			if(parseInt(txtYear)>parseInt(curYear))
			{
				alert("Check your passed year of UG")
				document.getElementById("UG_Year").select()
				document.getElementById("UG_Year").focus()
				return false
			}
		}
		if(document.getElementById("UG_Uni").value=="")
		{
			alert("Enter the UG University")
			document.getElementById("UG_Uni").focus()
			return false
		}
	}
	if(document.getElementById("PG_Degree").value!="")
	{
		if(document.getElementById("PG_Mark").value=="")
		{
			alert("Enter the PG % of Marks")
			document.getElementById("PG_Mark").focus()
			return false
		}
		else
		{
			fltM=parseFloat(document.getElementById("PG_Mark").value)
			if(fltM>100)
			{
				alert("Check your percentage of mark in PG")
				document.getElementById("PG_Mark").select()
				document.getElementById("PG_Mark").focus()
				return false
			}
		}
		if(document.getElementById("PG_Sub").value=="")
		{
			alert("Enter the PG Subject")
			document.getElementById("PG_Sub").focus()
			return false
		}
		if(document.getElementById("PG_Year").value=="")
		{
			alert("Enter the PG Year of Passing")
			document.getElementById("PG_Year").focus()
			return false
		}
		else
		{
			txtYear=document.getElementById("PG_Year").value
			if(txtYear.length<4)
			{
				alert("Enter 4 digit year")
				document.getElementById("PG_Year").select()
				document.getElementById("PG_Year").focus()
				return false
			}
			curDate=new Date()
			curYear=curDate.getYear()
			if(parseInt(txtYear)>parseInt(curYear))
			{
				alert("Check your passed year of PG")
				document.getElementById("PG_Year").select()
				document.getElementById("PG_Year").focus()
				return false
			}
		}
		if(document.getElementById("PG_Uni").value=="")
		{
			alert("Enter the PG University")
			document.getElementById("PG_Uni").focus()
			return false
		}
	}
	return true
}

function SetSkills()
{
	eles=document.getElementsByTagName("SELECT")
	vals=""
	for(i=0;i<eles.length;i++)
	{
		ele=document.getElementById(eles[i].name)
		if(ele.value!="")
			vals=vals + ele.value + ","
	}
	document.getElementById("Skill").value=vals
}

function Validate4()
{
	if(document.getElementById("ExpYears").value!="")
	{
		fltM=parseFloat(document.getElementById("ExpYears").value)
		if(fltM>100)
		{
			alert("Check Years of Experiences")
			document.getElementById("ExpYears").select()
			document.getElementById("ExpYears").focus()
			return false
		}
	}	
}

function ShowDetails(id)
{
	url="more.aspx?id=" + id
	window.showModalDialog(url,"","status:off;edge:raised;unadorned:off")
}

function ValidateSend()
{
	if(document.getElementById("YourName").value=="")
	{
		alert("Enter Your Name")
		document.getElementById("YourName").focus()
		return false
	}	
	if(document.getElementById("Concern").value=="")
	{
		alert("Enter Concern Name")
		document.getElementById("Concern").focus()
		return false
	}	
	if(document.getElementById("Location").value=="")
	{
		alert("Enter the Location")
		document.getElementById("Location").focus()
		return false
	}	
	if(document.getElementById("Address").value=="")
	{
		alert("Enter the Address")
		document.getElementById("Address").focus()
		return false
	}	
	if(document.getElementById("Email").value=="")
	{
		alert("Enter the Email Address")
		document.getElementById("Email").focus()
		return false
	}
	else
	{
		if(!ValidMail(document.getElementById("Email").value))
		{
			alert("Enter a valid Email Address")
			document.getElementById("Email").focus()
			document.getElementById("Email").select()
			return false
		}
	}
	if(document.getElementById("Comments").value=="")
	{
		alert("Enter the Comments")
		document.getElementById("Comments").focus()
		return false
	}
	return true
}

function showNews()
{
	var ele;
	ele=document.getElementById("News")
	ele.style.top=368
	ele.style.left=Tab1.offsetLeft+tdNews.offsetWidth-40
	ele.style.display="block"
}

function hideNews()
{
	document.getElementById("News").style.display="none"
}

function showMe()
{
	var ele
	ele=document.getElementById("News")
	ele.style.top=tdNews.offsetTop
	ele.style.left=Tab1.offsetLeft+tdNews.offsetWidth-40
	ele.style.filters[0].apply()
	ele.style.display="block"
	ele.style.filters[0].play()
}

function hideMe()
{
	document.getElementById("News").style.display="none"
}

function resetExistingUser()
{
    document.getElementById("txt_EmailAddress").value=""
    document.getElementById("txt_Password").value=""
    document.getElementById("lbl_Error").value=""
    document.getElementById("txt_EmailAddress").focus()
}
function resetNewUser()
{
    document.getElementById("txt_NewUserEmail").value=""
    document.getElementById("txt_NewUserPassword").value=""
    document.getElementById("txt_NewUserConfirmPassword").value=""
    document.getElementById("lbl_NewUserError").value=""
    document.getElementById("txt_NewUserEmail").focus()
}
 function querySt(ji) 
 {
     hu = window.location.search.substring(1);
     gy = hu.split("&");
     for (i=0;i<gy.length;i++) 
     {
         ft = gy[i].split("=");
         if (ft[0] == ji) 
         {
            return ft[1];
         }
      }
 }
 function trim(sString) 
 {
    while (sString.substring(0,1) == ' ')
    {
       sString = sString.substring(1, sString.length);
    }
    while (sString.substring(sString.length-1, sString.length) == ' ')
    {
        sString = sString.substring(0,sString.length-1);
    }
    return sString;
 }
 
    function addOtherDegreeRow()
    {
        //Insert row in OtherDegree table
        var tbl = document.getElementById('tbl_OtherDegrees');
        var lastRow = tbl.rows.length;
        var iteration = parseInt(lastRow)-1;
        var row = tbl.insertRow(lastRow);
        //Add DegreeId Column which is invisible
        var cellId = row.insertCell(0);
        cellId.id="DegreeId"+iteration;
        cellId.innerText = "0";
        cellId.style.display="none";
        //Add Degree Subject Column
        var cellDegree = row.insertCell(1);
        var elDegree = document.createElement('input');
        elDegree.type = 'text';
        elDegree.name = 'txt_Degree' + iteration;
        elDegree.id = 'txt_Degree' + iteration;
        elDegree.className = 't2';
        cellDegree.appendChild(elDegree);
        //Add Degree Mark Column
        var cellMark = row.insertCell(2);
        var elMark = document.createElement('input');
        elMark.type = 'text';
        elMark.name = 'txt_Mark' + iteration;
        elMark.id = 'txt_Mark' + iteration;
        elMark.className = 't2';
        //elMark.onkeypress='return ValidateKey(event.keyCode,this.value)';
        elMark.onkeypress=function() {return ValidateKey(event.keyCode,this.value);}
        elMark.setAttribute("maxlength",5);
        cellMark.appendChild(elMark);
        //Add Degree Mark Column
        var cellSubject = row.insertCell(3);
        var elSubject = document.createElement('input');
        elSubject.type = 'text';
        elSubject.name = 'txt_Subject' + iteration;
        elSubject.id = 'txt_Subject' + iteration;
        elSubject.className = 't1';
        cellSubject.appendChild(elSubject);
        //Add Degree year Column
        var cellYear = row.insertCell(4);
        var elYear = document.createElement('input');
        elYear.type = 'text';
        elYear.name = 'txt_Year' + iteration;
        elYear.id = 'txt_Year' + iteration;
        elYear.className = 't2';
        elYear.setAttribute("maxlength",4);
        //elYear.onkeypress='return ValidKey(event.keyCode)';
        elYear.onkeypress=function() {return ValidKey(event.keyCode);}
        cellYear.appendChild(elYear);
        //Add Degree university Column
        var cellUniversity = row.insertCell(5);
        var elUniversity = document.createElement('input');
        elUniversity.type = 'text';
        elUniversity.name = 'txt_University' + iteration;
        elUniversity.id = 'txt_University' + iteration;
        elUniversity.className = 't1';
        cellUniversity.appendChild(elUniversity);
       //Add Degree Delete button Column
        var cellDel = row.insertCell(6);
        var elDel = document.createElement('img');
        elDel.src='images/delete.gif';
        elDel.style.cursor='hand'; 
        elDel.style.width='12px'; 
        elDel.style.height='12px';
        elDel.alt='DeleteDegree';
        elDel.name = 'img_DeleteDegree' + iteration;
        elDel.id = 'img_DeleteDegree' + iteration;
        elDel.onclick = eval(removeOtherDegreeRow);
        cellDel.appendChild(elDel);
    }
    function removeOtherDegreeRow()
    {
        //Remove a particular row from OtherDegree table
        var index=0;
        var tbl = document.getElementById('tbl_OtherDegrees');
        var row=window.event.srcElement.parentElement.parentElement;
        index=row.rowIndex;
        var cellId = row.cells[0];
        if (cellId.innerText!="" && cellId.innerText!="0")
        {
              if (document.getElementById('hid_DeleteId').value=="")    document.getElementById('hid_DeleteId').value=cellId.innerText;
              else  document.getElementById('hid_DeleteId').value+="|"+cellId.innerText;
        }
        tbl.deleteRow(index);
        if (tbl.rows.length<2) addOtherDegreeRow();
    }
    function otherDegreePostback()
    {
        //Write other degree informations to a hidden control
        document.getElementById("hid_OtherDegree").value="";
        Validate2();
        var tbl = document.getElementById('tbl_OtherDegrees');
        var lastRow = tbl.rows.length;
        if (parseInt(lastRow)>1==true)
        {
            for (var index=1; index<lastRow; index++)
            {
                if (trim(tbl.rows[index].cells[1].firstChild.value)!="")
                {
                    if (document.getElementById("hid_OtherDegree").value=="")
                    {
                       document.getElementById("hid_OtherDegree").value=tbl.rows[index].cells[0].innerText+"|"+tbl.rows[index].cells[1].firstChild.value+"|"+tbl.rows[index].cells[2].firstChild.value+"|"+tbl.rows[index].cells[3].firstChild.value+"|"+tbl.rows[index].cells[4].firstChild.value+"|"+tbl.rows[index].cells[5].firstChild.value;
                    }
                    else
                    {
                        document.getElementById("hid_OtherDegree").value+="~"+tbl.rows[index].cells[0].innerText+"|"+tbl.rows[index].cells[1].firstChild.value+"|"+tbl.rows[index].cells[2].firstChild.value+"|"+tbl.rows[index].cells[3].firstChild.value+"|"+tbl.rows[index].cells[4].firstChild.value+"|"+tbl.rows[index].cells[5].firstChild.value;
                    }
                }
            }
        }
    }
    
    function addTechnicalRow()
    {
        //Insert row in Technical table
        var tbl = document.getElementById('tbl_Technical');
        var lastRow = tbl.rows.length;
        var iteration = parseInt(lastRow)-1;
        var row = tbl.insertRow(lastRow);
        //Add TechnicalDetailId Column which is invisible
        var cellId = row.insertCell(0);
        cellId.id="TechnicalId"+iteration;
        cellId.innerText = "0";
        cellId.style.display="none";
        //Add Technical Skill Column
        var cellSoftware = row.insertCell(1);
        var elSoftware = document.createElement('input');
        elSoftware.type = 'text';
        elSoftware.name = 'txt_TechSoftware' + iteration;
        elSoftware.id = 'txt_TechSoftware' + iteration;
        elSoftware.size=20;
        elSoftware.className = 't1';
        cellSoftware.appendChild(elSoftware);
        //Add Skill Level Column
        var cellSkillLevel = row.insertCell(2);
        var elSkillLevel = document.createElement('select');
        elSkillLevel.name = 'cmb_SkillLevel' + iteration;
        elSkillLevel.id = 'cmb_SkillLevel' + iteration;
        elSkillLevel.style.width="150px";
        elSkillLevel.setAttribute("Style","font-family:Verdana; font-size:11px; font-weight:bold; background-color:#EEF8FD;");
        elSkillLevel.style.setAttribute("background","#EEF8FD");
            var elSkillOption1 =document.createElement('option');
            elSkillOption1.value="Well-Known";
            elSkillOption1.innerText="Well-Known";
            elSkillLevel.appendChild(elSkillOption1);
            
            var elSkillOption2 =document.createElement('option');
            elSkillOption2.value="Known";
            elSkillOption2.innerText="Known";
            elSkillLevel.appendChild(elSkillOption2);
            
            var elSkillOption3 =document.createElement('option');
            elSkillOption3.value="Satisfactory";
            elSkillOption3.innerText="Satisfactory";
            elSkillLevel.appendChild(elSkillOption3);
        cellSkillLevel.appendChild(elSkillLevel);
        
       //Add Technical Delete button Column
        var cellDel = row.insertCell(3);
        var elDel = document.createElement('img');
        elDel.src='images/delete.gif';
        elDel.style.cursor='hand'; 
        elDel.style.width='12px'; 
        elDel.style.height='12px';
        elDel.alt='DeleteTechnicalDetail';
        elDel.name = 'img_DeleteTech' + iteration;
        elDel.id = 'img_DeleteTech' + iteration;
        elDel.onclick = eval(removeTechnicalRow);
        cellDel.appendChild(elDel);
    }
    function removeTechnicalRow()
    {
        //Remove a particular row from Technical table
        var index=0;
        var tbl = document.getElementById('tbl_Technical');
        var row=window.event.srcElement.parentElement.parentElement;
        index=row.rowIndex;
        var cellId = row.cells[0];
        if (cellId.innerText!="" && cellId.innerText!="0")
        {
              if (document.getElementById('hid_DeleteTechnical').value=="")    document.getElementById('hid_DeleteTechnical').value=cellId.innerText;
              else  document.getElementById('hid_DeleteTechnical').value+="|"+cellId.innerText;
        }
        tbl.deleteRow(index);
        if (tbl.rows.length<2) addTechnicalRow();
    }
    function addProjectRow()
    {
        //Insert row in Project table
        var tbl = document.getElementById('tbl_Project');
        var lastRow = tbl.rows.length;
        var iteration = parseInt(lastRow)-1;
        var row = tbl.insertRow(lastRow);
        //Add ProjectDetailId Column which is invisible
        var cellId = row.insertCell(0);
        cellId.id="ProjectId"+iteration;
        cellId.innerText = "0";
        cellId.style.display="none";
        //Add Project Title Column
        var cellTitle = row.insertCell(1);
        var elTitle = document.createElement('input');
        elTitle.type = 'text';
        elTitle.name = 'txt_Title' + iteration;
        elTitle.id = 'txt_Title' + iteration;
        elTitle.className = 't1';
        elTitle.size=20;
        cellTitle.appendChild(elTitle);
        //Add Project Software Column
        var cellSoftware = row.insertCell(2);
        var elSoftware = document.createElement('input');
        elSoftware.type = 'text';
        elSoftware.name = 'txt_prjSoftware' + iteration;
        elSoftware.id = 'txt_prjSoftware' + iteration;
        elSoftware.className = 't1';
        elSoftware.size=20;
        cellSoftware.appendChild(elSoftware);
        //Add Project Description Column
        var cellDescription = row.insertCell(3);
        var elDescription = document.createElement('textarea');
        elDescription.rows = 2;
        elDescription.cols = 20;
        elDescription.name = 'txt_Description' + iteration;
        elDescription.id = 'txt_Description' + iteration;
        elDescription.className = 't1';
        cellDescription.appendChild(elDescription);
        //Add Project Delete button Column
        var cellDel = row.insertCell(4);
        var elDel = document.createElement('img');
        elDel.src='images/delete.gif';
        elDel.style.cursor='hand'; 
        elDel.style.width='12px'; 
        elDel.style.height='12px';
        elDel.alt='DeleteProject';
        elDel.name = 'img_DeleteProject' + iteration;
        elDel.id = 'img_DeleteProject' + iteration;
        elDel.onclick = eval(removeProjectRow);
        cellDel.appendChild(elDel);
    }
    function removeProjectRow()
    {
        //Remove a particular row from Project table
        var index=0;
        var tbl = document.getElementById('tbl_Project');
        var row=window.event.srcElement.parentElement.parentElement;
        index=row.rowIndex;
        var cellId = row.cells[0];
        if (cellId.innerText!="" && cellId.innerText!="0")
        {
              if (document.getElementById('hid_DeleteProject').value=="")    document.getElementById('hid_DeleteProject').value=cellId.innerText;
              else  document.getElementById('hid_DeleteProject').value+="|"+cellId.innerText;
        }
        tbl.deleteRow(index);
        if (tbl.rows.length<2) addProjectRow();
    }
    function techProjectPostback()
    {
        //Write other Technical informations to a hidden control
        document.getElementById("hid_Technical").value="";
        var tbl = document.getElementById('tbl_Technical');
        var lastRow = tbl.rows.length;
        if (parseInt(lastRow)>1==true)
        {
            for (var index=1; index<lastRow; index++)
            {
                if (trim(tbl.rows[index].cells[1].firstChild.value)!="")
                {
                    if (document.getElementById("hid_Technical").value=="")
                    {
                       
                       document.getElementById("hid_Technical").value=tbl.rows[index].cells[0].innerText+"|"+tbl.rows[index].cells[1].firstChild.value+"|"+tbl.rows[index].cells[2].firstChild.options[tbl.rows[index].cells[2].firstChild.selectedIndex].value;
                    }
                    else
                    {
                        document.getElementById("hid_Technical").value+="~"+tbl.rows[index].cells[0].innerText+"|"+tbl.rows[index].cells[1].firstChild.value+"|"+tbl.rows[index].cells[2].firstChild.options[tbl.rows[index].cells[2].firstChild.selectedIndex].value;
                    }
                }
            }
        }
        //Write other Project informations to a hidden control
        document.getElementById("hid_Project").value="";
        var tbl = document.getElementById('tbl_Project');
        var lastRow = tbl.rows.length;
        if (parseInt(lastRow)>1==true)
        {
            for (var index=1; index<lastRow; index++)
            {
                if (trim(tbl.rows[index].cells[1].firstChild.value)!="")
                {
                    if (document.getElementById("hid_Project").value=="")
                    {
                       document.getElementById("hid_Project").value=tbl.rows[index].cells[0].innerText+"|"+tbl.rows[index].cells[1].firstChild.value+"|"+tbl.rows[index].cells[2].firstChild.value+"|"+tbl.rows[index].cells[3].firstChild.value;
                    }
                    else
                    {
                        document.getElementById("hid_Project").value+="~"+tbl.rows[index].cells[0].innerText+"|"+tbl.rows[index].cells[1].firstChild.value+"|"+tbl.rows[index].cells[2].firstChild.value+"|"+tbl.rows[index].cells[3].firstChild.value;
                    }
                }
            }
        }
    }
    
 
    function addExperienceRow()
    {
        //Insert row in Experience table
        var tbl = document.getElementById('tbl_Experience');
        var lastRow = tbl.rows.length;
        var iteration = parseInt(lastRow)-1;
        var row = tbl.insertRow(lastRow);
        //Add ExperienceId Column which is invisible
        var cellId = row.insertCell(0);
        cellId.id="ExperienceId"+iteration;
        cellId.innerText = "0";
        cellId.style.display="none";
        //Add Employer Column
        var cellCompanyName = row.insertCell(1);
        var elCompanyName = document.createElement('input');
        elCompanyName.type = 'text';
        elCompanyName.name = 'txt_CompanyName' + iteration;
        elCompanyName.id = 'txt_CompanyName' + iteration;
        elCompanyName.className = 't1';
        cellCompanyName.appendChild(elCompanyName);
        //Add ExpYears Column
        var cellExpYears = row.insertCell(2);
        var elExpYears = document.createElement('input');
        elExpYears.type = 'text';
        elExpYears.name = 'txt_NoOfYears' + iteration;
        elExpYears.id = 'txt_NoOfYears' + iteration;
        elExpYears.className = 't2';
        elExpYears.setAttribute("maxlength",5);
        elExpYears.onkeypress = function() {return ValidateKey(event.keyCode,this.value);}
        cellExpYears.appendChild(elExpYears);
        //Add Duration Column
        var cellDuration = row.insertCell(3);
        var elDuration = document.createElement('input');
        elDuration.type = 'text';
        elDuration.name = 'txt_Duration' + iteration;
        elDuration.id = 'txt_Duration' + iteration;
        elDuration.className = 't2';
        cellDuration.appendChild(elDuration);
        //Add Position Column
        var cellPosition = row.insertCell(4);
        var elPosition = document.createElement('input');
        elPosition.type = 'text';
        elPosition.name = 'txt_Position' + iteration;
        elPosition.id = 'txt_Position' + iteration;
        elPosition.className = 't1';
        cellPosition.appendChild(elPosition);
        //Add Duties Column
        var cellDuties = row.insertCell(5);
        var elDuties = document.createElement('input');
        elDuties.type = 'text';
        elDuties.name = 'txt_Responsibilities' + iteration;
        elDuties.id = 'txt_Responsibilities' + iteration;
        elDuties.className = 't1';
        cellDuties.appendChild(elDuties);
       //Add Experience Delete button Column
        var cellDel = row.insertCell(6);
        var elDel = document.createElement('img');
        elDel.src='images/delete.gif';
        elDel.style.cursor='hand'; 
        elDel.style.width='12px'; 
        elDel.style.height='12px';
        elDel.alt='Delete Experience';
        elDel.name = 'img_DeleteExperience' + iteration;
        elDel.id = 'img_DeleteExperience' + iteration;
        elDel.onclick = eval(removeExperienceRow);
        cellDel.appendChild(elDel);
    }
    function removeExperienceRow()
    {
        //Remove a particular row from Experience table
        var index=0;
        var tbl = document.getElementById('tbl_Experience');
        var row=window.event.srcElement.parentElement.parentElement;
        index=row.rowIndex;
        var cellId = row.cells[0];
        if (cellId.innerText!="" && cellId.innerText!="0")
        {
              if (document.getElementById('hid_DeleteExperience').value=="")    document.getElementById('hid_DeleteExperience').value=cellId.innerText;
              else  document.getElementById('hid_DeleteExperience').value+="|"+cellId.innerText;
        }
        tbl.deleteRow(index);
        if (tbl.rows.length<2) addExperienceRow();
    }
    function addReferenceRow()
    {
        //Insert row in Reference table
        var tbl = document.getElementById('tbl_Reference');
        var lastRow = tbl.rows.length;
        var iteration = parseInt(lastRow)-1;
        var row = tbl.insertRow(lastRow);
        //Add ReferenceId Column which is invisible
        var cellId = row.insertCell(0);
        cellId.id="ReferenceId"+iteration;
        cellId.innerText = "0";
        cellId.style.display="none";
        //Add Reference Name Column
        var cellRefName = row.insertCell(1);
        var elRefName = document.createElement('input');
        elRefName.type = 'text';
        elRefName.name = 'txt_RefName' + iteration;
        elRefName.id = 'txt_RefName' + iteration;
        elRefName.className = 'tt1';
        cellRefName.appendChild(elRefName);
        //Add RefPhone Column
        var cellRefPhone = row.insertCell(2);
        var elRefPhone = document.createElement('input');
        elRefPhone.type = 'text';
        elRefPhone.name = 'txt_RefPhone' + iteration;
        elRefPhone.id = 'txt_RefPhone' + iteration;
        elRefPhone.className = 'tt1';
        cellRefPhone.appendChild(elRefPhone);
        //Add RefEmail Column
        var cellRefEmail = row.insertCell(3);
        var elRefEmail = document.createElement('input');
        elRefEmail.type = 'text';
        elRefEmail.name = 'txt_RefEmail' + iteration;
        elRefEmail.id = 'txt_RefEmail' + iteration;
        elRefEmail.className = 'tt1';
        cellRefEmail.appendChild(elRefEmail);
        //Add RefAdd1 Column
        var cellRefAdd1 = row.insertCell(4);
        var elRefAdd1 = document.createElement('input');
        elRefAdd1.type = 'text';
        elRefAdd1.name = 'txt_RefAdd1' + iteration;
        elRefAdd1.id = 'txt_RefAdd1' + iteration;
        elRefAdd1.className = 'tt1';
        cellRefAdd1.appendChild(elRefAdd1);
        //Add RefAdd2 Column
        var cellRefAdd2 = row.insertCell(5);
        var elRefAdd2 = document.createElement('input');
        elRefAdd2.type = 'text';
        elRefAdd2.name = 'txt_RefAdd2' + iteration;
        elRefAdd2.id = 'txt_RefAdd2' + iteration;
        elRefAdd2.className = 'tt1';
        cellRefAdd2.appendChild(elRefAdd2);
        //Add Reference Delete button Column
        var cellDel = row.insertCell(6);
        var elDel = document.createElement('img');
        elDel.src='images/delete.gif';
        elDel.style.cursor='hand'; 
        elDel.style.width='12px'; 
        elDel.style.height='12px';
        elDel.alt='Delete Reference';
        elDel.name = 'img_DeleteReference' + iteration;
        elDel.id = 'img_DeleteReference' + iteration;
        elDel.onclick = eval(removeReferenceRow);
        cellDel.appendChild(elDel);
    }
    function removeReferenceRow()
    {
        //Remove a particular row from Reference table
        var index=0;
        var tbl = document.getElementById('tbl_Reference');
        var row=window.event.srcElement.parentElement.parentElement;
        index=row.rowIndex;
        var cellId = row.cells[0];
        if (cellId.innerText!="" && cellId.innerText!="0")
        {
              if (document.getElementById('hid_DeleteReference').value=="")    document.getElementById('hid_DeleteReference').value=cellId.innerText;
              else  document.getElementById('hid_DeleteReference').value+="|"+cellId.innerText;
        }
        tbl.deleteRow(index);
        if (tbl.rows.length<2) addReferenceRow();
    }
    function experienceReferencePostback()
    {
        //Write Experiences to a hidden control
        document.getElementById("hid_Experience").value="";
        var tbl = document.getElementById('tbl_Experience');
        var lastRow = tbl.rows.length;
        if (parseInt(lastRow)>1==true)
        {
            for (var index=1; index<lastRow; index++)
            {
                if (trim(tbl.rows[index].cells[1].firstChild.value)!="")
                {
                    if (document.getElementById("hid_Experience").value=="")
                    {
                       
                       document.getElementById("hid_Experience").value=tbl.rows[index].cells[0].innerText+"|"+tbl.rows[index].cells[1].firstChild.value+"|"+tbl.rows[index].cells[2].firstChild.value+"|"+tbl.rows[index].cells[3].firstChild.value+"|"+tbl.rows[index].cells[4].firstChild.value+"|"+tbl.rows[index].cells[5].firstChild.value;
                    }
                    else
                    {
                        document.getElementById("hid_Experience").value+="~"+tbl.rows[index].cells[0].innerText+"|"+tbl.rows[index].cells[1].firstChild.value+"|"+tbl.rows[index].cells[2].firstChild.value+"|"+tbl.rows[index].cells[3].firstChild.value+"|"+tbl.rows[index].cells[4].firstChild.value+"|"+tbl.rows[index].cells[5].firstChild.value;
                    }
                }
            }
        }
        //Write References to a hidden control
        document.getElementById("hid_Reference").value="";
        var tbl = document.getElementById('tbl_Reference');
        var lastRow = tbl.rows.length;
        if (parseInt(lastRow)>1==true)
        {
            for (var index=1; index<lastRow; index++)
            {
                if (trim(tbl.rows[index].cells[1].firstChild.value)!="")
                {
                    if(!ValidMail(tbl.rows[index].cells[3].firstChild.value))
		            {
			            alert("Enter a valid Email Address")
			            tbl.rows[index].cells[3].firstChild.focus()
			            tbl.rows[index].cells[3].firstChild.select()
			            return false
		            }
                    if (document.getElementById("hid_Reference").value=="")
                    {
                       document.getElementById("hid_Reference").value=tbl.rows[index].cells[0].innerText+"|"+tbl.rows[index].cells[1].firstChild.value+"|"+tbl.rows[index].cells[2].firstChild.value+"|"+tbl.rows[index].cells[3].firstChild.value+"|"+tbl.rows[index].cells[4].firstChild.value+"|"+tbl.rows[index].cells[5].firstChild.value;
                    }
                    else
                    {
                        document.getElementById("hid_Reference").value+="~"+tbl.rows[index].cells[0].innerText+"|"+tbl.rows[index].cells[1].firstChild.value+"|"+tbl.rows[index].cells[2].firstChild.value+"|"+tbl.rows[index].cells[3].firstChild.value+"|"+tbl.rows[index].cells[4].firstChild.value+"|"+tbl.rows[index].cells[5].firstChild.value;
                    }
                }
            }
        }
    }
    
    function resetSearchOptions()
    {
        document.getElementById("lst_TechSkill").selectedIndex=-1;
        document.getElementById("lst_Qualification").selectedIndex=-1;
        document.getElementById("cmb_Experience").selectedIndex=0;
        document.getElementById("cmb_Age").selectedIndex=0;
        document.getElementById("txt_Subject").innerText="";
        if(document.getElementById("sp_Skills")!=null) 
            document.getElementById("sp_Skills").innerText = "0";
        if(document.getElementById("sp_Qualifications")!=null)     
            document.getElementById("sp_Qualifications").innerText = "0";
        if(document.getElementById("sp_Age")!=null)
            document.getElementById("sp_Age").innerText = "0";
        if(document.getElementById("sp_Experiences")!=null)
            document.getElementById("sp_Experiences").innerText = "0";
        if(document.getElementById("sp_Subject")!=null)
            document.getElementById("sp_Subject").innerText = "0";
     
     }
     function resetGridChk()
     {
       if(document.getElementById("grd_SearchResult_ctl03_Chk_Candidate")!=null)
            document.getElementById("grd_SearchResult_ctl03_Chk_Candidate").checked=false;
       if(document.getElementById("grd_SearchResult_ctl04_Chk_Candidate")!=null)
            document.getElementById("grd_SearchResult_ctl04_Chk_Candidate").checked=false;
       if(document.getElementById("grd_SearchResult_ctl05_Chk_Candidate")!=null)
            document.getElementById("grd_SearchResult_ctl05_Chk_Candidate").checked=false;
       if(document.getElementById("grd_SearchResult_ctl06_Chk_Candidate")!=null)
            document.getElementById("grd_SearchResult_ctl06_Chk_Candidate").checked=false;
       if(document.getElementById("grd_SearchResult_ctl07_Chk_Candidate")!=null)
            document.getElementById("grd_SearchResult_ctl07_Chk_Candidate").checked=false; 
     }
    function resetSendMail()
    {
        document.getElementById("txt_YourName").innerText = "";
        document.getElementById("txt_ConcernName").innerText = "";
        document.getElementById("txt_Location").innerText = "";
        document.getElementById("txt_Address").innerText = "";
        document.getElementById("txt_EmailAddress").innerText = "";
        document.getElementById("txt_Phone").innerText = "";
        document.getElementById("txt_Comments").innerText = "";
        document.getElementById("lbl_Error").innerText = "";
    }
    function resetProgram()
    {
        document.getElementById("txt_FirstName").value="";
        document.getElementById("txt_EmailAddress").value="";
        document.getElementById("txt_Address").value="";
        document.getElementById("txt_Comments").value="";
        document.getElementById("txt_LastName").value="";
        document.getElementById("txt_Phone").value="";
        document.getElementById("txt_Location").value="";
        document.getElementById("cmb_EduQualification").selectedIndex=0;
    }
    function resetFranchise()
    {
        document.getElementById("txt_FirstName").value="";
        document.getElementById("txt_EmailAddress").value="";
        document.getElementById("txt_Address").value="";
        document.getElementById("txt_Comments").value="";
        document.getElementById("txt_LastName").value="";
        document.getElementById("txt_Phone").value="";
        document.getElementById("txt_Mobile").value="";
        document.getElementById("txt_Fax").value="";
        document.getElementById("txt_Age").value="";
        document.getElementById("txt_Location").value="";
        document.getElementById("txt_Other").value="";
        document.getElementById("cmb_EduQualification").selectedIndex=0;
        document.getElementById("cmb_title").selectedIndex=0;
        document.getElementById("cmb_Country").selectedIndex=0;
        document.getElementById("cmb_Occupation").selectedIndex=0;
    }
function AllowOnly(Expression)
{
	Expression = Expression.toLowerCase();
	Expression = Replace(Expression, 'a..z', 'abcdefghijklmnopqrstuvwxyz');
	Expression = Replace(Expression, '0..9', '0123456789');
	Expression = Replace(Expression, '|', '');

	var ch = String.fromCharCode(window.event.keyCode);
	ch = ch.toLowerCase();
	Expression = Expression.toLowerCase();
	var a = Expression.indexOf(ch);
	if (a == -1) 
		window.event.keyCode = 0;
}
function Replace(Expression, Find, Replace)
{
	var temp = Expression;
	var a = 0;

	for (var i = 0; i < Expression.length; i++) 
	{
		a = temp.indexOf(Find);
		if (a == -1)
			break
		else
			temp = temp.substring(0, a) + Replace + temp.substring((a + Find.length));
	}

	return temp;
}
 
    function chkUser(levelId)
    {
        if(trim(document.getElementById("txt_Name").value)=="")
        {
            alert("Enter your Name!");
            return false;
        }
        else
        {
//            window.location.href="Read.aspx?LevelId=" + levelId + "&User="+trim(document.getElementById("txt_Name").value);
            window.location="Read.aspx";
            alert(window.location);
        }
    }
    
    function validateTest()
    {
        if(trim(document.getElementById("txt_Name").value)=="")
        {
            alert("Enter your Name!");
            document.getElementById("txt_Name").focus();
            return false;
        }
    }
    
    function showPage(idIndex)
    {
        document.getElementById('tr_Page1').style.display="none";
        document.getElementById('tr_Page2').style.display="none";
        document.getElementById('tr_Page3').style.display="none";
        document.getElementById('tr_Page4').style.display="none";
        document.getElementById('tr_Page5').style.display="none";
        document.getElementById('tr_Page'+idIndex).style.display="inline";
    }
    function showResult()
    {
        document.getElementById('tbl_level').style.display="none";
        document.getElementById('tbl_Result').style.display="inline";
        var totQues=document.getElementById('sp_totalQuestions').innerText;
        var attend=0, sel="", score=0;
        for(var i=1;i<=totQues;i++)
        {
            sel="";
            if(document.getElementById('rdo_'+i+'a').checked==true)
            {
                attend++;
                sel=document.getElementById('rdo_'+i+'a').value;
            }
            else if(document.getElementById('rdo_'+i+'b').checked==true)
            {
                attend++;
                sel=document.getElementById('rdo_'+i+'b').value;
            }
            else if(document.getElementById('rdo_'+i+'c').checked==true)
            {
                attend++;
                sel=document.getElementById('rdo_'+i+'c').value;
            }
            else if(document.getElementById('rdo_'+i+'d').checked==true)
            {
                attend++;
                sel=document.getElementById('rdo_'+i+'d').value;
            }
            if(sel==document.getElementById('sp_'+i).innerText)
                score++;
        }
        document.getElementById('sp_Attended').innerText=attend;
        document.getElementById('sp_Score').innerText=score;
    }