/*
 * put jQuery into noconflict mode
 * if conflicts with other Javascript libaries, e.g. Prototype on GoDaddy PreviewDNS
 */
	//jQuery.noConflict();
		
/*
 * Console logger
 *  %s	String
 *  %d, %i	Integer (numeric formatting is not yet supported)
 *  %f	Floating point number (numeric formatting is not yet supported)
 *  %o	Object hyperlink
 * 
 *  only logs if globalVars.log = true
 */

	$.log = function() {
	  	if(window.console) {
			if($.browser.safari){
				// Safari console
				var args = "";
				$.each(arguments,function(i,val){
					args += " " + val;
				});
				window.console.log(args); // fix to show args, Safari doesn't like .apply
			}
			if ($.browser.mozilla) {
				// Firefox with firebug
				window.console.log.apply(this, arguments);
			}
	  	} else {
	  		// no Firebug
	    	//alert(message);
		}
	};
	

/* 
 *  fix IE6 link background image flicker bug
 */
		
	try {  document.execCommand("BackgroundImageCache", false, true); } catch(err) {} 


/* 
 * jQuery actions when DOM is loaded
 */ 

$(document).ready(function(){

	/* tag external links */
	$("body").externalLinks(
		{
		     cssClass: "external",
			 target: "_blank",
		     gaPrefix: "/LINK/",
		     gaTracking: true
		}
	);

	/* uncloack email addresses */
	$("body").emailUncloak({
		at:"--@--"
	});

	/* hide email address when receives focus */
	$("#email-alerts .email").focus(function(){
		if ($(this).val() == "Email address...") {
			$(this).val("");
		}
	});

// confirm when click on link or button
		$(".action-confirm-first").click(function(){
			if(confirm("Are you sure?")){
				return true;
			} else {
				return false;
			}
		})

/*
 *  PNG fixer for IE6
 *  requires jquery_pngfix.js to be loaded before this script
 *	, use inline IMG width and height	
 */
	
	 $("img[src$=png]").pngFix();

/*
 *  
 */



/*
 * manipulate content
 */	
 
	// move sidebar div to top of content (from bottom)
	$(".content .sidebar").prependTo(".content");
	
	// insert floating logo			
	$(".branding").after("<div id='logo-floating'><img src='images/logo-transparent.png' alt='Comstock Place Adult Family Care Home' /></div>");
	
	// insert header slideshow images	
	$("#header-rotator").append("<img src='images/header/1.jpg' alt='Comstock Place Adult Family Care Home' />")
	
/*
 *  Innerfade slideshows
 *  docs: http://medienfreunde.com/deutsch/weblog/aus_der_praxis.html?nid=162
 *  in CSS set the following to prevent images from showing while page loads:
 * 	 #container img { display: none; }
 */ 
 
		/*
		$(".slideshow").innerfade({
		    animationtype: 'fade',
		    speed: 1500,
		    timeout: 6000,
		    type: 'sequence',
		    containerheight: '200px'
	    });
	    */



});