function Go(s) { // window.location = s; window.open(s); } function trof_flip(sId,iDelay,iDuration) { var oB = document.getElementById(sId); if(oB) { if(oB.style.display == '' ) { trof_hide(sId,iDelay,iDuration); setTimeout(function(){document.getElementById(sId).style.display='none'},iDelay+iDuration); } if(oB.style.display == 'none' ) { trof_show(sId,iDelay,iDuration); setTimeout(function(){document.getElementById(sId).style.display=''},iDelay+iDuration); } } } function trof_show(sId,iDelay,iDuration) { if(iDelay == 0) { iDelay = 5; //FUCK MSIE ! } var oB = document.getElementById(sId); //alert(oB.style.display + "\n" + oB.style.position); if(oB && (oB.style.display == 'none') ) { try //FUCK MSIE AGAIN! { Animation(oB).duration(iDelay).checkpoint().to('height', 'auto').from('0px').to('width', 'auto').from('0px').to('opacity', 1).from(0).blind().show().duration(iDuration).go(); } catch(e) { oB.style.display='inline'; } } } function trof_hide(sId,iDelay,iDuration) { if(iDelay == 0) { iDelay = 5; //FUCK MSIE AGAIN! } var oB = document.getElementById(sId); if(oB && (!(oB.style.display == 'none')) ) { try //FUCK MSIE AGAIN! { Animation(oB).duration(iDelay).checkpoint().to('height', '0px').to('width', '0px').to('opacity', 0).hide().duration(iDuration).go(); } catch(e) { oB.style.display='none'; } } } function trof_show_hide(sIdShow,sIdHide,iDelay,iDuration) { trof_show(sIdShow,iDelay,iDuration); trof_hide(sIdHide,iDelay,iDuration); } function TrimString(strIn) { try { return strIn.replace(/(^\s+)|(\s+$)/g, ""); } catch (e) { } } function trof_EmailPage() { window.location= "mailto:?subject=" + document.title + "&body="+escape(document.location.href); // return false; } function trof_BookmarkPage() { if(document.all) //MSIE { window.external.AddFavorite(document.location.href, document.title); } else { if(window.sidebar) { window.sidebar.addPanel(document.title, document.location.href, ''); } } // return true; } function trof_isNull(value) { return value == null || value == "" || value == "undefined"; } function trof_setCookie (name, value) { var expdate = new Date (); expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000 * 365 * 10)); document.cookie = name + "=" + escape (value) + "; expires=" + expdate.toGMTString() + "; path=/"; } //- function trof_getCookie_OLD(name) { var dcookie = document.cookie; var cname = name + "="; var clen = dcookie.length; var cbegin = 0; while (cbegin < clen) { var vbegin = cbegin + cname.length; if (dcookie.substring(cbegin, vbegin) == cname) { var vend = dcookie.indexOf (";", vbegin); if (vend == -1) vend = clen; return unescape(dcookie.substring(vbegin, vend)); } cbegin = dcookie.indexOf(" ", cbegin) + 1; if (cbegin == 0) break; } return null; } //http://techpatterns.com/downloads/javascript_cookies.php // this fixes an issue with the old method, ambiguous values // with this test document.cookie.indexOf( name + "=" ); //function Get_Cookie( check_name ) function trof_getCookie(check_name) { // first we'll split this cookie up into name/value pairs // note: document.cookie only returns name=value, not the other components var a_all_cookies = document.cookie.split( ';' ); var a_temp_cookie = ''; var cookie_name = ''; var cookie_value = ''; var b_cookie_found = false; // set boolean t/f default f for ( i = 0; i < a_all_cookies.length; i++ ) { // now we'll split apart each name=value pair a_temp_cookie = a_all_cookies[i].split( '=' ); // and trim left/right whitespace while we're at it cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, ''); // if the extracted name matches passed check_name if ( cookie_name == check_name ) { b_cookie_found = true; // we need to handle case where cookie has no value but exists (no = sign, that is): if ( a_temp_cookie.length > 1 ) { cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') ); } // note that in cases where cookie is initialized but no value, null is returned return cookie_value; break; } a_temp_cookie = null; cookie_name = ''; } if ( !b_cookie_found ) { return null; } } function trof_getUrlParameter(parameter, def) { url = new String(parent.location.href);//was top.location search = new String(url.substring(url.indexOf("?") + 1, url.length)) search = search.split("&") for (i = 0; i < search.length; i++) { pair = new String(search[i]) index = pair.indexOf("=") if (index > 0 && index < pair.length) { check = pair.substring(0, index) if (parameter == check) { var rawret = pair.substring(index + 1, pair.length); var ret = new String(unescape(rawret)); var mret = ""; for(var j = 0; j < ret.length; j++) if(ret.charAt(j) == '+') mret += ' '; else mret += ret.charAt(j); return mret; } } } return def; } function TrofReplaceAll(Source,stringToFind,stringToReplace) { var temp = new String(Source); var index = temp.indexOf(stringToFind); while(index != -1) { temp = temp.replace(stringToFind,stringToReplace); index = temp.indexOf(stringToFind); } return temp; } function TrofObjectPosition(obj) { var curleft = 0; var curtop = 0; if (obj.offsetParent) { do { curleft += obj.offsetLeft; curtop += obj.offsetTop; } while (obj = obj.offsetParent); } return [curleft,curtop]; } function TrofHelp(oCaller, sTopicId, sAsin) {//we use ebmedded help for now var oHelpTextContainer = document.getElementById("TROF_HELP_" + sTopicId); var aCallerPositions = TrofObjectPosition(oCaller); var iLeftCaller = aCallerPositions[0]; var iTopCaller = aCallerPositions[1]; oCaller.style.display='none'; sGlobalHelpReceiverObjectId = 'trof_div_apcn_help_a'; var oGlobalHelpObject = document.getElementById(sGlobalHelpReceiverObjectId); oGlobalHelpObject.style.display='none'; //can't hide- will overlap with show var sInner = oHelpTextContainer.innerHTML; var sReplaced = TrofReplaceAll(sInner,"@@ASIN@@", sAsin); oGlobalHelpObject.innerHTML = sReplaced; oGlobalHelpObject.style.position = 'absolute'; oGlobalHelpObject.style.left = iLeftCaller + 'px'; oGlobalHelpObject.style.top = iTopCaller + 'px'; trof_show(sGlobalHelpReceiverObjectId,0,300); return; } function trof_show_div_help_q(sDivId,oCaller) { var oDivHelp = document.getElementById(sDivId); //alert("|"+oDivHelp.style.display+"|"); if(oDivHelp.style.display != 'none') { // return; } var aCallerPositions = TrofObjectPosition(oCaller); var iLeftCaller = aCallerPositions[0]; var iTopCaller = aCallerPositions[1]; var aHelpPositions = TrofObjectPosition(oDivHelp); var iLeftHelp = aCallerPositions[0]; var iTopHelp = aCallerPositions[1]; oDivHelp.style.borderWidth = '1px'; oDivHelp.style.borderStyle = 'dashed'; oDivHelp.style.borderColor = 'black'; oDivHelp.style.backgroundColor = 'lightyellow'; oDivHelp.style.padding = '1px'; oDivHelp.style.cursor='help'; oDivHelp.style.color='blue'; oDivHelp.style.textDecoration='underline'; oDivHelp.style.position = 'absolute'; oDivHelp.style.left = iLeftHelp + 60 + 'px'; oDivHelp.style.top = iTopHelp - 10 + 'px'; //alert(oDivHelp.style.left + "\n" + oDivHelp.style.top); trof_show(sDivId,5,300); setTimeout(function(){trof_hide(sDivId,5,200);},4000); } //NOT IN USE ! function CloseQ(oThis) { var iDelay = 5; var iDuration = 300; if(oThis && (oThis.style.display != 'none')) { try //FUCK MSIE AGAIN! { Animation(oThis).duration(iDelay).checkpoint().to('height', '0px').to('width', '0px').to('opacity', 0).hide().duration(iDuration).go(); } catch(e) { oThis.style.display='none;'; } } }