function getFlashVersion(){ 
  // ie 
  try { 
    try { 
      // avoid fp6 minor version lookup issues 
      // see: http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/ 
      var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6'); 
      try { axo.AllowScriptAccess = 'always'; } 
      catch(e) { return '6,0,0'; } 
    } catch(e) {} 
    return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1]; 
  // other browsers 
  } catch(e) { 
    try { 
      if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){ 
        return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1]; 
      } 
    } catch(e) {} 
  } 
  return '0,0,0'; 
}

$("#bgImage").attr({"src": "/images/bgs/armani.jpg"});

$("#newsContainer").css({
	opacity: "0.70",
	height: $(window).height()-60
});
$("#newsContainer .content").css({
	opacity: "1",
	height: $("#newsContainer").height()-50
});

$("#emailContainer").css({
	opacity: "0.70"
});


$("#videoHeader a").css("opacity", 0.50);
$("#videoHeader a").hoverIntent(
	function(){
		$(this).animate({"opacity": 1}, 200);
	},
	function(){
		$(this).animate({"opacity": 0.50}, 200);
	}
);

$("#headerSocial div").css("opacity", 0.40);
$("#headerSocial div").hoverIntent(
	function(){
		$(this).css("cursor", "pointer");
		$(this).fadeTo(100, 1);
	},
	function(){
		$(this).fadeTo(100, 0.40);
	}
);

$("#headerLangs a, #headerInfos a").css("opacity", 0.40);
$("#headerLangs a, #headerInfos a").hoverIntent(
	function(){
		$(this).animate({"opacity": 1}, 200);
	},
	function(){
		$(this).animate({"opacity": 0.40}, 200);
	}
);

$("#headerLangs a").click(function(){
	$.cookie('armani_language', $(this).attr("class"), { expires: 7, path: '/'});
	window.location.reload();
	return false;
});

$("#contentLogos ul li a").css("opacity", 0.40);
$("#contentLogos ul li.armani a").css("opacity", 1);
$("#content ul li.armani").css("display", "block");
$("div#contentLogos ul li").hoverIntent(
	function(){
		var param = $(this).attr("class");
		if ($("#contentLogos ul li."+param+" a").css("opacity") != 1)
		{
			var source = "/" + $("#contentLogos ul li."+param+" a").attr("rel");
			$("#bgImage").fadeOut(500, function(){
				$(this).attr({
					src: source
				});
			}).fadeIn(500);
			
			$("#content ul li:not('."+param+"')").hide(100, function(){
				$("#content ul li."+param).show(100);
			});
		}
		$("#contentLogos ul li:not('."+param+"') a").animate({"opacity": 0.40}, 300);
		$(this).children("a").animate({"opacity": 1}, 300);
		active = param;
	},
	function(){}
);

$("#footer div").css("opacity", 0.70);
$("#footer").hoverIntent(
	function(){
		$("#newsContainer").fadeOut(200)
		$("#footer").animate({"height": "250px", "opacity": 1}, 500, function(){
			$("#contentLogos ul li:not('.armani') a").animate({"opacity": 0}, 200);
			$("#contentLogos ul li:.armani a").animate({"opacity": 1}, 200);
			$("#footer div").animate({"opacity": 1}, 100, function(){
				$("#footerContent").show(400);
			});
		});
		
	},
	function(){
		$("#footerContent").hide(200, function(){
			if (typeof active == "undefined")
			{
				active = "armani";
			}
			$("#contentLogos ul li:not('."+active+"') a").animate({"opacity": 0.40}, 200);
			$("#contentLogos ul li:."+active+" a").animate({"opacity": 1}, 200);
			$("#footer").animate({"height": "30px", "opacity": 0.70}, 500, function(){
				$("#footer div").animate({"opacity": 0.70}, 100);
				$("#newsContainer").fadeIn(200);
			});
		});
	}
);

$("#newsContainer .pager .prevPage, #newsContainer .pager .nextPage").hover(function(){$(this).css("cursor", "pointer");}, function(){});

function load_page(page){
	$.post("/get_news.php", { page: page },
	function(data){
	$("#newsContainer").html(data);
	$("#newsContainer .pager .prevPage").click(function(){
		if (page != 1)
		{
			page = page-1;
			load_page(page);
		}
		return false;
	});
	$("#newsContainer .pager .nextPage").click(function(){
		if ($(this).hasClass("enabled"))
		{
			page = page+1;
			load_page(page);
		}
		return false;
	});
	$("#newsContainer .content").css({
		opacity: "1",
		height: $("#newsContainer").height()-50
	});
	$("#newsContainer .content").jScrollPane({scrollbarWidth:2});
	$("#newsContainer .pager .prevPage, #newsContainer .pager .nextPage").hover(function(){$(this).css("cursor", "pointer");}, function(){});
	});
}

page = 1;
$("#newsContainer .pager .prevPage").click(function(){
	if (page != 1)
	{
		page = page-1;
		load_page(page);
	}
	return false;
});
$("#newsContainer .pager .nextPage").click(function(){
	if ($(this).hasClass("enabled"))
	{
		page = page+1;
		load_page(page);
	}
	return false;
});

$("#linkBtn").click(function(){
	$.post("/send_mail.php", { link: 1, full_name: $("input[name=full_name]").val(), email_from: $("input[name=email]").val(), friend: $("input[name=friend]").val(), message: $("textarea[name=message]").val(), number: $("input[name=number]").val() },
	function(data){
		$("#linkInfo").html(data);
	});
});

$("#emailBtn").click(function(){
	$.post("/send_mail.php", { email: 1, email_addr: $("input[name=email]").val() },
	function(data){
		$("#emailInfo").html(data);
	});
});

$("#blogBtn").click(function(){
	$.post("/send_mail.php", { blog: 1, blog_addr: $("input[name=blog]").val()},
	function(data){
		$("#blogInfo").html(data);
	});
});