function CalcDate(D){
  //args TimeValue & (Months|Days|Seconds) & (+|-)
  var TD=D.substring(0,D.length-2),TC=D.substring(D.length-2,D.length-1).toLowerCase(),MS=0,dO=new Date()
  MS=(TC=="m")?TD*((24*60*60*1000)*30):MS
  MS=(TC=="d")?TD*(24*60*60*1000):MS
  MS=(TC=="s")?TD*1000:MS
  dO.setTime((D.substring(D.length-1,D.length)=="+")?dO.getTime()+MS:dO.getTime()-MS)
  return dO.toGMTString()
}
function DropDownGo(FO,W,R){
  var U=FO[FO.selectedIndex].value
  if(U!=null&&U!=""){;(W)?OpenWin(U,"DropdownPage"):window.top.location="".concat(U);if(R){;FO.selectedIndex=0;};}
}
function GenRandomNum(){
  var DO=new Date
  return "".concat(("".concat(Math.random()).replace(/\./g,""))*DO.getSeconds())
}
function GetArg(N){;var i=0,u="".concat(window.location),u=(u.indexOf("?")>-1)?u.split("?")[1]:"",u=(u.indexOf("#")>-1)?u.split("#")[0]:u,u=(u.charAt(u.length-1)=="&")?u.substring(0,u.length-1):u;N+="=";while(i<u.length){;var j=i+(N.length);if(u.substring(i,j)==N){;return unescape(u.substring(j,(u.indexOf("&",j)==-1)?u.length:u.indexOf("&",j)));};i=u.indexOf("&",i)+1;if(i==0){;break;};};return null;}
function GetCookie(N){
  //args cookieName(r)
  var co=document.cookie,pos=co.indexOf(N+"=")
  return (pos!=-1)?unescape(co.substring(pos+N.length+1,(co.indexOf("; ",pos)!=-1?co.indexOf("; ",pos):co.length))):null
}
function OpenWin(U,N,W,H,A,F,L,T,C){
  //args Url(r),Name(r),Width(opt),Height(opt),Attributes(opt),Focus(opt),Left(opt),Top(opt),Center(opt)
  var WO,WA=new Array(),a=new Array("directories","location","menubar","resizable","scrollbars","status","titlebar","toolbar")
  A=(A)?"".concat(A):"on"
  for(i=0;i<a.length;i++){;WA[WA.length]=a[i]+"="+((A.indexOf(a[i].substring(0,2))>-1||A=="on")?"yes":"no");}
  if(W){;WA[WA.length]="width="+W;}
  if(H){;WA[WA.length]="height="+H;}
  if(C&&W&&H){;T=(screen.height-H)/2;L=(screen.width-W)/2;}
  if(L){;WA[WA.length]="left="+L;WA[WA.length]="screenX="+L;}
  if(T){;WA[WA.length]="top="+T;WA[WA.length]="screenY="+T;}
  A=(WA.length)?WA.join(","):""
  WO=window.open(U,N,A)
  if(F){;WO.focus();}
}
function SetCookie(N,V,E,P,D,S){
  //args Name(r),Value(r),Expire(opt),Path(opt),Domain(opt),Secure(opt)
  if(E){;E=((E.charAt(E.length-1)=="+")||(E.charAt(E.length-1)=="-"))?CalcDate(E):E;}
  document.cookie=N+"="+escape(V)+((E)?"; expires="+E:"")+((P)?"; path="+P:"; path=/")+((D)?"; domain="+D:"; domain=.wsj.com")+((S)?"; secure="+S:"");
}
var googleMod=/mod=google/
function SurveyPopUp(N,U,P,E,W,H,A,L,T){
  //args Name(r),Url(r),Percent(r),Expire(r),Width(r),Height(r),Attributes(r),Left(r),Top(r)
  var dO=new Date()
  if((!GetCookie("WSJIE_LOGIN"))&&GetCookie("user_type")!='subscribed'&&(!GetCookie(N))&&((dO.getTime()%100)<P)&&(!googleMod.test(document.location))){
    SetCookie(N,"true",E)
    if(GetCookie(N))
      OpenWin(U,N,W,H,A,true,L,T)
  }
}
var loggedIn=(GetCookie("fastlogin")||GetCookie("wsjproducts"))?true:false
//***** Add custom functions below this line *****
function PJ_SetDefaultFocus(){
  var FO=(document.myForm)?((document.myForm.companyList)?document.myForm.companyList:((document.myForm.companyfund_1)?document.myForm.companyfund_1:((document.myForm.myLayout)?document.myForm.myLayout:""))):""
  if(FO){;FO.selectedIndex=0;FO.focus();}
}
function update_frame(myoptions){;DropDownGo(myoptions,false,1);}
document.onmousedown=isJournalURL
var suppress_popup=false
if(document.captureEvents)
  document.captureEvents(Event.MOUSEDOWN)
