var agt=navigator.userAgent.toLowerCase();
var appVer = navigator.appVersion.toLowerCase();
// *** BROWSER VERSION ***
var is_minor = parseFloat(appVer);
var is_major = parseInt(is_minor);
var is_opera = (agt.indexOf("opera") != -1);
var is_opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
var is_opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
var is_opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
var is_opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
var is_opera6 = (agt.indexOf("opera 6") != -1 || agt.indexOf("opera/6") != -1); // new 020128- abk
var is_opera7 = (agt.indexOf("opera 7") != -1 || agt.indexOf("opera/7") != -1); // new 021205- dmr
var is_opera8 = (agt.indexOf("opera 8") != -1 || agt.indexOf("opera/8") != -1); // new 082906- djk
var is_opera9 = (agt.indexOf("opera 8") != -1 || agt.indexOf("opera/9") != -1); // new 082906- djk
var is_opera5up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4);
var is_opera6up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4 && !is_opera5); // new020128
var is_opera7up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4 && !is_opera5 && !is_opera6); // new021205 -- dmr
var is_opera8up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4 && !is_opera5 && !is_opera6 && !is_opera7); // new 082906 -- djk
var is_opera9up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4 && !is_opera5 && !is_opera6 && !is_opera7 && !is_opera8); // new 082906 -- djk
var is_mac = (agt.indexOf("mac")!=-1);
var iePos = appVer.indexOf('msie');
if (iePos !=-1) {
if(is_mac) {
var iePos = agt.indexOf('msie');
is_minor = parseFloat(agt.substring(iePos+5,agt.indexOf(';',iePos)));
}
else is_minor = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)));
is_major = parseInt(is_minor);
}
var is_konq = false;
var kqPos = agt.indexOf('konqueror');
if (kqPos !=-1) {
is_konq = true;
is_minor = parseFloat(agt.substring(kqPos+10,agt.indexOf(';',kqPos)));
is_major = parseInt(is_minor);
}
var is_safari = ((agt.indexOf('safari')!=-1)&&(agt.indexOf('mac')!=-1))?true:false;
var is_khtml = (is_safari || is_konq);
var is_gecko = ((!is_khtml)&&(navigator.product)&&(navigator.product.toLowerCase()=="gecko"))?true:false;
var is_gver = 0;
if (is_gecko) is_gver=navigator.productSub;
var is_moz = ((agt.indexOf('mozilla/5')!=-1) && (agt.indexOf('spoofer')==-1) &&
(agt.indexOf('compatible')==-1) && (agt.indexOf('opera')==-1) &&
(agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1) &&
(is_gecko) &&
((navigator.vendor=="")||(navigator.vendor=="Mozilla")||(navigator.vendor=="Debian")));
var is_fb = ((agt.indexOf('mozilla/5')!=-1) && (agt.indexOf('spoofer')==-1) &&
(agt.indexOf('compatible')==-1) && (agt.indexOf('opera')==-1) &&
(agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1) &&
(is_gecko) && (navigator.vendor=="Firebird"));
var is_fx = ((agt.indexOf('mozilla/5')!=-1) && (agt.indexOf('spoofer')==-1) &&
(agt.indexOf('compatible')==-1) && (agt.indexOf('opera')==-1) &&
(agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1) &&
(is_gecko) && (navigator.vendor=="Firefox" || agt.indexOf('firefox') >= 0));
var is_flock = (agt.indexOf('flock') != -1);
if ((is_moz)||(is_fb)||(is_fx)) { // 032504 - dmr
var is_moz_ver = (navigator.vendorSub)?navigator.vendorSub:0;
if(!(is_moz_ver)) {
is_moz_ver = agt.indexOf('rv:');
is_moz_ver = agt.substring(is_moz_ver+3);
is_paren = is_moz_ver.indexOf(')');
is_moz_ver = is_moz_ver.substring(0,is_paren);
is_minor = is_moz_ver;
is_major = parseInt(is_moz_ver);
} else if (is_fx) {
is_major = parseInt(is_moz_ver);
is_minor = is_moz_ver.substring(2);
}
}
var is_fb_ver = is_moz_ver;
var is_fx_ver = is_moz_ver;
var is_fx1 = (is_fx && (is_major == 1));
var is_fx1up = (is_fx && (is_major >= 1));
var is_fx1_5 = (is_fx && (is_major == 1) && (is_minor.toString().indexOf('1') == 0));
var is_fx1_5up = ((is_fx && (is_major == 1) && (is_minor.toString().indexOf('1') == 0)) || (is_fx && (is_major >= 2)));
/*var is_fx2 = (is_fx && (is_major == 1) && (is_minor == 0.8));
var is_fx2up = (is_fx && (is_major >= 1) && (is_minor >= 0.8));
var is_fx3 = (is_fx && (is_major == 1) && (is_minor == 0.9));
var is_fx3up = (is_fx && is_fx3);*/
//alert(is_major + '-' + is_minor + ' - ' + is_fx);
var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
&& (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
&& (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)
&& (!is_khtml) && (!(is_moz)) && (!is_fb) && (!is_fx));
if ((navigator.vendor) && ((navigator.vendor=="Netscape6")||(navigator.vendor=="Netscape")) && (is_nav)) {
is_major = parseInt(navigator.vendorSub);
is_minor = parseFloat(navigator.vendorSub);
}
var is_nav6 = (is_nav && is_major==6); // new 010118 mhp
var is_nav6up = (is_nav && is_minor >= 6); // new 010118 mhp
var is_nav5 = (is_nav && is_major == 5 && !is_nav6); // checked for ns6
var is_nav5up = (is_nav && is_minor >= 5);
var is_nav7 = (is_nav && is_major == 7);
var is_nav7up = (is_nav && is_minor >= 7);
var is_ie = ((iePos!=-1) && (!is_opera) && (!is_khtml));
var is_ie5 = (is_ie && is_major == 5);
var is_ie5up = (is_ie && is_minor >= 5);
var is_ie5_5 = (is_ie && (agt.indexOf("msie 5.5") !=-1)); // 020128 new - abk
var is_ie5_5up =(is_ie && is_minor >= 5.5); // 020128 new - abk
var is_ie6 = (is_ie && is_major == 6);
var is_ie6up = (is_ie && is_major >= 6);
var is_ie7 = (is_ie && is_major == 7);
var is_ie7up = (is_ie && is_major >= 7);
var is_webtv = (agt.indexOf("webtv") != -1);
// Done with is_minor testing; revert to real for N6/7
if (is_nav6up) {
is_minor = navigator.vendorSub;
}
var is_win = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
if (is_mac) { is_win = !is_mac; } // dmr - 06/20/2002
document.cookie = "cookies=true";
var is_cookie = (document.cookie) ? "true" : "false";
var g_sPrivateColor = '#40c100';
var g_sPublicColor = '#157EBA';
var bShowClipCastLinks = true;
var bFavoritesLoad = false;
var bFacebookApp = false;
var bLibraryWindowOpen = true;
var KEY_ENTER = 13;
var bInClipcast = false;
function ShowTagCloud(sUsername) {
window.open('/tag_cloud.aspx?u=' + sUsername, sUsername + 'TagCloud', 'height=550,width=550,resizable=yes');
}
//*** DOM NODE FUNCTIONS ***//
function CreateIfNone(sElementID, sTagName) {
var oElement = document.getElementById(sElementID);
if (!oElement) {
oElement = document.createElement(sTagName);
oElement.id = sElementID;
oElement.style.display = 'none';
document.body.appendChild(oElement);
}
return oElement;
}
function CloneNode(oNode, bDeep) {
var oNewNode = null;
var oNewChildNode = null;
var i = 0;
if (oNode.nodeType == 3) {
return document.createTextNode(oNode.nodeValue);
} else if (oNode.nodeType != 1) {
return null;
}
oNewNode = document.createElement(oNode.tagName);
for (i = 0; i < oNode.attributes.length; i++) {
if (oNode.attributes[i].name.indexOf('on') == 0 && is_ie) {
// this is for ie but works in all browsers
eval('oNewNode.' + oNode.attributes[i].name + ' = function() {' + oNode.attributes[i].value + '}');
} else if (is_ie && oNode.attributes[i].name == 'style') {
oNewNode.style.cssText = oNode.attributes[i].value;
} else if (is_ie && oNode.attributes[i].name == 'class') {
oNewNode.setAttribute('className', oNode.attributes[i].value);
} else {
oNewNode.setAttribute(oNode.attributes[i].name, oNode.attributes[i].value);
}
}
if (!bDeep) {
return oNewNode;
}
for (i = 0; i < oNode.childNodes.length; i++) {
oNewChildNode = CloneNode(oNode.childNodes[i], true);
if (!!oNewChildNode) {
oNewNode.appendChild(oNewChildNode);
}
}
return oNewNode;
}
//*** STRING FUNCTIONS ***//
function trim(s) {
while (s.substring(0,1) == ' ') {
s = s.substring(1,s.length);
}
while (s.substring(s.length-1,s.length) == ' ') {
s = s.substring(0,s.length-1);
}
return s;
}
//*** HTML NODE FUNCTIONS ***//
function GetAttribute(oElement, sAttribute, sDefault) {
var sReturn = sDefault
if (oElement.getAttribute(sAttribute)) {
sReturn = oElement.getAttribute(sAttribute);
}
return sReturn;
}
//*** EVENT FUNCTIONS ***//
function StopPropagation(e, bPreventDefault) {
if (!e) e = window.event;
e.cancelBubble = true;
if (e.stopPropagation) e.stopPropagation();
if (bPreventDefault) {
if (e.preventDefault) e.preventDefault();
}
return false;
}
//*** XML FUNCTIONS ***//
function CreateXMLHTTP() {
var oXMLHTTP = false;
if(window.XMLHttpRequest) {
try {
oXMLHTTP = new XMLHttpRequest();
} catch(e) {
oXMLHTTP = false;
}
} else if(window.ActiveXObject) {
try {
oXMLHTTP = new ActiveXObject('Msxml2.XMLHTTP');
} catch(e) {
try {
oXMLHTTP = new ActiveXObject('Microsoft.XMLHTTP');
} catch(e) {
oXMLHTTP = false;
}
}
}
return oXMLHTTP;
}
function stripUnsafe(sText, iMode) {
if (iMode == 2) {
sText = sText.replace(/\'/mig, "\\'");
} else {
sText = sText.replace(/\'/mig, "\'");
}
sText = sText.replace(/(%0D|%0A|%0d|%0a|\n|\r)/mig, "\+");
return(sText);
}
function stripBBCode(sText) {
sText = sText.replace(/\[([^\]]+)\]/ig,"");
return(sText);
}
function ShowDialog(sMessage, xOffset, yOffset, bHideButton, sButtonLabel, lWidth, lHeight, bHardPosition, bDragBar, sCallbackFunction, bCancelButton) {
var lBoxWidth = 280;
var lBoxHeight = 144;
var lPosX = 0;
var lPosY = 0;
if (lWidth) { lBoxWidth = lWidth; }
if (lHeight) { lBoxHeight = lHeight; }
if (is_ie) { lBoxHeight = lBoxHeight + 38; }
document.getElementById("dvDialogBox").style.width = lBoxWidth + 'px';
document.getElementById("dvDialogBox").style.height = lBoxHeight + 'px';
if (bHardPosition) {
lPosX = xOffset;
lPosY = yOffset;
} else {
lPosX = parseInt((document.body.clientWidth - lBoxWidth) / 2);
lPosY = parseInt((document.body.clientHeight - lBoxHeight) / 2 - 80); // + document.body.scrollTop);
//lPosX = parseInt((document.body.clientWidth - lBoxWidth)/2);
//lPosY = parseInt((document.body.clientHeight - lBoxHeight)/2);
}
var lOffsetX = 0;
var lOffsetY = 0;
if (xOffset) { lPosX += xOffset; }
if (yOffset) { lPosY += yOffset; }
lPosX += document.body.scrollLeft;
lPosY += document.body.scrollTop;
if (lPosX < 0) { lPosX = 0; }
if (lPosY < 0) { lPosY = 0; }
document.getElementById("dvDialogBox").style.top = lPosY + 'px';
document.getElementById("dvDialogBox").style.left = lPosX + 'px';
document.getElementById("spnDialogMessage").innerHTML = sMessage;
if (bHideButton) {
document.getElementById("spnDialogButton").style.display = 'none';
} else {
document.getElementById("spnDialogButton").style.display = 'block';
}
if (!sButtonLabel) { sButtonLabel = 'OK'; }
document.getElementById("spnDialogButton").innerHTML='
';
document.getElementById("dvDialogBox").style.display='block';
if (!!bDragBar) {
if (!!document.getElementById("dvDragBar")) {
document.getElementById("dvDragBar").style.display='block';
}
} else {
if (!!document.getElementById("dvDragBar")) {
document.getElementById("dvDragBar").style.display='none';
}
}
HideScrollbars();
}
function HideDialogBox() {
document.getElementById("dvDialogBox").style.display='none';
if (bLibraryWindowOpen) { bLibraryWindowOpen = false; }
if (!!bBlockWindowOpen) { bBlockWindowOpen = false; }
ShowScrollbars();
}
function OpenFunctionWindow(sFunction, sKey, bSizable, bScrollbars, bTargetSelf) {
var lWidth, lHeight, lX, lY, sGUIDParam, sURL;
switch (sFunction) {
case 'EDIT':
case 'SAVEFROMWIN':
case 'EMAIL':
case 'BLOG':
case 'PRINT':
lWidth = 740;
lHeight = 590;
break;
case 'SAVE':
lWidth = 740;
lHeight = 590;
break;
case 'CONTENT':
lWidth = 640;
lHeight = 480;
break;
case 'REFERENCE':
lWidth = 540;
lHeight = 444;
break;
case 'DEMO':
lWidth = 670;
lHeight = 570;
}
var lX = parseInt((document.body.clientWidth - lWidth) / 2);
var lY = parseInt((document.body.clientHeight - lHeight) / 2);
switch (sFunction) {
case 'EDIT':
sURL = '/edit_clip.aspx?new=false&nav=true&clip_guid=';
break;
case 'SAVEFROMWIN':
sURL = '/edit_clip.aspx?clipping=true&clip_guid=';
break;
case 'EMAIL':
sURL = '/email_clipmark.aspx?clipmark=';
break;
case 'BLOG':
sURL = '/blog_this.aspx?c=';
break;
case 'PRINT':
sURL = '/print_clips.aspx?mode=clip&print=true&c=';
break;
case 'SAVE':
sURL = '/save_clips.aspx?mode=clip&save=true&c=';
break;
case 'CONTENT':
sURL = '/view_clip.aspx?guid=';
break;
case 'REFERENCE':
sURL = '/reference.aspx?type=';
break;
case 'DEMO':
sURL = '/demo_window.aspx?r=3';
}
if (!!sKey) {
sURL += sKey;
}
if (bTargetSelf) {
window.location.href = sURL;
} else {
var oFunctionWindow = window.open(sURL, 'Clipmarks_' + sFunction, 'width=' + lWidth + ',height=' + lHeight + ',top=' + lY + ',left=' + lX + ',resizable=' + (bSizable ? 'yes' : 'no') + ',scrollbars=' + (bScrollbars ? 'yes' : 'no'));
oFunctionWindow.focus();
}
}
function DeleteClipmark(sGUID, bPermanent, bBypassPrompt, bPrivate) {
if ((!!bBypassPrompt && bPermanent) || (bPermanent && confirm('Are you sure you want to delete this clip?'))) {
PostDeleteClipmark(true);
} else if ((!!bBypassPrompt && !bPermanent) || (!bPermanent && confirm('Are you sure you want to remove this clipmark from your clips?' + (!bPrivate ? ' Doing so will not remove it from the public clip exchange or from any other clipper\'s page.' : '')))) {
PostDeleteClipmark(false);
}
}
function OpenBookmarkOptions(u,d,t,n, bPermalink) {
if (document.getElementById('fraClipmark')) { document.getElementById('fraClipmark').style.overflow='hidden'; }
if (bLibraryWindowOpen) { HideDialogBox(); } else {
bLibraryWindowOpen = true;
bKeepDialogOpen = true;
var t_unescape = unescape(t);
var sTagStringDel = t_unescape.replace(/\,/g, '\+');
var sHrefDelicious = 'javascript:BookmarkDelicious(\'' + encodeURI(stripUnsafe(u, 2)) + '\',\'' + encodeURI(stripUnsafe(d, 2)) + '\',\'' + encodeURI(stripUnsafe(sTagStringDel, 2)) + '\',\'' + encodeURI(stripUnsafe(n, 2)) + '\')';
var sParams = '\'' + stripUnsafe(u, 2) + '\',\'' + stripUnsafe(d, 2) + '\',\'' + stripUnsafe(t, 2) + '\',\'' + stripUnsafe(n, 2) + '\'';
var sHTML = '';
ShowDialog(sHTML, 0, -70, false, "Close", 280, 246, false, true);
}
}
function BookmarkDelicious(u,d,t,n) {
var thisURL = 'http://del.icio.us/post?v=3&noui=yes&jump=close&url=' + escape(u) + '&title=' + escape(d) + '¬es=' + escape(n);
window.open(thisURL, 'delicious','toolbar=no,width=700,height=260,resizable=yes');
outbound('delicious', thisURL);
}
function BkmkIt(sType,u,d,t,n,bFromPopup) {
var sBkmkUrl = '';
if (sType == 'digg') {
sBkmkUrl = 'http://digg.com/submit?url=' + escape(u) + '&title=' + escape(d) + '&phase=2';
} else if (sType == 'blinklist') {
sBkmkUrl = 'http://www.blinklist.com/index.php?Action=Blink/addblink.php&Url=' + escape(u) + '&Title=' + escape(d) + '&Tag=' + escape(t) + '&Description=' + escape(n);
} else if (sType == 'magnolia') {
sBkmkUrl = 'http://ma.gnolia.com/bookmarklet/add?url=' + escape(u) + '&title=' + escape(d) + '&description=' + escape(n) + '&tags=' + escape(t);
} else if (sType == 'netvouz') {
sBkmkUrl ='http://www.netvouz.com/action/submitBookmark?url=' + escape(u) + '&title=' + escape(d) + '&description=' + escape(n) + '&tags=' + escape(t) + '&popup=no';
} else if (sType == 'furl') {
sBkmkUrl = 'http://www.furl.net/storeIt.jsp?t=' + escape(d) + '&u=' + escape(u);
} else if (sType == 'simpy') {
sBkmkUrl = 'http://www.simpy.com/simpy/LinkAdd.do?href=' + escape(u) + '&title=' + escape(d) + '¬e=' + escape(n) + '&tags=' + escape(t);
} else if (sType == 'slashdot') {
sBkmkUrl = 'http://slashdot.org/submit.pl';
} else if (sType == 'spurl') {
sBkmkUrl = 'http://spurl.net/spurl.php?title=' + escape(d) + '&url=' + escape(u) + '&tags=' + escape(t);
} else if (sType == 'stumble') {
sBkmkUrl = 'http://www.stumbleupon.com/submit?url=' + escape(u) + '&title=' + escape(d);
} else if (sType == 'newsvine') {
sBkmkUrl = 'http://www.newsvine.com/_tools/seed&save?u=' + escape(u) + '&h=' + escape(d) + '&tags=' + escape(t);
} else if (sType == 'fark') {
sBkmkUrl = 'http://cgi.fark.com/cgi/fark/edit.pl?new_url=' + escape(u) + '&new_comment=' + escape(d) + '&linktype=';
} else if (sType == 'facebook') {
sBkmkUrl = 'http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(d);
} else if (sType == 'yahoo') {
sBkmkUrl = 'http://myweb2.search.yahoo.com/myresults/bookmarklet?u=' + escape(u) + '&t=' + escape(d);
} else if (sType == 'diigo') {
sBkmkUrl = 'http://www.diigo.com/post?url=' + escape(u) + '&title=' + escape(d) + '&comments=' + escape(n);
} else if (sType == 'reddit') {
sBkmkUrl = 'http://www.reddit.com/submit?url=' + escape(u) + '&title=' + escape(d);
} else if (sType == 'mixx') {
sBkmkUrl = 'http://www.mixx.com/submit?page_url=' + escape(u);
} else if (sType == 'ffeed') {
sBkmkUrl = 'http://friendfeed.com/share?url=' + escape(u) + '&title=' + escape(d);
} else if (sType == 'twit') {
sBkmkUrl = 'http://twitthis.com/twit?url=' + escape(u);
} else if (sType == 'del') {
BookmarkDelicious(u,d,t,n);
return false;
} else {
return false;
}
if (sType == 'facebook') {
window.open(sBkmkUrl,'sharer','toolbar=0,status=0,width=626,height=436');
} else {
if (bFromPopup) {
oNewWindow = window.open(sBkmkUrl, 'Clipmarks_New', 'width=1010,top=0,left=0,scrollbars=yes,toolbar=yes,location=yes,menubar=yes,directories=yes,statusbar=yes,resizable=yes');
} else {
window.open(sBkmkUrl);
}
}
outbound(sType, sBkmkUrl);
return false;
}
function EmbedClip(sClipGuid) {
// static guid must be dynamic
bLibraryWindowOpen = true;
bKeepDialogOpen = true;
var sCode;
sCode = '';
sCode += ' ';
sCode += ' ';
sCode += ' ';
sCode += '';
sCode += ' ';
sCode = sCode.replace(/\/mig, '>');
var sHTML = 'Paste this code in your blog, myspace profile, or other page to embed this clip. ';
sHTML += '';
ShowDialog(sHTML, 0, -70, false, "Close", 280, 246, false, true);
}
function outbound(sType, sURL) {
var xmlOutbound = CreateXMLHTTP();
if (!xmlOutbound) {
return;
}
xmlOutbound.open('GET', '/xml_action.aspx?action=outbound&type=' + sType + '&url=' + sURL, true);
xmlOutbound.send(null);
}
function LoginPrompt(sType, sUrl) {
var sMessage = '';
switch (sType) {
case 'add':
sMessage = 'add this to your clips';
break;
case 'comment':
sMessage = 'comment on this clip';
break;
case 'email':
sMessage = 'email this clip';
break;
case 'fav':
sMessage = 'add this tag to your Favorite Tags';
break;
case 'ignore':
sMessage = 'moderate your interaction with this user';
break;
case 'pop':
sMessage = 'pop this clip';
break;
case 'tag':
sMessage = 'add this topic to your "My Topics" list';
break;
case 'topic':
sMessage = 'customize this menu';
break;
}
if (sUrl && sUrl != '') { sUrl = '&url=' + encodeURI(sUrl); } else { sUrl = ''; }
var sHTML = '';
if (sType == 'pop') {
sHTML += '
Pop this clip!
';
sHTML += '
A pop is a way of thanking someone for posting a clip and telling others they should see it.
';
sHTML += '
';
} else if (sType == 'follow') {
sHTML += '
Follow this user!
';
sHTML += '
Following a user lets you easily follow their latest clips.
';
sHTML += '
';
} else {
sHTML += '
Please login to ' + sMessage + ' ';
sHTML += '
';
}
sHTML += '
';
sHTML += '';
ShowLayeredDialog(sHTML, 430, 190, false, true);
}
function HideLoginPrompt() {
ShowScrollbars();
document.getElementById('dvDialogBlackout').style.display='none';
document.getElementById('dvLoginPromptMessage').style.display='none';
if (!bIsNav) {
document.body.style.overflow = 'scroll';
}
}
function HideScrollbars() {
// note safari doesn't always hide scrollbars, but layers and scrollbars are not a problem with safari
if (is_mac || is_safari) {
if (document.getElementById('dvClipList')) { document.getElementById('dvClipList').style.overflow='hidden'; }
if (document.getElementById('fraClip')) { document.getElementById('fraClip').style.overflow='hidden'; }
if (document.getElementById('dvCollections')) { document.getElementById('dvCollections').style.overflow='hidden'; }
if (document.getElementById('dvClippers')) { document.getElementById('dvClippers').style.overflow='hidden'; }
if (document.getElementById('dvTags')) { document.getElementById('dvTags').style.overflow='hidden'; }
}
}
function ShowScrollbars() {
if (is_mac || is_safari) {
if (document.getElementById('dvClipList')) { document.getElementById('dvClipList').style.overflow='auto'; }
if (document.getElementById('fraClip')) { document.getElementById('fraClip').style.overflow='auto'; }
if (document.getElementById('dvCollections')) { document.getElementById('dvCollections').style.overflow='auto'; }
if (document.getElementById('dvClippers')) { document.getElementById('dvClippers').style.overflow='auto'; }
if (document.getElementById('dvTags')) { document.getElementById('dvTags').style.overflow='auto'; }
}
}
function setClientSize(W, H) {
window.resizeTo(W + 4, H + 24);
var cp = document.createElement("div");
cp.style.position = "absolute";
cp.style.width = "0px";
cp.style.height = "0px";
cp.style.right = "0px";
cp.style.bottom = "0px";
document.body.appendChild(cp);
var current_width = cp.offsetLeft;
var current_height = cp.offsetTop;
var dw = W - current_width;
var dh = H - current_height;
window.resizeBy(dw, dh);
document.body.removeChild(cp);
}
function GetUserDomain(sUser) {
var sDomain = sUser.toLowerCase();
var sHost = window.location.host;
sDomain = 'http://' + ((sUser != '') ? sDomain.replace(/[_\s]/g, '') : 'clipcast') + '.' + ((sHost.indexOf('dev.') > 0) ? 'dev.clipmarks.com' : 'clipmarks.com');
return(sDomain);
}
function IEHd() {
// prevents header from dissapearing in ie
if (is_ie) {
document.getElementById('dvHeaderSearch').style.display='none';
document.getElementById('dvHeaderSearch').style.display='block';
}
}
var xmlFollowedHTTP = null;
var xmlFavoritesHTTP = null;
function search() {
// step 1: check for valid query
var q = document.getElementById('txtTags').value;
q = q.replace(/^\s*/, '');
q = q.replace(/\s*$/, '');
if (q.length < 2 || q == 'search my clips' || q == 'search all clips') {
alert('Please a search query first.');
return false;
} else {
// set hiddens
document.getElementById('hdnSearchCc').value = (bInClipcast ? '1' : '0');
if (document.getElementById('radSearchWhat1').checked) {
document.getElementById('hdnSearchUser').value = '1';
}
return true;
}
}
function SearchVars(obj) {
for (i=0;i<3;i++) {
if (!!document.getElementById('radSearchWhat' + i)) { document.getElementById('radSearchWhat' + i).parentNode.className = 'SearchOpt'; }
}
obj.parentNode.className = 'SearchOptAct';
if (obj.value == '1') {
document.getElementById('hdnSearchUser').value = '1';
document.getElementById('hdnSearchUsername').value = sAuthName;
ResetSearchText('my');
} else if (obj.value == '2') {
document.getElementById('hdnSearchUser').value = '1';
if (!!sSearchUser) { document.getElementById('hdnSearchUsername').value = sSearchUser; }
ResetSearchText();
} else {
document.getElementById('hdnSearchUser').value = '0';
document.getElementById('hdnSearchUsername').value = '';
ResetSearchText();
}
}
function SearchFocus(obj, bFocused) {
if ((obj.value == 'search my clips' || obj.value == 'search all clips')) {
obj.style.color = (bFocused ? '#333333' : '#cccccc');
if (bFocused) { obj.value = ''; }
}
obj.className = (bFocused ? 'SearchFocus' : 'SearchBlur');
}
function ResetSearchText(sType) {
var obj = document.getElementById('txtTags');
if (sType == 'my') {
if (obj.value == '') {
obj.value = 'search my clips';
SearchFocus(obj, false);
}
} else {
if (obj.value == 'search my clips' || obj.value == 'search all clips') {
obj.value = '';
SearchFocus(obj, false);
}
}
}
function followed_load(dvMenu) {
if (GetAttribute(dvMenu, 'loaded', 'false') == 'true') {
return;
}
dvMenu.setAttribute('loaded', 'true');
var sTopic = dvMenu.getAttribute('type');
xmlFollowedHTTP = CreateXMLHTTP();
if (!xmlFollowedHTTP) {
alert('Browser Not Supported');
return;
}
if (dvMenu.getAttribute('type') == 'tags') {
xmlFollowedHTTP.open('GET', '/feed_follow.aspx?clippers=0', true);
} else {
xmlFollowedHTTP.open('GET', '/feed_follow.aspx?tags=0&clipcast=' + (bInClipcast ? 'true' : 'false'), true);
}
xmlFollowedHTTP.onreadystatechange = followed_related_XMLStateChange;
xmlFollowedHTTP.send(null);
}
function followed_remove(sType, sKey, aMenuItem) {
if (!confirm('Are you sure you want to remove "' + sKey + '" from your My ' + (sType == 'clipper' ? 'Clippers' : 'Topics') + ' list?')) {
return false;
}
var xmlAction = CreateXMLHTTP();
if (sType == 'clipper') {
xmlAction.open('GET', '/xml_action.aspx?action=remove_users&user=' + sKey, true);
} else {
xmlAction.open('GET', '/xml_action.aspx?action=remove_tags&tag=' + sKey, true);
}
xmlAction.send(null);
if (aMenuItem) {
aMenuItem.parentNode.removeChild(aMenuItem);
}
return false;
}
function followed_related_XMLStateChange() {
if (xmlFollowedHTTP.readyState != 4) {
return;
}
var xmlDocument = null;
var oWorkingNode = null;
var oTags = null;
var aRelatedTag = null;
var dvMenu_MyTags = document.getElementById('dvMenu_MyTags');
var dvMenu_CVMyTags = document.getElementById('dvMenu_CVMyTags');
var dvMenu_MyClippers = document.getElementById('dvMenu_MyClippers');
var dvMenu_MyClippersClipCast = document.getElementById('dvMenu_MyClippersClipCast');
var dvMenu_CVMyClippersEX = document.getElementById('dvMenu_CVMyClippersEX');
var dvWorkingMenu = null;
var imgDelete = null;
if (!(xmlFollowedHTTP.responseXML && xmlFollowedHTTP.responseXML.documentElement)) {
return;
}
xmlDocument = xmlFollowedHTTP.responseXML.documentElement;
oTags = xmlDocument.getElementsByTagName('item');
//fix for empty submenus ...
if (sMenuClicked == 'SortMine') {
sMenuClicked = 'MyTags';
} else if (sMenuClicked == 'SortMy' || sMenuClicked == 'Classic') {
sMenuClicked = 'MyClippers';
} else if (sMenuClicked == 'Clipcasts') {
sMenuClicked = 'MyClippersClipCast';
}
if (oTags.length == 0) {
dvWorkingMenu = document.getElementById('dvMenu_' + sMenuClicked);
var sHTML = '';
if (sMenuClicked == 'MyClippers' || sMenuClicked == 'MyClippersClipCast' || sMenuClicked == 'CVMyClippersEX' || sMenuClicked == 'ChooseClipper') {
sHTML = 'You don\'t have any Guides yet. When you want to follow clips posted by a particular user, make them a Guide by clicking the \"Follow\" link.
';
}
dvWorkingMenu.innerHTML = '';
} else {
for (i = 0; i < oTags.length; i++) {
if (oTags[i].getAttribute('type') == 'tag') {
for (j = 0; j < 2; j++) {
if (j == 0) {
dvWorkingMenu = dvMenu_MyTags;
} else {
dvWorkingMenu = dvMenu_CVMyTags;
}
if (!!dvWorkingMenu) {
if (dvWorkingMenu.firstChild.tagName == 'IMG') {
dvWorkingMenu.removeChild(dvWorkingMenu.firstChild);
}
aRelatedTag = document.createElement('A');
imgDelete = document.createElement('IMG');
imgDelete.title = 'Remove this from My Topics';
imgDelete.src = '/images/icons/delete.gif';
imgDelete.border = 0;
imgDelete.align = 'right';
imgDelete.className = 'Dlt';
if (is_ie) {
eval('imgDelete.onclick = function() {return followed_remove(\'tag\', \'' + oTags[i].getAttribute('key') + '\', this.parentNode);StopPropagation(event)}');
} else {
imgDelete.setAttribute('onclick', 'return followed_remove(\'tag\', \'' + oTags[i].getAttribute('key') + '\', this.parentNode);StopPropagation(event)');
}
aRelatedTag.appendChild(imgDelete)
aRelatedTag.appendChild(document.createTextNode(oTags[i].getAttribute('title')));
//aRelatedTag.href = (j == 0 ? 'http://clipmarks.com/' : '/') + (bInClipcast ? 'clipcast/' : '') + 'search/' + oTags[i].getAttribute('key') + '/';
if (bInClipcast) {
aRelatedTag.href = '/search/' + oTags[i].getAttribute('key') + '/'
} else {
aRelatedTag.href = (j == 0 ? 'http://clipmarks.com/' : '/') + 'search/' + oTags[i].getAttribute('key') + '/';
}
dvWorkingMenu.appendChild(aRelatedTag);
imgDelete = null;
aRelatedTag = null;
}
}
} else if (oTags[i].getAttribute('type') == 'clipper') {
for (j = 0; j <= 2; j++) {
if (j == 0) {
dvWorkingMenu = dvMenu_MyClippers;
} else if (j == 1) {
dvWorkingMenu = dvMenu_CVMyClippersEX;
} else {
dvWorkingMenu = dvMenu_MyClippersClipCast;
}
if (!!dvWorkingMenu) {
if (dvWorkingMenu.firstChild.tagName == 'IMG') {
dvWorkingMenu.removeChild(dvWorkingMenu.firstChild);
}
if (i == 0 && bInClipcast) {
dvWorkingMenu.innerHTML += 'All My Clippers ';
}
aRelatedTag = document.createElement('A');
imgDelete = document.createElement('IMG');
imgDelete.title = 'Remove from My Clippers';
imgDelete.src = '/images/icons/delete.gif';
imgDelete.border = 0;
imgDelete.align = 'right';
imgDelete.className = 'Dlt';
if (is_ie) {
eval('imgDelete.onclick = function() {return followed_remove(\'clipper\', \'' + oTags[i].getAttribute('username').replace(/ /mig, '+') + '\', this.parentNode);StopPropagation(event)}');
} else {
imgDelete.setAttribute('onclick', 'followed_remove(\'clipper\', \'' + oTags[i].getAttribute('username').replace(/ /mig, '+') + '\', this.parentNode);return StopPropagation(event)');
}
aRelatedTag.appendChild(imgDelete)
oWorkingNode = document.createElement('IMG');
oWorkingNode.align = 'left';
oWorkingNode.border = '0';
if (oTags[i].getAttribute('has-photo') == '1') {
oWorkingNode.src = '/profile/xsmall/' + oTags[i].getAttribute('key') + '.png';
} else {
oWorkingNode.src = '/images/user-no-photo-tiny-top.gif';
}
aRelatedTag.appendChild(oWorkingNode);
oWorkingNode = null;
aRelatedTag.appendChild(document.createTextNode(oTags[i].getAttribute('title')));
//alert(bInClipcast);
if (bInClipcast && j != 0) {
aRelatedTag.href = oTags[i].getAttribute('clipcast-url');
} else {
aRelatedTag.href = (j == 2 ? 'http://' + oTags[i].getAttribute('domain') + '/' : 'http://clipmarks.com/clipper/' + oTags[i].getAttribute('username').replace(/ /mig, '+') + '/');
}
dvWorkingMenu.appendChild(aRelatedTag);
aRelatedTag = null;
}
}
}
}
}
oTags = null;
xmlDocument = null;
if (sMenuClicked == 'CVMyClippersEX') {
CollapseMenu('CVMyClippersEX');
ExpandMenu('CVMyClippersEX', true, false, false);
} else if (sMenuClicked == 'MyClippers') {
ExpandMenu('SortMy', true, false, false, true, 'dvMenu_MyClippers');
} else if (sMenuClicked == 'SortMine') {
ExpandMenu('SortMine', true, false, false, true, 'dvMenu_MyTags');
} else if (!!dvMenu_MyTags) {
aRelatedTag = document.createElement('A');
aRelatedTag.style.textAlign = 'center';
aRelatedTag.style.fontWeight = 'bold';
aRelatedTag.appendChild(document.createTextNode('Add Topic'));
aRelatedTag.href = 'javascript:topic_add();';
dvMenu_MyTags.appendChild(aRelatedTag);
aRelatedTag = null;
}
}
function followed_tags_reset() {
document.getElementById('dvMenu_MyTags').setAttribute('loaded', 'false');
document.getElementById('dvMenu_MyTags').innerHTML = ' ';
}
function topic_add() {
sMenuClicked = null;
HideOpenMenus();
var sTemp = '';
sTemp += '
Add Topic
';
sTemp += '
';
sTemp += '
';
ShowDialog(sTemp, 0, 0, false, 'Save', 180, 90, false, false, 'topic_add_save()', true);
if (document.attachEvent) {
document.getElementById('txtAddTopicName').attachEvent('onkeydown', txtAddTopicName_keypress);
} else {
document.getElementById('txtAddTopicName').addEventListener('keypress', txtAddTopicName_keypress, true);
}
txtAddTopicName_blur();
}
function txtAddTopicName_focus() {
var txtAddTopicName = document.getElementById('txtAddTopicName');
if (txtAddTopicName.value == 'enter topic here') {
txtAddTopicName.value = '';
txtAddTopicName.style.color = '#333333';
}
}
function txtAddTopicName_blur() {
var txtAddTopicName = document.getElementById('txtAddTopicName');
if (txtAddTopicName.value == '' || txtAddTopicName.value == 'enter topic here') {
document.getElementById('txtAddTopicName').value = 'enter topic here';
txtAddTopicName.style.color = '#AAAAAA';
}
}
function txtAddTopicName_keypress(e) {
e = e||window.event;
var key = e.keyCode || e.which;
switch (key) {
case KEY_ENTER:
topic_add_save();
break;
default:
var txtAddTopicName = document.getElementById('txtAddTopicName');
if (txtAddTopicName.value == 'enter topic here') {
txtAddTopicName.value = '';
}
break;
}
}
function topic_add_save() {
var sNewTopic = document.getElementById('txtAddTopicName').value;
if (!!sNewTopic) {
FollowTag(sNewTopic, true);
}
}
function FollowTag(sTag, bCustom) {
if (!bAuth) {
alert('You must login to follow tags.');
}
var sURL = '/xml_action.aspx?action=follow_tag&k=' + sTag;
var xmlHTTP = CreateXMLHTTP();
if (!xmlHTTP) {
return;
}
xmlHTTP.open('GET', sURL, (iSearchFilter != 5));
xmlHTTP.send(null);
if (iSearchFilter == 5) {
window.location.reload(true);
return;
}
followed_tags_reset();
ShowDialog('' + sTag + ' has been added to your "My Topics" list. You can access these topics from the "My Topics" button in the header. ', 0, 0, false, null, null, 100);
if (!bCustom) {
var imgFollowTopic = document.getElementById('imgFollowTopic');
var imgFollowTopic2 = document.getElementById('imgFollowTopicCP');
if (!!imgFollowTopic) {
imgFollowTopic.src = '/images/buttons/plusexchange-added.gif';
imgFollowTopic.alt = sTag + ' is already in your My Topics list.';
imgFollowTopic.parentNode.href = 'javascript:ShowDialog(\'' + sTag + ' is already in your My Topics list. \', 0, 0, false, null, null, 80);';
imgFollowTopic.parentNode.title = sTag + ' is already in your My Topics list.';
}
if (!!imgFollowTopic2) {
imgFollowTopic2.parentNode.href = 'javascript:ShowDialog(\'' + sTag + ' is already in your My Topics list. \', 0, 0, false, null, null, 80);';
imgFollowTopic2.parentNode.title = sTag + ' is already in your My Topics list.';
imgFollowTopic2.parentNode.innerHTML = ' In My Topics';
imgFollowTopic2.parentNode.style.textDecoration='none';
}
}
}
/* Favorites Header Code */
function favorites_load(dvMenu) {
if (GetAttribute(dvMenu, 'loaded', 'false') == 'true') {
return;
}
dvMenu.setAttribute('loaded', 'true');
var sTopic = dvMenu.getAttribute('type');
xmlFavoritesHTTP = CreateXMLHTTP();
if (!xmlFavoritesHTTP) {
alert('Browser Not Supported');
return;
}
xmlFavoritesHTTP.open('GET', '/feed_favorites.aspx', true);
xmlFavoritesHTTP.onreadystatechange = favorites_related_XMLStateChange;
xmlFavoritesHTTP.send(null);
}
function favorites_remove(sUrl, aMenuItem) {
//if (!confirm('Are you sure you want to remove "' + sUrl + '" from your Favorite Clipcasts?')) {
if (!confirm('Are you sure you want to remove this from your Favorite Clipcasts?')) {
return false;
}
var xmlAction = CreateXMLHTTP();
xmlAction.open('GET', '/xml_action.aspx?action=fvrt_del&url=' + sUrl, true);
xmlAction.send(null);
if (aMenuItem) {
aMenuItem.parentNode.removeChild(aMenuItem);
}
return false;
}
function favorites_related_XMLStateChange() {
if (xmlFavoritesHTTP.readyState != 4) {
return;
}
var xmlDocument = null;
var oWorkingNode = null;
var oFavs = null;
var aRelatedTag = null;
//var dvMenu_MyFavoritesEX = document.getElementById('dvMenu_MyFavoritesEX');
var dvMenu_MyFavoritesEX = document.getElementById('dvMenu_MyFaves');
var dvWorkingMenu = null;
var imgDelete = null;
if (!(xmlFavoritesHTTP.responseXML && xmlFavoritesHTTP.responseXML.documentElement)) {
return;
}
xmlDocument = xmlFavoritesHTTP.responseXML.documentElement;
oFavs = xmlDocument.getElementsByTagName('favorite');
if (oFavs.length == 0) {
dvWorkingMenu = dvMenu_MyFavoritesEX; //document.getElementById('dvMenu_' + sMenuClicked);
var oDiv = document.createElement('div');
var sHTML = 'Your My Favorites list is empty. This list makes it easy to keep track of your favorite clipcasts.';
dvWorkingMenu.innerHTML = 'To add a Clipcast to your
favorites, click the
icon
at the top right of that ClipCast.';
} else {
for (i = 0; i < oFavs.length; i++) {
dvWorkingMenu = dvMenu_MyFavoritesEX;
if (!!dvWorkingMenu) {
if (dvWorkingMenu.firstChild.tagName == 'IMG') {
dvWorkingMenu.removeChild(dvWorkingMenu.firstChild);
}
aRelatedTag = document.createElement('A');
imgDelete = document.createElement('IMG');
imgDelete.title = 'Remove this from My Favorites';
imgDelete.src = '/images/icons/delete.gif';
imgDelete.border = 0;
imgDelete.align = 'right';
imgDelete.className = 'Dlt';
if (is_ie) {
eval('imgDelete.onclick = function() {return favorites_remove(\'' + oFavs[i].getAttribute('raw-url') + '\', this.parentNode);StopPropagation(event)}');
} else {
imgDelete.setAttribute('onclick', 'return favorites_remove(\'' + oFavs[i].getAttribute('raw-url') + '\', this.parentNode);StopPropagation(event)');
}
sTtl = oFavs[i].getAttribute('title');
if (sTtl.length > 29) {
sTtl = sTtl.substr(0,26) + '...';
}
aRelatedTag.appendChild(imgDelete);
aRelatedTag.appendChild(document.createTextNode(sTtl));
//aRelatedTag.href = 'http://clipmarks.com' + oFavs[i].getAttribute('url');
aRelatedTag.href = oFavs[i].getAttribute('url');
dvWorkingMenu.appendChild(aRelatedTag);
imgDelete = null;
aRelatedTag = null;
//alert(i);
}
}
}
oFavs = null;
xmlDocument = null;
}
// New Header Image Rotation...
var bHdRotate = true;
var lHdOffset = 15000;
var iHdRotatePos = 0;
var HdRotateSrc = new Array();
var HdRotateUrl = new Array();
var HdRotateID = new Array();
HdRotateSrc[0] = '/images/header/cm-for-fb.png';
HdRotateUrl[0] = 'http://apps.facebook.com/clipmarks/';
HdRotateID[0] = '1003';
HdRotateSrc[1] = '/images/header/my-clipcast.png';
HdRotateID[1] = '1001';
// HdRotateUrl[1] - declared inline
function preImg() {
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=preImg.arguments; for(i=0; i
= HdRotateSrc.length) { iHdRotatePos = 0; }
document.getElementById('imgHdRotate').src = HdRotateSrc[iHdRotatePos];
document.getElementById('lnkHdRotate').href = '/ad_click.aspx?id=' + HdRotateID[iHdRotatePos] + '&dest=' + escape(HdRotateUrl[iHdRotatePos]);
if (bHdRotate) { window.setTimeout("header_rotate_change();", lHdOffset); }
}