//Saved 0.1 /* Javascript concatenator. dontcompress=1 - Show original files. */ function devnull(a) { return; } /*File: jquery.caret.1.02.min.js.*/ /* * * Copyright (c) 2010 C. F., Wong (Cloudgen Examplet Store) * Licensed under the MIT License: * http://www.opensource.org/licenses/mit-license.php * */ (function(k,e,i,j){k.fn.caret=function(b,l){var a,c,f=this[0],d=k.browser.msie;if(typeof b==="object"&&typeof b.start==="number"&&typeof b.end==="number"){a=b.start;c=b.end}else if(typeof b==="number"&&typeof l==="number"){a=b;c=l}else if(typeof b==="string")if((a=f.value.indexOf(b))>-1)c=a+b[e];else a=null;else if(Object.prototype.toString.call(b)==="[object RegExp]"){b=b.exec(f.value);if(b!=null){a=b.index;c=a+b[0][e]}}if(typeof a!="undefined"){if(d){d=this[0].createTextRange();d.collapse(true); d.moveStart("character",a);d.moveEnd("character",c-a);d.select()}else{this[0].selectionStart=a;this[0].selectionEnd=c}this[0].focus();return this}else{if(d){c=document.selection;if(this[0].tagName.toLowerCase()!="textarea"){d=this.val();a=c[i]()[j]();a.moveEnd("character",d[e]);var g=a.text==""?d[e]:d.lastIndexOf(a.text);a=c[i]()[j]();a.moveStart("character",-d[e]);var h=a.text[e]}else{a=c[i]();c=a[j]();c.moveToElementText(this[0]);c.setEndPoint("EndToEnd",a);g=c.text[e]-a.text[e];h=g+a.text[e]}}else{g= f.selectionStart;h=f.selectionEnd}a=f.value.substring(g,h);return{start:g,end:h,text:a,replace:function(m){return f.value.substring(0,g)+m+f.value.substring(h,f.value[e])}}}}})(jQuery,"length","createRange","duplicate"); /*File: jtip.js.*/ /* * JTip * By Cody Lindley (http://www.codylindley.com) * Under an Attribution, Share Alike License * JTip is built on top of the very light weight jquery library. */ //on page load (as soon as its ready) call JT_init $(document).ready(JT_init); function JT_init(){ //$("a.jTip").html(""); $("a.jTip") .hover(function(){JT_show(this.href,this.id,this.name)},function(){$('#JT').remove()}) .click(function(){return false}); $("a.jTipClick") .click(function(){alert("hi");JT_show(this.href,this.id,this.name); return false }); } function JT_show(url,linkId,title){ $('#JT').remove(); if(title == false)title=" "; var de = document.documentElement; var w = self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth; var hasArea = w - getAbsoluteLeft(linkId); var clickElementy = getAbsoluteTop(linkId) - 3; //set y position var queryString = url.replace(/^[^\?]+\??/,''); //alert(queryString + " --> "+ url); var params = parseQuery( queryString ); if(params['width'] === undefined){ params['width'] = 250; } else { widthPos = url.indexOf("&width"); url = url.substring(0, widthPos); } if(params['link'] !== undefined){ $('#' + linkId).bind('click',function(){window.location = params['link']}); $('#' + linkId).css('cursor','pointer'); } if(hasArea>((params['width']*1)+75)){ $("body").append("
"+title+"
");//right side var arrowOffset = getElementWidth(linkId) + 11; var clickElementx = getAbsoluteLeft(linkId) + arrowOffset; //set x position }else{ $("body").append("
"+title+"
");//left side var clickElementx = getAbsoluteLeft(linkId) - ((params['width']*1) + 15); //set x position } $('#JT').css({left: clickElementx+"px", top: clickElementy+"px"}); $('#JT').show(); $.get(url, function(data){ //alert("Data Loaded: " + data); html_pos = data.indexOf(''); data = data.substring(html_pos + 6); html_pos = data.indexOf(''); data = data.substring(0, html_pos); $('#JT_copy').html(data); }) //$('#JT_copy').load(url); //$('#JT_copy').hide(); } function JT_showClick(url,linkId,title){ $('#JT').remove(); var hashLoc = url.indexOf("#"); url = url.substring(hashLoc); if(title == false)title=" "; var de = document.documentElement; var w = self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth; var hasArea = w - getAbsoluteLeft(linkId); var clickElementy = getAbsoluteTop(linkId) - 3; //set y position var queryString = url.replace(/^[^\?]+\??/,''); //alert(queryString + " --> "+ url); var params = parseQuery( queryString ); if(params['width'] === undefined){ params['width'] = 250; } else { widthPos = url.indexOf("?width"); url = url.substring(0, widthPos); //alert(url); } if(params['link'] !== undefined){ $('#' + linkId).bind('click',function(){window.location = params['link']}); $('#' + linkId).css('cursor','pointer'); } if(hasArea>((params['width']*1)+75)){ $("body").append("
"+title+"
");//right side var arrowOffset = getElementWidth(linkId) + 11; var clickElementx = getAbsoluteLeft(linkId) + arrowOffset; //set x position }else{ $("body").append("
"+title+"
");//left side var clickElementx = getAbsoluteLeft(linkId) - ((params['width']*1) + 15); //set x position } $('#JT').css({left: clickElementx+"px", top: clickElementy+"px"}); $('#JT').show(); var objContent = $(url).html(); $('#JT_copy').html(objContent); /*$.get(url, function(data){ //alert("Data Loaded: " + data); html_pos = data.indexOf(''); data = data.substring(html_pos + 6); html_pos = data.indexOf(''); data = data.substring(0, html_pos); $('#JT_copy').html(data); })*/ //$('#JT_copy').load(url); //$('#JT_copy').hide(); } function getElementWidth(objectId) { x = document.getElementById(objectId); return x.offsetWidth; } function getAbsoluteLeft(objectId) { // Get an object left position from the upper left viewport corner o = document.getElementById(objectId) oLeft = o.offsetLeft // Get left position from the parent object while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element oParent = o.offsetParent // Get parent object reference oLeft += oParent.offsetLeft // Add parent left position o = oParent } return oLeft } function getAbsoluteTop(objectId) { // Get an object top position from the upper left viewport corner o = document.getElementById(objectId) oTop = o.offsetTop // Get top position from the parent object while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element oParent = o.offsetParent // Get parent object reference oTop += oParent.offsetTop // Add parent top position o = oParent } return oTop } function parseQuery ( query ) { var Params = new Object (); if ( ! query ) return Params; // return empty object var Pairs = query.split(/[;&]/); for ( var i = 0; i < Pairs.length; i++ ) { var KeyVal = Pairs[i].split('='); if ( ! KeyVal || KeyVal.length != 2 ) continue; var key = unescape( KeyVal[0] ); var val = unescape( KeyVal[1] ); val = val.replace(/\+/g, ' '); Params[key] = val; } return Params; } function blockEvents(evt) { if(evt.target){ evt.preventDefault(); }else{ evt.returnValue = false; } } /*File: jquery.scrollTo-min.js.*/ /** * Copyright (c) 2007-2013 Ariel Flesler - afleslergmailcom | http://flesler.blogspot.com * Dual licensed under MIT and GPL. * @author Ariel Flesler * @version 1.4.6 */ ;(function($){var h=$.scrollTo=function(a,b,c){$(window).scrollTo(a,b,c)};h.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1,limit:true};h.window=function(a){return $(window)._scrollable()};$.fn._scrollable=function(){return this.map(function(){var a=this,isWin=!a.nodeName||$.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)return a;var b=(a.contentWindow||a).document||a.ownerDocument||a;return/webkit/i.test(navigator.userAgent)||b.compatMode=='BackCompat'?b.body:b.documentElement})};$.fn.scrollTo=function(e,f,g){if(typeof f=='object'){g=f;f=0}if(typeof g=='function')g={onAfter:g};if(e=='max')e=9e9;g=$.extend({},h.defaults,g);f=f||g.duration;g.queue=g.queue&&g.axis.length>1;if(g.queue)f/=2;g.offset=both(g.offset);g.over=both(g.over);return this._scrollable().each(function(){if(e==null)return;var d=this,$elem=$(d),targ=e,toff,attr={},win=$elem.is('html,body');switch(typeof targ){case'number':case'string':if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=$(targ,this);if(!targ.length)return;case'object':if(targ.is||targ.style)toff=(targ=$(targ)).offset()}$.each(g.axis.split(''),function(i,a){var b=a=='x'?'Left':'Top',pos=b.toLowerCase(),key='scroll'+b,old=d[key],max=h.max(d,a);if(toff){attr[key]=toff[pos]+(win?0:old-$elem.offset()[pos]);if(g.margin){attr[key]-=parseInt(targ.css('margin'+b))||0;attr[key]-=parseInt(targ.css('border'+b+'Width'))||0}attr[key]+=g.offset[pos]||0;if(g.over[pos])attr[key]+=targ[a=='x'?'width':'height']()*g.over[pos]}else{var c=targ[pos];attr[key]=c.slice&&c.slice(-1)=='%'?parseFloat(c)/100*max:c}if(g.limit&&/^\d+$/.test(attr[key]))attr[key]=attr[key]<=0?0:Math.min(attr[key],max);if(!i&&g.queue){if(old!=attr[key])animate(g.onAfterFirst);delete attr[key]}});animate(g.onAfter);function animate(a){$elem.animate(attr,f,g.easing,a&&function(){a.call(this,targ,g)})}}).end()};h.max=function(a,b){var c=b=='x'?'Width':'Height',scroll='scroll'+c;if(!$(a).is('html,body'))return a[scroll]-$(a)[c.toLowerCase()]();var d='client'+c,html=a.ownerDocument.documentElement,body=a.ownerDocument.body;return Math.max(html[scroll],body[scroll])-Math.min(html[d],body[d])};function both(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery); /*File: jquery.placeholder.js.*/ /***************************************************************************** jQuery Placeholder 1.1.9 Copyright (c) 2010 Michael J. Ryan (http://tracker1.info/) Dual licensed under the MIT and GPL licenses: http://www.opensource.org/licenses/mit-license.php http://www.gnu.org/licenses/gpl.html ------------------------------------------------------------------------------ Sets up a watermark for inputted fields... this will create a LABEL.watermark tag immediately following the input tag, the positioning will be set absolute, and it will be positioned to match the input tag. To activate: $('input[placeholder],textarea[placeholder]').placeholder(); NOTE, when changing a value via script: $('#input_id').val('new value').change(); //force change event, so placeholder sets properly To style the tags as appropriate (you'll want to make sure the font matches): label.placeholder { cursor: text; <--- display a cursor to match the text input padding: 4px 4px 4px 4px; <--- this should match the border+padding for the input field(s) color: #999999; <--- this will display as faded } You'll also want to have the color set for browsers with native support input:placeholder, textarea:placeholder { color: #999999; } input::-webkit-input-placeholder, textarea::-webkit-input-placeholder { color: #999999; } ------------------------------------------------------------------------------ Thanks to... http://www.alistapart.com/articles/makingcompactformsmoreaccessible http://plugins.jquery.com/project/overlabel This works similar to the overlabel, but creates the actual label tag based on the placeholder attribute on the input tag, instead of relying on the markup to provide it. *****************************************************************************/ (function($){ var ph = "PLACEHOLDER-INPUT"; var phl = "PLACEHOLDER-LABEL"; var boundEvents = false; var default_options = { labelClass: 'placeholder' }; //check for native support for placeholder attribute, if so stub methods and return var input = document.createElement("input"); if ('placeholder' in input) { $.fn.placeholder = $.fn.unplaceholder = function(){}; //empty function delete input; //cleanup IE memory return; }; delete input; //bind to resize to fix placeholders when the page resizes (fields are hidden/displayed, which can change positioning). $(window).resize(checkResize); $.fn.placeholder = function(options) { bindEvents(); var opts = $.extend(default_options, options) this.each(function(){ var rnd=Math.random().toString(32).replace(/\./,'') ,input=$(this) ,label=$(''); if (!input.attr('placeholder') || input.data(ph) === ph) return; //already watermarked //make sure the input tag has an ID assigned, if not, assign one. if (!input.attr('id')) input.attr('id', 'input_' + rnd); label .attr('id',input.attr('id') + "_placeholder") .data(ph, '#' + input.attr('id')) //reference to the input tag .attr('for',input.attr('id')) .addClass(opts.labelClass) .addClass(opts.labelClass + '-for-' + this.tagName.toLowerCase()) //ex: watermark-for-textarea .addClass(phl) .text(input.attr('placeholder')); input .data(phl, '#' + label.attr('id')) //set a reference to the label .data(ph,ph) //set that the field is watermarked .addClass(ph) //add the watermark class .after(label) //add the label field to the page //setup overlay itemFocus.call(this); itemBlur.call(this); }); }; $.fn.unplaceholder = function(){ this.each(function(){ var input=$(this), label=$(input.data(phl)); if (input.data(ph) !== ph) return; label.remove(); input.removeData(ph).removeData(phl).removeClass(ph).unbind('change',itemChange); }); }; function bindEvents() { if (boundEvents) return; //prepare live bindings if not already done. $("form").live('reset', function(){ $(this).find('.' + ph).each(itemBlur); }); $('.' + ph) .live('keydown',itemFocus) .live('mousedown',itemFocus) .live('mouseup',itemFocus) .live('mouseclick',itemFocus) .live('focus',itemFocus) .live('focusin',itemFocus) .live('blur',itemBlur) .live('focusout',itemBlur) .live('change',itemChange); ; $('.' + phl) .live('click', function() { $($(this).data(ph)).focus(); }) .live('mouseup', function() { $($(this).data(ph)).focus(); }); bound = true; boundEvents = true; }; function itemChange() { var input = $(this); if (!!input.val()) { $(input.data(phl)).hide(); return; } if (input.data(ph+'FOCUSED') != 1) { showPHL(input); } } function itemFocus() { $($(this).data(ph+'FOCUSED',1).data(phl)).hide(); }; function itemBlur() { var that = this; showPHL($(this).removeData(ph+'FOCUSED')); //use timeout to let other validators/formatters directly bound to blur/focusout work setTimeout(function(){ var input = $(that); //if the item wasn't refocused, test the item if (input.data(ph+'FOCUSED') != 1) { showPHL(input); } }, 200); }; function showPHL(input, forced) { var label = $(input.data(phl)); //if not already shown, and needs to be, show it. if ((forced || label.css('display') == 'none') && !input.val()) label .text(input.attr('placeholder')) .css('top', input.position().top + 'px') .css('left', input.position().left + 'px') .css('display', 'block'); //console.dir({ 'input': { 'id':input.attr('id'), 'pos': input.position() }}); } var cr; function checkResize() { if (cr) window.clearTimeout(cr); cr = window.setTimeout(checkResize2, 50); } function checkResize2() { $('.' + ph).each(function(){ var input = $(this); var focused = $(this).data(ph+'FOCUSED'); if (!focused) showPHL(input, true); }); } }(jQuery)); /*File: jquery.selectOptions.js.*/ // JavaScript Document eval(function(p,a,c,k,e,r){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';(6($){$.u.N=6(){5 j=6(a,v,t,b,c){5 d=11.12("U");d.p=v,d.H=t;5 o=a.z;5 e=o.q;3(!a.A){a.A={};x(5 i=0;i=2){3(9(a[1])=="O"){k=a[1];E=a[2]}n 3(9(a[2])=="O"){k=a[2];E=a[1]}n{E=a[1]}3(!m){v=a[0];t=a[1]}}4.y(6(){3(4.F.C()!="G")7;3(m){x(5 a 13 l){j(4,a,l[a],k,E);E+=1}}n{j(4,v,t,k,E)}});7 4};$.u.14=6(b,c,d,e,f){3(9(b)!="J")7 4;3(9(c)!="D")c={};3(9(d)!="O")d=8;4.y(6(){5 a=4;$.15(b,c,6(r){$(a).N(r,d);3(9 e=="6"){3(9 f=="D"){e.16(a,f)}n{e.P(a)}}})});7 4};$.u.X=6(){5 a=W;3(a.q==0)7 4;5 d=9(a[0]);5 v,K;3(d=="J"||d=="D"||d=="6"){v=a[0];3(v.I==Y){5 l=v.q;x(5 i=0;i=0;i--){3(v.I==Q){3(o[i].p.R(v)){b=8}}n 3(o[i].p==v){b=8}3(b&&a[1]===8)b=o[i].s;3(b){o[i]=Z}b=B}}n{3(a[1]===8){b=o[K].s}n{b=8}3(b){4.18(K)}}});7 4};$.u.19=6(f){5 g=$(4).10();5 a=9(f)=="V"?8:!!f;4.y(6(){3(4.F.C()!="G")7;5 o=4.z;5 d=o.q;5 e=[];x(5 i=0;iM?-1:1}});x(5 i=0;i2500) { whichForm.find("a.submit").after("
"+label_please_wait_javascript+"
"); setTimeout(function () { $("div.js_please_wait").remove(); },3000); } setTimeout(checkBadWordTimeout,delaysIncr+4000); } var checkBadCallback = function(thisField) { return function(data, textStatus) { checkingNResults--; if(data.indexOf('restricted_word_alert')>-1) { thisField.addClass('invalid'); lastBadField = thisField; lastBadData = data; foundNBadResults++; } else { thisField.removeClass('invalid'); } if(checkingNResults == 0) { thisField.parents("form").find("a.submit").attr("title","").removeClass("negative"); if(foundNBadResults > 0) { $.scrollTo(lastBadField,0); var introheight = 0; introheight = 62 + (lastBadData.length / 90 * 18) + ((lastBadData.replace('
','
').split("
").length - 1)*18); introheight = Math.max(introheight,100); //'; tb_show("","/my/common/restricted_status_fetch#TB_iframe=true&width=600&height="+introheight); } else { checkBadForm.submit(); } } }; }; function getLastBadWord() { return lastBadData; } function checkBadWordTimeout() { checkBadForm.find("a.submit").attr("title","").removeClass("negative"); if(foundNBadResults == 0&&checkingNResults!=0) { /*if(gn_customer_id == "415880") alert("Check bad word timeout reached...found "+foundNBadResults+" bad words, expected "+checkingNResults+" more results."); */ checkBadForm.submit(); } } function makeButtons(where) { if (typeof(where) == "undefined") var where = ''; CSS3 = { supported: false, prefix: "" }; try { if (typeof(document.body.style.borderRadius) != 'undefined') { CSS3.supported = true; CSS3.prefix = ""; } } catch(e) { var cssfailed = 1; } try { if (typeof(document.body.style.MozBorderRadius) != 'undefined') { CSS3.supported = true; CSS3.prefix = "-moz-"; } } catch(e) { var cssfailed = 1; } try { if (typeof(document.body.style.webkitBorderRadius) != 'undefined') { CSS3.supported = true; CSS3.prefix = "-webkit-"; } } catch(e) { var cssfailed = 1; } /* if (CSS3.supported) if (CSS3.prefix == "") alert("CSS3 is supported in this browser with no prefix required."); else alert("CSS3 is supported in this browser with the prefix: '"+CSS3.prefix+"'."); else alert("CSS3 is NOT supported in this browser.");*/ if (CSS3.supported || gn_company_id == 161928) { var we_default_to_cool_buttons_now = 1; } else { $("body a.button:not(.fixedButton), button:not(.fixedButton)").addClass("fixedButton"); $(where + ' .fixedButton:not(.non_standard_btn)').wrapInner(''); $(where + ' .fixedButton:not(.non_standard_btn).button_large').addClass('fixedButtonLarge'); $(where + ' .fixedButton:not(.non_standard_btn)').each(function () { var b = $(this); var lastWidth = b.css('width'); if(lastWidth!=b.css('width','auto').css('width')) { b.children('span').css('width',lastWidth.replace('px','')-2); b.css('width','auto'); } }); } zeroclip_setup(); } function checkLanguages() { $('#gsn_web_profile .language_select').each(function () { $(this).parents('p.language_p').css('position', '').css('left', ''); $(this).removeClass('noneselected'); if ($(this).selectedTexts()[0] == 'None') { $(this).addClass('noneselected'); } }); $('#gsn_web_profile .noneselected:gt(0)').parents('p.language_p').css('position', 'absolute').css('left', '-5000px'); } function addRandomizerSwitch(newval,actuallyDoIt) { if(actuallyDoIt!==undefined) addRandomizer = newval; setTimeout(function () { addRandomizerSwitch(newval,true); },3000); } this.imagePreview = function () { /* CONFIG */ // these 2 variable determine popup's distance from the cursor // you might want to adjust to get the right result /* END CONFIG */ addRandomizerSwitch(false); $(".hover_preview").hover(function (e) { if (e.pageX > 0) mouseOffset = e.pageX; if (e.pageY > 0) mouseyOffset = e.pageY; //if($(this).attr("rel")=='potd') { //xOffset = -535; //yOffset = -350; //} else { //xOffset = -235; //yOffset = -50; //} //var c = (this.title != "") ? "
" + this.title : ""; addRandomizer = false; $("body").append("

