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";
      }
    }
  } 
}

function showTab(tab)
{
	if($(tab).hasClass('active')){}else{
	$('.tab').removeClass('active');
	$('.tab-content').hide();
	$(tab).addClass('active');
	var no = $('.tab').index(tab);
	$('.tab-content:eq('+no+')').fadeIn();
	$('.tab-content:eq('+no+')').children('.item-list-container').animate( {marginLeft:'0px'},'fast');
	position=5;
	move=0;
	}
}

function scrolItem(div)
{
	var id;
	count=$('.tab-content:visible').children('.item-list-container').children('.item').size();
	if($(div).hasClass('left-move'))
	{
		if(position>5)
		{
			move=move-114;
			position--;
			$('.tab-content:visible').children('.item-list-container').animate( {marginLeft:'-'+String(move)+'px'},'slow');
		}
	}else
	{
		if(position<count)
		{
			move=move+114;
			position++; 
			$('.tab-content:visible').children('.item-list-container').animate( {marginLeft:'-'+String(move)+'px'},'slow');
		}	
		
	}
}

function showList(tab)
{
	if($(tab).hasClass('active')){}else{
	$(tab).siblings('.button').removeClass('active');
	$(tab).siblings('.list-content').hide();
	$(tab).addClass('active');
	var no = $('.button').index(tab);
	$('.list-content:eq('+no+')').fadeIn();
	}
}

function login()
{
	$('#login').slideToggle();
}

this.imagePreview = function(){	
	/* CONFIG */
		
		xOffset = 30;
		yOffset = 200;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	/* END CONFIG */
	$("img.preview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p id='preview'><img src='"+ this.src +"' alt='"+this.title+"' width='240'/>"+ c +"</p>");								 
		$("#preview")
			.css("top",(e.pageY + yOffset) + "px")
			.css("left",(e.pageX + xOffset) + "px")
			.fadeIn("fast");
    },
	function(){
		this.title = this.t;	
		$("#preview").remove();
    });	
	$("img.preview").mousemove(function(e){
		$("#preview")
			.css("top",(e.pageY - yOffset) + "px")
			.css("left",(e.pageX + xOffset) + "px");
	});			
};

function scrollbanner(){
	var total=$('div.banner-image').length;
	$('.banner-image:eq('+banner+')').fadeOut();
	banner=banner+1;
	if(total==banner){banner=0};
	$('.banner-image:eq('+banner+')').fadeIn('slow');
	setTimeout(function(){scrollbanner();},5000)
}

function imageViewer(){
	$('img.main-image').click(function(){
		$('a.lightbox').attr('href',$(this).attr('src'));
		$('a.lightbox').lightbox();
	});
}

function sendTo()
{
	$('#send-to').slideToggle();
}

function menu()
{
	$('ul.current').show();
	$('ul#menu li').mouseenter(function(){
		$('ul.child').hide();
		if($(this).attr('id')!='')
		{	
			
			$('ul.'+$(this).attr('id')).fadeIn('slow');
		}
	});
	
	$('#navigation').mouseleave(function(){
		$('ul.child').hide();	
		$('ul.current').fadeIn('slow');
	})
}

