document.write (""); document.write (""); var oldrow, oldlink, chartLabel, vtime, thisTime, thisFreq; var errorHeight = '234px'; var normalHeight = '224px'; //Initialize oldlink and oldrow oldrow = '1yr'; oldlink = 'L-1yr'; vtime = '1yr'; thisTime = '1yr'; thisFreq = '1dy'; function redrawCompare(blnShowDate) { redraw(oldrow, blnShowDate); var sMain = document.getElementById('mwMidChartMainIdx').options[document.getElementById('mwMidChartMainIdx').selectedIndex].value; var aMain = sMain.split('~'); //document.write(aMain); sMain = aMain[0]; var sSid = aMain[1]; var dispName = document.getElementById('mwMidChartMainIdx').options[document.getElementById('mwMidChartMainIdx').selectedIndex].text; if (dispName == "Global Dow") { dispName = "The Global Dow"; } else if (dispName == "Global Dow (Euro)"){ dispName = "The Global Dow (Euro)"; } var s = document.createElement('script'); s.type = 'text/javascript'; s.src = 'http://custom.marketwatch.com/custom/wsj-com/charts/jsinc-chrt-renovation-mod55.asp?js=1&sid=' + sSid + '&symb=' + sMain + '&displayName=' + escape(dispName); document.body.appendChild(s); } function redraw(newtime, blnUpdateDate){ var mode, stime, sfreq, scomp, sdate, edate, sSid, sMain, aMain, chartLink, headerLink, sMainText,bDrawChart,intDateDifference,uf; mode = document.EtfChart.mode.value; sMainText = document.getElementById('mwMidChartMainIdx').options[document.getElementById('mwMidChartMainIdx').selectedIndex].text; scomp = document.getElementById('CompIdx').options[document.getElementById('CompIdx').selectedIndex].value; sMain = document.getElementById('mwMidChartMainIdx').options[document.getElementById('mwMidChartMainIdx').selectedIndex].value; aMain = sMain.split('~'); sMain = aMain[0]; sSid = aMain[1]; document.getElementById('ChartSymbolLabel').innerHTML = sMainText; bDrawChart = true; if (mode == 1){ sdate = ''; edate = ''; stime = newtime.toLowerCase(); stime = stime.replace(' day','dy') stime = stime.replace(' months','mo') stime = stime.replace(' month','mo') stime = stime.replace(' years','yr') stime = stime.replace(' year','yr') stime = stime.replace(' week','wk') if (stime.indexOf('1dy') > -1){ sfreq='1mi'; uf='8192'; } else if (stime.indexOf('1wk') > -1) sfreq='15mi'; else sfreq='1dy'; if (stime.indexOf('wk') > -1){ sfreq='15mi' stime = '5dy' } oldrow = newtime; updateLinks(newtime); thisFreq = sfreq; thisTime = stime; vtime = '1yr'; } else { sfreq='1dy'; stime=thisTime; sdate = document.getElementsByName('sdate')[0].value; edate = document.getElementsByName('edate')[0].value; if (sdate == '' && edate == '') { bDrawChart = true; stime = '1yr'; sFreq = '1dy'; } else { if (isDate(sdate) == false || isDate(edate) == false) { bDrawChart = false; stime = '1yr'; sFreq = '1dy'; document.getElementById('DateError').innerHTML = 'Enter the dates in mm/dd/yyyy format.'; sdate = ''; edate = ''; } else { sdate= Date.parse(sdate); edate= Date.parse(edate); if (sdate < edate) { var day, month, year; if ( document.getElementsByName('sdate')[0].value != '') { var startDate = new Date(document.getElementsByName('sdate')[0].value); day = startDate.getDate(); month = startDate.getMonth(); year = startDate.getFullYear(); if (IsNumeric(month)) {month = month + 1;} if (year < 1920) { year = 100 + year;} sdate = month + '/' + day + '/' + year; } else { sdate = ''; } if ( document.getElementsByName('edate')[0].value != '') { var endDate = new Date(document.getElementsByName('edate')[0].value); endDate.setDate(endDate.getDate() + 1); day = endDate.getDate(); month = endDate.getMonth(); year = endDate.getFullYear(); if (IsNumeric(month)) {month = month + 1;} if (year < 1920) { year = 100 + year;} edate = month + '/' + day + '/' + year; } else { edate = ''; } var currentDate = new Date(); var endDateForCalc = new Date(edate); var startDateForCalc = new Date(sdate); var intDateDifference, intDateDifferenceFromNow; intDateDifferenceFromNow = (currentDate.getTime() - startDateForCalc.getTime())/(24*60*60*1000); intDateDifference = (endDateForCalc.getTime() - startDateForCalc.getTime())/(24*60*60*1000); if ( intDateDifference > 15 || intDateDifferenceFromNow > 15) { sfreq = '1dy'; } else { sfreq = '15mi'; stime = '1dy'; } oldrow = newtime; bDrawChart = true; } else { bDrawChart = false; stime = '1yr'; sFreq = '1dy'; sdate = ''; edate = ''; document.getElementById('DateError').innerHTML = 'Enter a valid date range.'; } } } } document.images.chart.src = 'http://chart.bigcharts.com/custom/wsj-com/charts/chrt-renovation-mod55.img?time=' + stime + '&freq=' + sfreq + '&style=2287&size=3&sid=' + sSid + '&symb=' + sMain + '&comp=' + scomp + '&type=256&startdate=' + sdate + '&enddate=' + edate + '&mocktick=1&uf=' + uf; var s = document.createElement('script'); s.type = 'text/javascript'; var dispName = document.getElementById('mwMidChartMainIdx').options[document.getElementById('mwMidChartMainIdx').selectedIndex].text; if (dispName == "Global Dow") { dispName = "The Global Dow"; } else if (dispName == "Global Dow (Euro)") { dispName = "The Global Dow (Euro)"; } if (blnUpdateDate) { if ((sdate!='') && (edate!='')) { s.src = 'http://custom.marketwatch.com/custom/wsj-com/charts/jsinc-chrt-renovation-mod55.asp?js=1&sid=' + sSid + '&symb=' + sMain + '&startdate=' + sdate + '&endDate=' + edate + '&displayName=' + escape(dispName); } else { s.src = 'http://custom.marketwatch.com/custom/wsj-com/charts/jsinc-chrt-renovation-mod55.asp?js=1&sid=' + sSid + '&symb=' + sMain + '&displayName=' + escape(dispName); } } document.body.appendChild(s); document.getElementById('lnkFullInteractive').href = '/mdc/public/npage/2_3051.html?mod=2_3002' + '&sid=' + sSid + '&page=' + 'us'; document.getElementById('chartLinkWrapper').href = '/mdc/public/npage/2_3051.html?mod=2_3002' + '&sid=' + sSid + '&page=' + 'us'; if (bDrawChart) { document.getElementById('DateError').style.display = 'none'; }else { document.getElementById('DateError').style.display = 'inline'; } } function IsNumeric(strString) { var strValidChars = "0123456789"; var strChar; var blnResult = true; if (strString.length == 0) return false; for (i = 0; i < strString.length && blnResult == true; i++) { strChar = strString.charAt(i); if (strValidChars.indexOf(strChar) == -1) { blnResult = false; } } return blnResult; } function updateLinks(id) { if (document.getElementById){ var newlink; if ((oldlink != '') && (oldlink != 'L-')) document.getElementById(oldlink).className = ''; if (id != ''){ document.getElementById('L-'+id).className = 'selected'; } oldlink = 'L-'+id; } } function ReDrawChartVars(){ redraw(vtime, true); var mode = document.EtfChart.mode.value; document.getElementsByName('sdate')[0].value=''; document.getElementsByName('edate')[0].value=''; if (mode == 1){ document.getElementById('ChartVars').style.display = 'inline'; document.getElementById('ChartVarsCustom').style.display = 'none'; } else { document.getElementById('ChartVars').style.display = 'none'; document.getElementById('ChartVarsCustom').style.display = 'inline'; } } var dtCh= "/"; var minYear=1900; var maxYear=2100; function isInteger(s){ var i; for (i = 0; i < s.length; i++){ // Check that current character is number. var c = s.charAt(i); if (((c < "0") || (c > "9"))) return false; } // All characters are numbers. return true; } function stripCharsInBag(s, bag){ var i; var returnString = ""; for (i = 0; i < s.length; i++){ var c = s.charAt(i); if (bag.indexOf(c) == -1) returnString += c; } return returnString; } function daysInFebruary (year){ return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 ); } function DaysArray(n) { for (var i = 1; i <= n; i++) { this[i] = 31 if (i==4 || i==6 || i==9 || i==11) {this[i] = 30} if (i==2) {this[i] = 29} } return this } function isDate(dtStr){ var daysInMonth = DaysArray(12) var pos1=dtStr.indexOf(dtCh) var pos2=dtStr.indexOf(dtCh,pos1+1) var strMonth=dtStr.substring(0,pos1) var strDay=dtStr.substring(pos1+1,pos2) var strYear=dtStr.substring(pos2+1) strYr=strYear if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1) if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1) for (var i = 1; i <= 3; i++) { if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1) } month=parseInt(strMonth) day=parseInt(strDay) year=parseInt(strYr) if (pos1==-1 || pos2==-1){ return false } if (strMonth.length<1 || month<1 || month>12){ return false } if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){ return false } if (strYear.length != 4 || year==0 || yearmaxYear){ return false } if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){ return false } return true } function ValidateForm(thisDate){ var dt=document.frmSample.txtDate if (isDate(dt.value)==false){ dt.focus() return false } return true } function changeDD(ddCompIdx,bSuppress) { if (bSuppress) { document.getElementById("L-1dy").innerHTML = "1dy"; redraw('1yr',true); document.getElementById("L-1dy").style.color = "#CCCCCC"; } else { document.getElementById("L-1dy").innerHTML = "1dy"; } } function blnSuppress(ddCompIdx) { var bSuppress = false; if ((ddCompIdx.options[ddCompIdx.options.selectedIndex].value == "GDOW~3463459")||(ddCompIdx.options[ddCompIdx.options.selectedIndex].value == "GDOWE~3463460")) { bSuppress = true; } return bSuppress; } function checkToSuppress() { var ddcompidx1 = document.EtfChart.mwMidChartMainIdx; var ddcompidx2 = document.EtfChart.CompIdx; var bSupp = false; if ( (blnSuppress(ddcompidx1)) || (blnSuppress(ddcompidx2)) ) { bSupp = true; } changeDD(ddcompidx1, bSupp); changeDD(ddcompidx2, bSupp); } document.writeln ("
"); document.writeln ("
"); document.writeln ("

See Full Interactive Chart

"); document.writeln ("

DJ Industrial Average

"); document.writeln ("
"); document.writeln (""); document.writeln ("