﻿function FillYearDDL(DDL,SelectedValue)
 {    
 // Fill years in dropdownlist 
 var currentDate=new Date();
 var currentYear=currentDate.getFullYear();
 var fromYear=parseInt(currentYear)-70;
 var j=1;
 document.getElementById(DDL).options[0] = new Option("-","-");
 for(var i=fromYear; i<=currentYear; i++)
  {    
    document.getElementById(DDL).options[j] = new Option(i,i);
    j++;    
   }
   document.getElementById(DDL).options[document.getElementById(DDL).selectedIndex].text=SelectedValue;
   document.getElementById(DDL).options[document.getElementById(DDL).selectedIndex].value=SelectedValue;
 }
 
 function FillMonDDL(DDL,SelectedValue)
 {
  // Fill months in dropdownlist      
 document.getElementById(DDL).options[0] = new Option("-","-");
 document.getElementById(DDL).options[1] = new Option("Jan","Jan");
 document.getElementById(DDL).options[2] = new Option("Feb","Feb");
 document.getElementById(DDL).options[3] = new Option("Mar","Mar");
 document.getElementById(DDL).options[4] = new Option("Apr","Apr");
 document.getElementById(DDL).options[5] = new Option("May","May");
 document.getElementById(DDL).options[6] = new Option("Jun","Jun");
 document.getElementById(DDL).options[7] = new Option("Jul","Jul"); 
 document.getElementById(DDL).options[8] = new Option("Aug","Aug");
 document.getElementById(DDL).options[9] = new Option("Sep","Sep");
 document.getElementById(DDL).options[10] = new Option("Oct","Oct");
 document.getElementById(DDL).options[11] = new Option("Nov","Nov");
 document.getElementById(DDL).options[12] = new Option("Dec","Dec");
 document.getElementById(DDL).options[document.getElementById(DDL).selectedIndex].text=SelectedValue;
 document.getElementById(DDL).options[document.getElementById(DDL).selectedIndex].value=SelectedValue;
 }
 
 function FillDateDDL(DDL,SelectedValue)
 {
 var i;
 document.getElementById(DDL).options[0] = new Option("-","-"); 
 for(i=1;i<=31;i++)
 { 
 if(i<10) 
 document.getElementById(DDL).options[i]=new Option("0"+i,"0"+i); 
 else
 document.getElementById(DDL).options[i]=new Option(i,i); 
 }  
 document.getElementById(DDL).options[document.getElementById(DDL).selectedIndex].text=SelectedValue;
 document.getElementById(DDL).options[document.getElementById(DDL).selectedIndex].value=SelectedValue; 
 }
 
 
function funAddEduFields()
{    
    var Edu_ID=document.getElementById("ctl00_MainContentPlaceHolder_HF_Edu_ID1").value;
    if(parseInt(Edu_ID.length)>2)             
    {
       Edu_ID=Edu_ID.substring(parseInt(Edu_ID.length)-2,Edu_ID.length);                      
       Edu_ID=parseInt(Edu_ID);
    }    
    var RowCnt=document.getElementById("ctl00_MainContentPlaceHolder_HF_Education_RowCnt").value;
    //parseInt(document.aspnetForm.ctl00$MainContentPlaceHolder$HF_Education_RowCnt.value);
    var newrow1=document.getElementById("tablEducational").insertRow(RowCnt);    
    var newcell1=newrow1.insertCell(0);        
    var tab1=document.createElement('table');    
    tab1.cellPadding="0";
    tab1.cellSpacing="0";
    tab1.border="0";
    
    tab1.className="tbleditWork"; 
    var row0=tab1.insertRow(0);
    row0.className="padleft";
        
    var row1=tab1.insertRow(1);
    row1.className="padtop";
    var row2=tab1.insertRow(2);    
    row2.className="padleft";
    var row3=tab1.insertRow(3);
    row3.className="padtop";
    var row4=tab1.insertRow(4);   
    row4.className="padleft";
    var row5=tab1.insertRow(5);
    row5.className="padtop";
    var row6=tab1.insertRow(6);    
    row6.className="padleft";
    var row7=tab1.insertRow(7);
    row7.className="padtop";
    
    
    var cell0=row0.insertCell(0);
    cell0.colSpan="3";
    cell0.innerHTML="Add another university/college";
    cell0.className="subheading4";
    
    var cell1=row1.insertCell(0);
    var cell2=row1.insertCell(1);
    var cell2a=row1.insertCell(2);
    
    var cell3=row2.insertCell(0);
    var cell4=row2.insertCell(1);
    var cell4a=row2.insertCell(2);
    
    var cell5=row3.insertCell(0);
    var cell6=row3.insertCell(1);
    cell6.colSpan="2";
    
    var cell7=row4.insertCell(0);
    var cell8=row4.insertCell(1);
    cell8.colSpan="2";
    
    
    var cell9=row5.insertCell(0);
    cell9.colSpan="3";
    //var cell10=row5.insertCell(1);
    //cell10.colSpan="2";
    
    var cell11=row6.insertCell(0);
    cell11.colSpan="3";
    //var cell12=row6.insertCell(1);    
    //cell12.colSpan="2";
    
    var cell13=row7.insertCell(0);            
    cell13.colSpan="3";
    
        
    //cell11.innerHTML="<div style='background:url(images/dot_line.jpg) repeat-x; height:1px; width:100%;'></div>"    
    cell1.innerHTML="University/College";
    cell1.className ="bold";
    
    cell2.innerHTML="From";
    cell2.className ="bold";
    
    cell2a.innerHTML="Until";
    cell2a.className ="bold";       
    
    cell3.innerHTML="<input id='txtUniversity"+(parseInt(Edu_ID)+1)+"' value='' name='txtUniversity"+(parseInt(Edu_ID)+1)+"' class='txtboxedu'>";
        
    cell4.innerHTML="<select id='ddlEduFromMM"+(parseInt(Edu_ID)+1)+"' name='ddlEduFromMM"+(parseInt(Edu_ID)+1)+"' ><option></option></select>&nbsp;<select id='ddlEduFromYY"+(parseInt(Edu_ID)+1)+"' name='ddlEduFromYY"+(parseInt(Edu_ID)+1)+"'><option></option></select>";    
    cell4a.innerHTML="<select id='ddlEduToMM"+(parseInt(Edu_ID)+1)+"' name='ddlEduToMM"+(parseInt(Edu_ID)+1)+"'><option></option></select>&nbsp;<select id='ddlEduToYY"+(parseInt(Edu_ID)+1)+"' name='ddlEduToYY"+(parseInt(Edu_ID)+1)+"' ><option></option></select>";
    
    cell5.innerHTML="Field of study";
    cell5.className ="bold";
    
    
    
    cell6.innerHTML="Degree";
    cell6.className ="bold";
    
    cell7.innerHTML="<input id='txtstudy"+(parseInt(Edu_ID)+1)+"' name='txtstudy"+(parseInt(Edu_ID)+1)+"' class='txtboxedu' >";
       
    cell8.innerHTML="<input id='txtdegree"+(parseInt(Edu_ID)+1)+"' name='txtdegree"+(parseInt(Edu_ID)+1)+"' class='txtdegree' >";    
    
    cell9.innerHTML="Specialized subjects";   
    cell9.className ="bold";
    
    cell11.innerHTML="<input id='txtspecialized"+(parseInt(Edu_ID)+1)+"' name='txtspecialized"+(parseInt(Edu_ID)+1)+"' class='txtspecial'>";
    
    cell13.innerHTML="<img src='Images/img_save.jpg' class='cursor' id='imgEduSave"+(parseInt(Edu_ID)+1)+"' name='imgEduSave"+(parseInt(Edu_ID)+1)+"' onclick=SubmitEduValues(this,'','',this.parentNode.parentNode.parentNode.rowIndex) />&nbsp;&nbsp;<img src='Images/img_cancel.jpg' class='cursor' id='imgEduCancel"+(parseInt(Edu_ID)+1)+"' name='imgEduCancel"+(parseInt(Edu_ID)+1)+"' onClick=fndel1(this.parentNode.parentNode.parentNode.rowIndex,'tablEducational') />";
    cell13.align="center";
        
    newcell1.appendChild(tab1);
    document.getElementById("ctl00_MainContentPlaceHolder_HF_Education_RowCnt").value=parseInt(document.getElementById("ctl00_MainContentPlaceHolder_HF_Education_RowCnt").value)+1
    //document.aspnetForm.ctl00$MainContentPlaceHolder$HF_Education_RowCnt.value=parseInt(document.aspnetForm.ctl00$MainContentPlaceHolder$HF_Education_RowCnt.value)+1;
    document.getElementById("ctl00_MainContentPlaceHolder_HF_Edu_ID").value=parseInt(Edu_ID)+1;
    //document.aspnetForm.ctl00$MainContentPlaceHolder$HF_Edu_ID.value=parseInt(Edu_ID)+1;
    var FromYY="ddlEduFromYY"+(parseInt(Edu_ID)+1);
    var ToYY="ddlEduToYY"+(parseInt(Edu_ID)+1);
    var FromMM="ddlEduFromMM"+(parseInt(Edu_ID)+1);
    var ToMM="ddlEduToMM"+(parseInt(Edu_ID)+1);    
    FillMonDDL(FromMM,"-");
    FillMonDDL(ToMM,"-");
    FillYearDDL(FromYY,"-");
    FillYearDDL(ToYY,"-");

}

