<!--
// -------------------------------------------------------------------------------------------------------------------------------------------
// js vars

	var currentFloatingDivId = "";
	var TYPE_AJAX = 0;
	var TYPE_IFRAME = 1;
	var TYPE_CONTENT = 2;

	var isIE = document.all;
	var isNN = !document.all && document.getElementById;
	var isIE5 = navigator.userAgent.toLowerCase().indexOf('msie 5') != -1;
	var isIE6 = navigator.userAgent.toLowerCase().indexOf('msie 6') != -1;
	var isIE7 = navigator.userAgent.toLowerCase().indexOf('msie 7') != -1;
	var isIE8 = navigator.userAgent.toLowerCase().indexOf('msie 8') != -1;
	var ddEnabled = false;
	var whichDog;
	var ddLocked = false;

	var userAgent = navigator.userAgent.toLowerCase();
	jQuery.browser = {
		version: (userAgent.match( /.+(?:rv|it|ra|ie|me)[\/: ]([\d.]+)/ ) || [])[1],
		chrome: /chrome/.test( userAgent ),
		safari: /webkit/.test( userAgent ) && !/chrome/.test( userAgent ),
		opera: /opera/.test( userAgent ),
		msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
		mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
	}

	String.prototype.wordSplit = function() {
		return this.replace(/([^\s-]{52})(?=[^\s-])/g, '$1 ');
	};

	String.prototype.url2anchor = function() {
		// match all URLS
		var regUrl = /((^|[^>\"\/])(https:\/\/|http:\/\/|www\.)(?:[^\"])\S*([\s\)\!]|$))/gi;
		var replacedText = this.replace(regUrl, '<a href="$1" target="_blank">$1</a>');

		// URLs starting with http:// or https://
		//var replacePattern1 = /(\b(https?):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.; ]*[-A-Z0-9+&@#\/%=~_| ])/gim;
		//var replacedText = this.replace(replacePattern1, '<a href="$1" target="_blank">$1</a>');
		// URLs starting with www. (without // before it, or it'd re-link the ones done above)
		//var replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim;
		//var replacedText = replacedText.replace(replacePattern2, '$1<a href="http://$2" target="_blank">$2</a>');
		// now remove spaces in urls
		//var replacePattern3 = / href="(.*) (.*)" /gim;
		//var replacedText = replacedText.replace(replacePattern3, ' href="$1$2" '); 
		return replacedText;
	};






// -------------------------------------------------------------------------------------------------------------------------------------------
// Set a cookie in Javascript

	function setCookie(cname,cvalue) {
		var today = new Date();
		var expire = new Date();
		expire.setTime(today.getTime() + 3600000);
		document.cookie = cname+"="+escape(cvalue)+";expires="+expire.toGMTString();
}

// -------------------------------------------------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------------------------------------------------
// FACE BOOK SCRIPTS

	//$(document).ready( function() { FB.init({ appId:'306058409409669', cookie:true, status:true, xfbml:true }); } );

	function facebook_post_link(fb_message, fb_name, fb_caption, fb_link, fb_description, fb_picture) {
		FB.api('/me/feed', 'post', { type:'link', message:fb_message, name:fb_name, caption:fb_caption, link:fb_link, description:fb_description, picture:fb_picture }, function(response) {
			if (!response || response.error) {
				alert('Error occured');
			} else {
				alert('Response type'+r);
			}
		});
	}


	function facebook_post_audio(fb_url, fb_title, fb_artist, fb_href, fb_description) {
		FB.api('/me/feed', 'post', { type:'mp3', src:fb_url, title:fb_title, artist:fb_artist, href:fb_href, description:fb_description }, function(response) {
			if (!response || response.error) {
				alert('Error occured');
			} else {
				alert('Response type'+r);
			}
		});
	}


// -------------------------------------------------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------------------------------------------------
// LITTLE AJAX FUNCTIONS TO MAKE PAGES SEEM DYNAMIC

	// ----------------------------------------------------------------------------------------
	// public functions

		// autoplay on/off
		function dom_dosound(state) {
			$('#domlayer').hide();
			//dom_timers_pause();
			dom_ajax("/ajax/sound.php?grey="+state, 'domlayer');
		}

		// adult content on/off
		function dom_doadult(state) {
			$('#domlayer').hide();
			//dom_timers_pause();
			dom_ajax("/ajax/adult.php?grey="+state, 'domlayer');
		}

		// remember me (auto login) on/off
		function dom_doremember(state) {
			$('#domlayer').hide();
			//dom_timers_pause();
			dom_ajax("/ajax/remember.php?grey="+state, 'domlayer');
		}

		// change the v2 skin
		function dom_doskinchange(state) {
			$('#domlayer').hide();
			//dom_timers_pause();
			dom_ajax("/ajax/skin.php?new="+state, 'domlayer');
		}

		// change the results listing style
		function dom_doresults(state) {
			$('#domlayer').hide();
			//dom_timers_pause();
			dom_ajax("/ajax/liststyle.php?list="+state, 'domlayer');
		}

		// change the results listing order
		function dom_doresultsorder(state) {
			$('#domlayer').hide();
			//dom_timers_pause();
			dom_ajax("/ajax/listorder.php?list="+state, 'domlayer');
		}

		// change the default currency
		function dom_docurrency(cur) {
			$('#domlayer').hide();
			//dom_timers_pause();
			dom_ajax("/ajax/changecurrency.php?cur="+cur, 'domlayer');
		}

		// old style section toggle
		function dom_togglesection(divid) {
			$('#domlayer').hide();
			//dom_timers_pause();
			dom_ajax("/ajax/mysections.php?list="+divid, 'domlayer');
		}

		// collect radio now playing info
		//function dom_radio_status() {
		//	dom_ajax("/ajax/inner-nowplaying-playlist.php?format=site&target=opener", 'nowplayingdiv');
		//	setTimeout('dom_radio_status()', 6000);
		//}


// -------------------------------------------------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------------------------------------------------
// QUEUED AND NON-CACHED AJAX FUNCTIONS
// proved working in FF3, IE7

	// ----------------------------------------------------------------------------------------
	// private variables

		_dom_v_ajax = function(url, elid, functionname) { this.url = url; this.elid = elid; this.functionname = functionname; }
		_dom_v_ajax_queue = new Array();
		_dom_v_ajax_waiting = false;


	// ----------------------------------------------------------------------------------------
	// public functions

		// add an ajax call to the queue
		function dom_ajax(url, elid, functionname) {
			var t = new Date().getTime();
			if(url.indexOf('?') == -1) url += '?nocache='+t; else url += '&nocache='+t;
			_dom_v_ajax_queue[_dom_v_ajax_queue.length] = new _dom_v_ajax(url, elid, functionname);
			dom_ajax_roll();
		}


	// ----------------------------------------------------------------------------------------
	// private functions

		// if all is well, and we're not waiting for a prior call to finish, run the next ajax in the queue
		function dom_ajax_roll() {
			if(_dom_v_ajax_queue.length > 0 && !_dom_v_ajax_waiting) {
				_dom_v_ajax_waiting = true;
				$.ajax( { url: _dom_v_ajax_queue[0].url, error: function() { dom_ajax_roll_return(''); }, success: function(data) { dom_ajax_roll_return(data); } });
			} else if(_dom_v_ajax_waiting) {
				setTimeout('dom_ajax_roll', 750); // THIS BIT IS NEW AND MIGHT CAUSE PROBS
			}
		}

		// this is where ajax returns
		function dom_ajax_roll_return(data) {
			var fnret = null;
			if(_dom_v_ajax_queue[0].elid != null) $('#'+_dom_v_ajax_queue[0].elid).html(data);
			if(_dom_v_ajax_queue[0].functionname != null) fnret = _dom_v_ajax_queue[0].functionname;
			_dom_v_ajax_queue.shift();
			_dom_v_ajax_waiting = false;
			if(fnret != null) window[fnret](data);
			dom_ajax_roll();
		}






// -------------------------------------------------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------------------------------------------------
// SA INTERNAL SCROLLBAR

	// ----------------------------------------------------------------------------------------
	// private variables

		function _sa_v_scrollbar(p, c, ph, lch) { this.panid = p; this.conid = c; this.panheight = ph; this.lastconheight = lch; }
		var _sa_v_scrollbars = new Array();

	// ----------------------------------------------------------------------------------------
	// public functions

		// checks to see if any of the scrolled panes have had their content changed
		function dom_scrollbar_modified() {
			for(var i = 0; i < _sa_v_scrollbars.length; i++) {
				if(_sa_v_scrollbars[i] != null) {
					if($('#'+_sa_v_scrollbars[i].conid).height() != _sa_v_scrollbars[i].lastconheight) {
						dom_scrollbar_update(i);
						_sa_v_scrollbars[i].lastconheight = $('#'+_sa_v_scrollbars[i].conid).height();
					}
				}
			}
		}


		function dom_scrollbar_update(index) {
			// sort the slide scale and position
			var difference = $('#'+_sa_v_scrollbars[index].conid).height() - _sa_v_scrollbars[index].panheight;
			var proportion = difference / $('#'+_sa_v_scrollbars[index].conid).height();
			var handleHeight = Math.round((1 - proportion) * _sa_v_scrollbars[index].panheight);
			handleHeight -= handleHeight % 2;

			// update the slider css with the new height
			$('#slider-vertical-'+_sa_v_scrollbars[index].panid).css({ 'height' : (_sa_v_scrollbars[index].panheight - handleHeight)+'px' });

		   // update the slider handle css
		   $('#slider-handle-'+_sa_v_scrollbars[index].panid).css({'height' : (handleHeight-2)+'px', 'margin-bottom' : -handleHeight+'px'});
		}


	// ----------------------------------------------------------------------------------------
	// public functions

		// remove a scrollbar
		function dom_scrollbar_remove(panelid) {
			for(var i = 0; i < _sa_v_scrollbars.length; i++) {
				if(_sa_v_scrollbars[i].panid == panelid) {
					_sa_v_scrollbars[i] = null;
				}
			}
		}

		// add a scrollbar
		function dom_scrollbar_add(panelid, contentid, maxheight, scrollbar_rail_border_colour, scrollbar_rail_colour, scrollbar_handle_border_colour, scrollbar_handle_colour) {
			// set all the css for the scrollpane
			$('#'+panelid).css({'float' : 'left', 'overflow' : 'hidden', 'width' : ($('#'+panelid).width() - 20)+'px', 'height' : maxheight+'px', 'position' : 'relative', 'display' : 'inline'});

			// set all the css for the scrollcontent
			$('#'+contentid).css({'position' : 'absolute', 'top' : '0px', 'left' : '0px'});

			// build the slider and make it the same height as the panel
			$('#'+panelid).after('<div id="slider-wrap-'+panelid+'"><div id="slider-vertical-'+panelid+'"></div></div>');
			$('#slider-wrap-'+panelid).height($('#'+panelid).height());

			// skin the slider wrap (the slider rail)
			$('#slider-wrap-'+panelid).css({'border' : 'solid 1px '+scrollbar_rail_border_colour, 'background' : scrollbar_rail_colour, 'float' : 'left', 'width' : '12px'});

			// sort the slide scale and position
			var difference = $('#'+contentid).height() - maxheight;
			if(difference > 0) {
				var proportion = difference / $('#'+contentid).height();
				var handleHeight = Math.round((1 - proportion) * maxheight);
				handleHeight -= handleHeight % 2;
			} else {
				handleHeight = maxheight;
			}

			// skin the slider vertical (we want this invisible)
			$('#slider-vertical-'+panelid).css({'height' : (maxheight-handleHeight)+'px', 'border' : 'none', 'background' : 'transparent'});

			// set up the slider
			$('#slider-vertical-'+panelid).slider({orientation : 'vertical', min : 0, max : 100, value : 100,
				slide: function(event, ui) {
					// find which slider index we've got here
					var index = -1;
					for(var i = 0; i < _sa_v_scrollbars.length; i++) { if(this.id == 'slider-vertical-' + _sa_v_scrollbars[i].panid) { index = i; } }
					if(index != -1) {
						var diff = $('#'+_sa_v_scrollbars[index].conid).height() - _sa_v_scrollbars[index].panheight;
						var topValue = -((100 - ui.value) * diff / 100);
						if(topValue > 0) topValue = 0;
						$('#'+_sa_v_scrollbars[index].conid).css({top:topValue});
					}
				},
				change: function(event, ui) {
					// find which slider index we've got here
					var index = -1;
					for(var i = 0; i < _sa_v_scrollbars.length; i++) { if(this.id == 'slider-vertical-' + _sa_v_scrollbars[i].panid) { index = i; } }
					if(index != -1) {
						var diff = $('#'+_sa_v_scrollbars[index].conid).height() - _sa_v_scrollbars[index].panheight;
						var topValue = -((100 - ui.value) * diff / 100);
						if(topValue > 0) topValue = 0;
						$('#'+_sa_v_scrollbars[index].conid).css({top:topValue});
					}
				}
			});

			// give the slider handle an element id
			$('#slider-wrap-'+panelid).find('a').attr('id', 'slider-handle-'+panelid);

		   // set the handle height and bottom margin so the middle of the handle is in line with the slider
		   $('#slider-handle-'+panelid).css({'height' : (handleHeight-2)+'px', 'margin-bottom' : -handleHeight+'px', 'width' : '8px', 'margin-left' : '5px', 'border' : 'solid 1px '+scrollbar_handle_border_colour, 'background' : scrollbar_handle_colour});

			// clicks on the wrap outside the slider range
			$('#slider-wrap-'+panelid).click(function(event){ 
				var offsetTop = $(this).offset().top;
				var clickValue = (event.pageY - offsetTop) * 100 / $(this).height();
				$('#slider-vertical-'+panelid).slider('value', 100 - clickValue);
			}); 

			// stop any clicks on the slider propagating through to the code below
			$('.ui-slider').click(function(event) { event.stopPropagation(); });

			// add this scrollbar to the scrollbars array
			_sa_v_scrollbars[_sa_v_scrollbars.length] = new _sa_v_scrollbar(panelid, contentid, maxheight, $('#'+contentid).height());

			// add a timer to check if the content has changed
			setTimeout('dom_scrollbar_modified()', 2000);
		}






// -------------------------------------------------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------------------------------------------------
// SA TIMER FUNCTIONS TO ENSURE ONLY ONE TIMEOUT LOOP IS NEEDED AND AJAX CALLS ARE QUEUED
// THIS IS BECAUSE JAVASCRIPT IS SHIT AND SINGLE THREADED, LEAVING TIMEOUTS IN THE HANDS OF THE GODS
//
//
//	// ----------------------------------------------------------------------------------------
//	// private variables
//
//		_dom_v_timer = function(f, d, o) { this.functionname = f; this.delay = d; this.isoneoff = o; this.currentcount = 0; }
//		var _dom_v_timers = new Array();
//		var _dom_v_timers_paused = false;
//
//
//	// ----------------------------------------------------------------------------------------
//	// initialiser
//
//		$(document).ready( function() { dom_timer(); });
//
//
//	// ----------------------------------------------------------------------------------------
//	// private functions
//
//		function dom_timer() {
//			// iterate through the timers
//			for(var _tq = 0; _tq < _dom_v_timers.length; _tq++) {
//				// if this timer isn't null then deal with it
//				if(_dom_v_timers[_tq] != null) {
//					// increment the timer counter
//					if((_dom_v_timers[_tq].currentcount++) >= _dom_v_timers[_tq].delay && !_dom_v_timers_paused) {
//						// run the function
//						window[_dom_v_timers[_tq].functionname]);
//						//eval(_dom_v_timers[_tq].functionname+'()');
//						//window['dom_scrollbar_modified()'];
//						// was this a oneoff?
//						if(_dom_v_timers[_tq].isoneoff) {
//							// clear this timer
//							_dom_v_timers[_tq] = null;
//						} else {
//							// zero the counter
//							_dom_v_timers[_tq].currentcount = 0;
//						}
//					}
//				}
//			}
//			// call this function again - THIS IS THE ONLY USE OF setTimeout ALLOWED!!!!
//			setTimeout('dom_timer()', 1000);
//		}
//
//
//	// ----------------------------------------------------------------------------------------
//	// public functions
//
//		// pause the timers
//		function dom_timers_pause() {}// _dom_v_timers_paused = true; }
//
//		// restart the timers
//		function dom_timers_restart() { _dom_v_timers_paused = false; }
//
//		// add a timer to the queue
//		function dom_timer_add(functionname, delay, oneoff) {
//			if(oneoff != true) oneoff = false;
//			_dom_v_timers[_dom_v_timers.length] = new _dom_v_timer(functionname, delay, oneoff);
//		}
//
//		// remove a timer from the queue
//		function dom_timer_remove(functionname) {
//			if((a = jQuery.inArray(functionname, _dom_v_timers)) !== false) {
//					_dom_v_timers[a] = null;
//			}
//		}
//
//		// clear all timers from the stage
//		function dom_timers_clear() { _dom_v_timers = new Array(); }
//
//
//
//
//
//
// -------------------------------------------------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------------------------------------------------
// PRESENCE BAR FUNCTIONS
//
//	// ----------------------------------------------------------------------------------------
//	// private functions
//
//		// the response
//		function dom_getPresenceResponse(data) { 
//			var parts = data.split('|');
//
//			if(parseInt(parts[0]) == 0) {
//				$('#noticesmailtxt').html('NO NEW MAIL');
//			} else {
//				$('#noticesmailtxt').html('NEW MAIL ('+parts[0]+')');
//			}
//
//			if(parseInt(parts[1]) > -1) {
//				$('#noticesnum').html(parts[1]);
//			} else {
//				$('#noticesnum').html('0');
//			}
//
//			if(parseInt(parts[2]) > -1) {
//				$('#noticesfriendsnum').html(parts[2]);
//			} else {
//				$('#noticesfriendsnum').html('0');
//			}
//
//			if($('#basketitems').length > 0) {
//				if(parts[3] != "" && parts[3]) {
//					$('#basketitems').html(parts[3]);
//				} else {
//					$('#basketitems').html('');
//				}
//			}
//
//			if($('#noticesmoderation').length > 0) {
//				if(parts[4] != "" && parts[4]) {
//					$('#noticesmoderation').html(parts[4]);
//				} else {
//					$('#noticesmoderation').html('');
//				}
//			}
//
//			$('#noticeping').attr('src', '/images/led_out.gif');
//			setTimeout("dom_getPresence()", 10000);
//		}
//
//
//	// ----------------------------------------------------------------------------------------
//  // public functions
//
//		// the initial call to get the presence
//		function dom_getPresence() {
//			$('#noticeping').attr('src', '/images/led_on.gif');
//			dom_ajax('/ajax/notices.php', null, 'dom_getPresenceResponse');
//		}
//
//
//		// open the presence bar pane
		function dom_use_notices_layer(title, url, mode)
		{
			// sort the size and position of the noticeslayer
			if(mode == 'moderation') {
				winheight = 125;
				$('#noticenavbardiv').css( {'right':'182px', 'bottom':'24px', 'width':'300px', 'height':''+winheight+'px'} );
			}
			if(mode == 'friends') {
				winheight = 200;
				$('#noticenavbardiv').css( {'right':'1px', 'bottom':'24px', 'width':'220px', 'height':''+winheight+'px'} );
			}
			if(mode == 'groups') {
				winheight = 125;
				$('#noticenavbardiv').css( {'right':'368px', 'bottom':'24px', 'width':'246px', 'height':''+winheight+'px'} );
			}
			if(mode == 'notices') {
				// get the number of notices
				numnotices = parseInt($('#noticesnum').html());
				if(numnotices == 0) numnotices = 1;
				winheight = 24 + (numnotices * 26);
				if(winheight > 200) winheight = 200;
				$('#noticenavbardiv').css( {'right':'22px', 'bottom':'24px', 'width':'340px', 'height':''+winheight+'px'} );
			}

			// create the title bar + content div
			var content = "";
			content += '<table cellspacing="0" cellpadding="0" border="0" width="100%" id="titleBar" style="background:url(\'/images/dropmenu-background.png\') no-repeat;"><tr><td width="99%" height:18px; style="color:#ffffff;" valign="top"><b>'+title+'</b></td>';
			content += '<td align="right" nowrap="nowrap">';
			if(mode == 'notices')
				content += '<a href="#" onclick="dom_ajax(\''+url+'?g=all\', \'noticeslayerinterior\');return false;" title="Finish with ALL notices"><img src="/images/icon-tickmini.png" border="0" alt="Finish with ALL notices"></a> ';
			content += '<a href="#" onclick="dom_use_notices_layer_close();return false;"><img src="/images/theme-default-dialogue-modal-close.gif" border="0"></a> ';
			content += '</td></tr></table>';
			content += '<div id="noticeslayerinterior" style="width:100%; height:'+(winheight-16)+'px; z-index:30; overflow:auto;"></div>';
			$('#noticenavbardiv').html(content);

			// show the floating div
			$('#noticenavbardiv').show('slide', {direction:'down'}, 'fast');

			// init the ajax for this dialogue
			dom_ajax(url, 'noticeslayerinterior');
		}


		function dom_use_notices_layer_close()
		{
			$('#noticeslayerinterior').html('');
			$('#noticenavbardiv').html('');
			if($('#noticenavbardiv').is(":visible")) $('#noticenavbardiv').hide('slide', {direction:'down'}, 'fast');
		}






// -------------------------------------------------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------------------------------------------------
// the bubble popup system

	var _v_dom_bubble_normal_width = 0;
	var _v_dom_bubble_can_be_full_width = false;


	// close url is the url to show when close is called (SAMP uses this to clear samp session)
	// p3fullwidth allows the toggle between xlarge width(650px) and actual width (1028px) for p3 editors

	function dom_bubble_open(title, url, size, type, content, buttons, closeurl, p3fullwidth)
	{
		if(p3fullwidth != true) p3fullwidth = false;

		if(size == "small") {
			var width = 350; var height = 150;
		} else if(size == "medium") {
			var width = 450; var height = 250;
		} else if(size == "large") {
			var width = 550; var height = 350;
		} else {
			var width = 650; var height = 400;
		}
		_v_dom_bubble_normal_width = width;

		// hide the floating div
		dom_use_notices_layer_close();
		$('#dombubble').hide();
		$('#dommask').show();
		$('#dombubble').html('');

		// set central position
		$('#dombubble').css({'top':'50%', 'left':'50%', 'margin':'-'+((height / 2) + 30)+'px 0 0 -'+(width / 2)+'px', 'width':width+'px', 'height':height+'px'});

		// sort scroll type and change height/width to suit
		if(isIE5 || isIE6) {
			scrolltype = "yes";
		} else {
			scrolltype = "auto";
		}

		// create bubble container
		var container = "";
		container += '<div class="v2-container" style="background:#555555;">';
		container += '<div class="v2-container-title" style="position:relative;">';
		container += '<div class="v2-container-right" id="bubbletitlebuttons" style="position:relative; top:-5px;">';
		if(closeurl == "" || closeurl == null)
			container += '<a href="#" onclick="dom_bubble_close(); return false;"><img src="/images/icon-24-cross.png" border="0" /></a>';
		else
			container += '<a href="#" onclick="dom_bubble_close('+"'"+closeurl+"'"+'); return false;"><img src="/images/icon-24-cross.png" /></a>';
		container += '</div>';
		container += '<span id="bubbletitle">'+title+'</span>';
		container += '</div>';
		
		if(type == TYPE_AJAX && size == "small")
			container += "<div id=\"dialogueinterior\" style=\"width:"+(width-10)+"px; z-index:30; padding:4px;\"></div>";
		if(type == TYPE_AJAX && size != "small")
			container += "<div id=\"dialogueinterior\" style=\"width:"+(width-2)+"px; height:"+height+"px; max-height:"+height+"px; z-index:30; overflow:auto;\"></div>";
		if(type == TYPE_IFRAME)
			container += '<iframe name=\"dialogueinterior\" id=\"dialogueinterior\" style=\"width:'+(width-2)+'px; height:'+height+'px; border:0px; background:#444444;" frameborder="0" framespacing="0" src="'+url+'" scrolling="'+scrolltype+'"></iframe>';
		if(type == TYPE_CONTENT)
			container += "<div class=\"popupsecondary\" style=\"padding:6px;\">"+content+"</div>";

		container += '<div align="right" style="padding:4px;" id="bubblebuttons">';
		if(p3fullwidth) container += '<div style="float:left;"> &nbsp; <a href="#" id="butfullsize" onclick="$(\'#butfullsize\').hide(0);$(\'#butnormsize\').show(0);$(\'#dombubble\').css({\'width\':\'1028px\',\'margin-left\':\'-514px\'});$(\'#dialogueinterior\').css({\'width\':\'1024px\'});return false;" class="v2-big-button">FULL SIZE</a><a href="#" id="butnormsize" style="display:none;" onclick="$(\'#butnormsize\').hide(0);$(\'#butfullsize\').show(0);$(\'#dombubble\').css({\'width\':\''+_v_dom_bubble_normal_width+'px\',\'margin-left\':\'-'+(_v_dom_bubble_normal_width/2)+'px\'});$(\'#dialogueinterior\').css({\'width\':\''+(_v_dom_bubble_normal_width-4)+'px\'});return false;" class="v2-big-button">NORMAL SIZE</a></div>';
		if(buttons.indexOf('cancel')!=-1) container += '<a href="#" onclick="dom_bubble_close();return false;" class="v2-big-button">CANCEL</a> &nbsp;';
		if(buttons.indexOf('ok')!=-1 && !(buttons.indexOf('oksubmit')!=-1)) container += '<a href="#" onclick="dom_bubble_close();return false;" class="v2-big-button">OK</a> &nbsp;';
		if(buttons.indexOf('oksubmit')!=-1) container += '<a href="#" onclick="document.getElementById(\'dialogueinterior\').contentWindow.document.getElementById(\'submit\').click();return false;" class="v2-big-button">OK</a> &nbsp;';
		if(buttons.indexOf('post')!=-1) container += '<a href="#" onclick="document.getElementById(\'dialogueinterior\').contentWindow.document.getElementById(\'submit\').click();return false;" class="v2-big-button">POST</a> &nbsp;';
		if(buttons.indexOf('update')!=-1) container += '<a id="dialoguebutton_update" href="#" onclick="document.getElementById(\'dialogueinterior\').contentWindow.document.getElementById(\'submit\').click();return false;" class="v2-big-button">UPDATE</a> &nbsp;';
		if(buttons.indexOf('upload')!=-1) container += '<a href="#" onclick="document.getElementById(\'dialogueinterior\').contentWindow.document.getElementById(\'submit\').click();return false;" class="v2-big-button">UPLOAD</a> &nbsp;';
		if(buttons.indexOf('close')!=-1) container += '<a href="#" onclick="document.getElementById(\'dialogueinterior\').contentWindow.document.getElementById(\'submit\').click();return false;" class="v2-big-button">UPLOAD</a> &nbsp;';
		if(buttons.indexOf('prev')!=-1) container += '<a href="#" onclick="document.getElementById(\'dialogueinterior\').contentWindow.document.getElementById(\'prev\').click();return false;" class="v2-big-button">PREV</a> &nbsp;';
		if(buttons.indexOf('next')!=-1) container += '<a href="#" onclick="document.getElementById(\'dialogueinterior\').contentWindow.document.getElementById(\'next\').click();return false;" class="v2-big-button">NEXT</a> &nbsp;';
		if(buttons.indexOf('deletefinal')!=-1) container += '<a href="#" onclick="document.getElementById(\'delete\').click();return false;" class="v2-big-button">DELETE</a> &nbsp;';
		container += '</div>';
		container += '</div>';
		
		// fill the floating div with the container content and initial loading screen if required
		$('#dombubble').html(container);
		
		// show the floating div
		$('#dombubble').show('slow');

		// init the ajax for this dialogue
		if(type == TYPE_AJAX) {
			$('#dialogueinterior').html("<p align=\"center\"><img src=\"/images/icon-loading.gif\"></p>");
			dom_ajax(url, 'dialogueinterior');
		}

		// set the dialogue to be draggable
		$('#dombubble').draggable();

		// have to load the iframe after wiping it first, as SAFARI requires it (for all other browsers could put the url in the <iframe> statement).
		//if(type == TYPE_IFRAME)
		//{
		//	document.getElementById('dialogueinterior').contentWindow.document.open();
		//	//document.getElementById('dialogueinterior').contentWindow.document.write("<html><head></head><body><script language=\"javscript\">document.location.href='"+url+"';</script></body></html>");
		//	document.getElementById('dialogueinterior').contentWindow.document.close();
		//	document.getElementById('dialogueinterior').src = url;
		//}
	}

//	var dom_bubble_dragging = false;
//	var dom_bubble_drag_offset_x = 0;
//	var dom_bubble_drag_offset_y = 0;
//
//	function dom_bubble_drag_start(ev)
//	{
//		if(!dom_bubble_dragging) {
//			ev = ev || window.event; 
//			dom_bubble_drag_offset_x = ev.clientX;
//			dom_bubble_drag_offset_y = ev.clientY;
//			dom_bubble_dragging = true;
//		}
//	}
//
//	function dom_bubble_drag(ev)
//	{
//		if(!dom_bubble_dragging) return;
//		ev = ev || window.event; 
//
//		bp = $('#dombubble').offset();
//		bx = bp.left;
//		by = bp.top;
//		
//		bx += (ev.clientX - dom_bubble_drag_offset_x);
//		by += (ev.clientY - dom_bubble_drag_offset_y);
//
//		$('#dombubble').css({'left' : bx+'px', 'top' : by+'px'});
//
//		dom_bubble_drag_offset_x = ev.clientX;
//		dom_bubble_drag_offset_y = ev.clientY;
//	}
//	
//	function dom_bubble_drop()
//	{
//		dom_bubble_drag_offset_x = 0;
//		dom_bubble_drag_offset_y = 0;
//		dom_bubble_dragging = false;
//	}

	function dom_bubble_close(closeurl) {
		var url = '';
		if(closeurl != null && closeurl != '') url = closeurl;

		$('#dommask').hide();
		$('#dombubble').hide('slow', function() {
			if(url == '') {
				$('#dombubble').html('');
			} else {
				$('#dombubble').html('<div id="bubinterior"></div>');
				dom_ajax(url, 'dombubble');
			}
		});
		_v_dom_bubble_can_be_full_width = false;
	}

	function dom_bubble_changebuttons(newbuttons, go_url) {
		var contents = "";
		if(_v_dom_bubble_can_be_full_width) container += '<div style="float:left;"> &nbsp; <a href="#" id="butfullsize" onclick="$(\'#butfullsize\').hide(0);$(\'#butnormsize\').show(0);$(\'#dombubble\').css({\'width\':\'1028px\',\'margin-left\':\'-514px\'});$(\'#dialogueinterior\').css({\'width\':\'1024px\'});return false;" class="v2-big-button">FULL SIZE</a><a href="#" id="butnormsize" style="display:none;" onclick="$(\'#butnormsize\').hide(0);$(\'#butfullsize\').show(0);$(\'#dombubble\').css({\'width\':\''+_v_dom_bubble_normal_width+'px\',\'margin-left\':\'-'+(_v_dom_bubble_normal_width/2)+'px\'});$(\'#dialogueinterior\').css({\'width\':\''+(_v_dom_bubble_normal_width-4)+'px\'});return false;" class="v2-big-button">NORMAL SIZE</a></div>';
		if(newbuttons.indexOf('cancel')!=-1 && newbuttons.indexOf('cancelback')==-1 && newbuttons.indexOf('bottomcancel')==-1) contents += '<a href="#" onclick="dom_bubble_close();return false;" class="v2-big-button">CANCEL</a> &nbsp;';
		if(newbuttons.indexOf('bottomcancel')!=-1) contents += '<a href="#" onclick="document.getElementById(\'dialogueinterior\').contentWindow.history.back();" class="v2-big-button">CANCEL</a> &nbsp;';
		if(newbuttons.indexOf('cancelback')!=-1) contents += '<a href="#" onclick="document.getElementById(\'dialogueinterior\').contentWindow.history.back();" class="v2-big-button">CANCEL</a> &nbsp;';
		if(newbuttons.indexOf('bottomclose')!=-1) contents += '<a href="#" onclick="dom_bubble_close(); return false;" class="v2-big-button">OK</a> &nbsp;';
		if(newbuttons.indexOf('ok')!=-1 && !(newbuttons.indexOf('oksubmit')!=-1) && !(newbuttons.indexOf('okreload')!=-1) && !(newbuttons.indexOf('okgourl')!=-1)) contents += '<a href="#" onclick="dom_bubble_close();return false;" class="v2-big-button">OK</a> &nbsp;';
		if(newbuttons.indexOf('buy')!=-1) contents += '<a href="#" onclick="document.getElementById(\'dialogueinterior\').contentWindow.document.getElementById(\'submit\').click();return false;" class="v2-big-button">ADD TO CART</a> &nbsp;';
		if(newbuttons.indexOf('post')!=-1) contents += '<a href="#" onclick="document.getElementById(\'dialogueinterior\').contentWindow.document.getElementById(\'submit\').click();return false;" class="v2-big-button">POST</a> &nbsp;';
		if(newbuttons.indexOf('delete')!=-1) contents += '<a href="#" onclick="document.getElementById(\'dialogueinterior\').contentWindow.document.getElementById(\'delete\').click();return false;" class="v2-big-button">DELETE</a> &nbsp;';
		if(newbuttons.indexOf('update')!=-1) contents += '<a href="#" onclick="document.getElementById(\'dialogueinterior\').contentWindow.document.getElementById(\'submit\').click();return false;" class="v2-big-button">UPDATE</a> &nbsp;';
		if(newbuttons.indexOf('oksubmit')!=-1) contents += '<a href="#" onclick="document.getElementById(\'dialogueinterior\').contentWindow.document.getElementById(\'submit\').click();return false;" class="v2-big-button">OK</a> &nbsp;';
		if(newbuttons.indexOf('okreload')!=-1) contents += '<a href="#" onclick="top.document.location.reload();return false;" class="v2-big-button">OK</a> &nbsp;';
		if(newbuttons.indexOf('okgourl')!=-1) contents += '<a href="'+go_url+'" class="v2-big-button">OK</a> &nbsp;';
		if(newbuttons.indexOf('upload')!=-1) contents += '<a href="#" onclick="document.getElementById(\'dialogueinterior\').contentWindow.document.getElementById(\'submit\').click();return false;" class="v2-big-button">UPLOAD</a> &nbsp;';
		if(newbuttons.indexOf('prev')!=-1) contents += '<a href="#" onclick="document.getElementById(\'dialogueinterior\').contentWindow.document.getElementById(\'prev\').click();return false;" class="v2-big-button">PREVIOUS</a> &nbsp;';
		if(newbuttons.indexOf('next')!=-1) contents += '<a href="#" onclick="document.getElementById(\'dialogueinterior\').contentWindow.document.getElementById(\'next\').click();return false;" class="v2-big-button">NEXT</a> &nbsp;';
		if(newbuttons.indexOf('deletefinal')!=-1) contents += '<a href="#" onclick="document.getElementById(\'dialogueinterior\').contentWindow.document.getElementById(\'delete\').click();return false;" class="v2-big-button">DELETE</a> &nbsp;';
		$('#bubblebuttons').html(contents);
	}

	function dom_bubble_changetitlebuttons(newbuttons) { }

	function dom_bubble_changetitle(newtitle) { $('#bubbletitle').text(newtitle); }

	function dom_bubble_showloading(initialtext) {
		var content = "";
		content  = '<div align="center" style="padding:6px; font-family:verdana,arial,helvetica; font-size:9pt; font-weight:bold; color:#000000;" id="bubbleloadingtext">'+initialtext+'</div><br />';
		content += '<div align="center"><img src="/images/progress_bar.gif"></div>';
		$('#dombubbleloading').html(content);
		$('#dombubbleloading').show('slow');
		$('#dombubble').css('z-index', '0');
	}

	function dom_bubble_hideloading() {
		$('#dombubbleloading').hide('slow');
		$('#dombubble').css('z-index', '30');
	}

	function dom_bubble_confirm(title, text, okfunction, cancelfunction, framename) {
		// sort the functions
		if(!okfunction || okfunction == null || okfunction == '' || okfunction == 'undefined') okfunction = '';
		if(!cancelfunction || cancelfunction == null || cancelfunction == '' || cancelfunction == 'undefined') cancelfunction = '';
		if(!framename || framename == '' || framename == null || framename == 'undefined') {
			if(okfunction != '') okfunction += '();';
			if(cancelfunction != '') cancelfunction += '();';
		} else {
//			if(okfunction != '') okfunction = 'var $f = $(\'#'+framename+'\'); var fd = $f[0].document || $f[0].contentWindow.document; fd.'+okfunction+'();';
			if(okfunction != '') okfunction = 'dialogueinterior.'+okfunction+';';
			if(cancelfunction != '') cancelfunction = 'var $f = $(\'#'+framename+'\'); var fd = $f[0].document || $f[0].contentWindow.document; fd.'+cancelfunction+'();';
		}

		// size of the alert
		var width = 350;
		var height = 150;

		// hide the floating div
		$('#dombubblealert').hide();
		$('#dommask2').show();
		$('#dombubblealert').html('');

		// set central position
		$('#dombubblealert').css({'top':'50%', 'left':'50%', 'margin':'-'+(height / 2)+'px 0 0 -'+(width / 2)+'px', 'width':width+'px', 'height':height+'px'});

		// create bubble container
		var container = "";
		container += '<div class="v2-container" style="background:#555555;">';
		container += '<div class="v2-container-title" style="position:relative;">';
		container += '<span id="bubbletitle">'+title+'</span>';
		container += '</div>';
		container += "<div class=\"popupsecondary\" id=\"dombubblealertinterior\" style=\"padding:6px; color:#dddddd;\">"+text+"</div>";
		container += '<div align="right" style="padding:4px;" id="bubblebuttons">';
		container += '<a href="#" onclick="dom_bubble_alert_close();'+cancelfunction+'return false;" class="v2-button">Cancel</a> &nbsp;';
		container += '<a href="#" onclick="'+okfunction+'dom_bubble_alert_close();return false;" class="v2-button"> OK </a> &nbsp;';
		container += '</div>';
		container += '</div>';

		// fill the floating div with the container content and initial loading screen if required
		$('#dombubblealert').html(container);
		
		// show the floating div
		$('#dombubblealert').show('slow');
	}
	

	function dom_bubble_alert(title, text) {
		// size of the alert
		var width = 350;
		var height = 150;

		// hide the floating div
		$('#dombubblealert').hide();
		$('#dommask2').show();
		$('#dombubblealert').html('');

		// set central position
		$('#dombubblealert').css({'top':'50%', 'left':'50%', 'margin':'-'+(height / 2)+'px 0 0 -'+(width / 2)+'px', 'width':width+'px', 'height':height+'px'});

		// create bubble container
		var container = "";
		container += '<div class="v2-container" style="background:#555555;">';
		container += '<div class="v2-container-title" style="position:relative;">';
		container += '<div class="v2-container-right" id="bubbletitlebuttons" style="position:relative; top:-5px;">';
		container += '<a href="#" onclick="dom_bubble_alert_close(); return false;"><img src="/images/icon-24-cross.png" border="0" /></a>';
		container += '</div>';
		container += '<span id="bubbletitle">'+title+'</span>';
		container += '</div>';
		container += "<div class=\"popupsecondary\" id=\"dombubblealertinterior\" style=\"padding:6px; color:#dddddd;\">"+text+"</div>";
		container += '<div align="right" style="padding:4px;" id="bubblebuttons">';
		container += '<a href="#" onclick="dom_bubble_alert_close();return false;" class="v2-button">OK</a> &nbsp;';
		container += '</div>';
		container += '</div>';

		// fill the floating div with the container content and initial loading screen if required
		$('#dombubblealert').html(container);
		
		// show the floating div
		$('#dombubblealert').show('slow');
	}

	function dom_bubble_alert_close() {
		$('#dommask2').hide();
		$('#dombubblealert').hide('slow', function() { });
	}


// -------------------------------------------------------------------------------------------------------------------------------------------
//-->
