/** * Opens link in new window. **/ $(document).ready(function() { $('a.new-window').click(function() { window.open(this.href); return false; }); $('a.void-link').click(function() { return false; }); }); function defaultWindowOptions() { return { url : 'http://', name : 'newwindow', width : 500, height: 300, left : '', top : '', location : 'center', menubar : 'no', resizable : 'yes', scrollbars : 'yes', status : 'no', titlebar : 'no', toolbar : 'no' } } function setWindowLocation(settings) { if (settings.location == 'center'){settings.left = (screen.width-settings.width)/2; settings.top = (screen.height-settings.height)/2; } if (settings.location == 'top-left'){settings.left = 0; settings.top = 0;} if (settings.location == 'top-center'){settings.left = (screen.width-settings.width)/2; settings.top = 0;} if (settings.location == 'top-right'){settings.left = (screen.settings.width); settings.top = 0;} if (settings.location == 'bottom-left'){settings.left = 0; settings.top = (screen.height-settings.height);} if (settings.location == 'bottom-center'){settings.left = (screen.width-settings.width)/2; settings.top = (screen.height-settings.height);} if (settings.location == 'bottom-right'){settings.left = (screen.width-settings.width); settings.top = (screen.height-settings.height);} return settings; } function newWindow(element, options) { var settings = $.extend({}, defaultWindowOptions(), options), options = 'width=' + settings.width + ', ' + 'height=' + settings.height + ', ' + 'menubar=' + settings.menubar + ', ' + 'resizable=' + settings.resizable + ', ' + 'scrollbars=' + settings.scrollbars + ', ' + 'status=' + settings.status + ', ' + 'titlebar=' + settings.titlebar + ', ' + 'toolbar=' + settings.toolbar; // Get settings. settings = setWindowLocation(settings); // Create new window. var new_window = window.open(settings.url, settings.name, "" + options + ""); // Try to bring focus to window. try {new_window.focus();} catch(e) {} return false; } /** * Clears text from an input field. **/ function clearText(thefield) { if (thefield.defaultValue==thefield.value) { thefield.value = "" } } /** * Replaces text in an input field. **/ function replaceText(thefield) { if (thefield.value=="") { thefield.value = thefield.defaultValue } } /** * Prevents anchor tags with href="#" from displaying the #. **/ $(document).ready(function() { $('a').each(function(el) { if ($(this).attr('href') == '#') { $(this).click(function() { void(0); return false; }); } }); }); // This is called from the /recipes header flash. Used instead of passing parameters per request by developer. function openRecipeLandingPageVideo(){ Shadowbox.open({content : 'http://http.vitalstreamcdn.com/flashskins/FLVPlayer.swf?&bgColor=0xFFFFFF&configFile=&serverName=interactivate.flash.internapcdn.net&appName=interactivate_vitalstream_com/_definst_&streamName=wgp/catering/Butternut-Squash-Soup-16x9&autoPlay=true&skinName=http://http.vitalstreamcdn.com/flashskins/clearSkin_1&bufferTime=3&autoRewind=true&serverName=interactivate.flash.internapcdn.net', player : 'swf', title : '', height : 380, width : 620}); }