"); setTimeout(function () { rePositionPreview(e.pageX,e.pageY); }, 200); }, function () { // this.title = this.t; $("#preview_spot_hover").remove(); }); $(".hover_preview").mousemove(function (e) { rePositionPreview(e.pageX, e.pageY); }); }; var gv_random_spot = Math.floor(Math.random()*100000001); function rePositionPreview(epagex, epagey) { var myHeight = $('#preview_spot_hover img').height(); if(!addRandomizer) { if (myHeight < 35) { clearTimeout(repositionTimer); repositionTimer = setTimeout(function () { rePositionPreview(epagex,epagey);}, 100); return; } if($('#preview_spot_hover img').width() == 112 && myHeight == 92) { addRandomizer = true; $('#preview_spot_hover img').attr("src",$('#preview_spot_hover img').attr("src")+gv_random_spot); } } yOffset = Math.round(myHeight / 2) * -1; if (epagex > 0) mouseOffset = epagex; if (epagey > 0) mouseyOffset = epagey; if (yOffset < -10) { try { var yyy = parent.$('window'); newTopPosition = (($(window).height() / 2) + yOffset); } catch (e) { newTopPosition = (mouseyOffset + yOffset); } if (newTopPosition < 0) { newTopPosition = 0; } $("#preview_spot_hover").css("position", "fixed").stop().animate({ top: newTopPosition + "px", left: (mouseOffset + xOffset) + "px" }, 0);//Math.round(Math.abs($("#preview_spot_hover").css('left').replace('px', '') - (mouseOffset + xOffset)) / 2)); } } function checkProspectEmail(delayvar) { clearTimeout(checkProspectEmailTimeout); checkProspectEmailTimeout = setTimeout(function () { checkAnEmailA($('#prospect_contact input[name=fv_email]'),$('#prospect_contact form')) }, delayvar ); } function checkNewContactEmail(delayvar) { clearTimeout(checkProspectEmailTimeout); checkProspectEmailTimeout = setTimeout(function () { checkAnEmail($('#buildprospect input[name=fv_email]'),$('#addprospect form')) }, delayvar ); } function checkAnEmailA(theemail,theform) { if(theemail.val().length == 0) { theemail.css('background-color',''); theform.find("a.submit").removeClass("negative"); } else if(checkEmailVal(theemail.val())==false){ theemail.css('background-color','pink'); theform.find("a.submit").attr("title",'Please enter a valid email address.').addClass("negative"); } else { $.get('/my/remote/username_exists?fv_username='+theemail.val(),function (data) { if((data.indexOf('none') != -1 || data.indexOf($('#contact_id_h1').attr('rel'))!=-1)) { theemail.css('background-color',''); theform.find("a.submit").removeClass("negative"); } else { theemail.css('background-color','pink'); theform.find("a.submit").attr("title",'There is another contact in your database with this email address. Please change the email address of this contact.').addClass("negative"); } }); } } function checkAnEmail(theemail,theform) { if(theemail.val().length == 0) { theemail.css('background-color',''); theform.unbind('submit'); } else if(checkEmailVal(theemail.val())==false){ theemail.css('background-color','pink'); theform.unbind('submit'); theform.submit(function () { alert('Please enter a valid email address.'); return false; }); } else { $.get('/my/remote/username_exists?fv_username='+theemail.val(),function (data) { if((data.indexOf('none') != -1 || data.indexOf($('#contact_id_h1').attr('rel'))!=-1)) { theemail.css('background-color',''); theform.unbind('submit'); } else { theemail.css('background-color','pink'); theform.unbind('submit');theform.submit(function () { alert('There is another contact in your database with this email address. Please change the email address of this contact.'); return false; }); } }); } } $(bootUp); var lastKey = -1; function bootUp() { devnull("SPOT Marketing bootUp()"); if(!$.browser.msie || parseInt($.browser.version, 10) > 9) { $("body").removeClass("lteie9"); } else { $("body").addClass("lteie9"); } setupOmniSearch(); // ******************* Detect Border Radius and Buttons ************************************ /* jQuery.support.borderRadius = false; jQuery.each(['BorderRadius', 'MozBorderRadius', 'WebkitBorderRadius', 'OBorderRadius', 'KhtmlBorderRadius'], function () { if (document.body.style[this] !== undefined) jQuery.support.borderRadius = true; return (!jQuery.support.borderRadius); });*/ makeButtons(); // ******************* End Detect Border Radius and Buttons ************************************ if($("#to_addresses").length==1) setupEmailSendTokenizer(); if($("#html5_spot").length!=0) html5_spot_startup(); $('#prospect_history.relsort').each(function () { $relsorttable = $(this); var rows = $relsorttable.find('tr').get(); rows.sort(function(a, b) { var keyA = $(a).attr('rel'); var keyB = $(b).attr('rel'); if (keyA < keyB) return 1; if (keyA > keyB) return -1; return 0; }); $.each(rows, function(index, row) { $relsorttable.children("tbody").append(row); }); }); $("#j_show_customer_vars").click(function () { $(".j_customer_vars").show(); $(this).hide(); return false; }); $('#reset_ar_all').click(function (e) { if (confirm($(this).attr('title'))) { $('.iframe_container').empty(); $('.iframe_container').append('
Please wait while your messages are reset to default. This may take several minutes.

Do not close the window or proceed any further while this is occuring.

'); $('div.column.span-32').empty(); $('div.column.span-32').append('

Message Defaults

Please wait while your messages are reset to default. This may take several minutes.

Do not close the window while this is occuring.

