var count='';	var position=5; var move=0; banner=0;   var img_move = 0; var img_pos = 0;
$(document).ready(function(){
	if($('#content-text').height() > $('.left-side').height())
	{	
		$('.left-side').height($('#content-text').height()+2);
	}
	
	$('#content-text').height($('.left-side').height()-2);
	
	$('#tab_form .email').focus(function(){ if($(this).val()== 'Your Email') { $(this).val(''); } });
	$('#tab_form .email').blur(function(){ if($(this).val()== '') {$(this).val('Your Email');} });
	
	$('#tab_form').validate();
	$('form.contact').validate();
	
	$('img.sld').click(function(){  scrolItem(this) });

		/************* For the main navigation **************/
		$("#tabsI li").hover( function() { $(this).addClass("sfHover"); }, function() { $(this).removeClass("sfHover"); });

		/************* For the left side content **************/
		$("ul.lft_side li").hover( function() { $(this).addClass("sfHover"); }, function() { $(this).removeClass("sfHover"); });

		/************* For the Tabbers content **************/
		$(".tab_container a").click(function()
		{ 
			var no = $(".tab_container a").index(this);
			$('.tabber_content, .tab_container a').removeClass('active');
			$('.tabber_content:eq('+no+'), .tab_container a:eq('+no+')').addClass('active');
		});
		
	MM_CheckFlashVersion('8,0,0,0','Content on this page requires a newer version of Adobe Flash Player. Do you want to download it now?');
	
	/******************* For the Photo gallery **************************/
	
	$('.main img').attr('src', $('.thumb').children('img:eq(0)').attr('src'))
	$('.img_thumb').click(function(){ 
		
		$('.thumb').removeClass('active');  $(this).parent('.thumb').addClass('active');
		$('.main img').hide();
		$('.main img').attr('src', $(this).attr('src'));
		$('.main img').fadeIn('slow');
	});
	
	$('span.move').click(function(){ scrollphoto(this) });

});

$.fn.hoverClass = function(c) {

	return this.each(function(){
	$(this).hover(

	function() { $(this).addClass(c); },
	function() { $(this).removeClass(c); }

		);
	});
}

/******* Photo Gallery Scroll Function ***********/

function scrollphoto(div)
{
			var id; var cnt = $('.thumb').size(); 
			if($(div).hasClass('next'))
			{
				if(cnt > 5 && img_pos < (cnt-5))
				{
					img_move=img_move+84;
					img_pos++;
					$('.photo_scroll').animate( {marginLeft:'-'+String(img_move)+'px'},'slow');
				}
			}else
			{
				if(img_pos > 0  )
				{
					img_move=img_move-84;
					img_pos--; 
					$('.photo_scroll').animate( {marginLeft:'-'+String(img_move)+'px'},'slow');
				}	
				
			}

}

/******* Scroll Function ***********/

function scrolItem(div)
{
			var id; var count = $('.img_block').size();
			if($(div).hasClass('left_move'))
			{
				if(position>5)
				{
					move=move-172;
					position--;
					$('.scroll').animate( {marginLeft:'-'+String(move)+'px'},'slow');
				}
			}else
			{
				if(position<count)
				{
					move=move+172;
					position++; 
					$('.scroll').animate( {marginLeft:'-'+String(move)+'px'},'slow');
				}	
				
			}

}
function MM_CheckFlashVersion(reqVerStr,msg){
  with(navigator){
    var isIE  = (appVersion.indexOf("MSIE") != -1 && userAgent.indexOf("Opera") == -1);
    var isWin = (appVersion.toLowerCase().indexOf("win") != -1);
    if (!isIE || !isWin){  
      var flashVer = -1;
      if (plugins && plugins.length > 0){
        var desc = plugins["Shockwave Flash"] ? plugins["Shockwave Flash"].description : "";
        desc = plugins["Shockwave Flash 2.0"] ? plugins["Shockwave Flash 2.0"].description : desc;
        if (desc == "") flashVer = -1;
        else{
          var descArr = desc.split(" ");
          var tempArrMajor = descArr[2].split(".");
          var verMajor = tempArrMajor[0];
          var tempArrMinor = (descArr[3] != "") ? descArr[3].split("r") : descArr[4].split("r");
          var verMinor = (tempArrMinor[1] > 0) ? tempArrMinor[1] : 0;
          flashVer =  parseFloat(verMajor + "." + verMinor);
        }
      }
      // WebTV has Flash Player 4 or lower -- too low for video
      else if (userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 4.0;

      var verArr = reqVerStr.split(",");
      var reqVer = parseFloat(verArr[0] + "." + verArr[2]);
  
      if (flashVer < reqVer){
        if (confirm(msg))
          window.location = "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
      }
    }
  } 
}


