var live_replies = 0;
var global_page_key;
var global_page_desc;
function load_viewing_history_for(key,desc) {
global_page_key = key;
global_page_desc = desc;
var url = '/show-viewing-history/' + key + '?item_desc=' + escape(desc);
var req = window.XMLHttpRequest ? new XMLHttpRequest : window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : '';
req.onreadystatechange = function () {
if (req.readyState == 4 && req.status == 200) {
getEl('viewing_history_holder').innerHTML = req.responseText;
}
}
req.open('GET',url,true);
req.send(null);
}
function refresh_viewing_history() {
if (!global_page_key) { return; }
load_viewing_history_for(global_page_key,global_page_desc);
}
function set_visible(id, on_off) {
var el = document.all ? document.all[id] : document.getElementById(id);
if(el && el.style) el.style.visibility = on_off ? 'visible' : 'hidden';
}
function display(id, on_off) {
var el = document.all ? document.all[id] : document.getElementById(id);
if(el && el.style) el.style.display = on_off ? '' : 'none';
}
function toggle_display(id) {
var el = document.all ? document.all[id] : document.getElementById(id);
if(el && el.style) el.style.display = el.style.display ? '' : 'none';
}
function opacity(id, o) {
var el = document.all ? document.all[id] : document.getElementById(id);
if(el && el.style) el.style.opacity = o;
o = o * 100;
if(el && el.style) el.style.filter = "alpha(opactiy=" + o + ")";
}
function toggle_dropdown(id) {
display('new_dropdown', false);
display('explore_dropdown', false);
display('group_post_table', false);
var el = getEl(id);
el.style.display = el.style.display ? '' : 'none';
el.style.zIndex = 199;
if((id == 'go_dropdown' || id == 'new_dropdown' || id == 'explore_dropdown') && hide_owner_title) {
var ot = getEl('owner_nav');
set_visible('owner_nav', el.style.display);
set_visible('page_start', el.style.display);
if(ot) ot.style.marginTop = el.style.display ? '0' : '1200px';
}
if(getEl('page-start')) {
getEl('page-start').style.opacity = el.style.display ? 1 : .4;
getEl('page-start').style.filter = el.style.display ? "" : "alpha(opacity=40)";
// set_visible('page-start', el.style.display);
}
}
var default_group_id;
var default_group_name;
var post_new_check_leave_page;
function post_new() {
if (post_new_check_leave_page) {
var msg = 'Confirm\n\nAre you sure you want to navigate away from this page?\n\nYour unsaved Blog Entry will be lost.\n\nPress OK to continue, or Cancel to stay on the current page.';
if (! confirm(msg)) return;
}
window.skip_unload_check = 1;
display('post_new', 1);
display('post_new_link', 0);
// display('content-start-div', 0);
// display('page_start', 0);
reset_groups_div(default_group_id, default_group_name);
}
function toggle_submenu(id) {
toggle_display(id);
}
var hide_owner_title;
function hide_dropdown_delay(id) {
display(id, false);
var slider = getEl('slider-1');
if(slider) slider.style.visibility = 'visible';
if(hide_owner_title) {
var ot = getEl('owner_nav');
if(ot) ot.style.marginTop = '0';
}
if(getEl('page-start')) {
getEl('page-start').style.opacity = 1;
getEl('page-start').style.filter = "";
// set_visible('page-start', 1);
}
}
var hide_timeout;
function hide_delay(id) {
var func = "hide_dropdown_delay('" + id + "')";
if(!hide_timeout) hide_timeout = window.setTimeout(func, 500);
}
function no_hide_delay() {
window.clearTimeout(hide_timeout)
hide_timeout = 0;
}
var dropdown_group_id;
function set_group_for_posting(group_id, group_name) {
dropdown_group_id = group_id;
display('pickgroup', 0);
display('postgrouplist0', 0);
display('postgrouplist1', 0);
display('postgrouplist2', 1);
var gname = getEl('group_name_label');
if(gname) gname.innerHTML = '
';
var gname2 = getEl('group_name_title');
if(gname2) gname2.innerHTML = 'Add to ' + group_name;
}
function toggle_group_dropdown(div_id, group_id, group_name) {
var gname = getEl(div_id + '_name');
if(gname) gname.innerHTML = 'Add to ' + group_name + '
';
if(dropdown_group_id == group_id) {
toggle_display(div_id);
}
else {
dropdown_group_id = group_id;
display(div_id, 1);
}
}
function go_group(url) {
if(dropdown_group_id)
window.location.href = 'http://' + dropdown_group_id + '.multiply.com' + url;
else
alert("Please select a group first.");
}
function confirmLink(message, url) {
if(confirm(message)) window.location.href = url;
}
function confirmSubmit(message, form_name) {
if(confirm(message)) getEl(form_name).submit();
}
function confirmBlock(url) {
return confirmLink("Removing a message means you will not see the message nor its future replies. Please note that this is a message board, where unlike e-mail, it is not necessary to remove messages from this page. They will simply scroll off as they get old.\nAre you sure you want to remove this message and any replies?", url);
}
function getEl(el) {
return document.all ? document.all[el] : document.getElementById(el);
}
// create a new element of tag 'type' and assign id and class, if provided
function createEl(type, id, theClass) {
var el = document.createElement(type);
if (el) {
if ( id && id.length > 0 ) {
el.id = id;
}
if ( theClass && theClass.length > 0 ) {
el.className = theClass;
}
}
return el;
}
function readCookie(name) {
if(document.cookie == '') return false;
var firstChar, lastChar;
var theBigCookie = document.cookie;
name = name + '=';
firstChar = theBigCookie.indexOf(name);
if (firstChar != -1) {
firstChar += name.length;
lastChar = theBigCookie.indexOf(';', firstChar);
if(lastChar == -1) lastChar = theBigCookie.length;
return unescape(theBigCookie.substring(firstChar, lastChar));
}
else {
return false;
}
}
function setImgSrc(id, src, width, height) {
var img = getEl(id);
img.width = width;
img.height = height;
img.src = src;
}
function window_height() {
var myHeight = 0;
if(typeof(window.innerHeight) == 'number') {
myHeight = window.innerHeight;
}
else if(document.documentElement && document.documentElement.clientHeight) {
myHeight = document.documentElement.clientHeight;
}
else if(document.body && document.body.clientHeight) {
myHeight = document.body.clientHeight;
}
return myHeight;
}
function containsDOM (container, containee) {
var isParent = false;
do {
if ((isParent = container == containee))
break;
containee = containee.parentNode;
}
while (containee != null);
return isParent;
}
function checkMouseEnter (element, evt) {
if (element.contains && evt.fromElement) {
return !element.contains(evt.fromElement);
}
else if (evt.relatedTarget) {
return !containsDOM(element, evt.relatedTarget);
}
}
function doesContain(elThis, elThat) {
if (elThat == elThis) return true;
if (elThat == null) return false;
return doesContain(elThis, elThat.parentNode);
}
function checkMouseLeave (element, evt) {
if (evt.toElement) {
return !doesContain(element, evt.toElement);
}
else if (evt.relatedTarget) {
return !containsDOM(element, evt.relatedTarget);
}
}
var keyActions = new Array ();
keyActions [0] = {character: "P",
param: "http://multiply.com/compose/pm"};
keyActions [1] = {character: "N",
param: "http://multiply.com/compose/note"};
keyActions [2] = {character: "U",
param: "http://multiply.com/go-user-site?xurl=photos/upload"};
keyActions [3] = {character: "J",
param: "http://multiply.com/go-user-site?xurl=journal/compose"};
keyActions [4] = {character: "S",
param: "http://multiply.com/go-user-site?xurl=calendar/compose"};
keyActions [5] = {character: "V",
param: "http://multiply.com/go-user-site?xurl=reviews/compose"};
keyActions [6] = {character: "M",
param: "http://multiply.com/go-user-site?xurl=market/compose"};
keyActions [7] = {character: "I",
param: "http://multiply.com/go-user-site?xurl=recipes/compose"};
keyActions [8] = {character: "L",
param: "http://multiply.com/go-user-site?xurl=links/compose"};
function hotKeys (event) {
event = (event) ? event : ((window.event) ? event : null);
if (event && event.ctrlKey) {
var charCode = (event.charCode) ? event.charCode : ((event.which) ? event.which : event.keyCode);
var myChar = String.fromCharCode (charCode).toLowerCase();
if (event.shiftKey) {myChar = myChar.toUpperCase();}
// Firefox returns keycode 109 when '-' (minus) key is pressed
// which is ascii code for lowercase "m". Pressing either "M" and "m"
// generates keycode 77
if ((myChar == "m" && charCode == 77) || myChar == "\n" || myChar == "\r") {return submitReply();}
for (var i = 0; i < keyActions.length; i++) {
if (keyActions[i].character == myChar) {
var action;
action = new Function ('location.href ="' + keyActions[i].param + '"');
action ();
break;
}
}
}
}
var xml_reqs = new Array();
function load_xml_document(req_name, url, callback) {
// branch for native XMLHttpRequest object
if (window.XMLHttpRequest) {
xml_reqs[req_name] = new XMLHttpRequest();
xml_reqs[req_name].onreadystatechange = callback;
xml_reqs[req_name].open("GET", url, true);
xml_reqs[req_name].send(null);
// branch for IE/Windows ActiveX version
} else if (window.ActiveXObject) {
xml_reqs[req_name] = new ActiveXObject("Microsoft.XMLHTTP");
if (xml_reqs[req_name]) {
xml_reqs[req_name].onreadystatechange = callback;
xml_reqs[req_name].open("GET", url, true);
xml_reqs[req_name].send();
}
}
}
function addEvent(obj, evType, fn, useCapture) {
if (obj.addEventListener) {
obj.addEventListener(evType, fn, useCapture);
return true;
} else if (obj.attachEvent) {
var r = obj.attachEvent("on"+evType, fn);
return r;
};
};
function quicksearch_setup() {
var input = getEl('quicksearchinput');
if(input) {
ph = input.getAttribute("placeholder")
if( ph && ph != "" ) {
input.value = ph;
input.style.color = 'gray';
input.onfocus = quicksearch_focus;
input.onblur = quicksearch_blur;
}
}
}
function quicksearch_focus() {
if( this.style.color == 'gray' ) {
this.value = '';
this.style.color = 'black';
}
}
function quicksearch_blur() {
ph = this.getAttribute("placeholder")
if( ph && this.value == "" ) {
this.value = ph;
this.style.color = 'gray';
}
}
var guideboxheight;
function do_nothing () {
return;
}
function collapse_guidebox(id, nonvirgin) {
display(id, false);
display('openbox' + id, true);
load_xml_document('setpref', '/user/set-pref/no_guidebox:' + id + '/1', do_nothing);
}
function open_guidebox(id, nonvirgin) {
display(id, true);
display('openbox' + id, false);
load_xml_document('setpref', '/user/set-pref/no_guidebox:' + id + '/0', do_nothing);
}
function show_advanced() {
display('display_options', 1);
// display('show_from', 0);
display('item_table', 0);
display('item_table_bottom', 0);
display('mail_tabs', 0);
display('mail_tab_wrap', 0);
display('mail_label', 0);
display('advancedlinks', 0);
display('next_page_links', 0);
display('included_display_options', 0);
}
function pick_post_group() {
display('pickgroup', 0);
display('postgrouplist1', 1);
}
function reset_groups_div(default_group_id, default_group_name) {
if(default_group_id) {
set_group_for_posting(default_group_id, default_group_name);
}
else {
display('pickgroup', 1);
display('postgrouplist0', 1);
display('postgrouplist1', 0);
display('postgrouplist2', 0);
var gname2 = getEl('group_name_title');
if(gname2) gname2.innerHTML = 'Add to a Group Site';
}
}
function logo_onmouseover_ie() {
getEl("multiply_logo").style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://images.multiply.com//multiply/splash/splashheaderlogosmall2_red.png',sizingMethod='scale')";
}
function logo_onmouseout_ie() {
getEl("multiply_logo").style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://images.multiply.com//multiply/splash/splashheaderlogosmall2.png',sizingMethod='scale')";
}
function popup_miniprofile(element, user_id, offset_x, offset_y) {
var div = getEl('miniprofile_div');
var pos = getPos(element);
if (offset_x || offset_y) {
div.style.left = (pos.x + offset_x) + 'px';
div.style.top = (pos.y + offset_y) + 'px';
}
else {
div.style.left = pos.x + 'px';
div.style.top = pos.y + 'px';
}
div.style.position = 'absolute';
div.innerHTML = "";
div.style.display = '';
var url = '/miniprofile/' + user_id;
load_xml_document('miniprofile', url, popup_miniprofile_callback);
}
function popup_miniprofile_callback() {
if (xml_reqs['miniprofile'].readyState != 4) return;
if (xml_reqs['miniprofile'].status != 200) return;
var div = getEl('miniprofile_div');
div.style.width = '300px';
div.style.height = '150px';
div.innerHTML = xml_reqs['miniprofile'].responseText;
}
function getPos(inputElement) {
var coords = new Object();
coords.x = 0;
coords.y = 0;
try {
targetElement = inputElement;
if(targetElement.x && targetElement.y) {
coords.x = targetElement.x;
coords.y = targetElement.y;
} else {
if(targetElement.offsetParent) {
coords.x += targetElement.offsetLeft;
coords.y += targetElement.offsetTop;
while(targetElement = targetElement.offsetParent) {
coords.x += targetElement.offsetLeft;
coords.y += targetElement.offsetTop;
}
} else {
//alert(\"Could not find any reference for coordinate positioning.\");
}
}
return coords;
} catch(error) {
//alert(error.msg);
return coords;
}
}