jQuery(document).ready(function($){$.fn.prettyPhoto=function(settings){var isSet=false;var setCount=0;var setPosition=0;var arrayPosition=0;var hasTitle=false;var caller=0;var doresize=true;var imagesArray=[];$(window).scroll(function(){_centerPicture()});$(window).resize(function(){_centerPicture();_resizeOverlay()});$(document).keyup(function(e){switch(e.keyCode){case 37:if(setPosition==1){return}changePicture("previous");break;case 39:if(setPosition==setCount){return}changePicture("next");break;case 27:close();break}});settings=jQuery.extend({animationSpeed:"normal",padding:40,opacity:0.35,showTitle:true,allowresize:true,counter_separator_label:"/"},settings);$(this).each(function(){imagesArray[imagesArray.length]=this;$(this).bind("click",function(){open(this);return false})});function open(el){caller=$(el);theRel=$(caller).attr("rel");galleryRegExp=/\[(?:.*)\]/;theGallery=galleryRegExp.exec(theRel);contentType="image";if($(caller).attr("href").indexOf(".swf")>0){hasTitle=false;contentType="flash"}isSet=false;setCount=0;for(i=0;i<imagesArray.length;i++){if($(imagesArray[i]).attr("rel").indexOf(theGallery)!=-1){setCount++;if(setCount>1){isSet=true}if($(imagesArray[i]).attr("href")==$(el).attr("href")){setPosition=setCount;arrayPosition=i}}}_buildOverlay(isSet);$("div.pictureHolder p.currentTextHolder").text(setPosition+settings.counter_separator_label+setCount);_centerPicture();$("div.pictureHolder #fullResImageContainer").hide();$(".loaderIcon").show();(contentType=="image")?_preload():_writeFlash()}showimage=function(width,height,containerWidth,containerHeight,contentHeight,contentWidth,resized){$(".loaderIcon").hide();var scrollPos=_getScroll();if($.browser.opera){windowHeight=window.innerHeight;windowWidth=window.innerWidth}else{windowHeight=$(window).height();windowWidth=$(window).width()}$("div.pictureHolder .content").animate({height:contentHeight,width:containerWidth},settings.animationSpeed);projectedTop=scrollPos.scrollTop+((windowHeight/2)-(containerHeight/2));if(projectedTop<0){projectedTop=0+$("div.prettyPhotoTitle").height()}$("div.pictureHolder").animate({top:projectedTop,left:((windowWidth/2)-(containerWidth/2)),width:containerWidth},settings.animationSpeed,function(){$("#fullResImage").attr({width:width,height:height});$("div.pictureHolder").width(containerWidth);$("div.pictureHolder .hoverContainer").height(height).width(width);_shownav();$("div.pictureHolder #fullResImageContainer").fadeIn(settings.animationSpeed);if(resized){$("a.expand,a.contract").fadeIn(settings.animationSpeed)}})};function changePicture(direction){if(direction=="previous"){arrayPosition--;setPosition--}else{arrayPosition++;setPosition++}if(!doresize){doresize=true}$("div.pictureHolder .hoverContainer,div.pictureHolder .details").fadeOut(settings.animationSpeed);$("div.pictureHolder #fullResImageContainer").fadeOut(settings.animationSpeed,function(){$(".loaderIcon").show();_preload()});_hideTitle();$("a.expand,a.contract").fadeOut(settings.animationSpeed,function(){$(this).removeClass("contract").addClass("expand")})}function close(){$("div.pictureHolder,div.prettyPhotoTitle").fadeOut(settings.animationSpeed,function(){$("div.prettyPhotoOverlay").fadeOut(settings.animationSpeed,function(){$("div.prettyPhotoOverlay,div.pictureHolder,div.prettyPhotoTitle").remove();if($.browser.msie&&$.browser.version==6){$("select").css("visibility","visible")}})})}function _checkPosition(){if(setPosition==setCount){$("div.pictureHolder a.next").css("visibility","hidden");$("div.pictureHolder a.arrow_next").addClass("disabled").unbind("click")}else{$("div.pictureHolder a.next").css("visibility","visible");$("div.pictureHolder a.arrow_next.disabled").removeClass("disabled").bind("click",function(){changePicture("next");return false})}if(setPosition==1){$("div.pictureHolder a.previous").css("visibility","hidden");$("div.pictureHolder a.arrow_previous").addClass("disabled").unbind("click")}else{$("div.pictureHolder a.previous").css("visibility","visible");$("div.pictureHolder a.arrow_previous.disabled").removeClass("disabled").bind("click",function(){changePicture("previous");return false})}$("div.pictureHolder p.currentTextHolder").text(setPosition+settings.counter_separator_label+setCount);(isSet)?$c=$(imagesArray[arrayPosition]):$c=$(caller);if($c.attr("title")){$("div.pictureHolder .description").show().html(unescape($c.attr("title")))}else{$("div.pictureHolder .description").hide().text("")}if($c.find("img").attr("alt")&&settings.showTitle){hasTitle=true;$("div.prettyPhotoTitle .prettyPhotoTitleContent").html(unescape($c.find("img").attr("alt")))}else{hasTitle=false}}function _fitToViewport(width,height){hasBeenResized=false;$("div.pictureHolder .details").width(width);$("div.pictureHolder .details p.description").width(width-parseFloat($("div.pictureHolder a.close").css("width")));contentHeight=height+parseFloat($("div.pictureHolder .details").height())+parseFloat($("div.pictureHolder .details").css("margin-top"))+parseFloat($("div.pictureHolder .details").css("margin-bottom"));contentWidth=width;containerHeight=height+parseFloat($("div.prettyPhotoTitle").height())+parseFloat($("div.pictureHolder .top").height())+parseFloat($("div.pictureHolder .bottom").height());containerWidth=width+settings.padding;imageWidth=width;imageHeight=height;if($.browser.opera){windowHeight=window.innerHeight;windowWidth=window.innerWidth}else{windowHeight=$(window).height();windowWidth=$(window).width()}if(((containerWidth>windowWidth)||(containerHeight>windowHeight))&&doresize&&settings.allowresize){hasBeenResized=true;if((containerWidth>windowWidth)&&(containerHeight>windowHeight)){var xscale=(containerWidth+200)/windowWidth;var yscale=(containerHeight+200)/windowHeight}else{var xscale=windowWidth/containerWidth;var yscale=windowHeight/containerHeight}if(yscale>xscale){imageWidth=Math.round(width*(1/yscale));imageHeight=Math.round(height*(1/yscale))}else{imageWidth=Math.round(width*(1/xscale));imageHeight=Math.round(height*(1/xscale))}contentHeight=imageHeight+parseFloat($("div.pictureHolder .details").height())+parseFloat($("div.pictureHolder .details").css("margin-top"))+parseFloat($("div.pictureHolder .details").css("margin-bottom"));contentWidth=imageWidth;containerHeight=imageHeight+parseFloat($("div.prettyPhotoTitle").height())+parseFloat($("div.pictureHolder .top").height())+parseFloat($("div.pictureHolder .bottom").height());containerWidth=imageWidth+settings.padding;$("div.pictureHolder .details").width(contentWidth);$("div.pictureHolder .details p.description").width(contentWidth-parseFloat($("div.pictureHolder a.close").css("width")))}return{width:imageWidth,height:imageHeight,containerHeight:containerHeight,containerWidth:containerWidth,contentHeight:contentHeight,contentWidth:contentWidth,resized:hasBeenResized}}function _centerPicture(){if($("div.pictureHolder").size()>0){var scrollPos=_getScroll();if($.browser.opera){windowHeight=window.innerHeight;windowWidth=window.innerWidth}else{windowHeight=$(window).height();windowWidth=$(window).width()}if(doresize){projectedTop=(windowHeight/2)+scrollPos.scrollTop-($("div.pictureHolder").height()/2);if(projectedTop<0){projectedTop=0+$("div.prettyPhotoTitle").height()}$("div.pictureHolder").css({top:projectedTop,left:(windowWidth/2)+scrollPos.scrollLeft-($("div.pictureHolder").width()/2)});$("div.prettyPhotoTitle").css({top:$("div.pictureHolder").offset().top-$("div.prettyPhotoTitle").height(),left:$("div.pictureHolder").offset().left+(settings.padding/2)})}}}function _shownav(){if(isSet){$("div.pictureHolder .hoverContainer").fadeIn(settings.animationSpeed)}$("div.pictureHolder .details").fadeIn(settings.animationSpeed);_showTitle()}function _showTitle(){if(settings.showTitle&&hasTitle){$("div.prettyPhotoTitle").css({top:$("div.pictureHolder").offset().top,left:$("div.pictureHolder").offset().left+(settings.padding/2),display:"block"});$("div.prettyPhotoTitle div.prettyPhotoTitleContent").css("width","auto");if($("div.prettyPhotoTitle").width()>$("div.pictureHolder").width()){$("div.prettyPhotoTitle div.prettyPhotoTitleContent").css("width",$("div.pictureHolder").width()-(settings.padding*2))}else{$("div.prettyPhotoTitle div.prettyPhotoTitleContent").css("width","")}$("div.prettyPhotoTitle").animate({top:($("div.pictureHolder").offset().top-22)},settings.animationSpeed)}}function _hideTitle(){$("div.prettyPhotoTitle").animate({top:($("div.pictureHolder").offset().top)},settings.animationSpeed,function(){$(this).css("display","none")})}function _preload(){_checkPosition();imgPreloader=new Image();nextImage=new Image();if(isSet){nextImage.src=$(imagesArray[arrayPosition+1]).attr("href")}prevImage=new Image();if(isSet&&imagesArray[arrayPosition-1]){prevImage.src=$(imagesArray[arrayPosition-1]).attr("href")}$("div.pictureHolder .content").css("overflow","hidden");if(isSet){$("div.pictureHolder #fullResImage").attr("src",$(imagesArray[arrayPosition]).attr("href"))}else{$("div.pictureHolder #fullResImage").attr("src",$(caller).attr("href"))}imgPreloader.onload=function(){var correctSizes=_fitToViewport(imgPreloader.width,imgPreloader.height);imgPreloader.width=correctSizes.width;imgPreloader.height=correctSizes.height;setTimeout("showimage(imgPreloader.width,imgPreloader.height,"+correctSizes.containerWidth+","+correctSizes.containerHeight+","+correctSizes.contentHeight+","+correctSizes.contentWidth+","+correctSizes.resized+")",500)};(isSet)?imgPreloader.src=$(imagesArray[arrayPosition]).attr("href"):imgPreloader.src=$(caller).attr("href")}function _getScroll(){scrollTop=window.pageYOffset||document.documentElement.scrollTop||0;scrollLeft=window.pageXOffset||document.documentElement.scrollLeft||0;return{scrollTop:scrollTop,scrollLeft:scrollLeft}}function _resizeOverlay(){$("div.prettyPhotoOverlay").css({height:$(document).height(),width:$(window).width()})}function _writeFlash(){flashParams=$(caller).attr("rel").split(";");$(flashParams).each(function(i){if(flashParams[i].indexOf("width")>=0){flashWidth=flashParams[i].substring(flashParams[i].indexOf("width")+6,flashParams[i].length)}if(flashParams[i].indexOf("height")>=0){flashHeight=flashParams[i].substring(flashParams[i].indexOf("height")+7,flashParams[i].length)}if(flashParams[i].indexOf("flashvars")>=0){flashVars=flashParams[i].substring(flashParams[i].indexOf("flashvars")+10,flashParams[i].length)}});$(".pictureHolder #fullResImageContainer").append('<embed width="'+flashWidth+'" height="'+flashHeight+'" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" wmode="opaque" name="prettyFlash" flashvars="'+flashVars+'" allowscriptaccess="always" bgcolor="#FFFFFF" quality="high" src="'+$(caller).attr("href")+'"/>');$("#fullResImage").hide();contentHeight=parseFloat(flashHeight)+parseFloat($("div.pictureHolder .details").height())+parseFloat($("div.pictureHolder .details").css("margin-top"))+parseFloat($("div.pictureHolder .details").css("margin-bottom"));contentWidth=parseFloat(flashWidth)+parseFloat($("div.pictureHolder .details").width())+parseFloat($("div.pictureHolder .details").css("margin-left"))+parseFloat($("div.pictureHolder .details").css("margin-right"));containerHeight=contentHeight+parseFloat($("div.pictureHolder .top").height())+parseFloat($("div.pictureHolder .bottom").height());containerWidth=parseFloat(flashWidth)+parseFloat($("div.pictureHolder .content").css("padding-left"))+parseFloat($("div.pictureHolder .content").css("padding-right"))+settings.padding;setTimeout("showimage("+flashWidth+","+flashHeight+","+containerWidth+","+containerHeight+","+contentHeight+","+contentWidth+")",500)}function _buildOverlay(){backgroundDiv="<div class='prettyPhotoOverlay'></div>";$("body").append(backgroundDiv);$("div.prettyPhotoOverlay").css("height",$(document).height()).bind("click",function(){close()});pictureHolder='<div class="pictureHolder"><div class="top"><div class="left"></div><div class="middle"></div><div class="right"></div></div><div class="content"><a href="#" class="expand" title="Expand the image">Expand</a><div class="loaderIcon"></div><div class="hoverContainer"><a class="next" href="#">next</a><a class="previous" href="#">previous</a></div><div id="fullResImageContainer"><img id="fullResImage" src="" /></div><div class="details clearfix"><a class="close" href="#">Close</a><p class="description"></p><div class="nav"><a href="#" class="arrow_previous">Previous</a><p class="currentTextHolder">0'+settings.counter_separator_label+'0</p><a href="#" class="arrow_next">Next</a></div></div></div><div class="bottom"><div class="left"></div><div class="middle"></div><div class="right"></div></div></div>';titleHolder='<div class="prettyPhotoTitle"><div class="prettyPhotoTitleLeft"></div><div class="prettyPhotoTitleContent"></div><div class="prettyPhotoTitleRight"></div></div>';$("body").append(pictureHolder).append(titleHolder);$(".pictureHolder,.titleHolder").css({opacity:0});$("a.close").bind("click",function(){close();return false});$("a.expand").bind("click",function(){if($(this).hasClass("expand")){$(this).removeClass("expand").addClass("contract");doresize=false}else{$(this).removeClass("contract").addClass("expand");doresize=true}_hideTitle();$("div.pictureHolder .hoverContainer,div.pictureHolder #fullResImageContainer").fadeOut(settings.animationSpeed);$("div.pictureHolder .details").fadeOut(settings.animationSpeed,function(){_preload()});return false});$(".pictureHolder .previous,.pictureHolder .arrow_previous").bind("click",function(){changePicture("previous");return false});$(".pictureHolder .next,.pictureHolder .arrow_next").bind("click",function(){changePicture("next");return false});$(".hoverContainer").css({"margin-left":settings.padding/2});if(!isSet){$(".hoverContainer,.nav").hide()}if($.browser.msie&&$.browser.version==6){$("select").css("visibility","hidden")}$("div.prettyPhotoOverlay").css("opacity",0).fadeTo(settings.animationSpeed,settings.opacity,function(){$("div.pictureHolder").css("opacity",0).fadeIn(settings.animationSpeed,function(){$("div.pictureHolder").attr("style","left:"+$("div.pictureHolder").css("left")+";top:"+$("div.pictureHolder").css("top")+";")})})}}});
            