function funAddFields(Companyname,Position,Website,Services,FromMon,FromYr,ToMon,ToYr)
{
  //  Add rows for workhistory
    var WorkHistory= document.getElementById("ctl00_MainContentPlaceHolder_HiddenFieldWorkHistory").value;//document.aspnetForm.ctl00$MainContentPlaceHolder$HiddenFieldWorkHistory.value;  
    if(parseInt(WorkHistory.length)>2)
    {
       WorkHistory=WorkHistory.substring(parseInt(WorkHistory.length)-2,WorkHistory.length);
       WorkHistory=parseInt(WorkHistory);
    }
    //var RowCnt=parseInt(document.aspnetForm.ctl00$MainContentPlaceHolder$HiddenFieldRowCnt.value);    
    var RowCnt= parseInt(document.getElementById("ctl00_MainContentPlaceHolder_HiddenFieldRowCnt").value);        
    var newrow1=document.getElementById("tblWorkHistory").insertRow(RowCnt);    
    var newcell1=newrow1.insertCell(0);    
    var tab1=document.createElement("table");
    tab1.className="tbleditWork";
    
    var row0=tab1.insertRow(0);
    var row1=tab1.insertRow(1);
    var row2=tab1.insertRow(2);
    var row3=tab1.insertRow(3);
    var row4=tab1.insertRow(4);
    var row5=tab1.insertRow(5);
    var row6=tab1.insertRow(6);    
        
    
    var cell0=row0.insertCell(0);
    cell0.colSpan="2";
    cell0.innerHTML="Add another job"; 
    cell0.className="subheading4";
    var cell1=row1.insertCell(0);
    var cell2=row1.insertCell(1);
    var cell3=row2.insertCell(0);
    var cell4=row2.insertCell(1);
    var cell5=row3.insertCell(0);
    var cell6=row3.insertCell(1);
    var cell7=row4.insertCell(0);
    var cell8=row4.insertCell(1);
    var cell9=row5.insertCell(0);
    var cell10=row5.insertCell(1);    
    var cell11=row6.insertCell(0);            
    cell11.colSpan="2";
    
    
    //cell11.innerHTML="<div style='background:url(images/dot_line.jpg) repeat-x; height:1px; width:100%;'></div>"    
    cell1.innerHTML="Company Name:";
    cell1.className ="subheading2";
    cell2.innerHTML="<input id='txtcompanyname"+(parseInt(WorkHistory)+1)+"' value='"+Companyname+"' name='txtcompanyname"+(parseInt(WorkHistory)+1)+"' class='txtboxWorkHis' >";
    cell2.className ="profiles";
    cell3.innerHTML="Position:";
    cell3.className ="subheading2";
    cell4.innerHTML="<input id='txtPosition"+(parseInt(WorkHistory)+1)+"' value='"+Position+"' name='txtPosition"+(parseInt(WorkHistory)+1)+"' class='txtboxWorkHis'>";
    cell4.className ="profiles";
    cell5.innerHTML="Website:";
    cell5.className ="subheading2";
    cell6.innerHTML="<input id='txtWebsite"+(parseInt(WorkHistory)+1)+"' value='"+Website+"' name='txtWebsite"+(parseInt(WorkHistory)+1)+"' class='txtboxWorkHis' >";
    cell6.className ="profiles"; 
    cell7.innerHTML="Period:";
    cell7.className ="subheading2";
    cell8.innerHTML="From: <select id='ddlFromMM"+(parseInt(WorkHistory)+1)+"' name='ddlFromMM"+(parseInt(WorkHistory)+1)+"' ><option></option></select><select id='ddlFromYY"+(parseInt(WorkHistory)+1)+"' name='ddlFromYY"+(parseInt(WorkHistory)+1)+"'><option></option></select> To:<select id='ddlToMM"+(parseInt(WorkHistory)+1)+"' name='ddlToMM"+(parseInt(WorkHistory)+1)+"'><option></option></select><select id='ddlToYY"+(parseInt(WorkHistory)+1)+"' name='ddlToYY"+(parseInt(WorkHistory)+1)+"' ><option></option></select>";
    cell8.className ="profiles";
    cell9.innerHTML="Services:";
    cell9.className ="subheading1";
    cell10.innerHTML="<input id='txtServices"+(parseInt(WorkHistory)+1)+"' value='"+Services+"' name='txtServices"+(parseInt(WorkHistory)+1)+"' class='txtservices'>";
    cell10.className ="profiles";
    cell11.colSpan="2";
    cell11.innerHTML="<img src='Images/img_save.jpg' class='cursor' id='imgSave"+(parseInt(WorkHistory)+1)+"' name='imgSave"+(parseInt(WorkHistory)+1)+"' onclick=SubmitValues(this,'','',this.parentNode.parentNode.parentNode.rowIndex) />&nbsp;&nbsp;<img src='Images/img_cancel.jpg' id='imgCancel"+(parseInt(WorkHistory)+1)+"' class='cursor' name='imgCancel"+(parseInt(WorkHistory)+1)+"' onClick=fndel1(this.parentNode.parentNode.parentNode.rowIndex,'tblWorkHistory') />";
    cell11.align="center";
    newcell1.appendChild(tab1);
    document.getElementById("ctl00_MainContentPlaceHolder_HiddenFieldRowCnt").value=parseInt(document.getElementById("ctl00_MainContentPlaceHolder_HiddenFieldRowCnt").value)+1;
    //document.aspnetForm.ctl00$MainContentPlaceHolder$HiddenFieldRowCnt.value=parseInt(document.aspnetForm.ctl00$MainContentPlaceHolder$HiddenFieldRowCnt.value)+1;
    document.getElementById("ctl00_MainContentPlaceHolder_HiddenFieldWorkHistory").value=parseInt(WorkHistory)+1;
    //document.aspnetForm.ctl00$MainContentPlaceHolder$HiddenFieldWorkHistory.value=parseInt(WorkHistory)+1;
        
    var FromYY="ddlFromYY"+(parseInt(WorkHistory)+1);
    var ToYY="ddlToYY"+(parseInt(WorkHistory)+1);
    var FromMM="ddlFromMM"+(parseInt(WorkHistory)+1);
    var ToMM="ddlToMM"+(parseInt(WorkHistory)+1);
    FillMonDDL(FromMM,FromMon);
    FillMonDDL(ToMM,ToMon);
    FillYearDDL(FromYY,FromYr);
    FillYearDDL(ToYY,ToYr);
}

function funEditFields(Companyname,Position,Website,Services,FromMon,FromYr,ToMon,ToYr,WorkHis_id)
{
  //  Add rows for workhistory  
    var RowCnt=parseInt(document.getElementById("ctl00_MainContentPlaceHolder_HiddenFieldRowCnt1").value);//parseInt(document.aspnetForm.ctl00$MainContentPlaceHolder$HiddenFieldRowCnt1.value);
    var newrow=document.getElementById("tblViewWorkHistory").insertRow(RowCnt);
    var newcell=newrow.insertCell(0);
    var elementdiv=document.createElement('div');
    var hrdiv=document.createElement('div');
    hrdiv.innerHTML="<hr />";
    hrdiv.className="clrall";
    elementdiv.id="divview"+(parseInt(RowCnt)+1);
    var elementdivinnerleft=document.createElement('div');
    elementdivinnerleft.className="divWHinnerleft";
    var elementtbl=document.createElement('table');
    var tblrow0=elementtbl.insertRow(0);
    var tblrow1=elementtbl.insertRow(1);
    var tblrow2=elementtbl.insertRow(2);
    var tblrow3=elementtbl.insertRow(3);
    var tblrow4=elementtbl.insertRow(4);
    
    var tblcell1=tblrow0.insertCell(0);
    var tblcell2=tblrow1.insertCell(0);
    var tblcell3=tblrow2.insertCell(0);
    var tblcell4=tblrow3.insertCell(0);
    var tblcell5=tblrow4.insertCell(0);
    
    var elementcell1=document.createElement('div');
    elementcell1.id="cellPosition"+(parseInt(RowCnt)+1);
    elementcell1.innerHTML="<b>"+Position+"</b>"; 
    tblcell1.appendChild(elementcell1);
    
    
    var elementcell2=document.createElement('div');
    elementcell2.id="cellPeriod"+(parseInt(RowCnt)+1);    
    if(FromMon=="-" && ToMon=="-")
    {
        elementcell2.innerHTML="";
    }
    else
    {
        elementcell2.innerHTML="<b>"+FromMon+"/"+FromYr+" - "+ToMon+"/"+ToYr+"</b>";
    }
    
    tblcell2.appendChild(elementcell2);
    
    
    var elementcell3=document.createElement('div');
    elementcell3.id="cellCompany"+(parseInt(RowCnt)+1);
    elementcell3.innerHTML=Companyname;
    elementcell3.className="workhistory";    
    tblcell3.appendChild(elementcell3);
    
    var elementcell4=document.createElement('div');
    elementcell4.id="cellWebsite"+(parseInt(RowCnt)+1);
    elementcell4.innerHTML=Website;
    elementcell4.className="workhistory";    
    tblcell4.appendChild(elementcell4);
    
    var elementcell5=document.createElement('div');
    elementcell5.id="cellServices"+(parseInt(RowCnt)+1);
    elementcell5.innerHTML=Services;
    elementcell5.className="workhistory";
    tblcell5.appendChild(elementcell5);
    
    var elementdivinnerright=document.createElement('div');
    elementdivinnerright.innerHTML="<img src='Images/Edit-small.jpg' class='cursor' id='imgedit"+(parseInt(RowCnt)+1)+"' name='imgedit"+(parseInt(RowCnt)+1)+"' onclick=Canceledit('divview"+(parseInt(RowCnt)+1)+"','view') />";
    elementdivinnerright.className="divWHinnerright";    
    elementdivinnerleft.appendChild(elementtbl);
    elementdiv.appendChild(elementdivinnerright);
    elementdiv.appendChild(elementdivinnerleft);
    elementdiv.appendChild(hrdiv);    
    newcell.appendChild(elementdiv);
        
    var elementdiv1=document.createElement('div');
    elementdiv1.id="divedit"+(parseInt(RowCnt)+1);    
    elementdiv1.className="divtxthide";
    var tab1=document.createElement('table');       
    tab1.className="tbleditWork";           
    var row0=tab1.insertRow(0);
    var row1=tab1.insertRow(1);
    var row2=tab1.insertRow(2);
    var row3=tab1.insertRow(3);
    var row4=tab1.insertRow(4);
    var row5=tab1.insertRow(5);
    var row6=tab1.insertRow(6); 
    var cell0=row0.insertCell(0);           
    cell0.colSpan="2";
    cell0.innerHTML="Edit job"; 
    cell0.className="subheading4";
    var cell1=row1.insertCell(0);
    var cell2=row1.insertCell(1);
    var cell3=row2.insertCell(0);
    var cell4=row2.insertCell(1);
    var cell5=row3.insertCell(0);
    var cell6=row3.insertCell(1);
    var cell7=row4.insertCell(0);
    var cell8=row4.insertCell(1);
    var cell9=row5.insertCell(0);
    var cell10=row5.insertCell(1);
    var cell11=row6.insertCell(0);
    cell11.colSpan="2";        
    //cell11.innerHTML="<div style='background:url(images/dot_line.jpg) repeat-x; height:1px; width:100%;'></div>"    
    cell1.innerHTML="Company Name:";
    cell1.className ="subheading2";
    cell2.innerHTML="<input id='txteditcompanyname"+(parseInt(RowCnt)+1)+"' value='"+Companyname+"' name='txteditcompanyname"+(parseInt(RowCnt)+1)+"' class='txtboxWorkHis' >";
    cell2.className ="profiles";
    cell3.innerHTML="Position:";
    cell3.className ="subheading2";    
    cell4.innerHTML="<input id='txteditPosition"+(parseInt(RowCnt)+1)+"' value='"+Position+"' name='txteditPosition"+(parseInt(RowCnt)+1)+"' class='txtboxWorkHis'>";
    cell4.className ="profiles";    
    cell5.innerHTML="Website:";    
    cell5.className ="subheading2";
    cell6.innerHTML="<input id='txteditWebsite"+(parseInt(RowCnt)+1)+"' value='"+Website+"' name='txteditWebsite"+(parseInt(RowCnt)+1)+"' class='txtboxWorkHis' >";
    cell6.className ="profiles";    
    
    cell7.innerHTML="Period:";
    cell7.className ="subheading2";    
    cell8.innerHTML="From: <select id='ddleditFromMM"+(parseInt(RowCnt)+1)+"' name='ddleditFromMM"+(parseInt(RowCnt)+1)+"' ><option></option></select><select id='ddleditFromYY"+(parseInt(RowCnt)+1)+"' name='ddleditFromYY"+(parseInt(RowCnt)+1)+"'><option></option></select> To:<select id='ddleditToMM"+(parseInt(RowCnt)+1)+"' name='ddleditToMM"+(parseInt(RowCnt)+1)+"'><option></option></select><select id='ddleditToYY"+(parseInt(RowCnt)+1)+"' name='ddleditToYY"+(parseInt(RowCnt)+1)+"' ><option></option></select>";
    cell8.className ="profiles";
    cell9.innerHTML="Services:";        
    cell9.className ="subheading1";    
    cell10.innerHTML="<input id='txteditServices"+(parseInt(RowCnt)+1)+"' value='"+Services+"' name='txteditServices"+(parseInt(RowCnt)+1)+"' class='txtservices'>";
    cell10.className ="profiles";
    cell11.colSpan="2";
    cell11.innerHTML="<img src='Images/img_update.jpg' class='cursor' id='imgeditSave"+(parseInt(RowCnt)+1)+"' name='imgeditSave"+(parseInt(RowCnt)+1)+"' onclick=SubmitValues(this,"+parseInt(WorkHis_id)+",'divedit"+(parseInt(RowCnt)+1)+"','') />&nbsp;&nbsp;<img src='Images/img_cancel.jpg' class='cursor' id='imgeditCancel"+(parseInt(RowCnt)+1)+"' name='imgeditCancel"+(parseInt(RowCnt)+1)+"' onClick=Canceledit('divedit"+(parseInt(RowCnt)+1)+"','edit') />&nbsp;&nbsp;<img src='Images/btn_delete_sml.jpg' class='cursor' id='imgeditDelete"+(parseInt(RowCnt)+1)+"' name='imgeditDelete"+(parseInt(RowCnt)+1)+"' onclick=DelRecord("+parseInt(WorkHis_id)+",'WorkHistory','divedit"+(parseInt(RowCnt)+1)+"') />";     
    cell11.align="center";
    elementdiv1.appendChild(tab1);    
    newcell.appendChild(elementdiv1);
    //document.aspnetForm.ctl00$MainContentPlaceHolder$HiddenFieldRowCnt1.value=parseInt(document.aspnetForm.ctl00$MainContentPlaceHolder$HiddenFieldRowCnt1.value)+1; 
    document.getElementById("ctl00_MainContentPlaceHolder_HiddenFieldRowCnt1").value=parseInt(document.getElementById("ctl00_MainContentPlaceHolder_HiddenFieldRowCnt1"))+1;
    var FromYY="ddleditFromYY"+(parseInt(RowCnt)+1);
    var ToYY="ddleditToYY"+(parseInt(RowCnt)+1);
    var FromMM="ddleditFromMM"+(parseInt(RowCnt)+1);
    var ToMM="ddleditToMM"+(parseInt(RowCnt)+1); 
    FillMonDDL(FromMM,FromMon);
    FillMonDDL(ToMM,ToMon);
    FillYearDDL(FromYY,FromYr);
    FillYearDDL(ToYY,ToYr);    
    //return true;
}


