var student=null;(jQuery)(document).ready(function(){var tabLink="#1";var autocompetecache={},lastXhr;start();function start(){(jQuery)("#fb-text").focus(function(){(jQuery)(this).val("");});(jQuery).ajax({data:"",url:"cv/index.php",success:function(data){var data1=data.split("&&");if(data1[0]=="login"){(jQuery)("#cv-content").hide('blind');(jQuery)("#cv-content").html(data1[1]);(jQuery)("#cv-content").show('blind','slow');logInit();}else if(data1[0]=="cv-login-success"){student=(jQuery).parseJSON(data1[2]);(jQuery)("#cv-content").hide('blind','slow');(jQuery)("#cv-content").html(data1[1]);(jQuery)("#cv-content").show('blind','slow');appInit();}else if(data1[0]=="pass_change"){(jQuery)("#cv-content").hide('blind');(jQuery)("#cv-content").html(data1[1]);(jQuery)("#cv-content").show('blind','slow');(jQuery)("#ch-stdChange").button().click(function(){var pass1=(jQuery)("#ch-stdPass1").val();var pass2=(jQuery)("#ch-stdPass2").val();var key=(jQuery)("#ch-stdKey").val();(jQuery)(".cv-alert").remove();if(pass1==pass2){(jQuery)("#ch-stdForm").append("<center><div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div><center>");(jQuery)("#ch-stdForm :input").attr("disabled",true);var text="action=changePassword&pass="+pass1+"&key="+key+"&";(jQuery).ajax({data:text,url:"cv/recovery.php",success:function(data){var data1=data.split("&&");if(data1[0]=="change_success"){alert(data1[1]);GoToLoginForm();}else{alert(data1[1]);}
(jQuery)("#ch-stdForm :input").attr("disabled",false);(jQuery)("#cv-loading-parent").remove();},type:'POST'});}else{var div=(jQuery)("<div class='cv-alert ui-state-error ui-corner-all' title='Lozinke se ne podudaraju!'></div>");(jQuery)(div).css("float","left");(jQuery)(div).width(16);(jQuery)(div).append("<center><span class='ui-icon ui-icon-alert'></span></center>");(jQuery)("#ch-stdPass2").parent().append(div);}});}},type:'POST'});};function logInit(){(jQuery)("#log-stdLogin").button().click(function(){if(formCheck((jQuery)("#log-stdForm"))){LoginUser();}});(jQuery)("#log-stdReg").click(function(){GoToRegisterForm();});(jQuery)("#log-stdRecovery").click(function(){GoToRecoveryForm();});(jQuery)('#log-stdPass').bind('keypress',function(e){if(e.keyCode==13){(jQuery)("#log-stdLogin").trigger("click");}});}
function recoveryInit(){(jQuery)("#rec-stdRecover").button().click(function(){RecoverPass();});(jQuery)("#rec-stdBack").button().click(function(){GoToLoginForm();});(jQuery)("#rec-stdReg").click(function(){GoToRegisterForm();});}
function regInit(){(jQuery)("#cv-register").button().click(function(){RegisterUser();});(jQuery)("#reg-stdBack").button().click(function(){GoToLoginForm();});(jQuery)(".cv-datepicker").keydown(function(e){e.preventDefault();});(jQuery)(".cv-integers").forceNumeric(0);(jQuery)(".cv-positive-numbers").forceNumeric(1);(jQuery)(".cv-citySearch").autocomplete({minLength:1,source:function(request,response){var term=request.term;if(term in autocompetecache){response(autocompetecache[term]);return;}
lastXhr=(jQuery).getJSON("cv/searchCity.php",request,function(data,status,xhr){autocompetecache[term]=data;if(xhr===lastXhr){response(data);}});},select:function(event,ui){this.removeClass("ui-autocomplete-loading");}}).focusout(function(){this.removeClass("ui-autocomplete-loading");});(jQuery)("#lp-stdBDate").datepicker({defaultDate:"-20y",changeMonth:true,changeYear:true,dateFormat:"dd-mm-yy",constrainInput:true});(jQuery)("#lp-stdEmail").blur(function(e){(jQuery).ajax({data:"data="+this.value+"&",url:"cv/checkEmail.php",success:function(data){if(data=="false"){(jQuery)(".cv-alert").remove();var div=(jQuery)("<div class='cv-alert ui-state-error ui-corner-all' title='Dat email vec postoji u nasoj bazi!'></div>");(jQuery)(div).css("float","left");(jQuery)(div).width(16);(jQuery)(div).append("<center><span class='ui-icon ui-icon-alert'></span></center>");(jQuery)("#lp-stdEmail").parent().append(div);}},type:'POST'});});}
function appInit(){setScoreBarPosition();window.fbAsyncInit=function(){FB.init({appId:'230468043676033',status:true,cookie:true,xfbml:true,oauth:true});};(function(d){var js,id='facebook-jssdk';if(d.getElementById(id)){return;}
js=d.createElement('script');js.id=id;js.async=true;js.src="//connect.facebook.net/en_US/all.js";d.getElementsByTagName('head')[0].appendChild(js);}
(document));(jQuery)(".cv-scoreBar").css("display","block");(jQuery)("#cv-logout").button().click(function(){student=null;(jQuery)(".cv-scoreBar").css("display","none");GoToLoginForm();});(jQuery)("#cvAccordion").accordion({autoHeight:false,navigation:true});(jQuery)(".cv-menuItem").click(function(e){var retVal=true;if(tabLink=="#1"){if(formCheck((jQuery)("#lp-stdForm"))){savePersonalInfo();tabLink=this.hash;}else{e.stopImmediatePropagation();retVal=false;}}else if(tabLink=="#2"){if(formCheck((jQuery)("#so-stdForm"))){saveHighSchool();tabLink=this.hash;}else{e.stopImmediatePropagation();retVal=false;}}else if(tabLink=="#11"){saveMisc();tabLink=this.hash;}else{tabLink=this.hash;}
getGlobalScore(student);return retVal;});(jQuery)(".ui-icon-triangle-1-e").click(function(e){(jQuery)(".cv-menuItem").trigger("click");return false;});(jQuery)("#lp-stdSavePersonal").click(function(){if(formCheck((jQuery)("#lp-stdForm"))){savePersonalInfo();}});(jQuery)("#so-stdSaveHighschool").click(function(){if(formCheck((jQuery)("#so-stdForm"))){saveHighSchool();}});(jQuery)("#oi-stdSaveMisc").click(function(){saveMisc();});(jQuery)(".cv-datepicker").keydown(function(e){e.preventDefault();});(jQuery)(".cv-integers").forceNumeric(0);(jQuery)(".cv-positive-numbers").forceNumeric(1);(jQuery)(".cv-citySearch").autocomplete({minLength:1,source:function(request,response){var term=request.term;if(term in autocompetecache){response(autocompetecache[term]);return;}
lastXhr=(jQuery).getJSON("cv/searchCity.php",request,function(data,status,xhr){autocompetecache[term]=data;if(xhr===lastXhr){response(data);}});},select:function(event,ui){this.removeClass("ui-autocomplete-loading");}}).focusout(function(){this.removeClass("ui-autocomplete-loading");});(jQuery)(".cv-langSearch").autocomplete({minLength:1,source:function(request,response){var term=request.term;if(term in autocompetecache){response(autocompetecache[term]);return;}
lastXhr=(jQuery).getJSON("cv/searchLang.php",request,function(data,status,xhr){autocompetecache[term]=data;if(xhr===lastXhr){response(data);}});},select:function(event,ui){this.removeClass("ui-autocomplete-loading");}}).focusout(function(){this.removeClass("ui-autocomplete-loading");});(jQuery)(".cv-year-picker").datepicker({dateFormat:'yy',changeYear:true,showButtonPanel:true,stepMonths:12,monthNames:['','','','','','','','','','','',''],yearRange:'1980:2015',closeText:'Izaberi',currentText:'Danas',onClose:function(dateText,inst){var year=(jQuery)("#ui-datepicker-div .ui-datepicker-year :selected").val();(jQuery)(this).val((jQuery).datepicker.formatDate('yy',new Date(year,1,1)));},onChangeMonthYear:function(year,month,inst){(jQuery)(this).val((jQuery).datepicker.formatDate('yy',new Date(year,1,0)));}});(jQuery)(".cv-year-picker").focus(function(){(jQuery)(".ui-datepicker-calendar").hide();});(jQuery)(".cv-year-month-picker").datepicker({dateFormat:'MM yy',changeYear:true,changeMonth:true,showButtonPanel:true,yearRange:'1970:2015',monthNamesShort:['Jan','Feb','Mar','Apr','Maj','Jun','Jul','Avg','Sep','Okt','Nov','Dec'],closeText:'Izaberi',currentText:'Danas',onClose:function(dateText,inst){var month=(jQuery)("#ui-datepicker-div .ui-datepicker-month :selected").val();var year=(jQuery)("#ui-datepicker-div .ui-datepicker-year :selected").val();(jQuery)(this).val((jQuery).datepicker.formatDate('MM yy',new Date(year,month,1),{monthNames:['Januar','Februar','Mart','April','Maj','Jun','Jul','Avgust','Septembar','Oktobar','Novembar','Decembar']}));},onChangeMonthYear:function(year,month,inst){(jQuery)(this).val((jQuery).datepicker.formatDate('MM yy',new Date(year,month,0),{monthNames:['Januar','Februar','Mart','April','Maj','Jun','Jul','Avgust','Septembar','Oktobar','Novembar','Decembar']}));}});(jQuery)(".cv-year-month-picker").focus(function(){(jQuery)(".ui-datepicker-calendar").hide();});(jQuery)("#lp-stdBDate").datepicker({defaultDate:"-20y",changeMonth:true,changeYear:true,dateFormat:"dd-mm-yy",constrainInput:true});function savePersonalInfo(){var stud=new Student();stud.name=(jQuery)("#lp-stdName").val();stud.pname=(jQuery)("#lp-stdPName").val();stud.sname=(jQuery)("#lp-stdSName").val();stud.gender=(jQuery)("#lp-stdGender").val();stud.bdate=(jQuery)("#lp-stdBDate").val();stud.email=(jQuery)("#lp-stdEmail").val();stud.address1=(jQuery)("#lp-stdAddress1").val();stud.city1=(jQuery)("#lp-stdCity1").val();stud.state1=(jQuery)("#lp-stdState1").val();stud.address2=(jQuery)("#lp-stdAddress2").val();stud.city2=(jQuery)("#lp-stdCity2").val();stud.state2=(jQuery)("#lp-stdState2").val();stud.phone1=(jQuery)("#lp-stdPhone1").val();stud.phone2=(jQuery)("#lp-stdPhone2").val();if(!isPersonalDataChanged(stud))
return;(jQuery)("#lp-stdForm :input").attr("disabled",true);(jQuery)("#cv-menuPersonalInfo").html("Licni podaci (Snimanje u toku...)");(jQuery)("#cv-menuPersonalInfo").css("font-weight","bold");text="action=savePersonal&data="+encodeURIComponent(JSON.stringify(stud))+"&";(jQuery).ajax({data:text,url:"cv/student.php",success:function(data){var data1=data.split("&&");if(data1[0]=="student_success"){(jQuery)("#cv-menuPersonalInfo").css("font-weight","normal");student.name=stud.name;student.pname=stud.pname;student.sname=stud.sname;student.gender=stud.gender;student.bdate=stud.bdate;student.email=stud.email;student.address1=stud.address1;student.address2=stud.address2
student.city1=stud.city1;student.city2=stud.city2;student.state1=stud.state1;student.state2=stud.state2;student.phone1=stud.phone1;student.phone2=stud.phone2;getGlobalScore(student);}else if(data1[0]=="student_nsuccess"){alert(data1[1]);}else{alert(data);}
(jQuery)("#lp-stdForm :input").attr("disabled",false);(jQuery)("#cv-menuPersonalInfo").html("Licni podaci");},type:'POST'});}
(jQuery)("#so-stdCity").autocomplete({minLength:1,source:function(request,response){var term=request.term;if(term in autocompetecache){response(autocompetecache[term]);return;}
lastXhr=(jQuery).getJSON("cv/searchCity.php",request,function(data,status,xhr){autocompetecache[term]=data;if(xhr===lastXhr){response(data);}});},select:function(event,ui){this.removeClass("ui-autocomplete-loading");}}).focusout(function(){this.removeClass("ui-autocomplete-loading");});function saveHighSchool(){var school=new HighSchool();school.name=(jQuery)("#so-stdName").val();school.city=(jQuery)("#so-stdCity").val();school.state=(jQuery)("#so-stdState").val();school.course=(jQuery)("#so-stdCourse").val();school.gyear=(jQuery)("#so-stdGYear").val();school.type=(jQuery)("#so-stdType").val();if(!isHighSchoolChanged(school))
return;(jQuery)("#so-stdForm :input").attr("disabled",true);(jQuery)("#cv-menuHighSchool").html("Srednje obrazovanje (Snimanje u toku...)");(jQuery)("#cv-menuHighSchool").css("font-weight","bold");text="action=saveHighschool&data="+encodeURIComponent(JSON.stringify(school))+"&";(jQuery).ajax({data:text,url:"cv/student.php",success:function(data){var data1=data.split("&&");if(data1[0]=="highschool_success"){(jQuery)("#cv-menuHighSchool").css("font-weight","normal");student.highschool.name=school.name;student.highschool.city=school.city;student.highschool.state=school.state;student.highschool.course=school.course;student.highschool.gyear=school.gyear;student.highschool.type=school.type;getGlobalScore(student);}else if(data1[0]=="highschool_success"){alert(data1[1]);}else{alert(data);}
(jQuery)("#so-stdForm :input").attr("disabled",false);(jQuery)("#cv-menuHighSchool").html("Srednje obrazovanje");},type:'POST'});}
(jQuery)("#dialog:ui-dialog").dialog("destroy");(jQuery)("#vo-stdForm").dialog({autoOpen:false,height:760,width:648,modal:true,draggable:false,resizable:false,title:"Dodaj novo visoko obrazovanje:"});(jQuery)("#vo-stdAddNewEducation").click(function(){(jQuery)("#vo-stdForm").dialog("option","buttons",[{text:"Dodaj",click:function(){if(formCheck("#vo-stdForm")){student.faculties[student.faculties.length]=AddNewFaculty();(jQuery)("#vo-stdContent-Faculties").removeAttr('hidden');return true;}else
return false;}},{text:"Nazad",click:function(){(jQuery)(this).dialog("close");}}]);ClearForm((jQuery)("#vo-stdForm"));(jQuery)("#vo-stdForm").dialog("open");});(jQuery)(".cv-vo-graduated-only").parent().parent().hide();(jQuery)(".cv-vo-final-only").parent().parent().hide();(jQuery)("#vo-stdStatus").change(function(){if((jQuery)(this).val()=="Student"){(jQuery)(".cv-vo-student-only").parent().parent().show();(jQuery)(".cv-vo-graduated-only").parent().parent().hide();(jQuery)(".cv-vo-final-only").parent().parent().hide();}else if((jQuery)(this).val()=="Apsolvent"){(jQuery)(".cv-vo-student-only").parent().parent().hide();(jQuery)(".cv-vo-graduated-only").parent().parent().hide();(jQuery)(".cv-vo-final-only").parent().parent().show();}else{(jQuery)(".cv-vo-student-only").parent().parent().hide();(jQuery)(".cv-vo-graduated-only").parent().parent().show();(jQuery)(".cv-vo-final-only").parent().parent().hide();}});(jQuery)(".cv-vo-delete").click(function(){var id=(jQuery)(this).next().val();deleteFaculty(id);});(jQuery)(".cv-vo-edit").click(function(){var id=(jQuery)(this).next().next().val();getFacultyInfo(id);});(jQuery)("#vo-stdUni").change(function(){(jQuery)("#vo-stdUni2").remove();(jQuery)("#vo-stdFaculty2").remove();(jQuery)("#vo-stdFaculty").show();if((jQuery)(this).val()=="Nije u listi"){(jQuery)('<input type="text" name="stdUni" id="vo-stdUni2" class="cv-input cv-mandatory"/>').insertAfter(this);(jQuery)('<input type="text" name="stdFaculty" id="vo-stdFaculty2" class="cv-input cv-mandatory"/>').insertAfter((jQuery)("#vo-stdFaculty"));(jQuery)("#vo-stdFaculty").hide();}else{(jQuery)("#vo-stdForm").append("<center><div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div><center>");(jQuery)("#vo-stdForm :input").attr("disabled",true);(jQuery)("#vo-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",true);var text="action=getFacultiesByUni&uni="+encodeURIComponent((jQuery)(this).val())+"&";(jQuery).ajax({data:text,url:"cv/faculty.php",success:function(data){var data1=data.split("&&");if(data1[0]=="faculty_success"){(jQuery)("#vo-stdFaculty option").remove()
var faculties=(jQuery).parseJSON(data1[1]);for(var i=0;i<faculties.length;i++){(jQuery)("#vo-stdFaculty").append('<option value="'+faculties[i]+'">'+faculties[i]+'</option>');}
(jQuery)("#vo-stdFaculty").append('<option value="Nije u listi">Nije u listi</option>');}
(jQuery)("#vo-stdForm :input").attr("disabled",false);(jQuery)("#cv-loading-parent").remove();(jQuery)("#vo-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",false);},type:'POST'});}});(jQuery)("#vo-stdFaculty").change(function(){(jQuery)("#vo-stdFaculty2").remove();if((jQuery)(this).val()=="Nije u listi"){(jQuery)('<input type="text" name="stdFaculty" id="vo-stdFaculty2" class="cv-input cv-mandatory"/>').insertAfter(this);}});function AddNewFaculty(){var fac=new Faculty();if((jQuery)("#vo-stdUni").val()=="Nije u listi"){fac.university=(jQuery)("#vo-stdUni2").val();fac.name=(jQuery)("#vo-stdFaculty2").val();}else{fac.university=(jQuery)("#vo-stdUni").val();if((jQuery)("#vo-stdFaculty").val()=="Nije u listi"){fac.name=(jQuery)("#vo-stdFaculty2").val();}else{fac.name=(jQuery)("#vo-stdFaculty").val();}}
fac.city=(jQuery)("#vo-stdCity").val();fac.state=(jQuery)("#vo-stdState").val();fac.course=(jQuery)("#vo-stdCourse").val();fac.spec=(jQuery)("#vo-stdSpec").val();fac.status=(jQuery)("#vo-stdStatus").val();fac.ayear=(jQuery)("#vo-stdAYear").val();fac.agrade=(jQuery)("#vo-stdAGrade").val();fac.relSub=(jQuery)("#vo-stdRelSub").val();fac.gsub=(jQuery)("#vo-stdNoSub").val();if(fac.status=="Student"){fac.syear=(jQuery)("#vo-stdSYear").val();fac.gyear='';fac.gwork='';fac.rsub='';}else if(fac.status=="Apsolvent"){fac.syear='';fac.rsub=(jQuery)("#vo-stdRSub").val();fac.gyear='';fac.gwork='';}else{fac.syear='';fac.rsub='';fac.gyear=(jQuery)("#vo-stdGYear").val();fac.gwork=(jQuery)("#vo-stdGWork").val();}
(jQuery)("#vo-stdForm").append("<center><div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div><center>");(jQuery)("#vo-stdForm :input").attr("disabled",true);(jQuery)("#vo-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",true);text="action=addFaculty&data="+encodeURIComponent(JSON.stringify(fac))+"&";(jQuery).ajax({data:text,url:"cv/faculty.php",success:function(data){var data1=data.split("&&");if(data1[0]=="faculty_success"){(jQuery)("#cv-loading-parent").remove();fac.id=data1[1];var i=0;var textToInsert=[];textToInsert[i++]="<tr><td>";textToInsert[i++]=fac.name;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=fac.university;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=fac.status;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=fac.syear;textToInsert[i++]="</td><td><span id='vo-edit'";textToInsert[i++]=" title='Pogledaj/Izmeni' class='cv-icon ui-icon ui-icon-pencil cv-vo-edit'></span><span id='vo-del";textToInsert[i++]=" title='Obrisi' class='cv-icon ui-icon ui-icon-trash cv-vo-delete'></span>";textToInsert[i++]="<input id='vo-hInput-"
textToInsert[i++]=fac.id;textToInsert[i++]="' type='hidden' value='";textToInsert[i++]=fac.id;textToInsert[i++]="'/></td></tr>";(jQuery)("#vo-stdContent-Faculties").append(textToInsert.join(''));(jQuery)("#vo-stdContent-Faculties").show();(jQuery)("#vo-stdForm").dialog("close");(jQuery)(".cv-vo-edit").unbind("click");(jQuery)(".cv-vo-edit").click(function(){var facId=(jQuery)(this).next().next().val();getFacultyInfo(facId);});(jQuery)(".cv-vo-delete").unbind("click");(jQuery)(".cv-vo-delete").click(function(){var facId=(jQuery)(this).next().val();deleteFaculty(facId);});getGlobalScore(student);}else if(data1[0]=="faculty_nsuccess"){alert(data1[1]);}
(jQuery)("#vo-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",false);(jQuery)("#vo-stdForm :input").attr("disabled",false);(jQuery)("#cv-loading-parent").remove();},type:'POST'});return fac;}
function getFacultyInfo(id){for(var i=0;i<student.faculties.length;i++){if(student.faculties[i].id==id)
break;}
fac=student.faculties[i];(jQuery)("#vo-stdForm").dialog("open");(jQuery)("#vo-stdUni").val(fac.university);(jQuery)("#vo-stdFaculty").val(fac.name);(jQuery)("#vo-stdCity").val(fac.city);(jQuery)("#vo-stdState").val(fac.state);(jQuery)("#vo-stdCourse").val(fac.course);(jQuery)("#vo-stdSpec").val(fac.spec);(jQuery)("#vo-stdStatus").val(fac.status);(jQuery)("#vo-stdAYear").val(fac.ayear);(jQuery)("#vo-stdGYear").val(fac.gyear==0?"":fac.gyear);(jQuery)("#vo-stdNoSub").val(fac.gsub==0?"":fac.gsub);(jQuery)("#vo-stdSYear").val(fac.syear);(jQuery)("#vo-stdRSub").val(fac.rsub);(jQuery)("#vo-stdAGrade").val(fac.agrade==0?"":fac.agrade);(jQuery)("#vo-stdRelSub").val(fac.relSub);(jQuery)("#vo-stdGWork").val(fac.gwork);(jQuery)("#vo-stdStatus").trigger("change");(jQuery)("#vo-stdForm").dialog("option","buttons",[{text:"Izmeni",click:function(){if(formCheck((jQuery)("#vo-stdForm"))){saveFacultyInfo(id);return true;}else
return false;}},{text:"Nazad",click:function(){(jQuery)(this).dialog("close");}}]);}
function saveFacultyInfo(id){var fac=new Faculty();if((jQuery)("#vo-stdUni").val()=="Nije u listi"){fac.university=(jQuery)("#vo-stdUni2").val();fac.name=(jQuery)("#vo-stdFaculty2").val();}else{fac.university=(jQuery)("#vo-stdUni").val();if((jQuery)("#vo-stdFaculty").val()=="Nije u listi"){fac.name=(jQuery)("#vo-stdFaculty2").val();}else{fac.name=(jQuery)("#vo-stdFaculty").val();}}
fac.city=(jQuery)("#vo-stdCity").val();fac.state=(jQuery)("#vo-stdState").val();fac.course=(jQuery)("#vo-stdCourse").val();fac.spec=(jQuery)("#vo-stdSpec").val();fac.status=(jQuery)("#vo-stdStatus").val();fac.ayear=(jQuery)("#vo-stdAYear").val();fac.agrade=(jQuery)("#vo-stdAGrade").val();fac.relSub=(jQuery)("#vo-stdRelSub").val();fac.gsub=(jQuery)("#vo-stdNoSub").val();if(fac.status=="Student"){fac.syear=(jQuery)("#vo-stdSYear").val();fac.gyear='';fac.gwork='';fac.rsub='';}else if(fac.status=="Apsolvent"){fac.syear='';fac.rsub=(jQuery)("#vo-stdRSub").val();fac.gyear='';fac.gwork='';}else{fac.syear='';fac.rsub='';fac.gyear=(jQuery)("#vo-stdGYear").val();fac.gwork=(jQuery)("#vo-stdGWork").val();}
(jQuery)("#vo-stdForm").append("<center><div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div><center>");(jQuery)("#vo-stdForm :input").attr("disabled",true);(jQuery)("#vo-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",true);fac.id=id;text="action=saveFaculty&data="+encodeURIComponent(JSON.stringify(fac))+"&";(jQuery).ajax({data:text,url:"cv/faculty.php",success:function(data){var data1=data.split("&&");if(data1[0]=="faculty_success"){for(var i=0;i<student.faculties.length;i++){if(student.faculties[i].id==id){student.faculties[i]=fac;break;}}
var i=0;var textToInsert=[];textToInsert[i++]="<tr><td>";textToInsert[i++]=fac.name;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=fac.university;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=fac.status;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=fac.syear;textToInsert[i++]="</td><td><span";textToInsert[i++]=" title='Pogledaj/Izmeni' class='cv-icon ui-icon ui-icon-pencil cv-vo-edit'></span><span";textToInsert[i++]=" title='Obrisi' class='cv-icon ui-icon ui-icon-trash cv-vo-delete'></span>";textToInsert[i++]="<input id='vo-hInput-"
textToInsert[i++]=fac.id;textToInsert[i++]="' type='hidden' value='";textToInsert[i++]=fac.id;textToInsert[i++]="'/></td></tr>";(jQuery)("#vo-hInput-"+id).parent().parent().replaceWith(textToInsert.join(''));(jQuery)(".cv-vo-edit").unbind("click");(jQuery)(".cv-vo-edit").click(function(){var facId=(jQuery)(this).next().next().val();getFacultyInfo(facId);});(jQuery)(".cv-vo-delete").unbind("click");(jQuery)(".cv-vo-delete").click(function(){var facId=(jQuery)(this).next().val();deleteFaculty(facId);});(jQuery)("#cv-loading-parent").remove();(jQuery)("#vo-stdForm").dialog("close");getGlobalScore(student);}else if(data1[0]=="faculty_nsuccess"){alert(data1[1]);}
(jQuery)("#vo-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",false);(jQuery)("#vo-stdForm :input").attr("disabled",false);(jQuery)("#cv-loading-parent").remove();},type:'POST'});return fac;}
function deleteFaculty(id){(jQuery)("#vo-stdFaculties").append("<div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div>");text="action=deleteFaculty&id="+id+"&";(jQuery).ajax({data:text,url:"cv/faculty.php",success:function(data){var data1=data.split("&&");if(data1[0]=="faculty_success"){var index=-1;for(var i=0;i<student.faculties.length;i++){if(student.faculties[i].id==id){index=i;break;}}
student.faculties.splice(index,1);(jQuery)("#vo-hInput-"+id).parent().parent().remove();if(student.faculties.length==0){(jQuery)("#vo-stdContent-Faculties").hide();}
getGlobalScore(student);}else if(data1[0]=="faculty_nsuccess"){alert(data1[1]);}
(jQuery)("#cv-loading-parent").remove();},type:'POST'});}
(jQuery)("#po-stdForm").dialog({autoOpen:false,height:770,width:648,modal:true,draggable:false,resizable:false,title:"Dodaj nove postdiplomske studije:"});(jQuery)("#po-stdAddNewEducation").click(function(){(jQuery)("#po-stdForm").dialog("option","buttons",[{text:"Dodaj",click:function(){if(formCheck((jQuery)("#po-stdForm"))){student.postgrads[student.postgrads.length]=AddNewPostgrad();(jQuery)("#po-stdContent-Faculties").removeAttr('hidden');return true;}else
return false;}},{text:"Nazad",click:function(){(jQuery)(this).dialog("close");}}]);ClearForm((jQuery)("#po-stdForm"));(jQuery)("#po-stdForm").dialog("open");});(jQuery)(".cv-po-graduated-only").parent().parent().hide();(jQuery)(".cv-po-final-only").parent().parent().hide();(jQuery)("#po-stdStatus").change(function(){if((jQuery)(this).val()=="Student"){(jQuery)(".cv-po-student-only").parent().parent().show();(jQuery)(".cv-po-graduated-only").parent().parent().hide();(jQuery)(".cv-po-final-only").parent().parent().hide();}else if((jQuery)(this).val()=="Apsolvent"){(jQuery)(".cv-po-student-only").parent().parent().hide();(jQuery)(".cv-po-graduated-only").parent().parent().hide();(jQuery)(".cv-po-final-only").parent().parent().show();}else{(jQuery)(".cv-po-student-only").parent().parent().hide();(jQuery)(".cv-po-graduated-only").parent().parent().show();(jQuery)(".cv-po-final-only").parent().parent().hide();}});(jQuery)(".cv-po-delete").click(function(){var id=(jQuery)(this).next().val();deletePostgrad(id);});(jQuery)(".cv-po-edit").click(function(){var id=(jQuery)(this).next().next().val();getPostgradInfo(id);});(jQuery)("#po-stdUni").change(function(){(jQuery)("#po-stdUni2").remove();(jQuery)("#po-stdFaculty2").remove();(jQuery)("#po-stdFaculty").show();if((jQuery)(this).val()=="Nije u listi"){(jQuery)('<input type="text" name="stdUni" id="po-stdUni2" class="cv-input cv-mandatory"/>').insertAfter(this);(jQuery)('<input type="text" name="stdFaculty" id="po-stdFaculty2" class="cv-input cv-mandatory"/>').insertAfter((jQuery)("#po-stdFaculty"));;(jQuery)("#po-stdFaculty").hide();}else{(jQuery)("#po-stdForm").append("<center><div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div><center>");(jQuery)("#po-stdForm :input").attr("disabled",true);(jQuery)("#po-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",true);var text="action=getFacultiesByUni&uni="+encodeURIComponent((jQuery)(this).val())+"&";(jQuery).ajax({data:text,url:"cv/faculty.php",success:function(data){var data1=data.split("&&");if(data1[0]=="faculty_success"){(jQuery)("#po-stdFaculty option").remove()
var faculties=(jQuery).parseJSON(data1[1]);for(var i=0;i<faculties.length;i++){(jQuery)("#po-stdFaculty").append('<option value="'+faculties[i]+'">'+faculties[i]+'</option>');}
(jQuery)("#po-stdFaculty").append('<option value="Nije u listi">Nije u listi</option>');}
(jQuery)("#po-stdForm :input").attr("disabled",false);(jQuery)("#cv-loading-parent").remove();(jQuery)("#po-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",false);},type:'POST'});}});(jQuery)("#po-stdFaculty").change(function(){(jQuery)("#po-stdFaculty2").remove();if((jQuery)(this).val()=="Nije u listi"){(jQuery)('<input type="text" name="stdFaculty" id="po-stdFaculty2" class="cv-input cv-mandatory"/>').insertAfter(this);}});function AddNewPostgrad(){var post=new Postgrad();if((jQuery)("#po-stdUni").val()=="Nije u listi"){post.university=(jQuery)("#po-stdUni2").val();post.name=(jQuery)("#po-stdFaculty2").val();}else{post.university=(jQuery)("#po-stdUni").val();if((jQuery)("#po-stdFaculty").val()=="Nije u listi"){post.name=(jQuery)("#po-stdFaculty2").val();}else{post.name=(jQuery)("#po-stdFaculty").val();}}
post.city=(jQuery)("#po-stdCity").val();post.state=(jQuery)("#po-stdState").val();post.type=(jQuery)("#po-stdType").val();post.course=(jQuery)("#po-stdCourse").val();post.spec=(jQuery)("#po-stdSpec").val();post.status=(jQuery)("#po-stdStatus").val();post.ayear=(jQuery)("#po-stdAYear").val();post.agrade=(jQuery)("#po-stdAGrade").val();post.relSub=(jQuery)("#po-stdRelSub").val();post.gsub=(jQuery)("#po-stdNoSub").val();if(post.status=="Student"){post.syear=(jQuery)("#po-stdSYear").val();post.gyear='';post.gwork='';post.rsub='';}else if(post.status=="Apsolvent"){post.syear='';post.rsub=(jQuery)("#po-stdRSub").val();post.gyear='';post.gwork='';}else{post.syear='';post.rsub='';post.gyear=(jQuery)("#po-stdGYear").val();post.gwork=(jQuery)("#po-stdGWork").val();}
(jQuery)("#po-stdForm").append("<center><div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div><center>");(jQuery)("#po-stdForm :input").attr("disabled",true);(jQuery)("#po-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",true);text="action=addPostgrad&data="+encodeURIComponent(JSON.stringify(post))+"&";(jQuery).ajax({data:text,url:"cv/postgrad.php",success:function(data){var data1=data.split("&&");if(data1[0]=="postgrad_success"){(jQuery)("#cv-loading-parent").remove();post.id=data1[1];var i=0;var textToInsert=[];textToInsert[i++]="<tr><td>";textToInsert[i++]=post.name;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=post.university;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=post.status;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=post.syear;textToInsert[i++]="</td><td><span";textToInsert[i++]=" title='Pogledaj/Izmeni' class='cv-icon ui-icon ui-icon-pencil cv-po-edit'></span><span";textToInsert[i++]=" title='Obrisi' class='cv-icon ui-icon ui-icon-trash cv-po-delete'></span>";textToInsert[i++]="<input id='po-hInput-"
textToInsert[i++]=post.id;textToInsert[i++]="' type='hidden' value='";textToInsert[i++]=post.id;textToInsert[i++]="'/></td></tr>";(jQuery)("#po-stdContent-Faculties").append(textToInsert.join(''));(jQuery)("#po-stdContent-Faculties").show();(jQuery)("#po-stdForm").dialog("close");(jQuery)(".cv-po-edit").unbind("click");(jQuery)(".cv-po-edit").click(function(){var facId=(jQuery)(this).next().next().val();getPostgradInfo(facId);});(jQuery)(".cv-po-delete").unbind("click");(jQuery)(".cv-po-delete").click(function(){var facId=(jQuery)(this).next().val();deletePostgrad(facId);});getGlobalScore(student);}else if(data1[0]=="postgrad_nsuccess"){alert(data1[1]);}
(jQuery)("#po-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",false);(jQuery)("#po-stdForm :input").attr("disabled",false);(jQuery)("#cv-loading-parent").remove();},type:'POST'});return post;}
function getPostgradInfo(id){for(var i=0;i<student.postgrads.length;i++){if(student.postgrads[i].id==id)
break;}
post=student.postgrads[i];(jQuery)("#po-stdForm").dialog("open");(jQuery)("#po-stdUni").val(post.university);(jQuery)("#po-stdFaculty").val(post.name);(jQuery)("#po-stdCity").val(post.city);(jQuery)("#po-stdState").val(post.state);(jQuery)("#po-stdType").val(post.type);(jQuery)("#po-stdCourse").val(post.course);(jQuery)("#po-stdSpec").val(post.spec);(jQuery)("#po-stdStatus").val(post.status);(jQuery)("#po-stdAYear").val(post.ayear);(jQuery)("#po-stdGYear").val(post.gyear==0?"":post.gyear);(jQuery)("#po-stdNoSub").val(post.gsub==0?"":post.gsub);(jQuery)("#po-stdSYear").val(post.syear);(jQuery)("#po-stdRSub").val(post.rsub);(jQuery)("#po-stdAGrade").val(post.agrade==0?"":post.agrade);(jQuery)("#po-stdRelSub").val(post.relSub);(jQuery)("#po-stdGWork").val(post.gwork);(jQuery)("#po-stdStatus").trigger("change");(jQuery)("#po-stdForm").dialog("option","buttons",[{text:"Izmeni",click:function(){if(formCheck((jQuery)("#po-stdForm"))){savePostgradInfo(id);return true;}else
return false;}},{text:"Nazad",click:function(){(jQuery)(this).dialog("close");}}]);}
function savePostgradInfo(id){var post=new Postgrad();if((jQuery)("#po-stdUni").val()=="Nije u listi"){post.university=(jQuery)("#po-stdUni2").val();post.name=(jQuery)("#po-stdFaculty2").val();}else{post.university=(jQuery)("#po-stdUni").val();if((jQuery)("#po-stdFaculty").val()=="Nije u listi"){post.name=(jQuery)("#po-stdFaculty2").val();}else{post.name=(jQuery)("#po-stdFaculty").val();}}
post.city=(jQuery)("#po-stdCity").val();post.state=(jQuery)("#po-stdState").val();post.type=(jQuery)("#po-stdType").val();post.course=(jQuery)("#po-stdCourse").val();post.spec=(jQuery)("#po-stdSpec").val();post.status=(jQuery)("#po-stdStatus").val();post.ayear=(jQuery)("#po-stdAYear").val();post.agrade=(jQuery)("#po-stdAGrade").val();post.relSub=(jQuery)("#po-stdRelSub").val();post.gsub=(jQuery)("#po-stdNoSub").val();if(post.status=="Student"){post.syear=(jQuery)("#po-stdSYear").val();post.gyear='';post.gwork='';post.rsub='';}else if(post.status=="Apsolvent"){post.syear='';post.rsub=(jQuery)("#po-stdRSub").val();post.gyear='';post.gwork='';}else{post.syear='';post.rsub='';post.gyear=(jQuery)("#po-stdGYear").val();post.gwork=(jQuery)("#po-stdGWork").val();}
(jQuery)("#po-stdForm").append("<center><div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div><center>");(jQuery)("#po-stdForm :input").attr("disabled",true);(jQuery)("#po-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",true);post.id=id;text="action=savePostgrad&data="+encodeURIComponent(JSON.stringify(post))+"&";(jQuery).ajax({data:text,url:"cv/postgrad.php",success:function(data){var data1=data.split("&&");if(data1[0]=="postgrad_success"){for(var i=0;i<student.postgrads.length;i++){if(student.postgrads[i].id==id){student.postgrads[i]=post;break;}}
var i=0;var textToInsert=[];textToInsert[i++]="<tr><td>";textToInsert[i++]=post.name;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=post.university;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=post.status;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=post.syear;textToInsert[i++]="</td><td><span";textToInsert[i++]=" title='Pogledaj/Izmeni' class='cv-icon ui-icon ui-icon-pencil cv-po-edit'></span><span ";textToInsert[i++]=" title='Obrisi' class='cv-icon ui-icon ui-icon-trash cv-po-delete'></span>";textToInsert[i++]="<input id='po-hInput-"
textToInsert[i++]=post.id;textToInsert[i++]="' type='hidden' value='";textToInsert[i++]=post.id;textToInsert[i++]="'/></td></tr>";(jQuery)("#po-hInput-"+id).parent().parent().replaceWith(textToInsert.join(''));(jQuery)(".cv-po-edit").unbind("click");(jQuery)(".cv-po-edit").click(function(){var facId=(jQuery)(this).next().next().val();getPostgradInfo(facId);});(jQuery)(".cv-po-delete").unbind("click");(jQuery)(".cv-po-delete").click(function(){var facId=(jQuery)(this).next().val();deletePostgrad(facId);});(jQuery)("#cv-loading-parent").remove();(jQuery)("#po-stdForm").dialog("close");getGlobalScore(student);}else if(data1[0]=="postgrad_nsuccess"){alert(data1[1]);}
(jQuery)("#po-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",false);(jQuery)("#po-stdForm :input").attr("disabled",false);(jQuery)("#cv-loading-parent").remove();},type:'POST'});return post;}
function deletePostgrad(id){(jQuery)("#po-stdFaculties").append("<div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div>");text="action=deletePostgrad&id="+id+"&";(jQuery).ajax({data:text,url:"cv/postgrad.php",success:function(data){var data1=data.split("&&");if(data1[0]=="postgrad_success"){var index=-1;for(var i=0;i<student.postgrads.length;i++){if(student.postgrads[i].id==id){index=i;break;}}
student.postgrads.splice(index,1);(jQuery)("#po-hInput-"+id).parent().parent().remove();if(student.postgrads.length==0){(jQuery)("#po-stdContent-Faculties").hide();}
getGlobalScore(student);}else if(data1[0]=="postgrad_nsuccess"){alert(data1[1]);}
(jQuery)("#cv-loading-parent").remove();},type:'POST'});}
(jQuery)("#dialog:ui-dialog").dialog("destroy");(jQuery)("#ri-stdForm").dialog({autoOpen:false,height:500,width:648,modal:true,draggable:false,resizable:false,title:"Dodaj novo radno iskustvo:"});(jQuery)(".cv-ri-delete").click(function(){var id=(jQuery)(this).next().val();(jQuery)(this).unbind("click");deleteWork(id);});(jQuery)(".cv-ri-edit").click(function(){var id=(jQuery)(this).next().next().val();getWorkInfo(id);});(jQuery)("#ri-stdAddNewWork").click(function(){(jQuery)("#ri-stdForm").dialog("option","buttons",[{text:"Dodaj",click:function(){if(formCheck((jQuery)("#ri-stdForm"))){student.workexp[student.workexp.length]=AddNewWork();(jQuery)("#ri-stdContent-Works").removeAttr('hidden');return true;}else
return false;}},{text:"Nazad",click:function(){(jQuery)(this).dialog("close");}}]);ClearForm((jQuery)("#ri-stdForm"));(jQuery)("#ri-stdForm").dialog("open");});(jQuery)("#ri-stdStillWorking").click(function(){if(this.checked){(jQuery)("#ri-stdEDate").val("");(jQuery)("#ri-stdEDate").attr("disabled","");}
if(!this.checked){(jQuery)("#ri-stdEDate").removeAttr("disabled");}});function AddNewWork(){var work=new WorkExp();work.company=(jQuery)("#ri-stdOrgKomp").val();work.func=(jQuery)("#ri-stdFunction").val();work.desc=(jQuery)("#ri-stdJob").val();work.dbegin=(jQuery)("#ri-stdBDate").val();if((jQuery)("#ri-stdStillWorking").is(':checked')==true){work.dend="Rad u toku";}else{work.dend=(jQuery)("#ri-stdEDate").val();}
(jQuery)("#ri-stdForm").append("<center><div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div><center>");(jQuery)("#ri-stdForm :input").attr("disabled",true);(jQuery)("#ri-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",true);text="action=addWork&data="+encodeURIComponent(JSON.stringify(work))+"&";(jQuery).ajax({data:text,url:"cv/work.php",success:function(data){var data1=data.split("&&");if(data1[0]=="work_success"){(jQuery)("#cv-loading-parent").remove();work.id=data1[1];var i=0;var textToInsert=[];textToInsert[i++]="<tr><td>";textToInsert[i++]=work.company;textToInsert[i++]="</td><td>";textToInsert[i++]=work.func;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=work.dbegin;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=work.dend=="Rad u toku"?"Rad u toku":work.dend;textToInsert[i++]="</td><td><span";textToInsert[i++]=" title='Pogledaj/Izmeni' class='cv-icon ui-icon ui-icon-pencil cv-ri-edit'></span><span";textToInsert[i++]=" title='Obrisi' class='cv-icon ui-icon ui-icon-trash cv-ri-delete'></span>";textToInsert[i++]="<input id='ri-hInput-"
textToInsert[i++]=work.id;textToInsert[i++]="' type='hidden' value='";textToInsert[i++]=work.id;textToInsert[i++]="'/></td></tr>";(jQuery)("#ri-stdContent-Works").append(textToInsert.join(''));(jQuery)("#ri-stdContent-Works").show();(jQuery)("#ri-stdForm").dialog("close");(jQuery)(".cv-ri-edit").unbind("click");(jQuery)(".cv-ri-edit").click(function(){var facId=(jQuery)(this).next().next().val();getWorkInfo(facId);});(jQuery)(".cv-ri-delete").unbind("click");(jQuery)(".cv-ri-delete").click(function(){var facId=(jQuery)(this).next().val();deleteWork(facId);});getGlobalScore(student);}else if(data1[0]=="work_nsuccess"){alert(data1[1]);}
(jQuery)("#ri-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",false);(jQuery)("#ri-stdForm :input").attr("disabled",false);(jQuery)("#cv-loading-parent").remove();},type:'POST'});return work;}
function getWorkInfo(id){ClearForm((jQuery)("#ri-stdForm"));for(var i=0;i<student.workexp.length;i++){if(student.workexp[i].id==id)
break;}
var work=student.workexp[i];(jQuery)("#ri-stdForm").dialog("open");(jQuery)("#ri-stdOrgKomp").val(work.company);(jQuery)("#ri-stdFunction").val(work.func);(jQuery)("#ri-stdJob").val(work.desc);(jQuery)("#ri-stdBDate").val(work.dbegin);if(work.dend=="Rad u toku"){(jQuery)("#ri-stdStillWorking").attr("checked",true);(jQuery)("#ri-stdEDate").val("");(jQuery)("#ri-stdEDate").attr("disabled",true);}else{(jQuery)("#ri-stdEDate").val(work.dend);}
(jQuery)("#ri-stdForm").dialog("option","buttons",[{text:"Izmeni",click:function(){if(formCheck((jQuery)("#ri-stdForm"))){saveWorkInfo(id);return true;}
return false;}},{text:"Nazad",click:function(){(jQuery)(this).dialog("close");}}]);}
function saveWorkInfo(id){var work=new WorkExp();work.company=(jQuery)("#ri-stdOrgKomp").val();work.func=(jQuery)("#ri-stdFunction").val();work.desc=(jQuery)("#ri-stdJob").val();work.dbegin=(jQuery)("#ri-stdBDate").val();if((jQuery)("#ri-stdStillWorking").is(':checked')==true){work.dend="Rad u toku";}else{work.dend=(jQuery)("#ri-stdEDate").val();}
work.id=id;(jQuery)("#ri-stdForm").append("<center><div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div><center>");(jQuery)("#ri-stdForm :input").attr("disabled",true);(jQuery)("#ri-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",true);text="action=saveWork&data="+encodeURIComponent(JSON.stringify(work))+"&";(jQuery).ajax({data:text,url:"cv/work.php",success:function(data){var data1=data.split("&&");if(data1[0]=="work_success"){(jQuery)("#cv-loading-parent").remove();for(var i=0;i<student.workexp.length;i++){if(student.workexp[i].id==id){student.workexp[i]=work;break;}}
var i=0;var textToInsert=[];textToInsert[i++]="<tr><td>";textToInsert[i++]=work.company;textToInsert[i++]="</td><td>";textToInsert[i++]=work.func;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=work.dbegin;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=work.dend=="Rad u toku"?"Rad u toku":work.dend;textToInsert[i++]="</td><td><span";textToInsert[i++]=" title='Pogledaj/Izmeni' class='cv-icon ui-icon ui-icon-pencil cv-ri-edit'></span><span";textToInsert[i++]=" title='Obrisi' class='cv-icon ui-icon ui-icon-trash cv-ri-delete'></span>";textToInsert[i++]="<input id='ri-hInput-"
textToInsert[i++]=work.id;textToInsert[i++]="' type='hidden' value='";textToInsert[i++]=work.id;textToInsert[i++]="'/></td></tr>";(jQuery)("#ri-hInput-"+id).parent().parent().replaceWith(textToInsert.join(''));(jQuery)("#ri-stdForm").dialog("close");(jQuery)(".cv-ri-edit").unbind("click");(jQuery)(".cv-ri-edit").click(function(){var facId=(jQuery)(this).next().next().val();getWorkInfo(facId);});(jQuery)(".cv-ri-delete").unbind("click");(jQuery)(".cv-ri-delete").click(function(){var facId=(jQuery)(this).next().val();deleteWork(facId);});getGlobalScore(student);}else if(data1[0]=="work_nsuccess"){alert(data1[1]);}
(jQuery)("#ri-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",false);(jQuery)("#ri-stdForm :input").attr("disabled",false);(jQuery)("#cv-loading-parent").remove();},type:'POST'});return work;}
function deleteWork(id){(jQuery)("#ri-stdWorks").append("<div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div>");text="action=deleteWork&id="+id+"&";(jQuery).ajax({data:text,url:"cv/work.php",success:function(data){var data1=data.split("&&");if(data1[0]=="work_success"){var index=-1;for(var i=0;i<student.workexp.length;i++){if(student.workexp[i].id==id){index=i;break;}}
student.workexp.splice(index,1);(jQuery)("#ri-hInput-"+id).parent().parent().remove();if(student.workexp.length==0){(jQuery)("#ri-stdContent-Works").hide();}
getGlobalScore(student);}else if(data1[0]=="work_nsuccess"){alert(data1[1]);}
(jQuery)("#cv-loading-parent").remove();},type:'POST'});}
(jQuery)("#dialog:ui-dialog").dialog("destroy");(jQuery)("#pr-stdForm").dialog({autoOpen:false,height:530,width:648,modal:true,draggable:false,resizable:false,title:"Dodaj novi projekat:"});(jQuery)(".cv-pr-delete").click(function(){var id=(jQuery)(this).next().val();(jQuery)(this).unbind("click");deleteProject(id);});(jQuery)(".cv-pr-edit").click(function(){var id=(jQuery)(this).next().next().val();getProjectInfo(id);});(jQuery)("#pr-stdAddNewProject").click(function(){(jQuery)("#pr-stdForm").dialog("option","buttons",[{text:"Dodaj",click:function(){if(formCheck((jQuery)("#pr-stdForm"))){student.projects[student.projects.length]=AddNewProject();(jQuery)("#pr-stdContent-Projects").removeAttr('hidden');return true;}else
return false;}},{text:"Nazad",click:function(){(jQuery)(this).dialog("close");}}]);ClearForm((jQuery)("#pr-stdForm"));(jQuery)("#pr-stdForm").dialog("open");});(jQuery)("#pr-stdStillWorking").click(function(){if(this.checked){(jQuery)("#pr-stdEDate").val("");(jQuery)("#pr-stdEDate").attr("disabled","");}
if(!this.checked){(jQuery)("#pr-stdEDate").removeAttr("disabled");}});function AddNewProject(){var project=new Project();project.name=(jQuery)("#pr-stdName").val();project.func=(jQuery)("#pr-stdFunction").val();project.desc=(jQuery)("#pr-stdDesc").val();project.dbegin=(jQuery)("#pr-stdBDate").val();project.sert=(jQuery)("#pr-stdSert").val();if((jQuery)("#pr-stdStillWorking").is(':checked')==true){project.dend="Rad u toku";}else{project.dend=(jQuery)("#pr-stdEDate").val();}
(jQuery)("#pr-stdForm").append("<center><div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div><center>");(jQuery)("#pr-stdForm :input").attr("disabled",true);(jQuery)("#pr-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",true);text="action=addProject&data="+encodeURIComponent(JSON.stringify(project))+"&";(jQuery).ajax({data:text,url:"cv/project.php",success:function(data){var data1=data.split("&&");if(data1[0]=="project_success"){(jQuery)("#cv-loading-parent").remove();project.id=data1[1];var i=0;var textToInsert=[];textToInsert[i++]="<tr><td>";textToInsert[i++]=project.name;textToInsert[i++]="</td><td>";textToInsert[i++]=project.func;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=project.dbegin;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=project.dend=="Rad u toku"?"Rad u toku":project.dend;textToInsert[i++]="</td><td><span";textToInsert[i++]=" title='Pogledaj/Izmeni' class='cv-icon ui-icon ui-icon-pencil cv-pr-edit'></span><span";textToInsert[i++]=" title='Obrisi' class='cv-icon ui-icon ui-icon-trash cv-pr-delete'></span>";textToInsert[i++]="<input id='pr-hInput-"
textToInsert[i++]=project.id;textToInsert[i++]="' type='hidden' value='";textToInsert[i++]=project.id;textToInsert[i++]="'/></td></tr>";(jQuery)("#pr-stdContent-Projects").append(textToInsert.join(''));(jQuery)("#pr-stdContent-Projects").show();(jQuery)("#pr-stdForm").dialog("close");(jQuery)(".cv-pr-edit").unbind("click");(jQuery)(".cv-pr-edit").click(function(){var id=(jQuery)(this).next().next().val();getProjectInfo(id);});(jQuery)(".cv-pr-delete").unbind("click");(jQuery)(".cv-pr-delete").click(function(){var id=(jQuery)(this).next().val();deleteProject(id);});getGlobalScore(student);}else if(data1[0]=="project_nsuccess"){alert(data1[1]);}
(jQuery)("#pr-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",false);(jQuery)("#pr-stdForm :input").attr("disabled",false);(jQuery)("#cv-loading-parent").remove();},type:'POST'});return project;}
function getProjectInfo(id){ClearForm((jQuery)("#pr-stdForm"));for(var i=0;i<student.projects.length;i++){if(student.projects[i].id==id)
break;}
var project=student.projects[i];(jQuery)("#pr-stdForm").dialog("open");(jQuery)("#pr-stdName").val(project.name);(jQuery)("#pr-stdFunction").val(project.func);(jQuery)("#pr-stdDesc").val(project.desc);(jQuery)("#pr-stdBDate").val(project.dbegin);(jQuery)("#pr-stdSert").val(project.sert);if(project.dend=="Rad u toku"){(jQuery)("#pr-stdStillWorking").attr("checked",true);(jQuery)("#pr-stdEDate").val("");(jQuery)("#pr-stdEDate").attr("disabled",true);}else{(jQuery)("#pr-stdEDate").val(project.dend);}
(jQuery)("#pr-stdForm").dialog("option","buttons",[{text:"Izmeni",click:function(){if(formCheck((jQuery)("#pr-stdForm"))){saveProjectInfo(id);return true;}else
return false;}},{text:"Nazad",click:function(){(jQuery)(this).dialog("close");}}]);}
function saveProjectInfo(id){var project=new Project();project.name=(jQuery)("#pr-stdName").val();project.func=(jQuery)("#pr-stdFunction").val();project.desc=(jQuery)("#pr-stdDesc").val();project.dbegin=(jQuery)("#pr-stdBDate").val();project.sert=(jQuery)("#pr-stdSert").val();if((jQuery)("#pr-stdStillWorking").is(':checked')==true){project.dend="Rad u toku";}else{project.dend=(jQuery)("#pr-stdEDate").val();}
project.id=id;(jQuery)("#pr-stdForm").append("<center><div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div><center>");(jQuery)("#pr-stdForm :input").attr("disabled",true);(jQuery)("#pr-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",true);text="action=saveProject&data="+encodeURIComponent(JSON.stringify(project))+"&";(jQuery).ajax({data:text,url:"cv/project.php",success:function(data){var data1=data.split("&&");if(data1[0]=="project_success"){(jQuery)("#cv-loading-parent").remove();for(var i=0;i<student.projects.length;i++){if(student.projects[i].id==id){student.projects[i]=project;break;}}
var i=0;var textToInsert=[];textToInsert[i++]="<tr><td>";textToInsert[i++]=project.name;textToInsert[i++]="</td><td>";textToInsert[i++]=project.func;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=project.dbegin;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=project.dend=="Rad u toku"?"Rad u toku":project.dend;textToInsert[i++]="</td><td><span";textToInsert[i++]=" title='Pogledaj/Izmeni' class='cv-icon ui-icon ui-icon-pencil cv-pr-edit'></span><span";textToInsert[i++]=" title='Obrisi' class='cv-icon ui-icon ui-icon-trash cv-pr-delete'></span>";textToInsert[i++]="<input id='pr-hInput-"
textToInsert[i++]=project.id;textToInsert[i++]="' type='hidden' value='";textToInsert[i++]=project.id;textToInsert[i++]="'/></td></tr>";(jQuery)("#pr-hInput-"+id).parent().parent().replaceWith(textToInsert.join(''));(jQuery)("#pr-stdForm").dialog("close");(jQuery)(".cv-pr-edit").unbind("click");(jQuery)(".cv-pr-edit").click(function(){var facId=(jQuery)(this).next().next().val();getProjectInfo(facId);});(jQuery)(".cv-pr-delete").unbind("click");(jQuery)(".cv-pr-delete").click(function(){var facId=(jQuery)(this).next().val();deleteProject(facId);});getGlobalScore(student);}else if(data1[0]=="project_nsuccess"){alert(data1[1]);}
(jQuery)("#pr-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",false);(jQuery)("#pr-stdForm :input").attr("disabled",false);(jQuery)("#cv-loading-parent").remove();},type:'POST'});return project;}
function deleteProject(id){(jQuery)("#pr-stdProjects").append("<div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div>");var text="action=deleteProject&id="+id+"&";(jQuery).ajax({data:text,url:"cv/project.php",success:function(data){var data1=data.split("&&");if(data1[0]=="project_success"){var index=-1;for(var i=0;i<student.projects.length;i++){if(student.projects[i].id==id){index=i;break;}}
student.projects.splice(index,1);(jQuery)("#pr-hInput-"+id).parent().parent().remove();if(student.projects.length==0){(jQuery)("#pr-stdContent-Projects").hide();}
getGlobalScore(student);}else if(data1[0]=="project_nsuccess"){alert(data1[1]);}
(jQuery)("#cv-loading-parent").remove();},type:'POST'});}
(jQuery)("#dialog:ui-dialog").dialog("destroy");(jQuery)("#su-stdForm").dialog({autoOpen:false,height:530,width:648,modal:true,draggable:false,resizable:false,title:"Dodaj novo strucno usavrsavanje:"});(jQuery)(".cv-su-delete").click(function(){var id=(jQuery)(this).next().val();(jQuery)(this).unbind("click");deleteSpec(id);});(jQuery)(".cv-su-edit").click(function(){var id=(jQuery)(this).next().next().val();getSpecInfo(id);});(jQuery)("#su-stdAddNewSpec").click(function(){(jQuery)("#su-stdForm").dialog("option","buttons",[{text:"Dodaj",click:function(){if(formCheck((jQuery)("#su-stdForm"))){student.specs[student.specs.length]=AddNewSpec();(jQuery)("#su-stdContent-Specs").removeAttr('hidden');return true;}else
return false;}},{text:"Nazad",click:function(){(jQuery)(this).dialog("close");}}]);ClearForm((jQuery)("#su-stdForm"));(jQuery)("#su-stdForm").dialog("open");});(jQuery)("#su-stdStillWorking").click(function(){if(this.checked){(jQuery)("#su-stdEDate").val("");(jQuery)("#su-stdEDate").attr("disabled","");}
if(!this.checked){(jQuery)("#su-stdEDate").removeAttr("disabled");}});function AddNewSpec(){var spec=new Specialization();spec.name=(jQuery)("#su-stdName").val();spec.organizer=(jQuery)("#su-stdOrg").val();spec.desc=(jQuery)("#su-stdDesc").val();spec.dbegin=(jQuery)("#su-stdBDate").val();spec.sert=(jQuery)("#su-stdSert").val();if((jQuery)("#su-stdStillWorking").is(':checked')==true){spec.dend="Rad u toku";}else{spec.dend=(jQuery)("#su-stdEDate").val();}
(jQuery)("#su-stdForm").append("<center><div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div><center>");(jQuery)("#su-stdForm :input").attr("disabled",true);(jQuery)("#su-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",true);text="action=addSpec&data="+encodeURIComponent(JSON.stringify(spec))+"&";(jQuery).ajax({data:text,url:"cv/specialization.php",success:function(data){var data1=data.split("&&");if(data1[0]=="spec_success"){(jQuery)("#cv-loading-parent").remove();spec.id=data1[1];var i=0;var textToInsert=[];textToInsert[i++]="<tr><td>";textToInsert[i++]=spec.name;textToInsert[i++]="</td><td>";textToInsert[i++]=spec.organizer;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=spec.dbegin;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=spec.dend=="Rad u toku"?"Rad u toku":spec.dend;textToInsert[i++]="</td><td><span";textToInsert[i++]=" title='Pogledaj/Izmeni' class='cv-icon ui-icon ui-icon-pencil cv-su-edit'></span><span";textToInsert[i++]=" title='Obrisi' class='cv-icon ui-icon ui-icon-trash cv-su-delete'></span>";textToInsert[i++]="<input id='su-hInput-"
textToInsert[i++]=spec.id;textToInsert[i++]="' type='hidden' value='";textToInsert[i++]=spec.id;textToInsert[i++]="'/></td></tr>";(jQuery)("#su-stdContent-Specs").append(textToInsert.join(''));(jQuery)("#su-stdContent-Specs").show();(jQuery)("#su-stdForm").dialog("close");(jQuery)(".cv-su-edit").unbind("click");(jQuery)(".cv-su-edit").click(function(){var id=(jQuery)(this).next().next().val();getSpecInfo(id);});(jQuery)(".cv-su-delete").unbind("click");(jQuery)(".cv-su-delete").click(function(){var id=(jQuery)(this).next().val();deleteSpec(id);});getGlobalScore(student);}else if(data1[0]=="spec_nsuccess"){alert(data1[1]);}
(jQuery)("#su-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",false);(jQuery)("#su-stdForm :input").attr("disabled",false);(jQuery)("#cv-loading-parent").remove();},type:'POST'});return spec;}
function getSpecInfo(id){ClearForm((jQuery)("#su-stdForm"));for(var i=0;i<student.specs.length;i++){if(student.specs[i].id==id)
break;}
var spec=student.specs[i];(jQuery)("#su-stdForm").dialog("open");(jQuery)("#su-stdName").val(spec.name);(jQuery)("#su-stdOrg").val(spec.organizer);(jQuery)("#su-stdDesc").val(spec.desc);(jQuery)("#su-stdBDate").val(spec.dbegin);(jQuery)("#su-stdSert").val(spec.sert);if(spec.dend=="Rad u toku"){(jQuery)("#su-stdStillWorking").attr("checked",true);(jQuery)("#su-stdEDate").val("");(jQuery)("#su-stdEDate").attr("disabled",true);}else{(jQuery)("#su-stdEDate").val(spec.dend);}
(jQuery)("#su-stdForm").dialog("option","buttons",[{text:"Izmeni",click:function(){if(formCheck((jQuery)("#su-stdForm"))){saveSpecInfo(id);return true;}else
return false}},{text:"Nazad",click:function(){(jQuery)(this).dialog("close");}}]);}
function saveSpecInfo(id){var spec=new Specialization();spec.name=(jQuery)("#su-stdName").val();spec.organizer=(jQuery)("#su-stdOrg").val();spec.desc=(jQuery)("#su-stdDesc").val();spec.dbegin=(jQuery)("#su-stdBDate").val();spec.sert=(jQuery)("#su-stdSert").val();if((jQuery)("#su-stdStillWorking").is(':checked')==true){spec.dend="Rad u toku";}else{spec.dend=(jQuery)("#su-stdEDate").val();}
spec.id=id;(jQuery)("#su-stdForm").append("<center><div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div><center>");(jQuery)("#su-stdForm :input").attr("disabled",true);(jQuery)("#su-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",true);text="action=saveSpec&data="+encodeURIComponent(JSON.stringify(spec))+"&";(jQuery).ajax({data:text,url:"cv/specialization.php",success:function(data){var data1=data.split("&&");if(data1[0]=="spec_success"){(jQuery)("#cv-loading-parent").remove();for(var i=0;i<student.specs.length;i++){if(student.specs[i].id==id){student.specs[i]=spec;break;}}
var i=0;var textToInsert=[];textToInsert[i++]="<tr><td>";textToInsert[i++]=spec.name;textToInsert[i++]="</td><td>";textToInsert[i++]=spec.organizer;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=spec.dbegin;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=spec.dend=="Rad u toku"?"Rad u toku":spec.dend;textToInsert[i++]="</td><td><span";textToInsert[i++]=" title='Pogledaj/Izmeni' class='cv-icon ui-icon ui-icon-pencil cv-su-edit'></span><span";textToInsert[i++]=" title='Obrisi' class='cv-icon ui-icon ui-icon-trash cv-su-delete'></span>";textToInsert[i++]="<input id='su-hInput-"
textToInsert[i++]=spec.id;textToInsert[i++]="' type='hidden' value='";textToInsert[i++]=spec.id;textToInsert[i++]="'/></td></tr>";(jQuery)("#su-hInput-"+id).parent().parent().replaceWith(textToInsert.join(''));(jQuery)("#su-stdForm").dialog("close");(jQuery)(".cv-su-edit").unbind("click");(jQuery)(".cv-su-edit").click(function(){var id=(jQuery)(this).next().next().val();getSpecInfo(id);});(jQuery)(".cv-su-delete").unbind("click");(jQuery)(".cv-su-delete").click(function(){var id=(jQuery)(this).next().val();deleteSpec(id);});getGlobalScore(student);}else if(data1[0]=="spec_nsuccess"){alert(data1[1]);}
(jQuery)("#su-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",false);(jQuery)("#su-stdForm :input").attr("disabled",false);(jQuery)("#cv-loading-parent").remove();},type:'POST'});return spec;}
function deleteSpec(id){(jQuery)("#su-stdSpecs").append("<div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div>");var text="action=deleteSpec&id="+id+"&";(jQuery).ajax({data:text,url:"cv/specialization.php",success:function(data){var data1=data.split("&&");if(data1[0]=="spec_success"){var index=-1;for(var i=0;i<student.specs.length;i++){if(student.specs[i].id==id){index=i;break;}}
student.specs.splice(index,1);(jQuery)("#su-hInput-"+id).parent().parent().remove();if(student.specs.length==0){(jQuery)("#su-stdContent-Specs").hide();}
getGlobalScore(student);}else if(data1[0]=="spec_nsuccess"){alert(data1[1]);}
(jQuery)("#cv-loading-parent").remove();},type:'POST'});}
(jQuery)("#dialog:ui-dialog").dialog("destroy");(jQuery)("#pj-stdForm").dialog({autoOpen:false,height:430,width:648,modal:true,draggable:false,resizable:false,title:"Dodaj novi jezik:"});(jQuery)(".cv-pj-delete").click(function(){var id=(jQuery)(this).next().val();(jQuery)(this).unbind("click");deleteLanguage(id);});(jQuery)(".cv-pj-edit").click(function(){var id=(jQuery)(this).next().next().val();getLanguageInfo(id);});(jQuery)("#pj-stdAddNewLang").click(function(){(jQuery)("#pj-stdForm").dialog("option","buttons",[{text:"Dodaj",click:function(){if(formCheck((jQuery)("#pj-stdForm"))){student.languages[student.languages.length]=AddNewLanguage();(jQuery)("#pj-stdContent-Langs").removeAttr('hidden');return true;}else
return false;}},{text:"Nazad",click:function(){(jQuery)(this).dialog("close");}}]);ClearForm((jQuery)("#pj-stdForm"));(jQuery)("#pj-stdForm").dialog("open");});function AddNewLanguage(){var language=new Language();language.language=(jQuery)("#pj-stdName").val();language.read=(jQuery)("#pj-stdRead").val();language.write=(jQuery)("#pj-stdWrite").val();language.understand=(jQuery)("#pj-stdUnd").val();language.speak=(jQuery)("#pj-stdSpeak").val();language.sert=(jQuery)("#pj-stdSert").val();(jQuery)("#pj-stdForm").append("<center><div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div><center>");(jQuery)("#pj-stdForm :input").attr("disabled",true);(jQuery)("#pj-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",true);text="action=addLanguage&data="+encodeURIComponent(JSON.stringify(language))+"&";(jQuery).ajax({data:text,url:"cv/language.php",success:function(data){var data1=data.split("&&");if(data1[0]=="language_success"){(jQuery)("#cv-loading-parent").remove();language.id=data1[1];var i=0;var textToInsert=[];textToInsert[i++]="<tr><td>";textToInsert[i++]=language.language;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=language.read;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=language.write;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=language.understand;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=language.speak;textToInsert[i++]="</td><td><span";textToInsert[i++]=" title='Pogledaj/Izmeni' class='cv-icon ui-icon ui-icon-pencil cv-pj-edit'></span><span";textToInsert[i++]=" title='Obrisi' class='cv-icon ui-icon ui-icon-trash cv-pj-delete'></span>";textToInsert[i++]="<input id='pj-hInput-"
textToInsert[i++]=language.id;textToInsert[i++]="' type='hidden' value='";textToInsert[i++]=language.id;textToInsert[i++]="'/></td></tr>";(jQuery)("#pj-stdContent-Langs").append(textToInsert.join(''));(jQuery)("#pj-stdContent-Langs").show();(jQuery)("#pj-stdForm").dialog("close");(jQuery)(".cv-pj-edit").unbind("click");(jQuery)(".cv-pj-edit").click(function(){var id=(jQuery)(this).next().next().val();getLanguageInfo(id);});(jQuery)(".cv-pj-delete").unbind("click");(jQuery)(".cv-pj-delete").click(function(){var id=(jQuery)(this).next().val();deleteLanguage(id);});getGlobalScore(student);}else if(data1[0]=="language_nsuccess"){alert(data1[1]);}
(jQuery)("#pj-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",false);(jQuery)("#pj-stdForm :input").attr("disabled",false);(jQuery)("#cv-loading-parent").remove();},type:'POST'});return language;}
function getLanguageInfo(id){ClearForm((jQuery)("#pj-stdForm"));for(var i=0;i<student.languages.length;i++){if(student.languages[i].id==id)
break;}
var language=student.languages[i];(jQuery)("#pj-stdForm").dialog("open");(jQuery)("#pj-stdName").val(language.language);(jQuery)("#pj-stdRead").val(language.read);(jQuery)("#pj-stdWrite").val(language.write);(jQuery)("#pj-stdUnd").val(language.understand);(jQuery)("#pj-stdSpeak").val(language.speak);(jQuery)("#pj-stdSert").val(language.sert);(jQuery)("#pj-stdForm").dialog("option","buttons",[{text:"Izmeni",click:function(){if(formCheck((jQuery)("#pj-stdForm"))){saveLanguageInfo(id);return true;}else
return false}},{text:"Nazad",click:function(){(jQuery)(this).dialog("close");}}]);}
function saveLanguageInfo(id){var language=new Language();language.language=(jQuery)("#pj-stdName").val();language.read=(jQuery)("#pj-stdRead").val();language.write=(jQuery)("#pj-stdWrite").val();language.understand=(jQuery)("#pj-stdUnd").val();language.speak=(jQuery)("#pj-stdSpeak").val();language.sert=(jQuery)("#pj-stdSert").val();language.id=id;(jQuery)("#pj-stdForm").append("<center><div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div><center>");(jQuery)("#pj-stdForm :input").attr("disabled",true);(jQuery)("#pj-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",true);text="action=saveLanguage&data="+encodeURIComponent(JSON.stringify(language))+"&";(jQuery).ajax({data:text,url:"cv/language.php",success:function(data){var data1=data.split("&&");if(data1[0]=="language_success"){(jQuery)("#cv-loading-parent").remove();for(var i=0;i<student.languages.length;i++){if(student.languages[i].id==id){student.languages[i]=language;break;}}
var i=0;var textToInsert=[];textToInsert[i++]="<tr><td>";textToInsert[i++]=language.language;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=language.read;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=language.write;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=language.understand;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=language.speak;textToInsert[i++]="</td><td><span";textToInsert[i++]=" title='Pogledaj/Izmeni' class='cv-icon ui-icon ui-icon-pencil cv-pj-edit'></span><span";textToInsert[i++]=" title='Obrisi' class='cv-icon ui-icon ui-icon-trash cv-pj-delete'></span>";textToInsert[i++]="<input id='pj-hInput-"
textToInsert[i++]=language.id;textToInsert[i++]="' type='hidden' value='";textToInsert[i++]=language.id;textToInsert[i++]="'/></td></tr>";(jQuery)("#pj-hInput-"+id).parent().parent().replaceWith(textToInsert.join(''));(jQuery)("#pj-stdForm").dialog("close");(jQuery)(".cv-pj-edit").unbind("click");(jQuery)(".cv-pj-edit").click(function(){var id=(jQuery)(this).next().next().val();getLanguageInfo(id);});(jQuery)(".cv-pj-delete").unbind("click");(jQuery)(".cv-pj-delete").click(function(){var id=(jQuery)(this).next().val();deleteExpertise(id);});getGlobalScore(student);}else if(data1[0]=="language_nsuccess"){alert(data1[1]);}
(jQuery)("#pj-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",false);(jQuery)("#pj-stdForm :input").attr("disabled",false);(jQuery)("#cv-loading-parent").remove();},type:'POST'});return language;}
function deleteLanguage(id){(jQuery)("#pj-stdLangs").append("<div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div>");var text="action=deleteLanguage&id="+id+"&";(jQuery).ajax({data:text,url:"cv/language.php",success:function(data){var data1=data.split("&&");if(data1[0]=="language_success"){var index=-1;for(var i=0;i<student.languages.length;i++){if(student.languages[i].id==id){index=i;break;}}
student.languages.splice(index,1);(jQuery)("#pj-hInput-"+id).parent().parent().remove();if(student.languages.length==0){(jQuery)("#pj-stdContent-Langs").hide();}
getGlobalScore(student);}else if(data1[0]=="language_nsuccess"){alert(data1[1]);}
(jQuery)("#cv-loading-parent").remove();},type:'POST'});}
(jQuery)("#dialog:ui-dialog").dialog("destroy");(jQuery)("#sto-stdForm").dialog({autoOpen:false,height:300,width:648,modal:true,draggable:false,resizable:false,title:"Dodaj novu oblast:"});(jQuery)(".cv-sto-delete").click(function(){var id=(jQuery)(this).next().val();(jQuery)(this).unbind("click");deleteExpertise(id);});(jQuery)(".cv-sto-edit").click(function(){var id=(jQuery)(this).next().next().val();getExpertiseInfo(id);});(jQuery)("#sto-stdAddNewExpt").click(function(){(jQuery)("#sto-stdForm").dialog("option","buttons",[{text:"Dodaj",click:function(){if(formCheck((jQuery)("#sto-stdForm"))){student.expertises[student.expertises.length]=AddNewExpertise();(jQuery)("#sto-stdContent-Expertises").removeAttr('hidden');return true;}else
return false;}},{text:"Nazad",click:function(){(jQuery)(this).dialog("close");}}]);ClearForm((jQuery)("#sto-stdForm"));(jQuery)("#sto-stdForm").dialog("open");});function AddNewExpertise(){var expertise=new Expertise();expertise.name=(jQuery)("#sto-stdName").val();expertise.level=(jQuery)("#sto-stdLevel").val();expertise.sert=(jQuery)("#sto-stdSert").val();(jQuery)("#sto-stdForm").append("<center><div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div><center>");(jQuery)("#sto-stdForm :input").attr("disabled",true);(jQuery)("#sto-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",true);text="action=addExpertise&data="+encodeURIComponent(JSON.stringify(expertise))+"&";(jQuery).ajax({data:text,url:"cv/expertise.php",success:function(data){var data1=data.split("&&");if(data1[0]=="expertise_success"){(jQuery)("#cv-loading-parent").remove();expertise.id=data1[1];var i=0;var textToInsert=[];textToInsert[i++]="<tr><td>";textToInsert[i++]=expertise.name;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=expertise.level;textToInsert[i++]="</td><td><span";textToInsert[i++]=" title='Pogledaj/Izmeni' class='cv-icon ui-icon ui-icon-pencil cv-sto-edit'></span><span";textToInsert[i++]=" title='Obrisi' class='cv-icon ui-icon ui-icon-trash cv-sto-delete'></span>";textToInsert[i++]="<input id='sto-hInput-"
textToInsert[i++]=expertise.id;textToInsert[i++]="' type='hidden' value='";textToInsert[i++]=expertise.id;textToInsert[i++]="'/></td></tr>";(jQuery)("#sto-stdContent-Expertises").append(textToInsert.join(''));(jQuery)("#sto-stdContent-Expertises").show();(jQuery)("#sto-stdForm").dialog("close");(jQuery)(".cv-sto-edit").unbind("click");(jQuery)(".cv-sto-edit").click(function(){var id=(jQuery)(this).next().next().val();getExpertiseInfo(id);});(jQuery)(".cv-sto-delete").unbind("click");(jQuery)(".cv-sto-delete").click(function(){var id=(jQuery)(this).next().val();deleteExpertise(id);});getGlobalScore(student);}else if(data1[0]=="expertise_nsuccess"){alert(data1[1]);}
(jQuery)("#sto-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",false);(jQuery)("#sto-stdForm :input").attr("disabled",false);(jQuery)("#cv-loading-parent").remove();},type:'POST'});return expertise;}
function getExpertiseInfo(id){ClearForm((jQuery)("#sto-stdForm"));for(var i=0;i<student.expertises.length;i++){if(student.expertises[i].id==id)
break;}
var expertise=student.expertises[i];(jQuery)("#sto-stdForm").dialog("open");(jQuery)("#sto-stdName").val(expertise.name);(jQuery)("#sto-stdLevel").val(expertise.level);(jQuery)("#sto-stdSert").val(expertise.sert);(jQuery)("#sto-stdForm").dialog("option","buttons",[{text:"Izmeni",click:function(){if(formCheck((jQuery)("#sto-stdForm"))){saveExpertiseInfo(id);return true;}else
return false}},{text:"Nazad",click:function(){(jQuery)(this).dialog("close");}}]);}
function saveExpertiseInfo(id){var expertise=new Expertise();expertise.name=(jQuery)("#sto-stdName").val();expertise.level=(jQuery)("#sto-stdLevel").val();expertise.sert=(jQuery)("#sto-stdSert").val();expertise.id=id;(jQuery)("#sto-stdForm").append("<center><div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div><center>");(jQuery)("#sto-stdForm :input").attr("disabled",true);(jQuery)("#sto-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",true);text="action=saveExpertise&data="+encodeURIComponent(JSON.stringify(expertise))+"&";(jQuery).ajax({data:text,url:"cv/expertise.php",success:function(data){var data1=data.split("&&");if(data1[0]=="expertise_success"){(jQuery)("#cv-loading-parent").remove();for(var i=0;i<student.expertises.length;i++){if(student.expertises[i].id==id){student.expertises[i]=expertise;break;}}
var i=0;var textToInsert=[];textToInsert[i++]="<tr><td>";textToInsert[i++]=expertise.name;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=expertise.level;textToInsert[i++]="</td><td><span";textToInsert[i++]=" title='Pogledaj/Izmeni' class='cv-icon ui-icon ui-icon-pencil cv-sto-edit'></span><span";textToInsert[i++]=" title='Obrisi' class='cv-icon ui-icon ui-icon-trash cv-sto-delete'></span>";textToInsert[i++]="<input id='sto-hInput-"
textToInsert[i++]=expertise.id;textToInsert[i++]="' type='hidden' value='";textToInsert[i++]=expertise.id;textToInsert[i++]="'/></td></tr>";(jQuery)("#sto-hInput-"+id).parent().parent().replaceWith(textToInsert.join(''));(jQuery)("#sto-stdForm").dialog("close");(jQuery)(".cv-sto-edit").unbind("click");(jQuery)(".cv-sto-edit").click(function(){var id=(jQuery)(this).next().next().val();getExpertiseInfo(id);});(jQuery)(".cv-sto-delete").unbind("click");(jQuery)(".cv-sto-delete").click(function(){var id=(jQuery)(this).next().val();deleteExpertise(id);});getGlobalScore(student);}else if(data1[0]=="expertise_nsuccess"){alert(data1[1]);}
(jQuery)("#sto-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",false);(jQuery)("#sto-stdForm :input").attr("disabled",false);(jQuery)("#cv-loading-parent").remove();},type:'POST'});return expertise;}
function deleteExpertise(id){(jQuery)("#sto-stdExpertises").append("<div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div>");var text="action=deleteExpertise&id="+id+"&";(jQuery).ajax({data:text,url:"cv/expertise.php",success:function(data){var data1=data.split("&&");if(data1[0]=="expertise_success"){var index=-1;for(var i=0;i<student.expertises.length;i++){if(student.expertises[i].id==id){index=i;break;}}
student.expertises.splice(index,1);(jQuery)("#sto-hInput-"+id).parent().parent().remove();if(student.expertises.length==0){(jQuery)("#sto-stdContent-Expertises").hide();}
getGlobalScore(student);}else if(data1[0]=="expertise_nsuccess"){alert(data1[1]);}
(jQuery)("#cv-loading-parent").remove();},type:'POST'});}
(jQuery)("#dialog:ui-dialog").dialog("destroy");(jQuery)("#rnr-stdForm").dialog({autoOpen:false,height:300,width:648,modal:true,draggable:false,resizable:false,title:"Dodaj novu oblast:",buttons:{"Dodaj":function(){},"Nazad":function(){(jQuery)(this).dialog("close");}},close:function(){}});(jQuery)(".cv-rnr-delete").click(function(){var id=(jQuery)(this).next().val();(jQuery)(this).unbind("click");deleteComputing(id);});(jQuery)(".cv-rnr-edit").click(function(){var id=(jQuery)(this).next().next().val();getComputingInfo(id);});(jQuery)("#rnr-stdAddNewCompSkill").click(function(){(jQuery)("#rnr-stdForm").dialog("option","buttons",[{text:"Dodaj",click:function(){if(formCheck((jQuery)("#rnr-stdForm"))){student.computing[student.computing.length]=AddNewComputing();(jQuery)("#rnr-stdContent-Computings").removeAttr('hidden');return true;}else
return false;}},{text:"Nazad",click:function(){(jQuery)(this).dialog("close");}}]);ClearForm((jQuery)("#rnr-stdForm"));(jQuery)("#rnr-stdForm").dialog("open");});function AddNewComputing(){var computing=new Computing();computing.name=(jQuery)("#rnr-stdName").val();computing.level=(jQuery)("#rnr-stdLevel").val();computing.sert=(jQuery)("#rnr-stdSert").val();(jQuery)("#rnr-stdForm").append("<center><div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div><center>");(jQuery)("#rnr-stdForm :input").attr("disabled",true);(jQuery)("#rnr-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",true);text="action=addComputing&data="+encodeURIComponent(JSON.stringify(computing))+"&";(jQuery).ajax({data:text,url:"cv/computing.php",success:function(data){var data1=data.split("&&");if(data1[0]=="computing_success"){(jQuery)("#cv-loading-parent").remove();computing.id=data1[1];var i=0;var textToInsert=[];textToInsert[i++]="<tr><td>";textToInsert[i++]=computing.name;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=computing.level;textToInsert[i++]="</td><td><span";textToInsert[i++]=" title='Pogledaj/Izmeni' class='cv-icon ui-icon ui-icon-pencil cv-rnr-edit'></span><span";textToInsert[i++]=" title='Obrisi' class='cv-icon ui-icon ui-icon-trash cv-rnr-delete'></span>";textToInsert[i++]="<input id='rnr-hInput-"
textToInsert[i++]=computing.id;textToInsert[i++]="' type='hidden' value='";textToInsert[i++]=computing.id;textToInsert[i++]="'/></td></tr>";(jQuery)("#rnr-stdContent-Computing").append(textToInsert.join(''));(jQuery)("#rnr-stdContent-Computing").show();(jQuery)("#rnr-stdForm").dialog("close");(jQuery)(".cv-rnr-edit").unbind("click");(jQuery)(".cv-rnr-edit").click(function(){var id=(jQuery)(this).next().next().val();getComputingInfo(id);});(jQuery)(".cv-rnr-delete").unbind("click");(jQuery)(".cv-rnr-delete").click(function(){var id=(jQuery)(this).next().val();deleteComputing(id);});getGlobalScore(student);}else if(data1[0]=="computing_nsuccess"){alert(data1[1]);}
(jQuery)("#rnr-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",false);(jQuery)("#rnr-stdForm :input").attr("disabled",false);(jQuery)("#cv-loading-parent").remove();},type:'POST'});return computing;}
function getComputingInfo(id){ClearForm((jQuery)("#rnr-stdForm"));for(var i=0;i<student.computing.length;i++){if(student.computing[i].id==id)
break;}
var computing=student.computing[i];(jQuery)("#rnr-stdForm").dialog("open");(jQuery)("#rnr-stdName").val(computing.name);(jQuery)("#rnr-stdLevel").val(computing.level);(jQuery)("#rnr-stdSert").val(computing.sert);(jQuery)("#rnr-stdForm").dialog("option","buttons",[{text:"Izmeni",click:function(){if(formCheck((jQuery)("#rnr-stdForm"))){saveComputingInfo(id);return true;}else
return false}},{text:"Nazad",click:function(){(jQuery)(this).dialog("close");}}]);}
function saveComputingInfo(id){var computing=new Computing();computing.name=(jQuery)("#rnr-stdName").val();computing.level=(jQuery)("#rnr-stdLevel").val();computing.sert=(jQuery)("#rnr-stdSert").val();computing.id=id;(jQuery)("#rnr-stdForm").append("<center><div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div><center>");(jQuery)("#rnr-stdForm :input").attr("disabled",true);(jQuery)("#rnr-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",true);text="action=saveComputing&data="+encodeURIComponent(JSON.stringify(computing))+"&";(jQuery).ajax({data:text,url:"cv/computing.php",success:function(data){var data1=data.split("&&");if(data1[0]=="computing_success"){(jQuery)("#cv-loading-parent").remove();for(var i=0;i<student.computing.length;i++){if(student.computing[i].id==id){student.computing[i]=computing;break;}}
var i=0;var textToInsert=[];textToInsert[i++]="<tr><td>";textToInsert[i++]=computing.name;textToInsert[i++]="</td><td class='cv-table-centered-text'>";textToInsert[i++]=computing.level;textToInsert[i++]="</td><td><span";textToInsert[i++]=" title='Pogledaj/Izmeni' class='cv-icon ui-icon ui-icon-pencil cv-rnr-edit'></span><span";textToInsert[i++]=" title='Obrisi' class='cv-icon ui-icon ui-icon-trash cv-rnr-delete'></span>";textToInsert[i++]="<input id='rnr-hInput-"
textToInsert[i++]=computing.id;textToInsert[i++]="' type='hidden' value='";textToInsert[i++]=computing.id;textToInsert[i++]="'/></td></tr>";(jQuery)("#rnr-hInput-"+id).parent().parent().replaceWith(textToInsert.join(''));(jQuery)("#rnr-stdForm").dialog("close");(jQuery)(".cv-rnr-edit").unbind("click");(jQuery)(".cv-rnr-edit").click(function(){var id=(jQuery)(this).next().next().val();getComputingInfo(id);});(jQuery)(".cv-rnr-delete").unbind("click");(jQuery)(".cv-rnr-delete").click(function(){var id=(jQuery)(this).next().val();deleteComputing(id);});getGlobalScore(student);}else if(data1[0]=="computing_nsuccess"){alert(data1[1]);}
(jQuery)("#rnr-stdForm").next(".ui-dialog-buttonpane").children(".ui-dialog-buttonset").children().attr("disabled",false);(jQuery)("#rnr-stdForm :input").attr("disabled",false);(jQuery)("#cv-loading-parent").remove();},type:'POST'});return computing;}
function deleteComputing(id){(jQuery)("#rnr-stdComputing").append("<div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div>");var text="action=deleteComputing&id="+id+"&";(jQuery).ajax({data:text,url:"cv/computing.php",success:function(data){var data1=data.split("&&");if(data1[0]=="computing_success"){var index=-1;for(var i=0;i<student.computing.length;i++){if(student.computing[i].id==id){index=i;break;}}
student.computing.splice(index,1);(jQuery)("#rnr-hInput-"+id).parent().parent().remove();if(student.computing.length==0){(jQuery)("#rnr-stdContent-Computing").hide();}
getGlobalScore(student);}else if(data1[0]=="computing_nsuccess"){alert(data1[1]);}
(jQuery)("#cv-loading-parent").remove();},type:'POST'});}
function saveMisc(){var stud=student;stud.dlicense=(jQuery)("#oi-stdDriving").val();stud.skills=(jQuery)("#oi-stdSkills").val();stud.char=(jQuery)("#oi-stdTraits").val();stud.interests=(jQuery)("#oi-stdIntrests").val();stud.searchfor=new SearchFor();if((jQuery)("#oi-stdSearch-Practice").is(":checked")){stud.searchfor.practice="true";}
if((jQuery)("#oi-stdSearch-Parttime").is(":checked")){stud.searchfor.parttime="true";}
if((jQuery)("#oi-stdSearch-Fulltime").is(":checked")){stud.searchfor.fulltime="true";}
if((jQuery)("#oi-stdSearch-Project").is(":checked")){stud.searchfor.project="true";}
if((jQuery)("#oi-stdSearch-Volunteer").is(":checked")){stud.searchfor.volunteer="true";}
stud.newsBEST=(jQuery)("#oi-stdNewsJF").is(":checked")?1:0;stud.newsJF=(jQuery)("#oi-stdNewsBEST").is(":checked")?1:0;(jQuery)("#oi-stdForm :input").attr("disabled",true);(jQuery)("#cv-menuMisc").html("Ostale informacije (Snimanje u toku...)");(jQuery)("#cv-menuMisc").css("font-weight","bold");text="action=saveMisc&data="+encodeURIComponent(JSON.stringify(stud))+"&";(jQuery).ajax({data:text,url:"cv/student.php",success:function(data){var data1=data.split("&&");if(data1[0]=="misc_success"){(jQuery)("#cv-menuMisc").css("font-weight","normal");student.dlicense=stud.dlicense;student.skills=stud.skills;student.char=stud.char;student.interests=stud.interests;student.searchfor=stud.searchfor;getGlobalScore(student);}else if(data1[0]=="misc_nsuccess"){alert(data1[1]);}else{alert(data);}
(jQuery)("#oi-stdForm :input").attr("disabled",false);(jQuery)("#cv-menuMisc").html("Ostale informacije");},type:'POST'});}
getGlobalScore(student);}
function GoToLoginForm(){(jQuery)("#cv-content").append("<center><div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div></center>");(jQuery).ajax({data:"action=loginForm",url:"cv/login.php",success:function(data){(jQuery)("#cv-content").html(data);logInit();},type:'POST'});}
function GoToRegisterForm(){(jQuery)("#log-stdForm :input").attr("disabled",true);(jQuery)("#log-stdForm").append("<div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div>");(jQuery).ajax({data:"action=registerForm",url:"cv/register.php",success:function(data){(jQuery)("#cv-content").html(data);Recaptcha.create("6LeW6skSAAAAACNh72I6rbZYg_DNXbT6ia2WOha5","cv-capthca",{theme:"white"});regInit();},type:'POST'});}
function GoToRecoveryForm(){(jQuery)("#log-stdForm :input").attr("disabled",true);(jQuery)("#log-stdForm").append("<div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div>");(jQuery).ajax({data:"action=recoveryForm",url:"cv/recovery.php",success:function(data){(jQuery)("#cv-content").html(data);recoveryInit();Recaptcha.create("6LeW6skSAAAAACNh72I6rbZYg_DNXbT6ia2WOha5","cv-capthca",{theme:"white"});},type:'POST'});}
function RecoverPass(){var email=(jQuery)("#rec-stdEmail").val();var captcha1=(jQuery)("#recaptcha_challenge_field").val();var captcha2=(jQuery)("#recaptcha_response_field").val();if(email==""){alert("Morate uneti E-mail adresu!");return;}else{(jQuery)("#rec-stdForm :input").attr("disabled",true);(jQuery)("#rec-stdForm").append("<div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div>");(jQuery).ajax({data:"action=sendMail&email="+email+"&recaptcha_challenge_field="+captcha1+"&recaptcha_response_field="+captcha2+"&",url:"cv/recovery.php",success:function(data){var data1=data.split("&&");if(data1[0]=="recovery_success"){(jQuery)("#cv-content").html(data1[1]);}else if(data1[0]=="cv-captcha-err"){alert(data1[1]);Recaptcha.reload();}else if(data1[0]=="cv-user-nexists"){alert(data1[1]);}else if(data1[0]=="cv-user-success"){(jQuery)("#rec-stdForm").replaceWith(data1[1]);}
(jQuery)("#rec-stdForm :input").attr("disabled",false);(jQuery)("#cv-loading-parent").remove();},type:'POST'});}}
function ClearForm(form){(jQuery)(form).find(".cv-alert").remove();(jQuery)(':input',form).each(function(){var type=this.type;var tag=this.tagName.toLowerCase();if(type=='text'||tag=='textarea'){this.value="";(jQuery)(this).attr("disabled",false);}else if(type=='checkbox'||type=='radio'){this.checked=false;}else if(tag=='select'){this.selectedIndex=0;(jQuery)(this).trigger("change");}});}
function RegisterUser(){if(!regFormCheck())
return;(jQuery)("#reg-stdForm :input").attr("disabled",true);(jQuery)("#reg-stdForm").append("<div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div>");var stud=new Student();stud.name=(jQuery)("#lp-stdName").val();stud.pname=(jQuery)("#lp-stdPName").val();stud.sname=(jQuery)("#lp-stdSName").val();stud.gender=(jQuery)("#lp-stdGender").val();stud.bdate=(jQuery)("#lp-stdBDate").val();stud.email=(jQuery)("#lp-stdEmail").val();stud.address1=(jQuery)("#lp-stdAddress1").val();stud.address2=(jQuery)("#lp-stdAddress2").val();stud.city1=(jQuery)("#lp-stdCity1").val();stud.city2=(jQuery)("#lp-stdCity2").val();stud.state1=(jQuery)("#lp-stdState1").val();stud.state2=(jQuery)("#lp-stdState2").val();stud.password=(jQuery)("#lp-stdPass").val();stud.phone1=(jQuery)("#lp-stdPhone1").val();stud.phone2=(jQuery)("#lp-stdPhone2").val();stud.newsBEST=(jQuery)("#lp-stdNewsJF").is(":checked")?1:0;stud.newsJF=(jQuery)("#lp-stdNewsBEST").is(":checked")?1:0;var captcha=(jQuery)("#recaptcha_response_field").val();var captchaChallenge=(jQuery)("#recaptcha_challenge_field").val();var text="action=registerUser&podaci="+encodeURIComponent(JSON.stringify(stud));text+="&recaptcha_response_field="+captcha+"&recaptcha_challenge_field="+captchaChallenge+"&";(jQuery).ajax({data:text,url:"cv/register.php",success:function(data){var data1=data.split("&&");if(data1[0]=="cv-captcha-err"){alert(data1[1]);Recaptcha.reload();}else if(data1[0]=="cv-user-exists"){alert(data1[1]);}else if(data1[0]=="register_success"){(jQuery)("#reg-stdForm :input").attr("disabled",false);(jQuery)("#cv-loading-parent").remove();student=(jQuery).parseJSON(data1[2]);(jQuery)("#cv-content").hide('blind','slow');(jQuery)("#cv-content").html(data1[1]);(jQuery)("#cv-content").show('blind','slow');appInit();}
(jQuery)("#reg-stdForm :input").attr("disabled",false);(jQuery)("#cv-loading-parent").remove();},type:'POST'});}
function formCheck(form){(jQuery)(form).find(".cv-alert").remove();var retVal=true;(jQuery)(form).find(".cv-mandatory").each(function(){if(this.value==""){var fieldName=(jQuery)(this).parent().prev().children(":first-child").text();fieldName=fieldName.substring(0,fieldName.length-1);var div=(jQuery)("<div class='cv-alert ui-state-error ui-corner-all' title='Morate popuniti polje: "+fieldName+" !'></div>");(jQuery)(div).css("float","left");(jQuery)(div).width(16);(jQuery)(div).append("<center><span class='ui-icon ui-icon-alert'></span></center>");(jQuery)(this).parent().append(div);retVal=false;}});return retVal;}
function regFormCheck(){(jQuery)(".ui-state-error").remove();if((jQuery)("#lp-stdPass").val()!=(jQuery)("#lp-stdPass1").val()){var div=(jQuery)("<div class='cv-alert ui-state-error ui-corner-all' title='Lozinke se ne podudaraju!'></div>");(jQuery)(div).css("float","left");(jQuery)(div).width(16);(jQuery)(div).append("<center><span class='ui-icon ui-icon-alert'></span></center>");(jQuery)("#lp-stdPass1").parent().append(div);}
var retVal=true;(jQuery)(".cv-mandatory").each(function(){if(this.value==""){var fieldName=(jQuery)(this).parent().prev().children(":first-child").text();fieldName=fieldName.substring(0,fieldName.length-1);var div=(jQuery)("<div class='cv-alert ui-state-error ui-corner-all' title='Morate popuniti polje: "+fieldName+" !'></div>");(jQuery)(div).css("float","left");(jQuery)(div).width(16);(jQuery)(div).append("<center><span class='ui-icon ui-icon-alert'></span></center>");(jQuery)(this).parent().append(div);retVal=false;}});return retVal;}
function LoginUser(){(jQuery)("#log-stdForm :input").attr("disabled",true);(jQuery)("#log-stdForm").append("<div id='cv-loading-parent'><br/><label>Ucitavanje...</label><br/><div id='cv-loading'></div></div>");var text="action=loginUser&email="+(jQuery)("#log-stdEmail").val();text+="&pass="+(jQuery)("#log-stdPass").val()+"&";(jQuery).ajax({data:text,url:"cv/login.php",success:function(data){var data1=data.split("&&");if(data1[0]=="cv-user-nexists"){alert(data1[1]);}else if(data1[0]=="cv-login-failed"){alert(data1[1]);}else if(data1[0]=="cv-login-success"){(jQuery)("#log-stdForm :input").attr("disabled",false);(jQuery)("#cv-loading-parent").remove();student=(jQuery).parseJSON(data1[2]);(jQuery)("#cv-content").hide('blind','slow');(jQuery)("#cv-content").html(data1[1]);(jQuery)("#cv-content").show('blind','slow');appInit();}
(jQuery)("#log-stdForm :input").attr("disabled",false);(jQuery)("#cv-loading-parent").remove();},type:'POST'});}
(jQuery)("#fb-labelDiv").click(function(){var right=parseInt((jQuery)(".cv-Feedback").css("right"));if(right==-274){(jQuery)("#fb-image").attr("src","cv/images/feedback2.png");}else{(jQuery)("#fb-image").attr("src","cv/images/feedback1.png");}
(jQuery)(".cv-Feedback").animate({right:right==-274?0:-274});});(jQuery)("#fb-send").hover(function(){this.addClass("ui-state-hover");},function(){this.removeClass("ui-state-hover");});(jQuery)("#fb-send").click(function(){if((jQuery)("#fb-text").val().length<=1024&&(jQuery)("#fb-text").val().length>1){var text=(jQuery)("#fb-text").val();(jQuery).ajax({type:"POST",url:"cv/sendfeedback.php",data:{idStudenta:student.id,feedback:text}});(jQuery)("#fb-text").val("");(jQuery)("#fb-warning").html("Uspesno ste poslali feedback!").css('color','green');}else if((jQuery)("#fb-text").val().length<1){(jQuery)("#fb-warning").html("Niste uneli text!").css('color','red');}});(jQuery)("#fb-text").keyup(function(){if((jQuery)("#fb-text").val().length>1024){(jQuery)("#fb-warning").html("Uneseni tekst je predug!").css('color','red');}else{(jQuery)("#fb-warning").html("");}});function isPersonalDataChanged(stud){return!(stud.name==student.name&&stud.pname==student.pname&&stud.sname==student.sname&&stud.gender==student.gender&&stud.bdate==student.bdate&&stud.email==student.email&&stud.address1==student.address1&&stud.city1==student.city1&&stud.state1==student.state1&&stud.address2==student.address2&&stud.city2==student.city2&&stud.state2==student.state2&&stud.phone1==student.phone1&&stud.phone2==student.phone2);}
function isHighSchoolChanged(school){return!(student.highschool.name==school.name&&student.highschool.city==school.city&&student.highschool.state==school.state&&student.highschool.course==school.course&&student.highschool.gyear==school.gyear&&student.highschool.type==school.type);}})
jQuery.fn.forceNumeric=function(integersOnly){return this.each(function(){(jQuery)(this).keydown(function(e){var key=e.which||e.keyCode;if(integersOnly==0){if(!e.shiftKey&&!e.altKey&&!e.ctrlKey&&key>=48&&key<=57||key>=96&&key<=105||key==8||key==9||key==13||key==35||key==36||key==37||key==39||key==46||key==45)
return true;}else if(integersOnly==1){if(!e.shiftKey&&!e.altKey&&!e.ctrlKey&&key>=48&&key<=57||key>=96&&key<=105||key==190||key==110||key==8||key==9||key==13||key==35||key==36||key==37||key==39||key==46||key==45)
return true;}else{if(!e.shiftKey&&!e.altKey&&!e.ctrlKey&&key>=48&&key<=57||key>=96&&key<=105||key==190||key==188||key==109||key==110||key==8||key==9||key==13||key==35||key==36||key==37||key==39||key==46||key==45)
return true;}
return false;});});}
function fblogin(){FB.login(function(response){if(response.authResponse){console.log('Welcome!  Fetching your information.... ');FB.api('/me',function(response){console.log('Good to see you, '+response.name+'.');postActivity();});}else{console.log('User cancelled login or did not fully authorize.');}});}
function postActivity(){FB.api('/me/jobfairnis-app:update'+'?cv=http://www.jobfairnis.rs/ostavicv&access_token=AAADRnAXgGYEBAEHOh7CZA9u8BDwvOtsrzPTFVpRT68NZA49BwaKAOa0Acy6SjgZClq5LxkqVjsWqNtuBdFASM308ZAHmXYEiBESgBbTbsOuo8X1qbGhI','post',function(response){if(!response||response.error){console.log(response.error.message);}else{console.log('Post was successful! Action ID: '+response.id);}});}