jQuery(document).ready(function($){(function($){$.fn.ctRotatorSidebar=function(dataSource,options){options=$.extend({showCount:5,speed:8000,fadeInSpeed:750,fadeOutSpeed:250,fadeEffect:true,useTooltip:false,shuffle:false,itemRenderer:function(item){if(item.url==null){return'<li  class="ctrotator-item"><img src="http://rafimaging.com/wp-content/themes/raf/images/'+item.img+'" /></li>'}else{return'<li  class="ctrotator-item"><img src="http://rafimaging.com/wp-content/themes/raf/images/'+item.img+'" /></li>'}},tooltipOptions:{}},options);if(options.showCount<1){throw ("options.showCount must be greater than 0")}return this.each(function(){$(this).empty();doRotating(dataSource,this,options)})};function doRotating(dataSource,container,options){var rotator=new ctRotatorList(dataSource,options.shuffle);var showCount=options.showCount;for(var i=0;i<showCount;i++){insertItem(rotator.gotoNext(),container,options)}updateRotation(rotator,container,options)}function updateRotation(rotator,container,options){var item=rotator.gotoNext();var newLi=insertItem(item,container,options);if(options.fadeEffect){newLi.hide();var inSpeed=options.fadeInSpeed;var outSpeed=options.fadeOutSpeed;$(container).children(":last").fadeOut(outSpeed,function(){$(this).remove();newLi.fadeIn(inSpeed,function(){setTimeout(function(){updateRotation(rotator,container,options)},options.speed)})})}else{$(container).children(":last").remove();setTimeout(function(){updateRotation(rotator,container,options)},options.speed)}}function insertItem(item,container,options){var rendered=options.itemRenderer(item);var newLi=$(rendered);if(newLi.size()==0){newLi=$("<li></li>").append(rendered)}$(container).prepend(newLi);if(options.useTooltip){newLi.tooltip($.extend({fade:50,delay:800,opacity:1,bodyHandler:function(){return item.tip}},options.tooltipOptions))}return newLi}function ctRotatorList(list,shuffle){this.cursor=0;this.list=list;this.shuffle=shuffle==null?false:shuffle;if(this.shuffle){this.list=this.shuffleArray(this.list)}}ctRotatorList.prototype={gotoNext:function(){if(this.cursor>=this.getCount()-1){this.cursor=0}else{this.cursor++}return this.list[this.cursor]},getCount:function(){return this.list.length},shuffleArray:function(o){for(var j,x,i=o.length;i;j=parseInt(Math.random()*i),x=o[--i],o[i]=o[j],o[j]=x){}return o}}})(jQuery)});