function funEditEduFields(university,study,degree,special,FromMon,FromYr,ToMon,ToYr,university_id)
{
    var RowCnt=document.getElementById("ctl00_MainContentPlaceHolder_HF_Edu_ID1").value;//parseInt(document.aspnetForm.ctl00$MainContentPlaceHolder$HF_Edu_ID1.value);
    var newrow=document.getElementById("tblViewEducation").insertRow(RowCnt);
    var newcell=newrow.insertCell(0);
    var elementdiv=document.createElement('div');
    elementdiv.id="diveduview"+(parseInt(RowCnt)+1);
    var elementdivinnerleft=document.createElement('div');
    elementdivinnerleft.className="divWHinnerleft";
    var elementtbl=document.createElement('table');
    elementtbl.width="100%";
    var tblrow0=elementtbl.insertRow(0);    
    var tblrow1=elementtbl.insertRow(1);
    var tblrow2=elementtbl.insertRow(2);   
    
    var tblcell1=tblrow0.insertCell(0);    
    var tblcell2=tblrow1.insertCell(0);    
    var tblcell3=tblrow2.insertCell(0);     
    
    var elementcell1=document.createElement('div');
    elementcell1.id="cellUniversity"+(parseInt(RowCnt)+1);
    elementcell1.innerHTML="<b>"+university+"</b>";
    if(FromMon!="")
    {
        elementcell1.innerHTML=elementcell1.innerHTML+" , "+FromMon +" "+FromYr; 
    }
    if(ToMon!="")
    {
        elementcell1.innerHTML=elementcell1.innerHTML+" - "+ToMon +" "+ToYr; 
    } 
    tblcell1.appendChild(elementcell1);
    
    var elementcell2=document.createElement('div');
    elementcell2.id="cellStudy"+(parseInt(RowCnt)+1);    
    if(study!="" && degree!="")
    {
        elementcell2.innerHTML=study+" , "+degree;
    }
    else
    {
        elementcell2.innerHTML=study;
        elementcell2.innerHTML=elementcell2.innerHTML+degree;
    }    
    tblcell2.appendChild(elementcell2);    
    
    var elementcell3=document.createElement('div');
    elementcell3.id="cellSpecial"+(parseInt(RowCnt)+1);
    elementcell3.innerHTML=special;    
    tblcell3.appendChild(elementcell3);            
    
    var elementdivinnerright=document.createElement('div');
    elementdivinnerright.innerHTML="<img src='Images/Edit-small.jpg' class='cursor' id='imgeduedit"+(parseInt(RowCnt)+1)+"' name='imgeduedit"+(parseInt(RowCnt)+1)+"' onclick=Canceleduedit('diveduview"+(parseInt(RowCnt)+1)+"','view') />";
    elementdivinnerright.className="divWHinnerright";    
    elementdivinnerleft.appendChild(elementtbl);
    elementdiv.appendChild(elementdivinnerright);
    elementdiv.appendChild(elementdivinnerleft);      
    newcell.appendChild(elementdiv); 
    
    var elementdiv1=document.createElement('div');
    elementdiv1.id="diveduedit"+(parseInt(RowCnt)+1);    
    elementdiv1.className="divtxthide";
    var tab1=document.createElement('table');
    tab1.cellPadding="0";
    tab1.cellSpacing="0";
    tab1.className="tbleditWork";            
    var row0=tab1.insertRow(0);
    row0.className="padleft";
        
    var row1=tab1.insertRow(1);
    row1.className="padtop";
    var row2=tab1.insertRow(2);    
    row2.className="padleft";
    var row3=tab1.insertRow(3);
    row3.className="padtop";
    var row4=tab1.insertRow(4);   
    row4.className="padleft";
    var row5=tab1.insertRow(5);
    row5.className="padtop";
    var row6=tab1.insertRow(6);    
    row6.className="padleft";
    var row7=tab1.insertRow(7);
    row7.className="padtop";
    
    
    var cell0=row0.insertCell(0);
    cell0.colSpan="3";
    cell0.innerHTML="Edit university/college";
    cell0.className="subheading4";
    
    var cell1=row1.insertCell(0);
    var cell2=row1.insertCell(1);
    var cell2a=row1.insertCell(2);
    
    var cell3=row2.insertCell(0);
    var cell4=row2.insertCell(1);
    var cell4a=row2.insertCell(2);
    
    var cell5=row3.insertCell(0);
    var cell6=row3.insertCell(1);
    cell6.colSpan="2";
    
    var cell7=row4.insertCell(0);
    var cell8=row4.insertCell(1);
    cell8.colSpan="2";
    
    
    var cell9=row5.insertCell(0);
     cell9.colSpan="3";
    //var cell10=row5.insertCell(1);
    //cell10.colSpan="2";
    
    var cell11=row6.insertCell(0);
    //var cell12=row6.insertCell(1);    
    //cell12.colSpan="2";
    cell11.colSpan="3";
    
    var cell13=row7.insertCell(0); 
    cell13.colSpan="3";
    
        
    //cell11.innerHTML="<div style='background:url(images/dot_line.jpg) repeat-x; height:1px; width:100%;'></div>"    
    cell1.innerHTML="University/College";
    cell1.className ="bold";
    
    cell2.innerHTML="From";
    cell2.className ="bold";
    
    cell2a.innerHTML="Until";
    cell2a.className ="bold";       
    
    cell3.innerHTML="<input id='txteditUniversity"+(parseInt(RowCnt)+1)+"' value='"+university+"' name='txteditUniversity"+(parseInt(RowCnt)+1)+"' class='txtboxedu'>";
        
    cell4.innerHTML="<select id='ddleditEduFromMM"+(parseInt(RowCnt)+1)+"' name='ddleditEduFromMM"+(parseInt(RowCnt)+1)+"' ><option></option></select>&nbsp;<select id='ddleditEduFromYY"+(parseInt(RowCnt)+1)+"' name='ddleditEduFromYY"+(parseInt(RowCnt)+1)+"'><option></option></select>";    
    cell4a.innerHTML="<select id='ddleditEduToMM"+(parseInt(RowCnt)+1)+"' name='ddleditEduToMM"+(parseInt(RowCnt)+1)+"'><option></option></select>&nbsp;<select id='ddleditEduToYY"+(parseInt(RowCnt)+1)+"' name='ddleditEduToYY"+(parseInt(RowCnt)+1)+"' ><option></option></select>";
    
    cell5.innerHTML="Field of study";
    cell5.className ="bold";
    
    cell6.innerHTML="Degree";
    cell6.className ="bold";
    
    cell7.innerHTML="<input id='txteditstudy"+(parseInt(RowCnt)+1)+"' name='txteditstudy"+(parseInt(RowCnt)+1)+"' value='"+study+"' class='txtboxedu' >";
       
    cell8.innerHTML="<input id='txteditdegree"+(parseInt(RowCnt)+1)+"' name='txteditdegree"+(parseInt(RowCnt)+1)+"' value='"+degree+"' class='txtdegree' >"; 
    
    cell9.innerHTML="Specialized subjects";   
    cell9.className ="bold";    
    
    cell11.innerHTML="<input id='txteditspecialized"+(parseInt(RowCnt)+1)+"' name='txteditspecialized"+(parseInt(RowCnt)+1)+"' value='"+special+"' class='txtspecial'>";    
    //cell13.innerHTML="<img src='Images/img_update.jpg' class='cursor' id='imgeditEduSave"+(parseInt(RowCnt)+1)+"' name='imgeditEduSave"+(parseInt(RowCnt)+1)+"' onclick=SubmitEduValues(this,"+university_id+",'diveduedit"+(parseInt(RowCnt)+1)+"','') />&nbsp;&nbsp;<img src='Images/img_cancel.jpg' class='cursor' id='imgeditEduCancel"+(parseInt(RowCnt)+1)+"' name='imgeditEduCancel"+(parseInt(RowCnt)+1)+"' onclick=Canceleduedit('diveduedit"+(parseInt(RowCnt)+1)+"','edit') /><span class='gray' onclick=DelRecord("+university_id+",'Edu','diveduedit"+(parseInt(RowCnt)+1)+"')>Delete</span>";
    cell13.innerHTML="<img src='Images/img_update.jpg' class='cursor' id='imgeditEduSave"+(parseInt(RowCnt)+1)+"' name='imgeditEduSave"+(parseInt(RowCnt)+1)+"' onclick=SubmitEduValues(this,"+parseInt(university_id)+",'diveduedit"+(parseInt(RowCnt)+1)+"','') />&nbsp;&nbsp;<img src='Images/img_cancel.jpg' class='cursor' id='imgeditEduCancel"+(parseInt(RowCnt)+1)+"' name='imgeditEduCancel"+(parseInt(RowCnt)+1)+"' onclick=Canceleduedit('diveduedit"+(parseInt(RowCnt)+1)+"','edit') />&nbsp;&nbsp;<img src='Images/btn_delete_sml.jpg' class='cursor' id='imgeditDelete"+(parseInt(RowCnt)+1)+"' name='imgeditDelete"+(parseInt(RowCnt)+1)+"' onclick=DelRecord("+parseInt(university_id)+",'Edu','diveduedit"+(parseInt(RowCnt)+1)+"') />";
    cell13.align="center";
    elementdiv1.appendChild(tab1);
    newcell.appendChild(elementdiv1);
    document.getElementById("ctl00_MainContentPlaceHolder_HF_Edu_ID1").value=parseInt(RowCnt)+1;    
    //document.aspnetForm.ctl00$MainContentPlaceHolder$HF_Edu_ID1.value=parseInt(RowCnt)+1;
    var FromYY="ddleditEduFromYY"+(parseInt(RowCnt)+1);
    var ToYY="ddleditEduToYY"+(parseInt(RowCnt)+1);
    var FromMM="ddleditEduFromMM"+(parseInt(RowCnt)+1);
    var ToMM="ddleditEduToMM"+(parseInt(RowCnt)+1);    
    FillMonDDL(FromMM,FromMon);
    FillMonDDL(ToMM,ToMon);
    FillYearDDL(FromYY,FromYr);
    FillYearDDL(ToYY,ToYr);
}

