//v.1.0 build 80512

/*
Copyright DHTMLX LTD. http://www.dhtmlx.com
You allowed to use this component or parts of it under GPL terms
To use it on other terms or get Professional edition of the component please contact us at sales@dhtmlx.com
*/
 
function dtmlXMLLoaderObject(funcObject, dhtmlObject,async,rSeed){this.xmlDoc="";if (typeof(async)!= "undefined")
 this.async = async;else this.async = true;this.onloadAction=funcObject||null;this.mainObject=dhtmlObject||null;this.waitCall=null;this.rSeed=rSeed||false;return this};dtmlXMLLoaderObject.prototype.waitLoadFunction=function(dhtmlObject){var once=true;this.check=function (){if ((dhtmlObject)&&(dhtmlObject.onloadAction!=null)){if ((!dhtmlObject.xmlDoc.readyState)||(dhtmlObject.xmlDoc.readyState == 4)){if (!once)return;once=false;dhtmlObject.onloadAction(dhtmlObject.mainObject,null,null,null,dhtmlObject);if (dhtmlObject.waitCall){dhtmlObject.waitCall();dhtmlObject.waitCall=null}}}};return this.check};dtmlXMLLoaderObject.prototype.getXMLTopNode=function(tagName,oldObj){if (this.xmlDoc.responseXML){var temp=this.xmlDoc.responseXML.getElementsByTagName(tagName);var z=temp[0]}else
 var z=this.xmlDoc.documentElement;if (z){this._retry=false;return z};if ((_isIE)&&(!this._retry)){var xmlString=this.xmlDoc.responseText;var oldObj=this.xmlDoc;this._retry=true;this.xmlDoc = new ActiveXObject("Microsoft.XMLDOM");this.xmlDoc.async=false;this.xmlDoc["loadXM"+"L"](xmlString);return this.getXMLTopNode(tagName,oldObj)};dhtmlxError.throwError("LoadXML","Incorrect XML",[(oldObj||this.xmlDoc),this.mainObject]);return document.createElement("DIV")};dtmlXMLLoaderObject.prototype.loadXMLString=function(xmlString){{
 try
 {var parser = new DOMParser();this.xmlDoc = parser.parseFromString(xmlString,"text/xml")}catch(e){this.xmlDoc = new ActiveXObject("Microsoft.XMLDOM");this.xmlDoc.async=this.async;this.xmlDoc["loadXM"+"L"](xmlString)}};this.onloadAction(this.mainObject,null,null,null,this);if (this.waitCall){this.waitCall();this.waitCall=null}};dtmlXMLLoaderObject.prototype.loadXML=function(filePath,postMode,postVars,rpc){if (this.rSeed)filePath+=((filePath.indexOf("?")!=-1)?"&":"?")+"a_dhx_rSeed="+(new Date()).valueOf();this.filePath=filePath;if ((!_isIE)&&(window.XMLHttpRequest))
 this.xmlDoc = new XMLHttpRequest();else{if (document.implementation && document.implementation.createDocument){this.xmlDoc = document.implementation.createDocument("", "", null);this.xmlDoc.onload = new this.waitLoadFunction(this);this.xmlDoc.load(filePath);return}else
 this.xmlDoc = new ActiveXObject("Microsoft.XMLHTTP")};if (this.async)this.xmlDoc.onreadystatechange=new this.waitLoadFunction(this);this.xmlDoc.open(postMode?"POST":"GET",filePath,this.async);if (rpc){this.xmlDoc.setRequestHeader("User-Agent", "dhtmlxRPC v0.1 (" + navigator.userAgent + ")");this.xmlDoc.setRequestHeader("Content-type", "text/xml")}else
 if (postMode)this.xmlDoc.setRequestHeader('Content-type','application/x-www-form-urlencoded');this.xmlDoc.send(null||postVars);if (!this.async)(new this.waitLoadFunction(this))()};dtmlXMLLoaderObject.prototype.destructor=function(){this.onloadAction=null;this.mainObject=null;this.xmlDoc=null;return null};function callerFunction(funcObject,dhtmlObject){this.handler=function(e){if (!e)e=window.event;funcObject(e,dhtmlObject);return true};return this.handler};function getAbsoluteLeft(htmlObject){var xPos = htmlObject.offsetLeft;var temp = htmlObject.offsetParent;while (temp != null){xPos += temp.offsetLeft;temp = temp.offsetParent};return xPos};function getAbsoluteTop(htmlObject) {var yPos = htmlObject.offsetTop;var temp = htmlObject.offsetParent;while (temp != null){yPos += temp.offsetTop;temp = temp.offsetParent};return yPos};function convertStringToBoolean(inputString){if (typeof(inputString)=="string") inputString=inputString.toLowerCase();switch(inputString){case "1":
 case "true":
 case "yes":
 case "y":
 case 1: 
 case true: 
 return true;break;default: return false}};function getUrlSymbol(str){if(str.indexOf("?")!=-1)
 return "&"
 else
 return "?"
 };function dhtmlDragAndDropObject(){if (window.dhtmlDragAndDrop)return window.dhtmlDragAndDrop;this.lastLanding=0;this.dragNode=0;this.dragStartNode=0;this.dragStartObject=0;this.tempDOMU=null;this.tempDOMM=null;this.waitDrag=0;window.dhtmlDragAndDrop=this;return this};dhtmlDragAndDropObject.prototype.removeDraggableItem=function(htmlNode){htmlNode.onmousedown=null;htmlNode.dragStarter=null;htmlNode.dragLanding=null};dhtmlDragAndDropObject.prototype.addDraggableItem=function(htmlNode,dhtmlObject){htmlNode.onmousedown=this.preCreateDragCopy;htmlNode.dragStarter=dhtmlObject;this.addDragLanding(htmlNode,dhtmlObject)};dhtmlDragAndDropObject.prototype.addDragLanding=function(htmlNode,dhtmlObject){htmlNode.dragLanding=dhtmlObject};dhtmlDragAndDropObject.prototype.preCreateDragCopy=function(e)
 {if (e && (e||event).button==2) return;if (window.dhtmlDragAndDrop.waitDrag){window.dhtmlDragAndDrop.waitDrag=0;document.body.onmouseup=window.dhtmlDragAndDrop.tempDOMU;document.body.onmousemove=window.dhtmlDragAndDrop.tempDOMM;return false};window.dhtmlDragAndDrop.waitDrag=1;window.dhtmlDragAndDrop.tempDOMU=document.body.onmouseup;window.dhtmlDragAndDrop.tempDOMM=document.body.onmousemove;window.dhtmlDragAndDrop.dragStartNode=this;window.dhtmlDragAndDrop.dragStartObject=this.dragStarter;document.body.onmouseup=window.dhtmlDragAndDrop.preCreateDragCopy;document.body.onmousemove=window.dhtmlDragAndDrop.callDrag;if ((e)&&(e.preventDefault)) {e.preventDefault();return false};return false};dhtmlDragAndDropObject.prototype.callDrag=function(e){if (!e)e=window.event;dragger=window.dhtmlDragAndDrop;if ((e.button==0)&&(_isIE)) return dragger.stopDrag();if (!dragger.dragNode && dragger.waitDrag){dragger.dragNode=dragger.dragStartObject._createDragNode(dragger.dragStartNode,e);if (!dragger.dragNode)return dragger.stopDrag();dragger.gldragNode=dragger.dragNode;document.body.appendChild(dragger.dragNode);document.body.onmouseup=dragger.stopDrag;dragger.waitDrag=0;dragger.dragNode.pWindow=window;dragger.initFrameRoute()};if (dragger.dragNode.parentNode!=window.document.body){var grd=dragger.gldragNode;if (dragger.gldragNode.old)grd=dragger.gldragNode.old;grd.parentNode.removeChild(grd);var oldBody=dragger.dragNode.pWindow;if (_isIE){var div=document.createElement("Div");div.innerHTML=dragger.dragNode.outerHTML;dragger.dragNode=div.childNodes[0]}else dragger.dragNode=dragger.dragNode.cloneNode(true);dragger.dragNode.pWindow=window;dragger.gldragNode.old=dragger.dragNode;document.body.appendChild(dragger.dragNode);oldBody.dhtmlDragAndDrop.dragNode=dragger.dragNode};dragger.dragNode.style.left=e.clientX+15+(dragger.fx?dragger.fx*(-1):0)+(document.body.scrollLeft||document.documentElement.scrollLeft)+"px";dragger.dragNode.style.top=e.clientY+3+(dragger.fy?dragger.fy*(-1):0)+(document.body.scrollTop||document.documentElement.scrollTop)+"px";if (!e.srcElement)var z=e.target;else z=e.srcElement;dragger.checkLanding(z,e)};dhtmlDragAndDropObject.prototype.calculateFramePosition=function(n){if (window.name){var el =parent.frames[window.name].frameElement.offsetParent;var fx=0;var fy=0;while (el){fx += el.offsetLeft;fy += el.offsetTop;el = el.offsetParent};if ((parent.dhtmlDragAndDrop)) {var ls=parent.dhtmlDragAndDrop.calculateFramePosition(1);fx+=ls.split('_')[0]*1;fy+=ls.split('_')[1]*1};if (n)return fx+"_"+fy;else this.fx=fx;this.fy=fy};return "0_0"};dhtmlDragAndDropObject.prototype.checkLanding=function(htmlObject,e){if ((htmlObject)&&(htmlObject.dragLanding)) {if (this.lastLanding)this.lastLanding.dragLanding._dragOut(this.lastLanding);this.lastLanding=htmlObject;this.lastLanding=this.lastLanding.dragLanding._dragIn(this.lastLanding,this.dragStartNode,e.clientX, e.clientY,e);this.lastLanding_scr=(_isIE?e.srcElement:e.target)}else {if ((htmlObject)&&(htmlObject.tagName!="BODY")) this.checkLanding(htmlObject.parentNode,e);else {if (this.lastLanding)this.lastLanding.dragLanding._dragOut(this.lastLanding,e.clientX, e.clientY,e);this.lastLanding=0;if (this._onNotFound)this._onNotFound()}}};dhtmlDragAndDropObject.prototype.stopDrag=function(e,mode){dragger=window.dhtmlDragAndDrop;if (!mode){dragger.stopFrameRoute();var temp=dragger.lastLanding;dragger.lastLanding=null;if (temp)temp.dragLanding._drag(dragger.dragStartNode,dragger.dragStartObject,temp,(_isIE?event.srcElement:e.target))};dragger.lastLanding=null;if ((dragger.dragNode)&&(dragger.dragNode.parentNode==document.body)) dragger.dragNode.parentNode.removeChild(dragger.dragNode);dragger.dragNode=0;dragger.gldragNode=0;dragger.fx=0;dragger.fy=0;dragger.dragStartNode=0;dragger.dragStartObject=0;document.body.onmouseup=dragger.tempDOMU;document.body.onmousemove=dragger.tempDOMM;dragger.tempDOMU=null;dragger.tempDOMM=null;dragger.waitDrag=0};dhtmlDragAndDropObject.prototype.stopFrameRoute=function(win){if (win)window.dhtmlDragAndDrop.stopDrag(1,1);for (var i=0;i<window.frames.length;i++)if ((window.frames[i]!=win)&&(window.frames[i].dhtmlDragAndDrop))
 window.frames[i].dhtmlDragAndDrop.stopFrameRoute(window);if ((parent.dhtmlDragAndDrop)&&(parent!=window)&&(parent!=win)) 
 parent.dhtmlDragAndDrop.stopFrameRoute(window)};dhtmlDragAndDropObject.prototype.initFrameRoute=function(win,mode){if (win){window.dhtmlDragAndDrop.preCreateDragCopy();window.dhtmlDragAndDrop.dragStartNode=win.dhtmlDragAndDrop.dragStartNode;window.dhtmlDragAndDrop.dragStartObject=win.dhtmlDragAndDrop.dragStartObject;window.dhtmlDragAndDrop.dragNode=win.dhtmlDragAndDrop.dragNode;window.dhtmlDragAndDrop.gldragNode=win.dhtmlDragAndDrop.dragNode;window.document.body.onmouseup=window.dhtmlDragAndDrop.stopDrag;window.waitDrag=0;if (((!_isIE)&&(mode))&&((!_isFF)||(_FFrv<1.8)))
 window.dhtmlDragAndDrop.calculateFramePosition()};if ((parent.dhtmlDragAndDrop)&&(parent!=window)&&(parent!=win))
 parent.dhtmlDragAndDrop.initFrameRoute(window);for (var i=0;i<window.frames.length;i++)if ((window.frames[i]!=win)&&(window.frames[i].dhtmlDragAndDrop))
 window.frames[i].dhtmlDragAndDrop.initFrameRoute(window,((!win||mode)?1:0))};var _isFF=false;var _isIE=false;var _isOpera=false;var _isKHTML=false;var _isMacOS=false;if (navigator.userAgent.indexOf('Macintosh')!= -1) _isMacOS=true;if ((navigator.userAgent.indexOf('Safari')!= -1)||(navigator.userAgent.indexOf('Konqueror')!= -1)){var _KHTMLrv=parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf('Safari')+7,5));if (_KHTMLrv > 525){_isFF=true;var _FFrv=1.9}else 
 _isKHTML=true}else if (navigator.userAgent.indexOf('Opera')!= -1){_isOpera=true;_OperaRv=parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf('Opera')+6,3))}else if(navigator.appName.indexOf("Microsoft")!=-1)
 _isIE=true;else {_isFF=true;var _FFrv=parseFloat(navigator.userAgent.split("rv:")[1])
 };function isIE(){if(navigator.appName.indexOf("Microsoft")!=-1)
 if (navigator.userAgent.indexOf('Opera')== -1)
 return true;return false};dtmlXMLLoaderObject.prototype.doXPath = function(xpathExp,docObj,namespace,result_type){if ((_isKHTML)) return this.doXPathOpera(xpathExp,docObj);if(_isIE){if(!docObj)if(!this.xmlDoc.nodeName)docObj = this.xmlDoc.responseXML
 else
 docObj = this.xmlDoc;if (!docObj)dhtmlxError.throwError("LoadXML","Incorrect XML",[(docObj||this.xmlDoc),this.mainObject]);if(namespace!=null)docObj.setProperty("SelectionNamespaces","xmlns:xsl='"+namespace+"'");if(result_type=='single'){return docObj.selectSingleNode(xpathExp)}else{return docObj.selectNodes(xpathExp)||new Array(0)}}else{var nodeObj = docObj;if(!docObj){if(!this.xmlDoc.nodeName){docObj = this.xmlDoc.responseXML
 }else{docObj = this.xmlDoc}};if (!docObj)dhtmlxError.throwError("LoadXML","Incorrect XML",[(docObj||this.xmlDoc),this.mainObject]);if(docObj.nodeName.indexOf("document")!=-1){nodeObj = docObj}else{nodeObj = docObj;docObj = docObj.ownerDocument};var retType = XPathResult.ANY_TYPE;if(result_type=='single')retType = XPathResult.FIRST_ORDERED_NODE_TYPE
 var rowsCol = new Array();var col = docObj.evaluate(xpathExp, nodeObj, function(pref){return namespace}, retType,null);if(retType == XPathResult.FIRST_ORDERED_NODE_TYPE){return col.singleNodeValue };var thisColMemb = col.iterateNext();while (thisColMemb){rowsCol[rowsCol.length] = thisColMemb;thisColMemb = col.iterateNext()};return rowsCol}};function _dhtmlxError(type,name,params){if (!this.catches)this.catches=new Array();return this};_dhtmlxError.prototype.catchError=function(type,func_name){this.catches[type]=func_name};_dhtmlxError.prototype.throwError=function(type,name,params){if (this.catches[type])return this.catches[type](type,name,params);if (this.catches["ALL"])return this.catches["ALL"](type,name,params);alert("Error type: " + arguments[0]+"\nDescription: " + arguments[1] );return null};window.dhtmlxError=new _dhtmlxError();dtmlXMLLoaderObject.prototype.doXPathOpera = function(xpathExp,docObj){var z=xpathExp.replace(/[\/]+/gi,"/").split('/');var obj=null;var i=1;if (!z.length)return [];if (z[0]==".")obj=[docObj];else if (z[0]==""){obj=(this.xmlDoc.responseXML||this.xmlDoc).getElementsByTagName(z[i].replace(/\[[^\]]*\]/g,""));i++}else return [];for (i;i<z.length;i++)obj=this._getAllNamedChilds(obj,z[i]);if (z[i-1].indexOf("[")!=-1)
 obj=this._filterXPath(obj,z[i-1]);return obj};dtmlXMLLoaderObject.prototype._filterXPath = function(a,b){var c=new Array();var b=b.replace(/[^\[]*\[\@/g,"").replace(/[\[\]\@]*/g,"");for (var i=0;i<a.length;i++)if (a[i].getAttribute(b))
 c[c.length]=a[i];return c};dtmlXMLLoaderObject.prototype._getAllNamedChilds = function(a,b){var c=new Array();if (_isKHTML)b=b.toUpperCase();for (var i=0;i<a.length;i++)for (var j=0;j<a[i].childNodes.length;j++){if (_isKHTML){if (a[i].childNodes[j].tagName && a[i].childNodes[j].tagName.toUpperCase()==b)
 c[c.length]=a[i].childNodes[j]}else
 if (a[i].childNodes[j].tagName==b)c[c.length]=a[i].childNodes[j]};return c};function dhtmlXHeir(a,b){for (var c in b)if (typeof(b[c])=="function") a[c]=b[c];return a};function dhtmlxEvent(el,event,handler){if (el.addEventListener)el.addEventListener(event,handler,false);else if (el.attachEvent)el.attachEvent("on"+event,handler)};dtmlXMLLoaderObject.prototype.xslDoc = null;dtmlXMLLoaderObject.prototype.setXSLParamValue = function(paramName,paramValue,xslDoc){if(!xslDoc)xslDoc = this.xslDoc
 if(xslDoc.responseXML)xslDoc = xslDoc.responseXML;var item = this.doXPath("/xsl:stylesheet/xsl:variable[@name='"+paramName+"']",xslDoc,"http:/\/www.w3.org/1999/XSL/Transform","single");if(item!=null)item.firstChild.nodeValue=paramValue
 
};dtmlXMLLoaderObject.prototype.doXSLTransToObject = function(xslDoc,xmlDoc)
{if(!xslDoc)xslDoc = this.xslDoc;if(xslDoc.responseXML)xslDoc = xslDoc.responseXML
 
 if(!xmlDoc)xmlDoc = this.xmlDoc;if(xmlDoc.responseXML)xmlDoc = xmlDoc.responseXML
 
 
 if(!isIE()){if(!this.XSLProcessor){this.XSLProcessor = new XSLTProcessor();this.XSLProcessor.importStylesheet(xslDoc)};var result = this.XSLProcessor.transformToDocument(xmlDoc)}else{var result = new ActiveXObject("Msxml2.DOMDocument.3.0");xmlDoc.transformNodeToObject(xslDoc,result)};return result};dtmlXMLLoaderObject.prototype.doXSLTransToString = function(xslDoc,xmlDoc)
{return this.doSerialization(this.doXSLTransToObject(xslDoc,xmlDoc))};dtmlXMLLoaderObject.prototype.doSerialization = function(xmlDoc){if(!isIE()){var xmlSerializer = new XMLSerializer();return xmlSerializer.serializeToString(xmlDoc)}else
 return xmlDoc.xml};//(c)dhtmlx ltd. www.dhtmlx.com
//v.1.0 build 80512

/*
Copyright DHTMLX LTD. http://www.dhtmlx.com
You allowed to use this component or parts of it under GPL terms
To use it on other terms or get Professional edition of the component please contact us at sales@dhtmlx.com
*/



//v.1.0 build 80512

/*
Copyright DHTMLX LTD. http://www.dhtmlx.com
You allowed to use this component or parts of it under GPL terms
To use it on other terms or get Professional edition of the component please contact us at sales@dhtmlx.com
*/



function dhtmlxDblCalendarObject(contId, isAutoDraw, options){this.scriptName = 'dhtmlxcalendar.js';this.entObj = document.createElement("DIV");this.winHeader = null
 this.style = "dhtmlxdblcalendar";this.winTitle = 'dhtmlxDblCalendarObject';this.uid = 'sc&dblCal'+Math.round(1000000*Math.random());this.numLoaded = 2;this.options = {isWinHeader: false,
 headerButtons: '', 
 
 
 isWinDrag: false,
 msgClose: "Close",
 msgMinimize: "Minimize",
 msgToday: "Today",
 msgClear: "Clear"
 };if (options)for (x in options)this.options[x] = options[x];this.entBox = document.createElement("TABLE");this.entBox.cellPadding = "0px";this.entBox.cellSpacing = "0px";this.entBox.className = this.style;this.entObj.appendChild(this.entBox);var entRow = this.entBox.insertRow(0);var calLeft = entRow.insertCell(0);calLeft.style.paddingRight = '2px';var calRight = entRow.insertCell(1);this.leftCalendar = new dhtmlxCalendarObject(calLeft, isAutoDraw, this.options);this.leftCalendar._dblC = this;this.leftCalendar.setOnClickHandler(this.doOnCLeftClick);this.rightCalendar = new dhtmlxCalendarObject(calRight, isAutoDraw, this.options);this.rightCalendar._dblC = this;this.rightCalendar.setOnClickHandler(this.doOnCRightClick);this.doOnClick = null;this.onLanguageLoaded = null;this.getPosition = this.leftCalendar.getPosition;this.startDrag = this.leftCalendar.startDrag;this.stopDrag = this.leftCalendar.stopDrag;this.onDrag = this.leftCalendar.onDrag;this.drawHeader = this.leftCalendar.drawHeader;if (typeof(contId)!= 'string') this.con = contId;else this.con = document.getElementById(contId);var self = this};dhtmlxDblCalendarObject.prototype.setHeader = function(isVisible, isDrag, btnsOpt){this.leftCalendar.options.isWinHeader = this.options.isWinHeader = isVisible;this.leftCalendar.options.isWinDrag = this.options.isWinDrag = isDrag;if (btnsOpt)this.options.headerButtons = this.leftCalendar.options.headerButtons = btnsOpt;if (this.isAutoDraw)this.drawHeader()};dhtmlxDblCalendarObject.prototype.setYearsRange = function(minYear, maxYear){var cs = [this.leftCalendar, this.rightCalendar];for (var ind=0;ind < cs.length;ind++){cs[ind].options.yearsRange = [parseInt(minYear), parseInt(maxYear)];cs[ind].allYears = [];for (var i=minYear;i <= maxYear;i++)cs[ind].allYears.push(i)}};dhtmlxDblCalendarObject.prototype.show = function(){this.parent.style.display = 'block'};dhtmlxDblCalendarObject.prototype.hide = function(){this.parent.style.display = 'none'};dhtmlxDblCalendarObject.prototype.createStructure = function(){if (this.options.isWinHeader){var headerRow = this.entBox.insertRow(0).insertCell(0);headerRow.colSpan = 2;headerRow.align = 'right';this.winHeader = document.createElement('DIV');headerRow.appendChild(this.winHeader)};this.setParent(this.con)};dhtmlxDblCalendarObject.prototype.draw = function(options){if (!this.parent)this.createStructure();this.drawHeader();this.leftCalendar.draw(options);this.rightCalendar.draw(options);this.isAutoDraw = true};dhtmlxDblCalendarObject.prototype.loadUserLanguage = function(lang, userCBfunction){this.numLoaded = 0;if (userCBfunction)this.onLanguageLoaded = userCBfunction;this.leftCalendar.loadUserLanguage(lang, this.languageLoaded);this.rightCalendar.loadUserLanguage(lang, this.languageLoaded)};dhtmlxDblCalendarObject.prototype.languageLoaded = function(status){var self = this._dblC;self.numLoaded ++;if (self.numLoaded == 2){for (param in this.options)self.options[param] = this.options[param];if (this.isAutoDraw)self.drawHeader();if (self.onLanguageLoaded)self.onLanguageLoaded(status)}};dhtmlxDblCalendarObject.prototype.setParent = function(newParent){if (newParent){this.parent = newParent;this.parent.style.display = 'block';this.parent.appendChild(this.entObj)}};dhtmlxDblCalendarObject.prototype.setOnClickHandler = function(func){this.doOnClick = func};dhtmlxDblCalendarObject.prototype.doOnCLeftClick = function(date){this._dblC.rightCalendar.setSensitive(date, null);if (this._dblC.doOnClick)this._dblC.doOnClick(date, this, "left");return true};dhtmlxDblCalendarObject.prototype.doOnCRightClick = function(date){this._dblC.leftCalendar.setSensitive(null, date);if (this._dblC.doOnClick)this._dblC.doOnClick(date, this, "right");return true};dhtmlxDblCalendarObject.prototype.setSensitive = function(){this.rightCalendar.setSensitive(null, this.leftCalendar.date);this.leftCalendar.setSensitive(this.rightCalendar.date, null)};dhtmlxDblCalendarObject.prototype.minimize = function(){if (!this.winHeader)return;var tr = this.winHeader.parentNode.parentNode.nextSibling;tr.parentNode.parentNode.style.width = parseInt(tr.parentNode.parentNode.offsetWidth) + 'px';if (tr)tr.style.display = (tr.style.display == 'none')? 'block': 'none'};dhtmlxDblCalendarObject.prototype.setDate = function(dateFrom,dateTo){this.leftCalendar.setDate(dateFrom);this.rightCalendar.setDate(dateTo);this.leftCalendar.setSensitive(null, this.rightCalendar.date);this.rightCalendar.setSensitive(this.leftCalendar.date, null)};dhtmlxDblCalendarObject.prototype.setDateFormat = function(format){this.leftCalendar.setDateFormat(format);this.rightCalendar.setDateFormat(format)};dhtmlxDblCalendarObject.prototype.isVisible = function(){return (this.parent.style.display == 'block'?true:false)};dhtmlxDblCalendarObject.prototype.setHolidays = function(dates){this.leftCalendar.setHolidays(dates);this.rightCalendar.setHolidays(dates)};function dhtmlxCalendarObject(contId, isAutoDraw, options){this.isAutoDraw = isAutoDraw;this.contId = contId;this.scriptName = 'dhtmlxcalendar.js';this.date = this.cutTime(new Date());this.selDate = this.cutTime(new Date());this.curDate = this.cutTime(new Date());this.entObj = document.createElement("DIV");this.monthPan = document.createElement("TABLE");this.dlabelPan = document.createElement("TABLE");this.daysPan = document.createElement("TABLE");this.parent = null;this.style = "dhtmlxcalendar";this.skinName = "";this.doOnClick = null;this.sensitiveFrom = null;this.sensitiveTo = null;this.activeCell = null;this.hotCell = null;this.winHeader = null
 this.onLanguageLoaded = null;this.dragging = false;this.minimized = false;this.winTitle = '';this.uid = 'sc&Cal'+Math.round(1000000*Math.random());this.holidays = new Array();this.dhx_Event();this.options = {btnPrev: "&laquo;",
 btnBgPrev: null,
 btnNext: "&raquo;",
 btnBgNext: null,
 yearsRange: [1900, 2100],
 
 isMonthEditable: false,
 isYearEditable: false,
 
 isWinHeader: false,
 headerButtons: 'TMX', 
 
 
 isWinDrag: true
 };defLeng = {langname: 'en-us',
 dateformat: '%Y-%m-%d',
 monthesFNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
 monthesSNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
 daysFNames: ["Sunday", "Monday", "Tuesday", "Wednday", "Thursday", "Friday", "Saturday"],
 daysSNames: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
 weekend: [0, 6],
 weekstart: 0,
 msgClose: "Close",
 msgMinimize: "Minimize",
 msgToday: "Today",
 msgClear: "Clear"
 };if (!window.dhtmlxCalendarLangModules)window.dhtmlxCalendarLangModules = {};window.dhtmlxCalendarLangModules['en-us'] = defLeng;if (window.dhtmlxCalendarObjects)window.dhtmlxCalendarObjects[window.dhtmlxCalendarObjects.length] = this;else window.dhtmlxCalendarObjects = [this];for (lg in defLeng)this.options[lg] = defLeng[lg];if (options)for (param in options)this.options[param] = options[param];this.loadUserLanguage();if (options)for (param in options)this.options[param] = options[param];this.allYears = Array();with (this.options)
 for (var i=yearsRange[0];i <= yearsRange[1];i++)this.allYears.push(i);if(isAutoDraw !== false)this.draw(options);return this};dhtmlxCalendarObject.prototype.setHeader = function(isVisible, isDrag, btnsOpt){with (this.options) {isWinHeader = isVisible;isWinDrag = isDrag;if (btnsOpt)headerButtons = btnsOpt}};dhtmlxCalendarObject.prototype.setYearsRange = function(minYear, maxYear){this.options.yearsRange = [parseInt(minYear), parseInt(maxYear)];this.allYears = [];for (var i=minYear;i <= maxYear;i++)this.allYears.push(i)};dhtmlxCalendarObject.prototype.createStructure = function(){var self = this;this.entObj.className = this.style;if (this.options.isWinHeader){this.winHeader = document.createElement('DIV');this.entObj.appendChild(this.winHeader)};this.entBox = document.createElement("TABLE");this.entBox.className = "entbox";with (this.entBox) {cellPadding = "0px";cellSpacing = "0px";width = '100%'};this.entObj.appendChild(this.entBox);var monthBox = this.entBox.insertRow(0).insertCell(0);with (this.monthPan) {cellPadding = "1px";cellSpacing = "0px";width = '100%';align = 'center'};this.monthPan.className = "dxcalmonth";monthBox.appendChild(this.monthPan);var dlabelBox = this.entBox.insertRow(1).insertCell(0);dlabelBox.appendChild(this.dlabelPan);with (this.dlabelPan) {cellPadding = "0px";cellSpacing = "0px";width = '100%';align = 'center'};this.dlabelPan.className = "dxcaldlabel";var daysBox = this.entBox.insertRow(2).insertCell(0);daysBox.appendChild(this.daysPan);with (this.daysPan) {cellPadding = "1px";cellSpacing = "0px";width = '100%';align = 'center'};if(_isIE || _isKHTML)this.daysPan.className = "dxcaldays_ie";else
 this.daysPan.className = "dxcaldays";this.daysPan.onmousemove = function (e) {self.doHotKeys(e)};this.daysPan.onmouseout = function () {self.endHotKeys()};if (typeof(this.contId)!= 'string') this.con = this.contId;else this.con = document.getElementById(this.contId);if (this.con.nodeName == 'INPUT'){var div = document.createElement('DIV');var aleft = getAbsoluteLeft(this.con);var atop = getAbsoluteTop(this.con);with (div.style) {position = 'relative';display = 'none';marginLeft = this.con.offsetWidth+'px';top = atop;left = aleft;zIndex = "99"};this.setParent(div);document.body.appendChild(div);this.con.onclick = function () {
	 if (self.contId == "EndDate")
	 {
		 if (document.getElementById("StartDate").value != "" && document.getElementById("EndDate").value == "")
			self.setDate(document.getElementById("StartDate").value); 
	 }
	 closeCals(); //a reference to a function in the aspheader.asp to close all open calendars before opening this one. The reason for this being here is that the onclick event on the input field, which ideally should be calling this function, doesn't work because it is being handled in here.
	 if (self.isVisible())
 self.hide()
 else
 self.show()};this.con._c = this.parent;this.doOnClick = function (date) {self.con.value = self.getFormatedDate(self.options.dateformat, date);self.hide();self.con.focus();return true};this.con.onkeydown = function(e){if((e||window.event).keyCode==27)
 self.hide();else if((e||window.event).keyCode==13)
 self.show()}}else this.setParent(this.con)};dhtmlxCalendarObject.prototype.drawHeader = function(){if (this._dblC)return;if (!this.options.isWinHeader)return;var self = this;if (!this.winHeader)return false;while (this.winHeader.hasChildNodes())
 this.winHeader.removeChild(this.winHeader.firstChild);this.winHeader.className = 'dhtmlxcalendarHeader';this.winHeader.onselectstart=function(){return false};var label = document.createElement('SPAN');label.className = 'winTitle';label.appendChild(document.createTextNode(this.winTitle));label.setAttribute('title', this.winTitle);this.winHeader.appendChild(label);if (this.options.isWinDrag){this.winHeader.onmousedown = function(e) {self.startDrag(e)}};if (this.con.nodeName != 'INPUT')if (this.options.headerButtons.indexOf('M')>=0)
 this.options.headerButtons = "M";else
 this.options.headerButtons = "";if (this.options.headerButtons.indexOf('X')>=0) {var btnClose = document.createElement('DIV');btnClose.className = 'btn_close';btnClose.setAttribute('title', this.options.msgClose);btnClose.onmousedown = function (e) {e = e||event;self.hide();if (e.stopPropagation)e.stopPropagation();else e.cancelBubble = true};this.winHeader.appendChild(btnClose)};if (this.options.headerButtons.indexOf('M')>=0) {var btnMin = document.createElement('DIV');btnMin.className = 'btn_mini';btnMin.setAttribute('title', this.options.msgMinimize);btnMin.onmousedown = function(e) {e = e||event;self.minimize();if (e.stopPropagation)e.stopPropagation();else e.cancelBubble = true};this.winHeader.appendChild(btnMin)};if (this.options.headerButtons.indexOf('C')>=0) {var btnClear = document.createElement('DIV');btnClear.className = 'btn_clr';btnClear.setAttribute('title', this.options.msgClear);btnClear.onmousedown = function(e) {e = e||event;if (e.stopPropagation)e.stopPropagation();else e.cancelBubble = true;self.con.value = "";self.hide()};this.winHeader.appendChild(btnClear)};if (this.options.headerButtons.indexOf('T')>=0) {var btnToday = document.createElement('DIV');btnToday.className = 'btn_today';btnToday.setAttribute('title', this.options.msgToday);btnToday.onmousedown = function(e) {e = e||event;if (e.stopPropagation)e.stopPropagation();else e.cancelBubble = true;self.setDate(new Date());if (self.doOnClick)self.doOnClick(new Date())};this.winHeader.appendChild(btnToday)}};dhtmlxCalendarObject.prototype.drawMonth = function(){var self = this;if(this.monthPan.childNodes.length>0)this.monthPan.removeChild(this.monthPan.childNodes[0]);var row = this.monthPan.insertRow(0);var cArLeft = row.insertCell(0);var cContent = row.insertCell(1);var cArRight = row.insertCell(2);cArLeft.align = "left";cArLeft.className = 'month_btn_left';var btnLabel = document.createElement("SPAN");btnLabel.innerHTML = this.options.btnPrev;cArLeft.appendChild(btnLabel);cArLeft.onclick = function(){self.prevMonth() };cArRight.align = "right";cArRight.className = 'month_btn_right';var btnLabel = document.createElement("SPAN");btnLabel.innerHTML = this.options.btnNext;cArRight.appendChild(btnLabel);cArRight.onclick = function(){self.nextMonth() };cContent.align = 'center';var mHeader = document.createElement("TABLE");with (mHeader) {cellPadding = "0px";cellSpacing = "0px";align = "center"};var mRow = mHeader.insertRow(0);var cMonth = mRow.insertCell(0);var cComma = mRow.insertCell(1);var cYear = mRow.insertCell(2);cContent.appendChild(mHeader);this.planeMonth = document.createElement('DIV');this.planeMonth._c = this;this.planeMonth.appendChild(document.createTextNode(this.options.monthesFNames[this.date.getMonth()]));this.planeMonth.className = 'planeMonth';cMonth.appendChild(this.planeMonth);if (this.options.isMonthEditable){this.planeMonth.style.cursor = 'pointer';this.editorMonth = new dhtmlxRichSelector({nodeBefore: this.planeMonth,
 valueList: [0,1,2,3,4,5,6,7,8,9,10,11],
 titleList: this.options.monthesFNames,
 activeValue: this.options.monthesFNames[this.date.getMonth()],
 onSelect: this.onMonthSelect
 });this.editorMonth._c = this};cComma.appendChild(document.createTextNode(","));cComma.className = 'comma';this.planeYear = document.createElement('DIV');this.planeYear._c = this;this.planeYear.appendChild(document.createTextNode(this.date.getFullYear()));this.planeYear.className = 'planeYear';cYear.appendChild(this.planeYear);if (this.options.isYearEditable){this.planeYear.style.cursor = 'pointer';this.editorYear = new dhtmlxRichSelector({nodeBefore: this.planeYear,
 valueList: this.allYears,
 titleList: this.allYears,
 activeValue: this.date.getFullYear(),
 onSelect: this.onYearSelect,
 isOrderedList: true,
 isNumbersList: true,
 isAllowUserValue: true
 });this.editorYear._c = this}};dhtmlxCalendarObject.prototype.drawDayLabels = function() {var self = this;if(this.dlabelPan.childNodes.length>0)this.dlabelPan.removeChild(this.dlabelPan.childNodes[0]);var row = this.dlabelPan.insertRow(-1);row.className = "daynames";for(var i=0;i<7;i++){var cDay = row.insertCell(i);cDay.appendChild(document.createTextNode(this.getDayName(i)))
 }};dhtmlxCalendarObject.prototype.drawDays = function() {var self = this;if(this.daysPan.childNodes.length>0)this.daysPan.removeChild(this.daysPan.childNodes[0]);var row = {}, cell = {};var tempDate = new Date(this.date);tempDate.setDate(1);var day1 = (tempDate.getDay() - this.options.weekstart) % 7;if (day1 < 0)day1 += 7;tempDate.setDate(- day1);tempDate.setDate(tempDate.getDate() + 1);if (tempDate.getDate()< tempDate.getDay()) 
 tempDate.setMonth(tempDate.getMonth() - 1);for (var weekNumber=0;weekNumber<6;weekNumber++){row = this.daysPan.insertRow(-1);for (var i=0;i<7;i++){cell = row.insertCell(-1);cell.setAttribute('id', this.uid+tempDate.getFullYear()+tempDate.getMonth()+tempDate.getDate());cell.appendChild(document.createTextNode(tempDate.getDate()));cell.thisdate = tempDate.toString();cell.className = "thismonth";if(tempDate.getMonth()!=this.date.getMonth())
 cell.className = "othermonth";if (this.sensitiveFrom && (tempDate.valueOf()< this.sensitiveFrom.valueOf())) {cell.className = cell.className + " insensitive";tempDate.setDate(tempDate.getDate() + 1);continue};if (this.sensitiveTo && (tempDate.valueOf()> this.sensitiveTo.valueOf())) {cell.className = cell.className + " insensitive";tempDate.setDate(tempDate.getDate() + 1);continue};if (this.isWeekend(i)&& tempDate.getMonth()==this.date.getMonth()) 
 cell.className = "weekend";if (tempDate.toDateString()== this.curDate.toDateString())
 cell.className = "current";if (tempDate.toDateString()== this.selDate.toDateString()) {this.activeCell = cell;this.addClass(cell, "selected")};if (this.holidays.length>0)for (var h=0;h<this.holidays.length;h++){var dateAr = (this.holidays[h].indexOf(".")!=-1?this.holidays[h].toString().split("."):this.holidays[h].toString().split("-"));if (dateAr.length==2){if (dateAr[0].substr(0,1)=='0')
 dateAr[0] = dateAr[0].substr(1,1);if (dateAr[1].substr(0,1)=='0')
 dateAr[1] = dateAr[1].substr(1,1);if (dateAr[1]==tempDate.getDate()&&dateAr[0]==(tempDate.getMonth()+1))
 cell.className = cell.className + ' holiday'}else if (dateAr.length==3){if (dateAr[2].substr(0,1)=='0')
 dateAr[2] = dateAr[2].substr(1,1);if (dateAr[1].substr(0,1)=='0')
 dateAr[1] = dateAr[1].substr(1,1);if (dateAr[2]==tempDate.getDate()&&dateAr[1]==(tempDate.getMonth()+1)&&dateAr[0]==tempDate.getFullYear())
 cell.className = cell.className + ' holiday'}};cell.onclick = function(){if(!self.doOnClick || self.doOnClick(this.thisdate)){self.setDate(this.thisdate);self.callEvent("onClick",[this.thisdate])}};tempDate.setDate(tempDate.getDate() + 1)}}};dhtmlxCalendarObject.prototype.draw = function(options){var self = this;if (this.loadingLanguage){setTimeout(function() {self.draw(options);return}, 20);return}else
 if (!this.parent)this.createStructure(options);this.drawHeader();this.drawMonth();this.drawDayLabels();this.drawDays();this.isAutoDraw = true};dhtmlxCalendarObject.prototype.startDrag = function(e) {e = e||event;if ((e.button === 0)|| (e.button === 1)) {if (this.dragging){this.stopDrag(e)};this.drag_mx = e.clientX;this.drag_my = e.clientY;this.drag_spos = this.getPosition(this.parent);document.body.appendChild(this.parent);with (this.parent.style) {left = this.drag_spos[0] + 'px';top = this.drag_spos[1] + 'px';margin = '0px';position = 'absolute'};this.bu_onmousemove = document.body.onmousemove;var self = this;document.body.onmousemove = function (e) {self.onDrag(e)};this.bu_onmouseup = document.body.onmouseup;document.body.onmouseup = function (e) {self.stopDrag(e)};this.dragging = true}};dhtmlxCalendarObject.prototype.onDrag = function(e) {e = e||event;if ((e.button === 0)|| (e.button === 1)) {var delta_x = this.drag_mx - e.clientX;var delta_y = this.drag_my - e.clientY;this.parent.style.left = this.drag_spos[0] - delta_x + 'px';this.parent.style.top = this.drag_spos[1] - delta_y + 'px';if(_isIE){this.ifr.style.left = this.parent.style.left;this.ifr.style.top = this.parent.style.top}}else {this.stopDrag(e)}};dhtmlxCalendarObject.prototype.stopDrag = function(e) {e = e||event;document.body.onmouseup = (this.bu_onmouseup === window.undefined)? null: this.bu_onmouseup;document.body.onmousemove = (this.bu_onmousemove === window.undefined)? null: this.bu_onmousemove;this.dragging = false};dhtmlxCalendarObject.prototype.doHotKeys = function(e){e = e||event;var cell = ((e.target) ? e.target : e.srcElement);if (cell.className.toString().indexOf('insensitive') >=0 ) {this.endHotKeys()}else {if (this.hotCell)this.resetHotClass(this.hotCell);this.addClass(cell, 'hover');this.hotCell = cell}};dhtmlxCalendarObject.prototype.endHotKeys = function(){if (this.hotCell){this.resetHotClass(this.hotCell);this.hotCell = null}};dhtmlxCalendarObject.prototype.minimize = function(){if (!this.winHeader)return;this.entBox.style.display = (this.entBox.style.display == 'none')? 'block': 'none';if (!this.minimized)this.entObj.className = (this.skinName!=""?this.style+"_"+this.skinName+" "+this.style+"_"+this.skinName:this.style+" "+this.style)+"_minimized";else
 this.entObj.className = (this.skinName!=""?this.style+"_"+this.skinName:this.style);if(_isIE){this.ifr.style.width = this.entObj.offsetWidth;this.ifr.style.height = this.entObj.offsetHeight};this.minimized = !this.minimized};dhtmlxCalendarObject.prototype.loadUserLanguage = function(language, userCBfunction){if (userCBfunction)this.onLanguageLoaded = userCBfunction;if (!language){language="en-us"};this.loadingLanguage = language;if (!language){this.loadUserLanguageCallback(false);return};if (language == this.options.langname){this.loadUserLanguageCallback(true);return};var __lm = window.dhtmlxCalendarLangModules;if (__lm[language]){for (lg in __lm[language])this.options[lg] = __lm[language][lg];this.loadUserLanguageCallback(true);return};var src, path = null;var scripts = document.getElementsByTagName('SCRIPT');for (var i=0;i<scripts.length;i++)if(src = scripts[i].getAttribute('src'))
 if (src.indexOf(this.scriptName)>= 0) {path = src.substr(0, src.indexOf(this.scriptName));break};if (path === null){this.loadUserLanguageCallback(false);return};this.options.langname = language;var langPath = path + 'lang/' + language + '.js';for (var i=0;i<scripts.length;i++)if(src = scripts[i].getAttribute('src'))
 if (src == langPath)return;var script = document.createElement('SCRIPT');script.setAttribute('language', "Java-Script");script.setAttribute('type', "text/javascript");script.setAttribute('src', langPath);document.body.appendChild(script)};dhtmlxCalendarObject.prototype.loadUserLanguageCallback = function(status) {this.loadingLanguage = null;if (this.isAutoDraw !== false)this.draw();if (this.onLanguageLoaded && (typeof(this.onLanguageLoaded)== 'function'))
 this.onLanguageLoaded(status)};function loadLanguageModule(langModule) {var __c = window.dhtmlxCalendarObjects;for (var i=0;i<__c.length;i++){if (__c[i].loadingLanguage == langModule.langname){for (lg in langModule)__c[i].options[lg] = langModule[lg];__c[i].loadUserLanguageCallback(true)}};window.dhtmlxCalendarLangModules[langModule.langname] = langModule};dhtmlxCalendarObject.prototype.show = function(){this.parent.style.display = '';if(_isIE){this.parent.style.width = "0px";this.parent.style.height = "0px";if(this.parent.style.zIndex==0){this.parent.style.zIndex = 10};if(this.parent.style.position == "absolute" && this.ifr==undefined){this.ifr = document.createElement("IFRAME");this.ifr.style.position = "absolute";this.ifr.style.zIndex = "0";this.ifr.frameBorder = "no";this.ifr.src = window.dhx_globalImgPath+"/blank.html"
 this.ifr.style.top = this.entObj.style.top;this.ifr.style.left = this.entObj.style.left;this.ifr.className = this.style + "_ifr";this.ifr.style.className = this.style;this.parent.appendChild(this.ifr)
 }}};dhtmlxCalendarObject.prototype.hide = function(){this.parent.style.display = 'none';if(this.ifr!=undefined){this.ifr.parentNode.removeChild(this.ifr);this.ifr = undefined}};dhtmlxCalendarObject.prototype.setDateFormat = function(format){this.options.dateformat = format};dhtmlxCalendarObject.prototype.isWeekend = function(k){var q = k + this.options.weekstart;if (q > 6)q -= 7;for (var i=0;i<this.options.weekend.length;i++)if (this.options.weekend[i] == q)return true;return false};dhtmlxCalendarObject.prototype.getDayName = function(k){var q = k + this.options.weekstart;if (q > 6)q = q - 7;return this.options.daysSNames[q]};dhtmlxCalendarObject.prototype.cutTime = function(date) {date = new Date(date);var ndate = new Date(date.getFullYear(), date.getMonth(), date.getDate());return ndate};dhtmlxCalendarObject.prototype.onYearSelect = function(value) {this._c.date = new Date(this._c.date);if (!isNaN(value))
 this._c.date = new Date(this._c.date.setFullYear(value));this._c.draw();return (!isNaN(value))};dhtmlxCalendarObject.prototype.onMonthSelect = function(value) {this._c.date = new Date(this._c.date.setMonth(value));this._c.draw();return true};dhtmlxCalendarObject.prototype.setParent = function(newParent){if (newParent){this.parent = newParent;this.parent.appendChild(this.entObj)}};dhtmlxCalendarObject.prototype.setDate = function(date){dateTmp = this.setFormatedDate(this.options.dateformat,date);this.draw();if(isNaN(dateTmp)|| dateTmp==null)
 date = new Date(date);else
 date = dateTmp;if ((date.getFullYear()== this.date.getFullYear()) && (date.getMonth() == this.date.getMonth())) {this.date = new Date(this.cutTime(date));this.selDate = new Date(this.cutTime(date));var cell = document.getElementById(this.uid+date.getFullYear()+date.getMonth()+date.getDate());if (cell){this.resetClass(this.activeCell);this.addClass(cell, "selected");this.activeCell = cell}}else {this.date = new Date(this.cutTime(date));this.selDate = new Date(this.cutTime(date));if (this.isAutoDraw)this.draw()}};dhtmlxCalendarObject.prototype.addClass = function(obj, styleName) {obj.className += ' ' + styleName};dhtmlxCalendarObject.prototype.resetClass = function(obj) {obj.className = obj.className.toString().split(' ')[0]};dhtmlxCalendarObject.prototype.resetHotClass = function(obj) {obj.className = obj.className.toString().replace(/hover/, '')};dhtmlxCalendarObject.prototype.setSkin = function(newSkin) {this.entObj.className = this.style;this.skinName = newSkin;this.addClass(this.entObj, this.style + (newSkin?'_':"") + newSkin + (this.minimized?" " + this.style + (newSkin?'_' + newSkin:"") + "_minimized":""));if(_isIE&&this.ifr!=undefined){this.ifr.className = this.style + (newSkin?'_':"") + newSkin + "_ifr"}};dhtmlxCalendarObject.prototype.getDate = function(){return this.selDate.toString()};dhtmlxCalendarObject.prototype.nextMonth = function(){this.date = new Date(this.date);this.date = new Date(this.date.setMonth(this.date.getMonth()+1));if (this.isAutoDraw)this.draw()};dhtmlxCalendarObject.prototype.prevMonth = function(){this.date = new Date(this.date)
 this.date = new Date(this.date.setMonth(this.date.getMonth()-1));if (this.isAutoDraw)this.draw()};dhtmlxCalendarObject.prototype.setOnClickHandler = function(func){this.doOnClick = func};dhtmlxCalendarObject.prototype.setPosition = function(argA,argB,argC){if(typeof(argA)=='object'){var posAr = this.getPosition(argA)
 var left = posAr[0]+argA.offsetWidth+(argC||0);var top = posAr[1]+(argB||0)};this.entObj.style.position = "absolute";this.entObj.style.top = (top||argA)+"px";this.entObj.style.left = (left||argB)+"px"};dhtmlxCalendarObject.prototype.close = function(func){this.entObj.parentNode.removeChild(true)};dhtmlxCalendarObject.prototype.getPosition = function(oNode,pNode) {if(!pNode)var pNode = document.body
 var oCurrentNode=oNode;var iLeft=0;var iTop=0;while ((oCurrentNode)&&(oCurrentNode!=pNode)){iLeft+=oCurrentNode.offsetLeft-oCurrentNode.scrollLeft;iTop+=oCurrentNode.offsetTop-oCurrentNode.scrollTop;oCurrentNode=oCurrentNode.offsetParent};if (pNode == document.body ){if (_isIE){if (document.documentElement.scrollTop)iTop+=document.documentElement.scrollTop;if (document.documentElement.scrollLeft)iLeft+=document.documentElement.scrollLeft}else
 if (!_isFF){iLeft+=document.body.offsetLeft;iTop+=document.body.offsetTop}};return new Array(iLeft,iTop)};dhtmlxCalendarObject.prototype.getFormatedDate = function (dateformat, date) {if(!dateformat)dateformat = this.options.dateformat
 if(!date)date = this.selDate;date = new Date(date);var out = '';var plain = true;for (var i=0;i<dateformat.length;i++){var replStr = dateformat.substr(i, 1);if (plain){if (replStr == '%'){plain = false;continue};out += replStr}else {switch (replStr) {case 'e':
 replStr = date.getDate();break;case 'd':
 replStr = date.getDate();if (replStr.toString().length == 1)
 replStr='0'+replStr;break;case 'j':
 var x = new Date(date.getFullYear(), 0, 0, 0, 0, 0, 0);replStr = Math.ceil((date.valueOf() - x.valueOf())/1000/60/60/24 - 1);while (replStr.toString().length < 3)
 replStr = '0' + replStr;break;case 'a':
 replStr = this.options.daysSNames[date.getDay()];break;case 'W':
 replStr = this.options.daysFNames[date.getDay()];break;case 'c':
 replStr = 1 + date.getMonth();break;case 'm':
 replStr = 1 + date.getMonth();if (replStr.toString().length == 1)
 replStr = '0' + replStr;break;case 'b':
 replStr = this.options.monthesSNames[date.getMonth()];break;case 'M':
 replStr = this.options.monthesFNames[date.getMonth()];break;case 'y':
 replStr = date.getFullYear();replStr = replStr.toString().substr(2);break;case 'Y':
 replStr = date.getFullYear()};out += replStr;plain = true}};return out};dhtmlxCalendarObject.prototype.setFormatedDate = function(dateformatarg, date){if (!date)return false;if(!dateformatarg)dateformatarg = this.options.dateformat;date = date.toString();function parseMonth(val){var tmpAr = new Array(this.options.monthesSNames,this.options.monthesFNames);for(var j=0;j<tmpAr.length;j++){for (var i=0;i<tmpAr[j].length;i++)if (tmpAr[j][i].indexOf(val)== 0)
 return i};return -1};var outputDate = new Date(2008, 0, 1);var j=0;for(var i=0;i<dateformatarg.length;i++){var _char = dateformatarg.substr(i,1);if(_char=="%"){var _cd = dateformatarg.substr(i+1,1);var _nextpc = dateformatarg.indexOf("%",i+1);var _nextDelim = dateformatarg.substr(i+2,_nextpc-i-1-1);var _nDelimInDatePos = date.indexOf(_nextDelim,j);if(_nextDelim=="")_nDelimInDatePos = date.length
 if(_nDelimInDatePos==-1)return null;var value = date.substr(j, _nDelimInDatePos-j);j=_nDelimInDatePos+_nextDelim.length
 switch (_cd) {case 'd':
 case 'e':
 outputDate.setDate(parseFloat(value));break;case "c":
 case "m":
 outputDate.setMonth(parseFloat(value) - 1);break;case "M":
 var val = parseMonth.call(this,value);if(val!=-1)outputDate.setMonth(parseFloat(val));else 
 return null;break;case "b":
 var val = parseMonth.call(this,value);if(val!=-1)outputDate.setMonth(parseFloat(val));else 
 return null;break;case 'Y':
 outputDate.setFullYear(parseFloat(value));break;case 'y':
 var year=parseFloat(value);outputDate.setFullYear(((year>20)?1900:2000) + year);break}}};this.date = outputDate;this.selDate = outputDate;return this.selDate};dhtmlxCalendarObject.prototype.setSensitive = function(fromDate,toDate){if (fromDate)this.sensitiveFrom = this.cutTime(fromDate);if (toDate)this.sensitiveTo = this.cutTime(toDate);if (this.isAutoDraw)this.draw()};function dhtmlxRichSelector(parametres) {for (x in parametres)this[x] = parametres[x];this.initValue = this.activeValue;if (!this.selectorSize)this.selectorSize = 7;var self = this;this.blurTimer = null;this.nodeBefore.onclick = function() {self.show()};this.editor = document.createElement('TEXTAREA');this.editor.value = this.activeValue;this.editor._s = this;this.editor.className = 'dhtmlxRichSelector';this.editor.onfocus = this.onFocus;this.editor.onblur = this.onBlur;this.editor.onkeydown = this.onKeyDown;this.editor.onkeyup = this.onKeyUp;this.selector = document.createElement('SELECT');this.selector.size = this.selectorSize;this.selector.className = 'dhtmlxRichSelector';if (this.valueList)for (var i = 0;i < this.valueList.length;i++)this.selector.options[i] = new Option(this.titleList[i], this.valueList[i], false, false);this.selector._s = this;this.selector.onfocus = this.onFocus;this.selector.onblur = this.onBlur;this.selector.onclick = function () {self.onSelect(self.selector.value)};this.selector.getIndexByValue = function (Value, isFull) {var Select = this;Value = Value.toString().toUpperCase();if (!isFull)isFull=false;for (var i=0;i<Select.length;i++){var i_value = Select[i].text.toUpperCase();if (isFull){if(i_value == Value)return i}else {if (i_value.indexOf(Value)== 0) return i}};if (Select._s.isOrderedList){if (Select._s.isNumbersList)if (isNaN(Value)) return -1;i_value = Select[0].text.substring(0, Value.length).toUpperCase();if (i_value > Value)return 0;i_value = Select[Select.length-1].text.substring(0, Value.length);if (i_value < Value)return Select.length-1};return -1};this.con = document.createElement('DIV')
 this.con.className = 'dhtmlxRichSelector';with (this.con.style) {width = 'auto';display = 'none'};this.con.appendChild(this.editor);this.con.appendChild(this.selector);this.nodeBefore.parentNode.insertBefore(this.con, this.nodeBefore);return this};dhtmlxRichSelector.prototype.show = function() {this.con.style.display = 'block';with (this.selector.style) {marginTop = parseInt(this.nodeBefore.offsetHeight)+'px';width = 'auto'};with (this.editor.style) {width = parseInt(this.nodeBefore.offsetWidth)+15+'px';height = parseInt(this.nodeBefore.offsetHeight)+'px'};this.selector.selectedIndex = this.selector.getIndexByValue(this.activeValue);this.editor.focus()};dhtmlxRichSelector.prototype.hide = function() {this.con.style.display = 'none'};dhtmlxRichSelector.prototype.onBlur = function() {var self = this._s;self.blurTimer = setTimeout(function(){if (self.isAllowUserValue){if (self.onSelect(self.editor.value))
 self.activeValue = self.editor.value}else {if (self.onSelect(self.selector.value))
 self.activeValue = self.selector.value}}, 10)};dhtmlxRichSelector.prototype.onFocus = function() {var self = this._s;if(self.blurTimer){clearTimeout(self.blurTimer);self.blurTimer = null};if (this === this._s.selector)self.editor.focus()};dhtmlxRichSelector.prototype.onKeyDown = function(e) {var self = this._s;var e = e || event;var isCase = true;switch (e.keyCode) {case 33: 
 if (self.selector.selectedIndex < self.selector.size)self.selector.selectedIndex = 0;else self.selector.selectedIndex -= parseInt(self.selector.size)-1;break;case 34: 
 if (self.selector.length-self.selector.selectedIndex < self.selector.size)self.selector.selectedIndex = self.selector.length-1;else self.selector.selectedIndex += parseInt(self.selector.size)-1;break;case 35: 
 if (e.ctrlKey)self.selector.selectedIndex = self.selector.length-1;break;case 36: 
 if (e.ctrlKey)self.selector.selectedIndex = 0;break;case 38: 
 if (self.selector.selectedIndex == 0);else self.selector.selectedIndex -= 1;break;case 40: 
 if (self.selector.selectedIndex == self.selector.length-1);else self.selector.selectedIndex += 1;break;default:
 isCase = false};if (isCase){self.editor.value = self.selector.options[self.selector.selectedIndex].text;self.editor.focus()}};dhtmlxRichSelector.prototype.onKeyUp = function(e) {var self = this._s;var e = e || event;switch (e.keyCode) {case 13: 
 self.editor.blur();break;case 27: 
 self.editor.value = self.initValue;self.selector.selectedIndex = self.selector.getIndexByValue(self.initValue, true);self.editor.blur();break;default:
 var selectedIndex = self.selector.getIndexByValue(self.editor.value);if (selectedIndex >= 0)self.selector.selectedIndex = selectedIndex}};dhtmlxCalendarObject.prototype.dhx_Event=function()
{this.dhx_SeverCatcherPath="";this.attachEvent = function(original, catcher, CallObj)
 {CallObj = CallObj||this;original = 'ev_'+original;if ( ( !this[original] )|| ( !this[original].addEvent ) ) {var z = new this.eventCatcher(CallObj);z.addEvent( this[original] );this[original] = z};return ( original + ':' + this[original].addEvent(catcher) )};this.callEvent=function(name,arg0){if (this["ev_"+name])return this["ev_"+name].apply(this,arg0);return true};this.checkEvent=function(name){if (this["ev_"+name])return true;return false};this.eventCatcher = function(obj)
 {var dhx_catch = new Array();var m_obj = obj;var func_server = function(catcher,rpc)
 {catcher = catcher.split(":");var postVar="";var postVar2="";var target=catcher[1];if (catcher[1]=="rpc"){postVar='<?xml version="1.0"?><methodCall><methodName>'+catcher[2]+'</methodName><params>';postVar2="</params></methodCall>";target=rpc};var z = function() {};return z};var z = function()
 {if (dhx_catch)var res=true;for (var i=0;i<dhx_catch.length;i++){if (dhx_catch[i] != null){var zr = dhx_catch[i].apply( m_obj, arguments );res = res && zr}};return res};z.addEvent = function(ev)
 {if ( typeof(ev)!= "function" )
 if (ev && ev.indexOf && ev.indexOf("server:")== 0)
 ev = new func_server(ev,m_obj.rpcServer);else
 ev = eval(ev);if (ev)return dhx_catch.push( ev ) - 1;return false};z.removeEvent = function(id)
 {dhx_catch[id] = null};return z};this.detachEvent = function(id)
 {if (id != false){var list = id.split(':');this[ list[0] ].removeEvent( list[1] )}}};dhtmlxCalendarObject.prototype.isVisible = function(){return (this.parent.style.display == ''?true:false)};dhtmlxCalendarObject.prototype.setHolidays = function(dates){this.holidays = dates.toString().split(",")}
//v.1.0 build 80512

/*
Copyright DHTMLX LTD. http://www.dhtmlx.com
You allowed to use this component or parts of it under GPL terms
To use it on other terms or get Professional edition of the component please contact us at sales@dhtmlx.com
*/




/* Custom*/  

function clearInputField(elem, value)
{
    if (elem.value == value)
    {
        elem.value=''
    }
    elem.style.color = '#000000'; 
}

function clearInputField2(elem, value)
{
    if (elem.value == '') 
    {
        elem.value = value; 
        elem.style.color = '#999999';
    }
}


/* Custom AJAX*/

	function xmlhttpPost(strURL, Flagged_Counter, Media_Id, i, note) {
		var xmlHttpReq = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
		}
		self.xmlHttpReq.open('POST', strURL, true);
		self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		self.xmlHttpReq.onreadystatechange = function() {
			if (self.xmlHttpReq.readyState == 4) {
				updatepage(self.xmlHttpReq.responseText, i);
			}
		}
		self.xmlHttpReq.send('count=' + Flagged_Counter + '&media_id=' + Media_Id + '&note=' + escape(note));
	}
	
	function xmlhttpPostDisable(strURL, Media_Id, GFW) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	
    self.xmlHttpReq.send('GFW=' + GFW + '&media_id=' + Media_Id);
}
	
	
	function updatepage(str, i){
		document.getElementById("report" + i).innerHTML = str;
	}
	
	
	function CheckForSwears(strURL, phrase, pobjForm) {
	   
		var xmlHttpReq = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
		}
		self.xmlHttpReq.open('POST', strURL, true);
		self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		self.xmlHttpReq.onreadystatechange = function() {
			if (self.xmlHttpReq.readyState == 4) {
				CheckForSwearsUpdatepage(self.xmlHttpReq.responseText, pobjForm);
			}
		}
		self.xmlHttpReq.send('phrase=' + phrase);
	}
	
	function CheckForSwearsUpdatepage(str, pobjForm){
		document.getElementById("error").innerHTML = str;
        
		if (str.length == 0) 
	    {
	        pobjForm.action = pobjForm.action;
		    pobjForm.submit();
		}
	}
	
	
	function ReportPost(strURL, params, i) {
	  
		var xmlHttpReq = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
		}
		self.xmlHttpReq.open('POST', strURL, true);
		self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		self.xmlHttpReq.onreadystatechange = function() {
			if (self.xmlHttpReq.readyState == 4) {
				ReportPostUpdate(self.xmlHttpReq.responseText, i);
			}
		}
		self.xmlHttpReq.send('params=' + params);
	}
	
	function ReportPostUpdate(str, i){
	
		document.getElementById("report" + i).innerHTML = str;
	}
	
	function TogglePost(strURL, postid, status) {
	  
		var xmlHttpReq = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
		}
		self.xmlHttpReq.open('POST', strURL, true);
		self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		self.xmlHttpReq.onreadystatechange = function() {
			if (self.xmlHttpReq.readyState == 4) {
				TogglePostUpdate(self.xmlHttpReq.responseText, i);
			}
		}
		self.xmlHttpReq.send('postid=' + postid + "&status=" + status);
	}
	
	function TogglePostUpdate(str){
	
		document.getElementById("toggle").innerHTML = str;
	}
	
	function ToggleWarn(strURL, userid, status) {
	  
		var xmlHttpReq = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
		}
		self.xmlHttpReq.open('POST', strURL, true);
		self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		self.xmlHttpReq.onreadystatechange = function() {
			if (self.xmlHttpReq.readyState == 4) {
				ToggleWarnUpdate(self.xmlHttpReq.responseText, i);
			}
		}
		self.xmlHttpReq.send('userid=' + userid + "&status=" + status);
	}
	
	function ToggleWarnUpdate(str){
	
		document.getElementById("warn").innerHTML = str;
	}
	
	function ToggleBan(strURL, userid, status) {
	  
		var xmlHttpReq = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
		}
		self.xmlHttpReq.open('POST', strURL, true);
		self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		self.xmlHttpReq.onreadystatechange = function() {
			if (self.xmlHttpReq.readyState == 4) {
				ToggleBanUpdate(self.xmlHttpReq.responseText);
			}
		}
		self.xmlHttpReq.send('userid=' + userid + "&status=" + status);
	}
	
	function ToggleBanUpdate(str){
	
		document.getElementById("ban").innerHTML = str;
	}
	
	function ToggleLockBanTopic(strURL, topicid, status) {
	  
		var xmlHttpReq = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
		}
		self.xmlHttpReq.open('POST', strURL, true);
		self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		self.xmlHttpReq.onreadystatechange = function() {
			if (self.xmlHttpReq.readyState == 4) {
			    alert(status)
			    if (status == "lock" || status == "unlock" )
			        ToggleLockTopicUpdate(self.xmlHttpReq.responseText, "lock");
			    else
			        ToggleLockTopicUpdate(self.xmlHttpReq.responseText, "disable");
			}
		}
		self.xmlHttpReq.send('topicid=' + topicid + "&status=" + status);
	}
	
	function ToggleLockTopicUpdate(str, div){
	
		document.getElementById(div).innerHTML = str;
	}
	
	function SubmitWallComment(strURL, memberid, mediaid, comment, createdby, controls) {

		var xmlHttpReq = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
		}
		self.xmlHttpReq.open('POST', strURL, true);
		self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		self.xmlHttpReq.onreadystatechange = function() {
			if (self.xmlHttpReq.readyState == 4) {
			    SubmitWallCommentUpdate(self.xmlHttpReq.responseXML.documentElement);
			}
		}
		
		self.xmlHttpReq.send('memberid=' + memberid + "&mediaid=" + encodeURI(mediaid) + "&comment=" + encodeURI(comment) + "&createdby=" + createdby + "&controls=" + controls);
	}
	
	function SubmitWallCommentUpdate(str){
        
        var temp = document.createElement("div");
        temp.id = "comment" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue;
        temp.style.fontSize = "12";
        temp.style.borderBottom = "solid 1px #cccccc";
        temp.style.padding = "10";
        temp.onmouseover = new Function("if (document.getElementById('remove" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "') != null) {document.getElementById('remove" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "').style.visibility = 'visible';}");
        temp.onmouseout  = new Function("if (document.getElementById('remove" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "') != null) {document.getElementById('remove" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "').style.visibility = 'hidden';}");
        temp.innerHTML += "<div id='remove" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "' style='float:right; visibility:hidden; font-size:10px; position:relative; top:-8px;'><a href='#' onClick=\"document.getElementById('loadinggif" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "').style.visibility = 'visible'; ToggleWallComment('../utility/ajax_mini_pages/ToggleWallComment.asp','" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "', 'off','" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "');return false;\">[Remove]</a><img id='loadinggif" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "' border='0' src='i/loading.GIF' style='position:relative; top:5px; left: 10px; visibility:hidden;' /><br><br><a href='convo.asp?to=" + str.getElementsByTagName('createdby')[0].firstChild.nodeValue + "&from=" + str.getElementsByTagName('memberid')[0].firstChild.nodeValue + "' >[Conversation]</a></div>";
        temp.innerHTML += "<div style='color:#666666; '><a href='profile.asp?member=" + str.getElementsByTagName('createdby')[0].firstChild.nodeValue + "'>" + str.getElementsByTagName('createdbyname')[0].firstChild.nodeValue + "</a> on " + str.getElementsByTagName('time')[0].firstChild.nodeValue + "</div>";
        temp.innerHTML += "<div style='margin: 0 0 0 4;'>" + str.getElementsByTagName('commenttext')[0].firstChild.nodeValue + "</div>";
        
		document.getElementById('wall').insertBefore(temp, document.getElementById('wall').firstChild);
		document.getElementById('newcomment').value = "";
		document.getElementById('loadinggif2').style.visibility ='hidden';
	}
	
	function ToggleWallComment(strURL, commentid, onoff, loadingif) {

		var xmlHttpReq = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
		}
		self.xmlHttpReq.open('POST', strURL, true);
		self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		self.xmlHttpReq.onreadystatechange = function() {
			if (self.xmlHttpReq.readyState == 4) {
			    if (onoff == "off") 
			        ToggleWallCommentUpdate(commentid, loadingif)
			    else
			        window.location.reload()
			}
		}
		self.xmlHttpReq.send("commentid=" + commentid + "&onoff=" + onoff);
	}
	
	function ToggleWallCommentUpdate(str, loadingif){
	    
        if (document.getElementById('feeditem' + str) != null)
		    document.getElementById('feeditem' + str).innerHTML = "<div style='float:right; font-size:11px; '><a href='#' onClick=\"ToggleWallComment('../utility/ajax_mini_pages/ToggleWallComment.asp'," + str + ", 'on'); return false;\" >[Undo]</a></div><br>";
	    else
	        document.getElementById('comment' + str).innerHTML = "<div style='float:right; font-size:11px; '><a href='#' onClick=\"ToggleWallComment('../utility/ajax_mini_pages/ToggleWallComment.asp'," + str + ", 'on'); return false;\" >[Undo]</a></div><br>";
	    if (document.getElementById('loadinggif' + loadingif) != null)
	        document.getElementById('loadinggif' + loadingif).style.visibility ='hidden';
	}
	
	function PostStatus(strURL, memberid, status) {
	    
		var xmlHttpReq = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
		}
		self.xmlHttpReq.open('GET', strURL + "?memberid=" + encodeURIComponent(memberid) + "&status=" + encodeURIComponent(status), true);
		//self.xmlHttpReq.setRequestHeader('Content-Type', 'text/xml');
		//self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		self.xmlHttpReq.onreadystatechange = function() {
			if (self.xmlHttpReq.readyState == 4) {
			    PostStatusUpdate(self.xmlHttpReq.responseXML.documentElement);
			   //PostStatusUpdate(self.xmlHttpReq.responseText);
			}
		}
		self.xmlHttpReq.send(null);
	}
	
	function PostStatusUpdate(str){
        
        var temp = document.createElement("div");
        temp.id = "feeditem" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue;
        temp.className = "StatusItem bloopAnimation";
        temp.onmouseover = new Function("if (document.getElementById('remove" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "') != null) {document.getElementById('remove" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "').style.visibility = 'visible';}");
        temp.onmouseout  = new Function("if (document.getElementById('remove" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "') != null) {document.getElementById('remove" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "').style.visibility = 'hidden';}");
        temp.innerHTML += "<div id='remove" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "' style='float:right; visibility:hidden; font-size:10px; position:relative; top:0px;'><a href='#' onClick=\"document.getElementById('loadinggif" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "').style.visibility = 'visible'; ToggleWallComment('../utility/ajax_mini_pages/ToggleWallComment.asp','" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "', 'off','" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "');return false;\">[Remove]</a></div>";
        temp.innerHTML += "<div style='color:#666666; margin: 0 0 0 0;'><a href='profile.asp?member=" + str.getElementsByTagName('createdby')[0].firstChild.nodeValue + "'>" + str.getElementsByTagName('createdbyname')[0].firstChild.nodeValue + "</a> (" + str.getElementsByTagName('commenttype')[0].firstChild.nodeValue +  ") on " + str.getElementsByTagName('time')[0].firstChild.nodeValue + "</div>";
        temp.innerHTML += "<div style='margin: 0 0 0 4;'>" + str.getElementsByTagName('commenttext')[0].firstChild.nodeValue + "</div>";
        temp.innerHTML += "<div id='feeditemsubcomments" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "'>";
        temp.innerHTML += "</div>";
        temp.innerHTML += "<div>";
        temp.innerHTML += "    <input id='statuscommentfield" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "' name='statuscommentfield" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "'  style='height:17px; width: 200px; margin:3 10 2 10;' />";
        temp.innerHTML += "    <a href='#' onClick=\"if (document.getElementById('statuscommentfield" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "').value != ''){document.getElementById('loadinggif" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "').style.visibility = 'visible'; PostStatusComment('../utility/ajax_mini_pages/PostStatusComment.asp','" + str.getElementsByTagName('createdby')[0].firstChild.nodeValue + "','0',document.getElementById('statuscommentfield" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "').value,'" + str.getElementsByTagName('loginid')[0].firstChild.nodeValue + "','" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "');} return false;\"><span style='background-color:#ffffff; color:#000000; padding:3 5 3 5px; position:relative; top:-3px; border:solid 1px #aaaaaa; font-weight:bold; font-size:10px;'>Comment</span></a>"; 
        temp.innerHTML += "    <img id='loadinggif" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "' border='1' src='i/loading.GIF' style='margin:0 0 0 10; visibility:hidden;' />";
        temp.innerHTML += "</div>";
          
        //alert(temp.innerHTML);
	    document.getElementById('feed').insertBefore(temp, document.getElementById('feed').firstChild);
		document.getElementById('newstatus').value = "";
		document.getElementById('loadinggif2').style.visibility ='hidden';
		
		document.getElementById('norecentactivity').style.display ='none';
	}
	
	function PostStatusComment(strURL, memberid, mediaid, comment, createdby, parentid) {
	    
	   
		var xmlHttpReq = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
		}
		self.xmlHttpReq.open('POST', strURL, true);
		self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		self.xmlHttpReq.onreadystatechange = function() {
			if (self.xmlHttpReq.readyState == 4) {
			   PostStatusCommentUpdate(self.xmlHttpReq.responseXML.documentElement);
			   //PostStatusCommentUpdate(self.xmlHttpReq.responseText);
			}
		}
		self.xmlHttpReq.send("memberid=" + encodeURI(memberid) + "&mediaid=" + encodeURI(mediaid) + "&comment=" + encodeURI(comment) + "&createdby=" + encodeURI(createdby) +  "&parentid=" + encodeURI(parentid));
	}
	
	function PostStatusCommentUpdate(str){
	
		var temp = document.createElement("div");
        temp.id = "feeditem" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue;
        temp.className = "StatusItemComment bloopAnimation"
        temp.onmouseover = new Function("if (document.getElementById('remove" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "') != null) {document.getElementById('remove" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "').style.visibility = 'visible';}");
        temp.onmouseout  = new Function("if (document.getElementById('remove" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "') != null) {document.getElementById('remove" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "').style.visibility = 'hidden';}");
        temp.innerHTML += "<div id='remove" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "' style='float:right; visibility:hidden; font-size:10px; position:relative; top:0px;'><a href='#' onClick=\"document.getElementById('loadinggif" + str.getElementsByTagName('parentid')[0].firstChild.nodeValue + "').style.visibility = 'visible'; ToggleWallComment('../utility/ajax_mini_pages/ToggleWallComment.asp','" + str.getElementsByTagName('commentid')[0].firstChild.nodeValue + "', 'off','" + str.getElementsByTagName('parentid')[0].firstChild.nodeValue + "');return false;\">[Remove]</a></div>";
        temp.innerHTML += "<div style='margin: 0 0 0 0;'>" + str.getElementsByTagName('commenttext')[0].firstChild.nodeValue + "</div>";
        temp.innerHTML += "<div style='float:right; clear:both; color:#666666; '><a href='profile.asp?member=" + str.getElementsByTagName('createdby')[0].firstChild.nodeValue + "'>" + str.getElementsByTagName('createdbyname')[0].firstChild.nodeValue + "</a> on " + str.getElementsByTagName('time')[0].firstChild.nodeValue + "</div><br>";
       //alert('feeditemsubcomments' + str.getElementsByTagName('parentid')[0].firstChild.nodeValue);
        document.getElementById('feeditemsubcomments' + str.getElementsByTagName('parentid')[0].firstChild.nodeValue).appendChild(temp);
		document.getElementById('statuscommentfield' + str.getElementsByTagName('parentid')[0].firstChild.nodeValue).value = "";
		document.getElementById('loadinggif' + str.getElementsByTagName('parentid')[0].firstChild.nodeValue).style.visibility ='hidden';
	}
	
	function RemoveFriend(strURL, you, friend) {

		var xmlHttpReq = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
		}
		self.xmlHttpReq.open('POST', strURL, true);
		self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		self.xmlHttpReq.onreadystatechange = function() {
			if (self.xmlHttpReq.readyState == 4) {
			    RemoveFriendUpdate(self.xmlHttpReq.responseText)
			}
		}
		self.xmlHttpReq.send("you=" + encodeURI(you) + "&friend=" + encodeURI(friend));
	}
	
	function RemoveFriendUpdate(str){
		document.getElementById('status').innerHTML = str;
		setTimeout("parent.parent.location='http://www.roadscholar.org/social/MyProfile.asp'",2000);
	}
	
	
	
	

	
	
	
	function showToolTip(show) 
	{
		var helpToolTip = document.getElementById('help');
		
		helpToolTip.style.top = window.event.clientY - 200 + document.body.scrollTop;
		helpToolTip.style.left = window.event.clientX - 420;
		
		if (show) 
			helpToolTip.style.display = 'block';
		else
			helpToolTip.style.display = 'none';
	
	return true;
	}
	
	function showSharePopUp(params) 
	{
		var showSharePopUp = document.getElementById('shareBox');
		document.getElementById('shareBoxContents').innerText = "http://www.roadscholar.org/social/GroupTopic.asp?" + params;
		showSharePopUp.style.top = window.event.clientY - 143 + document.body.scrollTop;
		showSharePopUp.style.left = window.event.clientX - 520;
        
		showSharePopUp.style.display = 'block';
	
	return true;
}


    


	


