//(function(A){if(typeof jQuery.fn.niceTitles=="function"){return }jQuery.fn.niceTitles=function(C){var D=A(this);var B=A.extend({includeCSS:true,includeURL:true,cleanUpMailtos:true,delay:1,},C);if(B.includeCSS&&D.size()){A("head").append(A(jQuery("<style type=\"text/css\">div.nicetitles-tooltip { position: absolute; bottom: 102%; left: -10px; padding: 2px 4px; background: #c2c2c2; -moz-border-radius: 6px; -webkit-border-radius: 6px; border-radius: 6px; text-align: left; text-shadow: #fff 0px 1px 1px; color: #393939; font: normal normal 11px/13px 'Lucida Grande', 'Segoe UI', 'Tahoma', 'Helvetica', 'Arial', clean, sans-serif; z-index: 2; } div.nicetitles-tooltip span { display: block; white-space: nowrap; } div.nicetitles-tooltip span.nicetitles-name { font-weight: bold; } div.nicetitles-tooltip span.nicetitles-url { margin-bottom: 1px; }</style>")))}D.each(function(){var E=A(this);var H=E.attr("title");if(H!=""){E.removeAttr("title");E.attr({oldTitle:H});if(E.css("position")=="static"){E.css({position:"relative"})}var F=A(jQuery('<div class="nicetitles-tooltip"></div>'));F.append(A(jQuery('<span class="nicetitles-name">'+H+"</span>")));if(B.includeURL&&E.is("[href]")){F.append(A(jQuery('<span class="nicetitles-url">'+(B.cleanUpMailtos?E.attr("href").replace(/^mailto:/i,"Email: "):E.attr("href"))+"</span>")))}F.hide().appendTo(E);var G=false;E.hover(function(){G=true;setTimeout(function(){if(G){F.fadeIn("fast")}},(B.delay*1000))},function(){G=false;F.fadeOut("fast")});F.hover(function(){G=false;F.fadeOut("fast")},function(){});E.click(function(){F.fadeOut("fast")})}});return D}})(jQuery);

/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
/**
 * @author Alexander Farkas
 */

/*
(function($) {
	$.extend($.fx.step,{
	    backgroundPosition: function(fx) {
            if (fx.state == 0 && typeof fx.end == 'string') {
                var start = $.curCSS(fx.elem,'backgroundPosition');
                start = toArray(start);
                fx.start = [start[0],start[2]];
                var end = toArray(fx.end);
                fx.end = [end[0],end[2]];
                fx.unit = [end[1],end[3]];
			}
            var nowPosX = [];
            nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
            nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];           
            fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];
            
           function toArray(strg){
               strg = strg.replace(/left|top/g,'0px');
               strg = strg.replace(/right|bottom/g,'100%');
               strg = strg.replace(/(\d+)(\s|\)|$)/g,"$1px$2");
               var res = strg.match(/(\d+)(px|\%|em|pt)\s(\d+)(px|\%|em|pt)/);
               return [parseFloat(res[1]),res[2],parseFloat(res[3]),res[4]];
           }
        }
	});
    
})(jQuery);

*/




////////////////////////////////////////////////////////// MAIN OPTIONS LIVE HELP //////////////////////////////////////////////////////////////
//	the showhelp function used on most pages. nothing to do with sifr, just a convenient location to put this code

/*
function showHelp(txt,onoff,defaultmsg)
{
var txtsplit = txt.split("^");

if (onoff==1)
{
	document.getElementById('helpPtext').innerHTML=txtsplit[1];
	document.getElementById('helpPtitle').innerHTML=txtsplit[0];
	document.getElementById('helpPicon').innerHTML='<img src="/assets/images/' + txtsplit[2] + '">'
}
else
{
	 document.getElementById('helpPtext').innerHTML='This is the Live Help area. Simply place your mouse over any icon for a detailed description of what it does.';
	document.getElementById('helpPtitle').innerHTML='Live Help';
	document.getElementById('helpPicon').innerHTML='<img src="/assets/images/info_livehelp.gif">' 
}
}
*/

//--------------------------------------------------------------------------------------------------//