function DelRecord(id,table,obj)
{
  var c=confirm("Are you sure, you want to delete?");
  if(c==true)
   {

      try
        {        
        if (window.XMLHttpRequest)
            {
                xmlhttp=new XMLHttpRequest()
            }
        else if (window.ActiveXObject) 
            {
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
            }
        if (xmlhttp!=null)
            {
                if(table=="Edu")
                {    
                xmlhttp.open("GET","XMLHTTPEdu.aspx?delete="+ id)
                }
                if(table=="WorkHistory")
                {                    
                xmlhttp.open("GET","XMLHTTP.aspx?delete="+ id)                
                }
                                
                xmlhttp.onreadystatechange=function()                                
                {
                    if(xmlhttp.readyState==4)
                    {
                     alert("Record deleted successfully");                       
                     }
                }
                xmlhttp.send(null)
            }
	      else
	        {
			    alert("Your browser does not support XMLHTTP.")
		    }
		    return isValid;
       }
      catch(e){ } 
    document.getElementById(obj).innerHTML="";
    obj=obj.replace("edit","view");
    document.getElementById(obj).innerHTML="";
   }  
}

function SubmitValues(obj,WorkHistoryID,objname,delrowno)
{     
    if(WorkHistoryID=="")
    {         
    var objid=obj.id;
    objid=objid.replace("imgSave","");        
    var Position,Company_name,Website,fromMM,fromYY,toMM,toYY,Services;
    Position=document.getElementById("txtPosition"+objid).value;
    Company_name=document.getElementById("txtcompanyname"+objid).value;
    Website=document.getElementById("txtWebsite"+objid).value;
    fromMM=document.getElementById("ddlFromMM"+objid).value;
    fromYY=document.getElementById("ddlFromYY"+objid).value;
    toMM=document.getElementById("ddlToMM"+objid).value;
    toYY=document.getElementById("ddlToYY"+objid).value;
    Services=document.getElementById("txtServices"+objid).value;               
    }
    else
    {    
    var objid=obj.id;
    objid=objid.replace("imgeditSave","");
    var Position,Company_name,Website,fromMM,fromYY,toMM,toYY,Services;
    Position=document.getElementById("txteditPosition"+objid).value;
    Company_name=document.getElementById("txteditcompanyname"+objid).value;
    Website=document.getElementById("txteditWebsite"+objid).value;
    fromMM=document.getElementById("ddleditFromMM"+objid).value;
    fromYY=document.getElementById("ddleditFromYY"+objid).value;
    toMM=document.getElementById("ddleditToMM"+objid).value;
    toYY=document.getElementById("ddleditToYY"+objid).value;
    Services=document.getElementById("txteditServices"+objid).value;    
    }
    try
        {
        if (window.XMLHttpRequest)
            {
                xmlhttp=new XMLHttpRequest()
            }
        else if (window.ActiveXObject) 
            {
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
            }
        if (xmlhttp!=null)
            {                                                     
                xmlhttp.open("GET","XMLHTTP.aspx?Position="+ Position +"&Company_name="+ Company_name + "&Website=" + Website + "&fromMM=" + fromMM + "&fromYY=" + fromYY +"&toMM=" + toMM + "&toYY=" + toYY + "&Services=" + Services + "&whid=" +WorkHistoryID,true);                
                xmlhttp.onreadystatechange=function()
                {
                if(xmlhttp.readyState==4)
                {              
                    var tmpstr=xmlhttp.responseText;                       
                    var i=tmpstr.indexOf("updated");                                                    
                    if(i!=-1)
                    {                      
                    document.getElementById("cellPosition"+objid).innerHTML=Position;
                    document.getElementById("cellPeriod"+objid).innerHTML="<b>"+fromMM+"/"+fromYY+" - "+toMM+"/"+toYY+"</b>";
                    document.getElementById("cellCompany"+objid).innerHTML=Company_name;
                    document.getElementById("cellWebsite"+objid).innerHTML=Website;
                    document.getElementById("cellServices"+objid).innerHTML=Services;
                    Canceledit(objname,'edit');                    
                    }
                    else
                    {                                
                      var tmpstr=xmlhttp.responseText;                                            
                      var j=tmpstr.indexOf("DOCTYPE");                      
                      var workHistoryID=tmpstr.substring(0,(j-2));                      
                      funEditFields(Company_name,Position,Website,Services,fromMM,fromYY,toMM,toYY,workHistoryID);
                      fndel1(delrowno,'tblWorkHistory');                      
                    }
                 }
               }
                xmlhttp.send(null)                
            }
	      else
	        {
			    alert("Your browser does not support XMLHTTP.")
		    }		    
       }
      catch(e){ }    
}

function SubmitEduValues(obj,EducationalID,objname,delrowno)
{ 
    if(EducationalID=="")
    {    
    var objid=obj.id;
    objid=objid.replace("imgEduSave","");        
    var University,Study,Degree,fromMM,fromYY,toMM,toYY,Special;
    
    University=document.getElementById("txtUniversity"+objid).value;
    Study=document.getElementById("txtstudy"+objid).value;
    Degree=document.getElementById("txtdegree"+objid).value;
    Special=document.getElementById("txtspecialized"+objid).value;       
    
    fromMM=document.getElementById("ddlEduFromMM"+objid).value;
    fromYY=document.getElementById("ddlEduFromYY"+objid).value;
    toMM=document.getElementById("ddlEduToMM"+objid).value;
    toYY=document.getElementById("ddlEduToYY"+objid).value; 
    }
    else
    {
    var objid=obj.id;    
    objid=objid.replace("imgeditEduSave","");
    
    var University,Study,Degree,fromMM,fromYY,toMM,toYY,Special;        
    University=document.getElementById("txteditUniversity"+objid).value;
    Study=document.getElementById("txteditstudy"+objid).value;
    Degree=document.getElementById("txteditdegree"+objid).value;
    Special=document.getElementById("txteditspecialized"+objid).value;       
    
    fromMM=document.getElementById("ddleditEduFromMM"+objid).value;
    fromYY=document.getElementById("ddleditEduFromYY"+objid).value;
    toMM=document.getElementById("ddleditEduToMM"+objid).value;
    toYY=document.getElementById("ddleditEduToYY"+objid).value; 
    }
    try
        {        
        if (window.XMLHttpRequest)
            {
                xmlhttp=new XMLHttpRequest()
            }
        else if (window.ActiveXObject) 
            {
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
            }
        if (xmlhttp!=null)
            { 
                xmlhttp.open("GET","XMLHTTPEdu.aspx?University="+ University +"&Study="+ Study + "&Degree=" + Degree + "&fromMM=" + fromMM + "&fromYY=" + fromYY +"&toMM=" + toMM + "&toYY=" + toYY + "&Special=" + Special + "&eduid=" +EducationalID )
                xmlhttp.onreadystatechange=function()
                {
                if(xmlhttp.readyState==4)
                {
                    var tmpstr=xmlhttp.responseText;                       
                    var i=tmpstr.indexOf("updated");                         
                    if(i!=-1)
                    {      
                        document.getElementById("cellUniversity"+objid).innerHTML="<b>"+University+"</b>";
                        if(fromMM!="")
                        {
                            document.getElementById("cellUniversity"+objid).innerHTML=document.getElementById("cellUniversity"+objid).innerHTML+" , "+fromMM +" "+fromYY;
                        }
                        if(toMM!="")
                        {
                            document.getElementById("cellUniversity"+objid).innerHTML=document.getElementById("cellUniversity"+objid).innerHTML+" - "+toMM +" "+toYY; 
                        } 
                        
                        if(Study!="" && Degree!="")
                        {
                            document.getElementById("cellStudy"+objid).innerHTML=Study+" , "+Degree;
                        }
                        else
                        {
                            document.getElementById("cellStudy"+objid).innerHTML=Study;
                            document.getElementById("cellStudy"+objid).innerHTML=document.getElementById("cellStudy"+objid).innerHTML+Degree;
                        }                    
                        document.getElementById("cellSpecial"+objid).innerHTML=Special;                    
                        Canceleduedit(objname,'edit');
                    }
                    else
                    {
                      var j=tmpstr.indexOf("DOCTYPE");          
                      var EducationalID=tmpstr.substring(0,(j-2));
                      funEditEduFields(University,Study,Degree,Special,fromMM,fromYY,toMM,toYY,EducationalID)
                      fndel1(delrowno,'tablEducational');
                   }
                 }
               }
                xmlhttp.send(null)
            }
	      else
	        {
			    alert("Your browser does not support XMLHTTP.")
		    }
		    return isValid;
       }
      catch(e){ }    
}




function Canceledit(objname,txt)
 {
     if(txt=="edit")
     {
        document.getElementById(objname).className="divtxthide";
        objname=objname.replace("edit","view");
        document.getElementById(objname).className="divtxtvisible";    
     }
     else if(txt=="view")
     { 
        document.getElementById(objname).className="divtxthide";
        objname=objname.replace("view","edit");     
        document.getElementById(objname).className="divtxtvisible";        
     }
 }
 
 function Canceleduedit(objname,txt)
{ 
 if(txt=="edit")
 {
    document.getElementById(objname).className="divtxthide";
    objname=objname.replace("edit","view");
    document.getElementById(objname).className="divtxtvisible";    
 }
 else if(txt=="view")
 { 
    document.getElementById(objname).className="divtxthide";
    objname=objname.replace("view","edit");     
    document.getElementById(objname).className="divtxtvisible";        
 }
}

