function top_det(top_array) {
var i_photo = 1;
var j_photo = 0;
var v_detect = navigator.userAgent;
if (v_detect.indexOf("MSIE") > -1) {
	var p_1 = v_detect.indexOf("MSIE") + 5;
	var p_2 = v_detect.indexOf(".", p_1);
	var vers = v_detect.substring(p_1, p_2);
	if (vers == 7) { 
		var top_sky_transp = document.getElementById("top_sky");
		var top_photo_div_transp = document.getElementById("top_photo_div");
		var top_logotype_transp = document.getElementById("top_logotype");
		top_sky_transp.style.marginTop = 0;
		top_photo_div_transp.style.marginTop = 0;
		top_logotype_transp.style.marginTop = 0;	
	}
}
next_photo(top_array, j_photo);
}


function IE_in_photo(top_array, i_photo, j_photo) {
	var top_photo_transp = document.getElementById("top_photo_div");
	var interval_IE_in_photo = setInterval(function IE_in_top_photo() { top_photo_transp.filters.alpha.opacity = i_photo; i_photo=i_photo+1; if (i_photo > 99){ clearInterval(interval_IE_in_photo); IE_fix_photo(top_array, i_photo, j_photo); } }, 25);
}

function IE_fix_photo(top_array, i_photo, j_photo) {
	var top_photo_transp = document.getElementById("top_photo_div");
	if (j_photo == 1) {
		var top_photo_back = document.getElementById("top_sky");
		top_photo_back.style.backgroundImage = 'url(SpryAssets/sky.jpg)';
	}
	var interval_IE_fix_photo = setInterval(function IE_fix_top_photo() { top_photo_transp.filters.alpha.opacity = 100; clearInterval(interval_IE_fix_photo); IE_out_photo(top_array, i_photo, j_photo); }, 4000);
}

function IE_out_photo(top_array, i_photo, j_photo) {
	var top_photo_transp = document.getElementById("top_photo_div");
	var interval_IE_out_photo = setInterval(function IE_out_top_photo() { top_photo_transp.filters.alpha.opacity = i_photo; i_photo=i_photo-1; if (i_photo < 0) { clearInterval(interval_IE_out_photo); next_photo(top_array, j_photo); } }, 25);
}


function MO_in_photo(top_array, i_photo, j_photo) {
	var top_photo_transp = document.getElementById("top_photo_div");
	var interval_MO_in_photo = setInterval(function MO_in_top_photo() { top_photo_transp.style.opacity = i_photo/100; i_photo=i_photo+1; if (i_photo > 99){ clearInterval(interval_MO_in_photo); MO_fix_photo(top_array, i_photo, j_photo); } }, 25);
}

function MO_fix_photo(top_array, i_photo, j_photo) {
	var top_photo_transp = document.getElementById("top_photo_div");
	if (j_photo == 1) {
		var top_photo_back = document.getElementById("top_sky");
		top_photo_back.style.backgroundImage = 'url(SpryAssets/sky.jpg)';
	}
	var interval_MO_fix_photo = setInterval(function MO_fix_top_photo() { top_photo_transp.style.opacity = 1; clearInterval(interval_MO_fix_photo); MO_out_photo(top_array, i_photo, j_photo); }, 4000);
}

function MO_out_photo(top_array, i_photo, j_photo) {
	var top_photo_transp = document.getElementById("top_photo_div");
	var interval_MO_out_photo = setInterval(function MO_out_top_photo() { top_photo_transp.style.opacity = i_photo/100; i_photo=i_photo-1; if (i_photo < 0) { clearInterval(interval_MO_out_photo); next_photo(top_array, j_photo); } }, 25);
}


function next_photo(top_array, j_photo) {
	var top_photo_transp = document.getElementById("top_photo_div");
	if (j_photo < top_array.length-1) MM_preloadImages_two(top_array[j_photo+1]); else MM_preloadImages_two(top_array[0]);
	top_photo_transp.style.backgroundImage = "url(" + top_array[j_photo] + ")";
	i_photo = 1;
	j_photo = j_photo + 1;
	if (top_array.length == j_photo) {
		j_photo = 0;
	}
	if (navigator.userAgent.indexOf("MSIE") > -1) IE_in_photo(top_array, i_photo, j_photo);
	if (navigator.userAgent.indexOf("MSIE") == -1) MO_in_photo(top_array, i_photo, j_photo);
}


function MM_preloadImages_two() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages_two.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
