PageSourceSearch

https://www.arabamerica.com/wp-content/themes/arabamerica/assets/js/functions.js?ver=1.0.0

js arabamerica.com collected 2026-09-24 08:55:58 UTC 8,548 bytes, 315 lines download raw bytes

1var win = null;
2function NewWindow(mypage, myname, w, h, scroll, pos) {
3    if (pos == "random") {
4        LeftPosition = (screen.width) ? Math.floor(Math.random() * (screen.width - w)) : 100;
5        TopPosition = (screen.height) ? Math.floor(Math.random() * ((screen.height - h) - 75)) : 100;
6    }
7    if (pos == "center") {
8        LeftPosition = (screen.width) ? (screen.width - w) / 2 : 100;
9        TopPosition = (screen.height) ? (screen.height - h) / 2 : 100;
10    }
11    else if ((pos != "center" && pos != "random") || pos == null) {
12        LeftPosition = 0;
13        TopPosition = 20
14    }
15    settings = 'width=' + w + ',height=' + h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=' + scroll + ',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
16    win = window.open(mypage, myname, settings);
17    win.focus();
18}
19
20
21jQuery(document).ready(function () {
22  $('.featured .flexslider').flexslider({
23    animation: "fade",
24	slideshowSpeed: 5000
25  });
26  $('.flex-standard .flexslider').flexslider({
27    animation: "slide",
28	slideshowSpeed: 5000,
29	slideshow: false,
30  });
31  $('.flex-widget .flexslider').flexslider({
32    animation: "fade",
33	slideshowSpeed: 4000,
34	controlNav: false,
35	directionNav: false,
36	touch: false,
37	pauseOnAction: false
38  });
39  
40   
41    setTimeout(function() {
42      $('#ads-close').trigger('click');
43    }, 15000);
44    
45    
46    $('#subscribe_form').submit(function(e) {
47        if(this.ea.value === ''){
48            e.preventDefault();
49            alert('Please fill your email');
50        } 
51      });
52
53    BannerHeight = $('.ads-block').outerHeight();
54    HeaderHeight = $('header.main').outerHeight();
55    HeaderTop = $('.header-top').outerHeight();
56    WindowWidth = $(window).width();
57
58    Scroll = BannerHeight + HeaderHeight;
59
60    $('#ads-close').click(function () {
61        $('.ads-block').fadeOut('slow');
62        Scroll = HeaderHeight;
63    });
64    
65    $('a.gotop, .top-lnks li a').click(function () {
66        var target = $(this).attr('href');
67        $('.header-top').removeClass('fixed');
68        $('.header-bot').css('margin-top', 0);
69        $('.sidebar').removeClass('fixed');
70        $('.sidebar').css('margin-top', 0);
71        $('html, body').animate({scrollTop: $(target).offset().top - 141}, 300);
72        return false;
73    });
74
75
76
77
78    $(window).resize(function () {
79
80        BannerHeight = $('.ads-block').outerHeight();
81        HeaderHeight = $('header.main').outerHeight();
82        HeaderTop = $('.header-top').outerHeight();
83        WindowWidth = $(window).width();
84
85        Norm();
86
87    });
88
89    function Norm() {
90        var scroll = $(window).scrollTop();
91		  var sidebar = $('.sidebar').height();
92		  
93        if (WindowWidth > 768) {
94            $('.header-top').removeClass('fixed');
95            $('.header-bot').css('margin-top', 0);
96
97            if (scroll >= Scroll) {
98                $('header.main').addClass('fixed');
99                $('main').css('margin-top', HeaderHeight + 'px');
100            } else {
101                $('header.main').removeClass('fixed');
102                $('main').css('margin-top', 0);
103            }
104
105        } else {
106
107            $('header.main').removeClass('fixed');
108            $('main').css('margin-top', 0);
109
110            if (scroll >= HeaderTop) {
111                $('.header-top').addClass('fixed');
112                $('.header-bot').css('margin-top', HeaderTop + 'px');
113
114            } else {
115                $('.header-top').removeClass('fixed');
116                $('.header-bot').css('margin-top', 0);
117            }
118        }
119        if (WindowWidth > 540) {
120		  		$('main .center').css('padding-bottom', 0);
121		  } else {
122		  		$('main .center').css('padding-bottom', sidebar + 'px');
123		  }
124    }
125
126    $(window).scroll(function () {
127        Norm();
128    });
129
130
131    $(window).resize(function () {
132        var sidebar = $('.sidebar').height();
133        $('.content').css('min-height', sidebar + 'px');
134    });
135
136    $('.menu-btn').click(function () {
137        if ($('body').hasClass('nav-opened')) {
138            $('body').removeClass('nav-opened');
139        } else {
140            $('body').addClass('nav-opened');
141        }
142    });
143
144
145
146    //$('select').selectBoxIt();
147	 $('select:not([multiple])').selectBoxIt();
148
149    var sidebarl = $('.left-sidebar').height();
150
151
152    $(window).scroll(function () {
153        if (WindowWidth > 540) {
154            var HeaderHeight = $('header.main').outerHeight();
155            var BannerHeight = $('.ads-block').outerHeight();
156            var WindowHeight = $(window).height();
157            var scrollBottom = $(window).scrollTop() + WindowHeight;
158            var sidebar = $('.sidebar');
159            var sidebarLeft = $('.left-sidebar');
160            var sidebarWrapHeight = $('.sidebar').outerHeight();
161            var sidebarLeftWrapHeight = $('.left-sidebar').outerHeight();
162            var sidebarHeight = sidebar.outerHeight() + BannerHeight + HeaderHeight + 45;
163
164            var sidebarLeftHeight = sidebarLeft.outerHeight() + BannerHeight + HeaderHeight + 45;
165            var sidebarLeftTop = WindowHeight - BannerHeight - HeaderHeight + 45;
166            var Top = HeaderHeight + 5;
167
168            var scroll = $(window).scrollTop();
169
170            if (scrollBottom > sidebarHeight) {
171                sidebar.addClass('fixed');
172                $('.sidebar-wrap').css('height', sidebarWrapHeight + 'px');
173            } else {
174                sidebar.removeClass('fixed');
175            }
176
177            if (sidebarLeftTop > sidebarLeftWrapHeight) {
178
179                if (scroll >= HeaderHeight) {
180                    sidebarLeft.addClass('fixed');
181                    sidebarLeft.css('top', Top + 'px');
182                    $('.left-sidebar-wrap').css('height', sidebarLeftWrapHeight + 'px');
183                } else {
184                    sidebarLeft.removeClass('fixed')
185                }
186
187            } else {
188                if (scrollBottom > sidebarLeftHeight) {
189                    sidebarLeft.addClass('fixed');
190						  sidebarLeft.css('top', Top + 'px');
191                    $('.left-sidebar-wrap').css('height', sidebarLeftWrapHeight + 'px');
192                } else {
193                    sidebarLeft.removeClass('fixed');
194                }
195
196            }
197        }
198
199    });
200
201
202    $("#tabs").tabs();
203
204
205});
206
207function aa_checkField(ctrl, required, min, max, emptyMessage, minMessage, maxMessage) {
208	if (ctrl.value == "") {
209		if (required) {
210			aa_validatePrompt(ctrl, emptyMessage);
211			return (false);
212		}
213		else
214			return (true);
215	} 
216	else if (min > 0 && ctrl.value.length < min) {
217		aa_validatePrompt(ctrl, minMessage);
218		return (false);
219	} 
220	else if (max > 0 && ctrl.value.length > max) {
221		aa_validatePrompt(ctrl, maxMessage);
222		return (false);
223	} 
224	else
225		return (true);
226}
227
228function aa_isNumeric(n) {
229  return !isNaN(parseFloat(n)) && isFinite(n);
230}
231
232function aa_checkNumericField(ctrl, required, min, max, emptyMessage, invalidMessage, minMessage, maxMessage) {
233	if (ctrl.value == "") {
234		if (required) {
235			aa_validatePrompt(ctrl, emptyMessage);
236			return (false);
237		}
238		else
239			return (true);
240	}
241	else if (!aa_isNumeric(ctrl.value)) {
242		aa_validatePrompt(ctrl, invalidMessage);
243		return (false);
244	}
245	else {
246		value = parseFloat(ctrl.value);
247	
248		if (min !== null && value < min) {
249			aa_validatePrompt(ctrl, minMessage);
250			return (false);
251		} 
252		else if (max !== null && value > max) {
253			aa_validatePrompt(ctrl, maxMessage);
254			return (false);
255		} 
256		else
257			return (true);
258	}
259}
260
261function aa_checkCheckbox(ctrl, required, emptyMessage) {
262	if (!ctrl.checked) {
263		if (required) {
264			aa_validatePrompt(ctrl, emptyMessage);
265			return (false);
266		}
267		else
268			return (true);
269	} 
270	else
271		return (true);
272}
273
274function aa_checkEmail(ctrl, required, emptyMessage, invalidMessage) {
275	ind = ctrl.value.indexOf ('@', 0);
276
277	if (ctrl.value == "") {
278		if (required) {
279			aa_validatePrompt(ctrl, emptyMessage);
280			return (false);
281		}
282		else
283			return (true);
284	} else if (ind==-1 || ind==0 || ind==ctrl.value.length-1 
285               || ctrl.value.indexOf ('@', ind+1) != -1 || ctrl.value.indexOf ('.', ind+1) == -1) {
286		aa_validatePrompt(ctrl, invalidMessage);
287		return (false);
288	} else
289		return (true);
290}
291
292function aa_getSelectedButton(ctrl) {
293	for (i = 0; i < ctrl.length; i++) {
294		if (ctrl[i].checked) {
295			return(i);
296		}
297	}
298	return -1;
299}
300
301function aa_checkRadioButton(ctrl, message) {
302	if (aa_getSelectedButton(ctrl) == -1) {
303		aa_validatePrompt(ctrl[0], message);
304		return false;
305	}
306	else
307		return true;
308}
309
310function aa_validatePrompt(ctrl, PromptStr) {
311	alert (PromptStr);
312	ctrl.focus();
313	return;
314}
315

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.