function fndel1(no,tblname)
 { 
 //  delete function for all dynamically created rows
   if(tblname=="tblWorkHistory")
   {
        document.getElementById("tblWorkHistory").deleteRow(no);        
        document.getElementById("ctl00_MainContentPlaceHolder_HiddenFieldRowCnt").value=eval(document.getElementById("ctl00_MainContentPlaceHolder_HiddenFieldRowCnt").value)-1;
        document.getElementById("ctl00_MainContentPlaceHolder_HiddenFieldWorkHistory").value=document.getElementById("ctl00_MainContentPlaceHolder_HiddenFieldWorkHistory").value.replace((parseInt(no)+2),"");
   }
   else if(tblname=="tblMessaging")
   {
      //document.aspnetForm.ctl00$MainContentPlaceHolder$HF_Domain_RowCnt.value=parseInt(document.aspnetForm.ctl00$MainContentPlaceHolder$HF_Domain_RowCnt.value)-1;     
      document.getElementById("ctl00_MainContentPlaceHolder_HF_Domain_RowCnt").value=parseInt(document.getElementById("ctl00_MainContentPlaceHolder_HF_Domain_RowCnt").value)-1;    
      document.getElementById(tblname).deleteRow(no);            
      if(document.getElementById(tblname).rows.length==3)
      {
       document.getElementById("divMsgminus").style.display="block";        
      }
   }
   else if(tblname=="tablEducational")
   {
   //document.aspnetForm.ctl00$MainContentPlaceHolder$HF_Education_RowCnt.value=parseInt(document.aspnetForm.ctl00$MainContentPlaceHolder$HF_Education_RowCnt.value)-1;
   document.getElementById("ctl00_MainContentPlaceHolder_HF_Education_RowCnt").value=parseInt(document.getElementById("ctl00_MainContentPlaceHolder_HF_Education_RowCnt").value)-1; 
   document.getElementById(tblname).deleteRow(no); 
   }
   else if(tblname=="tablQualification")
   {
    //document.aspnetForm.ctl00$MainContentPlaceHolder$HF_Qualification_RowCnt.value=parseInt(document.aspnetForm.ctl00$MainContentPlaceHolder$HF_Qualification_RowCnt.value)-1;   
    document.getElementById("ctl00_MainContentPlaceHolder_HF_Qualification_RowCnt").value=parseInt(document.getElementById("ctl00_MainContentPlaceHolder_HF_Qualification_RowCnt").value)-1; 
    document.getElementById(tblname).deleteRow(no);
    if(document.getElementById(tblname).rows.length==2)
    {
        document.getElementById("divminus").style.display="block";        
    }     
   }
   else if(tblname=="tblLanguages")
   {
   //document.aspnetForm.ctl00$MainContentPlaceHolder$HF_Language_RowCnt.value=parseInt(document.aspnetForm.ctl00$MainContentPlaceHolder$HF_Language_RowCnt.value)-1;
   document.getElementById("ctl00_MainContentPlaceHolder_HF_Language_RowCnt").value=parseInt(document.getElementById("ctl00_MainContentPlaceHolder_HF_Language_RowCnt").value)-1;
   document.getElementById(tblname).deleteRow(no); 
   if(document.getElementById(tblname).rows.length==1)
    {
        document.getElementById("divLanguageminus").style.display="block";        
    }
   }      
 } 
 function ClearAll()
 {
 document.getElementById("ctl00_MainContentPlaceHolder_HiddenFieldRowCnt").value=0;
 document.getElementById("ctl00_MainContentPlaceHolder_HiddenFieldWorkHistory").value=0;
 document.getElementById("ctl00_MainContentPlaceHolder_HiddenFieldRowCnt1").value=0;
 document.getElementById("ctl00_MainContentPlaceHolder_HF_Edu_ID1").value=0;
 document.getElementById("ctl00_MainContentPlaceHolder_HF_Edu_ID").value=0;
 document.getElementById("ctl00_MainContentPlaceHolder_HF_Education_RowCnt").value=0; 
// document.aspnetForm.ctl00$MainContentPlaceHolder$HiddenFieldRowCnt.value="0";
// document.aspnetForm.ctl00$MainContentPlaceHolder$HiddenFieldWorkHistory.value="0";
// document.aspnetForm.ctl00$MainContentPlaceHolder$HiddenFieldRowCnt1.value="0";
// document.aspnetForm.ctl00$MainContentPlaceHolder$HF_Edu_ID1.value="0";
// document.aspnetForm.ctl00$MainContentPlaceHolder$HF_Edu_ID.value="0";
// document.aspnetForm.ctl00$MainContentPlaceHolder$HF_Education_RowCnt.value="0"; 
 document.getElementById("tablEducational").value=" ";
 document.getElementById("tblViewEducation").value=""; 
 }
 function CancelEdit(editdiv,viewdiv)
 { 
 if(editdiv=="divEditPersonalProfile")
    {
        document.getElementById("ctl00_MainContentPlaceHolder_divEditAvatar").style.display="none";
    }
 document.getElementById("ctl00_MainContentPlaceHolder_"+editdiv).style.display="none";
 document.getElementById("ctl00_MainContentPlaceHolder_"+viewdiv).style.display="block";
 }
 
 function EnableEdit(editdiv,viewdiv)
 {    
 document.getElementById("ctl00_MainContentPlaceHolder_"+editdiv).style.display="block";
 document.getElementById("ctl00_MainContentPlaceHolder_"+viewdiv).style.display="none";
 }
 
 
function SelectMedia(Ctrl)
{    
  
    document.getElementById("eprofiles").className="";
    document.getElementById("ph").className="";
    document.getElementById("videos").className="";
    document.getElementById("fe").className="";
    document.getElementById("diveprofiles").style.display="none";
    document.getElementById("divph").style.display="none";
    document.getElementById("divvideos").style.display="none";
    document.getElementById("divfe").style.display="none";  
    document.getElementById(Ctrl).className="selected";
    document.getElementById("div"+Ctrl).style.display="block";
    
}   


function fnEnable()
{
  document.getElementById('editblogroll').style.display='block'  
}

function fnDisable()
{
    document.getElementById('editblogroll').style.display='none'  
    document.getElementById('ctl00_MainContentPlaceHolder_TextBox1').value=""
    document.getElementById('ctl00_MainContentPlaceHolder_TextBox2').value=""
    document.getElementById('ctl00_MainContentPlaceHolder_TextBox3').value=""
    document.getElementById('ctl00_MainContentPlaceHolder_TextBox4').value=""
    document.getElementById('ctl00_MainContentPlaceHolder_postid').value=""
    
}


function getblogrollvalue(obj)
{   
var i;
count=0;
for (i=0; i < document.forms[0].elements.length; i++)
{
if (document.forms[0].elements[i].type == 'checkbox')
{ 
if (document.forms[0].elements[i].checked ==true)
{
 document.getElementById("ctl00_MainContentPlaceHolder_blogrollid").value = document.forms[0].elements[i].value
 count=count+1;
 }
 //else
// document.getElementById("postid").value = document.getElementById("postid").value + "," + document.forms[0].elements[i].value 
}

}
if(count==0)
{
alert("Please select BlogRoll")
return false;
}
if(count>1 )
{
if(obj==1)
{
alert("Please select Only one BlogRoll to edit")
return false;
}

}

}

function getblogrolldeletevalue()
    {     
var i;
count=0;
for (i=0; i < document.forms[0].elements.length; i++)
{
    
if (document.forms[0].elements[i].type == 'checkbox')
{ 
  
if (document.forms[0].elements[i].checked ==true)
{
if (document.getElementById("ctl00_MainContentPlaceHolder_blogrollid").value=="")
{
  document.getElementById("ctl00_MainContentPlaceHolder_blogrollid").value = document.forms[0].elements[i].value
  count=count+1;
  }
else
 document.getElementById("ctl00_MainContentPlaceHolder_blogrollid").value = document.getElementById("ctl00_MainContentPlaceHolder_blogrollid").value + "," + document.forms[0].elements[i].value

 }
}
}
if(count==0)
{
alert("Please select BlogRoll")
return false;
}
if(confirm("Are you sure want to delete?")==true)
{
return true;
}
else
{
window.location="MyProfiles.aspx" 
return false;
}
}
function getblogcatdeletevalue()
    {     
var i;
count=0;
for (i=0; i < document.forms[0].elements.length; i++)
{
    
if (document.forms[0].elements[i].type == 'checkbox')
{ 
  
if (document.forms[0].elements[i].checked ==true)
{
if (document.getElementById("ctl00_MainContentPlaceHolder_blogcatid").value=="")
{
  document.getElementById("ctl00_MainContentPlaceHolder_blogcatid").value = document.forms[0].elements[i].value
  count=count+1;
  }
else
 document.getElementById("ctl00_MainContentPlaceHolder_blogcatid").value = document.getElementById("ctl00_MainContentPlaceHolder_blogcatid").value + "," + document.forms[0].elements[i].value

 }
}
}
if(count==0)
{
alert("Please select Subject")
return false;
}
if(confirm("Are you sure want to delete?")==true)
{
return true;
}
else
{
window.location="MyProfiles.aspx" 
return false;
}
}

function viviblityOption(Type)
{ 
       if(document.getElementById("ctl00_MainContentPlaceHolder_rbl"+Type+"Visibility_0").checked)
       {
        VisibilityText=document.getElementById("ctl00_MainContentPlaceHolder_rbl"+Type+"Visibility_0").value;
       }
       if(document.getElementById("ctl00_MainContentPlaceHolder_rbl"+Type+"Visibility_1").checked)
       {
        VisibilityText=document.getElementById("ctl00_MainContentPlaceHolder_rbl"+Type+"Visibility_1").value;
       }   
       document.getElementById("View"+Type+"Visibility").innerHTML=VisibilityText+ " Viewing Fee: " 
}


function ViewFee(Type)
{
if((document.getElementById("ctl00_MainContentPlaceHolder_rbl"+Type+"Visibility_0").checked==false && document.getElementById("ctl00_MainContentPlaceHolder_rbl"+Type+"Visibility_1").checked==false))
{
    alert("Please select visiblity option");
}
else
{
   if(document.getElementById("ctl00_MainContentPlaceHolder_rbl"+Type+"Chargeable_0").checked)
   {
     document.getElementById("tr"+Type+"Fee").style.display="";
     document.getElementById("tr"+Type+"ServiceFee").style.display="";
     document.getElementById("tr"+Type+"NetAmount").style.display="";     
   }
   
   else
   {
     document.getElementById("tr"+Type+"Fee").style.display="none";
     document.getElementById("tr"+Type+"ServiceFee").style.display="none";
     document.getElementById("tr"+Type+"NetAmount").style.display="none";
     document.getElementById("ctl00_MainContentPlaceHolder_txt"+Type+"ViewingFee").value="";
   }
 }
} 

