var c, graphOptions, data = [], dots = [], tooltip, tooltipContent, canvasOffset, dataExists = true, dataZero = false, maxMin; var graph = { obj: $(""), size: { width: 0, height: 0 }, maxDots: 0 }; var isFirstTime = true, realEndPeriodDate/*=new Date(...)*/, scrollPosition = 0; var totals = $('.totals').find('.item'); var currentTotalItem = $(totals.get(0)); var mS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; var slideTabs, slideItems, slidesCont; var cmpList; var cmpDivLayer, cmpDiv, cmpDivList; $(document).ready(function () { cmpDivLayer = $("#cmp-div-layer"); cmpDiv = cmpDivLayer.find("#cmp-div"); cmpDivList = $(".cmp-div-hide"); showCampaignDiv(); setProgress($('.flc_time').data('flctime')); setNewsItems('2', userSpecialType, '1', '.newsHostPreviewContainer'); $('.tab1').click(function () { $('.csmHostPreviewContainer').hide(); $('.newsHostPreviewContainer').show(); $('.tab2').removeClass('on'); $(this).addClass('on'); }); $('.tab2').click(function () { $('.newsHostPreviewContainer').hide(); $('.csmHostPreviewContainer').show(); $('.tab1').removeClass('on'); $(this).addClass('on'); $('.cs_msg_cnt').remove(); }); $('.upd_link').click(function () { document.location.href = $(this).closest('.fnr').length > 0 ? "/creategalleryfs.asp" : "/creategallery.asp"; }); $('.ddPrice_container').find('li').click(function () { $('input[name="pvalue"]').val($(this).text()); $('#fPrice').submit(); }); totals.click(function () { if (currentTotalItem.is($(this))) return; currentTotalItem.removeClass('on'); currentTotalItem = $(this); currentTotalItem.addClass('on'); data = allData['t' + currentTotalItem.index()]; bindGraph(); }); // GRAPH graphOptions = { MonthViewMode: false, //("monthViewMode" in $attrs) ? true : false, xPadding: 7, yPadding: 20, xAxis: { rectangle: { color: "transparent", height: 0, topOffset: 0 }, value: { color: "#000", amount: 6, topOffset: 15, leftOffset: { firstItem: 20, lastItem: -20 } } }, yAxis: { line: { color: "transparent", width: 1 }, value: { color: "#a1a1a1", topOffset: { topItem: 15, generalItem : 8, bottomItem: -15 }, leftOffset: 10, amount: 3 } }, grid: { line: { width: 1, color: "#dce6f0" } }, line: { color: "#347a1f", width: 1 }, dot: { radius: 3, color: "#3399cc", negativeColor: "#a94442", offset: { left: 5, negativeTop: 10 } }, font: "12px Arial normal", tooltip: { offset: { left: 15, top: -15 }, triggerOffset: 5//pixels, area in which tooltip will be triggered } } graph.obj = $('#paymentChart'); tooltip = $("#graphTooltip"); tooltipContent = tooltip.find(".tip"); data = allData['t0']; bindGraph(); //update banners list cmpList = $('.cmp-hide'); if (cmpList.length > 0) { cmpList.each(function( index ) { var el = $( this ); $('.layer3 .banners_cont .banners').prepend(''); $('.layer3 .banners_cont .heads').prepend('
' + el.data('title') + '
'); }); } //banners slide show slideTabs = $('.layer3 .banners_cont .heads .head'); slideItems = $('.layer3 .banners_cont .banners .banner'); slidesCont = $('.layer3 .banners_cont .banners') if (slideItems.length > 1) { slideItems.first().addClass('current'); slideTabs.first().addClass('on'); bindSectionSlideshow(); //bindSlideSection(slidesCont, slideItems); slideTabs.click(function () { slideToSelected(slidesCont, slideItems, $(this)); }); } /*new referral program campaign*/ $(".copyToClipboardBtn").each(function () { $(this).click(function () { copy2Clip("hidden-referral-link"); }); }); /*end new referral program campaign*/ var WeeklyMessageGalleryPopup = $("#WeeklyMessageGalleryPopup"); WeeklyMessageGalleryPopup.find(".popup-close-btn").click(function () { WeeklyMessageGalleryPopup.hide("fast"); }); });/*end of document ready*/ function closeCampaignDiv() { if (cmpDivList && cmpDivList.length > 0) { showCampaignDiv(); } else { cmpDivLayer.fadeOut().removeClass('opened'); } } function showCampaignDiv() { if (cmpDivList && cmpDivList.length > 0) { var oneDiv = $(cmpDivList[0]).wrap('

').parent().html(); cmpDivList = cmpDivList.slice(1, cmpDivList.length); cmpDiv.html(oneDiv); if (!cmpDivLayer.hasClass('opened')) { cmpDivLayer.show('fast').addClass('opened'); } } } function bindSectionSlideshow() { si = setInterval(function () { slideRight(slidesCont, slideItems); }, 7000); slideItems.unbind('mouseenter mouseleave'); slideItems.mouseenter(function () { unbindSectionSlideshow(); }).mouseleave(function () { unbindSectionSlideshow(); si = setInterval(function () { slideRight(slidesCont, slideItems); }, 7000); }); } function unbindSectionSlideshow() { clearInterval(si); } function slideRight(container, slideItems) { var currItem = container.find('.current'), currPage = slideItems.index(currItem); var marginTarget, itemToAnime, nextItem, speed; if (currPage >= (slideItems.length - 1)) { itemToAnime = slideItems; marginTarget = '0px'; nextItem = slideItems.first(); } else { itemToAnime = currItem; marginTarget = '-50%'; nextItem = currItem.next(); } doSlide(currItem, nextItem, itemToAnime, marginTarget); } function slideLeft(container, slideItems) { var currItem = container.find('.current'), currPage = slideItems.index(currItem); var marginTarget, itemToAnime, nextItem, speed; if (currPage < 1) { itemToAnime = slideItems.slice(0, (slideItems.length - 1)); marginTarget = '-50%'; nextItem = slideItems.last(); } else { itemToAnime = currItem.prev(); marginTarget = '0px'; nextItem = currItem.prev(); } doSlide(currItem, nextItem, itemToAnime, marginTarget); } function doSlide(currItem, nextItem, itemToAnime, marginTarget) { currItem.removeClass('current'); nextItem.addClass('current'); slideTabs.eq(currItem.index()).removeClass('on'); slideTabs.eq(nextItem.index()).addClass('on'); itemToAnime.animate({ 'margin-left': marginTarget }, { duration: '700' }); } function slideToSelected(container, slideItems, selected) { var indexOfSelected = slideTabs.index(selected); var currItem = container.find('.current'), currPage = slideItems.index(currItem); if (currPage == indexOfSelected) { return; } if (currPage < indexOfSelected) { for (var i = currPage; i < indexOfSelected; i++) slideRight(container, slideItems); } else { for (var i = indexOfSelected; i < currPage ; i++) slideLeft(container, slideItems); } } function setProgress(progress)//need to get float number from 0 to 1 { if (progress > 1) progress = 1; var angle = Math.round(progress * 360); if (progress <= 0.5) { $("#pieSlice1 .pie").css("transform", "rotate(" + angle + "deg)"); } else { angle = angle - 180; $("#pieSlice1 .pie").css("transform", "rotate(" + 180 + "deg)"); $("#pieSlice2 .pie").css("transform", "rotate(" + angle + "deg)"); } } function bindGraph() { if (data == null || data == undefined || data.length <= 0) { console.log("No Data!"); return; } if (graph.obj.length <= 0 || tooltip.length <= 0 || tooltipContent.length <= 0) { console.log("One of main objects does not exist"); return; } canvasOffset = graph.obj.offset(); c = graph.obj[0].getContext('2d'); //on resize $(window).resize(function () { canvasOffset = graph.obj.offset(); c = graph.obj[0].getContext('2d'); //set canvas size as it's parents size var tt = setTimeout(function () { drawGraph(c, true); }, 200);//timeout for catching scroll Bar }).resize(); $(window).scroll(function () { //when window is scrolled scrollPosition = $(document).scrollTop(); }); //tooltips handler graph.obj.parent().mousemove(function (e) { mouseMoveHandler(e); }); } // show tooltip when mouse hovers over dot function mouseMoveHandler(e) { canvasOffset = graph.obj.offset(); var mouseX = parseInt(e.clientX - canvasOffset.left); var mouseY = parseInt(e.clientY - canvasOffset.top) + scrollPosition; var insideDot = false; for (var i = 0; i < dots.length; i++) { var dot = dots[i]; var dx = mouseX - dot.x; var dy = mouseY - dot.y; if (dx * dx + dy * dy < (dot.r * dot.r + graphOptions.tooltip.triggerOffset)) {//if mouse is inside the dot if (tooltipContent.data("field1") != dot.field1 || tooltipContent.data("field2") != dot.field2)//preventing unnecessary DOM injections { tooltipContent.data("field1", dot.field1); tooltipContent.data("field2", dot.field2); tooltipContent.html(dot.graphTooltip); } tooltip.css({ "left": dot.x - tooltip.outerWidth() + graphOptions.tooltip.offset.left, "top": dot.y - tooltip.outerHeight() + graphOptions.tooltip.offset.top, "display": "block" }); /*Special treatment*/ if ((i > 0 && i < (dots.length - 1)) || (i == (dots.length - 1) && dots.length > 1 && (graph.size.width - graphOptions.xPadding - getXPixel(i)) > graphOptions.dot.radius * 2))//general case or is last tooltip, but there is space on the right side tooltip.removeClass("first").removeClass("last"); else if (i == (dots.length - 1) && dots.length > 1)//last tooltip tooltip.removeClass("first").addClass("last"); else if (i == 0)//first tooltip tooltip.removeClass("last").addClass("first"); insideDot = true; } } if (!insideDot) { tooltip.css({ "display": "none" }); } } function dateFormatter(date, format) { /*format : 1 - Jan 10 2 - Jan 10, 2015 3 - Dec 17, 14 4 - Dec 17, 2014 */ var d = new Date(date); var dateStr = d.toDateString(); var year = d.getFullYear(); switch (format) { case 1: return dateStr.slice(4, 10); case 2: return dateFormatter(d, 1) + ", " + year; case 3: year = year.toString().substring(2); return mS[d.getMonth()] + ' ' + d.getDate() + ', ' + year; case 4: return mS[d.getMonth()] + ' ' + d.getDate() + ', ' + year; default: return dateStr; } } function formatAmount(num) { ///

Format the amount numbr. /// if (typeof num !== "undefined") { num = +(Math.round(num + "e+2") + "e-2"); num = num.toFixed(2); num = num.replace('.00', ''); return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); } else { return ' '; } } function setNegativeSign(num, noCurrency) { /// Get the $ sign location fro negative number. /// if (typeof num !== "undefined") { if (num != 0) { num = formatAmount(num); if (num.indexOf('-') > -1) { return '-$' + num.replace('-', ''); } else { return '$' + num; } } else { return noCurrency ? '0' : '$0'; } } } function dollarFormatter(val, fixedDecimalNumber) { fixedDecimalNumber = val >= 2 ? fixedDecimalNumber : 2;//for small values - need to show the number itself return (setNegativeSign(val.toFixed(fixedDecimalNumber))); //10$ or 10.00$ } //draws the Y axis lines function drawAxis(context, lineWidth, startPoint, color, endPoint) { context.lineWidth = lineWidth; context.beginPath(); context.moveTo(startPoint.x, startPoint.y); context.lineTo(endPoint.x, endPoint.y); context.strokeStyle = color; context.stroke(); } //draws the X axis rectangle function drawXaxis(context, startPoint, color, endPoint) { context.fillStyle = color; context.fillRect(startPoint.x, startPoint.y, endPoint.x, endPoint.y) } //draws the Y axis Values function drawYaxisValues(context) { context.textBaseline = "middle"; context.fillStyle = !dataZero ? graphOptions.yAxis.value.color : "transparent"; var amount = 0; var i = maxMin.Min; var step = (maxMin.Max - maxMin.Min) / (graphOptions.yAxis.value.amount - 1); while (amount < graphOptions.yAxis.value.amount) { amount++; context.textAlign = "left"; var y_offset = graphOptions.yAxis.value.topOffset.generalItem; if (amount === graphOptions.yAxis.value.amount)//top item { y_offset = graphOptions.yAxis.value.topOffset.topItem; } else if (amount === 1)//bottom item { y_offset = graphOptions.yAxis.value.topOffset.bottomItem; } context.fillText(dollarFormatter(i, 0), graphOptions.xPadding, getYPixel(i) + y_offset); context.textAlign = "right"; context.fillText(dollarFormatter(i, 0), graph.size.width - graphOptions.xPadding, getYPixel(i) + y_offset); i += step; } } //draws the grid - horizontal only function drawGrid(context) { if (dataZero) return; context.lineWidth = graphOptions.grid.line.width; var amount = 1; context.fillStyle = graphOptions.yAxis.value.color; var i = maxMin.Min; var step = (maxMin.Max - maxMin.Min) / (graphOptions.yAxis.value.amount - 1); while (amount <= graphOptions.yAxis.value.amount) { amount++; context.beginPath(); context.moveTo(graphOptions.xPadding, getYPixel(i)); context.lineTo(graph.size.width, getYPixel(i)); context.strokeStyle = graphOptions.grid.line.color; context.stroke(); i += step; } } //get Max and Min for Y axis values function getMaxMinY() { var max = data[0].y; var min = data[0].y; for (var i = 1; i < data.length; i++) { if (data[i].y > max) { max = data[i].y; } if (data[i].y < min) { min = data[i].y; } } var realMax = max;//real max - for real comparision with min //max *= 1.1;//without this dots at Max are cutted max = getCeilNumber(max); var realMin = min; min = 0; return { Max: max, Min: min, RealMax: realMax, RealMin: realMin }; } /* * gets the max value, get first digit, round the number till this digit +1, add zeros * Result examples: for number in 11,12(inclusive) - the max will be 20. */ function getCeilNumber(number) { var integer = parseInt(Math.ceil(number)); var firstDigit = getFirstDigit(integer); var numberLength = getNumberLength(integer); if (numberLength == 1) return 10; var power = Math.pow(10, numberLength - 1); var ceilDigit = firstDigit + 1; if (number == firstDigit * power) return number; else return ceilDigit * power; } function getNumberLength(integer) { return integer.toString().length; } function getFirstDigit(integer) { return parseInt(integer.toString()[0]); } function thereIsData() { return !(maxMin.Min == maxMin.Max && maxMin.RealMin == 0); }//checks if all real data is zero function visibleDataZero() { return (maxMin.Min == maxMin.Max && maxMin.Min == 0); }//checks if visible data is zero //gets Y pixel position of value, the bottom line from Zero function getYPixel(val) { var nettoHeight = graph.size.height - graphOptions.yPadding; if (!dataExists || dataZero)//no data case return nettoHeight; else if (val == 0) return nettoHeight; else if (val < 0) return nettoHeight + graphOptions.dot.offset.negativeTop; else if (val < 0.5) return nettoHeight - val * graphOptions.dot.offset.negativeTop;//fixing view issues var min = (maxMin.Min == maxMin.RealMax) ? 1 : maxMin.Min;//fixing position for case, if all values are equal, so will be no divide into Zero //return nettoHeight - (nettoHeight / (maxMin.Max - min)) * (val - min) + 5;//5 is for prevent cut on max value return nettoHeight - (nettoHeight / (maxMin.Max - min)) * (val - min);//5 is for prevent cut on max value } //returns end date for graph, according to start date and view mode function getEndGraphDate(startDate) { var startDate = new Date(startDate); var startMonth = startDate.getMonth();//0-11 var startYear = startDate.getFullYear(); var startDay = startDate.getDate();//1-31 var ppEndDate; if (graphOptions.MonthViewMode && null != realEndPeriodDate && "undefined" != realEndPeriodDate && realEndPeriodDate instanceof Date) ppEndDate = realEndPeriodDate; else ppEndDate = (startDay == 1) ? new Date(startYear, startMonth + 1, 0) : new Date(startYear, startMonth + 1, 15); var endDate = !graphOptions.MonthViewMode ? data[data.length - 1].x : ppEndDate; return endDate; } //gets X pixel position of value, works with dates only, there is a case for data with length = 1 function getXPixel(val) { if (data.length == 1 && !graphOptions.MonthViewMode)//case of 1 dot and not month view mode { return graphOptions.xPadding + graphOptions.dot.offset.left; } var endDate = getEndGraphDate(data[0].x); var daysToCover = Date.daysBetween(new Date(endDate), new Date(data[0].x)); var lastPosition = graph.size.width - graphOptions.xPadding - graphOptions.dot.offset.left; var dayInPixels = lastPosition / daysToCover; dayInPixels = dayInPixels <= 0 ? 1 : dayInPixels;//if rounded difference is less than 1 pixel var daysFromMin = Date.daysBetween(new Date(data[val].x), new Date(data[0].x)); var xPos = daysFromMin * dayInPixels + graphOptions.dot.offset.left; if (val == (data.length - 1)) if (graphOptions.MonthViewMode) xPos -= 2 * graphOptions.dot.offset.left; else xPos = lastPosition; return xPos; } /*draws X values:*/ function drawXaxisValues(context) { var formatType = graphOptions.MonthViewMode ? 1 : 1; context.fillStyle = graphOptions.xAxis.value.color; var yPos = graph.size.height - graphOptions.yPadding + graphOptions.xAxis.value.topOffset + graphOptions.dot.radius / 2; var startDate = new Date(data[0].x); var endDate = new Date(getEndGraphDate(startDate)); context.textAlign = "left"; context.fillText(dateFormatter(startDate, formatType), graphOptions.xPadding, yPos); var endDatePosition = graph.size.width - graphOptions.xPadding; if (data.length > 1 || graphOptions.MonthViewMode) { context.textAlign = "right"; context.fillText(dateFormatter(endDate, formatType), endDatePosition, yPos); } else return; //this part is only for arrays with length more than 1 or for Month View Mode context.textAlign = "left"; var days = Date.daysBetween(endDate, startDate); var divider = (graphOptions.xAxis.value.amount - 1) != 0 ? (graphOptions.xAxis.value.amount - 1) : 1; var dayOffset = 1; var xOffset = graph.size.width / divider; var currDate = startDate; var currDay = 0; var currDayStep = 1; var min; var lastDay = currDay; var lastDatePosition = graphOptions.xPadding; if (graphOptions.MonthViewMode)//if month view - always show the "graphOptions.xAxis.value.amount" of values { min = graphOptions.xAxis.value.amount; dayOffset = Math.round((days - 1) / divider); dayOffset = dayOffset != 0 ? dayOffset : 1; } else { min = (graphOptions.xAxis.value.amount < data.length) ? graphOptions.xAxis.value.amount : data.length; if (data.length > (graphOptions.xAxis.value.amount + graphOptions.xAxis.value.amount / 2))//when dta.length is les when 1.5 of Value amounts - the step is 1 currDayStep = Math.ceil(data.length / min); } try { for (var i = 0; i < (min - 2) ; i++) {//-2 is the first and the last items if (graphOptions.MonthViewMode) { currDay += dayOffset; currDate.setDate(currDate.getDate() + dayOffset); } else { currDay += currDayStep; currDate = new Date(data[currDay].x); } var currPos = -1; try { currPos = getXPixel(currDay);//this position is more accurate, generally in use for Month Videw mode } catch (e) { currPos = (i + 1) * xOffset;//this position is less accurate } if ((currPos >= (lastDatePosition + 70)) && ((currPos + 70 * 2) < endDatePosition))//70 is approx. formatted date width, *2 = width of last + width of one, need to be inserted before { context.fillText(dateFormatter(currDate, formatType), currPos, yPos); lastDay = currDay; lastDatePosition = getXPixel(lastDay); } } } catch (e) { console.log("drawXaxisValues exception"); } } //return days difference between 2 dates Date.daysBetween = function (date1, date2) { var one_day = 1000 * 60 * 60 * 24;//1 day in milliseconds var difference_ms = date1.getTime() - date2.getTime(); return Math.round(difference_ms / one_day); } //draws lines, not axis function drawLines(context) { /*draw lines*/ context.strokeStyle = graphOptions.line.color; context.lineWidth = graphOptions.line.width; context.beginPath(); context.moveTo(getXPixel(0), getYPixel(data[0].y)); for (var i = 1; i < data.length; i++) { context.lineTo(getXPixel(i), getYPixel(data[i].y)); } context.stroke(); /*adding circles*/ for (var i = 0; i < data.length; i++) { context.beginPath(); context.arc(getXPixel(i), getYPixel(data[i].y), graphOptions.dot.radius, 0, Math.PI * 2, true); context.fillStyle = data[i].y >= 0 && !(data[i].c) ? graphOptions.dot.color : graphOptions.dot.negativeColor; context.fill(); } } function defineTooltips() {// define tooltips for each data point dots = []; for (var i = 0; i < data.length; i++) { dots.push({ x: getXPixel(i), y: getYPixel(data[i].y), r: graphOptions.dot.radius, graphTooltip: dateFormatter(data[i].x, 2) + "
" + dollarFormatter(data[i].y, 2) + "", field1: dateFormatter(data[i].x, 2), field2: data[i].y }); } } //main function function drawGraph(context, dataChanged) { context.canvas.width = graph.obj.parent().width(); context.canvas.height = graph.obj.parent().height(); graph.size.height = context.canvas.height; graph.size.width = context.canvas.width; graph.maxDots = context.canvas.width / (graphOptions.dot.radius * 2); if (graph.maxDots < data.length) filterData(); if (dataChanged) { isFirstTime = false; maxMin = getMaxMinY(); dataExists = thereIsData(); dataZero = visibleDataZero(); } context.font = graphOptions.font; context.textAlign = "center"; //axis x and y drawAxis(context, graphOptions.yAxis.line.width, { x: graphOptions.xPadding, y: 0 }, graphOptions.yAxis.line.color, { x: graphOptions.xPadding, y: graph.size.height - graphOptions.yPadding }); drawXaxis(context, { x: graphOptions.xPadding, y: graph.size.height - graphOptions.yPadding + graphOptions.dot.radius + graphOptions.xAxis.rectangle.topOffset }, graphOptions.xAxis.rectangle.color, { x: graph.size.width, y: graph.size.height - graphOptions.yPadding + graphOptions.xAxis.rectangle.height + graphOptions.xAxis.rectangle.topOffset }); drawGrid(context); /*Axis values*/ drawXaxisValues(context); if (dataExists) { drawYaxisValues(context); drawLines(context); defineTooltips(); todayActions();//for month view mode only } else { addNoEarningsMessage(context); } } function addNoEarningsMessage(c) { c.font = "20px Arial bold"; c.textAlign = "center"; c.fillStyle = "#2f598b"; var text = ""; if (graphOptions.MonthViewMode) text = "No earnings since " + dateFormatter(data[0].x, 2); else text = "No earnings for this period"; c.fillText(text, c.canvas.width / 2, c.canvas.height / 2); } //throw away some elements, because the graph may display only certain amount of dots on specific graph width function filterData() { var toThrow = data.length - graph.maxDots; var tempData = []; //push first point tempData.push(data[0]); var i = 1; var thrown = 0; //points that are thrown out from original data array var step = Math.ceil(toThrow / graph.maxDots);//each step will be trown (step -1 ) points step = step > 2 ? step : 2; //min step is 2, in order to throw out 1 dot while (i < (data.length - 2 * step)) /*minus first and last points*/ { if (i < (data.length - 1))//last item will be inserted at the end tempData.push(data[i]); i += step; thrown += (step - 1); if (thrown >= toThrow)//if all spare points are thrown out already - just copy the rest points step = 1; } //push last point tempData.push(data[data.length - 1]); data = tempData; } //adds word TODAY and additional circle to last dot function todayActions() { if (!graphOptions.MonthViewMode) return; addTodayWord(); addAdditionalCircle(); } function addTodayWord()//adds word TODAY to last dot { if (graph.obj.parent().find(".today_text").length <= 0) graph.obj.parent().append("TODAY"); var lefPos = getXPixel(data.length - 1); var topPos = getYPixel(data[data.length - 1].y); var todayTextObj = graph.obj.parent().find(".today_text"); if ((lefPos + todayTextObj.width()) > (graph.size.width - graphOptions.xPadding)) { lefPos -= todayTextObj.width(); } if ((topPos + todayTextObj.height()) > (graph.size.height - graphOptions.yPadding)) { topPos -= todayTextObj.height(); } todayTextObj.css({ left: lefPos, top: topPos }); } function addAdditionalCircle()//adds additional circle to last dot { if (graph.obj.parent().find(".today_circle").length <= 0) graph.obj.parent().append("
"); graph.obj.parent().find(".today_circle").css({ "border-color": data[data.length - 1].y >= 0 ? graphOptions.dot.color : graphOptions.dot.negativeColor, width: graphOptions.dot.radius * 2 * 2, height: graphOptions.dot.radius * 2 * 2, left: getXPixel(data.length - 1) - graphOptions.dot.radius * 2, top: getYPixel(data[data.length - 1].y) - graphOptions.dot.radius * 2 }); } function setNewsItems(newsUserMainType, newsUserType, NewsViewType, targetExpression) { var url = '/Services/NewsItemsRetriever.ashx'; if (newsUserMainType == "2") { url += "?preview=" + NewsViewType; } else { try { url = (full_server != null && full_server != undefined && full_server != '' ? full_server : '') + url; } catch (e) { } url = url + "?ac=GetNewsItems&newsUserMainType=" + newsUserMainType + "&NewsViewType=" + NewsViewType + "&newsUserType=" + newsUserType; //use proxy for crossdomain if (url.indexOf("http:") > -1) { url = '/Services/Proxy.ashx?url=' + encodeURIComponent(url); } } jQuery.get(url, function (data) { jQuery(targetExpression).html(data) }); } function closeCampaign(obj) { var openedDiv = $('.blockPage').find('div').get(0); $.unblockUI({ onUnblock: function () { $(openedDiv).hide(); } }); } /// - no checks - set as read function GetReadClick(obj) { console.log($(obj).is(':checked')); if ($(obj).is(':checked')) { $('.btnReadSubmit').css({ 'background-color': '#3399cc', 'cursor': 'pointer' }); } else { $('.btnReadSubmit').css({ 'background-color': '#99cce5', 'cursor': 'none' }); } } function SetAsRead() { if ($('.ibit9').eq(1).is(':checked')) { $.post("/Services/GeneralService.asp?action=checkssetasread", function (data) { console.log(data); closeCampaignDiv(); }); } }