function refreshvisitors(userId, shift) {
    x_refreshvisitors(userId, shift, refreshvisitors_cb);
}

function refreshvisitors_cb(val) {
    document.getElementById('LastVisitorsContent').innerHTML = val;
}

function refreshmygroups(userId, shift) {
    x_refreshmygroups(userId, shift, refreshmygroups_cb);
}

function refreshmygroups_cb(val) {
    document.getElementById('MyGroupsContent').innerHTML = val;
}

function refreshrelations(userId, shift) {
    x_refreshrelations(userId, shift, refreshrelations_cb);
}

function refreshrelations_cb(val) {
    document.getElementById('RelationsContent').innerHTML = val;
}

function refreshtoptagsupper(userId) {
    x_refreshtoptagsupper(userId, refreshtoptagsupper_cb);
}

function refreshtoptagsupper_cb(val) {
    document.getElementById('TopTagsContent').innerHTML = val;
}

function savetoptaguppers(userId) {
	var form = document.getElementById('topTagUppersForm');
    var arr = Array()
	for (var i = 0; i < form.length; i++) {
		var type = form.elements[i].getAttribute('type');
		if ((type == 'radio') || (type == 'checkbox')) {
			if (form.elements[i].checked) {
                arr.push(form.elements[i].getAttribute('name'));
            }
		}
	}
    x_savetoptaguppers(userId, HTML_AJAX_JSON.stringify(arr), savetoptaguppers_cb);
}

function savetoptaguppers_cb(val) {
   // document.getElementById('topTagsUpper').innerHTML = "";
    document.getElementById('TopTagsContent').innerHTML = val;
}

function showHideAddComment(id) {
    var style = document.getElementById(id).style;
    (style.display == "block")?style.display = "none":style.display = "block";
}

function showpositioncomments(id, alias) {
    x_showpositioncomments(id, alias, showpositioncomments_cb);
}

function showpositioncomments_cb(val) {
    document.getElementById("positionCommentLink_"+val.id).innerHTML = val.content;
}

function savepositioncomment(id) {
    x_savepositioncomment(id, document.getElementById('positionCommentArea_'+id).value, showpositioncomments_cb);
}

function hidepositioncomments(id) {
    x_hidepositioncomments(id, showpositioncomments_cb);
}

function addtowishlist(tagId) {
    x_addtowishlist(tagId, addtowishlist_cb);
}
function addtowishlist_cb(val) {
    document.getElementById("addtowishlistlink_"+val).onclick = null;
    document.getElementById("added_"+val).innerHTML = 'Ajout&eacute;!';
}

function showenterprisecomments(id, alias) {
    x_showenterprisecomments(id, alias, showenterprisecomments_cb);
}

function showenterprisecomments_cb(val) {
    document.getElementById("enterpriseCommentLink_"+val.id).innerHTML = val.content;
}

function saveenterprisecomment(id) {
    x_saveenterprisecomment(id, document.getElementById('enterpriseCommentArea_'+id).value, showenterprisecomments_cb);
}