'); setTimeout(function () { window.location = window.location }, 1000 * 60 * 2.5); $.get($(this).attr('href'), function (xml) { window.location = window.location; }); } e.preventDefault(); return false; }); $('a.closeTB').click(function (e) { tb_remove(2); //Only remove the first thickbox, do not try to cascade, really the limit is 2, but we are tricking it to never close more than one even if the limit rises. $(this).blur(); e.preventDefault(); return false; }); $('a.noclick').click(function (e) { $(this).blur(); e.preventDefault(); return false; }).css('cursor', 'default'); // ******************* Init Scripts Start Here ************************************ $('a.submit').click(function () { if ($(this).hasClass("negative")) { saythis = 'Please complete the form.'; saythis = ($(this).attr('title')===undefined || $(this).attr('title').length == 0) ? saythis : $(this).attr('title'); saythis = $(this).data('error-message')===undefined ? saythis : $(this).data('error-message'); if(saythis!='none') alert(saythis); } else { parent.goodToGo = true; if($(this).parents('form').find('.restricted_input').length>0) { testRestrictedWords($(this).parents('form')); } else { $(this).parents('form').submit(); } } return false; }); $('form:has(a.submit)').submit(function () { if($(this).children('a.submit').hasClass('negative')) return false; }); $('form:has(a.submit) input').keyup(function (e) { if (e.keyCode == 13 && lastKey != 38 && lastKey != 40) { $(this).parents('form').find('a.submit').click(); return false; } lastKey = e.keyCode; }); if (window.location.hash == '#configspot') { $('#show_create_spot').click(); } if(window.location.hash == '#open_login') { $('#login_option a').click(); } try { if(window.location.hash.length > 2) { if(parent!=self) { parent.$.scrollTo(Number(parent.$("#fancybox-wrap").css("top").replace('px',''))+Number($("a[name="+window.location.hash.substring(1)+"]").offset().top)+25,400); } else { $.scrollTo(Number($("a[name="+window.location.hash.substring(1)+"]").offset().top-25),400); } } } catch(e) { var aaa = 1; } setTimeout(fancy_anchors,500); if (parent.frames.length != 0) { // ******************* Thickbox Title Generation ************************************ //This code changes the ThickBox Pop-Up Title to match the first H1, h2, or legend found in the iframed page. //If it can't find those it resorts to the Title field. //If there isn't a title it resorts to the original rel title. try { var newAjaxTitle = $('h1:first,h2:first,legend:first').eq(0).text(); if (newAjaxTitle.length == 0) newAjaxTitle = $('title').eq(0).text(); if (newAjaxTitle.length != 0) parent.$('#TB_ajaxWindowTitle,#fancybox-title-float-main').text(newAjaxTitle); if (parent.$('#fancybox-content').width() >0) { parent.$("#fancybox-title").css("left",(((parent.$('#fancybox-content').width()+20)/2)-(parent.$('#fancybox-title').width()/2)+20)+"px"); } } catch (e) { var crashed_changing_title = e; //alert(e); } // ******************* End Thickbox Title Generation ************************************ } // ******************* MISC Start Here ************************************ $('#prospect_contact input[name=fv_email]').keydown(function () { checkProspectEmail(300); }); $("#buildprospect input[name=fv_email]").keydown(function () { checkNewContactEmail(300); }); $('#calendar_sync_button').click(function () { $('#sync_options').show(); }); // ******************* MISC END Here ************************************ // ******************* Low Priority Start Here ************************************ setTimeout(lowPriorityBootUp, 30); //**** END LOW PRIORITY // ******************* Org and Lang Selection Scripts Start Here ************************ $("#myorg").click(function () { $("#langlist").hide(); $("#orglist").load("/gsnapi/orglist", function () { $(this).show(); $("#orglist a.listclose").click(function () { $(this).parent().hide(); }); }); }); $('html').click(function() { $("#langlist").hide(); }); $("#mylang").click(function () { $("#orglist").hide(); $("#langlist").load("/gsnapi/langlist", function () { $(this).show(); $("#langlist a.listclose").click(function () { $("#langlist").hide(); }); }); }); // ******************* Org and Lang Selection Scripts End Here ************************ $("#openupgrade").click(function () { $("#prospectsummaryupgrade").show("fast"); }); $("#closeupgrade").click(function () { $("#prospectsummaryupgrade").hide("fast"); }); $("#activity_report #rpt_close").click(function () { self.parent.tb_remove(); return false; }); // ******************* Begin Help Alternative Layouts ************************************ $('#helpopener').click(function () { $(".span-7").show(); $(this).hide(); }); //The following makes the help bar full opacity when hovered over when it is defaulted to half opacity. if ($('#help').css('opacity') != "1") { $('.span-7').hover(function () { $('#help,#bookmarks,.span-7 .button, .span-7 .ad').css('opacity', '1'); }, function () { $('#help,#bookmarks,.span-7 .button, .span-7 .ad').css('opacity', ''); }); } // ******************* End Help Alternative Layouts ************************************ // ******************* Pod Lists Start Here ************************************ $('.pod_list .pod').addClass('middlepod'); $('.pod_list .pod:first, .pod_list .pod:last').removeClass('middlepod'); $('.pod_list .pod:first h2').after(''); $('.pod_list .close_pod_list').click(function () { $(this).parents('.pod_list').slideUp(); }); $('.pod_list .pod:first').addClass('firstpod'); $('.pod_list .pod:last').addClass('lastpod'); $('.pod_list .pod_opened').find('.pod_data').slideDown(); $('.pod_list .pod h2').click(function () { if (!$(this).parents('.pod').hasClass('pod_opened')) { $('.pod_list .pod_opened').find('.pod_data').slideUp(); $('.pod_list .pod_opened').removeClass('pod_opened'); $(this).parents('.pod').addClass('pod_opened'); $('.pod_list .pod_opened').find('.pod_data').slideDown(); } }); // ******************* Pod Lists Scripts End Here ************************************ // ******************* Admin Tab Forms ************************************ $('#gsn_web_role_access input[name=fv_inactive_flag], #gsn_web_admin input[name=fv_inactive_flag]').each(function () { if ($(this).val() == '0') { $(this).css('background-color', 'lightgreen'); } else { $(this).css('background-color', 'pink'); } }); $('#gsn_web_role_access input[name=fv_inactive_flag], #gsn_web_admin input[name=fv_inactive_flag]').click(function () { if ($(this).val() == '0') { $(this).val('1').css('background-color', 'pink'); } else { $(this).val('0').css('background-color', 'lightgreen'); } $(this).blur(); }); $('#start_and_end_times .date_field_end').click(function () { $(this).children().each(function () { var startdate = eval($('#start_and_end_times .date_field_start').val().replace(':', '').replace('12', '').replace('am', '').replace('pm', '+1200')); if (eval($(this).val().replace(':', '').replace('12', '').replace('am', '').replace('pm', '+1200')) < startdate) { $(this).attr('disabled', 'disabled'); } else { $(this).removeAttr('disabled'); } }); timeSpan = eval($('#start_and_end_times .date_field_end').val().replace(':30', ':50').replace(':', '').replace('12', '').replace('am', '').replace('pm', '+1200')) - eval($('#start_and_end_times .date_field_start').val().replace(':30', ':50').replace(':', '').replace('12', '').replace('am', '').replace('pm', '+1200')); }); $('#start_and_end_times .date_field_start').click(function () { var newEndTime = eval(($(this).val().replace(':30', ':50').replace(':', '').replace('12', '').replace('am', '').replace('pm', '+1200'))); //alert(newEndTime); //alert(timeSpan); newEndTime = newEndTime + timeSpan; //alert(newEndTime); var newEndTimeHour = Math.floor(newEndTime / 100); //alert(newEndTimeHour); var newEndTimeMinute = (newEndTime - (newEndTimeHour * 100)) / 100 * 60; //alert(newEndTimeMinute); if (Number(newEndTimeHour) - 12 == 0) newEndTime = '12:' + newEndTimeMinute + 'pm'; else if (Number(newEndTimeHour) - 12 > 0) { if (Number(newEndTimeHour) - 24 >= 0) newEndTime = '11:30pm'; else newEndTime = (newEndTimeHour - 12) + ':' + newEndTimeMinute + 'pm'; } else newEndTime = (newEndTimeHour) + ':' + newEndTimeMinute + 'am'; $('#start_and_end_times .date_field_end').selectOptions(newEndTime.replace('0pm', '00pm').replace('0am', '00am').replace('300', '30')); //alert(newEndTime.replace('0pm','00pm').replace('0am','00am').replace('300','30')); }); $('#template_box .template_choice').click(function () { var answer = confirm('Overwrite email subject and body?'); if (answer) { $('#template_box div').removeClass('selected'); $('input[name=fv_subject]').val($('#subject' + $(this).attr('id').substr(1)).val()); setContent($('#body' + $(this).attr('id').substr(1)).val()); $(this).addClass('selected'); $('#template_box #template_id').val($(this).attr('id').substr(1)); } }); if ($('#template_box #template_id').length > 0 && $('#template_box #template_id').val() >= 0) { $('#template_box div').removeClass('selected'); $('#t' + $('#template_box #template_id').val()).addClass('selected'); } $('#fn_template_id').change(function () { var answer = confirm('Overwrite email subject and body?'); if (answer) { $('input[name=fn_autoresponder_id][value=-1]').prop('checked',true).click(); $('.compose_options').show(); $('.ars_preview, .ars_holder').hide(); /*$('#select_drip').hide();*/ $('input[name=fv_subject]').val($('#subject' + $(this).val()).val()); setContent($('#body' + $(this).val()).val()); } else { return false; } }); $('.ars_preview').live("click",function () { try { if ($('#ars' + $(this).attr('rel')).is(":visible")) $('#ars' + $(this).attr('rel')).hide(); else { if ($('#ars' + $(this).attr('rel') + ' iframe').attr('src').indexOf('popup_editor') < 0) $('#ars' + $(this).attr('rel') + ' iframe').attr('src', '/my/autoresponders/popup_editor?fn_autoresponder_series_id=' + $(this).attr('rel')); $('#ars' + $(this).attr('rel')).show(); } } catch(e){ var aa=1; } return false; }); $('#gsn_web_mail select[name=fn_prospect_id], #gsn_web_mail input[name=fv_subject]').keypress(verifyEmailForm).click(verifyEmailForm).change(verifyEmailForm); $('#gsn_web_mail input[name=fn_autoresponder_id]').click(function () { verifyEmailForm(); if ($(this).val() != '-1') { $('#fv_bookmark .ars_preview').attr("rel",$(this).val()); $('.ars_preview, .ars_holder').hide(); $('.ars_preview[rel=' + $(this).val() + ']').show(); $('#ars'+$(this).val()).before($('#fv_bookmark')); $("#select_drip div div").removeClass('selected'); $("#ars_container"+$(this).val()).addClass('selected'); $('.ars_preview span').hide(); if($('#ars'+$(this).val()).hasClass('js_ars_editable')) $("#preview_edit_series").show(); else $("#preview_open_series").show(); $('.compose_options').hide(); $('#select_drip').show(); $('#fv_bookmark').hide(); $('#fv_bookmark').hide(); $('#fv_bookmark input[name=fn_setup_events_flag][value=0]').click(); updateBookmarksOnSendMail(); } else { $('.compose_options').show(); $('#fv_bookmark').hide(); $('.ars_preview, .ars_holder').hide(); } }); $('#gsn_web_mail input[name=fn_autoresponder_id]:checked').click(); $('#gsn_web_mail form:not(#preview_form) a.submit').click(function (e) { verifyEmailForm(true); $('#data4').val(tinyMCE.get('data4').getContent()); $('.mceMenu').hide(); return false; }); $('#gsn_web_mail input[name=fn_autoresponder_id]:checked').each(function () { $(this).click(); }); // ******************* Cust Reg Scripts Start Here ************************ //Some features moved to low priority batch at bottom of page. $("#expand_all_matrix").click(function () { $(".matrix_feature p").slideDown("fast"); $(".matrix_feature a img").attr("src", "/images/ver2_images/bullet_toggle_minus.gif"); return false; }); $("#collapse_all_matrix").click(function () { $(".matrix_feature p").slideUp("fast"); $(".matrix_feature a img").attr("src", "/images/ver2_images/bullet_toggle_plus.gif"); return false; }); $("#gsn_web_registration #EMAIL").focus(); // check product radio buttons and if checked, show star packages if necessary and populate order summary with appropriate product $("#regprods input").each(function () { var prodID = this.value; var prodIDID = $(this).attr("id"); var parentdiv = $(this).parent().parent().parent().parent().parent().parent().parent().parent().attr("id"); if (this.checked == true) { prevInput = this; // if radio button is tied to either three star or 5 star packages then show div containing that package if (parentdiv != "gsn_web_account") { if (prodIDID == '3STAR' || prodID == '2') { $("#3star_package").show("normal"); } if (prodIDID == '5STAR' || prodID == '3') { $("#5star_package").show("normal"); } } // loop through products array and populate order summary with data from appropriate row for (i = 0; i < prods.length; i++) { if (prods[i][0] == prodID) { $("#prodpackage .price").html("$" + prods[i][2]); $("#prodpackage .desc").html(prods[i][3]); if (document.location.href != "http://us.repstars.com/my/registration/thanks") { $("#prodpackagedesc .desc").html(prods[i][4]); } } } } }); $(".add_package input").each(function () { var prodID = this.value; if (this.checked == true) { // loop through products array and populate order summary with data from appropriate row for (i = 0; i < prods.length; i++) { if (prods[i][0] == prodID) { //alert("array works --> " + prods[i]); $("#starpackage .price").html("$" + prods[i][2]); $("#starpackage .desc").html(prods[i][3]); $("#starpackagedesc .desc").html(prods[i][4]); } } $("#PROMO_CODE").val(""); $("#PROMO_FORM").hide(); } }); $("#fv_setup_coupon").each(function () { var couponcode = $(this).val(); if (couponcode != "") { for (i = 0; i < coups.length; i++) { if (coups[i][0] == couponcode) { if (couponcode.substr(0, 7) == 'CB30DAY') { $("#setupcoupon .desc").html("Full Discount for Entry Level Service"); } else { $("#setupcoupon .desc").html("Coupon Code: " + coups[i][0]); } if (coups[i][1] == "") { $("#setupcoupon .desc").append(" - " + coups[i][2] + "% OFF"); var prodPrice = $("#setupfee .price").text(); prodPrice = prodPrice.substring(1); var couponDiscount = prodPrice * (coups[i][2] * .01); $("#setupcoupon .price").html("-$" + couponDiscount.toFixed(2)); } else { var couponDiscount = coups[i][1] * 1; $("#setupcoupon .price").html("-$" + couponDiscount.toFixed(2)); } if (document.location.href != "http://us.repstars.com/my/registration/thanks") { var removeHTML = '
Remove Coupon'; $("#setupcoupon .desc").append(removeHTML); } $("#setupcoupon").show(); } } } }); $("#fv_prod_coupon").each(function () { var couponcode = $(this).val(); updateProdCoupon(couponcode); }); $("#regprods input").mousedown(function () { var prodCoupon = $("#fv_prod_coupon").val(); var changeCoup = true; for (i = 0; i < coups.length; i++) { //alert(prodCoupon); if (coups[i][0] == prodCoupon) { if (coups[i][3] == "") { changeCoup = false; } } } if ((prodCoupon != "") && (changeCoup)) { var changeProd = confirm("You have previously selected a package that has a coupon applied to it. Changing this package will remove the coupon as well. Do you want to continue changing your selection?"); } else { var changeProd = true; } if (changeProd) { prevInput = this; var prodID = this.value; var prodIDID = $(this).attr("id"); for (i = 0; i < prods.length; i++) { if (prods[i][0] == prodID) { //alert("array works --> " + prods[i]); $("#prodpackage .price").html("$" + prods[i][2]); $("#prodpackage .desc").html(prods[i][3]); if (document.location.href != "http://us.repstars.com/my/registration/thanks") { $("#prodpackagedesc .desc").html(prods[i][4]); } } } if (changeCoup) { $("#prodpackagecoupon .desc").html(""); $("#prodpackagecoupon .price").html(""); $("#prodpackagecoupon").hide(); $("#fv_prod_coupon").val(""); $("#starpackage .price").html(""); $("#starpackage .desc").html(""); $("#starpackagedesc .desc").html(""); $("#starpackage").hide(); $("#starpackagedesc").hide(); $("#PROMO_FORM").show(); } else { updateProdCoupon(prodCoupon); } $(".add_package input").prop("checked", false); $(".add_package").hide(); var parentdiv = $(this).parent().parent().parent().parent().parent().parent().parent().parent().attr("id"); if (parentdiv != "gsn_web_account") { if (prodIDID == '3STAR' || prodID == '2') { $("#3star_package").show("normal"); } if (prodIDID == '5STAR' || prodID == '3') { $("#5star_package").show("normal"); } } this.prop("checked", true); calculateOrderTotal(); } else { prevInput.prop("checked", true); return false; } }); $(".add_package input").click(function () { if (this.checked == true) { $("#setupcoupon .desc").html(""); $("#setupcoupon .price").html(""); $("#setupcoupon").hide(); $("#fv_setup_coupon").val(""); var prodID = this.value; for (i = 0; i < prods.length; i++) { if (prods[i][0] == prodID) { //alert("array works --> " + prods[i]); $("#starpackage .price").html("$" + prods[i][2]); $("#starpackage .desc").html(prods[i][3]); $("#starpackagedesc .desc").html(prods[i][4]); var couponcode = prods[i][1]; } } for (i = 0; i < coups.length; i++) { if (coups[i][0] == couponcode) { //alert("array works --> " + prods[i]); if (couponcode.substr(0, 7) == 'CB30DAY') { $("#prodpackagecoupon .desc").html("Full Discount for Entry Level Service"); } else { $("#prodpackagecoupon .desc").html("Coupon Code: " + coups[i][0]); } if (coups[i][1] == "") { $("#prodpackagecoupon .desc").append(" - " + coups[i][2] + "% OFF"); var prodPrice = $("#prodpackage .price").text(); prodPrice = prodPrice.substring(1); var moPos = prodPrice.indexOf("/"); prodPrice = prodPrice.substring(0, moPos); //alert(prodPrice); var couponDiscount = prodPrice * (coups[i][2] * .01); $("#prodpackagecoupon .price").html("-$" + couponDiscount.toFixed(2)); } else { var couponDiscount = coups[i][1] * 1; $("#prodpackagecoupon .price").html("-$" + couponDiscount.toFixed(2)); } if (document.location.href != "http://us.repstars.com/my/registration/thanks") { var removeHTML = '
Remove Coupon'; $("#prodpackagecoupon .desc").append(removeHTML); } $("#prodpackagecoupon").show(); $("#fv_prod_coupon").val(coups[i][0]); } } $("#PROMO_CODE").val(""); $("#PROMO_FORM").hide(); $("#starpackage").show(); $("#starpackagedesc").show(); } else { $("#starpackage .price").html(""); $("#starpackage .desc").html(""); $("#starpackagedesc .desc").html(""); $("#starpackage").hide(); $("#starpackagedesc").hide(); $("#fv_prod_coupon").val(""); $("#prodpackagecoupon .desc").html(""); $("#prodpackagecoupon .price").html(""); $("#prodpackagecoupon").hide(); $("#PROMO_FORM").show(); } calculateOrderTotal(); }); // ******************* Cust Reg Scripts End Here ************************ // ******************* Help Scripts Start Here ************************ $("#help a").click(function () { if ($(this).hasClass("video")) { var video_id = '#' + $(this).attr("rel"); try { if ($(video_id)) $(video_id).get(0).sendEvent('playpause'); } catch (e) { var a = 1; } return false; } helpID = "#text_" + this.id; // If this is not the one which we are currently on then toggle all visible help text // We also need to go one level higher and toggle help expanded if ($('#help p:visible').length != 0 && $('#help p:visible').attr("id") != $(helpID).attr("id")) // RONAN - modified to make the expanded class disappear $('#help p:visible') .each(function() { $("#" + $(this).attr("id").substr(5)).toggleClass("helpexpanded"); }) .slideUp("fast", function () { $(helpID).slideToggle("fast"); }); // RONAN - end of modifications else $(helpID).slideToggle("fast"); if (!$(this).hasClass("thickbox") && $(this).attr("href").substr(0, 4) != "http") { $(this).toggleClass("helpexpanded"); return false; } }); //Some functions moved to low priority batch at bottom of this page. // ******************* Help Scripts End Here ************************ // *********************Build Prospect List Scripts Start Here ****************** $("#add_manual_btn").click(function () { $("#buildprospect div#uploadcsv").hide(); $("#buildprospect div#addprospect").slideToggle("fast"); return false; }); $("#upload_csv_btn").click(function () { $("#buildprospect div#addprospect").hide(); $("#buildprospect div#uploadcsv").slideToggle("fast"); return false; }); // *********************Build Prospect List Scripts End Here ****************** // *********************SPOT Configure Scripts Start Here ****************** $("#xsmallopt").attr("disabled", "disabled"); //$("#video_spot_options").hide(); $("#spot_form #type").change(function () { if (this.value == "1") { $("#video_spot_options").show(); } else { $("#video_spot_options").hide(); } try { if ((this.value == "1") && ($("#spot_form #size").val() == "3")) { $("#custom_text_options").hide(); } else { $("#custom_text_options").show(); } } catch (e) { $("#custom_text_options").hide(); } if (this.value == "1") { $("#xsmallopt").removeAttr("disabled"); } else if (this.value == "2") { try { if ($("#spot_form #size").val() == "3") { $("#spot_form #size").selectOptions("1", true).change(); } } catch (e) { var zsszz = zsszz; } $("#xsmallopt").attr("disabled", "disabled"); } else { $("#xsmallopt").attr("disabled", "disabled"); } spottype = this.value; getpreviewSWF(); }); $("#spot_form #type").change(); $("#spot_form #size").change(function () { if (this.value == "2") { $("#small_spot_options").show(); } else { $("#small_spot_options").hide(); } try { if (((this.value == "1") || (this.value == "3")) && ($("#spot_form #type").val() == "1")) { $("#custom_text_options").hide(); } else { $("#custom_text_options").show(); } } catch (e) { $("#custom_text_options").show(); } /*if(this.value == "3") { $("#spot_form #theme option").attr("disabled","disabled"); $('#whitegreentheme').removeAttr("disabled"); $("#spot_form #theme").selectOptions("2",true).change(); } else { $("#spot_form #theme option").removeAttr("disabled"); }*/ spotsize = this.value; getpreviewSWF(); }); $("#spot_form #size").change(); $("#spot_form #theme").change(function () { spottheme = this.value; getpreviewSWF(); }); $("#spot_form #theme").change(); $("#spot_form input[name='fv_message'], #spot_form input[name='fv_button_text'], #spot_form input[name='fn_contact_info'], #spot_form input[name='fn_share_media_id']").change(function () { getpreviewSWF(); }); /*$(".spot_share").each(function() { var tempURL = $(this).attr("rel"); var tempfileloc = tempURL.indexOf("?s="); var tempfile = tempURL.substring(0,tempfileloc); var tempspotid = tempURL.substring(tempfileloc+3); $("#spotShareDetails #link_spot").text("http://us.repstars.com/s/" + tempspotid).attr("href", "http://us.repstars.com/s/" + tempspotid); $("#spotShareDetails #link_spot_text").val("http://us.repstars.com/s/" + tempspotid); $("#spotShareDetails input[name='spot_btn']").unbind("click"); $("#spotShareDetails input[name='spot_btn']").change(function() { var linkHTML = ''; linkHTML += ''; $("#spotShareDetails #btn_spot").val(linkHTML); }); });*/ //some spot startups moved to low priority batch at bottom // *********************SPOT Configure Scripts End Here ****************** } function getpreviewSWF() { if ((spottype != "") && (spotsize != "") && (spottheme != "")) { //alert("spottype = "+spottype+"; spotsize = "+spotsize); $.post("/my/spots/spot_swf", { fn_height: spotsize, fn_type: spottype, fn_theme: spottheme }, function (xml) { tempspotid = $("spotfile", xml).attr("id"); spotfile = $("spotfile > file", xml).text(); spotInfo = xml; $("input[name='fn_spot_file_id']").val(tempspotid); buildPreviewSWF(); }); } } function buildPreviewSWF() { //alert(spotfile); switch (spotfile) { case "/archive/spot/spot_video.swf": swfwidth = '332'; swfheight = '490'; break; case "/archive/spot/spot_video_sm.swf": swfwidth = '252'; swfheight = '373'; break; case "/archive/spot/spot_video_fb.swf": swfwidth = '160'; swfheight = '205'; break; case "/archive/spot/spot_video_fb_2.swf": swfwidth = '184'; swfheight = '250'; break; case "/archive/spot/spot_prospect.swf": swfwidth = '332'; swfheight = '290'; break; case "/archive/spot/spot_prospect_sm.swf": swfwidth = '252'; swfheight = '253'; break; case "/archive/spot/spot_call.swf": swfwidth = '332'; swfheight = '190'; break; case "/archive/spot/spot_call_sm.swf": swfwidth = '252'; swfheight = '178'; break; default: alert("There is no file that matches this configuration"); } var so = new SWFObject(spotfile+'?fn_theme='+spottheme, 'jstest', swfwidth, swfheight, '9'); so.addParam('allowscriptaccess', 'always'); so.addParam('allowfullscreen', 'true'); so.addParam('wmode', 'transparent'); so.addParam('menu', 'true'); so.addVariable('p', 'true'); so.addVariable('javascriptid', 'jstest'); so.addVariable('enablejs', 'true'); so.addVariable('tn', previewName); so.addVariable('tp', previewPhone); so.addVariable('te', previewEmail); var tempvidid = $("input[name='fn_share_media_id']").val(); var tempmessage = $("input[name='fv_message']").val(); var tempbutton = $("input[name='fv_button_text']").val(); var tempcontact; $("input[name='fn_contact_info']").each(function () { if (this.checked == true) { tempcontact = this.value } }); var tempict = $("input[id='fn_ict_enable']").val(); var tempurl = $("input[id='fv_forward_url']").val(); var tempvid = ""; var tempthumb = ""; if (tempvidid != "") { var tempvid = $("input#video_url").val(); var tempthumb = $("input#video_thumb").val(); //alert(tempvid+"-->"+tempthumb); } so.addVariable('file', tempvid); so.addVariable('image', tempthumb); if (tempmessage != "") { so.addVariable('tm', tempmessage); } if (tempbutton != "") { so.addVariable('tb', tempbutton); } //alert(tempcontact); if (tempcontact != "") { so.addVariable('tc', tempcontact); } //if (tempict != "") { so.addVariable('ti',tempict); } //if (tempurl != "") { so.addVariable('tu',tempurl); } so.write('spot_preview'); if ($("spotfile > theme > backgroundid", spotInfo).text() == 4) { $("#spot_preview").css("background", "none"); $("#spot_preview").css("background", "#333333"); } else $("#spot_preview").css("background", "none"); } var fv_bookmark_for_email_edit; function updateBookmarksOnSendMail(keep_old) { var curr_autoresponder = $('#gsn_web_mail input[name=fn_autoresponder_id]:checked').val(); try { if(keep_old === 1) { fv_bookmark_for_email_edit = $('#fv_bookmark select').val(); } } catch(e) { var aaa=1; } $.getJSON('/my/autoresponders/bookmarks?fn_autoresponder_id='+curr_autoresponder,function (data) { $('#fv_bookmark select option').remove(); $('#fv_bookmark select').addOption(data, false); if($('#fv_bookmark select option').length == 1 || $('#fv_bookmark select option').length == 0) { $('#fv_bookmark select').hide(); $('#fv_bookmark_startonly').show(); } else { $('#fv_bookmark select').show(); $('#fv_bookmark_startonly').hide(); } try { if(autoresponder_series_data!=undefined) { var curr_autoresponder = $('#gsn_web_mail input[name=fn_autoresponder_id]:checked').val(); if(curr_autoresponder in autoresponder_series_data) { //alert('effecting the autoresponder_series_data'); $('#fv_bookmark select').selectOptions(autoresponder_series_data[curr_autoresponder]['bookmark']); $('#fv_bookmark input[name=fn_setup_events_flag][value='+autoresponder_series_data[curr_autoresponder]['events']+']').click(); } else { // alert('not effecting the autoresponder series data'); devnull(curr_autoresponder+" not in "); devnull(autoresponder_series_data); autoresponder_series_data = undefined; } } else devnull('series data undefined'); } catch(e) { devnull('series data read crash: '+e); var aaa = 1; } if(fv_bookmark_for_email_edit != undefined) { $('#fv_bookmark select').selectOptions(fv_bookmark_for_email_edit); fv_bookmark_for_email_edit = undefined; } $('#fv_bookmark').show(); }); } function calculateOrderTotal() { var subtotal = 0; var discount = 0; var total = 0; $("#ordersum .prodline .price").each(function () { var priceString = $(this).html(); //alert(priceString); var numPos = priceString.indexOf("$"); var moPos = priceString.indexOf("/"); if (moPos != -1) { var priceNum = priceString.substring(numPos + 1, moPos) * 1; } else { var priceNum = priceString.substring(numPos + 1) * 1; } //alert(priceNum); subtotal += priceNum; //alert(subtotal); }); $("#ordersum .prodcoupon .price").each(function () { var priceString = $(this).html(); //alert(priceString); var numPos = priceString.indexOf("$"); var moPos = priceString.indexOf("/"); //var priceNum = priceString.substring(numPos+1) * 1; if (moPos != -1) { var priceNum = priceString.substring(numPos + 1, moPos) * 1; } else { var priceNum = priceString.substring(numPos + 1) * 1; } //alert(priceNum); discount += priceNum; //alert(discount); }); total = subtotal - discount; $("#prodsubtotal .price").html("$" + subtotal.toFixed(2)); $("#proddiscount .price").html("-$" + discount.toFixed(2)); $("#prodtotal .price").html("$" + total.toFixed(2)); //alert(total); } function removeSetupCoup() { var removeMyCoup = confirm("Are you sure you want to remove this coupon?"); if (removeMyCoup) { $("#setupcoupon .desc").html(""); $("#setupcoupon .price").html(""); $("#setupcoupon").hide(); $("#fv_setup_coupon").val(""); } calculateOrderTotal(); return false; } function removeProdCoup() { var removeMyCoup = confirm("Are you sure you want to remove this coupon?"); if (removeMyCoup) { $("#prodpackagecoupon .desc").html(""); $("#prodpackagecoupon .price").html(""); $("#prodpackagecoupon").hide(); $("#fv_prod_coupon").val(""); } calculateOrderTotal(); return false; } function updateProdCoupon(couponcode) { if (couponcode != "") { for (i = 0; i < coups.length; i++) { if (coups[i][0] == couponcode) { //alert("array works --> " + prods[i]); if (couponcode.substr(0, 7) == 'CB30DAY') { $("#prodpackagecoupon .desc").html("Full Discount for Entry Level Service"); } else { $("#prodpackagecoupon .desc").html("Coupon Code: " + coups[i][0]); } if (coups[i][1] == "") { $("#prodpackagecoupon .desc").append(" - " + coups[i][2] + "% OFF"); var prodPrice = $("#prodpackage .price").text(); prodPrice = prodPrice.substring(1); var moPos = prodPrice.indexOf("/"); prodPrice = prodPrice.substring(0, moPos); //alert(prodPrice); var couponDiscount = prodPrice * (coups[i][2] * .01); $("#prodpackagecoupon .price").html("-$" + couponDiscount.toFixed(2)); } else { var couponDiscount = coups[i][1] * 1; $("#prodpackagecoupon .price").html("-$" + couponDiscount.toFixed(2)); } if (document.location.href != "http://us.repstars.com/my/registration/thanks") { var removeHTML = '
Remove Coupon'; $("#prodpackagecoupon .desc").append(removeHTML); } $("#prodpackagecoupon").show(); } } } calculateOrderTotal(); } function validateSubscribe(colID) { var selection1 = "#" + colID + " input.check1"; var selection2 = "#" + colID + " input.check2"; var selection3 = "#" + colID + " input.check3"; var check1; var check2; var check3; $(selection1).each(function () { check1 = this.checked }); $(selection2).each(function () { check2 = this.checked }); $(selection3).each(function () { check3 = this.checked }); if ((check1 == false) || (check2 == false) || (check3 == false)) { alert("In order to complete the application process, you must indicate that you have read, understand and agree to abide by the documents indicated by checking the boxes provided."); return false; } else { return true; } } function validateSubscribe2() { var selection = "#" + colID + " :checkbox"; var allBoxes = false; //var numBoxes = $(selection).length; //var numBoxes = 3; var boxCount = 0; return false; /*$(selection).each(function() { boxCount++; alert("checkbox=" + this.checked); if ((this.checked != true) && (allBoxes == true)) { allBoxes = false; return allBoxes; } if (boxCount == numBoxes) { return allBoxes; } });*/ } function adjustPosition(obj, objtop, objleft) { var newtop = obj.style.top; var newleft = obj.style.left; var pxpos = newtop.indexOf('px'); newtop = parseInt(newtop.substring(0, pxpos)); pxpos = newleft.indexOf('px'); newleft = parseInt(newleft.substring(0, pxpos)); var windowwidth = $(window).width(); var toolwidth = $(".tooltip").width(); var windowoffset = (newleft > (windowwidth - toolwidth)) ? toolwidth + objleft : 0; //alert(windowoffset + " --> " + windowwidth + " --> " + toolwidth + " --> " + newleft); newtop += objtop; newtop += "px"; newleft += (objleft - windowoffset); newleft += "px"; obj.style.top = newtop; obj.style.left = newleft; } function popupWindow(winurl, winname, winfeatures) { //This launches a new window and then //focuses it if window.focus() is supported. newwin = window.open(winurl, winname, winfeatures); setTimeout(function () { newwin.focus(); }, 250); } function popupReportWindow(form, winfeatures) { //This launches a new window to show an IPS Manager report. newwin = window.open('', 'IPSReportWindow', winfeatures); form.target = 'IPSReportWindow'; } function setNavActive(iframepath) { //var iframepath = iframeWin.location.pathname; var temp; var charPos = iframepath.lastIndexOf("/"); iframepath = iframepath.substr(charPos + 1); charPos = iframepath.indexOf("."); temp = iframepath.substring(0, charPos).toLowerCase(); if (temp != "gsn_web_home") { iframepath = iframepath.substring(0, charPos).toLowerCase(); } $("#ic_catlnk a").each(function () { $(this).removeClass("catlinkactive"); var linkpath = this.href; charPos = linkpath.lastIndexOf("/"); linkpath = linkpath.substr(charPos + 1); charPos = linkpath.indexOf("."); if (temp != "gsn_web_home") { linkpath = linkpath.substring(0, charPos).toLowerCase(); } if (iframepath == linkpath) { temp = linkpath; $(this).addClass("catlinkactive"); } /*else if ((iframepath == "gsn_web_profile.startup") && (linkpath == "gsn_web_profile.startupnav")) { $(this).addClass("catlinkactive"); } else if ((iframepath == "gsn_web_affiliation_payments.startup") && (linkpath == "gsn_web_affiliation_payments.startupnav")) { $(this).addClass("catlinkactive"); }*/ }); } function disableOtherSubmitButtons(submitButton) { if (!submitButton) { //alert("no object found"); return; } if (!submitButton.type) { //alert("no type attribute"); return; } if (submitButton.type != "submit") { //alert("no submit button"); return; } if (!submitButton.form) { //alert("parentless button (no form)"); return; } var formElements = submitButton.form.elements; for (var i = 0; i < formElements.length; i++) { //leave the pressed button as is... if (formElements[i] == submitButton) continue; //disable all other submit buttons if (formElements[i].type == "submit") { formElements[i].disabled = "true"; } } } function validateInfo(form) { return ( checkString(document.forms[0].fv_realname, "Your Name") && checkEmail(document.forms[0].fv_email)) } function checkEmailVal(email) { var reg = /^([A-Za-z0-9\+_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; var address = email; if (reg.test(address) == false) return false; else return true; } browserName = navigator.appName; browserVer = parseInt(navigator.appVersion); ns3up = (browserName == "Netscape" && browserVer >= 3); ie4up = (browserName.indexOf("Microsoft") >= 0 && browserVer >= 4); function doPic(imgName) { if (ns3up || ie4up) { imgOn = ("" + imgName); document.mainpic.src = imgOn; } } function get_timestamp() { var tt = new Date(); var day = tt.getDate(); if (day < 10) day = "0" + day; var monthNames = "JanFebMarAprMayJunJulAugSepOctNovDec"; var month = monthNames.substring(3 * tt.getMonth(), 3 * (tt.getMonth() + 1)); var hour = tt.getHours(); if (hour > 12) { hour = hour - 12; var pm = "PM"; } else var pm = "AM"; if (hour < 10) hour = "0" + hour; var minute = tt.getMinutes(); if (minute < 10) minute = "0" + minute; var second = tt.getSeconds(); if (second < 10) second = "0" + second; var timezone = (-1 * tt.getTimezoneOffset() / 60); if (Math.floor(timezone) == timezone) timezone = timezone + "."; var tz = day + "-" + month + "-" + tt.getYear() + " " + hour + ":" + minute + ":" + second + " " + pm + " " + timezone; return tz; } function get_timezone() { var tt = new Date(); var timezone = (-1 * tt.getTimezoneOffset() / 60); if (Math.floor(timezone) == timezone) timezone = timezone + ":00"; return timezone; } function trim(str, chars) { return ltrim(rtrim(str, chars), chars); } function ltrim(str, chars) { chars = chars || "\\s"; return str.replace(new RegExp("^[" + chars + "]+", "g"), ""); } function rtrim(str, chars) { chars = chars || "\\s"; return str.replace(new RegExp("[" + chars + "]+$", "g"), ""); } function addContactTypeSubmit() { //alert('adding group'); $.get('/my/prospecting/add_type?fv_title=' + escape($('#contact_type_title').val()), function (data) { window.location = '/my/prospecting/manage_groups'; }); $('#addContactType').hide(); return false; } function getFormattedPhoneNumber(zandais,fancy) { var a = zandais.replace(/[^0-9]/g, ''); var lp = ''; var rp = ''; var md = ' '; if(fancy==undefined) fancy = 0; else { lp = '('; rp = ')'; md = '-'; } if (a.length == 7) { //ZONE 1 - NANP return a.substr(0, 3) + md + a.substr(3); } else if (a.length == 10 && zandais.substr(0,1) != '+') { //NANP Guess return lp+a.substr(0, 3)+rp + ' ' + a.substr(3, 3) + md + a.substr(6); } else if (a.substr(0, 1) == '1' && a.length >= 11) { //Zone 1 – NANP return a.substr(0, 1) + ' ' +lp + a.substr(1, 3)+rp + ' ' + a.substr(4, 3) + md + a.substr(7); } else if (a.substr(0, 1) == '2' && a.length >= 10) { //Zone 2 – Mostly Africa, some Atlantic and Indian Ocean islands if (a.substr(0, 2) != 27 && a.substr(0, 2) != 20) { b = '+' + a.substr(0, 3) + ' '; b += a.substr(3); } else { b = '+' + a.substr(0, 2) + ' '; b += a.substr(2); } return b; } else if ((a.substr(0, 1) == '3' || a.substr(0, 1) == '4') && a.length >= 10 && a.substr(0, 2) != '44') { //Zone 3/4 - Europe var twodigits = [30, 31, 32, 33, 34, 36, 39, 40, 41, 43, 44, 45, 46, 47, 48, 49]; twodigits = twodigits.toString(); if (twodigits.search(a.substr(0, 2)) == -1) { b = '+' + a.substr(0, 3) + ' '; b += a.substr(3); } else { b = '+' + a.substr(0, 2) + ' '; b += a.substr(2); } return b; } else if ((a.substr(0, 1) == '5') && a.length >= 10) { //Zone 5 - Mexico, Central America and South America var twodigits = [51, 52, 53, 54, 55, 56, 57, 58]; twodigits = twodigits.toString(); if (twodigits.search(a.substr(0, 2)) == -1) { b = '+' + a.substr(0, 3) + ' '; b += a.substr(3); } else { b = '+' + a.substr(0, 2) + ' '; b += a.substr(2); } return b; } else if ((a.substr(0, 1) == '6') && a.length >= 10) { //Zone 6 – Southeast Asia and Oceania var twodigits = [61, 62, 63, 64, 65, 66]; twodigits = twodigits.toString(); if (twodigits.search(a.substr(0, 2)) == -1) { b = '+' + a.substr(0, 3) + ' '; b += a.substr(3); } else { b = '+' + a.substr(0, 2) + ' '; b += a.substr(2); } return b; } else if ((a.substr(0, 1) == '7') && a.length >= 10) { //Zone 7 – Seventh World Numbering Zone (former Soviet Union) b = '+7 '; b += a.substr(1, 3) + ' '; b += a.substr(4); return b; } else if ((a.substr(0, 1) == '8') && a.length >= 10) { //Zone 8 - East Asia and Special Services var twodigits = [81, 82, 84, 86]; twodigits = twodigits.toString(); if (twodigits.search(a.substr(0, 2)) == -1) { b = '+' + a.substr(0, 3) + ' '; b += a.substr(3); } else { b = '+' + a.substr(0, 2) + ' '; b += a.substr(2); } return b; } else if ((a.substr(0, 1) == '9') && a.length >= 10) { //Zone 9 - West, South and Central Asia var twodigits = [90, 91, 92, 93, 94, 95, 98]; twodigits = twodigits.toString(); if (twodigits.search(a.substr(0, 2)) == -1) { b = '+' + a.substr(0, 3) + ' '; b += a.substr(3); } else { b = '+' + a.substr(0, 2) + ' '; b += a.substr(2); } return b; } else if (a.substr(0, 2) == '44' && a.length >= 10) { //UK b = '+44 '; /*if(a.substr(2,1)== '1'&&a.substr(4,1)=='1') { b += ' '+a.substr(2,3) +' '+a.substr(5); } else */ if (a.substr(2, 1) == '1') { b += a.substr(2, 3) + ' ' + a.substr(5, 3) + ' ' + a.substr(8); } else if (a.substr(2, 1) == '2') { b += a.substr(2, 2) + ' ' + a.substr(4, 4) + ' ' + a.substr(8); } else { b += a.substr(2, 3) + ' ' + a.substr(5, 3) + ' ' + a.substr(8); } return b; } else return a; } /* The following is related to the "Translate this Page" Features */ var translator_data; var trans_id; var translations_on = 0; var translate_hide; var translate_show; var iamtranslator = iamtranslator; try { if(iamtranslator) { iamtranslator = iamtranslator; } } catch(e) { var iamtranslator = false; } function loadTranslator() { var ifrm = document.getElementById('TB_iframeContent'); ifrm = (ifrm.contentWindow) ? ifrm.contentWindow : (ifrm.contentDocument.document) ? ifrm.contentDocument.document : ifrm.contentDocument; ifrm.document.open(); ifrm.document.write(translator_data); ifrm.document.close(); } $(function () { $('#gsn_web_signature_ .no_select').bind('selectstart',function () { return false; }); $('#gsn_web_signature_ .no_select').bind('mousedown',function () { return false; }); devnull("Translate BootUp"); transcount = $(".trnsrec, .trnsimg").length; untranslatedcount = $(".tfrEN").length; if ($("#enable_translate").length == 0 && iamtranslator) { $("body").append(''); $("#enable_translate_alt").click(function () { enableTranslation() }); $("#translator_box").click(function () { clearTimeout(translate_hide); $("#translator_box").stop(true); if ($("#translator_box").css('left') == '10px') { $("#translator_box").animate({ bottom: "-160px", opacity: .45, left: "-136px" }, 0); } else { $("#translator_box").animate({ bottom: "10px", opacity: 1, left: "10px" }, 500); } }).hover(function () { $(this).attr('title', 'Click again to close'); }, function () { $(this).attr('title', 'Click to Open the Translation Widget'); // clearTimeout(translate_hide); //-115px, -52px // translate_hide = setTimeout('$("#translator_box").stop(true);$("#translator_box").animate({ bottom: "-160px", opacity: .45, left: "-136px", }, 0 );',500); }); } if (transcount > 0) $("#enable_translate").append(' (' + transcount + ') ').after('
This Page Is ' + Math.round(((transcount - untranslatedcount) / transcount) * 100) + '% Translated
'/*'*/).click(function () { enableTranslation() }); else $("#enable_translate").html('Sorry, There Are No Translations Available For This Page.').click(function () { enableTranslation() }); }); function enableTranslate() { enableTranslation(); } function enableTranslation() { if (translations_on == 0) { $("#enable_translate").children('a').html('Disable All Translations For This Page') translations_on = 1; setTimeout('$(".trnsrec").addClass("translation_hover");', 350); setTimeout('$(".trnsrec").removeClass("translation_hover");', 550); setTimeout('$(".trnsrec").addClass("translation_hover");', 650); setTimeout('$(".trnsrec").removeClass("translation_hover");', 850); setTimeout('$(".tfrEN").addClass("translation_hover");', 1050); setTimeout('$(".tfrEN").removeClass("translation_hover");', 1250); $("body").on("mouseenter",".trnsrec",function () { trans_id = $(this).attr("rel"); $(this).addClass("translation_hover"); $('cite[rel=' + trans_id + ']').addClass("translation_hover"); }).on("mouseleave",".trnsrec",function () { $(this).removeClass("translation_hover"); $('cite[rel=' + trans_id + ']').removeClass("translation_hover"); trans_id = ""; }).on("mousedown",".trnsrec",function (e) { if(e.which==3) { setTimeout(function () { tb_show("Translations","/my/more_points/translation_widget?fn_translation_id="+ trans_id +"&TB_iframe=true&height=460&width=500",null); }, 100); e.preventDefault(true); return false; } }).on("contextmenu",".trnsrec",function (e) { e.preventDefault(true); }); } else { $("#enable_translate").children('a').html('Enable All Translations For This Page'); translations_on = 0; $("body").off('mouseenter mouseleave mousedown','.trnsrec'); } } // jQuery Right-Click Plugin // Version 1.01 // // Capture right click // $("#selector").rightClick( function(e) { // // Do something // }); // // Capture right mouse down // $("#selector").rightMouseDown( function(e) { // // Do something // }); // // Capture right mouseup // $("#selector").rightMouseUp( function(e) { // // Do something // }); // // Disable context menu on an element // $("#selector").noContext(); // This plugin is dual-licensed under the GNU General Public License and the MIT License // and is copyright 2008 A Beautiful Site, LLC. if (jQuery)(function () { $.extend($.fn, { rightClick: function (handler) { $(this).bind("contextmenu", function () { return false; }); $(this).mousedown(function (e) { var evt = e; $(this).mouseup(function () { $(this).unbind('mouseup'); if (evt.button == 2) { handler.call($(this), evt); return false; } else { return true; } }); }); return $(this); }, rightMouseDown: function (handler) { $(this).each(function () { $(this).mousedown(function (e) { if (e.button == 2) { handler.call($(this), e); return false; } else { return true; } }); $(this)[0].oncontextmenu = function () { return false; } }); return $(this); }, rightMouseUp: function (handler) { $(this).each(function () { $(this).mouseup(function (e) { if (e.button == 2) { handler.call($(this), e); return false; } else { return true; } }); $(this)[0].oncontextmenu = function () { return false; } }); return $(this); }, noContext: function () { $(this).each(function () { $(this)[0].oncontextmenu = function () { return false; } }); return $(this); } }); })(jQuery); var spot_shared_flag = false; function init_share_spots(aaa) { //Advanced SPOT Share Tracking /*$('#spotShareDetails '+aaa + "#link_spot_text1").bind("cut copy", function () { setTimeout(function () { shareTrackPrompt(share_link_copy,"link",""); },12); });*/ //Advanced SPOT Share Tracking $('#spotShareDetails '+aaa+ ".spot_share_link").bind("click", function () { shareTrackPrompt(share_add_notes.replace("{title}",$(this).attr("rel")),"social",$(this).attr("rel")); }); //Website Share Tracking /*$('#siteShareDetails '+aaa + "#link_spot_text1").bind("cut copy", function () { shareTrackPrompt(share_link_copy,"link",""); });*/ /*$('#siteShareDetails '+aaa+ ".spot_share_link").bind("click", function () { shareTrackPrompt("","social",$(this).attr("rel")); });*/ } /*function displayEventMessage(eventObj) { // handle the event if (eventObj.type == 'copy') { shareTrackPrompt(share_embed_copy,"embed",""); } else if (eventObj.type == 'networkButtonClicked') { spot_shared_flag = true; shareTrackPrompt("","quickembed",eventObj.network); } else { if (eventObj.page == "NetworkSelection" && spot_shared_flag) { window.location.reload(); } } }*/ var share_track_tgt, share_track_location; function shareTrackPrompt(msg,tgt,location) { $("#link_section").html("

