//------------------------------------------------------------------------------ // IPS JS: Attach Functions // (c) 2005 Invision Power Services, Inc. // http://www.invisionpower.com // Matt Mecham (16/12/05) //------------------------------------------------------------------------------ var ips_personal_portal = new ips_personal_portal(); function ips_personal_portal() { /** * Rating wrapper */ this.div_rating_wrapper = 'pp-rating-wrapper'; /** * Rating image text piece */ this.text_rating_image = 'pp-rating-img-'; /** * CSS classes */ this.css_classes = { 'pp-tabon' : 'pp-tabon', 'pp-taboff' : 'pp-taboff', 'pp-tabshaded' : 'pp-tabshaded', 'pp-contentbox-back' : 'pp-contentbox-back', 'pp-contentbox-entry-noheight' : 'pp-contentbox-entry-noheight', 'pp-contentbox-entry-noheight-mod' : 'pp-contentbox-entry-noheight-mod', 'pp-contentbox-entry-noheight-sel' : 'pp-contentbox-entry-noheight-sel' }; /** * Contact types */ this.contact_types = { 'aim' : 'aim', 'msn' : 'msn', 'icq' : 'icq', 'yahoo' : 'yahoo' }; /** * Content Tabs */ this.content_tabs = { }; /** * Stored tabs */ this.stored_tabs = { }; /** * Stored div classes */ this.stored_div_classes = { }; /** * iframe tabs */ this.iframe_tabs = { 'comments' : ipb_var_base_url + 'act=profile&CODE=personal_iframe_comments', 'settings' : ipb_var_base_url + 'act=profile&CODE=personal_iframe_settings', 'friends' : ipb_var_base_url + 'act=profile&CODE=personal_iframe_friends' }; /** * Stored tabs */ this.stored_tabs_css = { }; /** * Other wrappers */ this.div_names = { 'pp-entry-gender-wrap' : 'pp-entry-gender-wrap', 'pp-entry-gender-text' : 'pp-entry-gender-text', 'pp-entry-gender-img' : 'pp-entry-gender-img', 'pp-entry-gender-imgwrap' : 'pp-entry-gender-imgwrap', 'pp-entry-location-wrap' : 'pp-entry-location-wrap', 'pp-entry-location-text' : 'pp-entry-location-text', 'pp-entry-born-wrap' : 'pp-entry-born-wrap', 'pp-entry-born-text' : 'pp-entry-born-text', 'pp-entry-age-wrap' : 'pp-entry-age-wrap', 'pp-entry-age-text' : 'pp-entry-age-text', 'pp-entry-age-yearsold' : 'pp-entry-age-yearsold', 'pp-main-tab-content' : 'pp-main-tab-content', 'pp-content-tab' : 'pp-content-tab', 'pp-comment-textarea' : 'pp-comment-textarea', 'pp-comments-wrap' : 'pp-comments-wrap', 'pp-comment-entry' : 'pp-comment-entry', 'pp-comment-entry-main' : 'pp-comment-entry-main', 'pp-iframe-wrap' : 'pp-iframe-wrap', 'pp-entry-contact-wrap' : 'pp-entry-contact-wrap', 'pp-entry-contact-entry' : 'pp-entry-contact-entry', 'pp-main-photo' : 'pp-main-photo', 'pp-personal_statement' : 'pp-personal_statement', 'pp-checked' : 'pp-checked', 'pp-friend-img' : 'pp-friend-img', 'pp-friend-text' : 'pp-friend-text', 'pp-friend-wrap' : 'pp-friend-wrap' }; /** * Settings */ this.settings = { 'allow_rating' : 0, 'default_rating' : 3, 'edit_allowed' : 0, 'member_id' : 0, 'viewer_id' : 0, 'img_star_on' : 'star_filled.gif', 'img_star_selected' : 'star_selected.gif', 'img_star_off' : 'star_empty.gif', 'img_gender_male' : 'gender_male.png', 'img_gender_female' : 'gender_female.png', 'img_gender_mystery': 'gender_mystery.png', 'img_base_url' : '', 'img_menu_icon' : '', 'default_tab' : '', 'photo_def_width' : '150', 'photo_def_height' : '150', 'photo_def_src' : ipb_var_image_url + '/folder_profile_portal/pp-blank-large.png', 'img_friend_remove' : ipb_var_image_url + '/folder_profile_portal/friend_remove_small.png', 'img_friend_add' : ipb_var_image_url + '/folder_profile_portal/friend_add_small.png' }; /** * Language */ this.languages = { 'rate_me' : 'Rate Me', 'img_alt_rate' : 'Rate this member, click on desired star to send rating', 'gender_male' : 'Male', 'gender_female' : 'Female', 'gender_mystery' : 'Gender Not Set', 'saving_comment' : 'Saving Comment...', 'loading_tab' : ajax_load_msg, 'deleting_comment' : 'Deleting Comment...', 'friend_add' : 'Add as Friend', 'friend_remove' : 'Remove Friend' }; /** * Loaded tab */ var loaded_tab = null; /** * INIT */ this.init = function() { //----------------------------------------- // INIT tabs //----------------------------------------- var divs = document.getElementsByTagName( 'DIV' ); var divcount = 0; //---------------------------------- // Sort through and grab divs //---------------------------------- for ( var i = 0 ; i <= divs.length ; i++ ) { try { if ( ! divs[i].id ) { continue; } } catch(error) { continue; } var divid = divs[i].id; var divname = ipsclass.get_name_from_text( divs[i].id ); var divnum = ipsclass.get_id_from_text( divs[i].id ); //---------------------------------- // Work with it? //---------------------------------- if ( divname == this.div_names['pp-content-tab'] ) { var _highlight = 0; this.stored_tabs[ divnum ] = divs[i]; this.stored_tabs_css[ divnum ] = divs[i].className; divs[i].style.cursor = 'pointer'; divs[i].onclick = this.tab_onclick; //----------------------------------------- // Show this tab? //----------------------------------------- if ( this.settings['default_tab'] != "" ) { if ( this.settings['default_tab'] == divnum ) { _highlight = 1; } } else if ( divcount == 0 ) { _highlight = 1; } //---------------------------------- // Set correct classes / display //---------------------------------- if ( _highlight == 1) { // First tab... divs[i].className = this.css_classes['pp-tabon']; divs[i].style.display = 'block'; } else { // Second tab if ( divs[i].className != this.css_classes['pp-tabshaded'] ) { divs[i].className = this.css_classes['pp-taboff']; } divs[i].style.display = 'block'; } divcount++; } } //----------------------------------------- // Draw rating images... //----------------------------------------- this.init_rating_images(); //----------------------------------------- // Render drop down boxes //----------------------------------------- this.show_dropdown_boxes(); }; /** * Show friend add/remove */ this.show_friend_add_or_remove = function( add_friend ) { try { var _div = document.getElementById( this.div_names['pp-friend-wrap'] ); var _html = ''; if ( _div.id ) { if ( add_friend ) { _html = " "; _html += "" + this.languages['friend_add'] + ""; } else { _html = " "; _html += "" + this.languages['friend_remove'] + ""; } _div.innerHTML = _html; } } catch(error) { } }; /** * Toggle DIV class for a comment box */ this.toggle_comment_box = function( comment_id, from_iframe ) { //----------------------------------------- // INIT //----------------------------------------- comment_id = parseInt( comment_id ); from_iframe = parseInt( from_iframe ); //----------------------------------------- // Work out document... //----------------------------------------- var _document = document; if ( from_iframe ) { var iframe = document.getElementById( 'pp-main-tab-content-iframe' ); if ( iframe.contentDocument ) { _document = iframe.contentDocument; } else if ( iframe.contentWindow ) { _document = iframe.contentWindow.document; } else if ( iframe.document ) { _document = iframe.document; } } //----------------------------------------- // Continue... //----------------------------------------- if ( comment_id ) { var _div = _document.getElementById( this.div_names['pp-comment-entry-main'] + '-' + comment_id ); var _box = _document.getElementById( this.div_names['pp-checked'] + '-' + comment_id ); var _class = _div.className; if ( _class == this.css_classes['pp-contentbox-entry-noheight'] || _class == this.css_classes['pp-contentbox-entry-noheight-mod'] ) { this.stored_div_classes[ this.div_names['pp-comment-entry'] + '-' + comment_id ] = _class; _div.className = this.css_classes['pp-contentbox-entry-noheight-sel']; } else if ( this.stored_div_classes[ this.div_names['pp-comment-entry'] + '-' + comment_id ] ) { _div.className = this.stored_div_classes[ this.div_names['pp-comment-entry'] + '-' + comment_id ]; } else { _div.className = this.css_classes['pp-contentbox-entry-noheight']; } } return true; }; /** * Convert some stuff to drop down boxes */ this.show_dropdown_boxes = function() { //----------------------------------------- // INIT //----------------------------------------- var html = ''; //----------------------------------------- // Are we the same ID as the viewer //----------------------------------------- if ( ( this.settings['member_id'] == this.settings['viewer_id'] ) && ( this.settings['viewer_id'] ) && ( this.settings['edit_allowed'] == 1 ) ) { try { //----------------------------------------- // Gender box... //----------------------------------------- var _wrap = document.getElementById( this.div_names['pp-entry-gender-wrap'] ); _wrap.className = 'popmenubutton-new'; ipsmenu.register( "pp-entry-gender-wrap" ); //----------------------------------------- // Location box... //----------------------------------------- var _wrap = document.getElementById( this.div_names['pp-entry-location-wrap'] ); _wrap.className = 'popmenubutton-new'; ipsmenu.register( "pp-entry-location-wrap" ); //----------------------------------------- // Birthdate box... //----------------------------------------- var _wrap = document.getElementById( this.div_names['pp-entry-born-wrap'] ); _wrap.className = 'popmenubutton-new'; ipsmenu.register( "pp-entry-born-wrap" ); } catch( error ) { } //----------------------------------------- // Contact messengers... //----------------------------------------- for ( var i in this.contact_types ) { try { var _wrap = document.getElementById( this.div_names['pp-entry-contact-wrap'] + '-' + this.contact_types[i] ); _wrap.className = 'popmenubutton-new'; ipsmenu.register( "pp-entry-contact-wrap" + '-' + this.contact_types[i] ); } catch(error) { } } } }; /** * INIT rating images */ this.init_rating_images = function() { //----------------------------------------- // INIT //----------------------------------------- var html = ''; //----------------------------------------- // Can rate this member? //----------------------------------------- if ( ! this.settings[ 'allow_rating' ] ) { return false; } //----------------------------------------- // Still here? OK... //----------------------------------------- for( var i = 1 ; i <= 5 ; i++ ) { var _onmouseover = ''; var _onmouseout = ''; var _onclick = ''; var _title = ''; if ( ( this.settings['member_id'] != this.settings['viewer_id'] ) && ( this.settings['viewer_id'] ) ) { _onmouseover = ' onmouseover="this.style.cursor=\'pointer\'; ips_personal_portal.show_rating_images(' + i + ', 0)"'; _onmouseout = ' onmouseout="ips_personal_portal.show_rating_images(-1, 1)"'; _onclick = ' onclick="ips_personal_portal.send_rating(' + i + ')"'; _title = this.languages['img_alt_rate']; } html += "-"; } try { if ( ( this.settings['member_id'] != this.settings['viewer_id'] ) && ( this.settings['viewer_id'] ) ) { document.getElementById( this.div_rating_wrapper ).innerHTML = this.languages['rate_me'] + ' ' + html; } else { document.getElementById( this.div_rating_wrapper ).innerHTML = html; } //----------------------------------------- // Now set the image... //----------------------------------------- this.show_rating_images( this.settings['default_rating'], 1 ); } catch( e ) { } }; /** * Send rating.. */ this.load_content_tab = function( tab ) { //----------------------------------------- // INIT //----------------------------------------- var html = ''; //----------------------------------------- // IE is a pain... //----------------------------------------- if ( is_ie && !is_ie7 ) { var _div = document.getElementById( ips_personal_portal.div_names['pp-main-tab-content'] ); var _width = parseInt( _div.offsetWidth - 12 ); // IE adds the 12 px from the padding set below back into the width.. } //----------------------------------------- // Got a rating? //----------------------------------------- if ( tab ) { //----------------------------------------- // Make sure messages are hidden //----------------------------------------- hide_inline_messages_instant(); //----------------------------------------- // Loaded tab... //----------------------------------------- this.loaded_tab = tab; //----------------------------------------- // iFrame tab //----------------------------------------- if ( this.iframe_tabs[ tab ] ) { var url = this.iframe_tabs[ tab ] + '&member_id=' + this.settings['member_id'] + '&md5check=' + ipb_md5_check; document.getElementById( this.div_names['pp-main-tab-content'] ).innerHTML = ''; var iframeinclude = new iframe_include(); iframeinclude.iframe_id = 'pp-main-tab-content-iframe'; iframeinclude.iframe_add_to_div = 'pp-main-tab-content'; iframeinclude.iframe_main_wrapper = 'pp-iframe-wrap'; iframeinclude.init(); iframeinclude.include( url ); } //----------------------------------------- // Normal tab //----------------------------------------- else { //---------------------------------- // INIT //---------------------------------- var url = ipb_var_base_url+'act=profile&CODE=personal_ajax_load_tab&member_id=' + this.settings['member_id'] + '&tab=' + tab + '&md5check=' + ipb_md5_check; /*--------------------------------------------*/ // Main function to do on request // Must be defined first!! /*--------------------------------------------*/ do_request_function = function() { //---------------------------------- // Ignore unless we're ready to go //---------------------------------- if ( ! xmlobj.readystate_ready_and_ok() ) { xmlobj.show_loading( ips_personal_portal.languages['loading_tab'] ); return; } xmlobj.hide_loading(); //---------------------------------- // INIT //---------------------------------- var html = xmlobj.xmlhandler.responseText; if ( html != 'error' ) { document.getElementById( ips_personal_portal.div_names['pp-main-tab-content'] ).innerHTML = html; //----------------------------------------- // Topic attachment sizes... //----------------------------------------- try { fix_linked_image_sizes(); xmlobj.execute_javascript( html ); //----------------------------------------- // Resize box nicely... //----------------------------------------- document.getElementById( ips_personal_portal.div_names['pp-main-tab-content'] ).style.height = 'auto'; document.getElementById( ips_personal_portal.div_names['pp-main-tab-content'] ).style.padding = '6px'; document.getElementById( ips_personal_portal.div_names['pp-main-tab-content'] ).className = ips_personal_portal.css_classes['pp-contentbox-back']; //----------------------------------------- // IE is still a pain //----------------------------------------- if ( is_ie ) { _div.style.width = ( _width ) ? _width + "px" : 'auto'; _div.style.overflowX = 'auto'; } } catch(error) { //alert(error); } } else { alert( js_error_no_permission ); } }; //---------------------------------- // LOAD XML //---------------------------------- xmlobj = new ajax_request(); xmlobj.onreadystatechange( do_request_function ); xmlobj.process( url ); return false; } } }; /** * Send rating.. */ this.send_rating = function( rating ) { //----------------------------------------- // INIT //----------------------------------------- rating = rating ? rating : 0; //----------------------------------------- // Got a rating? //----------------------------------------- if ( rating ) { //---------------------------------- // INIT //---------------------------------- var url = ipb_var_base_url+'act=xmlout&do=member-rate&member_id=' + this.settings['member_id'] + '&rating=' + rating + '&md5check=' + ipb_md5_check; /*--------------------------------------------*/ // Main function to do on request // Must be defined first!! /*--------------------------------------------*/ do_request_function = function() { //---------------------------------- // Ignore unless we're ready to go //---------------------------------- if ( ! xmlobj.readystate_ready_and_ok() ) { xmlobj.show_loading( '' ); return; } xmlobj.hide_loading(); //---------------------------------- // INIT //---------------------------------- var html = xmlobj.xmlhandler.responseText; if ( html == 'no_permission' ) { alert( js_error_no_permission ); } else if ( html != 'error' ) { var _result = html.split(','); var _new_value = _result[0]; var _new_hits = _result[1]; var _new_stars = _result[2]; var _type = _result[3]; //----------------------------------------- // Now set the image... //----------------------------------------- ips_personal_portal.settings['default_rating'] = parseInt( _new_stars ); ips_personal_portal.show_rating_images( ips_personal_portal.settings['default_rating'], 1 ); ipsclass.fade_in_element( ips_personal_portal.div_rating_wrapper ); show_inline_messages_instant( 'rating_updated' ); } }; //---------------------------------- // LOAD XML //---------------------------------- xmlobj = new ajax_request(); xmlobj.onreadystatechange( do_request_function ); xmlobj.process( url ); return false; } }; /** * Show rating images.. */ this.show_rating_images = function( rating, restore_default ) { //----------------------------------------- // INIT //----------------------------------------- rating = restore_default ? this.settings['default_rating'] : parseInt( rating ); var star = restore_default ? this.settings['img_star_on'] : this.settings['img_star_selected']; //----------------------------------------- // Set to 0 //----------------------------------------- for( var i = 1 ; i <= 5 ; i++ ) { var _img = document.getElementById( this.text_rating_image + i ); _img.src = this.settings['img_base_url'] + '/' + this.settings['img_star_off']; } //----------------------------------------- // Show ones coloured... //----------------------------------------- for( var i = 1 ; i <= rating ; i++ ) { var _img = document.getElementById( this.text_rating_image + i ); _img.src = this.settings['img_base_url'] + '/' + star; } }; /** * Delete comment */ this.delete_comment = function( comment_id ) { //----------------------------------------- // INIT //----------------------------------------- var url = ipb_var_base_url+'act=profile&CODE=personal_ajax_delete_comment&member_id=' + this.settings['member_id']; var final_fields = new Array(); //----------------------------------------- // Populate the form fields //----------------------------------------- final_fields['md5check'] = ipb_md5_check; final_fields['comment_id'] = comment_id; //----------------------------------------- // Ajaxify mah bad self! //----------------------------------------- do_request_function = function() { //---------------------------------- // Ignore unless we're ready to go //---------------------------------- if ( ! xmlobj.readystate_ready_and_ok() ) { xmlobj.show_loading( ips_personal_portal.languages['deleting_comment'] ); return; } xmlobj.hide_loading(); //---------------------------------- // INIT //---------------------------------- var html = xmlobj.xmlhandler.responseText; if ( html == 'nopermission' ) { alert( message_pop_up_lang['no_permission'] ); } else if ( html != 'error' ) { document.getElementById( ips_personal_portal.div_names['pp-comments-wrap'] ).innerHTML = html; //----------------------------------------- // Reload comments tab //----------------------------------------- if ( ips_personal_portal.loaded_tab == 'comments' ) { ips_personal_portal.load_content_tab( 'comments' ); } } }; //---------------------------------- // LOAD XML //---------------------------------- xmlobj = new ajax_request(); xmlobj.onreadystatechange( do_request_function ); var xmlreturn = xmlobj.process( url, 'POST', xmlobj.format_for_post(final_fields) ); return false; }; /** * Reload comments */ this.reload_comments = function() { //----------------------------------------- // INIT //----------------------------------------- var url = ipb_var_base_url+'act=profile&CODE=personal_ajax_reload_comments&member_id=' + this.settings['member_id']; var final_fields = new Array(); //----------------------------------------- // Populate the form fields //----------------------------------------- final_fields['md5check'] = ipb_md5_check; //----------------------------------------- // Ajaxify mah bad self! //----------------------------------------- do_request_function = function() { //---------------------------------- // Ignore unless we're ready to go //---------------------------------- if ( ! xmlobj_gender.readystate_ready_and_ok() ) { return; } //---------------------------------- // INIT //---------------------------------- var html = xmlobj_gender.xmlhandler.responseText; if ( html != 'error' && html != 'no_permission' ) { document.getElementById( ips_personal_portal.div_names['pp-comments-wrap'] ).innerHTML = html; } }; //---------------------------------- // LOAD XML //---------------------------------- xmlobj_gender = new ajax_request(); xmlobj_gender.onreadystatechange( do_request_function ); var xmlreturn = xmlobj_gender.process( url, 'POST', xmlobj_gender.format_for_post(final_fields) ); return false; }; /** * Save comment */ this.save_comment = function() { //----------------------------------------- // INIT //----------------------------------------- var url = ipb_var_base_url+'act=profile&CODE=personal_ajax_add_comment&member_id=' + this.settings['member_id']; var final_fields = new Array(); //----------------------------------------- // Close menu //----------------------------------------- menu_action_close(); //----------------------------------------- // Populate the form fields //----------------------------------------- final_fields['md5check'] = ipb_md5_check; final_fields['comment'] = document.getElementById( this.div_names['pp-comment-textarea'] ).value; //----------------------------------------- // Ajaxify mah bad self! //----------------------------------------- do_request_function = function() { //---------------------------------- // Ignore unless we're ready to go //---------------------------------- if ( ! xmlobj.readystate_ready_and_ok() ) { xmlobj.show_loading( ips_personal_portal.languages['saving_comment'] ); return; } xmlobj.hide_loading(); //---------------------------------- // INIT //---------------------------------- var html = xmlobj.xmlhandler.responseText; if ( html == 'nopermission' ) { alert( message_pop_up_lang['no_permission'] ); return; } else if ( html == 'error-no-comment' ) { show_inline_messages_instant( 'pp_comment_error' ); return; } else if ( html != 'error' ) { document.getElementById( ips_personal_portal.div_names['pp-comments-wrap'] ).innerHTML = html; xmlobj.execute_javascript( html ); //----------------------------------------- // Reload comments tab //----------------------------------------- if ( ips_personal_portal.loaded_tab == 'comments' ) { ips_personal_portal.load_content_tab( 'comments' ); } document.getElementById( ips_personal_portal.div_names['pp-comment-textarea'] ).value = ''; } }; //---------------------------------- // LOAD XML //---------------------------------- xmlobj = new ajax_request(); xmlobj.onreadystatechange( do_request_function ); var xmlreturn = xmlobj.process( url, 'POST', xmlobj.format_for_post(final_fields) ); return false; }; /** * Updates the personal photo */ this.update_personal_photo = function( img_url, width, height ) { if ( ! img_url || ! img_url.match( "/photo-" ) ) { img_url = this.settings['photo_def_src']; width = this.settings['photo_def_width']; height = this.settings['photo_def_height']; } var _img = document.getElementById( this.div_names['pp-main-photo'] ); var mydate = new Date(); _img.src = img_url + '?__time=' + mydate.getTime(); _img.width = width; _img.height = height; }; /** * Updates the personal statement */ this.update_personal_statement = function( content, website ) { var _statement = document.getElementById( this.div_names['pp-personal_statement'] ); content = content.replace( /\[b\](.+?)\[\/b\]/gi, "$1" ); content = content.replace( /\[i\](.+?)\[\/i\]/gi, "$1" ); content = content.replace( /\[u\](.+?)\[\/u\]/gi, "$1" ); // Word wrap content = content.replace( /(\S{19})(\S+?)/g , "$1 $2" ); _statement.innerHTML = content; if ( website ) { if ( website.length > 30 ) { _statement.innerHTML += "

