var carousel; 
var carousel_props = 
{
	'itemsWidth': 320,
	'itemsHeight': 116,
	'autoAdjust': 1,
	'autoAdjustDuration': 400,
	'autoPlay': 1,
	'autoPlayDuration': 4000,
	'firstItemIndex': 1,
	'displayDots': 0,
	'items':
	[
		 {'type': 'string', 'content': '<img src="http://i.cdn.turner.com/v5cache/TNT/mobile/img/tnt/features/tnt_mobile_feat_closer.png" />'},
		 {'type': 'string', 'content': '<img src="http://i.cdn.turner.com/v5cache/TNT/mobile/img/tnt/features/tnt_mobile_feat_fb.png" />'},
		 {'type': 'string', 'content': '<img src="http://i.cdn.turner.com/v5cache/TNT/mobile/img/tnt/features/tnt_mobile_feat_fs.png" />'},
		 {'type': 'string', 'content': '<img src="http://i.cdn.turner.com/v5cache/TNT/mobile/img/tnt/features/tnt_mobile_feat_lev.png" />'},
		 {'type': 'string', 'content': '<img src="http://i.cdn.turner.com/v5cache/TNT/mobile/img/tnt/features/tnt_mobile_feat_riz.png" />'}
	]
}

init = function()
{
	carousel = new wink.ui.xy.Carousel(carousel_props);
        var textNode = $('tntHomeBanner').childNodes[0];
        $('tntHomeBanner').removeChild(textNode);
	$('tntHomeBanner').appendChild(carousel.getDomNode());
	/*var rightNow = new Date();
        var tz = String(String(rightNow).split("(")[1]).split(")")[0];
        setUserTimeZone(tz);*/
}
function setUserTimeZone(tz){
        var parameters =
        [
                {name: 'timezone', value: tz}
        ]
        xhr = new wink.Xhr();
        xhr.sendData('/primary/timezone', parameters, 'GET', {method: 'onsuccess'} , {method: 'onfailure'}, null);
        onsuccess = function(result)
        {
                if (result.xhrObject.responseText != '')
                {
                         var tzValue = result.xhrObject.responseXML.getElementById('tz').firstChild.data;
                         var schedLink = $("navbar_schedule").href;
                         $("navbar_schedule").href = schedLink.replace(schedLink.substring(schedLink.indexOf("tz="),schedLink.indexOf("#")), "tz="+tzValue);
                         //alert(test);
                }
        };
        onfailure = function(result)
        {
                //alert("user timezone not set");
        };
}