$(document).ready(function() {
	
	var images = ['TW_All_GettingBigger.jpg', 'TW_All_KeepGrowing.jpg', 'TW_All_TimeToExpand.jpg'];
	$('#Footer_Upgrade').css({'background-image': 'url(/assets/modules/ui-framework/upgrade/images/' + images[Math.floor(Math.random() * images.length)] + ')'}).children('.UserFeedMessage').wrap('<a href="/dashboard/productoverview.aspx" title="Find out more" target="_self"></a>');
	
	//To enable LiveChat, uncomment this line and upload to the server...
	$('#LiveChatIcon').show();
	
	
	$('a.NonReturn[href="#"]').click(function(){return false;});
	
	//Remove Learning Academy search bar...
	$('#SubmitSearchValue').remove();


	// Fix our Object Expected Error when using old jquery in parts of the system.....
	//$(someObject).filter(function(){ return this.name === "value"; }) 

	//all hover and click logic for buttons
	$(".fg-button:not(.ui-state-disabled)")
	.hover(
		function(){ 
			$(this).addClass("ui-state-hover"); 
		},
		function(){ 
			$(this).removeClass("ui-state-hover"); 
		}
	)
	.mousedown(function(){
			$(this).parents('.fg-buttonset-single:first').find(".fg-button.ui-state-active").removeClass("ui-state-active");
			if( $(this).is('.ui-state-active.fg-button-toggleable, .fg-buttonset-multi .ui-state-active') ){ $(this).removeClass("ui-state-active"); }
			else { $(this).addClass("ui-state-active"); }	
	})
	.mouseup(function(){
		if(! $(this).is('.fg-button-toggleable, .fg-buttonset-single .fg-button,  .fg-buttonset-multi .fg-button') ){
			$(this).removeClass("ui-state-active");
		}
	});
		
	//As part of our new interface, add this span around our buttons - to fix IE's bullshit */
	//$('input.upload-submit-blue').wrap('<span class="button-wrapper"></span>');
	$('.ui-button, .upload-submit-blue, .button-wrapper, .resetButton').mouseover(function(){
		$(this).addClass('hover_over');
	}).mouseout(function(){
		$(this).removeClass('hover_over');
		$(this).removeClass('click_it');
	});

	$('.ui-button, .upload-submit-blue, .button-wrapper, .resetButton').mousedown(function(){
		$(this).addClass('click_it');
	}).mouseup(function(){
		$(this).removeClass('click_it');	
	});
	
	// This fixes our tabs, in case we dont' want to use the ui. tabs script...
	$('li.ui-state-default.ui-corner-top.ui-tabs-selected.ui-state-default').hover(function(){
		$(this).addClass('ui-state-hover');
	}, function(){
		$(this).removeClass('ui-state-hover');
	});


	
	// Live Help Rollovers - these are broken for anything lower than jQuery 1.3.2
	/*
	var livehelp = $('div#info').html();
    $('div.icon, div.iconpro').mouseover(function(){
        var tooltip = $(this).attr('alt');
		$('div#info').html(tooltip);  
		$(this).addClass('hoverIcon');		
    }).mouseout(function(){
        $('div#info').html(livehelp);
		$(this).removeClass('hoverIcon');
    });
	*/
	// End of Live Help Rollovers

	// Our Fade Toggle...
	jQuery.fn.fadeToggle = function(speed, easing, callback) {
	   return this.animate({opacity: 'toggle'}, speed, easing, callback);
	};

	
	// Open and close the tabs
	var $tab = $('div.tabCont');
	var $tabShopOptions = $('div.tabCont.ShopOptions');
	var $tabEditShop = $('div.tabCont.EditShop');
	
		// Change Design Options
		$('div.topNav li.bgColor').click(function(){
				if ($(this).hasClass('tOn')){}
				else {$tab.hide();$('div.bgColor').fadeIn(300);$('input.backgroundlibrary').hide();$('input.colorandimage').show();}
		});
		
		$('div.topNav li.tMenus').click(function(){
				if ($(this).hasClass('tOn')){}
				else {$tab.hide();$('div.tMenus').fadeIn(300);}
		});
		
		$('div.topNav li.tThemes').click(function(){
				if ($(this).hasClass('tOn')){}
				else {$tab.hide();$('div.tThemes').fadeIn(300);}
		});
		
		// Bottom Shop Options
		$('div.topNav li.Shop_Layout').click(function(){
				if ($(this).hasClass('tOn')){}
				else {$tabShopOptions.hide();$('div.Shop_Layout').fadeIn(300);}
		});
		
		$('div.topNav li.Shop_Arrange').click(function(){
				if ($(this).hasClass('tOn')){}
				else {$tabShopOptions.hide();$('div.Shop_Arrange').fadeIn(300);}
		});
	
		// Express Checkout Options
		$('div.topNav li.Shop_ExpressCheckout').click(function(){
				if ($(this).hasClass('tOn')){}
				
				else {$tabEditShop.hide();$('div.Shop_ExpressCheckout').fadeIn(300);}
		});
		
		$('div.topNav li.Shop_IntHandling').click(function(){
				if ($(this).hasClass('tOn')){}
				else {$tabEditShop.hide();$('div.Shop_IntHandling').fadeIn(300);}
		});
		
		$('div.topNav li.Shop_Weight').click(function(){
			    if ($(this).hasClass('tOn')){}
				else {$tabEditShop.hide();$('div.Shop_Weight').fadeIn(300);}
		});
		
		$('div.topNav li.Shop_Exceptions').click(function(){
				if ($(this).hasClass('tOn')){}
				else {$tabEditShop.hide();$('div.Shop_Exceptions').fadeIn(300);}
		});
		
		$('div.topNav li.Shop_PayPalPro').click(function(){
				if ($(this).hasClass('tOn')){}
				else {$tabEditShop.hide();$('div.Shop_PayPalPro').fadeIn(300);}
		});
		
		// Edit Photo Gallery
		$('div.topNav li.Photo_Edit').click(function(){
				if ($(this).hasClass('tOn')){}
				else {$tab.hide();$('div.Photo_Edit').fadeIn(300);}
		});
		
		$('div.topNav li.Photo_Settings').click(function(){
				if ($(this).hasClass('tOn')){}
				else {$tab.hide();$('div.Photo_Settings').fadeIn(300);}
		});
		
		$('div.topNav li.Photo_Type').click(function(){
				if ($(this).hasClass('tOn')){}
				else {$tab.hide();$('div.Photo_Type').fadeIn(300);}
		});
		
		$('div.topNav li.Photo_Arrange').click(function(){
				if ($(this).hasClass('tOn')){}
				else {$tab.hide();$('div.Photo_Arrange').fadeIn(300);}
		});

		// Make Money Tabs
		$('div.topNav li.tAfBanner').click(function(){
				if ($(this).hasClass('tOn')){}
				else {$tab.hide();$('div.AfBanner').fadeIn(300);}
		});
		
		$('div.topNav li.tAfFriend').click(function(){
				if ($(this).hasClass('tOn')){}
				else {$tab.hide();$('div.AfFriend').fadeIn(300);}
		});
		
		$('div.topNav li.tAfBalance').click(function(){
				if ($(this).hasClass('tOn')){}
				else {$tab.hide();$('div.AfBalance').fadeIn(300);}
		});
		
		// Edit Background
		$('div.topNav li.Background_ownBg').click(function(){
				if ($(this).hasClass('tOn')){}
				else {$tab.hide();$('div.Background_ownBg').fadeIn(300);$('input.backgroundlibrary').hide();$('input.colorandimage').show();}
		});
		
		$('div.topNav li.Background_preBg').click(function(){
				if ($(this).hasClass('tOn')){}
				else {
					$tab.hide();$('div.Background_preBg').fadeIn(300);
					$('input.backgroundlibrary').show();
					$('input.colorandimage').hide();
					}
		});
		
		// Image Editor
		$('div.topNav li.Edit_an_Image').click(function(){
				if ($(this).hasClass('tOn')){}
				else {$tab.hide();$('div.Edit_an_Image').fadeIn(300);}
		});
		
		$('div.topNav li.Upload_Image').click(function(){
				if ($(this).hasClass('tOn')){}
				else {$tab.hide();$('div.Upload_Image').fadeIn(300);}
		});
	

	
	

	// Wiz.asp login page 
	var tips = $("div.help-welcome, div.help-account, div.help-password");
	$("a.help-account").click(function(){tips.hide();$("div.help-account").show();});
	$("a.help-password").click(function(){tips.hide();$("div.help-password").show();});
	
	$('a.t-select-wrapper.show').click(function(){
		$('#t-select-wrapper').show();
		$(this).hide();
		$('a.t-select-wrapper.hide').show();
	});

	$('a.t-select-wrapper.hide').click(function(){
		$('#t-select-wrapper').hide();
		$(this).hide();
		$('a.t-select-wrapper.show').show();
	});


	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//													 Payment Center Colour Styles														  //
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	$("table.paymentcenter tr:contains('Approved'), table.paymentcenter tr:contains('Completed')").addClass("pproapproved");
	$("table.paymentcenter tr:contains('Success'), table.paymentcenter tr:contains('Cleared')").addClass("pprosuccess");
	$("table.paymentcenter tr:contains('Canceled'), table.paymentcenter tr:contains('Returned')").addClass("pprocancel");
	$("table.paymentcenter tr:contains('Invalid'), table.paymentcenter tr:contains('Internal'), table.paymentcenter tr:contains('Uncleared')").addClass("pproerror");

	$("div.payment_result:contains('Approved'), div.payment_result:contains('Completed')").addClass("pproapproved");
	$("div.payment_result:contains('Success'), div.payment_result:contains('Cleared')").addClass("pprosuccess");
	$("div.payment_result:contains('Canceled'), div.payment_result:contains('Returned')").addClass("pprocancel");
	
	$("div.payment_result:contains('Invalid'), div.payment_result:contains('Internal'), div.payment_result:contains('Uncleared'), div.payment_result:contains('failed')").addClass("pproerror");
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//													 File Manager Icon and Colour Styles												  //
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	var $allfiles = $('div.filemanager div.file');
	$('div.filemanager div.file div.caption span.filesize').hide();
	$('div.showfileoptions div.fileoption').hide();

	var $allfilebtabs = $('li.imagestab a.imagestab, li.imagestab span.imagestab, li.videostab a.videostab, li.videostab span.videostab, li.audiostab a.audiostab, li.audiostab span.audiostab, li.htmlstab a.htmlstab, li.htmlstab span.htmlstab, li.otherstab a.otherstab, li.otherstab span.otherstab');
	var $imagestab = $('li.imagestab a.imagestab, li.imagestab span.imagestab');
	var $videostab = $('li.videostab a.videostab, li.videostab span.videostab');
	var $audiostab = $('li.audiostab a.audiostab, li.audiostab span.audiostab');
	var $htmlstab = $('li.htmlstab a.htmlstab, li.htmlstab span.htmlstab');
	var $otherstab = $('li.otherstab a.otherstab, li.otherstab span.otherstab');
	
	var $allfiletabs = $('div.fileoption');

	$imagestab.addClass('current'); // Show the first tab
	$('li.imagestab').show();
	$('div.fileoption.showimageoptions').fadeIn(300);

	$('li.imagestab').click(function(){
		$allfilebtabs.removeClass('current');
		$imagestab.addClass('current');
		$allfiletabs.hide();
		$('div.fileoption.showimageoptions').fadeIn(300);
	});
	$('li.videostab').click(function(){
		$allfilebtabs.removeClass('current');
		$videostab.addClass('current');
		$allfiletabs.hide();
		$('div.fileoption.showvideooptions').fadeIn(300);
	});
	$('li.audiostab').click(function(){
		$allfilebtabs.removeClass('current');
		$audiostab.addClass('current');
		$allfiletabs.hide();
		$('div.fileoption.showaudiooptions').fadeIn(300);
	});
	$('li.htmlstab').click(function(){
		$allfilebtabs.removeClass('current');
		$htmlstab.addClass('current');
		$allfiletabs.hide();
		$('div.fileoption.showhtmloptions').fadeIn(300);
	});
	$('li.otherstab').click(function(){
		$allfilebtabs.removeClass('current');
		$otherstab.addClass('current');
		$allfiletabs.hide();
		$('div.fileoption.showotheroptions').fadeIn(300);
	});
	

	// Just a small DOM fix for the save page... 

	/*
	if ($('div#app_wrap').hasClass('saveitnow'))
	{$('div#app_wrap').next().css({marginLeft: '-10px'});}
	
	*/
	

	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


	// Header and other pages 
	$('div.headercontainer, h3.headercontainer').hover(function() {
		$(this).addClass("hover");
			}, function() {
		$(this).removeClass("hover");
	});



	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//													 Stationery Creator																	  //
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
	$("div.stat-tab > div").hide();

	$(function () {
    var tabContainers = $('div.stat-tabs > div');
    
    $('div.stat-tabs ul.tabNavigation a').click(function () {
        tabContainers.hide().filter(this.hash).show();
        
        $('div.stat-tabs ul.tabNavigation a').removeClass('selected');
        $(this).addClass('selected');
        
        return false;
    }).filter(':first').click();
	});

*/

	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////




	



	
	
	
	
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	$('div.onlineshopoptions').hover(function() {
		$(this).addClass("hover");
			}, function() {
		$(this).removeClass("hover");
	});

	$('span.prodet').hover(function() {
		$(this).addClass("hover");
			}, function() {
		$(this).removeClass("hover");
	});
	
	/*
	$('fieldset').hover(function() {
		$(this).addClass("yellow");
			}, function() {
		$(this).removeClass("yellow");
	});
	*/


	$('a.show-api').click(function(){
		$('div.api').slideToggle();
	});

	$('a.show-latlong').click(function(){
		$('div.latlong').slideToggle();
	});

	$('a.show-pinpoint').click(function(){
		$('div.pinpoint').slideToggle();
	});

	$('a.show-maptitle').click(function(){
		$('div.maptitle').slideToggle();
	});
	
	$('a.show-gmtutorial').click(function(){
		$('div.gmtutorial').fadeToggle();
	});



				// Product Pages - Beginner, Standard Pro  read more's 
				
	$("span.gallery_what.slideshow").click(function(){
		$('div.gallery_help.slideshow').slideToggle(400);
	});

	$("span.gallery_what.flash").click(function(){
		$('div.gallery_help.flash').slideToggle(400);
	});

	
	var $news = $('a.newsnext, a.newsprev');
	var $newsdiv = $('div.news.one, div.news.two');
	 
	$('a.newsnext').click(function(){
		$newsdiv.hide();
		$('div.news.two').show();
		$news.removeClass('selected');
		$(this).addClass('selected');
	});
	
	$('a.newsprev').click(function(){
		$newsdiv.hide();
		$('div.news.one').show();
		$news.removeClass('selected');
		$(this).addClass('selected');
	});

	//$('select.styleit').selectbox();

	

	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//													 Edit Content Language Drop-down box												  //
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	
	
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	$('div.progressDiv.nonhighlight').css('opacity', '0.5');

	
	$('div.activationCodeWrapInner input.activationCode').hover(function() {
		$(this).css("borderColor", "#adc3db");
			}, function() {
		$(this).css("borderColor", "#bdd1e7");
	});

	$('.popup_a').click(function(){$('.divpopup_a').toggle();});
	$('.popup_b').click(function(){$('.divpopup_b').toggle();});

	$('div.clickhelp').hover(function() {
		$(this).css("background-position", "0 -25px");
			}, function() {
		$(this).css("background-position", "0 0");
	});
	
	$('span.btn_finish').mousedown(function(){
		$(this).css({backgroundPosition: '0 -100px'});									
	});
	$('span.btn_finish').mouseup(function(){
		$(this).css({backgroundPosition: '0 -50px'});									
	});
	
	/*
	$('div.ImageDragBox div.ImageCont').mouseover(function(){
		$(this).parent().children('div.ImageDragBoxPopup').show();
	});
	$('div.ImageDragBox div.ImageCont').mouseout(function(){
		
		$(this).parent().children('div.ImageDragBoxPopup').hide();									
	
	});
	*/

	
	
	// Set up the rounded box
		//$('div.texthelp').wrap('<div class="popuphelpinner"><div class="popuphelpinner_i"></div></div>');
	// Set up the bottom corner
		//$('div.popuphelp').append('<div class="popuphelp_b"></div>');
		//$('div.popuphelpinner_i').prepend('<span class="popuptitle">Mr Site Help</span>');

		
		// Shop and Gallery click event
		//$('span.HintLabel').empty().append('Click to <strong>Edit</strong> this Item');

		/*
		$('div.ImageDragBox').click(function(){
			if ($(this).next().is(":hidden")){
				$(this).next().show();
					// Our IE8 Hack, to get the expanding height
					$(this).parent().parent().parent().css({height: 'auto', display: 'block', position: 'relative'});
					$(this).parent().parent().parent().parent().css({height: 'auto', display: 'block', position: 'relative'});
				// Append Help
				//$(this).children('span.HintLabel').empty().append('Click to <strong>Hide</strong> this Item').css('background-position','0 -16px');
			}
			else{
				$(this).next().hide();
					// Our IE8 Hack, to get the expanding height
					$(this).parent().parent().parent().css({height: 'auto', display: 'block', position: 'relative'});
					$(this).parent().parent().parent().parent().css({height: 'auto', display: 'block', position: 'relative'});
				// Append Help
				//$(this).children('span.HintLabel').empty().append('Click to <strong>Edit</strong> this Item').css('background-position','0 0px');
			}
		});
		*/

		/*
		// Show All Items in Gallery
		$('span.ShowAllItems').click(function(){
			$('div.ImageDragBox').next().show();
			$('span.HintLabel').empty().append('Click to <strong>Hide</strong> this Item').css('background-position','0 -16px');
		});
		
		// Hide All Items in Gallery
		$('span.HideAllItems').click(function(){
			$('div.ImageDragBox').next().hide();
			$('span.HintLabel').empty().append('Click to <strong>Edit</strong> this Item').css('background-position','0 0px');
		});
		*/
				
		// Standard Gallery Item Hover function
		$('div.ImageDragBox').hover(function() {
			$(this).css("background-color", "#eeeeee");
				}, function() {
			$(this).css("background-color", "#f9f9f9");
		});

		// FORM BUILDER HELP SHOW / HIDE
		$('label.show_tutorial_help').click(function(){
			$('div.formbuilder_tutorial_help').fadeToggle(200);
			$(this).parent().parent().parent().parent().css({height: 'auto', display: 'block', position: 'relative'});
		});

			

// End of functions


	// System Tabatha goodness
	$('div.topNav.setone li').click(function(){
		$('div.topNav.setone li, div.topNav.setone li span').removeClass('tOn');
		$(this).addClass('tOn');
	});

	// System Tabatha goodness
	$('div.topNav.settwo li').click(function(){
		$('div.topNav.settwo li, div.topNav.settwo li span').removeClass('tOn');
		$(this).addClass('tOn');
	});
	
	/* Style our Default Tables */
	$('table tr:even, div#contactForm_List table tr:even').addClass('even');
	$('table tr:odd, div#contactForm_List table tr:odd').addClass('odd');

	$('input.tablecheckbox:checked').parent().parent().addClass('highlightrow');
	
	$('input.tablecheckbox').click(function(){
		if ($(this).is(':checked')) $(this).parent().parent().addClass('highlightrow');
		else $(this).parent().parent().removeClass('highlightrow');
	});
	
	// Various Checkboxes --- clean this up later on...
	/*
	var $chkdel = $('input#checkbox_delete_it');
	var $snf = $('input.saveandfinish');
	
	if ($chkdel.val() == null)
		{$snf.val('Upload Logo');}
	else {$snf.val('Delete Logo');}
	
	$chkdel.click(function(){
		if ($chkdel.val() == null)
			{$snf.val('Upload Logo');}
		else {$snf.val('Delete Logo');}
	});
	*/



	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//													 Stationery Creator																	  //
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	
	$("div.stat-tab > div.packofstats").hide();
	

	$(function () {
    var tabContainers = $('div.stat-tabs > div.packofstats');
    
    $('div.stat-tabs ul.tabNavigation a').click(function () {
        tabContainers.hide().filter(this.hash).show();
        
        $('div.stat-tabs ul.tabNavigation a').removeClass('selected');
        $(this).addClass('selected');
        
        return false;
    }).filter(':first').click();
	});

	
	
	// Close our dialog with the 'CLOSE' word... hmmmm
	$('span.close-dialog').click(function(){
		$(this).parent().parent().fadeOut(300);
	});
	// When they hover over the close function...
	$('span.close-dialog').hover(function() {
		$(this).css({textDecoration: 'underline', color: 'tomato'});
			}, function() {
		$(this).css({textDecoration: 'none', color: '#686868'});
	});
	// When they hover over the close function...
	$('span.editdialog').hover(function() {
		$(this).css({backgroundPosition: '0px -25px'});
			}, function() {
		$(this).css({backgroundPosition: '0px 0px'});
	});
	// When they hover over the handle...
	$('span.dialog-title').hover(function() {
		$(this).css({color: '#000000'});
			}, function() {
		$(this).css({color: '#686868'});
	});
	




	//all hover and click logic for buttons
		$(".fg-button:not(.ui-state-disabled)")
		.hover(
			function(){ 
				$(this).addClass("ui-state-hover"); 
			},
			function(){ 
				$(this).removeClass("ui-state-hover"); 
			}
		)
		.mousedown(function(){
				$(this).parents('.fg-buttonset-single:first').find(".fg-button.ui-state-active").removeClass("ui-state-active");
				if( $(this).is('.ui-state-active.fg-button-toggleable, .fg-buttonset-multi .ui-state-active') ){ $(this).removeClass("ui-state-active"); }
				else { $(this).addClass("ui-state-active"); }	
		})
		.mouseup(function(){
			if(! $(this).is('.fg-button-toggleable, .fg-buttonset-single .fg-button,  .fg-buttonset-multi .fg-button') ){
				$(this).removeClass("ui-state-active");
			}
		});
		
		$('span.CallVideo')
		.hover(
			function(){ 
				$(this).addClass("ui-video-hover"); 
			},
			function(){ 
				$(this).removeClass("ui-video-hover").removeClass("ui-video-active");
			}
		)
		.mousedown(function(){
				$(this).removeClass("ui-video-hover").addClass("ui-video-active"); 
		})
		.mouseup(function(){
				$(this).removeClass("ui-video-active"); 
		});
		
		function CallVideoPopup(this_rel, this_videoTag, this_Preview, this_title){
			$('body').append('<div id="VideoDialog"></div>');
			var container = $('#VideoDialog');
			$('#VideoDialog').dialog({
				modal: true, 
				width: 660,
				height:610,
				title: this_title,
				buttons: { 
					"Close tutorial": function() 
						{
							$(this).dialog("close");
						}
				},
				open: function(){
					container.html('<object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="640" height="520"><param name="movie" value="/assets/modules/' + this_rel + '/video/' + this_videoTag + '" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="flashvars" value="file=/assets/modules/' + this_rel + '/video/' + this_videoTag + '&image=preview.jpg" /><embed type="application/x-shockwave-flash" id="player2" name="player2" src="/assets/modules/' + this_rel + '/video/player.swf" width="640" height="520" allowscriptaccess="always" allowfullscreen="true" flashvars="file=/assets/modules/' + this_rel + '/video/' + this_videoTag + '&image=/assets/modules/' + this_rel + '/video/' + this_Preview + '"/></object>');
				},
				close: function(event, ui) {
					$('#VideoDialog').unbind('mousemove');
					$(this).dialog('destroy');
				}
			});
		}
		$('span.CallVideo').click(function(){
			CallVideoPopup($(this).attr('rel'), $(this).attr('videoTag'), $(this).attr('Preview'), $(this).attr('Vidtitle'));
		});

		

		
});

$(window).load(function() {
	CuteEditor_OnChange = function(editor) {
	    var content = editor.getHTML();
	    if(content.search('bookingtool/images/placeholder.gif') == -1) {
	    	if(content.search('bookingtool') != -1) {
	        	content = content.replace(/<!--\[bookingtool\]-->[\x00-\x7E]+<!--\[endbookingtool\]-->/gim, "");
	        	editor.setHTML(content);
	    	}
	    }
	}
});


