/***
* Coded by HdotNET + Radim @ www.cfp.co.uk
* Generated Tue Feb 21 15:03:55 GMT 2012
***/
window.name="wgcwin";$(document).ready(function(){debug("document.ready fired");var b=true;topNavHighlight();if(!mobile_device){$("a.definition").tooltip({position:"center top",tip:"#tooltipDEF",tipClass:"tooltip-def"});fixTopNav();setUpImageEnlargements();if(IE_version===false||IE_version>6){downloadTooltips("div#rightColumn a.pdf","right");downloadTooltips("div.base-item-list a.pdf","body");downloadTooltips("div#leftColumn div.content-body a.pdf","body")}setDownloadLinks("body a");loginDownloadLinks("a.download-secure");setUpLogoutForm()}setUpDownloadLinkTracking();if(global_session_id){$.each($("a.download-secure"),function(){$(this).removeClass("download-secure");$(this).attr("title","");$(this).addClass("download")})}if($(".magicBullets").length&&$(".magicBullets div.answer").length){str="q";$(".magicBullets").each(function(d,e){str=str+d;window[str]=new WGC_Bullets($(this).attr("id"),str);window[str].loadBullets()})}$("a#headerLoginLink").attr("href",$("a#headerLoginLink").attr("href")+"?return=http://"+document.location.hostname+document.location.pathname);$("a#headerRegisterLink").attr("href",$("a#headerRegisterLink").attr("href")+"?return=http://"+document.location.hostname+document.location.pathname);if(IE_version!==false&&global_session_id){dlcookie=readCookie("wgc_quickdownload");if(dlcookie!=null){debug("need to download this file "+dlcookie);debug("starting download and removing the cookie");eraseCookie("wgc_quickdownload");document.location.href=dlcookie}}});function trim(b){return b.replace(/^\s+|\s+$/g,"",b)}function ltrim(b){return b.replace(/^\s+/,"",b)}function rtrim(b){return b.replace(/\s+$/,"",b)}function readCookie(d){var f=d+"=";var b=document.cookie.split(";");for(var e=0;e<b.length;e++){var g=b[e];while(g.charAt(0)==" "){g=g.substring(1,g.length)}if(g.indexOf(f)==0){return g.substring(f.length,g.length)}}return null}function eraseCookie(b){createCookie(b,"",-1)}function createCookie(e,f,g){if(g){var d=new Date();d.setTime(d.getTime()+(g*24*60*60*1000));var b="; expires="+d.toGMTString()}else{var b=""}document.cookie=e+"="+f+b+"; path=/"}function setDownloadLinks(b){$(b).click(function(d){clicked=$(this).attr("href");if(clicked==null){return}if(clicked.substr(0,10)=="/download/"&&clicked.substr(0,13)!="/download/get"&&!$(this).hasClass("download-secure")){d.preventDefault();clicked=clicked.replace("/download/","/download/get/");debug("catching download link, changing to download/get");debug(clicked);document.location.href=clicked;return}})}var login_download_links_setup=false;function loginDownloadLinks(b){if(global_session_id){debug("<<<<<<<<<< logged in, no need to set login download links");return}if(login_download_links_setup){debug("<<<<<<<<<< already setup login download links");return}debug("setting up login download links");$(b).click(function(d){d.preventDefault();debug("secure link clicked");clicked_file=$(this).attr("href");login_link="/user/login/iframe/?file="+clicked_file+"&return="+document.location.pathname;if(use_ssl){login_link="https://"+document.location.hostname+login_link}$.colorbox({iframe:true,href:login_link,title:"You must login to download this file",width:"650px",height:"400px"})});login_download_links_setup=true}function loggedIn(b,e,f,d,g){global_session_id=e;occupation=f;if(d){debug("Logged in "+b+", need to download this file "+d)}ssl_link="";if(use_ssl){ssl_link="https://"+document.location.hostname}$("a#headerLoginLink").attr("href",ssl_link+"/user/edit/");$("a#headerLoginLink").text("Hello "+b+", edit your profile?");$("a#headerRegisterLink").attr("href",ssl_link+"/user/logout/");$("a#headerRegisterLink").text("Logout");$("a#headerRegisterLink").addClass("logout-link");$("a#headerRegisterLink").append('<form method="post" action="'+ssl_link+'/user/logout/" id="logoutForm"><input type="hidden" name="currentPage" value="'+window.location.pathname+'" /></form>');setUpLogoutForm();$("a.download-secure").removeAttr("title");$("a.download-secure").addClass("download");$("a.download-secure").unbind("click");$("a.download-secure").removeClass("download-secure");debug("setting up link tracking after log in");setDownloadLinks("body a.download");setUpDownloadLinkTracking("body a.download");setUpLinkTracking();if(d){downloadFileAfterLogin(d)}if(g){window[g]()}}function downloadFileAfterLogin(b){debug("downloadFileAfterLogin: "+b);clicked=b.replace("/download","");if(IE_version!==false){$.colorbox({iframe:true,href:"/download/iframe_download"+clicked,title:"Please download the requested file",width:"650px",height:"400px"})}else{debug("downloadFileAfterLogin: catching download link, changing to download/get");$.colorbox.close();$(document.body).append('<iframe id="downloadFrame" style="display:none">');$("iframe#downloadFrame").attr("src","/download/get"+clicked)}}function fixTopNav(){$("li.li_about_gold").hover(function(){if(vpWidth()<=1160){debug("resetting RH menu");$("li.li_about_gold div.top-nav-sub").addClass("top-nav-sub-position-right")}},function(){$("li.li_about_gold div.top-nav-sub").removeClass("top-nav-sub-position-right")})}function downloadTooltips(d,b){debug("setting up pdf tooltips for "+d);if(b=="right"&&vpWidth()<=1190){$(d).tooltip({position:"center left",tip:"#tooltipRightPDF",cancelDefault:true,tipClass:"tooltip-pdf-right"})}else{$(d).tooltip({position:"center right",tip:"#tooltipBodyPDF",cancelDefault:true,tipClass:"tooltip-pdf-body"})}}function setUpLogoutForm(){$("a.logout-link").click(function(b){b.preventDefault();$("form#logoutForm").submit()})}function setUpLinkTracking(){return;debug("setting up link tracking")}function setUpDownloadLinkTracking(){debug("setting up download tracking");$("div.content-body a").click(function(b){href=$(this).attr("href");if(href==null){return}if($(this).hasClass("notrack")){return}if($(this).hasClass("download-secure")){return}if($(this).parents("div.result-per-page").length||$(this).parents("div.result-pagination").length){return}if($(this).hasClass("download")){debug("div.content-body a.download site.js");trackDownload(href);return}if(href.indexOf("ownload/")!==-1){debug("div.content-body a ownload/ site.js");trackDownload(href);return}if(href.indexOf("ssets/file/")!==-1){debug("div.content-body a ssets/file/ site.js");trackDownload(href);return}})}function downloadLinks(b){$(b).click(function(d){clicked_file=$(this).attr("href");debug("downloadLinks site.js");trackDownload(clicked_file)})}tracked_files=Array();function trackDownload(b){if(!_gaq){return}for(c=0;c<tracked_files.length;c++){if(tracked_files[c]==b){return}}this_page=document.location.pathname;_gaq.push(["_trackEvent","Downloads By Page - All",this_page,b]);_gaq.push(["_trackEvent","Downloads By File - All",b,this_page]);tracked_files[tracked_files.length]=b}function trackClick(b,d){if(!_gaq){return}}function sharePage(b){debug("sharing page on service "+b);doctitle=encodeURIComponent(window.document.title);doclocation=encodeURIComponent(window.document.location.href);urilocation=encodeURIComponent(window.document.location.href);switch(b){case"facebook":sharelink="http://api.addthis.com/oexchange/0.8/forward/facebook/offer?url="+doclocation+"&title="+doctitle+"&pubid="+social_analytics_id;break;case"linkedin":sharelink="http://api.addthis.com/oexchange/0.8/forward/linkedin/offer?url="+doclocation+"&title="+doctitle+"&pubid="+social_analytics_id;break;case"twitter":sharelink="http://api.addthis.com/oexchange/0.8/forward/twitter/offer?url="+doclocation+"&title="+doctitle+"&pubid="+social_analytics_id;break;case"email":sharelink=false;break}if(!sharelink){document.location.href="/share/?url="+urilocation;return}}function setUpImageEnlargements(){$("div.content-body a.enlarge").click(function(b){b.preventDefault();debug("oh hai"+$(this).attr("href"));title=$(this).attr("title");bigImage=$(this).attr("href");$.colorbox({title:title,href:bigImage})});$("div.content-body a.enlarge-group").colorbox({width:"915px",height:"460px"});$("div.content-body a.enlarge-sized").click(function(b){b.preventDefault();debug("oh hai"+$(this).attr("href"));title=$(this).attr("title");bigImage=$(this).attr("href");colorboxWidth=(vpWidth()-200);colorboxHeight=(vpHeight()-100);$.colorbox({title:title,href:bigImage,maxWidth:colorboxWidth,maxHeight:colorboxHeight,scalePhotos:true})})}function vpWidth(){return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth}function vpHeight(){return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight}function topNavHighlight(){uri=document.location.pathname;if(uri=="/"){$("div#topNav a.homepage").addClass("active");return}segments=document.location.pathname.split("/");$.each($("div#topNav a"),function(){href=$(this).attr("href");if(uri.indexOf(href)==0&&href!="/"){$(this).addClass("active")}})}var eee=0;debug=function(b){if(!DEV_SERVER){return}if(window.console!=undefined){}else{}};Array.prototype.in_array=function(d){var b=this.length;while(b--){if(this[b]===d){return true}}return false};function WGC_Bullets(d,b){this.targetList=d;this.objName=b;this.list=new Array();this.questions=new Array();this.answers=new Array();this.loadBullets=function(){this.traceMsg(this.targetList);this.traceMsg(this.objName);this.list=$("#"+this.targetList+" > li");for(c=0;c<this.list.length;c++){qa=$(this.list[c]);q=$(qa).children("h3");$(qa).children("h3").remove();$(qa).children("div.answer a.top").remove();a=$(qa).children("div.answer");$(qa).children("div.answer").remove();this.questions[c]=q.text();this.answers[c]=a.html()}this.traceMsg("there are "+this.questions.length+" questions");this.traceMsg("there are "+this.answers.length+" answers");this.constructBullets()};this.constructBullets=function(){for(c=0;c<this.list.length;c++){qa=$(this.list[c]);a_id="a_"+this.objName+"_"+c;q=this.questions[c];a=this.answers[c];qa.append('<h3><a href="#'+this.objName+(c+1)+'" onclick="'+this.objName+".toggleQuestion('"+a_id+"')\">"+q+'</a></h3><div class="answer" id="'+a_id+'" style="display:none">'+a+"</div>")}};this.toggleQuestion=function(e){$("div#"+e).toggle()};this.traceMsg=function(e){}};
