//home page slider

var rttheme_effect_options = jQuery("meta[name=rttheme_effect_options]").attr('content');
var rttheme_slider_time_out = jQuery("meta[name=rttheme_slider_time_out]").attr('content');
var rttheme_slider_numbers = jQuery("meta[name=rttheme_slider_numbers]").attr('content');
var rttheme_template_dir = jQuery("meta[name=rttheme_template_dir]").attr('content');
        
var showEffect;
jQuery.each(jQuery.browser, function(i) {
         if(jQuery.browser.msie){
              showEffect = 'false';
         }
});

jQuery(document).ready(function(){

	function onBefore() {
		if (showEffect!="false"){
			jQuery('.desc').stop().animate({opacity:0},0);
		}else{
				
		}
	} 
	function onAfter() {
		if (showEffect!="false"){
			jQuery('.desc').stop().animate({opacity:1},400);
		}else{
				
		}			
	}
	
});


 
//validate contact form
jQuery(document).ready(function(){

      // show a simple loading indicator

      
         var loader = jQuery('<img src="'+rttheme_template_dir+'/images/loading.gif" alt="loading..." />')
         
              .appendTo(".loading")
              .hide();
      jQuery().ajaxStart(function() {
              loader.show();
      }).ajaxStop(function() {
              loader.hide();
      }).ajaxError(function(a, b, e) {
              throw e;
      });
      

 });


function getInternetExplorerVersion()
// Returns the version of Windows Internet Explorer or a -1
// (indicating the use of another browser).
{
   var rv = -1; // Return value assumes failure.
   if (navigator.appName == 'Microsoft Internet Explorer')
   {
      var ua = navigator.userAgent;
      var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
      if (re.exec(ua) != null)
         rv = parseFloat( RegExp.$1 );
   }
   return rv;
}
function checkIEVersion()
{
   var ver = getInternetExplorerVersion();
   if ( ver> -1 )
   {
      if ( ver>= 8.0 )
         msg = "You're using Windows Internet Explorer 8.";
      else if ( ver == 7.0 )
    	  msg = "You're using Windows Internet Explorer 7.";
      else if ( ver == 6.0 )
    	  msg = "You're using Windows Internet Explorer 6.";
      else
    	  msg = "You should upgrade your copy of Windows Internet Explorer";
    }
   alert( msg );
}

if ( getInternetExplorerVersion() == -1  ) {
//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,.title,.title a,.subtitle, .subtitle a, .banner, a.banner_button', {hover: true});
         });
}	
}
 

//preloading 
jQuery(function () {
	//jQuery('.preload').hide();//hide all the images on the page
	jQuery('.play,.magnifier').css({opacity:0});
	jQuery('.preload').css({opacity:0});
	jQuery('.preload').addClass("animated");
	jQuery('.play,.magnifier').addClass("animated_icon");
});


var i = 0;//initialize
var cint=0;//Internet Explorer Fix
jQuery(window).bind("load", function() {//The load event will only fire if the entire page or document is fully loaded
	var cint = setInterval("PreImage(i)",70);//500 is the fade in speed in milliseconds
});

function PreImage() {
	var images = jQuery('.preload').length;//count the number of images on the page
	if (i >= images) {// Loop the images
		clearInterval(cint);//When it reaches the last image the loop ends
	}
	//jQuery('.preload:hidden').eq(i).fadeIn(500);//fades in the hidden images one by one
	jQuery('.animated_icon').eq(0).animate({opacity:1},{"duration": 500});
	jQuery('.animated').eq(0).animate({opacity:1},{"duration": 500});
	jQuery('.animated').eq(0).removeClass("animated");
	jQuery('.animated_icon').eq(0).removeClass("animated_icon");
	i++;//add 1 to the count
}

//image effects 
jQuery(document).ready(function(){
         var image_e= jQuery(".image.portf, .image.product_image");
         image_e.mouseover(function(){jQuery(this).stop().animate({ opacity:0.7
                         }, 400);
         }).mouseout(function(){
                 image_e.stop().animate({ 
                         opacity:1
                         }, 400 );
         });
});