function validate(type)
{
 if(type=="eProfile")
    {     
    if(document.getElementById("ctl00_MainContentPlaceHolder_HF_eProfile_File").value=="")
    {
        if(isNull(document.getElementById("ctl00_MainContentPlaceHolder_FU_eprofile"),"eProfile"))return false;    
        if(notDNLFile(document.getElementById("ctl00_MainContentPlaceHolder_FU_eprofile"),"eProfile"))return false;        
         if(isNull(document.getElementById("ctl00_MainContentPlaceHolder_FU_Image"),"Display Image"))return false;    
    if(notImageFile(document.getElementById("ctl00_MainContentPlaceHolder_FU_Image"),"Display Image"))return false; 
    }         
    if(isNull(document.getElementById("ctl00_MainContentPlaceHolder_txtTile"),"Title"))return false;        
    if(fnSelectIndex(document.getElementById("ctl00_MainContentPlaceHolder_ddlSeries"),"--Select--","Series"))return false;
    if(fnSelectIndex(document.getElementById("ctl00_MainContentPlaceHolder_ddlCategories"),"--Select--","Category"))return false;       
    if(fnSelectIndex(document.getElementById("ctl00_MainContentPlaceHolder_ddlSubCategories"),"-1","SubCategory"))return false;          
    if(fnSelectIndex(document.getElementById("ctl00_MainContentPlaceHolder_ddllanguage"),"-Language-","Language"))return false;                   
    document.getElementById("ctl00_MainContentPlaceHolder_HF_eProfileLanguage").value=document.getElementById("ctl00_MainContentPlaceHolder_ddllanguage").value;
    document.getElementById("ctl00_MainContentPlaceHolder_HF_eProfileSubcategory").value=document.getElementById("ctl00_MainContentPlaceHolder_ddlSubCategories").value;    
    }
    
 if(type=="Photo")
 {   
    if(document.getElementById("ctl00_MainContentPlaceHolder_HF_Photo_File").value=="")
    {
        if(isNull(document.getElementById("ctl00_MainContentPlaceHolder_FU_UploadFile"),"Photo"))return false;    
        if(notImageFile(document.getElementById("ctl00_MainContentPlaceHolder_FU_UploadFile"),"Photo"))return false;    
    }
    if(isNull(document.getElementById("ctl00_MainContentPlaceHolder_txtPhotoTile"),"Title"))return false;    
    if(isNull(document.getElementById("ctl00_MainContentPlaceHolder_txtPhotoDescription"),"Description"))return false;    
    if(ChkLen(document.getElementById("ctl00_MainContentPlaceHolder_txtPhotoDescription"),"Description","500"))return false;
  }
if(type=="Video")
{
    if(document.getElementById("ctl00_MainContentPlaceHolder_HF_Video_File").value=="")
    {
    if(isNull(document.getElementById("ctl00_MainContentPlaceHolder_FU_UploadVideos"),"Video"))return false;
    if(notVideoFile(document.getElementById("ctl00_MainContentPlaceHolder_FU_UploadVideos"),"Video"))return false;
    }
    if(isNull(document.getElementById("ctl00_MainContentPlaceHolder_txtVideoTile"),"Title"))return false; 
    if(isNull(document.getElementById("ctl00_MainContentPlaceHolder_txtVideoDescription"),"Description"))return false;    
    if(ChkLen(document.getElementById("ctl00_MainContentPlaceHolder_txtVideoDescription"),"Description","500"))return false;
 }     
 if(type=="File")
{
    
    if(document.getElementById("ctl00_MainContentPlaceHolder_HF_File_File").value=="")
    {    
    if(isNull(document.getElementById("ctl00_MainContentPlaceHolder_FU_UploadFiles"),"File"))return false;    
    if(notFile(document.getElementById("ctl00_MainContentPlaceHolder_FU_UploadFiles"),"File"))return false;   
    }
    if(isNull(document.getElementById("ctl00_MainContentPlaceHolder_txtFileTitle"),"Title"))return false;
    if(isNull(document.getElementById("ctl00_MainContentPlaceHolder_txtFileDescription"),"Description"))return false;    
    if(ChkLen(document.getElementById("ctl00_MainContentPlaceHolder_txtFileDescription"),"Description","500"))return false;
 }
 
  var Premium=document.getElementById('ctl00_MainContentPlaceHolder_hid_premium').value;
  var Point=document.getElementById('ctl00_MainContentPlaceHolder_hid_digitalpoint').value;
  var Balance=document.getElementById('ctl00_MainContentPlaceHolder_hid_balance').value;  
   if(document.getElementById("ctl00_MainContentPlaceHolder_HF_"+type+"_File").value=="")
   {   
           Premium=(Premium)*(-1) 
           var Avlbalance = parseInt(Balance)-parseInt(Point)       
           if(parseInt(Premium)< parseInt(Avlbalance))
           {
                if(confirm("By clicking ‘OK’ you confirm and agree to pay "+ Point + " AZP to upload Digital Media")==true)
                 {
                  return true;
                 }
                 else
                 { 
                  return false;
                 }
           }
           else
           {           
            alert('You do not have sufficient AZPs to Upload Digitel Media Files') ;
            return false;
           }
    }
    else
    {
     return true;
     }
}

function getcatvalue(obj)
{
   
var i;
count=0;
for (i=0; i < document.forms[0].elements.length; i++)
{
if (document.forms[0].elements[i].type == 'checkbox')
{ 
if (document.forms[0].elements[i].checked ==true)
{
 document.getElementById("ctl00_MainContentPlaceHolder_blogcatid").value = document.forms[0].elements[i].value
 count=count+1;
 }
 //else
// document.getElementById("postid").value = document.getElementById("postid").value + "," + document.forms[0].elements[i].value
 
}

}
if(count==0)
{
alert("Please select Subject")
return false;
}
if(count>1 )
{
if(obj==1)
{
alert("Please select Only one Subject to edit")
return false;
}
}
}


function Cancel()
{
document.getElementById("ctl00_MainContentPlaceHolder_HF_eProfile_File").value="";
document.getElementById("ctl00_MainContentPlaceHolder_HF_Photo_File").value="";
document.getElementById("ctl00_MainContentPlaceHolder_HF_Video_File").value="";
}

function opentermsofuse(filename)
{
  newwindow=window.open(filename,"",'menubar=0,location=0,status=1,scrollbars=1,width=500,height=400');
   if (window.focus) {newwindow.focus()}
    return false;    
}

function validateaddress(fromtab)
{
if(isNull(document.getElementById("ctl00_MainContentPlaceHolder_txt"+fromtab+"City"),"City"))return false;
if(fnSelectIndex(document.getElementById("ctl00_MainContentPlaceHolder_ddl"+fromtab+"Country"),"Select","Country"))return false;
if(fromtab=="Bus")
{
SaveAddress('Business','divEditBusinessContactDetails','divViewBusinessContactDetails');
}
else if(fromtab=="Pro")
{
SaveAddress('Pro','divEditProfessContactDetails','divViewProfessContactDetails');
}
return false;
}

function SaveAddress(From,Hidediv,Viewdiv)
{
    if(From=="Business")
    {     
    phone=document.getElementById("ctl00_MainContentPlaceHolder_txtBusPhone").value;
    Fax=document.getElementById("ctl00_MainContentPlaceHolder_txtBusFax").value;
    BusCellPhone=document.getElementById("ctl00_MainContentPlaceHolder_txtBusCellPhone").value;
    BusEmail=document.getElementById("ctl00_MainContentPlaceHolder_txtBusEmail").value;
    BusWebsite=document.getElementById("ctl00_MainContentPlaceHolder_txtBusWebsite").value;
    BusAddress=document.getElementById("ctl00_MainContentPlaceHolder_txtBusAddress").value;
    BusStreet=document.getElementById("ctl00_MainContentPlaceHolder_txtBusStreet").value;
    BusCity=document.getElementById("ctl00_MainContentPlaceHolder_txtBusCity").value;
    BusState=document.getElementById("ctl00_MainContentPlaceHolder_txtBusState").value;
    BusCountry=document.getElementById("ctl00_MainContentPlaceHolder_ddlBusCountry").value;
    BusPincode=document.getElementById("ctl00_MainContentPlaceHolder_txtBusPincode").value;
    
    document.getElementById("ctl00_MainContentPlaceHolder_lblBusPhone").innerHTML = phone;
    document.getElementById("ctl00_MainContentPlaceHolder_lblBusFax").innerHTML = Fax;
    document.getElementById("ctl00_MainContentPlaceHolder_lblBusCellphone").innerHTML = BusCellPhone;
    document.getElementById("ctl00_MainContentPlaceHolder_lblBusEmail").innerHTML = BusEmail;
    document.getElementById("ctl00_MainContentPlaceHolder_lblBusWebsite").innerHTML = BusWebsite;

    if(BusAddress!="")
    {
    document.getElementById("ctl00_MainContentPlaceHolder_lblBusAddress").innerHTML=BusAddress;
    }    
    if(BusStreet!="")
    {
    document.getElementById("ctl00_MainContentPlaceHolder_lblBusAddress").innerHTML+="<span class='padleft'>"+BusStreet+"</span>,<br>";
    }    
    if(BusCity!="")
    {
    document.getElementById("ctl00_MainContentPlaceHolder_lblBusAddress").innerHTML+="<span class='padleft'>"+BusCity+"</span>,<br>";
    }
    
    if(BusState!="")
    {
    document.getElementById("ctl00_MainContentPlaceHolder_lblBusAddress").innerHTML+="<span class='padleft'>"+BusState+"</span>";
    }
    
    if(BusPincode!="")
    {
    document.getElementById("ctl00_MainContentPlaceHolder_lblBusAddress").innerHTML+="<span class='padleft'>"+BusPincode+"</span>,<br>";
    }     
    if(BusCountry!="")
    {
    document.getElementById("ctl00_MainContentPlaceHolder_lblBusAddress").innerHTML+="<span class='padleft'>"+BusCountry+"</span>";
    }
    document.getElementById("ctl00_MainContentPlaceHolder_divBusCityCountry").innerHTML=BusCity+", "+BusCountry;
    }   
    else if(From=="Pro")
    {       
    phone=document.getElementById("ctl00_MainContentPlaceHolder_txtProPhone").value;
    Fax="";        
    BusCellPhone=document.getElementById("ctl00_MainContentPlaceHolder_txtboxProCellPhone").value;
    BusEmail=document.getElementById("ctl00_MainContentPlaceHolder_txtProEmail").value;
    BusWebsite=document.getElementById("ctl00_MainContentPlaceHolder_txtProWebsite").value;
    BusAddress=document.getElementById("ctl00_MainContentPlaceHolder_txtProAddress").value;
    BusStreet=document.getElementById("ctl00_MainContentPlaceHolder_txtProStreet").value;
    BusCity=document.getElementById("ctl00_MainContentPlaceHolder_txtProCity").value;
    BusState=document.getElementById("ctl00_MainContentPlaceHolder_txtProState").value;
    BusCountry=document.getElementById("ctl00_MainContentPlaceHolder_ddlProCountry").value;
    BusPincode=document.getElementById("ctl00_MainContentPlaceHolder_txtProPincode").value;    
    document.getElementById("ctl00_MainContentPlaceHolder_lblProPhone").innerHTML = phone;            
    document.getElementById("ctl00_MainContentPlaceHolder_lblboxProCellPhone").innerHTML = BusCellPhone;
    document.getElementById("ctl00_MainContentPlaceHolder_lblProEmail").innerHTML = BusEmail;
    document.getElementById("ctl00_MainContentPlaceHolder_lblProWebsite").innerHTML = BusWebsite;    
    document.getElementById("ctl00_MainContentPlaceHolder_lblSocPhone").innerHTML = phone;
    document.getElementById("ctl00_MainContentPlaceHolder_lblSocCellphone").innerHTML = BusCellPhone;
    document.getElementById("ctl00_MainContentPlaceHolder_lblSocEmail").innerHTML = BusEmail;
    document.getElementById("ctl00_MainContentPlaceHolder_lblSocWebsite").innerHTML = BusWebsite;    
    if(BusAddress!="")
    {
    document.getElementById("ctl00_MainContentPlaceHolder_lblProAddress").innerHTML=BusAddress;
    document.getElementById("ctl00_MainContentPlaceHolder_lblSocAddress").innerHTML=BusAddress;
    }    
    if(BusStreet!="")
    {
    document.getElementById("ctl00_MainContentPlaceHolder_lblProAddress").innerHTML+="<span class='padleft'>"+BusStreet+"</span>,<br>";
    document.getElementById("ctl00_MainContentPlaceHolder_lblSocAddress").innerHTML+="<span class='padleft'>"+BusStreet+"</span>,<br>";
    }    
    if(BusCity!="")
    {
    document.getElementById("ctl00_MainContentPlaceHolder_lblProAddress").innerHTML+="<span class='padleft'>"+BusCity+"</span>,<br>";
    document.getElementById("ctl00_MainContentPlaceHolder_lblSocAddress").innerHTML+="<span class='padleft'>"+BusCity+"</span>,<br>";
    }
    
    if(BusState!="")
    {
    document.getElementById("ctl00_MainContentPlaceHolder_lblProAddress").innerHTML+="<span class='padleft'>"+BusState+"</span>";
    document.getElementById("ctl00_MainContentPlaceHolder_lblSocAddress").innerHTML+="<span class='padleft'>"+BusState+"</span>";
    }
    
    if(BusPincode!="")
    {
    document.getElementById("ctl00_MainContentPlaceHolder_lblProAddress").innerHTML+="<span class='padleft'>"+BusPincode+"</span>,<br>";
    document.getElementById("ctl00_MainContentPlaceHolder_lblSocAddress").innerHTML+="<span class='padleft'>"+BusPincode+"</span>,<br>";
    }
    
    if(BusCountry!="")
    {
    document.getElementById("ctl00_MainContentPlaceHolder_lblProAddress").innerHTML+="<span class='padleft'>"+BusCountry+"</span>";
    document.getElementById("ctl00_MainContentPlaceHolder_lblSocAddress").innerHTML+="<span class='padleft'>"+BusCountry+"</span>";
    }            
    document.getElementById("ctl00_MainContentPlaceHolder_divProCityCountry").innerHTML=BusCity+", "+BusCountry;
    document.getElementById("ctl00_MainContentPlaceHolder_divSocCityCountry").innerHTML=BusCity+", "+BusCountry;    
    }  
 
    try
        {         
        if (window.XMLHttpRequest)
            {
                xmlhttp=new XMLHttpRequest()
            }
        else if (window.ActiveXObject)
            {
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
            }
        if (xmlhttp!=null)
            {                   
              xmlhttp.open("POST","XMLHTTP.aspx?Fromaddress="+From+"&phone="+phone+"&Fax="+Fax+"&CellPhone="+BusCellPhone+"&Email="+BusEmail+"&Website="+BusWebsite+"&Address="+BusAddress+"&Street="+BusStreet+"&City="+BusCity+"&State="+BusState+"&Country="+BusCountry+"&Pincode="+BusPincode,true);              
              xmlhttp.onreadystatechange=function()
                {
                    if(xmlhttp.readyState==4)
                    {
                      document.getElementById("ctl00_MainContentPlaceHolder_"+Hidediv).style.display="none";
                      document.getElementById("ctl00_MainContentPlaceHolder_"+Viewdiv).style.display="block";
                     }
                }
              xmlhttp.send(null)                            
            }
	      else
	        {
			    alert("Your browser does not support XMLHTTP.")
		    }		    
       }
      catch(e){ }
}

