var globalFontSize=12;

function makeFontBigger(){
    
    if(globalFontSize<100){
        globalFontSize=globalFontSize+2;
    }
    jQuery.cookie('fontsize',globalFontSize);
    jQuery('body').css('font-size',globalFontSize+'px');
};
function makeFontSmaller(){    
    if(globalFontSize>12){
        globalFontSize=globalFontSize-2;
        jQuery.cookie('fontsize',globalFontSize);
    }
    
    jQuery('body').css('font-size',globalFontSize+'px');
};

jQuery(function(){
    cookieValue=jQuery.cookie('fontsize');
    if(typeof cookieValue !="undefined" && cookieValue != null){        
        var intval=parseInt(cookieValue);
        if(intval){
            globalFontSize=intval;
            jQuery('body').css('font-size',globalFontSize+'px');
        }

    }
    
    if( jQuery('ul.submenu').children().length === 0 ){
        jQuery('ul.submenu').remove();
    }
    
    jQuery('#bigger').click(function(e){
        makeFontBigger();
        e.preventDefault();
    });
    jQuery('#smaller').click(function(e){
        makeFontSmaller();
        e.preventDefault();
    });
    
    //filelinks
    jQuery('.maincontent a').each(function(){
        if(this.href.indexOf('mailto:') === -1){
            var ext=this.href.match(/\.[^\.?\/]+$/,''),
            isexternal=this.href.length>0 && this.href.indexOf(window.location.hostname) === -1;
            if(ext && !ext[0].match(/\?/) && !ext[0].match(/\.html/)){
                ext=ext[0].replace('.','');
                jQuery(this).addClass('download-'+ext);
            }else{
                if(isexternal){
                    jQuery(this).addClass('link-extern');
                }
            }
        }else{
            jQuery(this).addClass('link-mail');
        }
        
    });
    //faq
    if(jQuery('body').hasClass('page-105')){
        jQuery('.maincontent').find('.csc-header').click(function(){
                $this=jQuery(this);
                var content=$this.next();
                if(content.is(':visible')){
                    content.hide();
                }else{                
                    content.show();
                }
            }
        );
    }
    
    /*login*/
    jQuery('#pass,#user').focus(function(){
       $this=jQuery(this) ;       
       $this.addClass('empty');
       
    });
    jQuery('#pass,#user').blur(function(){
       $this=jQuery(this) ;
       if($this.val() == ''){
           $this.removeClass('empty');
       }
    });
//    leftcolmailfield
    jQuery('#leftcolmailfield').focus(function(){
       $this=jQuery(this) ;       
       $this.val('');
       
    });
    
    //slider
    jQuery('.news-slider').vTicker({

		       speed: 500,
		
		       pause: 6000,
		
		       showItems: 3,
		
		       mousePause: true,
		
		       height: 140,
		
		       direction: 'up'

    });
});
