var PLILPwindowObject = { baseURL: 'http://minskexpo.com', jquery: false, oldJQ1: false, oldJQ2: false, initPLILPwindowinit: function () { /*if (typeof $ == 'function') { this.oldJQ1 = $ } if (typeof jQuery == 'function') { this.oldJQ2 = jQuery }*/ this.PLIPLcreatejs(this.baseURL + "/js/jquery-1.11.2.min.js"); this.PLIPLcreatestylesheet(this.baseURL + "/css/onlineconsultant_label.css"); this.PLIPLcreatestylesheet(this.baseURL + "/onlineconsultant_styles.php?cid=278"); }, initPLILPwindowlabel: function () { this.jquery = jQuery; jQuery.noConflict(true); /*if (this.oldJQ1) $ = this.oldJQ1; if (this.oldJQ2) jQuery = this.oldJQ2;*/ obj = this.jquery('
'); obj.addClass('plilp_window_label'); obj.appendTo(this.jquery('body')); objclose = this.jquery('
'); objclose.addClass('plilp_window_label_close'); objclose.appendTo(obj); obj2 = this.jquery('
'); obj2.addClass('plilp_window_label_i'); obj2.appendTo(obj); obj3 = this.jquery('
'); obj3.addClass('plilp_window_label_click'); obj3.html('
'); obj3.appendTo(obj2); this.jquery(obj3).bind('click', {mainCLass: this}, this.PLILPwindow); this.jquery(objclose).bind('click', {mainCLass: this}, this.PLILPwindowhide); this.PLIPLplace(0); this.jquery(window).bind('scroll', {mainCLass: this}, this.PLIPLplace); this.jquery(window).bind('load', {mainCLass: this}, this.PLIPLplace); this.jquery(window).bind('message', {mainCLass: this}, this.PLIPLmessage); }, PLIPLmessage: function (event) { if (event == 0) Selfclass = this; else Selfclass = event.data.mainCLass; data = event.originalEvent.data; if (data == 'onlineconsultantalertmessage') { oldDocumentTitle = document.title; document.title = 'Вам сообщение'; setTimeout(function () {document.title = oldDocumentTitle}, 2000); Selfclass.PLILPwindow(event); //alert('pokl'); } }, PLIPLplace: function (event) { //alert('OPKL'); if (event == 0) Selfclass = this; else Selfclass = event.data.mainCLass; //Selfclass.jquery('.plilp_window_label').css({ top: pos + 'px', left: 0, right: 'auto' }); pos = parseInt(Selfclass.jquery(window).height() / 2) + Selfclass.jquery(window).scrollTop(); pos = pos - parseInt( Selfclass.jquery('.plilp_window_label').height() / 2); Selfclass.jquery('.plilp_window_label').css({ top: pos + 'px', right: 0 }); /*width = Selfclass.jquery(window).width(); documentwidth = Selfclass.jquery(document).width(); if (documentwidth > width) width = documentwidth; left = width - Selfclass.jquery('.plilp_window_label').width()-1; //alert(Selfclass.jquery('.plilp_window_label').width()); //alert(left); Selfclass.jquery('.plilp_window_label').css({ top: pos + 'px', left: left + 'px', right: 'auto', opacity: 1 });*/ }, PLIPLcreatestylesheet: function (css) { if (document.createStyleSheet) { document.createStyleSheet(css); } else { var e = document.createElement("link"); e.setAttribute("rel", "stylesheet"); e.setAttribute("href", css); document.body.appendChild(e) } }, PLIPLcreatejs: function (js) { /*var e = document.createElement("script"); e.setAttribute("type", "text/javascript"); e.setAttribute("src", js); document.body.appendChild(e)*/ var script = document.createElement('script'); script.setAttribute("type", "text/javascript"); if (script.readyState && false){ //IE script.onreadystatechange = function(){ if (script.readyState == "loaded" || script.readyState == "complete"){ script.onreadystatechange = null; this.initPLILPwindowlabel(); } }; } else { //Others var self = this script.onload = function() { self.initPLILPwindowlabel(); }; } script.setAttribute("src", js); document.body.appendChild(script); }, PLILPwindow: function (event) { //event.data.mainCLass.jquery('.plilp_window_label').css({ opacity: 0, left: 0 }); event.data.mainCLass.jquery('.plilp_window_label').addClass('plilp_window_label_opened'); event.data.mainCLass.jquery('.plilp_window_label_click').hide(); event.data.mainCLass.jquery('.plilp_window_label_close').show(); managerid = 0; if (event.data.mainCLass.jquery('.template-land-managers-online-clicked').size()) { managerid = event.data.mainCLass.jquery('.template-land-managers-online-clicked').attr('data-userid'); } obj = event.data.mainCLass.jquery(''); obj.appendTo( event.data.mainCLass.jquery('.plilp_window_label_i') ); //event.data.mainCLass(obj).('load', {mainCLass: event.data.mainCLass}, event.data.mainCLass.PLIPLplace); //obj('load', function () { alert('pok'); }); //event.data.mainCLass.jquery(obj).bind('ready', {mainCLass: event.data.mainCLass}, event.data.mainCLass.PLIPLplace); var Selfclass = event.data.mainCLass; event.data.mainCLass.jquery(obj).ready(function (){ Selfclass.jquery(obj).bind('load', {mainCLass: Selfclass}, Selfclass.PLIPLplace); }); }, PLILPwindowhide: function (event) { event.data.mainCLass.jquery('.plilp_window_label_click').show(); event.data.mainCLass.jquery('.plilp_window_label_close').hide(); event.data.mainCLass.jquery('.plilp_window_label_i .plilp_main_frame').remove(); event.data.mainCLass.PLIPLplace(0); event.data.mainCLass.jquery('.plilp_window_label').removeClass('plilp_window_label_opened'); } } PLILPwindowObject.initPLILPwindowinit();