Generating New Tracking Code...please wait or click here


"); share_track_tgt = tgt; share_track_location = location; if(msg!==undefined&&msg.length>0) nuPrompt(msg,shareTrackResponse); else shareTrackResponse(""); } function shareTrackResponse(response) { if (response === null || response === undefined) trackShare( share_track_tgt, share_track_location, "", gn_share_sid); else trackShare( share_track_tgt, share_track_location, response, gn_share_sid); setTimeout(function () { window.location.reload(); },1000); } function trackShare(typez, loc, details, share_id) { $.get($('#spotShareDetails').length>0?"/my/spots/track_share":"/my/marketing/track_share", { fn_share_id: share_id, fn_spot_id: sharing_spot_id, fn_website_id: sharing_site_id, fv_type: typez, fv_location: loc, fv_notes: details }); } /*Begin NU PROMPT*/ var nuprompt_callback; $(function () { setTimeout(function () { $("#nuprompt_input").keypress(nuPromptKeyHandler); $("#nuprompt_submit").click(function () { $(document).unbind("keypress",nuPromptKeyHandler); nuprompt_callback($("#nuprompt_input").val()); $.fancybox.close(); }); $("#nuprompt_cancel").click(function () { $(document).unbind("keypress",nuPromptKeyHandler); nuprompt_callback(""); $.fancybox.close(); }); },250); }); function nuPromptKeyHandler(event) { if(event.keyCode=='13') $("#nuprompt_submit").click(); if(event.keyCode=='27') $("#nuprompt_cancel").click(); } function nuPrompt(msg,cb) { nuprompt_callback = cb; //This comment will use the javascript prompt instead of the popup. //nuprompt_callback(prompt(msg)); //return; $("#nuprompt_query").val(""); $("#nuprompt_input").val(""); $("#nuprompt_query").html(msg.replace(/\r?\n|\r/g, "
")); $.fancybox({ 'hideOnContentClick': false, 'modal' : true, 'title' : "", 'type' : 'inline', 'href' : '#nuprompt_modal', 'transitionIn' : 'linear', 'transitionOut' : 'linear', 'width':500, 'height':'auto', 'autoscale':false, 'centerOnScroll':false, 'autoDimensions':false, 'overlayOpacity':1, 'overlayColor':'#FFF' }); $(document).bind("keypress",nuPromptKeyHandler); $("#nuprompt_input").focus(); $("#nuprompt_modal").show(); } /*END NU PROMPT*/ function getASDFOptions(ridnid, lbls, row_name, hide_email) { //This is called from flexigrid.js where asdfoptions is found in a column. //lbls comes from the XML feed, gsn_web_prospecting.xml_prospect_data, queried by flexigrid.js //row_name is configured in flexigrid to be column[1] + column[2] in flexigrid.js /**/ var email_button = ''; if(hide_email==1) { email_button = ''; } var prospecting_page = '/my/prospecting/'; if(window.location.href.indexOf('prospecting2/')!==-1) prospecting_page = '/my/prospecting2/'; return ' '+email_button+' '; devnull("ASDFOptions"); } function getFlexiGroupOptions(ridnid) { return (' '); } function getFlexiASDFImage(ridnid, lbls, row_name, data) { //This is called from flexigrid.js where asdfoptions is found in a column. //lbls comes from the XML feed, gsn_web_prospecting.xml_prospect_data, which is loaded from flexigrid.js //row_name is configured in flexigrid to be column[1] + column[2] in flexigrid.js var cols = data.split(','); return ''; } function prettyTelephoneNumbers() { $('input[name=fv_phone], input.phone').each(formatPhoneNumberField).blur(formatPhoneNumberField).keyup(checkPhoneNumberWarnings); } function checkPhoneNumberWarnings() { if($(this).attr('name') == 'fv_phone') { var phone_number = getFormattedPhoneNumber($(this).val(),1); showPhoneNumberWarnings(phone_number); } } function showPhoneNumberWarnings(phone_number) { var phone_length = phone_number.replace(/[^0-9]/g, '').length; if (phone_number.substr(0, 1) != '+' && phone_length < 11 && phone_length > 8) { $('#us_warn_number').show(); $('#intl_exit_warn').hide(); } else if (phone_number.substr(0, 1) == '0') { $('#intl_exit_warn').show(); $('#us_warn_number').hide(); } else $('#us_warn_number, #intl_exit_warn').hide(); } function formatPhoneNumberField() { var phone_number = getFormattedPhoneNumber($(this).val(),1); $(this).val(phone_number); var phone_length = phone_number.replace(/[^0-9]/g, '').length; if($(this).attr('name') == 'fv_phone') { showPhoneNumberWarnings(phone_number); } //Profile warning about non international format US numbers. } function alternateRowColor() { devnull("alternateRowColor()"); //Table Magic //Row colors, left/right col alignment, summarization //Apply the HTML5 Zebra Striping //No longer neccesary to do this, but we'll keep it incase we need to rollback the css. Erase anytime in 2012. $('table:not(.nozebra)').addClass('zebra'); //Test if nth-child works or not regardless of the background-color chosen by the theme. $('
test
').appendTo('body'); $('
test
').appendTo('body'); var oddtrcolor = $("#oddtrcolorfindertable").find('td').css("background-color"); var nthtrcolor = $("#nthtrcolorfindertable").find('tr').css("background-color"); $('#oddtrcolorfindertable,#nthtrcolorfindertable').remove(); if(oddtrcolor!=nthtrcolor) { if(iamtranslator) devnull("

