 window.onresize = function(){fixPosition();}


var isIPad = navigator.userAgent.match(/iPad/i) !== null;
var isIPhone = navigator.userAgent.match(/iPhone/i) !== null;
var isAndroid = navigator.userAgent.match(/Android/i) !== null;

$(document).ready(function(){
var videoHtml;
if(isIPad || isIPhone){
	videoHtml = "<video poster='2011/img/headjpgipad.jpg' src='2011/video/video.mp4' width='898' height='537' controls></video>";
	$(".flash1").html(videoHtml);
	$(".login1").css({ "height": "auto"});
	$(".login1 .iframe1").css("height","auto");
	$(".iframe1").html("<iframe id='iframeSiloForm' scrolling='no' frameborder='0' src='about:blank' width='960' height='1650'></iframe>")
	$(".login1 .close a").css({ "height": "14px"});
}else{
	videoHtml = "<div id='contentContainer'><div id='flashcontent'><img src='2011/img/headjpg.jpg' width='898' height='537' alt='' /></div></div>";
	$(".flash1").html(videoHtml);
	swfobject.embedSWF("2011/swf/main_loader.swf", "flashcontent", "898", "537", "9.0.45", false, flashvars, params, attributes);
	$(".iframe1").html("<iframe id='iframeSiloForm' scrolling='no' frameborder='0' src='about:blank' width='960' height='1650'></iframe>")
}



$("#wallpaper li").hover(
	  function () {
		if($(this).children(".w2").css("height")=="24px"){
			$(this).children(".w2").stop().animate( { marginTop: "-32px"}, 150 );
		}else{
			if($(this).children(".w2").css("height")=="80px"){
				$(this).children(".w2").stop().animate( { marginTop: "-88px"}, 600 );
			}else{
				$(this).children(".w2").stop().animate( { marginTop: "-48px"}, 300 );
			}
		}
	  },
	  function () {
		$(this).children(".w2").stop().animate( { marginTop: "0px"}, 300 );
	  }
	);


	$(".mask1").click( function () { hideSilo(); });
	$(".c1 a").click( function () { 
			downloadSpotLight();
			downloadWebtrends(); 
			});

});


function showSilo(){

	if ($("#iframeSiloForm").attr("src") == "about:blank"){
		$("#iframeSiloForm").attr("src",hostName);
	}
	
	fixPosition();
	
  	$(".mask1").show().fadeTo("slow", 0.66);
	$(".login1").fadeIn("slow");
	
	if(isIPad || isIPhone){
		$(".flash1").html("<img src='2011/img/headjpgipad.jpg' width='898' height='537' alt='' />");
	}
}

function hideSilo(){
	if(isIPad || isIPhone){
	$(".login1").hide();
	$(".flash1").html("<video poster='2011/img/headjpgipad.jpg' src='2011/video/video.mp4' width='898' height='537' controls></video>");
	}else{
	$(".login1").fadeOut("slow");
	}
	$(".mask1").fadeOut("slow");
}


function fixPosition(){
var w=$(window).width();
if(w<1024){w=1024;}
var w1=(w-742)/2;
var w2=w-20;
$(".login1").css({ "left": w1});
$(".mask1").css({ "width": w2, "height": $(document).height() });

}

//download spotlight
function downloadSpotLight() {
	var axel = Math.random() + "";
	var a = axel * 10000000000000;
	jQuery(document.body).append('<iframe src="http://fls.doubleclick.net/activityi;src=2528131;type=hb201267;cat=mglad959;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>');
}

//download webtrends
function downloadWebtrends() {
	trackPage("/gladiator/download.html");
}