function isJournalURL(e){
  var re=/wsj.com/
  var e=(!e)?window.event:e
  suppress_popup=(e.srcElement)?((re.test(e.srcElement.href))?true:false):((e.target.parentNode)?((re.test(e.target.parentNode))?true:false):((re.test(e.target))?true:false))
}
var exitPath=/public_junk/
var ePu="http://public.wsj.com/expop/contest_exit.html",ePw=375,ePh=477
function exitPopup(){
  if(!suppress_popup&&!GetCookie("WSJIE_LOGIN")&&(GetCookie("user_type")!='subscribed')&&(exitPath.test(document.location))&&(!googleMod.test(document.location)))
    OpenWin(ePu,"Farewell",ePw,ePh,"off",1,0,0)
}
function NewWindow(U,N,W,H,S){
  OpenWin(U,N,374,477,((S)?"scroll,resizable":"resizable"),true,100,100)
}
var userid=GetCookie("UBID"),userid=(userid)?((userid.indexOf(".")>-1)?(userid.split(".")[0]):userid):""
function GenericPopUp(U){
  OpenWin(U,"_blank",640,480,"scroll")
}
function hideConfirmation(cat) {
  OpenWin("/setup/hide_confirmation?category="+(cat.replace(/ /g,"+")),"newwin",310,260,"status",true,100,300)
}

function getDist(obj,isTop){
  var acum=0
  while(obj.tagName!="BODY"){
    acum+=isTop?obj.offsetTop:obj.offsetLeft
    obj=obj.offsetParent
  }
  return acum
}

function resizeSlider(){
  if((document.all.sliderSplash)&&(document.all.sliderSplash.style.pixelWidth>0)){
    document.all.sliderSplash.style.left=getDist(window.top.document.all.iframe4,false)
    document.all.sliderSplash.style.pixelWidth=document.all.iframe4.style.pixelWidth
  }
  if((document.all.sliderOpen)&&(document.all.sliderOpen.style.pixelWidth>0)){
    document.all.sliderOpen.style.pixelWidth=document.all.iframe4.style.pixelWidth
    document.all.sliderOpen.style.left=getDist(window.top.document.all.iframe4,false)
    blueBar=90
    iframeTop=getDist(document.all.iframe4,true)
    height=iframeTop-blueBar+250
    if(height<540)
      height=540
    document.all.sliderOpen.style.height=Height
  }
}
window.onresize=resizeSlider
var crumbs = (GetCookie("DMSEG"))?"".concat(GetCookie("DMSEG")).split("&"):"";
var howMany = (crumbs[4])?crumbs[4]:"";
var segments = (crumbs[5])?crumbs[5]:"";
var seg = (segments)?segments.split(","):"";
var mv = new Array("firstSeg","secondSeg","thirdSeg","fourthSeg","fifthSeg","sixthSeg")
for(i=0;i<mv.length;i++){
  eval("var "+mv[i]+" = (seg["+i+"])?seg["+i+"]:''");
}
var lastSeg = (seg[seg.length - 1])?seg[seg.length - 1]:"";

var msrc=(GetCookie("etsFlag"))?GetCookie("etsFlag"):(GetArg("mod"));

var ListOfIframes = new Object()
function LoadIframes(){
 for(ifid in ListOfIframes){
  var iobj=document.getElementById("".concat(ifid))
  if(iobj){
   try {
    var isrc="".concat(ListOfIframes[ifid]);
    var idoc;
    if (iobj.contentDocument) {
      // For NS6
      idoc= iobj.contentDocument; 
    } else if (iobj.contentWindow) {
      // For IE5.5 and IE6
      idoc=iobj.contentWindow.document;
     } else if (document.frames) {
       // For IE5/Mac
       iobj=document.frames[ifid];
       idoc=iobj.document;
     } else if(document.all) {
       // For IE5
       iobj=document.all[ifid];
       idoc=iobj.document;
    } else if (iobj.document) {
      idoc=iobj.document;
    } else {
      iobj.src=isrc
    }
    if ( idoc ) idoc.location.replace(isrc);
   } catch ( errMsg ) { continue }
  }
 }
 return false;
}

var segmentid = "";