//Function save Business and Profession Basic Details
function SaveBusBasic(From,Hidediv,Viewdiv)
{    
    position=document.getElementById("ctl00_MainContentPlaceHolder_txt"+From+"Position").value;
    position=position.replace("/","~");
    company=document.getElementById("ctl00_MainContentPlaceHolder_txt"+From+"Company").value;
    tags=document.getElementById("ctl00_MainContentPlaceHolder_txt"+From+"Tags").value;    
     document.getElementById("ctl00_MainContentPlaceHolder_txtBusTags").value=tags;
    document.getElementById("ctl00_MainContentPlaceHolder_txtProTags").value=tags;
 try
        {        
        if (window.XMLHttpRequest)
            {
                xmlhttp=new XMLHttpRequest()
            }
        else if (window.ActiveXObject)
            {
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
            }
        if (xmlhttp!=null)
            {                      
              xmlhttp.open("GET","XMLHTTPEdu.aspx?tags="+tags+"&position="+position+"&company="+company,true);              
              xmlhttp.onreadystatechange=function()
                {
               
                    if(xmlhttp.readyState==4)
                    {         
                     position=position.replace("~","/");  
                     var response_text=xmlhttp.responseText.split("^",1);                                   
                      document.getElementById("ctl00_MainContentPlaceHolder_"+Hidediv).style.display="none";
                      document.getElementById("ctl00_MainContentPlaceHolder_"+Viewdiv).style.display="block";                                                                  
                      document.getElementById("ctl00_MainContentPlaceHolder_lblBusPosition").innerHTML=position;
                      document.getElementById("ctl00_MainContentPlaceHolder_lblBusCompany").innerHTML=company;                      
                      document.getElementById("ctl00_MainContentPlaceHolder_lblBusTags").innerHTML=response_text;
                      document.getElementById("ctl00_MainContentPlaceHolder_lblProPosition").innerHTML=position;
                      document.getElementById("ctl00_MainContentPlaceHolder_lblProCompany").innerHTML=company;
                      document.getElementById("ctl00_MainContentPlaceHolder_lblProTags").innerHTML=response_text;
                      document.getElementById("ctl00_MainContentPlaceHolder_lblSocTags").innerHTML=response_text;                      
                     }
                }
              xmlhttp.send(null);
            }
	      else
	        {
			    alert("Your browser does not support XMLHTTP.")
		    }		    
       }
      catch(e){ }
}


//Save Languages
function SaveLanguages(Hidediv,Viewdiv)
{
HiddenFieldVal= document.getElementById("ctl00_MainContentPlaceHolder_HF_Language1").value;
document.getElementById("ctl00_MainContentPlaceHolder_HF_DomainName").value="";
document.getElementById("ctl00_MainContentPlaceHolder_HF_DomainIds").value="";
document.getElementById("ctl00_MainContentPlaceHolder_HF_Session_Languages").value="English";

for(i=1;i<=HiddenFieldVal;i++)
{
    if(i==1)
    {       
        document.getElementById("ctl00_MainContentPlaceHolder_HF_DomainIds").value+="|"+document.getElementById("ddlLanguageskills"+i).value;
        document.getElementById("ctl00_MainContentPlaceHolder_HF_Session_Languages").value+="~"+document.getElementById("ddlLanguageskills"+i).value;
        
    }
    if(document.getElementById("ddlLanguage"+i)!=null && document.getElementById("ddlLanguageskills"+i)!=null)
    {
        if(document.getElementById("ddlLanguage"+i).value!="" && document.getElementById("ddlLanguageskills"+i).value!="")
        {
            document.getElementById("ctl00_MainContentPlaceHolder_HF_DomainName").value+="|"+document.getElementById("ddlLanguage"+i).value;
            document.getElementById("ctl00_MainContentPlaceHolder_HF_DomainIds").value+="|"+document.getElementById("ddlLanguageskills"+i).value;                       
            document.getElementById("ctl00_MainContentPlaceHolder_HF_Session_Languages").value+="!"+document.getElementById("ddlLanguage"+i).value+"~"+document.getElementById("ddlLanguageskills"+i).value;
            
        }
    }
}

 try
        {        
        if (window.XMLHttpRequest)
            {
                xmlhttp=new XMLHttpRequest()
            }
        else if (window.ActiveXObject)
            {
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
            }
        if (xmlhttp!=null)
            {            
              xmlhttp.open("GET","XMLHTTPEdu.aspx",true);                
              if(document.getElementById("ctl00_MainContentPlaceHolder_HF_DomainName").value=="")
              {
              document.getElementById("ctl00_MainContentPlaceHolder_HF_DomainName").value=" ";
              }
              xmlhttp.setRequestHeader("Language",document.getElementById("ctl00_MainContentPlaceHolder_HF_DomainName").value);
              xmlhttp.setRequestHeader("Skills",document.getElementById("ctl00_MainContentPlaceHolder_HF_DomainIds").value);                          
              xmlhttp.onreadystatechange=function()
                {
                    if(xmlhttp.readyState==4)
                    {
                     var c=xmlhttp.responseText.split("^",1);                                                     
                     document.getElementById("ctl00_MainContentPlaceHolder_lblLanguages").innerHTML=c;                     
                     document.getElementById("ctl00_MainContentPlaceHolder_"+Hidediv).style.display="none";
                     document.getElementById("ctl00_MainContentPlaceHolder_"+Viewdiv).style.display="block";
                    }
                }
              xmlhttp.send(null)
            }
	      else
	        {
			    alert("Your browser does not support XMLHTTP.")
		    }		    
       }
      catch(e){ }
}


//Save Personal Details
function SavePersonelDetails()
      {
        var interest="";        
        var look="";
        var status="";                                
        var Dat="";
        var Mont="";
        var Yea="";         
        var val=document.getElementById("ctl00_MainContentPlaceHolder_AvatarUpload").value;           
        Dat=document.getElementById("ddlDOBDD").value;        
        Mont=document.getElementById("ddlDOBMM").value;
        Yea=document.getElementById("ddlDOBYY").value;        
        
        
        if(document.getElementById("ctl00_MainContentPlaceHolder_chkboxSocInterestIn_0").checked)
        {        
        interest+=","+"Men";
        }
        
        if(document.getElementById("ctl00_MainContentPlaceHolder_chkboxSocInterestIn_1").checked)
        {     
        interest+=","+"Women";
        }        
        
        interest=interest.substring(1,interest.length); 
                        
        for(i=0;i<=3;i++)
        {
        if(document.getElementById("ctl00_MainContentPlaceHolder_chkboxSocLookingfor_"+i).checked)
         {
            if(i==0)
                look+=","+"Friendship";            
            else if(i==1)
                look+=","+"Good Company";            
            else if(i==2)
                look+=","+"Relationship";
            else if(i==3)
                look+=","+"Pen Pals";           
         }
        }   
                  
       look=look.substring(1,look.length);       
       
        for(i=0;i<=3;i++)
        {
        if(document.getElementById("ctl00_MainContentPlaceHolder_RelationashipStatus_"+i).checked)
         {
            if(i==0)
                status="Single";            
            else if(i==1)
                status="Married";            
            else if(i==2)
                status="Separated";
            else if(i==3)
                status="Divorced";           
         }
        }
                           
       
                try
                {        
                if (window.XMLHttpRequest)
                    {
                        xmlhttp=new XMLHttpRequest()
                    }
                else if (window.ActiveXObject)
                    {
                        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
                    }
                if (xmlhttp!=null)
                    {
                        xmlhttp.open("Get","XMLHTTP.aspx?Dat="+Dat+"&Mont="+Mont+"&Yea="+Yea+"&status="+status+"&interest="+interest+"&look="+look,true);                
                        xmlhttp.onreadystatechange=function()
                        {
                            if(xmlhttp.readyState==4)
                            {                              
                             document.getElementById("ctl00_MainContentPlaceHolder_lblSocLookingfor").innerHTML=look;
                             document.getElementById("ctl00_MainContentPlaceHolder_lblSocDOB").innerHTML=Dat+"-"+Mont+"-"+Yea;                    
                             document.getElementById("ctl00_MainContentPlaceHolder_lblSocRelationshipStatus").innerHTML=status;                    
                             document.getElementById("ctl00_MainContentPlaceHolder_lblSocInterestedin").innerHTML=interest;                                                            
                             document.getElementById("ctl00_MainContentPlaceHolder_divEditPersonalProfile").style.display="none";
                             document.getElementById("ctl00_MainContentPlaceHolder_divEditAvatar").style.display="none";                     
                             document.getElementById("ctl00_MainContentPlaceHolder_divViewPersonalProfile").style.display="block";                     
                             var txt=xmlhttp.responseText.split("^",1);                             
                             document.getElementById("ctl00_MainContentPlaceHolder_HF_DOB").value=txt;
                              if(val!="")                                
                                {              
                                  var ctrl=document.getElementById("ctl00_MainContentPlaceHolder_btnSaveSocPersonal");
                                  ctrl.click();
                                }                             
                            }
                        }
                      xmlhttp.send(null)
                    }
	              else
	                {
			            alert("Your browser does not support XMLHTTP.")
		            }		            
                 }
                catch(e){ }                       
    }
    
    