function hideenterprisecomments(id) {
    x_hideenterprisecomments(id, showenterprisecomments_cb);
}

        // Showing Sajax Status
        AST_load = "Loading...";
        AST_save = "Saving...";
        AST_clear = "";
        
        function setAjaxStatus(str) {
            if (document.getElementById("ajaxStatus")) {
                var div = document.getElementById("ajaxStatus");
            } else {
                var div  = document.createElement("DIV");
                div.className = "ajaxStatus";
                div.id = "ajaxStatus";
                div.setAttribute("id", "ajaxStatus");
                document.body.appendChild(div);
            }
            div.innerHTML = str;
            if (str == AST_clear) {
                div.style.visibility = "hidden";
                return;
            }
            
            var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
            var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
            var width = document.documentElement.clientWidth || document.body.clientWidth;
            
            div.style.left = width - div.clientWidth + scrollX +"px";
            div.style.top = scrollY+"px";
            div.style.visibility = "visible";
        }
		// remote scripting library
		// (c) copyright 2005 modernmethod, inc
		var sajax_debug_mode = false;
		var sajax_request_type = "GET";
		var sajax_target_id = "";
		var sajax_failure_redirect = "";

		function sajax_debug(text) {
			if (sajax_debug_mode)
				alert(text);
		}

 		function sajax_init_object() {
 			sajax_debug("sajax_init_object() called..")

 			var A;

 			var msxmlhttp = new Array(
				'Msxml2.XMLHTTP.5.0',
				'Msxml2.XMLHTTP.4.0',
				'Msxml2.XMLHTTP.3.0',
				'Msxml2.XMLHTTP',
				'Microsoft.XMLHTTP');
			for (var i = 0; i < msxmlhttp.length; i++) {
				try {
					A = new ActiveXObject(msxmlhttp[i]);
				} catch (e) {
					A = null;
				}
			}

			if(!A && typeof XMLHttpRequest != "undefined")
				A = new XMLHttpRequest();
			if (!A)
				sajax_debug("Could not create connection object.");
			return A;
		}

		var sajax_requests = new Array();

		function sajax_cancel() {
			for (var i = 0; i < sajax_requests.length; i++)
				sajax_requests[i].abort();
		}

		function sajax_do_call(func_name, args) {
			var i, x, n;
			var uri;
			var post_data;
			var target_id;
            setAjaxStatus(AST_load);
			sajax_debug("in sajax_do_call().." + sajax_request_type + "/" + sajax_target_id);
			target_id = sajax_target_id;
			if (typeof(sajax_request_type) == "undefined" || sajax_request_type == "")
				sajax_request_type = "GET";

			uri = "http://jobmeeters.com/talents/index.php?view=Profile%2FView";
			if (sajax_request_type == "GET") {

				if (uri.indexOf("?") == -1)
					uri += "?rs=" + encodeURIComponent(func_name);
				else
					uri += "&rs=" + encodeURIComponent(func_name);
				uri += "&rst=" + encodeURIComponent(sajax_target_id);
				uri += "&rsrnd=" + new Date().getTime();

				for (i = 0; i < args.length-1; i++)
					uri += "&rsargs[]=" + encodeURIComponent(args[i]);

				post_data = null;
			}
			else if (sajax_request_type == "POST") {
				post_data = "rs=" + encodeURIComponent(func_name);
				post_data += "&rst=" + encodeURIComponent(sajax_target_id);
				post_data += "&rsrnd=" + new Date().getTime();

				for (i = 0; i < args.length-1; i++)
					post_data = post_data + "&rsargs[]=" + encodeURIComponent(args[i]);
			}
			else {
				alert("Illegal request type: " + sajax_request_type);
			}

			x = sajax_init_object();
			if (x == null) {
				if (sajax_failure_redirect != "") {
					location.href = sajax_failure_redirect;
					return false;
				} else {
					sajax_debug("NULL sajax object for user agent:\n" + navigator.userAgent);
					return false;
				}
			} else {
				x.open(sajax_request_type, uri, true);
				// window.open(uri);

				sajax_requests[sajax_requests.length] = x;

				if (sajax_request_type == "POST") {
					x.setRequestHeader("Method", "POST " + uri + " HTTP/1.1");
					x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				}

				x.onreadystatechange = function() {
					if (x.readyState != 4)
						return;

					sajax_debug("received " + x.responseText);

					var status;
					var data;
					var txt = x.responseText.replace(/^\s*|\s*$/g,"");
					status = txt.charAt(0);
					data = txt.substring(2);

					if (status == "") {
						// lets just assume this is a pre-response bailout and let it slide for now
					} else if (status == "-")
						alert("Error: " + data);
					else {
                        setAjaxStatus(AST_clear);
						if (target_id != "")
							document.getElementById(target_id).innerHTML = eval(data);
						else {
							try {
								var callback;
								var extra_data = false;
								if (typeof args[args.length-1] == "object") {
									callback = args[args.length-1].callback;
									extra_data = args[args.length-1].extra_data;
								} else {
									callback = args[args.length-1];
								}
								callback(eval(data), extra_data);
							} catch (e) {
								sajax_debug("Caught error " + e + ": Could not eval " + data );
							}
						}
					}
				}
			}

			sajax_debug(func_name + " uri = " + uri + "/post = " + post_data);
			x.send(post_data);
			sajax_debug(func_name + " waiting..");
			delete x;
			return true;
		}

		
		// wrapper for refreshEnterprise
		function x_refreshEnterprise() {
			sajax_do_call("refreshEnterprise",
				x_refreshEnterprise.arguments);
		}

		
		// wrapper for refreshKnowhow
		function x_refreshKnowhow() {
			sajax_do_call("refreshKnowhow",
				x_refreshKnowhow.arguments);
		}

		
		// wrapper for refreshMyweb
		function x_refreshMyweb() {
			sajax_do_call("refreshMyweb",
				x_refreshMyweb.arguments);
		}

		
		// wrapper for refreshWishList
		function x_refreshWishList() {
			sajax_do_call("refreshWishList",
				x_refreshWishList.arguments);
		}

		
		// wrapper for removeFile
		function x_removeFile() {
			sajax_do_call("removeFile",
				x_removeFile.arguments);
		}

		
		// wrapper for addTag
		function x_addTag() {
			sajax_do_call("addTag",
				x_addTag.arguments);
		}

		
		// wrapper for selectedTag
		function x_selectedTag() {
			sajax_do_call("selectedTag",
				x_selectedTag.arguments);
		}

		
		// wrapper for selectedTagType
		function x_selectedTagType() {
			sajax_do_call("selectedTagType",
				x_selectedTagType.arguments);
		}

		
		// wrapper for searchUser
		function x_searchUser() {
			sajax_do_call("searchUser",
				x_searchUser.arguments);
		}

		
		// wrapper for selectCategory
		function x_selectCategory() {
			sajax_do_call("selectCategory",
				x_selectCategory.arguments);
		}

		
		// wrapper for saveSearch
		function x_saveSearch() {
			sajax_do_call("saveSearch",
				x_saveSearch.arguments);
		}

		
		// wrapper for searching
		function x_searching() {
			sajax_do_call("searching",
				x_searching.arguments);
		}

		
		// wrapper for changeTheme
		function x_changeTheme() {
			sajax_do_call("changeTheme",
				x_changeTheme.arguments);
		}

		
		// wrapper for refreshvisitors
		function x_refreshvisitors() {
			sajax_do_call("refreshvisitors",
				x_refreshvisitors.arguments);
		}

		
		// wrapper for refreshrelations
		function x_refreshrelations() {
			sajax_do_call("refreshrelations",
				x_refreshrelations.arguments);
		}

		
		// wrapper for refreshmygroups
		function x_refreshmygroups() {
			sajax_do_call("refreshmygroups",
				x_refreshmygroups.arguments);
		}

		
		// wrapper for refreshtoptagsupper
		function x_refreshtoptagsupper() {
			sajax_do_call("refreshtoptagsupper",
				x_refreshtoptagsupper.arguments);
		}

		
		// wrapper for savetoptaguppers
		function x_savetoptaguppers() {
			sajax_do_call("savetoptaguppers",
				x_savetoptaguppers.arguments);
		}

		
		// wrapper for showpositioncomments
		function x_showpositioncomments() {
			sajax_do_call("showpositioncomments",
				x_showpositioncomments.arguments);
		}

		
		// wrapper for savepositioncomment
		function x_savepositioncomment() {
			sajax_do_call("savepositioncomment",
				x_savepositioncomment.arguments);
		}

		
		// wrapper for hidepositioncomments
		function x_hidepositioncomments() {
			sajax_do_call("hidepositioncomments",
				x_hidepositioncomments.arguments);
		}

		
		// wrapper for addtowishlist
		function x_addtowishlist() {
			sajax_do_call("addtowishlist",
				x_addtowishlist.arguments);
		}

		
		// wrapper for showenterprisecomments
		function x_showenterprisecomments() {
			sajax_do_call("showenterprisecomments",
				x_showenterprisecomments.arguments);
		}

		
		// wrapper for saveenterprisecomment
		function x_saveenterprisecomment() {
			sajax_do_call("saveenterprisecomment",
				x_saveenterprisecomment.arguments);
		}

		
		// wrapper for hideenterprisecomments
		function x_hideenterprisecomments() {
			sajax_do_call("hideenterprisecomments",
				x_hideenterprisecomments.arguments);
		}

		