﻿
App = function(){

    /* Private */
        
    /* Properties */
    
    var cmp = {};

    
    /* Defaults */
    
    TVI.debug = true;
    
    
    /* Methods */
    
    var init = function(){
		
		// CUFON
		Cufon.replace('H1, .title1', {
			fontFamily: 'FoundrySterling-Medium'
		});
		Cufon.replace('#topNav, .sideNav', {
			fontFamily: 'FoundrySterling-Bold'
		});

		// ROUNDED FIX
		if(! $('HTML').hasClass('borderradius') ){
			//tl
			$('.box .top').prepend('<div class="tl"></div>');
			var size = $('.box .top').css('border-top-left-radius');
			$('.box .top .tl').css({ 'width': size, 'height': size, 'top': '0', 'left': '0', 'position': 'absolute' });
			//tr
			$('.box .top').prepend('<div class="tr"></div>');
			var size = $('.box .top').css('border-top-right-radius');
			$('.box .top .tr').css({ 'width': size, 'height': size, 'top': '0', 'right': '0', 'position': 'absolute' });
			//br
			$('.box .top').prepend('<div class="br"></div>');
			var size = $('.box .top').css('border-bottom-right-radius');
			$('.box .top .br').css({ 'width': size, 'height': size, 'bottom': '0', 'right': '0', 'position': 'absolute' });

			//all
			$('.innerBox').prepend('<div class="tl"></div><div class="tr"></div><div class="br"></div><div class="bl"></div>');
			var size = $('.innerBox').css('border-radius');
			$('.innerBox .tl, .innerBox .tr, .innerBox .br, .innerBox .bl').css({ 'width': size, 'height': size, 'position': 'absolute' });
		}


		// SEARCH
		cmp.searchForm = new TVI.Form({
			ID: 'searchForm',
			submit: function(){
				window.location = 'search.aspx?keywords='+ this.field('text').val();		
			}
		});
    
    };
    
    
    /* Public */
    
    TVI.apply(cmp, {
    
        /* Properties */
    
        test: 'test',
    
        /* Methods */
        
        test: function(){
        
            /* Test function  */
        
        }
    
    });
    
    
    TVI.ready(init);    
    
    
    return cmp;


}();
