var rttheme_template_dir = jQuery("meta[name=rttheme_template_dir]").attr('content');
 
//pretty photo
jQuery(document).ready(function(){
        jQuery("a[rel^='prettyPhoto']").prettyPhoto();
});

//cufon fonts
var rttheme_disable_cufon= jQuery("meta[name=rttheme_disable_cufon]").attr('content');
if(rttheme_disable_cufon!='true') {
	   jQuery(document).ready(function(){		
            Cufon.replace('h1,h2,h3,h4,h5,h6, #navigation > li > a, .cufon', {
               hover: true,		  
               textShadow: '1px 1px #fff' 
            });
            
            Cufon.replace('.desc .title', {
               hover: true
            });
	   });
}	 
	 
 
//drop down menu
jQuery(document).ready(function() {
	jQuery("#navigation li").each(function()
	{
         
            jQuery(this).hover(function()
            {
                   
                       jQuery(this).find('ul:first').stop().css({
                             paddingTop:"8px",                              
                             height:"auto",
                             overflow:"hidden",
                             display:"none"
                             }).slideDown(200, function()
                       {
                       jQuery(this).css({
                             height:"auto",
                             overflow:"visible"
                       });
            });
                       
            },
            
            function()
            {	
                 jQuery(this).find('ul:first').stop().slideUp(200, function()
                 {	
                         jQuery(this).css({
                          display:"none",
                          overflow:"hidden"
                          });
                 });
            });	
	});
        
        jQuery("#navigation ul ").css({
            display: "none"}
         ); 
});
 
 
jQuery(document).ready(function() {
jQuery(".j_ttip[title]").tooltip({

   // tweak the position
	position: "top right",
         offset: [0, 0],

   // use the "slide" effect
   effect: 'slide'

// add dynamic plugin with optional configuration for bottom edge
}).dynamic({ bottom: { direction: 'down', bounce: true } });


});


//search field function
jQuery(document).ready(function() {
	var search_text=jQuery(".search_bar .search_text").val();

	jQuery(".search_bar .search_text").focus(function() {
		jQuery(".search_bar .search_text").val('');
	});

	jQuery(".search_bar .search_text").focus(function() {
		jQuery(".search_bar .search_text").val('');
	});
         
 
       
         jQuery(".search_bar form .searchsubmit").css( {opacity:"0"} )
         jQuery(".search_bar")

          .mouseover(function(){
                 jQuery(".search_bar form .searchsubmit").stop().animate(
                         {opacity:"1"}, 
                         {duration:500})
                 })
          .mouseout(function(){
                 jQuery(".search_bar form .searchsubmit").stop().animate(
                         {opacity:"0"}, 
                         {duration:500})
                 })
 

});



//RT Portfolio Effect
jQuery(document).ready(function() {
        
        jQuery(window).load(function() {
                  var portfolio_item=jQuery("a.imgeffect");
                  
                  portfolio_item.each(function(){
                  
                           var img_width = jQuery(this).find('img').width();  
                           var img_height = jQuery(this).find('img').innerHeight();
                           var imageClass = jQuery(this).attr("class");
                           jQuery(this).prepend('<span class="imagemask '+imageClass+'"></span>');
                           
                           var p = jQuery(this).find('img');
                           var position = p.position();
                           var PosTop= parseInt(p.css("margin-top"))+position.top;
                           var PosLeft= parseInt(p.css("margin-left"))+position.left;
			   if (!PosLeft) {PosLeft= position.left};
                           
                           jQuery(this).find('.imagemask').css({top: PosTop});
			   jQuery(this).find('.imagemask').css({left: PosLeft});
                           
                           jQuery('.imagemask', this).css({width:img_width,height:img_height,backgroundPosition:'center center'});
                           
                           if(jQuery.browser.msie){ jQuery('.imagemask', this).css({display:'none'});}
                           
                  });
                  
         });
        
        
         var image_e= jQuery("a.imgeffect");
		
		if(jQuery.browser.msie){//ignore the shadow effect if browser IE
			 
				image_e.mouseover(function(){
					 
				jQuery(this).find('.imagemask').stop().css({
						  display:"block"
						  }); 
					 
				}).mouseout(function(){
					jQuery(this).find('.imagemask').stop().css({
						 display:"none"
						} );
				});
			 
		}else{//real browsers :)
			 image_e.mouseover(function(){
				  
			 jQuery(this).find('.imagemask').stop().animate({
					   display:"block",
					   opacity:1
					   }, 500); 
				  
			 }).mouseout(function(){
				 jQuery(this).find('.imagemask').stop().animate({
					   display:"none",
					   opacity:0
					 }, 400 );
			 });                  
		}

});



 
 
//validate contact form
jQuery(document).ready(function(){

      // show a simple loading indicator
      var loader = jQuery('<img src="images/loading.gif" alt="..." />')
              .appendTo(".loading")
              .hide();
      jQuery().ajaxStart(function() {
              loader.show();
      }).ajaxStop(function() {
              loader.hide();
      }).ajaxError(function(a, b, e) {
              throw e;
      });
      
      jQuery.validator.messages.required = "";
      var v = jQuery("#validate_form").validate({
              submitHandler: function(form) {
                      jQuery(form).ajaxSubmit({
                              target: "#result"
                      });
              }
      });
      
      jQuery("#reset").click(function() {
              v.resetForm();
      });
 });


