var short_list_current_entity_id = ''; var global_var_added_to_short_list = false; function addOneToHeaderShortList() { var new_counter = parseInt(jQuery("#header_shortlist_number").html()) + 1; jQuery("#header_shortlist_number").html(new_counter); } function addToShortListCallback() { if (global_var_added_to_short_list) { jQuery("#" + short_list_current_entity_id).removeAttr('onclick'); jQuery("#" + short_list_current_entity_id).removeClass("short_list_not_added").addClass("short_list_added").html("Shortlisted "); if (jQuery("#bot_border").css('bottom') == '1px') { jQuery("#bot_border").css({bottom: '0px'}).show(); } else { jQuery("#bot_border").css({bottom: '1px'}).show(); } if (jQuery.fn.pngFix) jQuery(document).pngFix(); } //fixing firefox's caching problem: jQuery.ajax({ url: location.href, caching:true, success: function(html) { } }); addOneToHeaderShortList(); } function addToShortListCallbackProfilePage(link_id, button_id) { if (global_var_added_to_short_list) { //button jQuery("." + button_id).addClass("btn_pressed"); jQuery("." + button_id).removeClass("short_list_not_added_profile").addClass("short_list_added_profile").html("  Add to Shortlist"); jQuery("." + button_id).attr('onclick','').unbind('click'); //link jQuery("." + link_id).removeClass("short_list_not_added_profile").addClass("short_list_added_profile").html("  Added to Shortlist"); jQuery("." + link_id).attr('onclick','').unbind('click'); if (jQuery("#bot_border").css('bottom') == '1px') { jQuery("#bot_border").css({bottom: '0px'}).show(); } else { jQuery("#bot_border").css({bottom: '1px'}).show(); } if (jQuery.fn.pngFix) jQuery(document).pngFix(); //fixing firefox's caching problem: jQuery.ajax({ url: location.href, caching:true, success: function(html) { } }); addOneToHeaderShortList(); } } function VTKCheckCookieId() { //Very important, we need to check the browser cookie before we send data to the server: var current_cookie = getCookie('cookie_id'); if (current_cookie == null || current_cookie =="") { var new_cookie_value = "911496bc8032350f98b6a1df5f5d77fc"; setCookie('cookie_id', new_cookie_value, 365*2, '/'); } //end of checking cookie. } function VTKShortListAdd(options) { //get window view port: var view_port = {width: $(window).width(), height: $(window).height(),scrollLeft: $(document).scrollLeft(), scrollTop: $(document).scrollTop()}; var checkOffset = false; if (options.checkOffset) checkOffset = true; //get all options var destination_id = options.destination_id; //tooltip div id var element_id = options.element_id; //for which element var delayed_close = options.delayed_close; var tooltip_width = options.tooltip_width; var tooltip_start_point = options.tooltip_start_point //supports 'topLeft' and 'topRight' only var tooltip_top_offset = options.tooltip_top_offset; var tooltip_left_offset = options.tooltip_left_offset; var entity_id = options.entity_id; //entity id var entity_type = options.entity_type; //entity type var ajax_handler = options.ajax_handler; var callback_function = options.callback_function; var callback_function_link_id = options.callback_function_link_id; //passing in link element id for callback functions var callback_function_button_id = options.callback_function_button_id; //passing in button element id for callback functions if(typeof(options.callback_function_link_id) == 'undefined') { var callback_function_link_id = ""; } if(typeof(options.callback_function_button_id) == 'undefined') { var callback_function_button_id = ""; } if(typeof(options.client_title) == 'undefined') { var client_title = ""; } else { var client_title = options.client_title; } if(typeof(options.fixed_position) == 'undefined') { var fixed_position = false; } else { var fixed_position = options.fixed_position; } var $destination = $('#' + destination_id); var $element = $('#' + element_id); //copy $source contents into $destination: var $destination_content = $('#' + destination_id + '_content'); var $client_title = $('#' + destination_id + '_client_title'); //check cookie: VTKCheckCookieId(); var $element_position = $element.position(); if(typeof($element_position) == 'undefined') return ''; $client_title.html(decodeURIComponent(client_title.replace(/\+/g, " "))); short_list_current_entity_id = element_id; $destination_content.html("
Adding to Shortlist..."); $destination_content.load(ajax_handler,{entity_id: entity_id, entity_type: entity_type }, function(){ callback_function(callback_function_link_id, callback_function_button_id); }); //check element's offet values to the DOM var $offsetTop = 0; var $offsetLeft = 0; if (checkOffset) { $element_offset = $element.offset(); $offsetTop = $element_offset.top; $offsetLeft = $element_offset.left; } $element_width = $element.width(); $element_height = $element.height(); if (tooltip_start_point == 'topLeft') { //top left: $my_top = parseInt($element_position.top) + parseInt($offsetTop); //$my_left = parseInt($element_position.left)+ parseInt($offsetLeft); $my_left = parseInt($offsetLeft); } else { //top right and other $my_top = parseInt($element_position.top) + parseInt($offsetTop); //$my_left = parseInt($element_position.left) + $element_width + parseInt($offsetLeft); $my_left = $element_width + parseInt($offsetLeft); } $my_top = $my_top + parseInt(tooltip_top_offset); $my_left = $my_left + parseInt(tooltip_left_offset); if(fixed_position) { } else { //check vertical position: var current_height = parseInt(view_port.height) + parseInt(view_port.scrollTop); if (current_height < $my_top + $destination.height()) { //here we need to adjust the top position and move the tooltip to the top of the element: //$my_top = parseInt($element_position.top) - parseInt($destination.height()) - 10; $my_top = current_height - $destination.height() - 10 ; } else if($my_top < parseInt(view_port.scrollTop)) { $my_top = parseInt(view_port.scrollTop) + 10; } //check horizontal position: var current_width = parseInt(view_port.width) + parseInt(view_port.scrollLeft); if (current_width < $my_left + $destination.width()) { //here we need to adjust the left position and move the tooltip to the left of the element: $my_left = parseInt($element_position.left)+ parseInt($offsetLeft) - $destination.width() - parseInt(tooltip_left_offset) + 2 ; } } $destination.css({'z-index': 999999 ,position: 'absolute',top: $my_top , left: $my_left}); if (tooltip_width > 0) { $my_width = tooltip_width + 'px' $destination.css({'width': $my_width}); } //check the global flag: tooltip_show_registration_form if(typeof(tooltip_show_registration_form) == 'undefined') { $destination.show(); if (jQuery.fn.pngFix) jQuery(document).pngFix(); }else if (tooltip_show_registration_form != 'NO') { $destination.show(); if (jQuery.fn.pngFix) jQuery(document).pngFix(); } else { //don't show the tooltip: $destination.hide(); } function closeMe() { $destination.hide(); } if (delayed_close > 0) { setTimeout(closeMe, delayed_close); } } VTKCheckCookieId();