scheduler.toPDF=function(C,J,P,L){var I=0;var H=0;var F=false;if(J=="fullcolor"){F=true;J="color"}J=J||"color";function M(T){T=parseFloat(T);if(isNaN(T)){return"auto"}return 100*T/I}function Q(T){T=parseFloat(T);if(isNaN(T)){return"auto"}return 100*T/H}function O(U){var T="";for(var V=0;V<U.length;V++){T+="\n<column><![CDATA["+U[V].innerHTML+"]]></column>"}I=U[0].offsetWidth;return T}function G(V,W){var T=parseInt(V.style.left);for(var U=0;U<scheduler._cols.length;U++){T-=scheduler._cols[U];if(T<0){return U}}return W}function N(U,W){var V=parseInt(U.style.top);for(var T=0;T<scheduler._colsS.heights.length;T++){if(scheduler._colsS.heights[T]>V){return T}}return W}function A(W){var U="";var X=W.firstChild.rows;for(var V=0;V<X.length;V++){var Y=[];for(var T=0;T<X[V].cells.length;T++){Y.push(X[V].cells[T].firstChild.innerHTML)}U+="\n<row height='"+W.firstChild.rows[V].cells[0].offsetHeight+"'><![CDATA["+Y.join("|")+"]]></row>";H=W.firstChild.rows[0].cells[0].offsetHeight}return U}function S(X){var U="<data profile='"+X+"'";if(P){U+=" header='"+P+"'"}if(L){U+=" footer='"+L+"'"}U+=">";U+="<scale mode='"+scheduler._mode+"' today='"+scheduler._els.dhx_cal_date[0].innerHTML+"'>";if(scheduler._mode=="agenda"){var T=scheduler._els.dhx_cal_header[0].childNodes[0].childNodes;U+="<column>"+T[0].innerHTML+"</column><column>"+T[1].innerHTML+"</column>"}else{if(scheduler._mode=="year"){var T=scheduler._els.dhx_cal_data[0].childNodes;for(var V=0;V<T.length;V++){U+="<month label='"+T[V].childNodes[0].innerHTML+"'>";U+=O(T[V].childNodes[1].childNodes);U+=A(T[V].childNodes[2]);U+="</month>"}}else{U+="<x>";var T=scheduler._els.dhx_cal_header[0].childNodes;U+=O(T);U+="</x>";var W=scheduler._els.dhx_cal_data[0];if(W.firstChild.tagName=="TABLE"){U+=A(W)}else{W=W.childNodes[W.childNodes.length-1];while(W.className.indexOf("dhx_scale_holder")==-1){W=W.previousSibling}W=W.childNodes;U+="<y>";for(var V=0;V<W.length;V++){U+="\n<row><![CDATA["+W[V].innerHTML+"]]></row>"}U+="</y>";H=W[0].offsetHeight}}}U+="</scale>";return U}function E(U,T){return(window.getComputedStyle?(window.getComputedStyle(U,null)[T]):(U.currentStyle?U.currentStyle[T]:null))||""}function B(){var b="";var j=scheduler._rendered;if(scheduler._mode=="agenda"){for(var Z=0;Z<j.length;Z++){b+="<event><head>"+j[Z].childNodes[0].innerHTML+"</head><body>"+j[Z].childNodes[2].innerHTML+"</body></event>"}}else{if(scheduler._mode=="year"){var j=scheduler.get_visible_events();for(var Z=0;Z<j.length;Z++){var f=j[Z].start_date;if(f.valueOf()<scheduler._min_date.valueOf()){f=scheduler._min_date}while(f<j[Z].end_date){var U=f.getMonth()+12*(f.getFullYear()-scheduler._min_date.getFullYear())-scheduler.week_starts._month;var g=scheduler.week_starts[U]+f.getDate()-1;b+="<event day='"+(g%7)+"' week='"+Math.floor(g/7)+"' month='"+U+"'></event>";scheduler._mark_year_date(f);f=scheduler.date.add(f,1,"day");if(f.valueOf()>=scheduler._max_date.valueOf()){break}}}}else{for(var Z=0;Z<j.length;Z++){var X=M(j[Z].style.left);var V=Q(j[Z].style.top);var e=M(j[Z].style.width);var a=Q(j[Z].style.height);var Y=j[Z].className.split(" ")[0].replace("dhx_cal_","");var c=scheduler.getEvent(j[Z].getAttribute("event_id"));var g=c._sday;var T=c._sweek;if(scheduler._mode!="month"){if(parseInt(j[Z].style.left)<=26){X=2;e+=M(j[Z].style.left)-1}if(j[Z].parentNode==scheduler._els.dhx_cal_data[0]){continue}X+=M(j[Z].parentNode.style.left);X-=M(51)}else{a=parseInt(j[Z].offsetHeight);V=parseInt(j[Z].style.top)-22;g=G(j[Z],g);T=N(j[Z],T)}b+="\n<event week='"+T+"' day='"+g+"' type='"+Y+"' x='"+X+"' y='"+V+"' width='"+e+"' height='"+a+"'>";if(Y=="event"){b+="<header><![CDATA["+j[Z].childNodes[1].innerHTML+"]]></header>";var W=F?E(j[Z].childNodes[2],"color"):"";var h=F?E(j[Z].childNodes[2],"backgroundColor"):"";b+="<body backgroundColor='"+h+"' color='"+W+"'><![CDATA["+j[Z].childNodes[2].innerHTML+"]]></body>"}else{var W=F?E(j[Z],"color"):"";var h=F?E(j[Z],"backgroundColor"):"";b+="<body backgroundColor='"+h+"' color='"+W+"'><![CDATA["+j[Z].innerHTML+"]]></body>"}b+="</event>"}}}return b}function K(){var T="</data>";return T}var D=(new Date()).valueOf();var R=document.createElement("div");R.style.display="none";document.body.appendChild(R);R.innerHTML='<form id="'+D+'" method="post" target="_blank" action="'+C+'" accept-charset="utf-8" enctype="text/html"><input type="hidden" name="mycoolxmlbody"/> </form>';document.getElementById(D).firstChild.value=S(J).replace("\u2013","-")+B()+K();document.getElementById(D).submit();R.parentNode.removeChild(R);grid=null};