function BugGeomInterface(map) { this.map = map; // map interface object this.elPointAdder = null; this.elLineAdder = null; this.elPolyAdder = null; this.elCheck = null; this.elCancel = null; this.elSender = null; this.layerGeom = null; this.layerGeomCtrl = null; this.geoms = null; this.geomsLastId = null; this.popup = null; this.itemcolors = null; this.httpRequest = null; this._create = function() { if (this.getCookie('err_rep_jmeno')) document.getElementById("frm_c_jmeno").value = this.getCookie('err_rep_jmeno'); if (this.getCookie('err_rep_email')) document.getElementById("frm_c_email").value = this.getCookie('err_rep_email'); if (this.getCookie('err_rep_telefon')) document.getElementById("frm_c_telefon").value = this.getCookie('err_rep_telefon'); this.elPointAdder = document.getElementById('bug_add_point'); this.elLineAdder = document.getElementById('bug_add_line'); this.elPolyAdder = document.getElementById('bug_add_poly'); this.elCheck = document.getElementById('bug_check'); this.elCancel = document.getElementById('bug_cancel'); this.elSender = document.getElementById('bug_send'); this.itemcolors = new Array(); this.itemcolors.push("#189A9A"); this.itemcolors.push("#49CFC9"); this.itemcolors.push("#FC7646"); this.itemcolors.push("#390079"); this.itemcolors.push("#FFEA00"); this.itemcolors.push("#FF0000"); this.itemcolors.push("#00FF00"); this.itemcolors.push("#FF98BF"); var styleMap = new OpenLayers.StyleMap({ "pointVertex": { pointRadius: 4, strokeColor: this.itemcolors[0], strokeWidth: 1, strokeOpacity: 1, fillColor: '#FFFFFF', fillOpacity: 1, cursor: 'pointer' } }, {extendDefault: true}); this.layerGeom = new OpenLayers.Layer.Vector("LayerGeom", {styleMap: styleMap}); this.map.map.addLayer(this.layerGeom); this.layerGeomCtrl = new OpenLayers.Control.ModifyFeature(this.layerGeom, {vertexRenderIntent: "pointVertex"}); this.layerGeomCtrl.mode = OpenLayers.Control.ModifyFeature.DRAG | OpenLayers.Control.ModifyFeature.RESHAPE; this.layerGeomCtrl.virtualStyle = new OpenLayers.Symbolizer.Point({ pointRadius: 3, strokeColor: this.itemcolors[0], strokeWidth: 1, strokeOpacity: 1, fillColor: '#FFFFFF', fillOpacity: 0.45, cursor: 'pointer' }); //this.layerGeomCtrl.standalone = true; this.layerGeom.events.register('beforefeaturemodified', this, this.onFeatureSelected); this.layerGeom.events.register('afterfeaturemodified', this, this.onFeatureUnselected); this.map.map.addControl(this.layerGeomCtrl); this.layerGeomCtrl.activate(); this.geoms = new Array(); this.geomsLastId = 0; this.attachEvents(); } this.onSendClick = function() { this.closeInfo(); this.sendMessage(); return false; } this.sendMessage = function() { var size = 0, key; for (key in this.geoms) { if (this.geoms.hasOwnProperty(key)) size++; } if (size) { document.getElementById("sp_errormessage").innerHTML = ""; document.getElementById("sp_errormessage").style.display = "none"; document.getElementById("messagecontainer").style.zIndex = 999; } else { alert("Chybové hlášení musí obsahovat alespoň jeden bod, linii nebo plochu."); } return false; } this.onCloseClick = function() { this.closeMessage(); return false; } this.closeMessage = function() { document.getElementById("messagecontainer").style.zIndex = -999; document.getElementById("sp_errormessage").innerHTML = ""; document.getElementById("sp_errormessage").style.display = "none"; } this.onCheckClick = function() { this.checkMessage(); } this.checkMessage = function() { if ((document.getElementById("frm_c_email").value.length) && (!(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(document.getElementById("frm_c_email").value)))) { document.getElementById("sp_errormessage").innerHTML = "Chyba: Zadaná e-mailová adresa nemá platný tvar."; document.getElementById("sp_errormessage").style.display = "block"; return false; } if (document.getElementById("frm_c_email").value.length || document.getElementById("frm_c_telefon").value.length) { document.getElementById("sp_errormessage").innerHTML = "Prosím čekejte, chybové hlášení se odesílá."; document.getElementById("sp_errormessage").style.display = "block"; var ptss = ""; var liness = ""; var filleds = ""; var key; for (key in this.geoms) { if (this.geoms.hasOwnProperty(key)) { if (this.geoms[key].type == 'point') { if (ptss.length) ptss+= "|"; var ll = this.map.getLatLngFromPoint(this.geoms[key].feature.geometry.getVertices()[0]); ptss+= ll.lat + ":" + ll.lng; ptss+= ";" + this.encodeString(this.geoms[key].desc); ptss+= ";" + this.encodeString(this.geoms[key].color); } else if (this.geoms[key].type == 'line') { if (liness.length) liness+= "|"; tpts = ""; var pts = this.geoms[key].feature.geometry.getVertices() for (ti2 = 0; ti2 < pts.length; ti2++) { if (tpts.length) tpts+= ":"; var ll = this.map.getLatLngFromPoint(pts[ti2]); tpts+= ll.lat + ":" + ll.lng; } liness+= tpts; liness+= ";" + this.encodeString(this.geoms[key].desc); liness+= ";" + this.encodeString(this.geoms[key].color); } else { if (filleds.length) filleds+= "|"; tpts = ""; var pts = this.geoms[key].feature.geometry.getVertices() for (ti2 = 0; ti2 < pts.length; ti2++) { if (tpts.length) tpts+= ":"; var ll = this.map.getLatLngFromPoint(pts[ti2]); tpts+= ll.lat + ":" + ll.lng; } filleds+= tpts; filleds+= ";" + this.encodeString(this.geoms[key].desc); filleds+= ";" + this.encodeString(this.geoms[key].color); } } } this.setCookie('err_rep_jmeno', document.getElementById("frm_c_jmeno").value); this.setCookie('err_rep_email', document.getElementById("frm_c_email").value); this.setCookie('err_rep_telefon', document.getElementById("frm_c_telefon").value); var post = ""; post+= "predmet=" + this.encodeString(document.getElementById("frm_c_nadpis").value); post+= "&popis=" + this.encodeString(document.getElementById("frm_c_popis").value); post+= "&jmeno=" + this.encodeString(document.getElementById("frm_c_jmeno").value); post+= "&email=" + this.encodeString(document.getElementById("frm_c_email").value); post+= "&telefon=" + this.encodeString(document.getElementById("frm_c_telefon").value); post+= "&pts=" + ptss; post+= "&lines=" + liness; post+= "&filled=" + filleds; if (document.getElementById("frm_is_uploaded").value == 1) post+= "&is_uploaded=1"; else post+= "&is_uploaded=0"; var url = "processmessage.php"; //prompt(url+post, url+post); if (window.ActiveXObject) { this.httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); } else { this.httpRequest = new XMLHttpRequest(); } this.httpRequest.open("POST", url, true); this.httpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8"); this.httpRequest.setRequestHeader("Content-length", post.length); this.httpRequest.setRequestHeader("Connection", "close"); this.httpRequest.onreadystatechange = jQuery.proxy(this.messageDoSendRequest, this); this.httpRequest.send(post); } else { document.getElementById("sp_errormessage").innerHTML = "Chyba: Pro odeslání chybového hlášení je potřeba zadat alespoň e-mail nebo telefon."; document.getElementById("sp_errormessage").style.display = "block"; } return false; } this.messageDoSendRequest = function() { if (this.httpRequest.readyState == 4) { if (this.httpRequest.status == 200) { //window.clearTimeout(timeout); //alert(this.httpRequest.responseText); var doc = null; if (doc = this.httpRequest.responseXML) { if (doc.getElementsByTagName("error")[0].firstChild.data != "0") { document.getElementById("sp_errormessage").innerHTML = doc.getElementsByTagName("errordesc")[0].firstChild.data; document.getElementById("sp_errormessage").style.display = "block"; } else { alert("Chybové hlášení bylo úspěšně odesláno. Děkujeme."); this.closeMessage(); this.resetMap(); } } else alert("Nebylo možné uložit výlet."); } } } this.resetMap = function() { this.layerGeomCtrl.unselectFeature(); var key; for (key in this.geoms) { if (this.geoms.hasOwnProperty(key)) { this.removeGeom(key); } } } this.encodeString = function(str) { var res = ""; var src = str + ""; res = src.replace(/\=/g, "#EQU#").replace(/\&/g, "#AMP#").replace(/\:/g, "#DIV#").replace(/;/g, "#SEM#").replace(/\|/g, "#COL#"); return res; } this.decodeString = function(str) { var res = ""; var src = str + ""; res = src.replace(/#EQU#/g, '=').replace(/#AMP#/g, '&').replace(/#DIV#/g, ':').replace(/#SEM#/g, ';').replace(/#COL#/g, '|'); return res; } this.onFeatureSelected = function(ev) { this.showInfo(ev.feature.fId); } this.onFeatureUnselected = function(ev) { this.closeInfo(); } this.closeInfo = function() { if (this.popup) { if (this.geoms[this.selectedFeature]) { if (document.getElementById('desc_ta')) this.geoms[this.selectedFeature].desc = document.getElementById('desc_ta').value; } this.map.map.removePopup(this.popup); //this.popup.destroy(); //this.popup = null; } } this.showInfo = function(id) { if (this.popup) { this.closeInfo(); } //var pos = this.geoms[id].feature.geometry.getCentroid(); //var ll = new OpenLayers.LonLat(pos.x, pos.y); var bnds = this.geoms[id].feature.geometry.getBounds(); var ll = new OpenLayers.LonLat(bnds.right, bnds.top); var numId = 0; var numCount = 0; var key; for (key in this.geoms) { if (this.geoms.hasOwnProperty(key)) { numCount++; if (key == id) numId = numCount; } } var anchor = { 'size': new OpenLayers.Size(0, 0), 'offset': new OpenLayers.Pixel(20, 0) }; var infocont = "Popis:
"; infocont+= ""; infocont+= "
"; infocont+= "
"; infocont+= " "; infocont+= " "; infocont+= " "; infocont+= " "; infocont+= " "; infocont+= " "; infocont+= " "; infocont+= " "; infocont+= "
"; if (this.loadedReport) { //infocont+= " "; infocont+= ""; } else { //infocont+= " "; infocont+= ""; } if (this.loadedReport) { infocont+= " "; infocont+= " " + numId + "/" + numCount + " "; } this.selectedFeature = id; this.popup = new OpenLayers.Popup.Anchored( 'popup', ll, new OpenLayers.Size(290, 290), infocont, anchor, true ); this.popup.calculateRelativePosition = function(px) {return 'br';} this.map.map.addPopup(this.popup); $('#trasa_barva_button_0').bind('click', {color: 0}, jQuery.proxy(this.onClickChangeColor, this)); $('#trasa_barva_button_1').bind('click', {color: 1}, jQuery.proxy(this.onClickChangeColor, this)); $('#trasa_barva_button_2').bind('click', {color: 2}, jQuery.proxy(this.onClickChangeColor, this)); $('#trasa_barva_button_3').bind('click', {color: 3}, jQuery.proxy(this.onClickChangeColor, this)); $('#trasa_barva_button_4').bind('click', {color: 4}, jQuery.proxy(this.onClickChangeColor, this)); $('#trasa_barva_button_5').bind('click', {color: 5}, jQuery.proxy(this.onClickChangeColor, this)); $('#trasa_barva_button_6').bind('click', {color: 6}, jQuery.proxy(this.onClickChangeColor, this)); $('#trasa_barva_button_7').bind('click', {color: 7}, jQuery.proxy(this.onClickChangeColor, this)); $('#trasa_zmenit_button').bind('click', jQuery.proxy(this.onClickChange, this)); $('#trasa_odstranit_button').bind('click', jQuery.proxy(this.onClickRemove, this)); if (this.loadedReport) { $('#trasa_gpx_button').bind('click', jQuery.proxy(this.onClickGPX, this)); $('#trasa_prev_button').bind('click', jQuery.proxy(this.onClickPrev, this)); $('#trasa_next_button').bind('click', jQuery.proxy(this.onClickNext, this)); } } this.onClickChange = function(e) { if (this.geoms[this.selectedFeature]) { this.geoms[this.selectedFeature].desc = document.getElementById('desc_ta').value; this.closeInfo(); } } this.onClickRemove = function(e) { if (this.geoms[this.selectedFeature]) { this.layerGeomCtrl.unselectFeature(this.geoms[this.selectedFeature].feature); this.removeGeom(this.selectedFeature); this.closeInfo(); } } this.onClickGPX = function(e) { if (this.geoms[this.selectedFeature]) { this.exportGPXDoSend(this.selectedFeature); } } this.onClickPrev = function() { var key; var firstFound = false; var switchTo = ''; for (key in this.geoms) { if (this.geoms.hasOwnProperty(key)) { if (key == this.selectedFeature) firstFound = true; if (!firstFound) { switchTo = key; } } } if (switchTo != '') { this.showInfo(switchTo); } } this.onClickNext = function() { var key; var firstFound = false; var switchTo = ''; for (key in this.geoms) { if (this.geoms.hasOwnProperty(key)) { if (firstFound) { switchTo = key; firstFound = false; } if (key == this.selectedFeature) firstFound = true; } } if (switchTo != '') { this.showInfo(switchTo); } } this.removeGeom = function(id) { this.layerGeom.removeFeatures([this.geoms[id].feature]); this.geoms[id].feature = null; delete this.geoms[id]; } this.onClickChangeColor = function(e) { if (this.geoms[this.selectedFeature]) { this.selectFeatureColor(this.selectedFeature, e.data.color); this.updateFeature(this.selectedFeature); for (var ti = 0; ti <= 7; ti++) { if (ti == e.data.color) { document.getElementById('trasa_barva_button_' + ti).style.border = '3px solid #000000'; } else { document.getElementById('trasa_barva_button_' + ti).style.border = '3px solid #FFFFFF'; } } } return false; } this.selectFeatureColor = function(id, color) { this.geoms[this.selectedFeature].color = color; } this.updateFeature = function(id) { if (this.geoms[id].type == 'point') { this.geoms[id].feature.style.strokeColor = this.itemcolors[this.geoms[id].color]; this.geoms[id].feature.style.fillColor = this.itemcolors[this.geoms[id].color]; } else if (this.geoms[id].type == 'line') { this.geoms[id].feature.style.strokeColor = this.itemcolors[this.geoms[id].color]; this.geoms[id].feature.style.fillColor = this.itemcolors[this.geoms[id].color]; } else { this.geoms[id].feature.style.strokeColor = this.itemcolors[this.geoms[id].color]; this.geoms[id].feature.style.fillColor = this.itemcolors[this.geoms[id].color]; } this.layerGeom.drawFeature(this.geoms[id].feature); } this.addPoint = function() { var bnds = this.map.getBounds(); var center = new OLM.LatLng((bnds[1] + bnds[3]) / 2, (bnds[0] + bnds[2]) / 2); if (arguments.length == 3) { center.lat = arguments[0].lat; center.lng = arguments[0].lng; } else { center.lat+= (Math.random() - 0.5) * 0.05 * (bnds[3] - bnds[1]); center.lng+= (Math.random() - 0.5) * 0.05 * (bnds[2] - bnds[0]); } this.geomsLastId++; var desc = ''; if (arguments.length == 3) { desc = arguments[1]; } var col = 0; if (arguments.length == 3) { col = arguments[2]; } var geom = { 'type': 'point', 'id': 'g' + this.geomsLastId, 'feature': null, 'desc': desc, 'color': col }; geom.feature = new OpenLayers.Feature.Vector( this.map.pointFromLatLng(center), null, { pointRadius: 10, strokeColor: this.itemcolors[geom.color], strokeOpacity: 0.75, fillColor: this.itemcolors[geom.color], fillOpacity: 0.35 } ); geom.feature.fId = 'g' + this.geomsLastId; this.geoms['g' + this.geomsLastId] = geom; this.layerGeom.addFeatures([geom.feature]); if (arguments.length != 3) { this.layerGeomCtrl.selectFeature(geom.feature); this.showInfo(geom.feature.fId); } } this.addLine = function() { var bnds = this.map.getBounds(); var center = new OLM.LatLng((bnds[1] + bnds[3]) / 2, (bnds[0] + bnds[2]) / 2); center1 = new OLM.LatLng( center.lat + ((Math.random()) * 0.15 + 0.1) * (bnds[3] - bnds[1]), center.lng + ((Math.random()) * 0.15 + 0.1) * (bnds[2] - bnds[0]) ); center2 = new OLM.LatLng( center.lat - ((Math.random()) * 0.15 + 0.1) * (bnds[3] - bnds[1]), center.lng - ((Math.random()) * 0.15 + 0.1) * (bnds[2] - bnds[0]) ); this.geomsLastId++; var desc = ''; if (arguments.length == 3) { desc = arguments[1]; } var col = 0; if (arguments.length == 3) { col = arguments[2]; } var geom = { 'type': 'line', 'id': 'g' + this.geomsLastId, 'feature': null, 'desc': desc, 'color': col }; var line; if (arguments.length == 3) { line = arguments[0]; } else { line = [this.map.pointFromLatLng(center1), this.map.pointFromLatLng(center2)]; } geom.feature = new OpenLayers.Feature.Vector( new OpenLayers.Geometry.LineString(line), null, { strokeColor: this.itemcolors[geom.color], strokeWidth: 5, strokeOpacity: 0.75 } ); geom.feature.fId = 'g' + this.geomsLastId; this.geoms['g' + this.geomsLastId] = geom; this.layerGeom.addFeatures([geom.feature]); if (arguments.length != 3) { this.layerGeomCtrl.selectFeature(geom.feature); this.showInfo(geom.feature.fId); } } this.addPoly = function() { var bnds = this.map.getBounds(); var center = new OLM.LatLng((bnds[1] + bnds[3]) / 2, (bnds[0] + bnds[2]) / 2); center.lat+= (Math.random() - 0.5) * 0.25 * (bnds[3] - bnds[1]); center.lng+= (Math.random() - 0.5) * 0.25 * (bnds[2] - bnds[0]); center1 = new OLM.LatLng( center.lat + (Math.random() - 1.5) * 0.05 * (bnds[3] - bnds[1]), center.lng + (Math.random() - 1) * 0.05 * (bnds[2] - bnds[0]) ); center2 = new OLM.LatLng( center.lat + (Math.random() - 1.5) * 0.05 * (bnds[3] - bnds[1]), center.lng + (Math.random() + 1) * 0.05 * (bnds[2] - bnds[0]) ); center3 = new OLM.LatLng( center.lat + (Math.random() + 1) * 0.05 * (bnds[3] - bnds[1]), center.lng + (Math.random()) * 0.05 * (bnds[2] - bnds[0]) ); this.geomsLastId++; var desc = ''; if (arguments.length == 3) { desc = arguments[1]; } var col = 0; if (arguments.length == 3) { col = arguments[2]; } var geom = { 'type': 'poly', 'id': 'g' + this.geomsLastId, 'feature': null, 'desc': desc, 'color': col }; var poly; if (arguments.length == 3) { poly = arguments[0]; } else { poly = [this.map.pointFromLatLng(center1), this.map.pointFromLatLng(center2), this.map.pointFromLatLng(center3)]; } geom.feature = new OpenLayers.Feature.Vector( new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing(poly)]), null, { strokeColor: this.itemcolors[geom.color], strokeWidth: 5, strokeOpacity: 0.75, fillColor: this.itemcolors[geom.color], fillOpacity: 0.35 } ); geom.feature.fId = 'g' + this.geomsLastId; this.geoms['g' + this.geomsLastId] = geom; this.layerGeom.addFeatures([geom.feature]); if (arguments.length != 3) { this.layerGeomCtrl.selectFeature(geom.feature); this.showInfo(geom.feature.fId); } } this.exportAllGPXDoSend = function() { var coords = ""; var id; for (id in this.geoms) { if (this.geoms.hasOwnProperty(id)) { if (coords.length) coords+= "|_"; if (this.geoms[id].type == 'point') { if (coords.length) coords+= "|"; var ll = this.map.getLatLngFromPoint(this.geoms[id].feature.geometry.getVertices()[0]); coords+= ll.lng + ":" + ll.lat; } else if (this.geoms[id].type == 'line') { var pts = this.geoms[id].feature.geometry.getVertices() for (var ti2 = 0; ti2 < pts.length; ti2++) { if (coords.length) coords+= "|"; var ll = this.map.getLatLngFromPoint(pts[ti2]); coords+= ll.lng + ":" + ll.lat; } } else { var pts = this.geoms[id].feature.geometry.getVertices() for (var ti2 = 0; ti2 < pts.length; ti2++) { if (coords.length) coords+= "|"; var ll = this.map.getLatLngFromPoint(pts[ti2]); coords+= ll.lng + ":" + ll.lat; } coords+= "|"; var ll = this.map.getLatLngFromPoint(pts[0]); coords+= ll.lng + ":" + ll.lat; } } } if (coords.length) { var url = "../cykloatlas/processexport.php"; var params = "line=" + coords + "&pois="; if (window.ActiveXObject) { this.httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); } else { this.httpRequest = new XMLHttpRequest(); } this.httpRequest.open("POST", url, true); this.httpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8"); this.httpRequest.setRequestHeader("Content-length", params.length); this.httpRequest.setRequestHeader("Connection", "close"); this.httpRequest.onreadystatechange = jQuery.proxy(this.exportGPXDoSendRequest, this); this.httpRequest.send(params); } else alert("Nebylo možné dokončit export."); } this.exportGPXDoSend = function(id) { if (this.geoms.hasOwnProperty(id)) { var coords = ""; if (this.geoms[id].type == 'point') { //if (coords.length) coords+= "|"; var ll = this.map.getLatLngFromPoint(this.geoms[id].feature.geometry.getVertices()[0]); coords+= ll.lng + ":" + ll.lat; } else if (this.geoms[id].type == 'line') { //if (coords.length) coords+= "|"; var pts = this.geoms[id].feature.geometry.getVertices() for (var ti2 = 0; ti2 < pts.length; ti2++) { if (coords.length) coords+= "|"; var ll = this.map.getLatLngFromPoint(pts[ti2]); coords+= ll.lng + ":" + ll.lat; } } else { //if (coords.length) coords+= "|"; var pts = this.geoms[id].feature.geometry.getVertices() for (var ti2 = 0; ti2 < pts.length; ti2++) { if (coords.length) coords+= "|"; var ll = this.map.getLatLngFromPoint(pts[ti2]); coords+= ll.lng + ":" + ll.lat; } } var url = "../cykloatlas/processexport.php"; var params = "line=" + coords + "&pois="; if (window.ActiveXObject) { this.httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); } else { this.httpRequest = new XMLHttpRequest(); } this.httpRequest.open("POST", url, true); this.httpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8"); this.httpRequest.setRequestHeader("Content-length", params.length); this.httpRequest.setRequestHeader("Connection", "close"); this.httpRequest.onreadystatechange = jQuery.proxy(this.exportGPXDoSendRequest, this); this.httpRequest.send(params); } else alert("Nebylo možné dokončit export."); } this.exportGPXDoSendRequest = function() { if (this.httpRequest.readyState == 4) { if (this.httpRequest.status == 200) { if (doc = this.httpRequest.responseXML) { if (doc.getElementsByTagName("error")[0].firstChild.data != "0") { alert(this.txtUnableToExport); } else { url = "../cykloatlas/processexport.php?cre=1&r=" + Math.round(Math.random()*1000000); window.location.href = url; } } else alert("Nebylo možné dokončit export."); } } } this.onClickPointAdder = function() { this.addPoint(); return false; } this.onClickLineAdder = function() { this.addLine(); return false; } this.onClickPolyAdder = function() { this.addPoly(); return false; } this.attachEvents = function() { $(this.elPointAdder).bind('click', jQuery.proxy(this.onClickPointAdder, this)); $(this.elLineAdder).bind('click', jQuery.proxy(this.onClickLineAdder, this)); $(this.elPolyAdder).bind('click', jQuery.proxy(this.onClickPolyAdder, this)); $(this.elSender).bind('click', jQuery.proxy(this.onSendClick, this)); $(this.elCheck).bind('click', jQuery.proxy(this.onCheckClick, this)); $(this.elCancel).bind('click', jQuery.proxy(this.onCloseClick, this)); } this.setCookie = function(key, value) { var expires = new Date(); expires.setTime(expires.getTime() + (1 * 24 * 60 * 60 * 1000)); document.cookie = key + '=' + value + ';expires=' + expires.toUTCString(); } this.getCookie = function(key) { var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)'); return keyValue ? keyValue[2] : null; } this._create(); }