Doing jQuery zebra striping

"); //Do jquery oddtr class application to zebra tables. $('table:not(.nozebra)').each(function () { $(this).find('tbody tr:odd').addClass('oddtr'); }); $('table:not(.nozebra) tr:has(th)').removeClass('oddtr'); } //$('table:not(.noalign) td:first-child, table:not(.noalign) th:first-child').addClass("first"); //$('table:not(.noalign) td:last-child, table:not(.noalign) th:last-child').addClass("last"); /* $('table tr (td,th):first-child,table tr th:first-child').addClass("first"); $('table tr td:last-child,table tr th:last-child').addClass("last");*/ $('table tbody.summarized tr:not(.summarized)').hide(); $('table tbody.summarized').show(); $('table tbody.summarized tr.summarized').attr('title','Show me more').show().click(function () { var trs = $(this).toggleClass('opened').parent('.summarized').children('tr:not(.summarized)'); trs.toggle(); if(trs.css('display')=='none') $(this).attr('title','Show me more'); else $(this).attr('title','Show me less'); }); } function lowPriorityBootUp() { devnull("lowPriorityBootUp()"); setupNotificationCenter(); $("form.confirm_leave input, form.confirm_leave select, form.confirm_leave textarea").change(function () { lockExit(); }); $("form.confirm_leave").submit(function () { unlockExit(); setTimeout(function() { lockExit(); },1000); }); prettyTelephoneNumbers(); loadSignature(); $("#js_please_wait").remove();//hide any leftover notices if we pressed the back button and they stayed. $("#show_admin_events input").change(function () { var ln_val = 0; if($(this).is(":checked")) ln_val = 1; $.get("/my/preferences/put?fv_id=show_admin_events&fv_value="+ln_val,function () { try { refreshCalendar(); } catch(e) { var aaa=1; } }); }); setTimeout(alternateRowColor,10); setTimeout(function () { try { $('input[placeholder],textarea[placeholder]').placeholder(); } catch(e) { placeholder_fail = 1; } },50); $("document:has(#instructions_bg_for_copy_mail)").bind("cut copy",function () { var tempResponse = prompt(share_link_copy); if (tempResponse === null) trackShare("email", "", "copy", gn_share_sid); else trackShare("email", "", tempResponse, gn_share_sid); }); $(".selectable_list .selectable").live("click",function () { selectable_list = $(this).parents(".selectable_list"); $("#"+selectable_list.attr("id")+"_input").val($(this).attr("rel")); selectable_list.find(".selectable").removeClass("selected"); $(this).addClass("selected"); return false; }); $(".selectable_list .selectable:first").click(); init_share_spots(""); imagePreview(); $('input.noedit, select.noedit').click(function () { $('input.noedit, select.noedit').removeClass('noedit'); }); $('textarea[maxlength]').keypress(function () { if ($(this).val().length > $(this).attr('maxlength')) { $(this).val($(this).val().substr(0, $(this).attr('maxlength'))); return false; } }); //Customer Reg $("#gsn_web_registration .matrix_feature a, #gsn_web_options .matrix_feature a").click(function () { $(this).parent().find("p").slideToggle("fast"); var toggleImg = $(this).find("img").attr("src"); if (toggleImg == "/images/ver2_images/bullet_toggle_plus.gif") { $(this).find("img").attr("src", "/images/ver2_images/bullet_toggle_minus.gif"); } else { $(this).find("img").attr("src", "/images/ver2_images/bullet_toggle_plus.gif"); } return false; }); $("textarea.expand_text_area").height('16px').focus(function () { if($(this).is(".expanded_text_area")) return; $("textarea.expanded_text_area").height("16px").removeClass("expanded_text_area"); $(this).height("200px").addClass("expanded_text_area"); fancyInterval = 300; fancy_resized_in_row =0; fancy_resize(); }); /*SPOT*/ $(".spot_delete").click(function () { var spotName = $(this).attr("rel"); var confirmDelete = confirm("You are about to delete the SPOT - " + spotName + "." + "\n\n" + "Doing so will permanently remove this SPOT from your available SPOTs and inactivate it anywhere you may have already used it." + "\n\n" + "Are you sure you would like to delete this SPOT?"); if (confirmDelete) { return true; } else { return false; } }); $(".icw_enable").click(function () { $(this).parent().find("img").show(); var icw_switch; var spotID = this.value; if (this.checked) { //alert("checked"); icw_switch = 1; } else { //alert("unchecked"); icw_switch = 0; } $.post("/my/spots/toggle_icw", { fn_spot_id: this.value, fv_switch: icw_switch }, function (xml) { tempstatus = xml; //alert(tempstatus); //tempmsg = $("request > message",xml).text(); $("input.icw_enable[value='" + spotID + "']").parent().find("img").hide(); if (tempstatus == 1) { $("input.icw_enable[value='" + spotID + "']").prop("checked", true); } else { $("input.icw_enable[value='" + spotID + "']").prop("checked", false); } }); return false; }); $("body").on('click','a.ajax_confirm',function (event) { $(this).parents('tr').addClass('deleteThisRow').find('td').css('background-color', '#FFDDDD'); if ($(this).hasClass('noconfirm') || confirm($(this).attr("title").length > 2 ? $(this).attr('title') : 'Delete this?')) { $(this).find('td').css('background-color', '#FFEEEE'); $.get($(this).attr("href"), function (data) { $("tr.deleteThisRow").fadeOut("fast"); }); } else { $(this).parents('tr').removeClass('deleteThisRow').find('td').css('background-color', ''); } event.preventDefault(); return false; }); function delete_confirm_target(tgt) { return function collectData(data) { tgt.trigger("afterDelete"); tgt.parents('.delete_container').fadeOut("fast", function () { $(this).remove(); }); } } function delete_confirm_series(tgt) { parent.$('#ars_container'+tgt).trigger("afterDelete"); if(parent.$("#to_addresses").length>0) { setTimeout(function () { parent.window.location = parent.window.location; }, 500); } else { parent.$("#ars_container"+tgt+" #fv_bookmark").hide().appendTo('body'); parent.$('#ars_container'+tgt).trigger("afterDelete"); parent.$('#ars_container'+tgt).fadeOut("fast", function () { $(this).remove(); }); } } $("a.confirm_delete_series").live('click',function(event) { if(!parent.$("#to_addresses").length) parent.$('#ars_container'+$(this).attr("rel")).addClass("delete_question"); $('body').addClass("delete_question"); if ($(this).hasClass('noconfirm') || confirm($(this).attr("title").length > 2 ? $(this).attr('title') : 'Delete this?')) { if(!parent.$("#to_addresses").length) parent.$('#ars_container'+$(this).attr("rel")).addClass("delete_active"); $.get('/my/autoresponders/remove_series?fn_series_id='+$(this).attr("rel"), delete_confirm_series($(this).attr("rel"))); } else { if(!parent.$("#to_addresses").length) parent.$('#ars_container'+$(this).attr("rel")).removeClass("delete_question"); $('body').removeClass("delete_question"); } event.preventDefault(); return false; }); $("a.delete_confirm").live('click',function (event) { $(this).parents('.delete_container').addClass("delete_question"); if ($(this).hasClass('noconfirm') || confirm($(this).attr("title").length > 2 ? $(this).attr('title') : 'Delete this?')) { $(this).parents('.delete_container').addClass("delete_active"); $.get($(this).attr("rel"), delete_confirm_target($(this))); } else { $(this).parents('.delete_container').removeClass("delete_question"); } event.preventDefault(); return false; }); $("#marketingpagepod").find(".delete_confirm").bind("afterDelete",function () { $('#create_new_page_button').attr("title",'').removeClass("negative").removeClass("submit").unbind("click"); }); $(".delete_popup").bind("afterDelete",function() { $("#iframe_body").html("
Confirmed
"); setTimeout(function() { tb_remove(); },350); }); $("#my_spots").find(".delete_confirm").bind("afterDelete",function () { $('#at_max_spots').hide(); $('#show_create_spot').show(); $('#ngs_errmsg').hide(); }); $(".js_print").click(function () { $('#new_contact_details p').show(); window.print(); return false; }); $(".delete_ar").bind('click', function () { if (confirm($(this).attr('title'))) { if (!iamtranslator || confirm($(this).attr('title').toUpperCase())) { $(this).parents('tr').find('td').css('background-color', '#DDDDDD'); var icw_switch; var arID = $(this).parents('tr').find('input[name=fn_autoresponder_id]').val(); $.post("/my/autoresponders/delete_ar", { fn_autoresponder_id: arID }, function (xml) { if (xml.indexOf('Deleted') > -1) { $(".ar" + arID).find('td').css('background-color', '#DDFFDD'); setTimeout(function () { $('.ar'+ arID).remove();}, 500); } else alert(xml); }); } } return false; }); $(".ar_ajax:checkbox").bind('click', function () { //$(this).parents('tr').find("img.ajax_loader").show(); $(this).parents('tr').find('td').css('background-color', '#DDDDDD'); var icw_switch; var arID = $(this).parents('tr').find('input[name=fn_autoresponder_id]').val(); if ($(this).parents('tr').find(':checkbox').is(':checked')) { //alert("checked"); icw_switch = 0; } else { //alert("unchecked"); icw_switch = 1; } $.post("/my/autoresponders/update_ar", { fn_autoresponder_id: arID, fn_email_days: $(this).parents('tr').find('select[name=fn_email_days]').val(), fn_email_enable: icw_switch, fv_email_clob: $(this).parents('tr').find('input[name=fv_email_clob]').val(), fn_type: $(this).parents('tr').find('input[name=fn_type]').val() }, function (xml) { tempstatus = xml; //alert(tempstatus); //tempmsg = $("request > message",xml).text(); //$(".ar"+arID).find("img.ajax_loader").hide(); $(".ar" + arID).find('td').css('background-color', '#DDFFDD'); setTimeout(function () { $('.ar'+ arID).find('td').css('background-color',''); }, 500); /*if (tempstatus == 1) { $("input.icw_enable[value='"+arID+"']").prop("checked", true); } else { $("input.icw_enable[value='"+arID+"']").prop("checked", false); }*/ }); }); $('.ar_new').click(function () { if ($(this).hasClass('call')) { $.post("/my/autoresponders/update_ar", { fn_autoresponder_id: 0, fn_email_days: 377, fn_email_enable: 0, fn_type: 'call', fn_autoresponder_series_id: $(this).parents('div.ar_series').attr('id').substr("ar_series_".length) }, function (xml) { if (xml.indexOf('Updated') > -1) window.location.href = window.location.href; else alert(xml); }); $("#drip_new_step2, #drip_new_step1").slideUp(function () { $("#drip_new_step3").slideDown(); }); } else if ($(this).hasClass('email')) { $.post("/my/autoresponders/update_ar", { fn_autoresponder_id: 0, fn_email_days: 377, fn_email_enable: 0, fv_bookmark_phrase: '', fv_email_clob: 'NULL', fn_target: $(this).hasClass('coach') ? 1 : '', fn_type: 'email', fn_autoresponder_series_id: $(this).parents('div.ar_series').attr('id').substr("ar_series_".length) }, function (xml) { if (xml.indexOf('Updated') > -1) { window.location.href = window.location.href; } else alert(xml); }); $("#drip_new_step1, #drip_new_step3").slideUp(function () { $("#drip_new_step2").slideDown(); }); } return false; }); $(".ar_ajax").bind('change', function () { //$(this).parents('tr').find("img.ajax_loader").show(); $(this).parents('tr').find('td').css('background-color', '#DDDDDD'); var icw_switch; var arID = $(this).parents('tr').find('input[name=fn_autoresponder_id]').val(); if ($(this).parents('tr').find(':checkbox').is(':checked')) { //alert("checked"); icw_switch = 0; } else { //alert("unchecked"); icw_switch = 1; } $.post("/my/autoresponders/update_ar", { fn_autoresponder_id: arID, fn_target: $(this).parents('tr').find('select[name=fn_target]').val() >= 0 ? $(this).parents('tr').find('select[name=fn_target]').val() : null, fn_email_days: $(this).parents('tr').find('select[name=fn_email_days]').val(), fn_email_enable: icw_switch, fv_email_clob: 'NULL', fn_type: $(this).parents('tr').find('input[name=fn_type]').val() }, function (xml) { tempstatus = xml; //alert(tempstatus); //tempmsg = $("request > message",xml).text(); //$(".ar"+arID).find("img.ajax_loader").hide(); $(".ar" + arID).find('td').css('background-color', '#DDFFDD'); setTimeout(function () { $('.ar'+ arID).find('td').css('background-color',''); }, 500); /*if (tempstatus == 1) { $("input.icw_enable[value='"+arID+"']").prop("checked", true); } else { $("input.icw_enable[value='"+arID+"']").prop("checked", false); }*/ }); }); } function initLangugeChoices() { $("#langlist a[href=#askchangelanguage]").bind('click',function (e) { if(confirm(languageChangeWarn)) { window.location = "/ngs_plugins/set_preferred_language?fn_chosen=1&fn_language_id="+$(this).attr('rel'); } e.preventDefault(true); return false; }); } function verifyEmailForm(withAction) { withAction = withAction===true?true:false; if($('#gsn_web_mail input[name=fn_autoresponder_id]:checked').length==0) $('#gsn_web_mail form:not(#preview_form) a.submit').attr("title","Please choose an autoresponder or email template.") else if($('input[name=fn_who]:checked').val()==3&&$('select[name=fn_prospect_id]').val()=="") { $('#gsn_web_mail form:not(#preview_form) a.submit').attr("title","Please select a contact or group of contacts to email.") if(withAction) { $('select[name=fn_prospect_id]').focus(); scroll(0,0); } } else if (!($('.step_holder').length == 0 || $('.step_final:visible').length > 0)) { $('#gsn_web_mail form:not(#preview_form) a.submit').attr("title",'Please complete all steps.') if(withAction) { $('.step').css('border','3px solid red'); scroll(0,0); setTimeout(function () { $('.step').css('border', 'none'); },100); } } else if ($("input[name=fv_subject]").val().length<1 && $("input[name=fn_autoresponder_id]:checked").val() == '-1') { $('#gsn_web_mail form:not(#preview_form) a.submit').attr("title",'Please include a subject for your email.') if(withAction) $('input[name=fv_subject]').focus(); } else $('#gsn_web_mail form:not(#preview_form) a.submit').attr("title","") if($('#gsn_web_mail form:not(#preview_form) a.submit').attr("title")===undefined ||$('#gsn_web_mail form:not(#preview_form) a.submit').attr("title")=="" ) $('#gsn_web_mail form a.submit').removeClass('negative'); else $('#gsn_web_mail form a.submit').addClass('negative'); } function is_touch_device() { try { document.createEvent("TouchEvent"); return true; } catch (e) { return false; } } function html5_spot_startup() { $('#html5_spot form input').keyup(function (e) { if (e.keyCode == 13 && lastKey != 38 && lastKey != 40) { $('#spot_submit').click(); return false; } lastKey = e.keyCode; }); //$("#html5_spot .error_message").click(function () { $(this).fadeOut(); }); $("#spot_submit").click(function (e) { devnull($("#html5_spot form").serializeArray()); $.post($("#html5_spot form").attr("action"),$("#html5_spot form").serializeArray(),function (data) { data = data.replace("&mystring=","").split("|a*e|"); devnull(data); $("#html5_spot .message_holder h1").hide(); if(data[0]=="fail") { $("#html5_spot .success").hide(); $("#html5_spot .error_message").html(unescape(data[1])).show(); //setTimeout(function () { $("#html5_spot .error_message").fadeOut(); },10000); } else { $("#html5_spot .error_message").hide(); $("#html5_spot .success").html(unescape(data[1])).show(); if(unescape(data[2]).length > 5 && unescape(data[2])!="undefined") setTimeout(function() { try { window.parent.location.href = unescape(data[2]); } catch(e) { window.location = unescape(data[2]); } },2000); $("#spot_submit").unbind("click").click(function (e) { if(unescape(data[2]).length > 5 && unescape(data[2])!="undefined") window.location = unescape(data[2]); e.preventDefault(); return false; }); } if(is_touch_device()) { try { window.scrollTo(0, $(".message_holder").offset().top-5); } catch(e) { var failed_scroll_message_notice; } } }); e.preventDefault(); return false; }); if(is_touch_device()) { setTimeout(function(){window.scrollTo(0, 1);}, 100); setTimeout(function(){window.scrollTo(0, 1);}, 250); setTimeout(function(){window.scrollTo(0, 1);}, 500); setTimeout(function(){window.scrollTo(0, 1);}, 1000); setTimeout(function(){window.scrollTo(0, 1);}, 1500); setTimeout(function(){window.scrollTo(0, 1);}, 2000); $("#html5_spot").addClass("touch"); } setTimeout(function () { $(".controls").fadeOut("slow"); },is_touch_device()?5000:3500); $("#my-video, .controls").bind("mousemove touchstart",function () { $(".controls").stop().css("opacity","1").show(); clearTimeout(dim_controls_timer); dim_controls_timer = setTimeout(function () { $(".controls").fadeOut("slow"); },is_touch_device()?4000:1500); }); $(".status").attr("unselectable", "on").css({"-moz-user-select":"none","-webkit-user-select":"none", "user-select":"none"}).bind("onselectstart",function() { return false; }); $(".status").mousedown(function(e) { adjustScrubber(e); $(".status").addClass("dragging").mousemove(adjustScrubber); e.preventDefault(); }); $(".status").click(adjustScrubber).mouseup(function (e) { adjustScrubber(e); $(".status").removeClass("dragging").unbind("mousemove"); try {$("#my-video").get(0).currentTime = Math.round($("#my-video").get(0).duration * ($(".controls .status .knob").css("left").replace("%","")/100)); }catch(e) { var crashed_seeking; } if( ($(".controls .status .knob").css("left").replace("%","")/100) > ($(".controls .progress").css("width").replace("%","")/100)) $(".controls .progress").css("left",$(".controls .status .knob").css("left")); }); $(".fullscreen").click(function () { try{ if(navigator.userAgent.indexOf("Safari 5.1")>-1){ //alert("fancy fullscreen"); if($(document).context.webkitIsFullScreen) $(document).context.webkitCancelFullScreen(); else $(".media_holder").get(0).context.webkitRequestFullScreen(); } else { $("#my-video").get(0).webkitEnterFullScreen(); //alert("regular fullscreen"); } } catch(error){ var test; } }); $(".play, #my-video, .loading_clicktoplay").bind("click touchend",function () { if(is_touch_device()) { if(allowed_to_click_play!=1) return; clearTimeout(clickDelay); clickDelay = setTimeout(function () { allowed_to_click_play = 1; },500); allowed_to_click_play = 0; } $("#thelog").append("Click detected, we should pause or start playing
"); $("#my-video").addClass("manuallyStarted"); $("#my-video").trigger("mousemove"); if($("#my-video").get(0).paused == false) { //Pause the movie $("#my-video").get(0).pause(); $(".play").removeClass("pause"); $('.loading_clicktoplay').show(); } else { //Play the movie $("#my-video").get(0).play(); $(".play").addClass("pause"); $(".loading_clicktoplay").hide(); } }); $("#my-video").bind("progress timeupdate",progTimeUpdate); $("#my-video").bind("abort canplay canplaythrough canshowcurrentframe dataunavailable durationchange emptied empty ended error loadeddata loadedmetadata loadstart pause play playing ratechange seeked seeking suspend volumechange waiting",function(ev) { if(ev.type == "ended") { $("#my-video").get(0).currentTime = $("#my-video").get(0).startTime; $("#my-video").get(0).pause(); $(".loading_animation").hide(); $(".loading_clicktoplay").show(); } else if(ev.type == "error") { $("#my-video, .controls").unbind("mousemove"); $(".loading_animation, .loading_clicktoplay, .controls").hide(); $("#my-video").unbind("click").get(0).pause(); $(".loading_error_message").text(ev.target.error.code.toString().replace("4","The media resource "+ev.target.src+" was not usable.").replace("3","An error has occurred in the decoding of the media resource, after the resource was established to be usable.").replace("2","A network error has caused the user agent to stop fetching the media resource, after the resource was established to be usable.").replace("1","The fetching process for the media resource was aborted by the user.")).show(); setTimeout(function () { $(".loading_error_message").hide(); },7000); } else if(ev.type == "suspend") { if($("#my-video").get(0).paused == true) { $(".loading_animation").hide(); $(".loading_clicktoplay").show(); } } else if(ev.type == "loadstart") { $(".loading_animation").show(); $(".loading_clicktoplay").hide(); } else if(ev.type == "play" || ev.type=="playing" || ev.type =="canplaythrough") { $(".loading_animation").hide(); if($("#my-video").get(0).paused == false) { $(".loading_clicktoplay").hide(); $(".play").addClass("pause"); } if(ev.type=="canplaythrough" && $("#my-video.manuallyStarted").length==0) { $("#my-video").get(0).play(); } } else if(ev.type == "loadedmetadata") { if ($("#my-video").get(0).webkitSupportsFullscreen) { $(".fullscreen").show(); $(".fullscreen_disabled").hide(); } } else if(ev.type == "waiting") { $(".play").removeClass("pause"); $(".loading_animation").show(); } else if(ev.type != "progress" & ev.type!="timeupdate") $("#thelog").append(ev.type+"
"); if(is_touch_device()) $(".loading_clicktoplay").hide(); }); } //HTML5 SPOT function progTimeUpdate(ev) { if(ev.type == "timeupdate") { var newleft = (parseInt(((ev.target.currentTime.toFixed(3) / ev.target.duration))*100)-1); $(".controls .status:not(.dragging) .knob").css("left",(newleft>99?99:newleft<1?1:newleft)+"%"); if((newleft>99?99:newleft<1?1:newleft)>($(".controls .progress").css("width").replace("%","")+$(".controls .progress").css("left").replace("%",""))) $(".controls .progress").css("width",((newleft>99?99:newleft<1?1:newleft)-$(".controls .progress").css("left").replace("%",""))+"%"); } else if(ev.type == "progress") { try { var endBuf = ev.target.buffered.end(0); var soFar = parseInt(((endBuf / ev.target.duration) * 100)); if(ev.target.bufferedBytes > 250) { var endBuf = ev.target.bufferedBytes; var soFar = parseInt(((endBuf / ev.target.totalBytes) * 100)); } $(".controls .progress").width((soFar>100?100:soFar<1?1:soFar) + "%"); } catch (e) { var crashed_checking_buffer_size; } } } //HTML5 SPOT function adjustScrubber (e) { var x = e.pageX - ($(".status").offset().left+5); //alert("("+e.pageX+"-"+$(".status").offset().left+") ---OR----- "+x+"/ "+($(".status").width()*.9)); var newleft = Math.round(( x / ($(".status").width()*.95))*100); $(".controls .status .knob").css("left",(newleft>=99?99:newleft<1?1:newleft)+"%"); } var lastScrollBarStatus; (function($){ $.fn.postlink = function(options) { var defaults = { enabled: true, debug: true }; var options = $.extend(defaults, options); return this.each(function() { var $obj = $(this); if ( $obj[0].tagName != "A") { return; } $obj.click(function(clickEvent) { clickEvent.preventDefault(); var $link=$(this); var href=$link.attr("href"); var hrefObj = parseLink(href); var $linkForm = createPostForm(hrefObj); $('body').append($linkForm); $linkForm.submit(); }); }); function createPostForm(hrefObj) { var linkForm = document.createElement("form"); $linkForm = $(linkForm); if (hrefObj.url && hrefObj.url.length > 0) { $linkForm.attr("action", hrefObj.url); } $linkForm.attr("method", "post"); var thisDate = new Date(); $linkForm.attr("id", "postlinkForm_" + thisDate.getTime()); var counter=0; for (var parmKey in hrefObj.keyPairs) { var input = document.createElement("input"); var $input = $(input); $input.attr("id", "postlink_hidden_" + parmKey + counter + "_input"); $input.attr("type", "hidden"); $input.attr("name", parmKey); $input.attr("value", hrefObj.keyPairs[parmKey]); $linkForm.append($input); } return $linkForm; } function parseLink(linkHref) { var hrefObj = { url: null, keyPairs: {} }; if ( linkHref.match(/\?/) ) { var urlParts = linkHref.split('?'); if (urlParts[0] !== "" || urlParts[0] > 0) { hrefObj.url = urlParts[0]; } var queryString = urlParts[1]; var hrefKeyPairs = queryString.split('&'); while (hrefKeyPairs.length > 0) { var keyPair = hrefKeyPairs.shift().split('='); hrefObj.keyPairs[decodeURIComponent(keyPair[0])] = decodeURIComponent(keyPair[1]); } } else { hrefObj.url = linkHref; } return hrefObj; } }; $("a.postlink").postlink(); })(jQuery); function fancy_anchors() { devnull("Animated Anchors Enabled"); $('a[href^="#"]').click(function (e) { if($(this).attr("href").substring(1).length>0) { try { devnull("Fancy Anchor Clicked: "+$(this).attr("href")); if(self.parent!=self) { parent.$.scrollTo({ top:$("#fancybox-wrap").css("top").replace('px','')+Number($("a[name="+$(this).attr("href").substring(1)+"]").offset().top)+25, left:+0 },400); } else { $.scrollTo($("a[name="+$(this).attr("href").substring(1)+"]"),400); } return false; } catch(e) { devnull("Failed to setup fancy anchor"+e); } } }); } function copyToIE(data) { $("#tempIECopier").html(data); var div = document.getElementById('tempIECopier'); div.contentEditable = 'true'; var controlRange; if (document.body.createControlRange) { controlRange = document.body.createControlRange(); controlRange.addElement(div); controlRange.execCommand('Copy'); } div.contentEditable = 'false'; } function zeroclip_setup() { devnull("Zeroclip Setup"); zeroclipdata["gv_copy_esignature"] = 'Signature was not loaded before copying. Please return to the signature page and copy again.'; $('#gv_spot_share_link').bind('postCopy',function () { shareTrackPrompt($('#gv_spot_share_link').attr("rel"),"link",""); }); $('#gv_copy_esignature').bind('postCopy',function () { alert($('#gv_copy_esignature').attr("rel")); }); $('#gv_spot_share_embed').bind('postCopy',function () { shareTrackPrompt($('#gv_spot_share_embed').attr("rel"),"embed",""); }); $('#gv_spot_share_email').bind('postCopy',function () { shareTrackPrompt($('#gv_spot_share_email').attr("rel"),"email",""); }); if (window.clipboardData) { devnull("Native Clipboard Support Detected"); $(".zeroclip").click(function () { copyToIE(zeroclipdata[$(this).attr('id')]); $(this).trigger('postCopy'); }); if($('#gsn_web_signature').length>0) { try { $.get("/my/signature/get_html",function (data) { zeroclipdata['gv_copy_esignature'] = data; //.replace( /\&/g, '&' ) //alert(data.substr(0,11)+' == nosignature'); if(data.substr(0,11) == 'nosignature') { $('#modify_button').click(); $("#copy_disabled, #cancel_esig").remove(); $("#copy_disabled_setup").show(); } }); } catch(e){ var aaa =1; } } } else { devnull("Flash Clipboard Support Fallback"); $(".zeroclip").each(function () { myid = $(this).attr('id'); try { zeroclips[myid] = new ZeroClipboard.Client(); zeroclips[myid].setHandCursor( true ); zeroclips[myid].setText(zeroclipdata[myid]); zeroclips[myid].glue( myid, $(this).parent().attr("id") ); devnull("Finished Zero Setup"); } catch(e) { devnull("Failed to setup zeroclip"); devnull(e); var aaa =1; } devnull("Setup #"+myid+" (p: #"+$(this).parent().attr("id")+") to copy "+zeroclipdata[myid]+" to the clipboard."); }); try { zeroclips['gv_spot_share_link'].addEventListener('complete', function (client, text) { $('#gv_spot_share_link').trigger('postCopy'); }); } catch(e){ var aaa =1; } if($('#gsn_web_signature').length>0) { try { $.get("/my/signature/get_html",function (data) { zeroclipdata['gv_copy_esignature'] = data; //.replace( /\&/g, '&' ) //alert(data.substr(0,11)+' == nosignature'); if(data.substr(0,11) == 'nosignature') { $('#modify_button').click(); $("#copy_disabled, #cancel_esig").remove(); $("#copy_disabled_setup").show(); devnull("No Signature Found"); } devnull("zeroclip: setting text"); zeroclips['gv_copy_esignature'].setText(zeroclipdata['gv_copy_esignature']); }); zeroclips['gv_copy_esignature'].addEventListener('complete', function (client, text) { devnull("zeroclip: success"); $('#gv_copy_esignature').trigger('postCopy'); }); zeroclips['gv_copy_esignature'].addEventListener('mouseOver', function (client, text) { devnull("zeroclip: resetting text"); zeroclips[myid].setText(zeroclipdata['gv_copy_esignature']); }); } catch(e){ var aaa =1; } } try { zeroclips['gv_spot_share_embed'].addEventListener('complete', function (client, text) { $('#gv_spot_share_embed').trigger('postCopy'); }); } catch(e){ var aaa =1; } try { zeroclips['gv_spot_share_email'].addEventListener('complete', function (client, text) { $('#gv_spot_share_email').trigger('postCopy'); }); } catch(e){ var aaa =1; } } } var mytemptimeout; function hexToR(h) {return parseInt((cutHex(h)).substring(0,2),16)} function hexToG(h) {return parseInt((cutHex(h)).substring(2,4),16)} function hexToB(h) {return parseInt((cutHex(h)).substring(4,6),16)} function cutHex(h) {return (h.charAt(0)=="#") ? h.substring(1,7):h} function tryInitSignature() { //initSignature has all of the signature settings loaded into javascript via the package. try { initSignature(); } catch(e) { var aaa = 1; } } function setSignaturePreviewEvents() { $("#sample_signature a").attr("href","#edit").on('click',function (e) { $("#modify_button").click(); var myid = $(this).attr("id"); myid = myid.substr(0,myid.indexOf("_tgt")); $("#"+myid).focus(); $("#link_editing input").css("background-color",""); $("#"+myid).css("background-color","#FBEC5D"); setTimeout(function () { $("#"+myid).css("background-color",""); },3500); e.preventDefault(); }); } function loadSignature() { $("#modify_button").click(function () { $('#update_signature').show(); $('#modify_button,#signature_stats,div.success').hide(); }); setSignaturePreviewEvents(); $("#fonts").ajaxAddOption("/my/signature/fonts", null,null); $("#backgrounds").ajaxAddOption("/my/signature/backgrounds",null,null); $("#buttons").ajaxAddOption("/my/signature/buttons", null, null, function () { setTimeout(tryInitSignature,500); setTimeout(refreshSignature,1000); }); $("#link_editing input").change(function () { refreshSignature(); }); $("#fonts, #buttons, #backgrounds, #colors,#fontsize,#colorsb, #fontsizeb").click(function () { refreshSignature(); }); } function refreshSignature (e) { if($('#modify_button:visible').length==0) { $('#gv_copy_esig_container').hide(); $('#copy_disabled,#cancel_esig').show(); } if($("#primary_link").val().indexOf("http")<0) $("#primary_link").val("http://"+$("#primary_link").val()); if($("#first_link").val().indexOf("http")<0) $("#first_link").val("http://"+$("#first_link").val()); if($("#second_link").val().indexOf("http")<0) $("#second_link").val("http://"+$("#second_link").val()); if($("#third_link").val().indexOf("http")<0) $("#third_link").val("http://"+$("#third_link").val()); if($("#fourth_link").val().indexOf("http")<0) $("#fourth_link").val("http://"+$("#fourth_link").val()); if($("#fifth_link").val().indexOf("http")<0) $("#fifth_link").val("http://"+$("#fifth_link").val()); if($("#backgrounds").val().indexOf("_small")>-1) button_width = 135; else if($("#backgrounds").val().indexOf("_large")>-1) button_width = 189; else button_width = ""; $("#sample_signature").load("/my/signature/preview",$("#update_signature form").serializeArray(),function () { setTimeout("setSignaturePreviewEvents();",100); }); } function checkAlarms() { if(!goodToGo) window.event.returnValue = 'Warning: You have unsaved changes.\n\nAre you sure you want to cancel them?'; } function ask_for_attachment() { $("#attachment_selection_button").click(); } function dump(arr,level) { var dumped_text = ""; if(!level) level = 0; //The padding given at the beginning of the line. var level_padding = ""; for(var j=0;j \"" + value + "\"\n"; } } } else { //Stings/Chars/Numbers etc. dumped_text = "===>"+arr+"<===("+typeof(arr)+")"; } return dumped_text; } function insertToToken(val, details, label) { if(details.length<4 || $("#to_tokens li").filter(function(){ return $(this).data('submitdata') === val }).addClass("selected").length==0) { var insertThis = $('
  • '); insertThis.prop("title",details); insertThis.data("submitdata",val); if(val.toUpperCase().indexOf('RESTRICT')==0) insertThis.addClass("red_token"); insertThis.text(label); insertThis.append('
    '); if($("#to_tokens li:last").prev().length!=0) $("#to_tokens li:last").prev().after(insertThis); else $("#to_tokens").prepend(insertThis); $("#send_email_next").mouseenter(); } } function insertToTokenById(customer_id) { $.ajax({ url: "/my/search/s", dataType: "json", data: { contacts_only_search: 2, q: customer_id }, success: function( data ) { $.map( data, function( item ) { //Filter only the contacts out of the search results. if(item.type.indexOf('contact')!=-1) { if($("#to_tokens li").filter(function(){ return $(this).data('submitdata') === "CONTACT_"+item.id; }).length==0) { insertToToken('CONTACT_'+item.id, item.details, item.title) } } }); } }); } function setupEmailSendTokenizer() { //Add an element into the tokens list. //Parse a string for email addresses in any format. //e.g. find the email and name for: "John Doe" function parseToEmail(v) { v = $.trim(v); //Plain if(checkEmailVal(v)) { insertToToken('EMAIL_'+v, v, v); return true; } //With brackets <> var email = v.substr(v.indexOf('<')+1,v.indexOf('>')-(v.indexOf('<')+1)); if(checkEmailVal(email)) { //Has Brackets, check for a name. //Fix the name = Brent McAhren" bug var name = $.trim(v.substr(0,v.indexOf('<')-1).replace(/["']/g,"")); insertToToken('EMAIL_'+email, email, name) return true; } return false; } //Disable the inline-css that makes the TO field responsive while javascript was loading. $("#to_token_search").css("height","").css("margin-top",""); $(".to_options_popup a.to_submit").on('click',function() { var par = $(this).parents('.to_options_popup'); var v = String(par.find('.to_criteria').val()).toUpperCase(); var tokenName = String(par.attr('rel')).toUpperCase()+'_'+v; var tokenText = par.find('.to_criteria option:selected').text(); if(tokenText.length == 0 || tokenText === null) tokenText = v.replace(/(\-[a-z])/g, function($1){return $1.toUpperCase().replace('-','');}); if(v.length !=0 && v != 'NULL' && v !== null) { insertToToken(tokenName,tokenText,tokenText); } unlockExit(); tb_remove(); return false; }); //Simulate focus and hover on the parent element that contains this input and the tokens UL. $("#to_addresses").hover(function() { $(this).addClass("hover"); },function() { $(this).removeClass("hover"); }) $('#to_token_search').focus(function() { $("#to_addresses").addClass("focus"); $("#to_tokens li.selected").removeClass("selected"); $(this).prop('placeholder',''); }); $('#to_token_search').blur(function() { $("#to_addresses").removeClass("focus"); }); //Forward clicks on the input wrapper to the input. //$("#to_addresses").on('click',function () { $('#to_token_search').focus(); }); //Handle the remove icon. $("#to_tokens").on('click','li div.cL',function() { $(this).parent().remove(); return false; }); //Handle selecting tokens //TODO: Support SHIFT+Click and deselect all others before select when NOT CONTROL+Click. $("#to_tokens").on('click','li:not(li:last)',function() { $(this).toggleClass('selected'); return false; }); //Watch for document-level "delete" key presses and erase all selected contacts after a popup if more than one is selected. $(document).on('keydown',function(event) { if(event.which === 46&&($("#to_tokens li.selected").length==1||confirm("Remove "+$("#to_tokens li.selected").length+" selected contacts from this email?"))) { $("#to_tokens li.selected").remove(); } }); $("#to_token_search").on("paste",function(e) { //Simulate a keydown [Enter] after paste to resize the field properly and process the entries once they are pasted. if(e.type == 'paste') { var e2 = jQuery.Event("keydown", { keyCode: 13, which: 13 }); setTimeout(function() { $('#to_token_search').trigger(e2); },35); return; } }); $( "#to_token_search" ).on( "keydown", function(e) { //Don't navigate away from the field on [Tab] when selecting an item if ( e.which === $.ui.keyCode.TAB && $( this ).data( "autocomplete" ).menu.active ) { e.preventDefault(); } //Autosize the input field var text = $('').css({ position: 'absolute', top: -9999, left: -9999, width: 'auto', fontSize: $(this).css('fontSize'), fontFamily: $(this).css('fontFamily'), fontWeight: $(this).css('fontWeight'), letterSpacing: $(this).css('letterSpacing'), whiteSpace: 'nowrap' }).text($(this).val()).appendTo("body"); var w = text.width(); text.remove(); $(this).width(_.max([w,50])+25); //[Backspace] removes the last token if we're at the first character of the To: field. if(e.which === 8) { if($(this).caret().start===0) $("#to_tokens li:last").prev().remove(); devnull($(this).caret()); } //On [Enter] and [,] process the entries. if(e.which === 13 || e.which === 188) { var v = $(this).val(); //Process multiple entries if(v.indexOf(',')!=-1) { v = v.split(','); newv = []; $.each(v, function(index, value) { if(!parseToEmail(value)) newv.push(value); }); if($(this).val()!=newv.join(',')) { //Update the entry and simulate an [Enter] keydown. $(this).val(newv.join(',')); var e2 = jQuery.Event("keydown", { keyCode: 13, which: 13 }); setTimeout(function() { $('#to_token_search').trigger(e2); },35); } //Process one entry } else { if(parseToEmail(v)) { //Clear the entry and simulate an [Enter] var e2 = jQuery.Event("keydown", { keyCode: 13, which: 13 }); setTimeout(function () { $('#to_token_search').val('').trigger(e2); }, 4); } } } /*if(w+10>763 && /[A-Za-z0-9 ]/.test(String.fromCharCode(e.keyCode))) e.preventDefault();*/ e.stopPropagation(); }); $( "#to_token_search" ).autocomplete({ source: function( request, response ) { $.ajax({ url: "/my/search/s", dataType: "json", data: { contacts_only_search: 1, q: request.term }, success: function( data ) { response( $.map( data, function( item ) { //Filter only the contacts out of the search results. if(item.type.indexOf('contact')!=-1) { if($("#to_tokens li").filter(function(){ return $(this).data('submitdata') === "CONTACT_"+item.id; }).length==0) { return { label: item.title, value: item.id, details: item.details } } } })); } }); }, focus: function() { // prevent value inserted on focus return false; }, select: function( event, ui ) { this.value = ''; insertToToken('CONTACT_'+ui.item.value, ui.item.details, ui.item.label) return false; } }).data( "autocomplete" )._renderItem = function( ul, item ) { //Override the display within the autocomplete drop down. return $( "
  • " ) .data( "item.autocomplete", item ) .append( "" + item.label + "
    " + item.details + "
    " ) .appendTo( ul ); }; $("#content_standard_a").click(function () { //Standard hide options/show submit $(".content_choice, #content_choices_links").hide(); setTimeout(function () { $("#content_choices_links").hide(); },250); $("#content_reset, #send_email_next").show(); //Hide alternate options $("#content_drip_a, #content_coach_a").addClass('negative'); $(".content_drip_extra_field, .content_coach_extra_field").hide(); $(this).removeClass('negative'); $("#content_choice_hidden").val("STANDARD"); $("#content_standard").show(); $(".content_standard_extra_field").show(); $("#fv_subject, #data4").addClass('restricted_input'); $("#schedule_when").show(); return false; }); $("#content_drip_a").click(function () { //Standard hide options/show submit $(".content_choice, #content_choices_links").hide(); setTimeout(function () { $("#content_choices_links").hide(); },250); $("#content_reset, #send_email_next").show(); //Hide alternate options $("#content_coach_a, #content_standard_a").addClass('negative'); $(".content_standard_extra_field, .content_coach_extra_field").hide(); $(this).removeClass('negative'); $("#content_choice_hidden").val("DRIP"); $("#content_drip").show(); $(".content_drip_extra_field").show(); //Update fv_bookmark.... $("select[name=fn_autoresponder_id]").change(); $("#fv_subject, #data4").removeClass('restricted_input'); $("#schedule_when").show(); return false; }); $("#content_coach_a").click(function () { //Standard hide options/show submit $(".content_choice, #content_choices_links").hide(); setTimeout(function () { $("#content_choices_links").hide(); },250); $("#content_reset, #send_email_next").show(); //Hide alternate options $("#content_drip_a, #content_standard_a").addClass('negative'); $(".content_drip_extra_field, .content_coach_extra_field").hide(); $(this).removeClass('negative'); $("#content_choice_hidden").val("COACH"); $("#content_coach").show(); $(".content_coach_extra_field").show(); //Update fv_bookmark $("select[name=fn_coaching_id]").change(); $("#fv_subject, #data4").removeClass('restricted_input'); $("#schedule_when").show(); if($("#fn_when_select").data("coaching_value")!==undefined) { $("#fn_when_select").val($("#fn_when_select").data("coaching_value")); } return false; }); $("#content_reset").click(function() { $("#content_choice_hidden").val(""); $(".content_choice").hide(); $("#content_drip_a, #content_standard_a, #content_coach_a").removeClass('negative'); $(".content_standard_extra_field, .content_drip_extra_field, .content_coach_extra_field").hide(); $("#content_choices_links").show(); $(this).hide(); $("#send_email_next").hide(); return false; }); $("#send_email_next").on("mouseenter",function () { if(!$("#send_email_next a.submit").hasClass('submitting')) { //Process the last typed entry. var e2 = jQuery.Event("keydown", { keyCode: 13, which: 13 }); $('#to_token_search').trigger(e2); if($("#to_tokens").children().length > 1) { $("#send_email_next a.submit").removeClass("negative"); } else $("#send_email_next a.submit").addClass("negative").prop("title","Please choose a recipient"); } }); setTimeout(function () { $("#content_choices_links").show(); },250); $("#send_email_next a.submit").click(function () { var newinputs = []; $("#to_result_inputs").empty(); $("#to_tokens").children(":not(:last)").each(function(i,e) { //TODO: Cater for the names and email addresses of new contacts to be entered. var val = $(e).data('submitdata'); if($(e).data('submitdata').indexOf('EMAIL_')===0) { val = val+'_$name$_'+$(e).text(); } newinputs.push($("").val(val)); }); $("#to_result_inputs").html(newinputs); newinputs = []; }); } function omniSearchPress() { clearTimeout(omniSearchPressTimeout); omniSearchPressTimeout = setTimeout(omniSearch,100); } function omniSearch() { if($("#omnisearch_query").val().length > 0) { if(lastOmniSearchText == $("#omnisearch_query").val() && lastOmniSearch != null) return; //$("#omnisearch_header").html($("#omnisearch_query").val()); if(lastOmniSearch != null) lastOmniSearch.abort(); if($("#omnisearch_results img.loader_icon").length==0) $("#omnisearch_results").append(''); lastOmniSearch = $.getJSON("/my/search/s",{q:$("#omnisearch_query").val()}, function(data) { lastOmniSearchText = $("#omnisearch_query").val(); devnull("data response length: "+data.length); devnull(data); var items = []; var thisOmniResultId = -1; $.each(data, function(key, val) { if(val.type == 'search_id' || val.type == 'search_term' || val.type == 'search_term2') { /*if(val.type == 'search_term') $("#omnisearch_header").text(val.title);*/ } else items.push('
  • ' + val.title + '
  • '); }); $("#omnisearch_results").html("
      "+items.join("")+"
    "); $("#omnisearch_h3").fadeIn(); }); } else { if(lastOmniSearch != null) lastOmniSearch.abort(); $("#omnisearch_results").html(""); } } function setupOmniSearch() { $("#omnisearch_query").keyup(omniSearchPress); $("#omnisearch_query").keypress(omniSearchPress); $("#omnisearch_results ul li.onelineonly a").live("mouseenter",function () { if($(this).outerWidth()>148) $(this).stop().animate({"margin-left":"-"+($(this).outerWidth()-148)}, (($(this).outerWidth()-148)/60) * 1000,"linear"); }).live("mouseleave", function () { if($(this).width()>148) $(this).stop().animate({"margin-left": "0"}, 300,"linear"); }); } function setupNotificationCenter() { $("#notifications_table").on("click",".js_notification_skip,.js_notification_background_skip",function () { var backgrounded_href = false; if($(this).hasClass("js_notification_background_skip")) { $.get($(this).prop("href"),function () { $("#notifications_table").load("/my/dashboard/notificationsTable?rand="+Math.floor(Math.random()*99999999999)); }); backgrounded_href = true; } //gn_notification_count = gn_notification_count+1; if(!backgrounded_href) { setTimeout(function () { $("#notifications_table").load("/my/dashboard/notificationsTable?rand="+Math.floor(Math.random()*9999999999),function () { makeButtons("#notifications_table"); }); },500); } if($(this).prop("href").indexOf("#")==0 || backgrounded_href) return false; }); $("#notifications_table").load("/my/dashboard/notificationsTable?rand="+Math.floor(Math.random()*99999999999),function () { makeButtons("#notifications_table"); }); } function selectText(containerid) { if (document.selection) { var range = document.body.createTextRange(); range.moveToElementText(document.getElementById(containerid)); range.select(); } else if (window.getSelection()) { var range = document.createRange(); range.selectNode(document.getElementById(containerid)); window.getSelection().removeAllRanges(); window.getSelection().addRange(range); } }