/*
*
* Copyright Worketer.com
* Tous droits réservés
*
*/
var position = 0;
var gFieldName = '';
var gDivName = '';
var gProcessPage = '';
var do_ajax = '';
var number = '0';
var tunnel = '7d7820c7c904e7d9a06e71cc4daf948d';
var ResultLogin = '';
var dires = 'home.do';
var directions = "";
var super_loader = '
Veuillez patienter...
';
var mini_loader = '
';
var mini_sablier = '
';
var direction_del = "";
var transmit = "X";
// autocomplete
function ac_return(field, item){
// on met en place l'expression régulière
var regex = new RegExp('pid-[0123456789]*', 'i');
// on l'applique au contenu
var nomimage = regex.exec($(item).innerHTML);
//on récupère l'id
id = nomimage[0].replace('pid-', '');
// et on l'affecte au champ caché
window.open('/profile.do?id=' + id, '_parent');
}
function te_return(field, item){
// on met en place l'expression régulière
var regex = new RegExp('pid-[0123456789]*', 'i');
// on l'applique au contenu
var nomimage = regex.exec($(item).innerHTML);
//on récupère l'id
id = nomimage[0].replace('pid-', '');
// et on l'affecte au champ caché
if( id == 0)
{
ptechno($('destinataire').value);
$('destinataire').value='';
}
else
{
searcht(field, id);
$('destinataire').value='';
}
}
// autocomplete
function so_return(field, item){
// on met en place l'expression régulière
var regex = new RegExp('pid-[0123456789]*', 'i');
// on l'applique au contenu
var nomimage = regex.exec($(item).innerHTML);
//on récupère l'id
id = nomimage[0].replace('pid-', '');
// et on l'affecte au champ caché
$('societe_change').innerHTML = 'Votre société a bien été sélectionnée';
$('id_societe').value = id;
if(confirm('Changer de société ?'))
{
window.open('/_formSubmit.php?update_type=societe_switch&id_societe=' + id, '_parent');
}
}
/* Classe Worketer */
var Worketer = {
newheight: 32,
maxheight: 200,
maxadd: 0,
textareas: 0,
soustra: 0,
onDOMReady: function(handler){
if (document.addEventListener) {
if (navigator.userAgent.indexOf('AppleWebKit/') > -1 || window.opera){
var timer = window.setInterval(function() {
if (/loaded|complete/.test(document.readyState)){
window.clearInterval(timer);
handler();
}
}, 30);
}else document.addEventListener('DOMContentLoaded', handler, false);
}else{
var tempNode = document.createElement('document:ready');
(function(){
try {
if(document.readyState != 'complete')
return setTimeout(arguments.callee, 30);
tempNode.doScroll('left');
tempNode = null;
handler();
}catch (e){
setTimeout(arguments.callee, 30);
}
})()
}
},
UserSta: function(pam)
{
show_rideau();
show_div("request_message");
close_div("requesto");
load_page("requests_statut.php?follow=" + escape(pam) , 'request_message' );
},
growing: function(textarea, max)
{
this.maxheight = max;
Worketer.textareas = textarea;
// This section prevents display bug (artefact)
Event.observe($(textarea), 'keypress', function(e)
{
if(e.keyCode == 13)
{
Worketer.newheight = (parseInt($(textarea).value.split("\n" ).length + 1 + Worketer.maxadd) * 21) + 5;
Worketer.recalculate();
}
}
);
Event.observe($(textarea), 'keyup', function(e)
{
Worketer.maxadd=0;
Worketer.newheight = $(textarea).style.height.replace('px', '');
Worketer.debordinge($(textarea).value.split("\n" ));
Worketer.newheight = (parseInt($(textarea).value.split("\n" ).length + Worketer.maxadd) * 21) + 5;
Worketer.recalculate();
}
);
},
debordinge: function(lines)
{
var output = '';
var reallength = '';
for(i=0; i < lines.length; i++)
{
var soustract = 0;
reallength = lines[i].length;
// real length ratios (simon lamelliere)
if(lines[i].split('@').length > 1) soustract += Math.round(lines[i].split(')').length * 2);
if(lines[i].split(')').length > 1) soustract += Math.round(lines[i].split(')').length / 2.7);
if(lines[i].split('(').length > 1) soustract += Math.round(lines[i].split('(').length / 2.7);
if(lines[i].split('-').length > 1) soustract += Math.round(lines[i].split('-').length / 2.7);
if(lines[i].split('*').length > 1) soustract += Math.round(lines[i].split('*').length / 3.2);
if(lines[i].split('/').length > 1) soustract += Math.round(lines[i].split('/').length / 2);
if(lines[i].split('\\').length > 1) soustract += Math.round(lines[i].split('\\').length / 2);
if(lines[i].split(',').length > 1) soustract += Math.round(lines[i].split(',').length / 2.1);
if(lines[i].split(';').length > 1) soustract += Math.round(lines[i].split(';').length / 2.1);
if(lines[i].split(':').length > 1) soustract += Math.round(lines[i].split(':').length / 2.1);
if(lines[i].split('.').length > 1) soustract += Math.round(lines[i].split('.').length / 2.1);
if(lines[i].split(' ').length > 1) soustract += Math.round(lines[i].split(' ').length / 2.1);
if(lines[i].split('!').length > 1) soustract += Math.round(lines[i].split('!').length / 2.1);
if(lines[i].split('f').length > 1) soustract += Math.round(lines[i].split('f').length / 2);
if(lines[i].split('j').length > 1) soustract += Math.round(lines[i].split('j').length / 1.7);
if(lines[i].split('i').length > 1) soustract += Math.round(lines[i].split('i').length / 1.7);
if(lines[i].split('l').length > 1) soustract += Math.round(lines[i].split('l').length / 1.7);
if(lines[i].split('"').length > 1) soustract += Math.round(lines[i].split('"').length / 2.9);
if(lines[i].split("'").length > 1) soustract += Math.round(lines[i].split("'").length / 1.55);
// Soustract
reallength = reallength - soustract;
if((reallength/50) > 1)
{
this.maxadd = Math.round((this.maxadd + reallength)/50);
if(Math.round((this.maxadd + reallength)/50) > (this.maxadd + reallength)/50)
this.maxadd = Math.round((this.maxadd + reallength)/50) - 1;
}
// output += lines[i] + " " + (reallength/50) + " " + reallength + " " + this.maxadd + "
";
}
// $('news_feeder').innerHTML = output;
},
recalculate: function()
{
if(this.newheight < Worketer.maxheight)
{
$(Worketer.textareas).style.overflow = 'none';
$(Worketer.textareas).style.height = this.newheight+'px';
}
else
{
$(Worketer.textareas).style.overflow = 'auto';
}
},
editSkills: function() {
var callback = function(request) {
document.getElementById("edit_skills").innerHTML = request.responseText;
new Effect.ScrollTo($('edit_skills'), { offset: -255, duration: 0.8 });
ajax_exec("edit_skills");
};
load_page_post_min("_updatetech_liste.php", "edit_skills", {}, null, 1, callback);
$('edit_skills').innerHTML = super_loader;
$('edit_skills').style.border = "1px solid #999999";
$('edit_skills').style.padding = "4px";
},
editLanguages: function() {
var callback = function(request) {
document.getElementById("edit_languages").innerHTML = request.responseText;
new Effect.ScrollTo($('edit_languages'), { offset: -255, duration: 0.8 });
ajax_exec("edit_languages");
};
load_page_post_min("_updatetech_langue.php", "edit_languages", {}, null, 1, callback);
$('edit_languages').innerHTML = super_loader;
$('edit_languages').style.border = "1px solid #999999";
$('edit_languages').style.padding = "4px";
},
editProfile: function() {
show_rideau();
show_div("request_profile");
close_div("requesto");
load_page("_updateprofile_ajax.do?ADMIN_NOLAYOUT", 'request_profile');
},
reloadProfile: function() {
load_page_post('/profile.do?ADMIN_NOLAYOUT=1', 'body_container');
new Effect.ScrollTo($('prebody_agile'), { offset: -255, duration: 0.8 });
},
saveAjaxProfile: function() {
var cbs = function(request)
{
if(request.responseText == 1)
{
simple_close_div("request_profile");
close_rideau();
Worketer.reloadProfile();
}
else
{
$('request_profile').innerHTML = request.responseText;
ajax_exec('request_profile');
}
};
load_page_post_min("_updateprofile_ajax.do?check=1&ADMIN_NOLAYOUT=1", 'request_profile',
{
fc_genre: $('fc_genre').value,
fc_nom: $('fc_nom').value,
fc_prenom: $('fc_prenom').value,
fc_info_cf: $('fc_info_cf').value,
fc_naissance: $('fc_naissance').value,
fc_tel: $('fc_tel').value,
fc_zip: $('fc_zip').value,
fc_ville: $('fc_ville').value,
fc_pays_id: $('fc_pays_id').value,
fc_location_id: $('fc_location_id').value,
fc_langue_id: $('fc_langue_id').value,
fc_formation_id: $('fc_formation_id').value,
fc_cv_id: $('fc_cv_id').value,
fc_statut_id: $('fc_statut_id').value,
fc_experience_id: $('fc_experience_id').value,
fc_profession_id: $('fc_profession_id').value,
fc_dominance_id: $('fc_dominance_id').value,
fc_condition_accepted: $('fc_condition_accepted').value
}, null, null, cbs
);
},
editText: function() {
// $('description_user').style.border = "1px solid #999";
// $('description_user').style.padding = '2px';
$('edit_input').style.display = '';
$('description_user').style.cursor = "pointer";
$('description_user').onclick = function() { Worketer.launchEdit(); };
},
launchEdit: function() {
load_page_post("/inner/editDesc.php", "description_user_input");
$('description_user').style.display = 'none';
},
flushText: function () {
// $('description_user').style.border = '0px';
//$('description_user').style.padding = '0px';
// $('edit_input').style.display = 'none';
$('description_user').style.cursor = 'default';
},
newDescription: function(text) {
var callback = function(request) {
$('description_user_input').innerHTML = '';
$('description_user').style.display = '';
$('description_user_txt').innerHTML = request.responseText;
};
load_page_post_min("/p/new_description", "description_user_input", {descr: text}, null, 1, callback);
},
setParameter: function(parameter, value) {
mini_loader = mini_sablier;
callback = null;
if(parameter == 'widget_search')
{
callback = function(request) { document.getElementById("Worketer_Callback").innerHTML = request.responseText; Worketer.SetRemontee(false, $('filter1')); load_page('widget_feed.do?ADMIN_NOLAYOUT', "news_feeder"); };
}
if(parameter == 'remontee')
{
callback = function(request) { document.getElementById("Worketer_Callback").innerHTML = request.responseText; Worketer.SetRemontee(false, $('filter1')); load_page('widget_feed.do?ADMIN_NOLAYOUT', "news_feeder"); };
}
load_page_post_min("/p/set_parameter", "Worketer_Callback", {param: parameter, val: value}, null, null, callback);
},
StatutDelete: function(id) {
mini_loader = mini_sablier;
callback = function(request) { document.getElementById("Worketer_Callback").innerHTML = request.responseText; close_div('gstatus_' + id); };
load_page_post_min("/p/statut_delete", "Worketer_Callback", {sid: id}, null, null, callback);
},
FlushStatut: function() {
mini_loader = mini_sablier;
callback = function(request) { document.getElementById("Worketer_Callback").innerHTML = request.responseText; close_div('actual_statut'); };
load_page_post_min("/p/statut_flush", "Worketer_Callback", {}, null, null, callback);
},
Resend: function() {
show_rideau();
show_div("request_message");
close_div("requesto");
load_page("requests_activation.php" , 'request_message' );
},
changeLang: function() {
show_rideau();
show_div("request_message");
close_div("requesto");
load_page("requests_lang.php" , 'request_message' );
},
Join: function(id) {
show_rideau();
show_div("request_message");
close_div("requesto");
load_page("requests_join.php?id=" + id , 'request_message' );
},
ChangePicture: function() {
show_rideau();
show_div("request_message");
close_div("requesto");
load_page("requests_photo.php", 'request_message' );
},
SetRemontee: function(say, ele) {
$('filter1').className = 'bloc_filter_blank';
$('filter2').className = 'bloc_filter_blank';
$('filter3').className = 'bloc_filter_blank';
$('filter4').className = 'bloc_filter_blank';
$(ele.id).className = 'bloc_filter';
load_page('widget_feed.do?ADMIN_NOLAYOUT=1&forced=' + say, "news_feeder");
},
StatusUpdate: function() {
Worketer.setParameter('remontee', $('hp1').checked + "," + $('hp2').checked + "," + $('hp3').checked);
},
SavePicture: function(picture) {
load_page_post_min("/p/set_picture", "request_message", {files: picture}, null);
},
ConfirmFriend: function(accept, deny, id, j) {
show_rideau();
show_div("request_message");
close_div("requesto");
load_page_post("requests_confirm.php", 'request_message', { fid: id, accepts: accept, denys: deny, datax: j } );
},
JoinCB: function (cb) {
results = cb.responseText;
if ( results )
{
window.open('/groups.do?id='+results, '_parent');
}
else
{
alert("Une erreur inconnue s'est produite, veuillez nous en excuser.");
}
},
JoinGroup: function(params) {
nocacherandom = new String (Math.random()); nocacherandom = nocacherandom.substring(2,11);
show_loader ('request_message');
var urls = "/p/join_group";
load_ajax_post(urls, Worketer.JoinCB, params);
},
upload: function(tohide, divId) {
document.getElementById(tohide).style.display = 'none';
document.getElementById(divId).innerHTML = mini_loader;
},
getLevel: function(e) {
$('level_for_'+e).style.display = '';
load_page_post_min('/inner/level.php', 'level_for_'+e,
{
ajax:1,
id: e
} , null, 'default',
function(s) { $('level_for_'+e).innerHTML = s.responseText; } );
}
}
function WSearch(mot, id)
{
window.open('/profile.do?id=' + id, '_parent');
}
function setClicked(id) {
if(id == 1)
{
$('set1').className = "item active";
$('set2').className = "item";
$('photo_1').style.display = "";
$('photo_2').style.display = "none";
}
else
{
$('set2').className = "item active";
$('set1').className = "item";
$('photo_2').style.display = "";
$('photo_1').style.display = "none";
}
}
function yout(page)
{
document.getElementById('left_' + page).style.background = 'url(/images/button.png) no-repeat';
document.getElementById('right_' + page).style.background = 'url(/images/button.png) no-repeat';
document.getElementById('right_' + page).style.backgroundPosition = 'top right';
}
function yhover(page)
{
document.getElementById('left_' + page).style.background = 'url(/images/button_hover.png) no-repeat';
document.getElementById('right_' + page).style.background = 'url(/images/button_hover.png) no-repeat';
document.getElementById('right_' + page).style.backgroundPosition = 'top right';
}
function mgover(page)
{
document.getElementById('left_' + page).style.background = 'url(/images/menu_new_hover.png) no-repeat';
document.getElementById('right_' + page).style.background = 'url(/images/menu_new_hover.png) no-repeat';
document.getElementById('right_' + page).style.backgroundPosition = 'top right';
}
function mhover(page, still)
{
if(!still)
{
document.getElementById('left_' + page).style.background = 'url(/images/menu_new_hover.png) no-repeat';
document.getElementById('right_' + page).style.background = 'url(/images/menu_new_hover.png) no-repeat';
document.getElementById('inner_' + page).style.backgroundColor = '#FFFFFF';
document.getElementById('slink_' + page).style.color = '#000000';
document.getElementById('right_' + page).style.backgroundPosition = 'top right';
}
if(document.getElementById('menu_' + page)) document.getElementById('menu_' + page).style.display = '';
}
function mout(page, still)
{
if(!still)
{
document.getElementById('left_' + page).style.background = 'url(/images/menu_new.png) no-repeat';
document.getElementById('right_' + page).style.background = 'url(/images/menu_new.png) no-repeat';
document.getElementById('right_' + page).style.backgroundPosition = 'top right';
}
document.getElementById('inner_' + page).style.backgroundColor = '#4C7CA1';
document.getElementById('slink_' + page).style.color = '#FFF';
if(document.getElementById('menu_' + page)) document.getElementById('menu_' + page).style.display = 'none';
}
// Set as loader
function set_as_loader(divId)
{
document.getElementById(divId).innerHTML = super_loader;
}
function checks(container_id, state)
{
var checkboxes = document.getElementById(container_id).getElementsByTagName('input');
for (var i=0;i