1 /* Popup Box function */
4 $.fn.popbox = function(options){
6 selector : this.selector,
10 arrow_border : '.arrow-border',
15 open: function(event){
16 event.preventDefault();
18 var box = $(this).parent().find(settings['box']);
19 box.find(settings['arrow']).css({'left': box.width()/2 - 10 + 46});
20 box.find(settings['arrow_border']).css({'left': box.width()/2 - 10 - 63});
21 if(box.css('display') == 'block'){
23 setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','999'); },200);
24 // $(".btn-panel-vertical,#actionsDropDown").css('z-index','999');
25 if($(window).scrollTop() > 20){
26 setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999'); },200);
27 // $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999');
29 $('.box1').fadeIn('slow');
31 $('.chatBox').fadeOut('fast');
32 $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999');
33 if(box.attr('target') == 'auth'){
34 box.find(settings['arrow']).css({'left': box.width()/2 + 36});
35 box.css({'display': 'block', 'top': 0, 'left': ((pop.parent().parent().width()/2) -box.width()/2 ) - 90});
38 box.find(settings['arrow']).css({'left': box.width()/2 - 42});
39 box.css({'display': 'block', 'top': 0, 'left': ((pop.parent().parent().width()/2) -box.width()/2-15 )});
40 box.find("#header_login_id").focus();
41 box.find('#header_password').val('');
47 $(settings['box']).fadeOut("fast");
51 $(document).bind('keyup', function(event){
52 if(event.keyCode == 27){
53 setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','999'); },200);
54 // $(".btn-panel-vertical,#actionsDropDown").css('z-index','999');
55 if($(window).scrollTop() > 20){
56 // setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999'); },200);
57 $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999');
62 // Close chat-box and popup on clicking out of chat-box
63 $(document).bind('click', function(event){
64 if(!($(event.target).closest('.chatBox').length || $(event.target).hasClass('chatIcon') || $(event.target).closest(settings['selector']).length)){
66 if ($("#actionsDropDown").css('z-index')=='-999'){
67 setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','999'); },200);
69 if($(window).scrollTop() > 20){
70 setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999'); },200);
71 // $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999');
74 $('.chatBox').fadeOut('fast');
79 return this.each(function(){
81 $(this).css({'width': $(settings['box']).width()}); // Width needs to be set otherwise popbox will not move when window resized.
82 $(settings['open'], this).bind('click', methods.open);
83 $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999');
84 $(settings['open'], this).parent().find(settings['close']).bind('click', function(event){
85 // $(".btn-panel-vertical,#actionsDropDown").css('z-index','999');
86 setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','999'); },200);
95 $('.popbox').popbox();
99 if($("#reg-fn-ln-id").length > 0){
100 var fnln = $("#reg-fn-ln-id").val().length;
102 var fnVar = $("#reg-fname-id").val();
103 var lnVar = $("#reg-lname-id").val();
105 var nameLen = fnVar.length + lnVar.length + 1; // 1 for space between the first name and the last name
106 if(fnVar != " " && lnVar != " "){
107 if(nameLen <= numChars){
108 displayName = fnVar+" "+lnVar;
109 }else if(nameLen <= (numChars * 2)){
110 displayName = fnVar+"<br/>"+lnVar;
113 if(fnVar.length < numChars && lnVar.length > numChars){ //Smaller first name and longer last name
114 displayName = fnVar+"<br/>"+lnVar.substring(0,numChars-1)+"...";
117 if(fnVar.length >= numChars ){ //Longer first name
118 // 2 = 1 for elipses, 1 for space between the first name and last name
119 longLName = numChars - ((fnVar.substring(numChars,fnVar.length)).length + 2);
120 displayName = fnVar.substring(0,numChars)+"<br/>"+fnVar.substring(numChars,fnVar.length)+" "+lnVar.substring(0,longLName)+"...";
125 displayName = fnVar+" "+lnVar;
129 $("#reg-userName").html(displayName);
133 /* ClickToChat ANONYMOUS FUNCTION DEFINITION *
134 * =============================================== *
135 * On clicking the chat icon displays the chat box */
138 var chatbox = $('.chatBox');
140 // var actionsDropDown = $('#actionsDropDown');
142 open: function(){chatbox.css('display','block');},
143 close: function(){chatbox.fadeOut('fast');}
145 $('.chatIcon').click(function(){
146 if (chatbox.css('display') == 'block'){
148 setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','999'); },200);
149 // $(".btn-panel-vertical,#actionsDropDown").css('z-index','999');
150 if($(window).scrollTop() > 20){
151 setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999'); },200);
152 // $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999');
155 $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999');
157 $(settings['box']).fadeOut("fast");
161 // Close chat-box on clicking cross icon
162 $('.circle_close_chat').click(function(){
163 // $(".btn-panel-vertical,#actionsDropDown").css('z-index','999');
164 setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','999'); },200);
166 if($(window).scrollTop() > 20){
167 setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999'); },200);
168 // $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999');
172 // Close chat-box on Escape key press
173 $(document).bind('keyup', function(event){
174 if(event.keyCode == 27){
175 setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','999'); },200);
177 if($(window).scrollTop() > 20){
178 setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999'); },200);
179 //$(".btn-panel-vertical,#actionsDropDown").css('z-index','-999');
184 // Close chat-box on clicking out of chat-box
185 // $(document).bind('click', function(event){
187 // console.log(event.target,"2");
188 // if(!($(event.target).closest('.chatBox').length || $(event.target).hasClass('chatIcon'))) {
189 // event.preventDefault();
190 // // console.log($(event.target).closest(settings['selector']).length);
191 // console.log($(event.target).closest('. ').length);
192 // console.log($(event.target).hasClass('chatIcon'));
195 // // $(".btn-panel-vertical,#actionsDropDown").css('z-index','999');
197 // if ($("#actionsDropDown").css('z-index')=='-999') {
198 // $(".btn-panel-vertical,#actionsDropDown").css('z-index','999');
200 // // if (flag!="clicked") {
201 // // if ($('.box').css('display') == 'block' || $('.chatBox').css('display') == 'block' ){
202 // // $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999');
204 // // $(".btn-panel-vertical,#actionsDropDown").css('z-index','999');