var isIE=document.all?true:false;var isNS=document.layers?true:false;var items=new Array();items[0]=0;emailCont=1;phoneCont=1;picCont=0;degreeCont=1;actualTab=0;timing=0;function getuserTweets(b){var a="joseluisgonl";var c=5;$.getJSON("http://search.twitter.com/search.json?callback=?&rpp="+c+"&q=from:"+a,function(d){$.each(d,function(f,e){for(var g=0;g<e.length;g++){if(e[g].text!==undefined){$("#"+b).append("<p>"+e[g].text+"</p>")}}})})}function looping(a){if(a==undefined){next(this)}timing=setTimeout("looping()",5000)}function next(c){clearTimeout(timing);var d=$("#bloquePrincipal");var b=$("#titulos");var a=d.children().size();actualTab++;if(actualTab==a){actualTab=0;b.fadeOut(function(){b.text($($(d.children()[actualTab]).children()[0]).text());b.fadeIn()});$(d.children()[a-1]).fadeOut(function(){$(d.children()[actualTab]).fadeIn()})}else{b.fadeOut(function(){b.text($($(d.children()[actualTab]).children()[0]).text());b.fadeIn()});$(d.children()[actualTab-1]).fadeOut(function(){$(d.children()[actualTab]).fadeIn()})}}function previous(c){clearTimeout(timing);var d=$("#bloquePrincipal");var b=$("#titulos");var a=d.children().size();actualTab--;if(actualTab==-1){actualTab=a-1;b.fadeOut(function(){b.text($($(d.children()[a-1]).children()[0]).text());b.fadeIn()});$(d.children()[0]).fadeOut(function(){$(d.children()[a-1]).fadeIn()})}else{b.fadeOut(function(){b.text($($(d.children()[actualTab]).children()[0]).text());b.fadeIn()});$(d.children()[actualTab+1]).fadeOut(function(){$(d.children()[actualTab]).fadeIn()})}}function addHidenFormField(c,b,a){if(picCont==0){$("#"+c).before('<hr style="margin-bottom:13px"/>')}pic='<div class="input text hidden specialInput" id="'+picCont+'Pic">'+a+'<label>Título</label><input type="text" name="data[Picture]['+picCont+'][titulo]" maxlength="255"/><input type="hidden" name="data[Picture]['+picCont+'][id]" maxlength="255" value="'+b+'"/></div><div class="clear"></div>';$("#"+c).before(pic);$("#"+picCont+"Pic").fadeIn();picCont++}function ajaxLoad(b,a){$("#loader").fadeIn();$.ajax({type:"GET",url:a+"/"+b,success:function(c){$("#loader").fadeOut();$("#ajaxLoad").html(c).fadeIn()}})}function addNewDegree(){numero=$("#AuthorDegrees").children().size()+1;$("#AuthorDegrees").bind("click",function(a){pick=this.options[this.selectedIndex].value;if(pick==numero){addDegreeField(addDegreeLinkName+deleteContent,false,"","");this.selectedIndex=0}else{if(pick!=-1){addDegreeField(addDegreeLinkName+deleteContent,true,this.options[this.selectedIndex].text,addDegreeLinkId,pick);this.selectedIndex=0}}});$("#AuthorDegrees").prepend('<option value="-1">---Seleccione---</option>');$("#AuthorDegrees").append('<option value="'+numero+'">---Crear la Especialidad---</option>');$("#AuthorDegrees").val(0)}function addMark(a,b){if(a=="email"){$("#Email0Email").after(b)}else{if(a=="phone"){$("#Phone0Numero").after(b)}}}function addEmailField(a){a=a.replace(/#/,emailCont);a=a.replace(/#/,emailCont);$("#newEmail").before(a);$("#newEmail").prev().fadeIn();emailCont++}function addPhoneField(a){a=a.replace(/#/,phoneCont);a=a.replace(/#/,phoneCont);$("#newTelefono").before(a);$("#newTelefono").prev().fadeIn();phoneCont++}function addDegreeField(d,a,c,e,b){d=d.replace(/#/,degreeCont);d=d.replace(/#/,degreeCont);if(a){e=e.replace(/#/,degreeCont);e=e.replace(/#/,degreeCont);e=e.replace("$",b);d=d.replace("$",c);d=d.replace("&","READONLY");d=d.replace("%","Ignoredegree");$("#newDegree").before(d);$("#newDegree").prev().fadeIn();$("#newDegree").before(e)}else{d=d.replace("$","");d=d.replace("&","");d=d.replace("%","Newdegree");$("#newDegree").before(d);$("#newDegree").prev().fadeIn()}degreeCont++}function deleteField(a){$(a).parent().fadeOut(function(){$(a).parent().remove()})}function redondear(b){var c=parseFloat(b);var a=Math.round(c*100)/100;return a}function onlyDigits(d){decReq="decOK";var a=(isIE)?window.event.keyCode:d.which;var c=(isIE)?event.srcElement:d.target;var f=(a>47&&a<58)?true:false;var b=(a==46&&decReq=="decOK"&&(c.value.indexOf(".")<0||c.value.length==0))?true:false;if(a<32){return true}return(f||b)}function disable(){altern=$(this).parent().next();if(this.value=="todas pagadas"||this.value=="todas pendientes"){altern.fadeOut()}else{if(altern.css("display")=="none"){altern.fadeIn()}}}function suma(a){a.parent().next().children()[1].value=redondear((parseFloat(a.parent().prev().children()[1].value)*(parseFloat(a[1-1].value))));summAll()}function init(){$("#BillSubtotal")[0].value=0;$("#BillIva")[0].value=9;$("#BillTotal")[0].value=0;$($(".submit").children()[0]).click(function(){cont=0;while($("#Item"+cont+"Total").length>0){$("#Item"+cont+"Total")[0].disabled=false;cont++}$("#BillSubtotal")[0].disabled=false;$("#BillIva")[0].disabled=false;$("#BillTotal")[0].disabled=false})}function addItem(){var a=items.length;if(a-1==0){$("#fijo").after(contenido.replace(/0/g,a)).next().fadeIn("normal")}else{$("#remove"+(items[a-1])).parent().after(contenido.replace(/0/g,(items[a-1]+1))).next().fadeIn("normal")}items[a]=items[a-1]+1}function removeItem(b){temp=b[0].id;num=parseInt(temp.substring(6,temp.length));for(var a=items.length-1;a>=0;a--){if(items[a]==num){b.parent().fadeOut("normal",fade);items.splice(a,1);break}}}function fade(){$(this).remove();summAll()}function summAll(){total=0;for(var a=items.length-1;a>=0;a--){if(!$("#Item"+items[a]+"Total")[0].value==""){total=total+parseFloat($("#Item"+items[a]+"Total")[0].value)}}$("#BillSubtotal")[0].value=redondear(total);$("#BillTotal")[0].value=redondear(total*parseFloat("1.0"+$("#BillIva")[0].value))};