" + ipb_global_lang['visit_my_website'] + ""; } else { _statement.innerHTML += "

"+website+""; } } }; /** * Saves settings to the Deebee. */ this.save_settings = function( func_name, field_data, get_data_from_this_id ) { //----------------------------------------- // INIT objects //----------------------------------------- var url = ipb_var_base_url+'act=xmlout&do=profile-save-settings&member_id=' + this.settings['member_id']; var final_fields = new Array(); //----------------------------------------- // Close menu //----------------------------------------- menu_action_close(); //----------------------------------------- // Populate the form fields //----------------------------------------- final_fields['md5check'] = ipb_md5_check; final_fields['cmd'] = func_name; try { for( var i in field_data ) { final_fields[ i ] = field_data[i]; } } catch(error) { } if ( func_name == 'birthdate' ) { final_fields['pp_b_day'] = document.getElementById('pp_b_day').options[ document.getElementById('pp_b_day').selectedIndex ].value; final_fields['pp_b_month'] = document.getElementById('pp_b_month').options[ document.getElementById('pp_b_month').selectedIndex ].value; final_fields['pp_b_year'] = document.getElementById('pp_b_year').options[ document.getElementById('pp_b_year').selectedIndex ].value; } if ( get_data_from_this_id != '' ) { final_fields['value'] = document.getElementById( get_data_from_this_id ).value; } //----------------------------------------- // Ajaxify mah bad self! //----------------------------------------- do_request_function = function() { //---------------------------------- // Ignore unless we're ready to go //---------------------------------- if ( ! xmlobj.readystate_ready_and_ok() ) { xmlobj.show_loading(); return; } xmlobj.hide_loading(); //---------------------------------- // INIT //---------------------------------- var html = xmlobj.xmlhandler.responseText; if ( html == 'nopermission' ) { alert( message_pop_up_lang['no_permission'] ); } else if ( html != 'error' ) { switch( final_fields['cmd'] ) { case 'gender': var _txt = document.getElementById( ips_personal_portal.div_names['pp-entry-gender-text'] ); var _imgwrap = document.getElementById( ips_personal_portal.div_names['pp-entry-gender-imgwrap'] ); var _date = new Date(); var _src = ''; if ( html == 'male' ) { _src = ips_personal_portal.settings['img_base_url'] + '/' + ips_personal_portal.settings['img_gender_male'] + "?__=" + _date.getTime(); _txt.innerHTML = ips_personal_portal.languages['gender_male']; } else if ( html == 'female' ) { _src = ips_personal_portal.settings['img_base_url'] + '/' + ips_personal_portal.settings['img_gender_female'] + "?__=" + _date.getTime(); _txt.innerHTML = ips_personal_portal.languages['gender_female']; } else { _src = ips_personal_portal.settings['img_base_url'] + '/' + ips_personal_portal.settings['img_gender_mystery'] + "?__=" + _date.getTime(); _txt.innerHTML = ips_personal_portal.languages['gender_mystery']; } _imgwrap.innerHTML = ""; // Update gender icons... ips_personal_portal.reload_comments(); ipsclass.fade_in_element( ips_personal_portal.div_names['pp-entry-gender-wrap'] ); break; case 'contact': if ( html == 'icqerror' ) { show_inline_messages_instant( 'pp_icq_error' ); } else { document.getElementById( ips_personal_portal.div_names['pp-entry-contact-entry'] + '-' + field_data['contacttype'] ).innerHTML = html; ipsclass.fade_in_element( ips_personal_portal.div_names['pp-entry-contact-wrap'] + '-' + field_data['contacttype'] ); } break; case 'location': document.getElementById( ips_personal_portal.div_names['pp-entry-location-text'] ).innerHTML = html; ipsclass.fade_in_element( ips_personal_portal.div_names['pp-entry-location-wrap'] ); break; case 'birthdate': if ( html == 'dateerror' ) { show_inline_messages_instant( 'pp_date_error' ); } else { document.getElementById( ips_personal_portal.div_names['pp-entry-born-text'] ).innerHTML = html; var _dates = html.split('-'); if ( _dates[2] ) { var today = new Date(); var _years = today.getFullYear(); var _days = today.getDate(); var _mos = today.getMonth() + 1; var _age = _years - _dates[2]; _dates[0] = month[ _dates[0] ]; if ( _dates[0] > _mos ) { _age -= 1; } else if ( _dates[0] == _mos ) { if ( _dates[1] > _days ) { _age -= 1; } } document.getElementById( ips_personal_portal.div_names['pp-entry-age-text'] ).innerHTML = _age; document.getElementById( ips_personal_portal.div_names['pp-entry-age-yearsold'] ).style.display = ''; ipsclass.fade_in_element( ips_personal_portal.div_names['pp-entry-age-wrap'] ); } else { document.getElementById( ips_personal_portal.div_names['pp-entry-age-text'] ).innerHTML = ips_personal_portal.languages['age_unknown']; document.getElementById( ips_personal_portal.div_names['pp-entry-age-yearsold'] ).style.display = 'none'; ipsclass.fade_in_element( ips_personal_portal.div_names['pp-entry-age-wrap'] ); document.getElementById( ips_personal_portal.div_names['pp-entry-born-pretext'] ).style.display = ''; } ipsclass.fade_in_element( ips_personal_portal.div_names['pp-entry-born-wrap'] ); } } } }; //---------------------------------- // LOAD XML //---------------------------------- xmlobj = new ajax_request(); xmlobj.onreadystatechange( do_request_function ); var xmlreturn = xmlobj.process( url, 'POST', xmlobj.format_for_post(final_fields) ); return false; }; /** * On mouseover event */ this.tab_onclick = function( event ) { //------------------------------- // No? Get one then //------------------------------- var tabid = ipsclass.get_id_from_text( this.id ); // Stop scrolling to top of the page... ipsclass.cancel_bubble( event ); //---------------------------------- // Load tab //---------------------------------- ips_personal_portal.tab_load( tabid ); return false; }; /** * On mouseover event */ this.tab_load = function( tabid ) { //------------------------------- // Got it? //------------------------------- for ( var i in ips_personal_portal.stored_tabs ) { if ( i == tabid ) { ips_personal_portal.stored_tabs[ i ].style.display = 'block'; ips_personal_portal.stored_tabs[ i ].className = ips_personal_portal.css_classes['pp-tabon']; } else { ips_personal_portal.stored_tabs[ i ].style.display = 'block'; if ( ips_personal_portal.stored_tabs_css[ i ] == ips_personal_portal.css_classes['pp-tabshaded'] ) { ips_personal_portal.stored_tabs[ i ].className = ips_personal_portal.css_classes['pp-tabshaded']; } else { ips_personal_portal.stored_tabs[ i ].className = ips_personal_portal.css_classes['pp-taboff']; } } } //---------------------------------- // Load tab //---------------------------------- ips_personal_portal.load_content_tab( tabid ); return false; }; }