// sIFR

if(typeof sIFR == "function"){
	
	
	//if(!(OSName=="Windows" && jQuery.browser.mozilla == true)) {
		
		// Headers
		sIFR.replaceElement(named({sSelector:"body#body-about-us h1", sFlashSrc:"/flash/neosans.swf", sColor:"#00929f", sLinkColor:"#000000", sBgColor:"#ffffff", sHoverColor:"#000000", nPaddingTop:2, nPaddingBottom:2, sFlashVars:"textalign=left&offsetTop=0"}));	
		sIFR.replaceElement(named({sSelector:"body#body-design-comms h1, body#body-learning h1, body#body-blog h1", sFlashSrc:"/flash/neosans.swf", sColor:"#000000", sLinkColor:"#000000", sBgColor:"#ffffff", sHoverColor:"#000000", nPaddingTop:2, nPaddingBottom:2, sFlashVars:"textalign=left&offsetTop=0"}));	
		sIFR.replaceElement(named({sSelector:"body#body-who-we-are h2, body#body-communication-portfolio h2, body#body-learning h2, body#body-contact h2", sFlashSrc:"<?php echo get_option('siteurl'); ?>/flash/neosans.swf", sColor:"#000000", sLinkColor:"#000000", sBgColor:"#ffffff", sHoverColor:"#000000", nPaddingTop:2, nPaddingBottom:2, sFlashVars:"textalign=left&offsetTop=0"}));
		sIFR.replaceElement(named({sSelector:"h3", sFlashSrc:"/flash/neosans.swf", sColor:"#00929f", sLinkColor:"#000000", sBgColor:"#ffffff", sHoverColor:"#000000", nPaddingTop:2, nPaddingBottom:2, sFlashVars:"textalign=left&offsetTop=0"}));
		sIFR.replaceElement(named({sSelector:"#related-links h4", sFlashSrc:"/flash/neosansmed.swf", sColor:"#00929f", sLinkColor:"#000000", sBgColor:"#ffffff", sHoverColor:"#000000", nPaddingTop:2, nPaddingBottom:2, sFlashVars:"textalign=left&offsetTop=0"}));	
		sIFR.replaceElement(named({sSelector:"#project-archive h4", sFlashSrc:"/flash/neosansmed.swf", sColor:"#f78f20", sLinkColor:"#000000", sBgColor:"#ffffff", sHoverColor:"#000000", nPaddingTop:2, nPaddingBottom:2, sFlashVars:"textalign=left&offsetTop=0"}));	
	//}	


		//Breadcrumb
		//sIFR.replaceElement(named({sSelector:"li.bread1", sFlashSrc:"flash/neosansmed.swf", sColor:"#ffffff", sLinkColor:"#ffffff", sBgColor:"#f78f20", sHoverColor:"#ffffff", nPaddingTop:0, nPaddingBottom:1, sFlashVars:"textalign=left&offsetTop=0"}));
		//sIFR.replaceElement(named({sSelector:"li.bread2", sFlashSrc:"flash/neosansmed.swf", sColor:"#ffffff", sLinkColor:"#ffffff", sBgColor:"#f9b062", sHoverColor:"#ffffff", nPaddingTop:0, nPaddingBottom:1, sFlashVars:"textalign=left&offsetTop=0"}));



}



function removeEmptyParas() {  // not working safari not counting p tags as empty
	$("p").each(function () {				  
	  htmlStr = $(this).html();  
	  if (htmlStr == '' || htmlStr == ' ' || htmlStr == '  ' || htmlStr == '&nbsp;'  || htmlStr == '<br/>' || htmlStr == '<br/>\n') {
		  $(this).remove();
	  }	     	
	});
}

function swapH1() {
	// if there's an image swap with h1
	if ( $(".entry img").length > 0 ) {
		$(".entry img").addClass("nudge-up");
		$(".post h1").addClass("nudge-down");	
		$("div#author-date").addClass("author-date");			
	}	
}

function swapH2() {
	// swap with h2
	$(".entry img").addClass("nudge-up");
	$(".post h2").addClass("nudge-down");
}


function moveImages() {
	// move article images to gallery	and hide and remove parent p
	$("div.entry img").each(function (i) {
		if (i == 0) {
		  $(this).parent().remove();
		}			  
		$(this).remove().clone().appendTo("div#gallery-main-image").hide();	
	});		
}


function replaceScrollbars() {
	$('.scroll-pane').jScrollPane();
	$('.scroll-pane').css("visibility","visible");		
	$('.jScrollPaneContainer').css("visibility","visible");
}

function setupGallery() {
	
	/*$("div.entry").find("img").addClass('gallery-main-image');*/
	$("div#gallery-main-image img").each(function (i) {
	n=i+1;
	$("span#link-"+n).html("<a href='#'>"+n+"</a>");
	$(this).addClass("image-"+n);
	});
	
	// show first
	$("div#gallery-main-image img.image-1").show();
	
	// set up clicks
	$("div#gallery-link span a").each(function (i) {
		$(this).click(function () {
			n=i+1;  	
			$("div#gallery-main-image img").each(function () {
				$(this).hide();
				$("div#gallery-main-image img.image-"+n).show();			
			});
			$("div#content-right p").each(function () {
				$(this).hide();
				$("div#content-right p#extra-info-"+n).show();			
			});								
		});
	});
}




$(document).ready(function() {	
						   
	//check platform and browser
	if ((jQuery.browser.safari == true && jQuery.browser.version.substr(0,3)=="419") || (jQuery.browser.msie == true && jQuery.browser.version.substr(0,3)<"6.0")) { 
    	window.location.href="http://www.strudel.co.uk/wp-content/themes/strudel/browsers.html";
	} 	
	
						   
	if (jQuery.browser.safari == true) { // fix safari padding on breadcrumb
		$('li.bread1 a, li.bread2 a').css("paddingTop",1);	
	}
	
	if (OSName=="MacOS" && jQuery.browser.mozilla == true) { // fix mozilla(mac) padding on breadcrumb
		$('li.bread1 a, li.bread2 a').css("paddingTop",2);	
	}	
	
	$("ul#news li a").each(function (i) {
		listItem = $(this).text();
		if(listItem.length >= 42) {
			listItem = listItem.substring(0, 42);
			$(this).text(listItem+"...");
		}

	});	
	
	// ticker						   
	var options = {
	newsList: "#news",
	startDelay: 10
	}
	$().newsTicker(options);
	$("#news").css({ display:"inline"});
		
	
});


	