
var currSize = 1;


function swichStyleSheetSrc(size) {
    var styleName = 'size'+size;
    $('link[@rel*=STYLE][@title]').each(function() {
        this.disabled = true;
        if($(this).attr('title')==styleName) {
            this.disabled = false;
        }
    });
    $.cookie('styles',size,{expires:7,path:'/'});
}

function disableAll() {
    $('link[@rel*=STYLE]').each(function() {
        this.disabled = true;
    });
}



$(document).ready(function() {
/*				   
    if(document.all) {
        try {document.execCommand("BackgroundImageCache",false,true);} catch(e){}
    }
    $('#AddBookmark').click(function(){setBookmark(); return false;});
    $('#TextVersion').click(function(){disableAll(); return false;});
*/

    if($.cookie('styles')) {
        currSize = parseInt($.cookie('styles'));
        var isActive = false;
        $('link[@rel*=STYLE][@title]').each(function() {
              if($(this).attr('rel').indexOf('ALTERNATE')==-1
                && $(this).attr('title')=='size'+currSize) {
                    isActive = true;
              }
        });
        
		if(currSize == 2){
			$('#btnresize').addClass('down');
		}else{
			$('#btnresize').removeClass('down');
		}
		
        if(!isActive) {
            swichStyleSheetSrc(currSize);
        }
    }
    
         $('#btnresize').click(function(){					
					if(currSize == 1){
					 	currSize = 2;
						$('#btnresize').addClass('down');
					}else{
						currSize = 1;
						$('#btnresize').removeClass('down');
					}			
                    swichStyleSheetSrc(currSize);
					return false;
         });
		 
	});