function initializeDocument()
{
	updateHomeFlashPosition();
	setTimeout(function () {updateHomeFlashPosition()}, 100);
	$("#ProductThumbnails img").click(
		function () {
			var url = this.src;
			url = url.replace(/height=[0-9]+/,"");
			
			$("#ProductThumbnails img").css({border: "0px none #CCC"});
			$(this).css({border: "0px solid #CCC"});
			$("#MainProductImage").attr("src", url);
		}
	);
	
	$(".ProductHomeContainer img").hover(
		function () {this.src = this.src.replace("_off", "_on");},
		function () {this.src = this.src.replace("_on", "_off");}
	);
	$(".NewsletterSubscription .SubscriptionTextbox").focus(function () { if ($(this).val() == "E-posta adresiniz") $(this).val("");});
	$(".NewsletterSubscription .SubscriptionTextbox").blur(function () { if ($(this).val() == "") $(this).val("E-posta adresiniz");});
}

function updateHomeFlashPosition()
{
	var homeNewPos = $(window).height()/2 - $("#HomeFlash").height()/2 - 130;
	if (homeNewPos<-43)
		homeNewPos = -43;
	$("#HomeFlash").css({ top: homeNewPos + "px"});
	$("#FooterFlash").css({ top: "0px"});
//	alert($("#Content").height());
	var h = Math.max($(window).height(), $("#Content").height()!=null?($("#Content").height()+200):0);
	var footerNewPos = h - $("#FooterFlash").height()-500;
	if (footerNewPos<-100)
		footerNewPos=-100;
	var subsY = ($(window).height()-240);
	if (subsY<360)
		subsY = 360;
	$("#HomeNewsletterSubscription").css({ top:  subsY+ "px", left: ($(window).width()/4+160) + "px"});
	$("#FooterFlash").css({ top: footerNewPos + "px"});
	
}

$(window).resize(updateHomeFlashPosition);
$(document).ready(initializeDocument);