jQuery(document).ready(function($) {var dataSource1=[{title:"sidebar-image1",img:"sidebar-image1.jpg"},{title:"sidebar-image2",img:"sidebar-image2.jpg"},{title:"sidebar-image3",img:"sidebar-image3.jpg"},{title:"sidebar-image4",img:"sidebar-image4.jpg"}];jQuery(document).ready(function($){$(document).ready(function(){$("#rotating-image").ctRotatorSidebar(dataSource1,{shuffle:true,fadeEffect:true,fadeInSpeed:500,fadeOutSpeed:500,speed:7000,showCount:1})})});});

jQuery(document).ready(function($){(function($){jQuery.fn.faq=function(tog){return this.each(function(){var dl=$(this).addClass("");var dt=$("dt",dl).css("cursor","pointer").addClass("faqClosed").click(function(e){$(this).toggleClass("faqClosed").toggleClass("faqOpen");var sc=false;dt.each(function(){if($(this).hasClass("faqClosed")){sc=true}});if(!sc){$(".faqShow").text("Hide All").toggleClass("faqShow").toggleClass("faqHide")}else{$(".faqHide").text("Show All").toggleClass("faqShow").toggleClass("faqHide")}$(this).next().slideToggle()});var dd=$("dd",dl).hide().append('<a href="#faqtop" class="faqToTop"><!-- BACK TO TOP --></a>');$('<a href="#"><span>Show All</span></a>').addClass("faqShow").click(function(){if($(this).hasClass("faqShow")){$(".faqShow").text("Hide All").toggleClass("faqShow").toggleClass("faqHide");dt.filter("[class=faqClosed]").each(function(){$(this).toggleClass("faqClosed").toggleClass("faqOpen");$(this).next().slideToggle()})}else{$(".faqHide").text("Show All").toggleClass("faqShow").toggleClass("faqHide");dt.filter("[class=faqOpen]").each(function(){$(this).toggleClass("faqClosed").toggleClass("faqOpen");$(this).next().slideToggle()})}return false}).prependTo(dl).clone(true).appendTo(dl);$('<a id="faqtop" style="display:none;"></a>').prependTo(dl);if(typeof tog=="number"){$("dt:eq("+tog+")").trigger("click")}})}})(jQuery)});

jQuery(document).ready(function($) {
    $(function(){
        $('#faq1').faq();
    });

    $('a.external').click(function(){
        window.open( $(this).attr('href') );
        return false;
    });
});