function FillLanguaseDDL(DDL,SelectedValue) 
{
// Fill domain names in dropdownlist for internet messaging
 document.getElementById(DDL).options[0] = new Option("-Language-","-Language-"); 
 document.getElementById(DDL).options[1] = new Option("Afrikaans","Afrikaans");
 document.getElementById(DDL).options[2] = new Option("Arabic","Arabic");
 document.getElementById(DDL).options[3] = new Option("Bosnian","Bosnian");
 document.getElementById(DDL).options[4] = new Option("Bulgarian","Bulgarian");
 document.getElementById(DDL).options[5] = new Option("Chinese","Chinese");
 document.getElementById(DDL).options[6] = new Option("Croatian","Croatian");
 document.getElementById(DDL).options[7] = new Option("Czech","Czech");
 document.getElementById(DDL).options[8] = new Option("Danish","Danish");
 document.getElementById(DDL).options[9] = new Option("Dutch","Dutch");
 document.getElementById(DDL).options[10] = new Option("English","English");
 document.getElementById(DDL).options[11] = new Option("Filipino","Filipino");
 document.getElementById(DDL).options[12] = new Option("Finnish","Finnish");
 document.getElementById(DDL).options[13] = new Option("French","French");  
 document.getElementById(DDL).options[14] = new Option("German","German");
 document.getElementById(DDL).options[15] = new Option("Greek","Greek"); 
 document.getElementById(DDL).options[16] = new Option("Hebrew","Hebrew"); 
 document.getElementById(DDL).options[17] = new Option("Hindi","Hindi");  
 document.getElementById(DDL).options[18] = new Option("Hungarian","Hungarian");
 document.getElementById(DDL).options[19] = new Option("Italian","Italian");
 document.getElementById(DDL).options[20] = new Option("Japanese","Japanese");
 document.getElementById(DDL).options[21] = new Option("Korean","Korean");
 document.getElementById(DDL).options[22] = new Option("Khmer","Khmer"); 
 document.getElementById(DDL).options[23] = new Option("Lao","Lao"); 
 document.getElementById(DDL).options[24] = new Option("Latvian","Latvian"); 
 document.getElementById(DDL).options[25] = new Option("Lithuanian","Lithuanian"); 
 document.getElementById(DDL).options[26] = new Option("Malay","Malay"); 
 document.getElementById(DDL).options[27] = new Option("Maltese","Maltese"); 
 document.getElementById(DDL).options[28] = new Option("Maori","Maori"); 
 document.getElementById(DDL).options[29] = new Option("Mongolian","Mongolian"); 
 document.getElementById(DDL).options[30] = new Option("Nepali","Nepali");  
 document.getElementById(DDL).options[31] = new Option("Norwegian","Norwegian");
 document.getElementById(DDL).options[32] = new Option("Persian","Persian");  
 document.getElementById(DDL).options[33] = new Option("Polish","Polish");
 document.getElementById(DDL).options[34] = new Option("Portuguese","Portuguese");  
 document.getElementById(DDL).options[35] = new Option("Romanian","Romanian"); 
 document.getElementById(DDL).options[36] = new Option("Russian","Russian");
 document.getElementById(DDL).options[37] = new Option("Sanskrit","Sanskrit");  
 document.getElementById(DDL).options[38] = new Option("Serbian","Serbian");  
 document.getElementById(DDL).options[39] = new Option("Slovak","Slovak");  
 document.getElementById(DDL).options[40] = new Option("Slovenian","Slovenian");  
 document.getElementById(DDL).options[41] = new Option("Spanish","Spanish"); 
 document.getElementById(DDL).options[42] = new Option("Swedish","Swedish");
 document.getElementById(DDL).options[43] = new Option("Swahili","Swahili"); 
 document.getElementById(DDL).options[44] = new Option("Tamil","Tamil"); 
 document.getElementById(DDL).options[45] = new Option("Thai","Thai");
 document.getElementById(DDL).options[46] = new Option("Tibetan","Tibetan");
 document.getElementById(DDL).options[47] = new Option("Turkmen","Turkmen");
 document.getElementById(DDL).options[48] = new Option("Turkish","Turkish");   
 document.getElementById(DDL).options[49] = new Option("Uighur","Uighur");
 document.getElementById(DDL).options[50] = new Option("Ukrainian","Ukrainian");
 document.getElementById(DDL).options[51] = new Option("Urdu","Urdu"); 
 document.getElementById(DDL).options[52] = new Option("Uzbek","Uzbek");
 document.getElementById(DDL).options[53] = new Option("Vietnamese","Vietnamese");
 document.getElementById(DDL).options[54] = new Option("Welsh","Welsh");
 document.getElementById(DDL).options[55] = new Option("Xhosa","Xhosa");
 document.getElementById(DDL).options[56] = new Option("Zulu","Zulu");
 
 
  
 document.getElementById(DDL).options[document.getElementById(DDL).selectedIndex].text=SelectedValue;
 document.getElementById(DDL).options[document.getElementById(DDL).selectedIndex].value=SelectedValue; 
}

//Cancel eProfile Window

function ProfileCancel()
{
    document.getElementById("ctl00_MainContentPlaceHolder_txtTile").value="";        
    document.getElementById("ctl00_MainContentPlaceHolder_txtViewingFee").value="";    
    document.getElementById("ctl00_MainContentPlaceHolder_txtServiceFee").value="";    
    document.getElementById("ctl00_MainContentPlaceHolder_txtNetamount").value="";        
    document.getElementById("ctl00_MainContentPlaceHolder_txteProfileTag").value="";    
    document.getElementById("ctl00_MainContentPlaceHolder_HF_eProfile_File").value="";         
    ClearFileUpload(document.getElementById("ctl00_MainContentPlaceHolder_FU_eprofile"));        
    ClearFileUpload(document.getElementById("ctl00_MainContentPlaceHolder_FU_Image"));    
    document.getElementById("ctl00_MainContentPlaceHolder_trediteProfile").style.display="none";  
    document.getElementById("trFee").style.display="none";    
    document.getElementById("trServiceFee").style.display="none";    
    document.getElementById("trNetAmount").style.display="none";        
    document.getElementById("ctl00_MainContentPlaceHolder_rblVisibility_0").checked=true;
    document.getElementById("ctl00_MainContentPlaceHolder_rblChargeable_1").checked=true;
    document.getElementById("divuploadeprofile").style.display ="none"; 
    document.getElementById("ctl00_MainContentPlaceHolder_ddlSeries").disabled=false;
    document.getElementById("ctl00_MainContentPlaceHolder_txtactivationkey").disabled=false;
}


function PhotoCancel()
{
    document.getElementById("ctl00_MainContentPlaceHolder_txtPhotoTile").value="";        
    document.getElementById("ctl00_MainContentPlaceHolder_txtPhotoViewingFee").value="";
    document.getElementById("ctl00_MainContentPlaceHolder_txtphotoServiceFee").value="";
    document.getElementById("ctl00_MainContentPlaceHolder_txtphotoNetamount").value="";        
    document.getElementById("ctl00_MainContentPlaceHolder_txtPhotoDescription").value="";    
    document.getElementById("ctl00_MainContentPlaceHolder_HF_Photo_File").value="";    
    document.getElementById("ctl00_MainContentPlaceHolder_treditphoto").style.display="none";  
    document.getElementById("trPhotoFee").style.display="none";
    document.getElementById("ctl00_MainContentPlaceHolder_rblPhotoVisibility_0").checked=true;
    document.getElementById("ctl00_MainContentPlaceHolder_rblPhotoChargeable_1").checked=true;
    ClearFileUpload(document.getElementById("ctl00_MainContentPlaceHolder_FU_UploadFile"));
    document.getElementById("divuploadphotograph").style.display ="none";
}

function VideoCancel()
{
    document.getElementById("ctl00_MainContentPlaceHolder_txtVideoTile").value="";        
    document.getElementById("ctl00_MainContentPlaceHolder_txtVideoViewingFee").value="";
    document.getElementById("ctl00_MainContentPlaceHolder_txtvideoServiceFee").value="";
    document.getElementById("ctl00_MainContentPlaceHolder_txtvideoNetamount").value="";
    document.getElementById("ctl00_MainContentPlaceHolder_txtVideoDescription").value="";    
    document.getElementById("ctl00_MainContentPlaceHolder_HF_Video_File").value="";    
    document.getElementById("ctl00_MainContentPlaceHolder_treditvideo").style.display="none";        
    document.getElementById("trVideoFee").style.display="none";
    document.getElementById("ctl00_MainContentPlaceHolder_rblVideoVisibility_0").checked=true;
    document.getElementById("ctl00_MainContentPlaceHolder_rblVideoChargeable_1").checked=true;
    ClearFileUpload(document.getElementById("ctl00_MainContentPlaceHolder_FU_UploadVideos"));
    document.getElementById("divuploadvideo").style.display ="none";
}

function FileCancel()
{     
    document.getElementById("ctl00_MainContentPlaceHolder_txtFileTitle").value="";        
    document.getElementById("ctl00_MainContentPlaceHolder_txtFileViewingFee").value="";
    document.getElementById("ctl00_MainContentPlaceHolder_txtfileServiceFee").value="";
    document.getElementById("ctl00_MainContentPlaceHolder_txtFileNetamount").value="";
    document.getElementById("ctl00_MainContentPlaceHolder_txtFileDescription").value="";    
    document.getElementById("ctl00_MainContentPlaceHolder_HF_File_File").value="";        
    document.getElementById("ctl00_MainContentPlaceHolder_treditfile").style.display="none";  
    document.getElementById("trFileFee").style.display="none";      
    document.getElementById("ctl00_MainContentPlaceHolder_rblFileVisibility_0").checked=true;
    document.getElementById("ctl00_MainContentPlaceHolder_rblFileChargeable_1").checked=true;
    ClearFileUpload(document.getElementById("ctl00_MainContentPlaceHolder_FU_UploadFiles"));
    document.getElementById("divuploadFile").style.display ="none";
}

function ClearFileUpload(ctrl)
{
var fil = ctrl;
fil.select();
n=fil.createTextRange();
n.execCommand('delete');
fil.focus();
}

function ViewingFee(from)
  {  
   exp=(/(^(\\+|-)?[0-9][0-9]*(\\.[0-9]*)?$)/);
   var premium=document.getElementById("ctl00_MainContentPlaceHolder_admin_fee").value;
   var fee=document.getElementById("ctl00_MainContentPlaceHolder_txt"+from+"ViewingFee").value;    
   if(fee< 2)
   {
     alert('Please enter an Integer value greater than or equal to 2')
     document.getElementById("ctl00_MainContentPlaceHolder_txt"+from+"ViewingFee").value="";
     document.getElementById("ctl00_MainContentPlaceHolder_txt"+from+"ServiceFee").value="";
	 document.getElementById("ctl00_MainContentPlaceHolder_txt"+from+"Netamount").value="";
     return false;
    }
    else
     {     
	    if (!exp.test(fee)){
	    alert('Please enter an Integer value greater than or equal to 2')
	    document.getElementById("ctl00_MainContentPlaceHolder_txt"+from+"ViewingFee").value="";
        document.getElementById("ctl00_MainContentPlaceHolder_txt"+from+"ServiceFee").value="";
	    document.getElementById("ctl00_MainContentPlaceHolder_txt"+from+"Netamount").value="";
         return false; 
         }
         else
          {
            var total=(parseInt(fee)*parseInt(premium))/100                     
            document.getElementById("ctl00_MainContentPlaceHolder_txt"+from+"ServiceFee").value=Math.floor(total);
            document.getElementById("ctl00_MainContentPlaceHolder_txt"+from+"Netamount").value=Math.ceil(total);
            return true;
          }
       }
    }
