PageSourceSearch

http://www.starkosino.ru/components/com_community/assets/script-1.2.js

js starkosino.ru collected 2026-10-02 19:15:39 UTC 95,750 bytes, 2,772 lines download raw bytes

1if (typeof(joms)=='undefined')
2{
3	joms = {
4		jQuery: window.jQuery,
5		extend: function(obj){
6			this.jQuery.extend(this, obj);
7		}
8	}
9}
10
11joms.extend({
12	plugins: {
13		extend: function (obj){
14			//joms.jQuery.extend(joms.plugin, func);
15			joms.jQuery.extend(joms.plugins, obj);
16		},
17		initialize: function()
18		{
19			joms.jQuery.each(joms.plugins, function(index, value) {
20				try{
21				    value.initialize();
22				}
23				catch(err)
24				{
25					//Handle errors here
26				}
27			});
28		}
29	},
30	activities: {
31		getContent: function( activityId ){
32				jax.call('community' , 'activities,ajaxGetContent' , activityId );
33		},
34		setContent: function( activityId , content ){
35			joms.jQuery("#profile-newsfeed-item-content-" + activityId ).html( content );
36			joms.jQuery("#profile-newsfeed-item-content-" + activityId ).removeClass("small profile-newsfeed-item-action").addClass("newsfeed-content-hidden").slideDown();
37		},
38		showVideo: function( activityId ){
39			joms.jQuery('#profile-newsfeed-item-content-' + activityId + ' .video-object').slideDown();
40			joms.jQuery('#profile-newsfeed-item-content-' + activityId + ' .video-object embed').css('width' , joms.jQuery('#profile-newsfeed-item-content-' + activityId ).width() );
41		}
42	},
43	apps: {
44		windowTitle: '',
45		toggle: function (id){
46			joms.jQuery(id).children('.app-box-actions').slideToggle('fast');
47			joms.jQuery(id).children('.app-box-footer').slideToggle('fast');
48			joms.jQuery(id).children('.app-box-content').slideToggle('fast',
49				function() {
50
51					joms.jQuery.cookie( id , joms.jQuery(this).css('display') );
52					joms.jQuery(id).toggleClass('collapse', (joms.jQuery(this).css('display')=='none'));
53				}
54			);
55		},
56		showAboutWindow: function(appName){
57			var ajaxCall = "jax.call('community', 'apps,ajaxShowAbout', '"+appName+"');";
58			cWindowShow(ajaxCall, '', 450, 100);
59		},
60		showPrivacyWindow: function(appName){
61			var ajaxCall = "jax.call('community', 'apps,ajaxShowPrivacy', '"+appName+"');";
62			cWindowShow(ajaxCall, '', 450, 100);
63		},
64		showSettingsWindow: function(id, appName){
65			var ajaxCall = "jax.call('community', 'apps,ajaxShowSettings', '"+id+"', '"+appName+"');";
66			cWindowShow(ajaxCall, '', 450, 100);
67		},
68		savePrivacy: function(){
69			var value   = joms.jQuery('input[name=privacy]:checked').val();
70			var appName = joms.jQuery('input[name=appname]').val();
71			jax.call('community', 'apps,ajaxSavePrivacy', appName, value);
72		},
73		saveSettings: function(){
74			jax.call('community', 'apps,ajaxSaveSettings', jax.getFormValues('appSetting'));
75		},
76		remove: function(appName){
77			var ajaxCall = "jax.call('community', 'apps,ajaxRemove', '"+appName+"');";
78			cWindowShow(ajaxCall, this.windowTitle, 450, 100);
79		},
80		add: function(appName){
81			jax.call('community', 'apps,ajaxAdd', appName );
82		},
83		initToggle: function(){
84			joms.jQuery('.app-box').each(function(){
85				var id	= '#' + joms.jQuery(this).attr('id');
86
87				if(joms.jQuery.cookie( id )=='none')
88				{
89					joms.jQuery(id).addClass('collapse');
90					joms.jQuery(id).children('.app-box-actions').css('display' , 'none' );
91					joms.jQuery(id).children('.app-box-footer').css('display' , 'none' );
92					joms.jQuery(id).children('.app-box-content').css('display' , 'none' );
93				}
94			});
95		}
96	},
97	bookmarks:{
98		show: function( currentURI ){
99			var ajaxCall = "jax.call('community', 'bookmarks,ajaxShowBookmarks','" + currentURI + "');";
100			cWindowShow(ajaxCall, '', 450, 100);
101		},
102		email: function( currentURI ){
103
104			var formContent	= jax.getFormValues('bookmarks-email');
105			var content		= formContent[1][1];
106			var email		= formContent[0][1];
107
108			var ajaxCall = "jax.call('community', 'bookmarks,ajaxEmailPage','" + currentURI + "','" +  email + "',\"" + content + "\");";
109			cWindowShow( ajaxCall , '', 450, 100);
110		}
111	},
112	report: {
113		emptyMessage: '',
114
115		checkReport: function(){
116			if( joms.jQuery( '#report-message' ).val() == '' )
117			{
118				joms.jQuery( '#report-message-error' ).html( this.emptyMessage ).css( 'color' , 'red' );
119				return false;
120			}
121			return true;
122		},
123		showWindow: function ( reportFunc, arguments ){   
124			var ajaxCall	= 'jax.call("community" , "system,ajaxReport" , "' + reportFunc + '","' + location.href + '" ,' + arguments + ');';
125			cWindowShow(ajaxCall, '', 450, 100);
126		},
127		submit: function ( reportFunc , pageLink , arguments ){
128			if( joms.report.checkReport() )
129			{   
130				var message	= escape( joms.jQuery('#report-message').val() );
131				var ajaxcall='jax.call("community", "system,ajaxSendReport","' + reportFunc + '","' + location.href + '","' + message + '" , ' + arguments + ')';
132				cWindowShow(ajaxcall, '', 450, 100);
133			}
134		}
135	},
136	featured: {
137		add: function(uniqueId , controller ){
138			var ajaxCall = "jax.call('community', '" + controller + ",ajaxAddFeatured', '"+uniqueId+"');";
139			cWindowShow(ajaxCall, '', 450, 100);
140		},
141		remove: function(uniqueId , controller ){
142			var ajaxCall = "jax.call('community','" + controller + ",ajaxRemoveFeatured','" + uniqueId + "');";
143			cWindowShow(ajaxCall,'', 450, 100);
144		}
145	},
146	flash: {
147		enabled: function(){
148			// ie
149			try
150			{
151				try
152				{
153					// avoid fp6 minor version lookup issues
154					// see: http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
155					var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');
156					try
157					{
158						axo.AllowScriptAccess = 'always';
159					}
160					catch(e)
161					{
162						return '6,0,0';
163					}
164				}
165				catch(e)
166				{
167				}
168				return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
169			// other browsers
170			}
171			catch(e)
172			{
173				try
174				{
175					if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin)
176					{
177						return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
178					}
179				}
180				catch(e)
181				{
182				}
183			}
184			return false;
185		}
186	},
187	notifications: {
188		showWindow: function (){
189			var ajaxCall = 'jax.call("community", "notification,ajaxGetNotification", "")';
190			cWindowShow(ajaxCall, '', 450, 100);
191		},
192		updateNotifyCount: function (){
193			var notifyCount	= joms.jQuery('#toolbar-item-notify-count').text();
194
195			if(joms.jQuery.trim(notifyCount) != '' && notifyCount > 0)
196			{
197				//first we update the count. if the updated count == 0, then we hide the tab.
198				notifyCount = notifyCount - 1;
199				joms.jQuery('#toolbar-item-notify-count').html(notifyCount);
200				if (notifyCount == 0)
201				{
202					joms.jQuery('#toolbar-item-notify').hide();
203				}
204			}
205		}
206	},
207	filters:{
208		bind: function(){
209			var loading	= this.loading;
210			joms.jQuery(document).ready( function()
211			{
212				//sorting option binding for members display
213				joms.jQuery('.newest-member').bind('click', function() {
214				    if ( !joms.jQuery(this).hasClass('active-state') ) {
215				        loading( joms.jQuery(this).attr('class') );
216						jax.call('community', 'frontpage,ajaxGetNewestMember', frontpageUsers);
217					}
218				});
219				joms.jQuery('.active-member').bind('click', function() {
220				    if ( !joms.jQuery(this).hasClass('active-state') ) {
221			            loading( joms.jQuery(this).attr('class') );
222						jax.call('community', 'frontpage,ajaxGetActiveMember', frontpageUsers);
223					}
224				});
225				joms.jQuery('.popular-member').bind('click', function() {
226				    if ( !joms.jQuery(this).hasClass('active-state') ) {
227				        loading( joms.jQuery(this).attr('class') );
228				    	jax.call('community', 'frontpage,ajaxGetPopularMember', frontpageUsers);
229					}
230				});
231				joms.jQuery('.featured-member').bind('click', function() {
232				    if ( !joms.jQuery(this).hasClass('active-state') ) {
233				        loading( joms.jQuery(this).attr('class') );
234				    	jax.call('community', 'frontpage,ajaxGetFeaturedMember', frontpageUsers);
235					}
236				});
237
238				//sorting option binding for activity stream
239				joms.jQuery('.all-activity').bind('click', function() {
240				    if ( !joms.jQuery(this).hasClass('active-state') ) {
241			            loading( joms.jQuery(this).attr('class') );
242						jax.call('community', 'frontpage,ajaxGetActivities', 'all');
243					}
244				});
245				joms.jQuery('.me-and-friends-activity').bind('click', function() {
246				    if ( !joms.jQuery(this).hasClass('active-state') ) {
247				        loading( joms.jQuery(this).attr('class') );
248				    	jax.call('community', 'frontpage,ajaxGetActivities', 'me-and-friends');
249					}
250				});
251				joms.jQuery('.active-profile-and-friends-activity').bind('click', function() {
252				    if ( !joms.jQuery(this).hasClass('active-state') ) {
253				        loading( joms.jQuery(this).attr('class') );
254				    	jax.call('community', 'frontpage,ajaxGetActivities', 'active-profile-and-friends', joms.user.getActive());
255					}
256				});
257				joms.jQuery('.active-profile-activity').bind('click', function() {
258				    if ( !joms.jQuery(this).hasClass('active-state') ) {
259				        loading( joms.jQuery(this).attr('class') );
260				    	jax.call('community', 'frontpage,ajaxGetActivities', 'active-profile', joms.user.getActive());
261					}
262				});
263				joms.jQuery('.p-active-profile-and-friends-activity').bind('click', function() {
264				    if ( !joms.jQuery(this).hasClass('active-state') ) {
265				        loading( joms.jQuery(this).attr('class') );
266				    	jax.call('community', 'frontpage,ajaxGetActivities', 'active-profile-and-friends', joms.user.getActive(), 'profile');
267					}
268				});
269				joms.jQuery('.p-active-profile-activity').bind('click', function() {
270				    if ( !joms.jQuery(this).hasClass('active-state') ) {
271				        loading( joms.jQuery(this).attr('class') );
272				    	jax.call('community', 'frontpage,ajaxGetActivities', 'active-profile', joms.user.getActive(), 'profile');
273					}
274				});
275
276				// sorting and binding for videos
277				joms.jQuery('.newest-videos').bind('click', function() {
278				    if ( !joms.jQuery(this).hasClass('active-state') ) {
279				        loading( joms.jQuery(this).attr('class') );
280						jax.call('community', 'frontpage,ajaxGetNewestVideos', frontpageVideos);
281					}
282				});
283				joms.jQuery('.popular-videos').bind('click', function() {
284				    if ( !joms.jQuery(this).hasClass('active-state') ) {
285				        loading( joms.jQuery(this).attr('class') );
286				    	jax.call('community', 'frontpage,ajaxGetPopularVideos', frontpageVideos);
287					}
288				});
289				joms.jQuery('.featured-videos').bind('click', function() {
290				    if ( !joms.jQuery(this).hasClass('active-state') ) {
291				        loading( joms.jQuery(this).attr('class') );
292				    	jax.call('community', 'frontpage,ajaxGetFeaturedVideos', frontpageVideos);
293					}
294				});
295
296				// remove last link border
297				joms.jQuery('.popular-member').css('border-right', '0').css('padding-right', '0');
298				joms.jQuery('.me-and-friends-activity').css('border-right', '0').css('padding-right', '0');
299				joms.jQuery('.active-profile-activity').css('border-right', '0').css('padding-right', '0');
300			});
301		},
302		loading: function(element){
303			elParent = joms.jQuery('.'+element).parent().parent().attr('id');
304			if ( elParent === '' ) {
305		        elParent = joms.jQuery('.'+element).parent().attr('id');
306			}
307		    joms.jQuery('#' + elParent + ' .loading').show();
308		    joms.jQuery('#' + elParent + ' a').removeClass('active-state');
309		    joms.jQuery('.'+element).addClass('active-state');
310		},
311		hideLoading: function(){
312			joms.jQuery( '.loading' ).hide();
313			// rebind the tooltip
314			joms.jQuery('.jomTipsJax').addClass('jomTips');
315			joms.tooltip.setup();
316		}
317	},
318	groups: {
319		invitation: {
320			accept: function( groupId ){
321				jax.call( 'community' , 'groups,ajaxAcceptInvitation' , groupId )
322			},
323			reject: function( groupId ){
324				jax.call( 'community' , 'groups,ajaxRejectInvitation' , groupId  );
325			}
326		},
327		addInvite: function( element ){
328			var parentId = joms.jQuery('#' +element).parent().attr('id');
329
330			if(parentId == "friends-list")
331			{
332				joms.jQuery("#friends-invited").append(joms.jQuery('#' +element)).html();
333			}
334			else
335			{
336				joms.jQuery("#friends-list").append(joms.jQuery('#' +element)).html();
337			}
338		},
339		removeTopic: function( title , groupid , topicid ){
340			var ajaxCall = 'jax.call("community","groups,ajaxShowRemoveDiscussion", "' + groupid + '","' + topicid + '");';
341			cWindowShow(ajaxCall, title, 450, 100);
342		},
343		editBulletin: function(){
344
345			if( joms.jQuery('#bulletin-edit-data').css('display') == 'none' )
346			{
347				joms.jQuery('#bulletin-edit-data').show();
348			}
349			else
350			{
351				joms.jQuery('#bulletin-edit-data').hide();
352			}
353
354		},
355		removeBulletin: function( title , groupid , bulletinid ){
356			var ajaxCall = 'jax.call("community", "groups,ajaxShowRemoveBulletin", "' + groupid + '","' + bulletinid + '");';
357			cWindowShow(ajaxCall, title, 450, 100);
358		},
359		unpublish: function( groupId ){
360			jax.call( 'community' , 'groups,ajaxUnpublishGroup', groupId);
361		},
362		leave: function( groupid ){
363			var ajaxCall = 'jax.call("community", "groups,ajaxShowLeaveGroup", "' + groupid + '");';
364			cWindowShow(ajaxCall, '', 450, 100);
365		},
366		joinWindow: function( groupid ){
367			var ajaxCall = 'jax.call("community", "groups,ajaxShowJoinGroup", "' + groupid + '", location.href );';
368			cWindowShow(ajaxCall, '', 450, 100);
369		},
370		edit: function(){
371			// Check if input is already displayed
372			joms.jQuery('#community-group-info .cdata').each(function(){
373				// Test if the next div is cinput
374
375				if(joms.jQuery(this).next().html() && joms.jQuery(this).css('display') != 'none' )
376					joms.jQuery(this).css('display' , 'none');
377				else
378					joms.jQuery(this).css('display' , 'block');
379			});
380
381			joms.jQuery('#community-group-info .cinput').each(function(){
382				if(joms.jQuery(this).css('display') == 'none')
383					joms.jQuery(this).css('display' , 'block');
384				else
385					joms.jQuery(this).css('display' , 'none');
386			});
387
388			if(joms.jQuery('div#community-group-info-actions').css('display') != 'none')
389				joms.jQuery('div#community-group-info-actions').css('display' , 'none');
390			else
391				joms.jQuery('div#community-group-info-actions').css('display' , 'block');
392		},
393		save: function( groupid ){
394			var name		= joms.jQuery('#community-group-name').val();
395			var description	= joms.jQuery('#community-group-description').val();
396			var website		= joms.jQuery('#community-group-website').val();
397			var category	= joms.jQuery('#community-group-category').val();
398			var approvals	= joms.jQuery("input[@name='group-approvals']:checked").val();
399
400			jax.call('community' , 'groups,ajaxSaveGroup' , groupid , name , description , website , category , approvals);
401		},
402		update: function( groupName , groupDescription , groupWebsite , groupCategory){
403			// Re-update group data
404			joms.jQuery('#community-group-data-name').html( groupName );
405			joms.jQuery('#community-group-data-description').html( groupDescription );
406			joms.jQuery('#community-group-data-website').html( groupWebsite );
407			joms.jQuery('#community-group-data-category').html( groupCategory );
408			this.edit();
409		},
410		removeMember: function( memberId , groupId ){
411			jax.call('community', 'groups,ajaxRemoveMember', memberId , groupId );
412		},
413		deleteGroup: function( groupId ){
414			var ajaxCall = "jax.call('community', 'groups,ajaxWarnGroupDeletion', '" + groupId + "');";
415			cWindowShow(ajaxCall, '', 450, 100, 'warning');
416		}
417	},
418	friends: {
419		saveTag: function(){
420			var formVars = jax.getFormValues('tagsForm');
421			jax.call("community", "friends,ajaxFriendTagSave", formVars);
422			return false;
423		},
424		saveGroup: function(userid) {
425			if(document.getElementById('newtag').value == ''){
426			    window.alert('TPL_DB_INVALIDTAG');
427			}else{
428				jax.call("community", "friends,ajaxAddGroup",userid,joms.jQuery('#newtag').val());
429			}
430		},
431		cancelRequest: function( friendsId ){
432			var ajaxCall = 'jax.call("community" , "friends,ajaxCancelRequest" , "' + friendsId + '");';
433			cWindowShow(ajaxCall, '', 450, 100);
434		},
435		connect: function( friendid ){
436			var ajaxCall = 'jax.call("community", "friends,ajaxConnect", '+friendid+')';
437			cWindowShow(ajaxCall, '', 450, 100);
438		},
439		addNow: function(){
440		 	var formVars = jax.getFormValues('addfriend');
441		 	jax.call("community", "friends,ajaxSaveFriend",formVars);
442		 	return false;
443		}
444	},
445	messaging: {
446		loadComposeWindow: function(userid){
447			var ajaxCall = 'jax.call("community", "inbox,ajaxCompose", '+userid+')';
448			cWindowShow(ajaxCall, '', 450, 100);
449		},
450		send: function(){
451			var formVars = jax.getFormValues('writeMessageForm');
452			jax.call("community", "inbox,ajaxSend", formVars);
453			return false;
454		}
455	},
456	walls: {
457		add: function ( uniqueId, addFunc ){
458
459			jax.loadingFunction = function()
460			{
461				joms.jQuery('#wall-message').attr('disabled', true);
462				joms.jQuery('#wall-submit').attr('disabled', true);
463			}
464
465			jax.doneLoadingFunction = function()
466			{
467				joms.jQuery('#wall-message').attr('disabled', false);
468				joms.jQuery('#wall-submit').attr('disabled', false);
469			};
470
471			if(typeof getCacheId == 'function')
472			{
473				cache_id = getCacheId();
474			}
475			else
476			{
477				cache_id = "";
478			}
479
480			jax.call('community', addFunc, joms.jQuery('#wall-message').val(), uniqueId, cache_id);
481		},
482		insert: function( html ){
483			joms.jQuery('#wall-message').val('');
484			joms.jQuery('#wallContent').prepend(html);
485		},
486		remove: function( type , wallId , contentId ){
487			if(confirm('Are you sure you want to delete this wall?'))
488			{
489				jax.call('community' , type + ',ajaxRemoveWall' , wallId , contentId );
490				joms.jQuery('#wall_' + wallId ).fadeOut('normal', function(){joms.jQuery(this).remove()});
491
492				// Process ajax calls
493			}
494		},
495		update: function( id , message ){
496			//Hide popups
497			cWindowHide();
498
499			//Update the existing html codes
500			joms.jQuery( '#wall_' + id ).replaceWith( message );
501		},
502		save: function( id , editableFunc ){
503			jax.call('community' , 'system,ajaxUpdateWall' , id , joms.jQuery('#wall-edit-' + id).val() , editableFunc );
504		},
505		edit: function( id , permissionFunc ){
506
507			if( joms.jQuery('#wall-edit-' + id ).val() != null )
508			{
509				joms.jQuery('#wall-message-'+ id).show();
510				joms.jQuery('#wall-edit-container-'+ id).remove();
511			}
512			else
513			{
514				// Hide current message
515				joms.jQuery('#wall-message-' + id ).hide();
516				joms.jQuery('#wall_' + id + ' div.content').prepend( '<span id="wall-edit-container-' + id + '"></span>').prepend('<div class="loading" style="display:block;float: left;"></div>');
517
518				jax.call('community' , 'system,ajaxEditWall' , id , permissionFunc );
519				joms.utils.textAreaWidth('#wall-edit-' + id );
520				joms.utils.autogrow('#wall-edit-' + id);
521			}
522		}
523	},
524	toolbar: {
525		timeout: 500,
526		closetimer: 0,
527		ddmenuitem: 0,
528		open: function( id ){
529
530			if ( joms.jQuery('#'+id).length > 0 ) {
531				// cancel close timer
532				joms.toolbar.cancelclosetime();
533
534				// close old layer
535				if(joms.toolbar.ddmenuitem)
536				{
537					joms.toolbar.ddmenuitem.style.visibility = 'hidden';
538				}
539
540				// get new layer and show it
541				joms.toolbar.ddmenuitem = document.getElementById(id);
542				joms.toolbar.ddmenuitem.style.visibility = 'visible';
543			}
544		},
545		close: function(){
546			if(joms.toolbar.ddmenuitem)
547			{
548				joms.toolbar.ddmenuitem.style.visibility = 'hidden';
549			}
550		},
551		closetime: function(){
552			joms.toolbar.closetimer	= window.setTimeout( joms.toolbar.close , joms.toolbar.timeout );
553		},
554		cancelclosetime: function(){
555			if( joms.toolbar.closetimer )
556			{
557				window.clearTimeout( joms.toolbar.closetimer );
558				joms.toolbar.closetimer = null;
559			}
560		}
561	},
562	registrations:{
563		windowTitle: '',
564		showTermsWindow: function(){
565			var ajaxCall = 'jax.call("community", "register,ajaxShowTnc", "")';
566			cWindowShow(ajaxCall, this.windowTitle , 600, 350);
567		},
568		authenticate: function(){
569			jax.call("community", "register,ajaxGenerateAuthKey");
570		},
571		authenticateAssign: function(){
572			jax.call("community", "register,ajaxAssignAuthKey");
573		},
574		assignAuthKey: function(fname, lblname, authkey){
575			eval("document.forms['" + fname + "'].elements['" + lblname + "'].value = '" + authkey + "';");
576		},
577		showWarning: function(message) {
578			cWindowShow('joms.jQuery(\'#cWindowContent\').html(\''+message+'\')' , 'Notice' , 450 , 200 , 'warning');
579		}
580	},
581	comments:{
582		add: function(id){
583			var cmt = joms.jQuery('#'+ id +' textarea').val();
584			if(cmt != '') {
585				joms.jQuery('#'+ id +' .wall-coc-form-action.add').attr('disabled', true);
586				if(typeof getCacheId == 'function')
587				{
588					cache_id = getCacheId();
589				}
590				else
591				{
592					cache_id = "";
593				}
594				jax.call("community", "plugins,walls,ajaxAddComment", id, cmt, cache_id);
595			}
596		},
597		insert: function(id, text){
598			joms.jQuery('#'+ id +' form').before(text);
599			joms.comments.cancel(id);
600		},
601		remove: function(obj){
602			var cmtDiv = joms.jQuery(obj).parents('.wallcmt');
603			var index  = joms.jQuery(obj).parents('.wallcmt').parent().children().index(cmtDiv);
604			try{ console.log(index); } catch(err){}
605			var parentId = joms.jQuery(obj).parents('.wallcmt').parent().attr('id');
606			try{ console.log(parentId); } catch(err){}
607			//joms.jQuery(obj).parent('.wallcmt').remove();
608
609			jax.call("community", "plugins,walls,ajaxRemoveComment", parentId, index);
610		},
611		cancel: function(id){
612			joms.jQuery('#'+ id +' textarea').val('');
613			joms.jQuery('#'+ id +' form').hide();
614			joms.jQuery('#'+ id +' .show-cmt').show();
615			joms.jQuery('#'+ id + ' .wall-coc-errors').hide();
616		},
617		show: function(id){
618			var w = joms.jQuery('#'+ id +' form').parent().width();
619
620			joms.jQuery('#'+ id +' .wall-coc-form-action.add').attr('disabled', false);
621			joms.jQuery('#'+ id +' form').width(w).show();
622			joms.jQuery('#'+ id +' .show-cmt').hide();
623
624			var textarea = joms.jQuery('#'+ id +' textarea');
625			joms.utils.textAreaWidth(textarea);
626			joms.utils.autogrow(textarea);
627
628			textarea.blur(function(){
629				if (joms.jQuery(this).val()=='') joms.comments.cancel(id);
630			});
631		}
632	},
633	utils: {
634		// Resize the width of the giventext to follow the innerWidth of
635		// another DOM object
636		// The textarea must be visible
637		textAreaWidth: function(target) {
638			with (joms.jQuery(target))
639			{
640				css('width', '100%');
641				// Google Chrome doesn't return correct outerWidth() else things would be nicer.
642				// css('width', width()*2 - outerWidth(true));
643				css('width', width() - parseInt(css('borderLeftWidth'))
644				                     - parseInt(css('borderRightWidth'))
645				                     - parseInt(css('padding-left'))
646				                     - parseInt(css('padding-right')));
647			}
648		},
649
650		autogrow: function (id, options) {
651			if (options==undefined)
652				options = {};
653
654			// In JomSocial, by default every autogrow element will have a 300 maxHeight.
655			options.maxHeight = options.maxHeight || 300;
656
657			joms.jQuery(id).autogrow(options);
658		}
659	},
660	maps: {
661		mapsObj: null,
662		geocoder: null,
663		initialize: function(target, address, title, info) {
664			if(typeof google.maps =='undefined')
665			{
666				// Google map is not loaded yet, wait another 1 seconds?
667				setTimeout('joms.maps.initialize(\''+target+'\', \''+address+'\')', 1000);
668			}
669			else
670			{
671				joms.maps.geocoder = new google.maps.Geocoder();
672				joms.maps.geocoder.geocode( { 'address': address}, function(results, status) {
673					if (status == google.maps.GeocoderStatus.OK) {
674
675						if(joms.maps.mapsObj == null)
676						{
677							joms.maps.mapsObj = new Array();
678						}
679						// @todo: unoptimized, should not load a random location first
680						var latlng = new google.maps.LatLng(-34.397, 150.644);
681					    var mapOptions = {
682					      zoom: 14,
683					      center: latlng,
684					      mapTypeId: google.maps.MapTypeId.ROADMAP
685					    }
686
687					    // Map id is incremented for each map
688					    var mapId = joms.maps.mapsObj.length;
689
690					    joms.maps.mapsObj[mapId] = new google.maps.Map(document.getElementById(target), mapOptions);
691
692						joms.maps.mapsObj[mapId].setCenter(results[0].geometry.location);
693						var marker = new google.maps.Marker({
694							map: joms.maps.mapsObj[mapId],
695							position: results[0].geometry.location,
696							title:title
697						});
698
699						if(info.length > 0){
700							var infowindow = new google.maps.InfoWindow({
701							    content: info
702							});
703
704							google.maps.event.addListener(marker, 'click', function() {
705								var mapId  = joms.jQuery('div#'+target).data('maps');
706								infowindow.open(joms.maps.mapsObj[mapId], marker);
707							});
708						}
709
710						// Store map object in the div id
711						joms.jQuery('div#'+target).data('maps', mapId);
712
713					} else {
714						alert("Geocode was not successful for the following reason: " + status);
715					}
716				});
717			}
718		},
719		addMarker: function(target, lat, lng, title, info) {
720			if(joms.maps.mapsObj == null)
721			{
722				// Google map is not loaded yet, wait another 1 seconds?
723				setTimeout('joms.maps.addMarker(\''+target+'\', '+lat+', '+lng+', \''+title+'\', \''+info+'\')', 1000);
724			}
725			else
726			{
727				var mapId  = joms.jQuery('div#'+target).data('maps');
728				var myLatlng = new google.maps.LatLng(lat,lng);
729				var marker = new google.maps.Marker({
730					position: myLatlng,
731					map: joms.maps.mapsObj[mapId],
732					title:title
733				});
734
735				if(info.length > 0){
736					var infowindow = new google.maps.InfoWindow({
737					    content: info
738					});
739
740					google.maps.event.addListener(marker, 'click', function() {
741						var mapId  = joms.jQuery('div#'+target).data('maps');
742						infowindow.open(joms.maps.mapsObj[mapId], marker);
743					});
744				}
745
746			}
747		}
748	},
749	connect: {
750	    checkRealname: function( value ){
751	        var tmpLoadingFunction  = jax.loadingFunction;
752			jax.loadingFunction = function(){};
753			jax.doneLoadingFunction = function(){ jax.loadingFunction = tmpLoadingFunction; };
754			jax.call('community','connect,ajaxCheckName', value);
755		},
756	    checkEmail: function( value ){
757	        var tmpLoadingFunction  = jax.loadingFunction;
758			jax.loadingFunction = function(){};
759			jax.doneLoadingFunction = function(){ jax.loadingFunction = tmpLoadingFunction; };
760			jax.call('community','connect,ajaxCheckEmail', value);
761		},
762		checkUsername: function( value ){
763	        var tmpLoadingFunction  = jax.loadingFunction;
764			jax.loadingFunction = function(){};
765			jax.doneLoadingFunction = function(){ jax.loadingFunction = tmpLoadingFunction; };
766		    jax.call('community','connect,ajaxCheckUsername', value);
767		},
768		// Displays popup that requires user to update their details upon
769		update: function(){
770			var ajaxCall = "jax.call('community', 'connect,ajaxUpdate' );";
771			cWindowShow(ajaxCall, '', 450, 200);
772		},
773		updateEmail: function(){
774		    joms.jQuery('#facebook-email-update').submit();
775		},
776		importData: function(){
777		    var importStatus    = joms.jQuery('#importstatus').is(':checked') ? 1 : 0;
778		    var importAvatar    = joms.jQuery('#importavatar').is(':checked') ? 1 : 0 ;
779		    jax.call('community','connect,ajaxImportData',  importStatus , importAvatar );
780		},
781		mergeNotice: function(){
782			var ajaxCall = "jax.call('community','connect,ajaxMergeNotice');";
783			cWindowShow(ajaxCall, '', 450, 200);
784		},
785		merge: function(){
786			var ajaxCall = "jax.call('community','connect,ajaxMerge');";
787			cWindowShow(ajaxCall, '', 450, 200);
788		},
789		validateUser: function(){
790			// Validate existing user
791			var ajaxCall = "jax.call('community','connect,ajaxValidateLogin','" + joms.jQuery('#existingusername').val() + "','" + joms.jQuery('#existingpassword').val() + "');";
792			cWindowShow(ajaxCall, '', 450, 200);
793		},
794		newUser: function(){
795			var ajaxCall = "jax.call('community','connect,ajaxShowNewUserForm');";
796			cWindowShow(ajaxCall, '', 450, 200);
797		},
798		existingUser: function(){
799			var ajaxCall = "jax.call('community','connect,ajaxShowExistingUserForm');";
800			cWindowShow(ajaxCall, '', 450, 200);
801		},
802		selectType: function(){
803			if(joms.jQuery('[name=membertype]:checked').val() == '1' )
804			{
805				joms.connect.newUser();
806			}
807			else
808			{
809				joms.connect.existingUser();
810			}
811		},
812		validateNewAccount: function(){
813			// Check for errors on the forms.
814			jax.call('community','connect,ajaxCheckEmail', joms.jQuery('#newemail').val() );
815			jax.call('community','connect,ajaxCheckUsername', joms.jQuery('#newusername').val() );
816			jax.call('community','connect,ajaxCheckName', joms.jQuery('#newname').val() );
817
818			var isValid	= true;
819			if(joms.jQuery('#newname').val() == "" || joms.jQuery('#error-newname').css('display') != 'none')
820			{
821				isValid = false;
822			}
823
824			if(joms.jQuery('#newusername').val() == "" || joms.jQuery('#error-newusername').css('display') != 'none')
825			{
826				isValid = false;
827			}
828
829			if(joms.jQuery('#newemail').val() == '' || joms.jQuery('#error-newemail').css('display') != 'none' )
830			{
831				isValid = false;
832			}
833
834			if(isValid)
835			{
836				var ajaxCall = "jax.call('community', 'connect,ajaxCreateNewAccount' , '" + joms.jQuery('#newname').val() + "', '" + joms.jQuery('#newusername').val() + "','" + joms.jQuery('#newemail').val() + "');";
837				cWindowShow(ajaxCall, '', 450, 200);
838			}
839		}
840	},
841
842	// Video component
843	videos: {
844		playProfileVideo: function(id, userid){
845			jax.call('community', 'profile,ajaxPlayProfileVideo', id, userid);
846		},
847		linkConfirmProfileVideo: function(id){
848			var ajaxCall = "jax.call('community', 'profile,ajaxConfirmLinkProfileVideo', '" + id + "');";
849			cWindowShow(ajaxCall, '', 450, 100);
850		},
851		linkProfileVideo: function(id){
852			var ajaxCall = "jax.call('community', 'profile,ajaxLinkProfileVideo', '" + id + "');";
853			cWindowShow(ajaxCall, '', 450, 100);
854		},
855		removeConfirmProfileVideo: function(userid, videoid){
856			var ajaxCall = "jax.call('community', 'profile,ajaxRemoveConfirmLinkProfileVideo', '" + userid + "', '" + videoid + "');";
857			cWindowShow(ajaxCall, '', 450, 100);
858		},
859		removeLinkProfileVideo: function(userid, videoid){
860			var ajaxCall = "jax.call('community', 'profile,ajaxRemoveLinkProfileVideo', '" + userid + "', '" + videoid + "');";
861			cWindowShow(ajaxCall, '', 450, 100);
862		},
863		showEditWindow: function(id , redirectUrl ){
864
865			if( typeof redirectUrl == 'undefined' )
866				redirectUrl	= '';
867
868			var ajaxCall = "jax.call('community', 'videos,ajaxEditVideo', '"+id+"' , '" + redirectUrl + "');";
869			cWindowShow(ajaxCall, '' , 450, 400);
870		},
871		deleteVideo: function(videoId){
872			var ajaxCall = "jax.call('community' , 'videos,ajaxRemoveVideo', '" + videoId + "','myvideos');";
873			cWindowShow(ajaxCall, '', 450, 150);
874		},
875		playerConf: {
876			// Default flowplayer configuration here
877		},
878		addVideo: function(creatortype, groupid) {
879			if(typeof creatortype == "undefined" || creatortype == "")
880			{
881				var creatortype="";
882				var groupid = "";
883			}
884			var ajaxCall = "jax.call('community', 'videos,ajaxAddVideo', '" + creatortype + "', '" + groupid + "');";
885			cWindowShow(ajaxCall, '', 450, 100);
886		},
887		linkVideo: function(creatortype, groupid) {
888			var ajaxCall = "jax.call('community', 'videos,ajaxLinkVideo', '" + creatortype + "', '" + groupid + "');";
889			cWindowShow(ajaxCall, '', 450, 100);
890		},
891		uploadVideo: function(creatortype, groupid) {
892			var ajaxCall = "jax.call('community', 'videos,ajaxUploadVideo', '" + creatortype + "', '" + groupid + "');";
893			cWindowShow(ajaxCall, '', 450, 100);
894		},
895		submitLinkVideo: function() {
896			var isValid = true;
897
898			videoLinkUrl = "#linkVideo input[name='videoLinkUrl']";
899			if(joms.jQuery.trim(joms.jQuery(videoLinkUrl).val())=='')
900			{
901				joms.jQuery(videoLinkUrl).addClass('invalid');
902				isValid = false;
903			}
904			else
905			{
906				joms.jQuery(videoLinkUrl).removeClass('invalid');
907			}
908
909			if (isValid)
910			{
911				joms.jQuery('#cwin-wait').css("margin-left","20px");
912				joms.jQuery('#cwin-wait').show();
913
914				document.linkVideo.submit();
915			}
916		},
917		submitUploadVideo: function() {
918			var isValid = true;
919
920			videoFile = "#uploadVideo input[name='videoFile']";
921
922			if(joms.jQuery.trim(joms.jQuery(videoFile).val())=='')
923			{
924				joms.jQuery(videoFile).addClass('invalid');
925				isValid = false;
926			}
927			else
928			{
929				joms.jQuery(videoFile).removeClass('invalid');
930			}
931
932			videoTitle = "#uploadVideo input[name='title']";
933			if(joms.jQuery.trim(joms.jQuery(videoTitle).val())=='')
934			{
935				joms.jQuery(videoTitle).addClass('invalid');
936				isValid = false;
937			}
938			else
939			{
940				joms.jQuery(videoTitle).removeClass('invalid');
941			}
942
943			if (isValid)
944			{
945				joms.jQuery('#cwin-wait').css("margin-left","20px");
946				joms.jQuery('#cwin-wait').show();
947
948				document.uploadVideo.submit();
949			}
950		},
951		fetchThumbnail: function(videoId){
952			var ajaxCall = "jax.call('community' , 'videos,ajaxFetchThumbnail', '" + videoId + "','myvideos');";
953			cWindowShow(ajaxCall, '', 450, 150);
954		}
955	},
956	users: {
957		banUser: function( userId , isBlocked ){
958			var ajaxCall = "jax.call('community', 'profile,ajaxBanUser', '" + userId + "' , '" + isBlocked + "');";
959			cWindowShow(ajaxCall, '', 450, 100);
960		},
961		removePicture: function( userId ){
962			var ajaxCall = "jax.call('community', 'profile,ajaxRemovePicture', '" + userId + "');";
963			cWindowShow(ajaxCall, '', 450, 100);
964		},
965		uploadNewPicture: function( userId ){
966			var ajaxCall = "jax.call('community', 'profile,ajaxUploadNewPicture', '" + userId + "');";
967			cWindowShow(ajaxCall, '', 450, 100);
968		},
969	   blockUser: function( userId ){
970			var ajaxCall = 'jax.call("community", "profile,ajaxBlockUser", "' + userId + '");';
971			cWindowShow(ajaxCall, '', 450, 100);
972       },
973	   unBlockUser: function( userId, layout ){
974	        layout = layout || null;
975			var ajaxCall = 'jax.call("community", "profile,ajaxUnblockUser", "' + userId + '", "' + layout + '");';
976			cWindowShow(ajaxCall, '', 450, 100);
977       }
978	},
979
980	user: {
981		getActive: function( ){
982			// return the current active user
983			return js_profileId;
984		}
985	},
986
987	events: {
988		deleteEvent: function( eventId ){
989			var ajaxCall = "jax.call('community', 'events,ajaxWarnEventDeletion', '" + eventId + "');";
990			cWindowShow(ajaxCall, '', 450, 100, 'warning');
991		},
992		join: function( eventId ){
993			var ajaxCall = 'jax.call("community", "events,ajaxRequestInvite", "' + eventId + '", location.href );';
994			cWindowShow(ajaxCall, '', 450, 100);
995		},
996		leave: function( eventId ){
997			var ajaxCall = 'jax.call("community", "events,ajaxIgnoreEvent", "' + eventId + '");';
998			cWindowShow(ajaxCall, '', 450, 100);
999		},
1000		sendmail: function( eventId ){
1001			var ajaxCall = 'jax.call("community", "events,ajaxSendEmail", "' + eventId + '");';
1002			cWindowShow(ajaxCall, '', 450, 300);
1003		},
1004		confirmBlockGuest: function(userId, eventId){
1005			var ajaxCall = 'jax.call("community", "events,ajaxConfirmBlockGuest", "' + userId + '", "' + eventId + '");';
1006			cWindowShow(ajaxCall, '', 450, 100);
1007		},
1008		blockGuest: function(userId, eventId){
1009			var ajaxCall = 'jax.call("community", "events,ajaxBlockGuest", "' + userId + '", "' + eventId + '");';
1010			cWindowShow(ajaxCall, '', 450, 100);
1011		},
1012		confirmUnblockGuest: function(userId, eventId){
1013			var ajaxCall = 'jax.call("community", "events,ajaxConfirmUnblockGuest", "' + userId + '", "' + eventId + '");';
1014			cWindowShow(ajaxCall, '', 450, 100);
1015		},
1016		unblockGuest: function(userId, eventId){
1017			var ajaxCall = 'jax.call("community", "events,ajaxUnblockGuest", "' + userId + '", "' + eventId + '");';
1018			cWindowShow(ajaxCall, '', 450, 100);
1019		},
1020		confirmRemoveGuest: function(userId, eventId){
1021			var ajaxCall = 'jax.call("community", "events,ajaxConfirmRemoveGuest", "' + userId + '", "' + eventId + '");';
1022			cWindowShow(ajaxCall, '', 450, 100);
1023		},
1024		removeGuest: function(userId, eventId){
1025			var ajaxCall = 'jax.call("community", "events,ajaxRemoveGuest", "' + userId + '", "' + eventId + '");';
1026			cWindowShow(ajaxCall, '', 450, 100);
1027		},
1028		joinNow: function(eventId){
1029			jax.call("community" , "events,ajaxJoinInvitation" , eventId );
1030		},
1031		rejectNow: function(eventId){
1032			jax.call('community' , 'events,ajaxRejectInvitation' , eventId );
1033		}
1034	},
1035	profile: {
1036		setStatusLimit: function( textAreaElement ){
1037			joms.jQuery( textAreaElement ).keyup(function(){
1038				var max = parseInt( joms.jQuery(this).attr('maxlength'));
1039				if( joms.jQuery(this).val().length > max)
1040				{
1041					joms.jQuery(this).val( joms.jQuery(this).val().substr(0, joms.jQuery(this).attr('maxlength')));
1042				}
1043				joms.jQuery('#profile-status-notice span').html( (max - joms.jQuery(this).val().length) );
1044			});
1045		}
1046	},
1047	tooltip: {
1048		setup: function( ){
1049			// Hide all active visible qTip
1050			joms.jQuery('.qtip-active').hide();
1051			setTimeout('joms.jQuery(\'.qtip-active\').hide()', 150);
1052			try{ clearTimeout(joms.jQuery.fn.qtip.timers.show); } catch(e){}
1053
1054			// Scan the document and setup the tooltip that has .jomTips
1055			joms.jQuery(".jomTips").each(function(){
1056		    	var tipStyle = 'tipNormal';
1057		    	var tipWidth = 220;
1058		    	var tipPos	 = {corner: {target: 'topMiddle',tooltip: 'bottomMiddle'}}
1059		    	var tipShow  = true;
1060		    	var tipHide	 = { when: { event: 'mouseout' }, effect: { length: 10 } }
1061
1062		    	if(joms.jQuery(this).hasClass('tipRight'))
1063				{
1064		    		tipStyle = 'tipRight';
1065		    		tipWidth = 320;
1066		    		tipPos	 = {corner: {target: 'rightMiddle',tooltip: 'leftMiddle'}}
1067		    	}
1068
1069		    	if(joms.jQuery(this).hasClass('tipWide'))
1070				{
1071		    		tipWidth = 420;
1072		    	}
1073
1074		    	if(joms.jQuery(this).hasClass('tipFullWidth'))
1075				{
1076		    		tipWidth = joms.jQuery(this).innerWidth()-20;
1077		    	}
1078
1079		    	// Split the title and the content
1080		    	var title = '';
1081		    	var content = joms.jQuery(this).attr('title');
1082				var contentArray = content.split('::');
1083
1084				// Remove the 'title' attributes from the existing .jomTips classes
1085				joms.jQuery( this ).attr('title' , '' );
1086
1087				if(contentArray.length == 2)
1088				{
1089					content = contentArray[1];
1090					title = { text: contentArray[0] } ;
1091				} else
1092					title = title = { text: '' } ; ;
1093
1094
1095		    	joms.jQuery(this).qtip({
1096		    		content: {
1097					   text: content,
1098					   title: title
1099					},
1100					style: {name:tipStyle , width: tipWidth },
1101					position: tipPos,
1102					hide: tipHide,
1103					show: { solo: true, effect: { length: 50 } }
1104			 	}).removeClass('jomTips');
1105			});
1106
1107			return true;
1108		},
1109
1110		setStyle: function() {
1111			joms.jQuery.fn.qtip.styles.tipNormal = { // Last part is the name of the style
1112				width: 320,
1113				border: {
1114					width: 7,
1115					radius: 5
1116				},
1117				tip: true,
1118				name: 'dark' // Inherit the rest of the attributes from the preset dark style
1119			}
1120
1121			joms.jQuery.fn.qtip.styles.tipRight = { // Last part is the name of the style
1122				tip: 'leftMiddle',
1123				name: 'tipNormal' // Inherit the rest of the attributes from the preset dark style
1124			}
1125
1126			return true;
1127		}
1128	}
1129});
1130
1131
1132// close layer when click-out
1133joms.jQuery(document).click( function() {
1134    joms.toolbar.close();
1135});
1136
1137function get_cookies_array() {
1138
1139    var cookies = { };
1140
1141    if (document.cookie && document.cookie != '')
1142	{
1143		var split = document.cookie.split(';');
1144		for (var i = 0; i < split.length; i++)
1145		{
1146			var name_value = split[i].split("=");
1147			name_value[0] = name_value[0].replace(/^ /, '');
1148			cookies[decodeURIComponent(name_value[0])] = decodeURIComponent(name_value[1]);
1149		}
1150    }
1151
1152    return cookies;
1153
1154}
1155
1156
1157// Document ready
1158joms.jQuery(document).ready(function () {
1159
1160    joms.jQuery
1161	joms.tooltip.setStyle();
1162	joms.tooltip.setup();
1163	joms.apps.initToggle();
1164	joms.plugins.initialize();
1165});
1166
1167/**
1168 * Cookie plugin
1169 *
1170 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
1171 * Dual licensed under the MIT and GPL licenses:
1172 * http://www.opensource.org/licenses/mit-license.php
1173 * http://www.gnu.org/licenses/gpl.html
1174 *
1175 */
1176joms.jQuery.cookie = function(name, value, options) {
1177    if (typeof value != 'undefined') { // name and value given, set cookie
1178        options = options || {};
1179        if (value === null) {
1180            value = '';
1181            options.expires = -1;
1182        }
1183        var expires = '';
1184        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
1185            var date;
1186            if (typeof options.expires == 'number') {
1187                date = new Date();
1188                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
1189            } else {
1190                date = options.expires;
1191            }
1192            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
1193        }
1194        // CAUTION: Needed to parenthesize options.path and options.domain
1195        // in the following expressions, otherwise they evaluate to undefined
1196        // in the packed version for some reason...
1197        var path = options.path ? '; path=' + (options.path) : '';
1198        var domain = options.domain ? '; domain=' + (options.domain) : '';
1199        var secure = options.secure ? '; secure' : '';
1200        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
1201    } else { // only name given, get cookie
1202        var cookieValue = null;
1203        if (document.cookie && document.cookie != '') {
1204            var cookies = document.cookie.split(';');
1205            for (var i = 0; i < cookies.length; i++) {
1206                var cookie = joms.jQuery.trim(cookies[i]);
1207                // Does this cookie string begin with the name we want?
1208                if (cookie.substring(0, name.length + 1) == (name + '=')) {
1209                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
1210                    break;
1211                }
1212            }
1213        }
1214        return cookieValue;
1215    }
1216};
1217
1218(function(jQuery) {
1219    joms.jQuery.fn.autogrow = function(options) {
1220
1221        this.filter('textarea').each(function() {
1222
1223			var textarea = joms.jQuery(this);
1224
1225			// Hide scrollbar first.
1226			textarea.css('overflow','hidden');
1227
1228			options.minHeight = options.minHeight || textarea.height();
1229			options.maxHeight = options.maxHeight || 0;
1230
1231            textarea.siblings('.textarea-shadow').remove();
1232            var shadow = joms.jQuery('<div class="textarea-shadow">').css({
1233                             'position'    : 'absolute',
1234                             'visibility'  : 'hidden',
1235                             'font-size'   : (textarea[0].currentStyle==undefined) ? textarea.css('font-size') : textarea[0].currentStyle.fontSize,
1236                             'font-family' : textarea.css('font-family'),
1237                             'line-height' : textarea.css('line-height'),
1238                             'width'       : textarea.width()
1239                         }).insertBefore(textarea);
1240
1241			var timer;
1242            var update = function() {
1243                var times = function(string, number) {
1244                    var _res = '';
1245                    for(var i=0; i<number; i++) {
1246                        _res = _res + string;
1247                    }
1248                    return _res;
1249                };
1250
1251                var val = textarea[0].value.replace(/</g, '&lt;')
1252                                     .replace(/>/g, '&gt;')
1253                                     .replace(/&/g, '&amp;')
1254                                     .replace(/\njQuery/, '<br/>&nbsp;')
1255                                     .replace(/\n/g, '<br/>')
1256                                     .replace(/ {2,}/g, function(space) { return times('&nbsp;', space.length -1) + ' ' });
1257                shadow.html(val);
1258
1259                // Resize textarea if maxHeight is not reached
1260                var newHeight = Math.max(shadow.height() + 20, options.minHeight);
1261				if(newHeight < options.maxHeight || options.maxHeight==0)
1262				{
1263					textarea.css({'height'   : newHeight,
1264					              'overflow' : 'hidden'
1265					             });
1266				// Enable scrollbar if maxHeight is reached.
1267				} else {
1268                	textarea.css('overflow','auto');
1269				}
1270
1271                clearTimeout(timer);
1272            }
1273
1274            var checkExpand = function() {
1275            	timer = setTimeout(update, 100);
1276            }
1277
1278            textarea.change(checkExpand).keydown(checkExpand).keyup(checkExpand);
1279
1280            update.apply(this);
1281        });
1282
1283        return this;
1284
1285    }
1286
1287})(joms.jQuery);
1288
1289/*!
1290 * jquery.qtip. The jQuery tooltip plugin
1291 *
1292 * Copyright (c) 2009 Craig Thompson
1293 * http://craigsworks.com
1294 *
1295 * Licensed under MIT
1296 * http://www.opensource.org/licenses/mit-license.php
1297 *
1298 * Launch  : February 2009
1299 * Version : 1.0.0-rc3
1300 * Released: Tuesday 12th May, 2009 - 00:00
1301 * Debug: jquery.qtip.debug.js
1302 */
1303
1304(function(jQuery)
1305{
1306jQuery.fn.qtip=function(options,blanket)
1307{
1308var i,id,interfaces,opts,obj,command,config,api;
1309if(typeof options=='string')
1310{
1311if(typeof joms.jQuery(this).data('qtip')!=='object')
1312jQuery.fn.qtip.log.error.call(self,1,jQuery.fn.qtip.constants.NO_TOOLTIP_PRESENT,false);
1313if(options=='api')
1314return joms.jQuery(this).data('qtip').interfaces[jQuery(this).data('qtip').current];
1315else if(options=='interfaces')
1316return joms.jQuery(this).data('qtip').interfaces;
1317}
1318else
1319{
1320if(!options)options={};
1321if(typeof options.content!=='object'||(options.content.jquery&&options.content.length>0))options.content={text:options.content};
1322if(typeof options.content.title!=='object')options.content.title={text:options.content.title};
1323if(typeof options.position!=='object')options.position={corner:options.position};
1324if(typeof options.position.corner!=='object')options.position.corner={target:options.position.corner,tooltip:options.position.corner};
1325if(typeof options.show!=='object')options.show={when:options.show}
1325;
1326if(typeof options.show.when!=='object')options.show.when={event:options.show.when};
1327if(typeof options.show.effect!=='object')options.show.effect={type:options.show.effect};
1328if(typeof options.hide!=='object')options.hide={when:options.hide};
1329if(typeof options.hide.when!=='object')options.hide.when={event:options.hide.when};
1330if(typeof options.hide.effect!=='object')options.hide.effect={type:options.hide.effect};
1331if(typeof options.style!=='object')options.style={name:options.style};
1332options.style=sanitizeStyle(options.style);
1333opts=jQuery.extend(true,{},jQuery.fn.qtip.defaults,options);
1334opts.style=buildStyle.call({options:opts},opts.style);
1335opts.user=jQuery.extend(true,{},options);
1336};
1337return joms.jQuery(this).each(function()
1338{
1339if(typeof options=='string')
1340{
1341command=options.toLowerCase();
1342interfaces=jQuery(this).qtip('interfaces');
1343if(typeof interfaces=='object')
1344{
1345if(blanket===true&&command=='destroy')
1346while(interfaces.length>0)interfaces[interfaces.length-1].destroy();
1347else
1348{
1349if(blanket!==true)interfaces=[jQuery(this).qtip('api')];
1350for(i=0;i<interfaces.length;i++)
1351{
1352if(command=='destroy')interfaces[i].destroy();
1353else if(interfaces[i].status.rendered===true)
1354{
1355if(command=='show')interfaces[i].show();
1356else if(command=='hide')interfaces[i].hide();
1357else if(command=='focus')interfaces[i].focus();
1358else if(command=='disable')interfaces[i].disable(true);
1359else if(command=='enable')interfaces[i].disable(false);
1360};
1361};
1362};
1363};
1364}
1365else
1366{
1367config=jQuery.extend(true,{},opts);
1368config.hide.effect.length=opts.hide.effect.length;
1369config.show.effect.length=opts.show.effect.length;
1370if(config.position.container===false)config.position.container=jQuery(document.body);
1371if(config.position.target===false)config.position.target=jQuery(this);
1372if(config.show.when.target===false)config.show.when.target=jQuery(this);
1373if(config.hide.when.target===false)config.hide.when.target=jQuery(this);
1374id=jQuery.fn.qtip.interfaces.length;
1375for(i=0;i<id;i++)
1376{
1377if(typeof joms.jQuery.fn.qtip.interfaces[i]=='undefined'){id=i;break;};
1378};
1379obj=new qTip(jQuery(this),config,id);
1380jQuery.fn.qtip.interfaces[id]=obj;
1381if(jQuery(this).data('qtip') !== null && typeof jQuery(this).data('qtip') == 'object')
1382{
1383if(typeof joms.jQuery(this).attr('qtip')==='undefined')
1384jQuery(this).data('qtip').current=jQuery(this).data('qtip').interfaces.length;
1385jQuery(this).data('qtip').interfaces.push(obj);
1386}
1387else joms.jQuery(this).data('qtip',{current:0,interfaces:[obj]});
1388if(config.content.prerender===false&&config.show.when.event!==false&&config.show.ready!==true)
1389{
1390config.show.when.target.bind(config.show.when.event+'.qtip-'+id+'-create',{qtip:id},function(event)
1391{
1392api=jQuery.fn.qtip.interfaces[event.data.qtip];
1393api.options.show.when.target.unbind(api.options.show.when.event+'.qtip-'+event.data.qtip+'-create');
1394api.cache.mouse={x:event.pageX,y:event.pageY};
1395construct.call(api);
1396api.options.show.when.target.trigger(api.options.show.when.event);
1397});
1398}
1399else
1400{
1401obj.cache.mouse={
1402x:config.show.when.target.offset().left,
1403y:config.show.when.target.offset().top
1404};
1405construct.call(obj);
1406}
1407};
1408});
1409};
1410function qTip(target,options,id)
1411{
1412var self=this;
1413self.id=id;
1414self.options=options;
1415self.status={
1416animated:false,
1417rendered:false,
1418disabled:false,
1419focused:false
1420};
1421self.elements={
1422target:target.addClass(self.options.style.classes.target),
1423tooltip:null,
1424wrapper:null,
1425content:null,
1426contentWrapper:null,
1427title:null,
1428button:null,
1429tip:null,
1430bgiframe:null
1431};
1432self.cache={
1433mouse:{},
1434position:{},
1435toggle:0
1436};
1437self.timers={};
1438jQuery.extend(self,self.options.api,
1439{
1440show:function(event)
1441{
1442var returned,solo;
1443if(!self.status.rendered)
1444return joms.jQuery.fn.qtip.log.error.call(self,2,jQuery.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'show');
1445if(self.elements.tooltip.css('display')!=='none')return self;
1446self.elements.tooltip.stop(true,false);
1447returned=self.beforeShow.call(self,event);
1448if(returned===false)return self;
1449function afterShow()
1450{
1451if(self.options.position.type!=='static')self.focus();
1452self.onShow.call(self,event);
1453if(jQuery.browser.msie)self.elements.tooltip.get(0).style.removeAttribute('filter');
1454};
1455self.cache.toggle=1;
1456if(self.options.position.type!=='static')
1457self.updatePosition(event,(self.options.show.effect.length>0));
1458if(typeof self.options.show.solo=='object')solo=jQuery(self.options.show.solo);
1459else if(self.options.show.solo===true)solo=jQuery('div.qtip').not(self.elements.tooltip);
1460if(solo)solo.each(function(){if(jQuery(this).qtip('api').status.rendered===true)jQuery(this).qtip('api').hide();});
1461if(typeof self.options.show.effect.type=='function')
1462{
1463self.options.show.effect.type.call(self.elements.tooltip,self.options.show.effect.length);
1464self.elements.tooltip.queue(function(){afterShow();jQuery(this).dequeue();});
1465}
1466else
1467{
1468switch(self.options.show.effect.type.toLowerCase())
1469{
1470case'fade':
1471self.elements.tooltip.fadeIn(self.options.show.effect.length,afterShow);
1472break;
1473case'slide':
1474self.elements.tooltip.slideDown(self.options.show.effect.length,function()
1475{
1476afterShow();
1477if(self.options.position.type!=='static')self.updatePosition(event,true);
1478});
1479break;
1480case'grow':
1481self.elements.tooltip.show(self.options.show.effect.length,afterShow);
1482break;
1483default:
1484self.elements.tooltip.show(null,afterShow);
1485break;
1486};
1487self.elements.tooltip.addClass(self.options.style.classes.active);
1488};
1489return joms.jQuery.fn.qtip.log.error.call(self,1,jQuery.fn.qtip.constants.EVENT_SHOWN,'show');
1490},
1491hide:function(event)
1492{
1493var returned;
1494if(!self.status.rendered)
1495return joms.jQuery.fn.qtip.log.error.call(self,2,jQuery.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'hide');
1496else if(self.elements.tooltip.css('display')==='none')return self;
1497clearTimeout(self.timers.show);
1498self.elements.tooltip.stop(true,false);
1499returned=self.beforeHide.call(self,event);
1500if(returned===false)return self;
1501function afterHide(){self.onHide.call(self,event);};
1502self.cache.toggle=0;
1503if(typeof self.options.hide.effect.type=='function')
1504{
1505self.options.hide.effect.type.call(self.elements.tooltip,self.options.hide.effect.length);
1506self.elements.tooltip.queue(function(){afterHide();jQuery(this).dequeue();});
1507}
1508else
1509{
1510switch(self.options.hide.effect.type.toLowerCase())
1511{
1512case'fade':
1513self.elements.tooltip.fadeOut(self.options.hide.effect.length,afterHide);
1514break;
1515case'slide':
1516self.elements.tooltip.slideUp(self.options.hide.effect.length,afterHide);
1517break;
1518case'grow':
1519self.elements.tooltip.hide(self.options.hide.effect.length,afterHide);
1520break;
1521default:
1522self.elements.tooltip.hide(null,afterHide);
1523break;
1524};
1525self.elements.tooltip.removeClass(self.options.style.classes.active);
1526};
1527return joms.jQuery.fn.qtip.log.error.call(self,1,jQuery.fn.qtip.constants.EVENT_HIDDEN,'hide');
1528},
1529updatePosition:function(event,animate)
1530{
1531var i,target,tooltip,coords,mapName,imagePos,newPosition,ieAdjust,ie6Adjust,borderAdjust,mouseAdjust,offset,curPosition,returned
1532if(!self.status.rendered)
1533return joms.jQuery.fn.qtip.log.error.call(self,2,jQuery.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'updatePosition');
1534else if(self.options.position.type=='static')
1535return joms.jQuery.fn.qtip.log.error.call(self,1,jQuery.fn.qtip.constants.CANNOT_POSITION_STATIC,'updatePosition');
1536target={
1537position:{left:0,top:0},
1538dimensions:{height:0,width:0},
1539corner:self.options.position.corner.target
1540};
1541tooltip={
1542position:self.getPosition(),
1543dimensions:self.getDimensions(),
1544corner:self.options.position.corner.tooltip
1545};
1546if(self.options.position.target!=='mouse')
1547{
1548if(self.options.position.target.get(0).nodeName.toLowerCase()=='area')
1549{
1550coords=self.options.position.target.attr('coords').split(',');
1551for(i=0;i<coords.length;i++)coords[i]=parseInt(coords[i]);
1552mapName=self.options.position.target.parent('map').attr('name');
1553imagePos=jQuery('img[usemap="#'+mapName+'"]:first').offset();
1554target.position={
1555left:Math.floor(imagePos.left+coords[0]),
1556top:Math.floor(imagePos.top+coords[1])
1557};
1558switch(self.options.position.target.attr('shape').toLowerCase())
1559{
1560case'rect':
1561target.dimensions={
1562width:Math.ceil(Math.abs(coords[2]-coords[0])),
1563height:Math.ceil(Math.abs(coords[3]-coords[1]))
1564};
1565break;
1566case'circle':
1567target.dimensions={
1568width:coords[2]+1,
1569height:coords[2]+1
1570};
1571break;
1572case'poly':
1573target.dimensions={
1574width:coords[0],
1575height:coords[1]
1576};
1577for(i=0;i<coords.length;i++)
1578{
1579if(i%2==0)
1580{
1581if(coords[i]>target.dimensions.width)
1582target.dimensions.width=coords[i];
1583if(coords[i]<coords[0])
1584target.position.left=Math.floor(imagePos.left+coords[i]);
1585}
1586else
1587{
1588if(coords[i]>target.dimensions.height)
1589target.dimensions.height=coords[i];
1590if(coords[i]<coords[1])
1591target.position.top=Math.floor(imagePos.top+coords[i]);
1592};
1593};
1594target.dimensions.width=target.dimensions.width-(target.position.left-imagePos.left);
1595target.dimensions.height=target.dimensions.height-(target.position.top-imagePos.top);
1596break;
1597default:
1598return joms.jQuery.fn.qtip.log.error.call(self,4,jQuery.fn.qtip.constants.INVALID_AREA_SHAPE,'updatePosition');
1599break;
1600};
1601target.dimensions.width-=2;target.dimensions.height-=2;
1602}
1603else if(self.options.position.target.add(document.body).length===1)
1604{
1605target.position={left:jQuery(document).scrollLeft(),top:jQuery(document).scrollTop()};
1606target.dimensions={height:jQuery(window).height(),width:jQuery(window).width()};
1607}
1608else
1609{
1610if(typeof self.options.position.target.attr('qtip')!=='undefined')
1611target.position=self.options.position.target.qtip('api').cache.position;
1612else
1613target.position=self.options.position.target.offset();
1614target.dimensions={
1615height:self.options.position.target.outerHeight(),
1616width:self.options.position.target.outerWidth()
1617};
1618};
1619newPosition=jQuery.extend({},target.position);
1620if(target.corner.search(/right/i)!==-1)
1621newPosition.left+=target.dimensions.width;
1622if(target.corner.search(/bottom/i)!==-1)
1623newPosition.top+=target.dimensions.height;
1624if(target.corner.search(/((top|bottom)Middle)|center/)!==-1)
1625newPosition.left+=(target.dimensions.width/2);
1626if(target.corner.search(/((left|right)Middle)|center/)!==-1)
1627newPosition.top+=(target.dimensions.height/2);
1628}
1629else
1630{
1631target.position=newPosition={left:self.cache.mouse.x,top:self.cache.mouse.y};
1632target.dimensions={height:1,width:1};
1633};
1634if(tooltip.corner.search(/right/i)!==-1)
1635newPosition.left-=tooltip.dimensions.width;
1636if(tooltip.corner.search(/bottom/i)!==-1)
1637newPosition.top-=tooltip.dimensions.height;
1638if(tooltip.corner.search(/((top|bottom)Middle)|center/)!==-1)
1639newPosition.left-=(tooltip.dimensions.width/2);
1640if(tooltip.corner.search(/((left|right)Middle)|center/)!==-1)
1641newPosition.top-=(tooltip.dimensions.height/2);
1642ieAdjust=(jQuery.browser.msie)?1:0;
1643ie6Adjust=(jQuery.browser.msie&&parseInt(jQuery.browser.version.charAt(0))===6)?1:0;
1644if(self.options.style.border.radius>0)
1645{
1646if(tooltip.corner.search(/Left/)!==-1)
1647newPosition.left-=self.options.style.border.radius;
1648else if(tooltip.corner.search(/Right/)!==-1)
1649newPosition.left+=self.options.style.border.radius;
1650if(tooltip.corner.search(/Top/)!==-1)
1651newPosition.top-=self.options.style.border.radius;
1652else if(tooltip.corner.search(/Bottom/)!==-1)
1653newPosition.top+=self.options.style.border.radius;
1654};
1655if(ieAdjust)
1656{
1657if(tooltip.corner.search(/top/)!==-1)
1658newPosition.top-=ieAdjust
1659else if(tooltip.corner.search(/bottom/)!==-1)
1660newPosition.top+=ieAdjust
1661if(tooltip.corner.search(/left/)!==-1)
1662newPosition.left-=ieAdjust
1663else if(tooltip.corner.search(/right/)!==-1)
1664newPosition.left+=ieAdjust
1665if(tooltip.corner.search(/leftMiddle|rightMiddle/)!==-1)
1666newPosition.top-=1
1667};
1668if(self.options.position.adjust.screen===true)
1669newPosition=screenAdjust.call(self,newPosition,target,tooltip);
1670if(self.options.position.target==='mouse'&&self.options.position.adjust.mouse===true)
1671{
1672if(self.options.position.adjust.screen===true&&self.elements.tip)
1673mouseAdjust=self.elements.tip.attr('rel');
1674else
1675mouseAdjust=self.options.position.corner.tooltip;
1676newPosition.left+=(mouseAdjust.search(/right/i)!==-1)?-6:6;
1677newPosition.top+=(mouseAdjust.search(/bottom/i)!==-1)?-6:6;
1678}
1679if(!self.elements.bgiframe&&jQuery.browser.msie&&parseInt(jQuery.browser.version.charAt(0))==6)
1680{
1681jQuery('select, object').each(function()
1682{
1683offset=jQuery(this).offset();
1684offset.bottom=offset.top+jQuery(this).height();
1685offset.right=offset.left+jQuery(this).width();
1686if(newPosition.top+tooltip.dimensions.height>=offset.top
1687&&newPosition.left+tooltip.dimensions.width>=offset.left)
1688bgiframe.call(self);
1689});
1690};
1691newPosition.left+=self.options.position.adjust.x;
1692newPosition.top+=self.options.position.adjust.y;
1693curPosition=self.getPosition();
1694if(newPosition.left!=curPosition.left||newPosition.top!=curPosition.top)
1695{
1696returned=self.beforePositionUpdate.call(self,event);
1697if(returned===false)return self;
1698self.cache.position=newPosition;
1699if(animate===true)
1700{
1701self.status.animated=true;
1702self.elements.tooltip.animate(newPosition,200,'swing',function(){self.status.animated=false});
1703}
1704else self.elements.tooltip.css(newPosition);
1705self.onPositionUpdate.call(self,event);
1706if(typeof event!=='undefined'&&event.type&&event.type!=='mousemove')
1707jQuery.fn.qtip.log.error.call(self,1,jQuery.fn.qtip.constants.EVENT_POSITION_UPDATED,'updatePosition');
1708};
1709return self;
1710},
1711updateWidth:function(newWidth)
1712{
1713var hidden;
1714if(!self.status.rendered)
1715return joms.jQuery.fn.qtip.log.error.call(self,2,jQuery.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'updateWidth');
1716else if(newWidth&&typeof newWidth!=='number')
1717return joms.jQuery.fn.qtip.log.error.call(self,2,'newWidth must be of type number','updateWidth');
1718hidden=self.elements.contentWrapper.siblings().add(self.elements.tip).add(self.elements.button);
1719if(!newWidth)
1720{
1721if(typeof self.options.style.width.value=='number')
1722newWidth=self.options.style.width.value;
1723else
1724{
1725self.elements.tooltip.css({width:'auto'});
1726hidden.hide();
1727if(jQuery.browser.msie)
1728self.elements.wrapper.add(self.elements.contentWrapper.children()).css({zoom:'normal'});
1729newWidth=self.getDimensions().width+1;
1730if(!self.options.style.width.value)
1731{
1732if(newWidth>self.options.style.width.max)newWidth=self.options.style.width.max
1733if(newWidth<self.options.style.width.min)newWidth=self.options.style.width.min
1734};
1735};
1736};
1737if(newWidth%2!==0)newWidth-=1;
1738self.elements.tooltip.width(newWidth);
1739hidden.show();
1740if(self.options.style.border.radius)
1741{
1742self.elements.tooltip.find('.qtip-betweenCorners').each(function(i)
1743{
1744jQuery(this).width(newWidth-(self.options.style.border.radius*2));
1745})
1746};
1747if(jQuery.browser.msie)
1748{
1749self.elements.wrapper.add(self.elements.contentWrapper.children()).css({zoom:'1'});
1750self.elements.wrapper.width(newWidth);
1751if(self.elements.bgiframe)self.elements.bgiframe.width(newWidth).height(self.getDimensions.height);
1752};
1753return joms.jQuery.fn.qtip.log.error.call(self,1,jQuery.fn.qtip.constants.EVENT_WIDTH_UPDATED,'updateWidth');
1754},
1755updateStyle:function(name)
1756{
1757var tip,borders,context,corner,coordinates;
1758if(!self.status.rendered)
1759return joms.jQuery.fn.qtip.log.error.call(self,2,jQuery.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'updateStyle');
1760else if(typeof name!=='string'||!jQuery.fn.qtip.styles[name])
1761return joms.jQuery.fn.qtip.log.error.call(self,2,jQuery.fn.qtip.constants.STYLE_NOT_DEFINED,'updateStyle');
1762self.options.style=buildStyle.call(self,jQuery.fn.qtip.styles[name],self.options.user.style);
1763self.elements.content.css(jQueryStyle(self.options.style));
1764if(self.options.content.title.text!==false)
1765self.elements.title.css(jQueryStyle(self.options.style.title,true));
1766self.elements.contentWrapper.css({borderColor:self.options.style.border.color});
1767if(self.options.style.tip.corner!==false)
1768{
1769if(jQuery('<canvas>').get(0).getContext)
1770{
1771tip=self.elements.tooltip.find('.qtip-tip canvas:first');
1772context=tip.get(0).getContext('2d');
1773context.clearRect(0,0,300,300);
1774corner=tip.parent('div[rel]:first').attr('rel');
1775coordinates=calculateTip(corner,self.options.style.tip.size.width,self.options.style.tip.size.height);
1776drawTip.call(self,tip,coordinates,self.options.style.tip.color||self.options.style.border.color);
1777}
1778else if(jQuery.browser.msie)
1779{
1780tip=self.elements.tooltip.find('.qtip-tip [nodeName="shape"]');
1781tip.attr('fillcolor',self.options.style.tip.color||self.options.style.border.color);
1782};
1783};
1784if(self.options.style.border.radius>0)
1785{
1786self.elements.tooltip.find('.qtip-betweenCorners').css({backgroundColor:self.options.style.border.color});
1787if(jQuery('<canvas>').get(0).getContext)
1788{
1789borders=calculateBorders(self.options.style.border.radius)
1790self.elements.tooltip.find('.qtip-wrapper canvas').each(function()
1791{
1792context=jQuery(this).get(0).getContext('2d');
1793context.clearRect(0,0,300,300);
1794corner=jQuery(this).parent('div[rel]:first').attr('rel')
1795drawBorder.call(self,jQuery(this),borders[corner],
1796self.options.style.border.radius,self.options.style.border.color);
1797});
1798}
1799else if(jQuery.browser.msie)
1800{
1801self.elements.tooltip.find('.qtip-wrapper [nodeName="arc"]').each(function()
1802{
1803jQuery(this).attr('fillcolor',self.options.style.border.color)
1804});
1805};
1806};
1807return joms.jQuery.fn.qtip.log.error.call(self,1,jQuery.fn.qtip.constants.EVENT_STYLE_UPDATED,'updateStyle');
1808},
1809updateContent:function(content,reposition)
1810{
1811var parsedContent,images,loadedImages;
1812if(!self.status.rendered)
1813return joms.jQuery.fn.qtip.log.error.call(self,2,jQuery.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'updateContent');
1814else if(!content)
1815return joms.jQuery.fn.qtip.log.error.call(self,2,jQuery.fn.qtip.constants.NO_CONTENT_PROVIDED,'updateContent');
1816parsedContent=self.beforeContentUpdate.call(self,content);
1817if(typeof parsedContent=='string')content=parsedContent;
1818else if(parsedContent===false)return;
1819if(jQuery.browser.msie)self.elements.contentWrapper.children().css({zoom:'normal'});
1820if(content.jquery&&content.length>0)
1821content.clone(true).appendTo(self.elements.content).show();
1822else self.elements.content.html(content);
1823images=self.elements.content.find('img[complete=false]');
1824if(images.length>0)
1825{
1826loadedImages=0;
1827images.each(function(i)
1828{
1829jQuery('<img src="'+jQuery(this).attr('src')+'" />')
1830.load(function(){if(++loadedImages==images.length)afterLoad();});
1831});
1832}
1833else afterLoad();
1834function afterLoad()
1835{
1836self.updateWidth();
1837if(reposition!==false)
1838{
1839if(self.options.position.type!=='static')
1840self.updatePosition(self.elements.tooltip.is(':visible'),true);
1841if(self.options.style.tip.corner!==false)
1842positionTip.call(self);
1843};
1844};
1845self.onContentUpdate.call(self);
1846return joms.jQuery.fn.qtip.log.error.call(self,1,jQuery.fn.qtip.constants.EVENT_CONTENT_UPDATED,'loadContent');
1847},
1848loadContent:function(url,data,method)
1849{
1850var returned;
1851if(!self.status.rendered)
1852return joms.jQuery.fn.qtip.log.error.call(self,2,jQuery.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'loadContent');
1853returned=self.beforeContentLoad.call(self);
1854if(returned===false)return self;
1855if(method=='post')
1856jQuery.post(url,data,setupContent);
1857else
1858jQuery.get(url,data,setupContent);
1859function setupContent(content)
1860{
1861self.onContentLoad.call(self);
1862jQuery.fn.qtip.log.error.call(self,1,jQuery.fn.qtip.constants.EVENT_CONTENT_LOADED,'loadContent');
1863self.updateContent(content);
1864};
1865return self;
1866},
1867updateTitle:function(content)
1868{
1869if(!self.status.rendered)
1870return joms.jQuery.fn.qtip.log.error.call(self,2,jQuery.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'updateTitle');
1871else if(!content)
1872return joms.jQuery.fn.qtip.log.error.call(self,2,jQuery.fn.qtip.constants.NO_CONTENT_PROVIDED,'updateTitle');
1873returned=self.beforeTitleUpdate.call(self);
1874if(returned===false)return self;
1875if(self.elements.button)self.elements.button=self.elements.button.clone(true);
1876self.elements.title.html(content)
1877if(self.elements.button)self.elements.title.prepend(self.elements.button);
1878self.onTitleUpdate.call(self);
1879return joms.jQuery.fn.qtip.log.error.call(self,1,jQuery.fn.qtip.constants.EVENT_TITLE_UPDATED,'updateTitle');
1880},
1881focus:function(event)
1882{
1883var curIndex,newIndex,elemIndex,returned;
1884if(!self.status.rendered)
1885return joms.jQuery.fn.qtip.log.error.call(self,2,jQuery.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'focus');
1886else if(self.options.position.type=='static')
1887return joms.jQuery.fn.qtip.log.error.call(self,1,jQuery.fn.qtip.constants.CANNOT_FOCUS_STATIC,'focus');
1888curIndex=parseInt(self.elements.tooltip.css('z-index'));
1889newIndex=7000+jQuery('div.qtip[qtip]').length-1;
1890if(!self.status.focused&&curIndex!==newIndex)
1891{
1892returned=self.beforeFocus.call(self,event);
1893if(returned===false)return self;
1894jQuery('div.qtip[qtip]').not(self.elements.tooltip).each(function()
1895{
1896if(jQuery(this).qtip('api').status.rendered===true)
1897{
1898elemIndex=parseInt(jQuery(this).css('z-index'));
1899if(typeof elemIndex=='number'&&elemIndex>-1)
1900jQuery(this).css({zIndex:parseInt(jQuery(this).css('z-index'))-1});
1901jQuery(this).qtip('api').status.focused=false;
1902}
1903})
1904self.elements.tooltip.css({zIndex:newIndex});
1905self.status.focused=true;
1906self.onFocus.call(self,event);
1907jQuery.fn.qtip.log.error.call(self,1,jQuery.fn.qtip.constants.EVENT_FOCUSED,'focus');
1908};
1909return self;
1910},
1911disable:function(state)
1912{
1913if(!self.status.rendered)
1914return joms.jQuery.fn.qtip.log.error.call(self,2,jQuery.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'disable');
1915if(state)
1916{
1917if(!self.status.disabled)
1918{
1919self.status.disabled=true;
1920jQuery.fn.qtip.log.error.call(self,1,jQuery.fn.qtip.constants.EVENT_DISABLED,'disable');
1921}
1922else joms.jQuery.fn.qtip.log.error.call(self,1,jQuery.fn.qtip.constants.TOOLTIP_ALREADY_DISABLED,'disable');
1923}
1924else
1925{
1926if(self.status.disabled)
1927{
1928self.status.disabled=false;
1929jQuery.fn.qtip.log.error.call(self,1,jQuery.fn.qtip.constants.EVENT_ENABLED,'disable');
1930}
1931else joms.jQuery.fn.qtip.log.error.call(self,1,jQuery.fn.qtip.constants.TOOLTIP_ALREADY_ENABLED,'disable');
1932};
1933return self;
1934},
1935destroy:function()
1936{
1937var i,returned,interfaces;
1938returned=self.beforeDestroy.call(self);
1939if(returned===false)return self;
1940if(self.status.rendered)
1941{
1942self.options.show.when.target.unbind('mousemove.qtip',self.updatePosition);
1943self.options.show.when.target.unbind('mouseout.qtip',self.hide);
1944self.options.show.when.target.unbind(self.options.show.when.event+'.qtip');
1945self.options.hide.when.target.unbind(self.options.hide.when.event+'.qtip');
1946self.elements.tooltip.unbind(self.options.hide.when.event+'.qtip');
1947self.elements.tooltip.unbind('mouseover.qtip',self.focus);
1948self.elements.tooltip.remove();
1949}
1950else self.options.show.when.target.unbind(self.options.show.when.event+'.qtip-create');
1951if(typeof self.elements.target.data('qtip')=='object')
1952{
1953interfaces=self.elements.target.data('qtip').interfaces;
1954if(typeof interfaces=='object'&&interfaces.length>0)
1955{
1956for(i=0;i<interfaces.length-1;i++)
1957if(interfaces[i].id==self.id)interfaces.splice(i,1)
1958}
1959}
1960delete joms.jQuery.fn.qtip.interfaces[self.id];
1961if(typeof interfaces=='object'&&interfaces.length>0)
1962self.elements.target.data('qtip').current=interfaces.length-1;
1963else
1964self.elements.target.removeData('qtip');
1965self.onDestroy.call(self);
1966jQuery.fn.qtip.log.error.call(self,1,jQuery.fn.qtip.constants.EVENT_DESTROYED,'destroy');
1967return self.elements.target
1968},
1969getPosition:function()
1970{
1971var show,offset;
1972if(!self.status.rendered)
1973return joms.jQuery.fn.qtip.log.error.call(self,2,jQuery.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'getPosition');
1974show=(self.elements.tooltip.css('display')!=='none')?false:true;
1975if(show)self.elements.tooltip.css({visiblity:'hidden'}).show();
1976offset=self.elements.tooltip.offset();
1977if(show)self.elements.tooltip.css({visiblity:'visible'}).hide();
1978return offset;
1979},
1980getDimensions:function()
1981{
1982var show,dimensions;
1983if(!self.status.rendered)
1984return joms.jQuery.fn.qtip.log.error.call(self,2,jQuery.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'getDimensions');
1985show=(!self.elements.tooltip.is(':visible'))?true:false;
1986if(show)self.elements.tooltip.css({visiblity:'hidden'}).show();
1987dimensions={
1988height:self.elements.tooltip.outerHeight(),
1989width:self.elements.tooltip.outerWidth()
1990};
1991if(show)self.elements.tooltip.css({visiblity:'visible'}).hide();
1992return dimensions;
1993}
1994});
1995};
1996function construct()
1997{
1998var self,adjust,content,url,data,method,tempLength;
1999self=this;
2000self.beforeRender.call(self);
2001self.status.rendered=true;
2002self.elements.tooltip='<div qtip="'+self.id+'" '+
2003'class="qtip '+(self.options.style.classes.tooltip||self.options.style)+'"'+
2004'style="display:none; -moz-border-radius:0; -webkit-border-radius:0; border-radius:0;'+
2005'position:'+self.options.position.type+';">'+
2006'  <div class="qtip-wrapper" style="position:relative; overflow:hidden; text-align:left;">'+
2007'    <div class="qtip-contentWrapper" style="overflow:hidden;">'+
2008'       <div class="qtip-content '+self.options.style.classes.content+'"></div>'+
2009'</div></div></div>';
2010self.elements.tooltip=jQuery(self.elements.tooltip);
2011self.elements.tooltip.appendTo(self.options.position.container)
2012self.elements.tooltip.data('qtip',{current:0,interfaces:[self]});
2013self.elements.wrapper=self.elements.tooltip.children('div:first');
2014self.elements.contentWrapper=self.elements.wrapper.children('div:first').css({background:self.options.style.background});
2015self.elements.content=self.elements.contentWrapper.children('div:first').css(jQueryStyle(self.options.style));
2016if(jQuery.browser.msie)self.elements.wrapper.add(self.elements.content).css({zoom:1});
2017if(self.options.hide.when.event=='unfocus')self.elements.tooltip.attr('unfocus',true);
2018if(typeof self.options.style.width.value=='number')self.updateWidth();
2019if(jQuery('<canvas>').get(0).getContext||jQuery.browser.msie)
2020{
2021if(self.options.style.border.radius>0)
2022createBorder.call(self);
2023else
2024self.elements.contentWrapper.css({border:self.options.style.border.width+'px solid '+self.options.style.border.color});
2025if(self.options.style.tip.corner!==false)
2026createTip.call(self);
2027}
2028else
2029{
2030self.elements.contentWrapper.css({border:self.options.style.border.width+'px solid '+self.options.style.border.color});
2031self.options.style.border.radius=0;
2032self.options.style.tip.corner=false;
2033jQuery.fn.qtip.log.error.call(self,2,jQuery.fn.qtip.constants.CANVAS_VML_NOT_SUPPORTED,'render');
2034};
2035if((typeof self.options.content.text=='string'&&self.options.content.text.length>0)
2036||(self.options.content.text.jquery&&self.options.content.text.length>0))
2037content=self.options.content.text;
2038else if(typeof self.elements.target.attr('title')=='string'&&self.elements.target.attr('title').length>0)
2039{
2040content=self.elements.target.attr('title').replace("\\n",'<br />');
2041self.elements.target.attr('title','');
2042}
2043else if(typeof self.elements.target.attr('alt')=='string'&&self.elements.target.attr('alt').length>0)
2044{
2045content=self.elements.target.attr('alt').replace("\\n",'<br />');
2046self.elements.target.attr('alt','');
2047}
2048else
2049{
2050content=' ';
2051jQuery.fn.qtip.log.error.call(self,1,jQuery.fn.qtip.constants.NO_VALID_CONTENT,'render');
2052};
2053if(self.options.content.title.text!==false)createTitle.call(self);
2054self.updateContent(content);
2055assignEvents.call(self);
2056if(self.options.show.ready===true)self.show();
2057if(self.options.content.url!==false)
2058{
2059url=self.options.content.url;
2060data=self.options.content.data;
2061method=self.options.content.method||'get';
2062self.loadContent(url,data,method);
2063};
2064self.onRender.call(self);
2065jQuery.fn.qtip.log.error.call(self,1,jQuery.fn.qtip.constants.EVENT_RENDERED,'render');
2066};
2067function createBorder()
2068{
2069var self,i,width,radius,color,coordinates,containers,size,betweenWidth,betweenCorners,borderTop,borderBottom,borderCoord,sideWidth,vertWidth;
2070self=this;
2071self.elements.wrapper.find('.qtip-borderBottom, .qtip-borderTop').remove();
2072width=self.options.style.border.width;
2073radius=self.options.style.border.radius;
2074color=self.options.style.border.color||self.options.style.tip.color;
2075coordinates=calculateBorders(radius);
2076containers={};
2077for(i in coordinates)
2078{
2079containers[i]='<div rel="'+i+'" style="'+((i.search(/Left/)!==-1)?'left':'right')+':0; '+
2080'position:absolute; height:'+radius+'px; width:'+radius+'px; overflow:hidden; line-height:0.1px; font-size:1px">';
2081if(jQuery('<canvas>').get(0).getContext)
2082containers[i]+='<canvas height="'+radius+'" width="'+radius+'" style="vertical-align: top"></canvas>';
2083else if(jQuery.browser.msie)
2084{
2085size=radius*2+3;
2086containers[i]+='<v:arc stroked="false" fillcolor="'+color+'" startangle="'+coordinates[i][0]+'" endangle="'+coordinates[i][1]+'" '+
2087'style="width:'+size+'px; height:'+size+'px; margin-top:'+((i.search(/bottom/)!==-1)?-2:-1)+'px; '+
2088'margin-left:'+((i.search(/Right/)!==-1)?coordinates[i][2]-3.5:-1)+'px; '+
2089'vertical-align:top; display:inline-block; behavior:url(#default#VML)"></v:arc>';
2090};
2091containers[i]+='</div>';
2092};
2093betweenWidth=self.getDimensions().width-(Math.max(width,radius)*2);
2094betweenCorners='<div class="qtip-betweenCorners" style="height:'+radius+'px; width:'+betweenWidth+'px; '+
2095'overflow:hidden; background-color:'+color+'; line-height:0.1px; font-size:1px;">';
2096borderTop='<div class="qtip-borderTop" dir="ltr" style="height:'+radius+'px; '+
2097'margin-left:'+radius+'px; line-height:0.1px; font-size:1px; padding:0;">'+
2098containers['topLeft']+containers['topRight']+betweenCorners;
2099self.elements.wrapper.prepend(borderTop);
2100borderBottom='<div class="qtip-borderBottom" dir="ltr" style="height:'+radius+'px; '+
2101'margin-left:'+radius+'px; line-height:0.1px; font-size:1px; padding:0;">'+
2102containers['bottomLeft']+containers['bottomRight']+betweenCorners;
2103self.elements.wrapper.append(borderBottom);
2104if(jQuery('<canvas>').get(0).getContext)
2105{
2106self.elements.wrapper.find('canvas').each(function()
2107{
2108borderCoord=coordinates[jQuery(this).parent('[rel]:first').attr('rel')];
2109drawBorder.call(self,jQuery(this),borderCoord,radius,color);
2110})
2111}
2112else if(jQuery.browser.msie)self.elements.tooltip.append('<v:image style="behavior:url(#default#VML);"></v:image>');
2113sideWidth=Math.max(radius,(radius+(width-radius)))
2114vertWidth=Math.max(width-radius,0);
2115self.elements.contentWrapper.css({
2116border:'0px solid '+color,
2117borderWidth:vertWidth+'px '+sideWidth+'px'
2118})
2119};
2120function drawBorder(canvas,coordinates,radius,color)
2121{
2122var context=canvas.get(0).getContext('2d');
2123context.fillStyle=color;
2124context.beginPath();
2125context.arc(coordinates[0],coordinates[1],radius,0,Math.PI*2,false);
2126context.fill();
2127};
2128function createTip(corner)
2129{
2130var self,color,coordinates,coordsize,path;
2131self=this;
2132if(self.elements.tip!==null)self.elements.tip.remove();
2133color=self.options.style.tip.color||self.options.style.border.color;
2134if(self.options.style.tip.corner===false)return;
2135else if(!corner)corner=self.options.style.tip.corner;
2136coordinates=calculateTip(corner,self.options.style.tip.size.width,self.options.style.tip.size.height);
2137self.elements.tip='<div class="'+self.options.style.classes.tip+'" dir="ltr" rel="'+corner+'" style="position:absolute; '+
2138'height:'+self.options.style.tip.size.height+'px; width:'+self.options.style.tip.size.width+'px; '+
2139'margin:0 auto; line-height:0.1px; font-size:1px;">';
2140if(jQuery('<canvas>').get(0).getContext)
2141self.elements.tip+='<canvas height="'+self.options.style.tip.size.height+'" width="'+self.options.style.tip.size.width+'"></canvas>';
2142else if(jQuery.browser.msie)
2143{
2144coordsize=self.options.style.tip.size.width+','+self.options.style.tip.size.height;
2145path='m'+coordinates[0][0]+','+coordinates[0][1];
2146path+=' l'+coordinates[1][0]+','+coordinates[1][1];
2147path+=' '+coordinates[2][0]+','+coordinates[2][1];
2148path+=' xe';
2149self.elements.tip+='<v:shape fillcolor="'+color+'" stroked="false" filled="true" path="'+path+'" coordsize="'+coordsize+'" '+
2150'style="width:'+self.options.style.tip.size.width+'px; height:'+self.options.style.tip.size.height+'px; '+
2151'line-height:0.1px; display:inline-block; behavior:url(#default#VML); '+
2152'vertical-align:'+((corner.search(/top/)!==-1)?'bottom':'top')+'"></v:shape>';
2153self.elements.tip+='<v:image style="behavior:url(#default#VML);"></v:image>';
2154self.elements.contentWrapper.css('position','relative');
2155};
2156self.elements.tooltip.prepend(self.elements.tip+'</div>');
2157self.elements.tip=self.elements.tooltip.find('.'+self.options.style.classes.tip).eq(0);
2158if(jQuery('<canvas>').get(0).getContext)
2159drawTip.call(self,self.elements.tip.find('canvas:first'),coordinates,color);
2160if(corner.search(/top/)!==-1&&jQuery.browser.msie&&parseInt(jQuery.browser.version.charAt(0))===6)
2161self.elements.tip.css({marginTop:-4});
2162positionTip.call(self,corner);
2163};
2164function drawTip(canvas,coordinates,color)
2165{
2166var context=canvas.get(0).getContext('2d');
2167context.fillStyle=color;
2168context.beginPath();
2169context.moveTo(coordinates[0][0],coordinates[0][1]);
2170context.lineTo(coordinates[1][0],coordinates[1][1]);
2171context.lineTo(coordinates[2][0],coordinates[2][1]);
2172context.fill();
2173};
2174function positionTip(corner)
2175{
2176var self,ieAdjust,paddingCorner,paddingSize,newMargin;
2177self=this;
2178if(self.options.style.tip.corner===false||!self.elements.tip)return;
2179if(!corner)corner=self.elements.tip.attr('rel');
2180ieAdjust=positionAdjust=(jQuery.browser.msie)?1:0;
2181self.elements.tip.css(corner.match(/left|right|top|bottom/)[0],0);
2182if(corner.search(/top|bottom/)!==-1)
2183{
2184if(jQuery.browser.msie)
2185{
2186if(parseInt(jQuery.browser.version.charAt(0))===6)
2187positionAdjust=(corner.search(/top/)!==-1)?-3:1;
2188else
2189positionAdjust=(corner.search(/top/)!==-1)?1:2;
2190};
2191if(corner.search(/Middle/)!==-1)
2192self.elements.tip.css({left:'50%',marginLeft:-(self.options.style.tip.size.width/2)});
2193else if(corner.search(/Left/)!==-1)
2194self.elements.tip.css({left:self.options.style.border.radius-ieAdjust});
2195else if(corner.search(/Right/)!==-1)
2196self.elements.tip.css({right:self.options.style.border.radius+ieAdjust});
2197if(corner.search(/top/)!==-1)
2198self.elements.tip.css({top:-positionAdjust});
2199else
2200self.elements.tip.css({bottom:positionAdjust});
2201}
2202else if(corner.search(/left|right/)!==-1)
2203{
2204if(jQuery.browser.msie)
2205positionAdjust=(parseInt(jQuery.browser.version.charAt(0))===6)?1:((corner.search(/left/)!==-1)?1:2);
2206if(corner.search(/Middle/)!==-1)
2207self.elements.tip.css({top:'50%',marginTop:-(self.options.style.tip.size.height/2)});
2208else if(corner.search(/Top/)!==-1)
2209self.elements.tip.css({top:self.options.style.border.radius-ieAdjust});
2210else if(corner.search(/Bottom/)!==-1)
2211self.elements.tip.css({bottom:self.options.style.border.radius+ieAdjust});
2212if(corner.search(/left/)!==-1)
2213self.elements.tip.css({left:-positionAdjust});
2214else
2215self.elements.tip.css({right:positionAdjust});
2216};
2217paddingCorner='padding-'+corner.match(/left|right|top|bottom/)[0];
2218paddingSize=self.options.style.tip.size[(paddingCorner.search(/left|right/)!==-1)?'width':'height'];
2219self.elements.tooltip.css('padding',0);
2220self.elements.tooltip.css(paddingCorner,paddingSize);
2221if(jQuery.browser.msie&&parseInt(jQuery.browser.version.charAt(0))==6)
2222{
2223newMargin=parseInt(self.elements.tip.css('margin-top'))||0;
2224newMargin+=parseInt(self.elements.content.css('margin-top'))||0;
2225self.elements.tip.css({marginTop:newMargin});
2226};
2227};
2228function createTitle()
2229{
2230var self=this;
2231if(self.elements.title!==null)self.elements.title.remove();
2232self.elements.title=jQuery('<div class="'+self.options.style.classes.title+'">')
2233.css(jQueryStyle(self.options.style.title,true))
2234.css({zoom:(jQuery.browser.msie)?1:0})
2235.prependTo(self.elements.contentWrapper);
2236if(self.options.content.title.text)self.updateTitle.call(self,self.options.content.title.text);
2237if(self.options.content.title.button!==false
2238&&typeof self.options.content.title.button=='string')
2239{
2240self.elements.button=jQuery('<a class="'+self.options.style.classes.button+'" style="float:right; position: relative"></a>')
2241.css(jQueryStyle(self.options.style.button,true))
2242.html(self.options.content.title.button)
2243.prependTo(self.elements.title)
2244.click(function(event){if(!self.status.disabled)self.hide(event)});
2245};
2246};
2247function assignEvents()
2248{
2249var self,showTarget,hideTarget,inactiveEvents;
2250self=this;
2251showTarget=self.options.show.when.target;
2252hideTarget=self.options.hide.when.target;
2253if(self.options.hide.fixed)hideTarget=hideTarget.add(self.elements.tooltip);
2254if(self.options.hide.when.event=='inactive')
2255{
2256inactiveEvents=['click','dblclick','mousedown','mouseup','mousemove',
2257'mouseout','mouseenter','mouseleave','mouseover'];
2258function inactiveMethod(event)
2259{
2260if(self.status.disabled===true)return;
2261clearTimeout(self.timers.inactive);
2262self.timers.inactive=setTimeout(function()
2263{
2264jQuery(inactiveEvents).each(function()
2265{
2266hideTarget.unbind(this+'.qtip-inactive');
2267self.elements.content.unbind(this+'.qtip-inactive');
2268});
2269self.hide(event);
2270}
2271,self.options.hide.delay);
2272};
2273}
2274else if(self.options.hide.fixed===true)
2275{
2276self.elements.tooltip.bind('mouseover.qtip',function()
2277{
2278if(self.status.disabled===true)return;
2279clearTimeout(self.timers.hide);
2280});
2281};
2282function showMethod(event)
2283{
2284if(self.status.disabled===true)return;
2285if(self.options.hide.when.event=='inactive')
2286{
2287jQuery(inactiveEvents).each(function()
2288{
2289hideTarget.bind(this+'.qtip-inactive',inactiveMethod);
2290self.elements.content.bind(this+'.qtip-inactive',inactiveMethod);
2291});
2292inactiveMethod();
2293};
2294clearTimeout(self.timers.show);
2295clearTimeout(self.timers.hide);
2296self.timers.show=setTimeout(function(){self.show(event);},self.options.show.delay);
2297};
2298function hideMethod(event)
2299{
2300if(self.status.disabled===true)return;
2301if(self.options.hide.fixed===true
2302&&self.options.hide.when.event.search(/mouse(out|leave)/i)!==-1
2303&&jQuery(event.relatedTarget).parents('div.qtip[qtip]').length>0)
2304{
2305event.stopPropagation();
2306event.preventDefault();
2307clearTimeout(self.timers.hide);
2308return false;
2309};
2310clearTimeout(self.timers.show);
2311clearTimeout(self.timers.hide);
2312self.elements.tooltip.stop(true,true);
2313self.timers.hide=setTimeout(function(){self.hide(event);},self.options.hide.delay);
2314};
2315if((self.options.show.when.target.add(self.options.hide.when.target).length===1
2316&&self.options.show.when.event==self.options.hide.when.event
2317&&self.options.hide.when.event!=='inactive')
2318||self.options.hide.when.event=='unfocus')
2319{
2320self.cache.toggle=0;
2321showTarget.bind(self.options.show.when.event+'.qtip',function(event)
2322{
2323if(self.cache.toggle==0)showMethod(event);
2324else hideMethod(event);
2325});
2326}
2327else
2328{
2329showTarget.bind(self.options.show.when.event+'.qtip',showMethod);
2330if(self.options.hide.when.event!=='inactive')
2331hideTarget.bind(self.options.hide.when.event+'.qtip',hideMethod);
2332};
2333if(self.options.position.type.search(/(fixed|absolute)/)!==-1)
2334self.elements.tooltip.bind('mouseover.qtip',self.focus);
2335if(self.options.position.target==='mouse'&&self.options.position.type!=='static')
2336{
2337showTarget.bind('mousemove.qtip',function(event)
2338{
2339self.cache.mouse={x:event.pageX,y:event.pageY};
2340if(self.status.disabled===false
2341&&self.options.position.adjust.mouse===true
2342&&self.options.position.type!=='static'
2343&&self.elements.tooltip.css('display')!=='none')
2344self.updatePosition(event);
2345});
2346};
2347};
2348function screenAdjust(position,target,tooltip)
2349{
2350var self,adjustedPosition,adjust,newCorner,overflow,corner;
2351self=this;
2352if(tooltip.corner=='center')return target.position
2353adjustedPosition=jQuery.extend({},position);
2354newCorner={x:false,y:false};
2355overflow={
2356left:(adjustedPosition.left<jQuery.fn.qtip.cache.screen.scroll.left),
2357right:(adjustedPosition.left+tooltip.dimensions.width+2>=jQuery.fn.qtip.cache.screen.width+jQuery.fn.qtip.cache.screen.scroll.left),
2358top:(adjustedPosition.top<jQuery.fn.qtip.cache.screen.scroll.top),
2359bottom:(adjustedPosition.top+tooltip.dimensions.height+2>=jQuery.fn.qtip.cache.screen.height+jQuery.fn.qtip.cache.screen.scroll.top)
2360};
2361adjust={
2362left:(overflow.left&&(tooltip.corner.search(/right/i)!=-1||(tooltip.corner.search(/right/i)==-1&&!overflow.right))),
2363right:(overflow.right&&(tooltip.corner.search(/left/i)!=-1||(tooltip.corner.search(/left/i)==-1&&!overflow.left))),
2364top:(overflow.top&&tooltip.corner.search(/top/i)==-1),
2365bottom:(overflow.bottom&&tooltip.corner.search(/bottom/i)==-1)
2366};
2367if(adjust.left)
2368{
2369if(self.options.position.target!=='mouse')
2370adjustedPosition.left=target.position.left+target.dimensions.width;
2371else
2372adjustedPosition.left=self.cache.mouse.x
2373newCorner.x='Left';
2374}
2375else if(adjust.right)
2376{
2377if(self.options.position.target!=='mouse')
2378adjustedPosition.left=target.position.left-tooltip.dimensions.width;
2379else
2380adjustedPosition.left=self.cache.mouse.x-tooltip.dimensions.width;
2381newCorner.x='Right';
2382};
2383if(adjust.top)
2384{
2385if(self.options.position.target!=='mouse')
2386adjustedPosition.top=target.position.top+target.dimensions.height;
2387else
2388adjustedPosition.top=self.cache.mouse.y
2389newCorner.y='top';
2390}
2391else if(adjust.bottom)
2392{
2393if(self.options.position.target!=='mouse')
2394adjustedPosition.top=target.position.top-tooltip.dimensions.height;
2395else
2396adjustedPosition.top=self.cache.mouse.y-tooltip.dimensions.height;
2397newCorner.y='bottom';
2398};
2399if(adjustedPosition.left<0)
2400{
2401adjustedPosition.left=position.left;
2402newCorner.x=false;
2403};
2404if(adjustedPosition.top<0)
2405{
2406adjustedPosition.top=position.top;
2407newCorner.y=false;
2408};
2409if(self.options.style.tip.corner!==false)
2410{
2411adjustedPosition.corner=new String(tooltip.corner);
2412if(newCorner.x!==false)adjustedPosition.corner=adjustedPosition.corner.replace(/Left|Right|Middle/,newCorner.x);
2413if(newCorner.y!==false)adjustedPosition.corner=adjustedPosition.corner.replace(/top|bottom/,newCorner.y);
2414if(adjustedPosition.corner!==self.elements.tip.attr('rel'))
2415createTip.call(self,adjustedPosition.corner);
2416};
2417return adjustedPosition;
2418};
2419function jQueryStyle(style,sub)
2420{
2421var styleObj,i;
2422styleObj=jQuery.extend(true,{},style);
2423for(i in styleObj)
2424{
2425if(sub===true&&i.search(/(tip|classes)/i)!==-1)
2426delete styleObj[i];
2427else if(!sub&&i.search(/(width|border|tip|title|classes|user)/i)!==-1)
2428delete styleObj[i];
2429};
2430return styleObj;
2431};
2432function sanitizeStyle(style)
2433{
2434if(typeof style.tip!=='object')style.tip={corner:style.tip};
2435if(typeof style.tip.size!=='object')style.tip.size={width:style.tip.size,height:style.tip.size};
2436if(typeof style.border!=='object')style.border={width:style.border};
2437if(typeof style.width!=='object')style.width={value:style.width};
2438if(typeof style.width.max=='string')style.width.max=parseInt(style.width.max.replace(/([0-9]+)/i,"jQuery1"));
2439if(typeof style.width.min=='string')style.width.min=parseInt(style.width.min.replace(/([0-9]+)/i,"jQuery1"));
2440if(typeof style.tip.size.x=='number')
2441{
2442style.tip.size.width=style.tip.size.x;
2443delete style.tip.size.x;
2444};
2445if(typeof style.tip.size.y=='number')
2446{
2447style.tip.size.height=style.tip.size.y;
2448delete style.tip.size.y;
2449};
2450return style;
2451};
2452function buildStyle()
2453{
2454var self,i,styleArray,styleExtend,finalStyle,ieAdjust;
2455self=this;
2456styleArray=[true,{}];
2457for(i=0;i<arguments.length;i++)
2458styleArray.push(arguments[i]);
2459styleExtend=[jQuery.extend.apply(jQuery,styleArray)];
2460while(typeof styleExtend[0].name=='string')
2461{
2462styleExtend.unshift(sanitizeStyle(jQuery.fn.qtip.styles[styleExtend[0].name]));
2463};
2464styleExtend.unshift(true,{classes:{tooltip:'qtip-'+(arguments[0].name||'defaults')}},jQuery.fn.qtip.styles.defaults);
2465finalStyle=jQuery.extend.apply(jQuery,styleExtend);
2466ieAdjust=(jQuery.browser.msie)?1:0;
2467finalStyle.tip.size.width+=ieAdjust;
2468finalStyle.tip.size.height+=ieAdjust;
2469if(finalStyle.tip.size.width%2>0)finalStyle.tip.size.width+=1;
2470if(finalStyle.tip.size.height%2>0)finalStyle.tip.size.height+=1;
2471if(finalStyle.tip.corner===true)
2472finalStyle.tip.corner=(self.options.position.corner.tooltip==='center')?false:self.options.position.corner.tooltip;
2473return finalStyle;
2474};
2475function calculateTip(corner,width,height)
2476{
2477var tips={
2478bottomRight:[[0,0],[width,height],[width,0]],
2479bottomLeft:[[0,0],[width,0],[0,height]],
2480topRight:[[0,height],[width,0],[width,height]],
2481topLeft:[[0,0],[0,height],[width,height]],
2482topMiddle:[[0,height],[width/2,0],[width,height]],
2483bottomMiddle:[[0,0],[width,0],[width/2,height]],
2484rightMiddle:[[0,0],[width,height/2],[0,height]],
2485leftMiddle:[[width,0],[width,height],[0,height/2]]
2486};
2487tips.leftTop=tips.bottomRight;
2488tips.rightTop=tips.bottomLeft;
2489tips.leftBottom=tips.topRight;
2490tips.rightBottom=tips.topLeft;
2491return tips[corner];
2492};
2493function calculateBorders(radius)
2494{
2495var borders;
2496if(jQuery('<canvas>').get(0).getContext)
2497{
2498borders={
2499topLeft:[radius,radius],topRight:[0,radius],
2500bottomLeft:[radius,0],bottomRight:[0,0]
2501};
2502}
2503else if(jQuery.browser.msie)
2504{
2505borders={
2506topLeft:[-90,90,0],topRight:[-90,90,-radius],
2507bottomLeft:[90,270,0],bottomRight:[90,270,-radius]
2508};
2509};
2510return borders;
2511};
2512function bgiframe()
2513{
2514var self,html,dimensions;
2515self=this;
2516dimensions=self.getDimensions();
2517html='<iframe class="qtip-bgiframe" frameborder="0" tabindex="-1" src="javascript:false" '+
2518'style="display:block; position:absolute; z-index:-1; filter:alpha(opacity=\'0\'); border: 1px solid red; '+
2519'height:'+dimensions.height+'px; width:'+dimensions.width+'px" />';
2520self.elements.bgiframe=self.elements.wrapper.prepend(html).children('.qtip-bgiframe:first');
2521};
2522jQuery(document).ready(function()
2523{
2524jQuery.fn.qtip.cache={
2525screen:{
2526scroll:{left:jQuery(window).scrollLeft(),top:jQuery(window).scrollTop()},
2527width:jQuery(window).width(),
2528height:jQuery(window).height()
2529}
2530};
2531var adjustTimer;
2532jQuery(window).bind('resize scroll',function(event)
2533{
2534clearTimeout(adjustTimer);
2535adjustTimer=setTimeout(function()
2536{
2537if(event.type==='scroll')
2538jQuery.fn.qtip.cache.screen.scroll={left:jQuery(window).scrollLeft(),top:jQuery(window).scrollTop()};
2539else
2540{
2541jQuery.fn.qtip.cache.screen.width=jQuery(window).width();
2542jQuery.fn.qtip.cache.screen.height=jQuery(window).height();
2543};
2544for(i=0;i<jQuery.fn.qtip.interfaces.length;i++)
2545{
2546var api=jQuery.fn.qtip.interfaces[i];
2547if(api.status.rendered===true
2548&&(api.options.position.type!=='static'
2549||api.options.position.adjust.scroll&&event.type==='scroll'
2550||api.options.position.adjust.resize&&event.type==='resize'))
2551{
2552api.updatePosition(event,true);
2553}
2554};
2555}
2556,100);
2557})
2558jQuery(document).bind('mousedown.qtip',function(event)
2559{
2560if(jQuery(event.target).parents('div.qtip').length===0)
2561{
2562jQuery('.qtip[unfocus]').each(function()
2563{
2564var api=jQuery(this).qtip("api");
2565if(jQuery(this).is(':visible')&&!api.status.disabled
2566&&jQuery(event.target).add(api.elements.target).length>1)
2567api.hide(event);
2568})
2569};
2570})
2571});
2572jQuery.fn.qtip.interfaces=[]
2573jQuery.fn.qtip.log={error:function(){return this;}};
2574jQuery.fn.qtip.constants={};
2575jQuery.fn.qtip.defaults={
2576content:{
2577prerender:false,
2578text:false,
2579url:false,
2580data:null,
2581title:{
2582text:false,
2583button:false
2584}
2585},
2586position:{
2587target:false,
2588corner:{
2589target:'bottomRight',
2590tooltip:'topLeft'
2591},
2592adjust:{
2593x:0,y:0,
2594mouse:true,
2595screen:false,
2596scroll:true,
2597resize:true
2598},
2599type:'absolute',
2600container:false
2601},
2602show:{
2603when:{
2604target:false,
2605event:'mouseover'
2606},
2607effect:{
2608type:'fade',
2609length:100
2610},
2611delay:140,
2612solo:false,
2613ready:false
2614},
2615hide:{
2616when:{
2617target:false,
2618event:'mouseout'
2619},
2620effect:{
2621type:'fade',
2622length:100
2623},
2624delay:0,
2625fixed:false
2626},
2627api:{
2628beforeRender:function(){},
2629onRender:function(){},
2630beforePositionUpdate:function(){},
2631onPositionUpdate:function(){},
2632beforeShow:function(){},
2633onShow:function(){},
2634beforeHide:function(){},
2635onHide:function(){},
2636beforeContentUpdate:function(){},
2637onContentUpdate:function(){},
2638beforeContentLoad:function(){},
2639onContentLoad:function(){},
2640beforeTitleUpdate:function(){},
2641onTitleUpdate:function(){},
2642beforeDestroy:function(){},
2643onDestroy:function(){},
2644beforeFocus:function(){},
2645onFocus:function(){}
2646}
2647};
2648jQuery.fn.qtip.styles={
2649defaults:{
2650background:'white',
2651color:'#111',
2652overflow:'hidden',
2653textAlign:'left',
2654width:{
2655min:0,
2656max:250
2657},
2658padding:'5px 9px',
2659border:{
2660width:1,
2661radius:0,
2662color:'#d3d3d3'
2663},
2664tip:{
2665corner:false,
2666color:false,
2667size:{width:13,height:13},
2668opacity:1
2669},
2670title:{
2671background:'#e1e1e1',
2672fontWeight:'bold',
2673padding:'7px 12px'
2674},
2675button:{
2676cursor:'pointer'
2677},
2678classes:{
2679target:'',
2680tip:'qtip-tip',
2681title:'qtip-title',
2682button:'qtip-button',
2683content:'qtip-content',
2684active:'qtip-active'
2685}
2686},
2687cream:{
2688border:{
2689width:3,
2690radius:0,
2691color:'#F9E98E'
2692},
2693title:{
2694background:'#F0DE7D',
2695color:'#A27D35'
2696},
2697background:'#FBF7AA',
2698color:'#A27D35',
2699classes:{tooltip:'qtip-cream'}
2700},
2701light:{
2702border:{
2703width:3,
2704radius:0,
2705color:'#E2E2E2'
2706},
2707title:{
2708background:'#f1f1f1',
2709color:'#454545'
2710},
2711background:'white',
2712color:'#454545',
2713classes:{tooltip:'qtip-light'}
2714},
2715dark:{
2716border:{
2717width:3,
2718radius:0,
2719color:'#303030'
2720},
2721title:{
2722background:'#404040',
2723color:'#f3f3f3'
2724},
2725background:'#505050',
2726color:'#f3f3f3',
2727classes:{tooltip:'qtip-dark'}
2728},
2729red:{
2730border:{
2731width:3,
2732radius:0,
2733color:'#CE6F6F'
2734},
2735title:{
2736background:'#f28279',
2737color:'#9C2F2F'
2738},
2739background:'#F79992',
2740color:'#9C2F2F',
2741classes:{tooltip:'qtip-red'}
2742},
2743green:{
2744border:{
2745width:3,
2746radius:0,
2747color:'#A9DB66'
2748},
2749title:{
2750background:'#b9db8c',
2751color:'#58792E'
2752},
2753background:'#CDE6AC',
2754color:'#58792E',
2755classes:{tooltip:'qtip-green'}
2756},
2757blue:{
2758border:{
2759width:3,
2760radius:0,
2761color:'#ADD9ED'
2762},
2763title:{
2764background:'#D0E9F5',
2765color:'#5E99BD'
2766},
2767background:'#E5F6FE',
2768color:'#4D9FBF',
2769classes:{tooltip:'qtip-blue'}
2770}
2771};
2772})(joms.jQuery);

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.