function initPage(){
    hideFormText();
    setupYoutubeLinks();


}


function setupYoutubeLinks() {
    $("a.youtube").click(function () {
        $.fancybox({
            'padding': 0,
            'autoScale': false,
            'transitionIn': 'none',
            'transitionOut': 'none',
            'title': this.title,
            'width': 960,
            'height': 620,
            'href': this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
            'type': 'swf',
            'swf': {
                'wmode': 'transparent',
                'allowfullscreen': 'true'
            }
        });
        return false;
    });
}


var AcubizSlideShow;
AcubizSlideShow = (function () {
    function AcubizSlideShow() {
        var slider = $('.gallery .holder ul').bxSlider({
            'controls': false,
            mode: 'fade',
            auto: true,
            speed: 2000,
            pause: 9000,
            autoStart: true
        });

        $(".link-next").click(function (e) {
            e.preventDefault();
            slider.goToNextSlide();
        });
        $(".link-prev").click(function (e) {
            e.preventDefault();
            slider.goToPreviousSlide();
        });
    }
    return AcubizSlideShow;
})();



var Tweetbox;
Tweetbox = (function () {
    function Tweetbox() { }
    Tweetbox.prototype.fetch = function (screenName) {
        jQuery.ajax({
            url: "http://api.twitter.com/1/statuses/user_timeline.json?screen_name=" + screenName + "&count=2&trim_user=1",
            success: function (result) {
                if (window.console) {
                    console.log(result[0].created_at);
                }
                var tweetlist = $('ul.twitter-list li.tweet');
                //console.log('tweet count' + tweetlist.length);
                tweetlist.each(function (i, e) {
                    var html = result[i].text;
                    html = html.replace(/(https?:\/\/[^\s]+)/gi, '<a target="_blank" href="$1">$1</a>');
                    html = html.replace(/@@([a-z0-9]*)/gi, '<a target="_blank" href="http://twitter.com/$1">@@$1</a>');
                    $(e).find('.tweet-text').html(html);
                    var url = "http://twitter.com/" + screenName + "/status/" + result[i].id_str;
                    var date = result[i].created_at;
                    date = $.datepicker.parseDate('D M dd', date);
                    $(e).find('.tweet-time').text($.timeago(date)).wrap('<a target="_blank" href=' + url + '></a>');
                });
            },

            dataType: 'jsonp'
        });
    };
    return Tweetbox;
})();




// hideFormText
function hideFormText() {
	var _inputs = document.getElementsByTagName('input');
	var _txt = document.getElementsByTagName('textarea');
	var _value = [];
	
	if (_inputs) {
		for(var i=0; i<_inputs.length; i++) {
			if (_inputs[i].type == 'text' || _inputs[i].type == 'password') {
				
				_inputs[i].index = i;
				_value[i] = _inputs[i].value;
				
				_inputs[i].onfocus = function(){
					if (this.value == _value[this.index])
						this.value = '';
				}
				_inputs[i].onblur = function(){
					if (this.value == '')
						this.value = _value[this.index];
				}
			}
		}
	}
	if (_txt) {
		for(var i=0; i<_txt.length; i++) {
			_txt[i].index = i;
			_value['txt'+i] = _txt[i].value;
			
			_txt[i].onfocus = function(){
				if (this.value == _value['txt'+this.index])
					this.value = '';
			}
			_txt[i].onblur = function(){
				if (this.value == '')
					this.value = _value['txt'+this.index];
			}
		}
	}
}

