	function validateRetrive(source, args)
	{
		args.IsValid = document.getElementById('ctl00_phContent_chbNewsLetter').checked;
	}


function openWindowCenter(url, width, height, scroll, status, resizable)
{
	if(!status)
		status = 'no';

	if(!resizable)
		resizable = 'no';
		
	if(!scroll)
		scroll = 'no';

	var intTop = ((screen.Height / 2) - (height / 2));
	var intLeft = ((screen.Width / 2) - (width / 2));

	window.open(url, '', 'width='+ width +', height='+ height +', resizable='+ resizable +', location=no, titlebar=no, toolbar=no, menubar=no, directories=no, channelmode=no,  scrollbars='+ scroll +', status='+ status +', top='+ intTop +', left='+ intLeft +'');
} 

$(document).ready(function() {
	if ($(".front-left").length==0) initAreaSelector(".area-chooser h2 a", ".right-half");
	initCarousel(".carousel");
});

function initAreaSelector(src,target) {
	if (typeof target != undefined) {
		$(target).data("defaultValue",$(target).html());
		$(src).mouseover(
			function() {
				$(target).empty().append($(this).clone().contents()).wrapInner("<h1 class=alternative></h1>").find("br").replaceWith(" ");
				$(target).append($(this).parents("li").find("p").clone().wrapInner("<p></p>"));
			}
		).mouseout(
			function() {
				$(target).empty().append($(target).data("defaultValue"));
			}
		);
	}
}



function initCarousel(str) {
    $(str).each(function(i) {
        if ($(this).find("li").length>3) {
            $(this).wrapInner("<div class='carouselInner crs"+i+"'></div>").append("<div class='prev crs"+i+"prev'></div>","<div class='next crs"+i+"next'></div>");
            $(".crs"+i+"prev").fadeTo(200,0.4);
            $(this).find(".crs"+i).jCarouselLite({
                btnNext: ".crs"+i+"next",
                btnPrev: ".crs"+i+"prev",
                start:0,
                speed:200,
                circular:false,
                visible:3,
                scroll:1,
                afterEnd: function(a) {
                    var iFirst = $(this).children().index(a.filter(":first"));
                    var iLast = $(this).children().index(a.filter(":last"));
                    if (iFirst<=1) $(".crs"+i+"prev").fadeTo(140,(iFirst==0)?0.3:1);
                    if (iLast>=$(this).children().length-2) $(".crs"+i+"next").fadeTo(140,(iLast==$(this).children().length-1)?0.3:1);
                }

            });
            $(this).find(".carouselInner").width($(this).find(".carouselInner").width()-1);
        }
    });
}

