/**
 * DEFINE DEFAULT VARIABLES
 *
 */
var dom_ready = false;
var load_banners_onstart = true;
var slided_out;
var IS_FLASH_SHOWN = true;
var banner_flashvar = ''; // holder for banner flashvar which we sent to player

/**
 *   Event loads when DOM is ready
 *   This functions will fire right after HTML DOM is ready (before pictures load)
 */
window.addEvent('domready', function()
{
	/**
	 * SET VARIABLES
	 */
	dom_ready = true;



	/**
	 *  PRELOAD FOLLOWING IMAGES:
     */
	preload_images = new Array(
		"/static/shared/img/icons/ajax.gif",
		"/static/shared/img/icons/ico_home_page_ff_on.gif",
		"/static/shared/img/icons/ico_home_page_ie_on.gif",
		"/static/shared/img/icons/ico_home_page_netscape_on.gif",
		"/static/shared/img/icons/ico_home_page_opera_on.gif",
		"/static/shared/img/icons/ico_home_page_safari_on.gif",
		"/static/shared/img/icons/ico_home_page_ff_off.gif",
		"/static/shared/img/icons/ico_home_page_ie_off.gif",
		"/static/shared/img/icons/ico_home_page_netscape_off.gif",
		"/static/shared/img/icons/ico_home_page_opera_off.gif",
		"/static/shared/img/icons/ico_home_page_safari_off.gif"
	);

	preload_images.each ( function(el_url) {
		var tmp_image = new Image();
		tmp_image.src = el_url;
	});

	// fills in the username or registration link
	reload_user_info();
		
});


/**
 *  ########################################################################################
 *  ############################  FUNCTIONS BELOW THIS LINE  ###############################
 *  ########################################################################################
 */
function include_css(file)  	 
{ 	 
  if (document.createElement && document.getElementsByTagName) { 	 
  var d_head = document.getElementsByTagName('head')[0]; 	 
  	 
  var d_script = document.createElement('link'); 	 
  d_script.setAttribute('type', 'text/css'); 	 
  d_script.setAttribute('rel', 'stylesheet'); 	 
  d_script.setAttribute('href', file); 	 
  	 
  d_head.appendChild(d_script); 	 
  } 	 
}

/**
 * Reloads user info with either username or registration link
 * @author Matej Balantič <matej@balantic.si>
 */
function reload_user_info()
{
	var username = Cookie.get('user')
	var forum_enable_answer = Cookie.get('forum_user');

	if($('forum_enable_answer'))
	{
	    if(forum_enable_answer)
		$('forum_enable_answer').setStyle('display', '');
	    else
		$('forum_enable_answer').setStyle('display', 'none');
	}	

	// HIDE / SHOW all user blocks
	$ES('.user_display_when_loggedin').each ( function (el)
	{
		if (username)
			el.style.display = 'block';
		else
			el.style.display = 'none';
	});
	$ES('.user_display_when_loggedout').each ( function (el)
	{
		if (username)
			el.style.display = 'none';
		else
			el.style.display = 'block';
	});

	// FILL IN USERNAME
	if (username)
		$ES('.user_username').each ( function (el)
		{
			username = username.replace('+', ' ');
			if (username.length > 10)
			{
				username = username.substr(0,10) + "...";
			}
			el.innerHTML = username;
		});
}

function open_close_subform(div_id,div_head)
{
	var div_name = $(div_id);
	if(div_name)  {
		if (div_name.style.display == "block") {
			if (div_id == 'video_content') {
				try {
					$('flvvideo').innerHTML = ""; //remove flvvideo
				} catch(e) {
					null;
				}
			}
			div_name.style.display = "none";
			$(div_head).className = "head";
			
		} else {
			div_name.style.display = "block";
			$(div_head).className = "headopen";
			if (div_id == 'video_content') {
				video_player_setup(); //reopen flvvideo
			}
		}
	}	
}


/**
 * Sends AJAX request to $script_name and updates $div_name with results.
 * Animates $div_name while waiting for AJAX response
 * @param div_name Name of the div to write in
 * @param script_name name of the script to execute
 * @param callbackFn Calback function executed after successful request
 * @param callbackFnScope Scope in which callback function will be executed
 * @author Anže Robida
 * @author Matej Balantič <matej@balantic.si> (ajax-loader animation)
 * @author Tomáš Korčák, CET21, spol. s r.o. (callback function and scope)
 */
function returnContent(div_name,script_name,media_title,media_id,callbackFn,callbackFnScope) {


	temp = $('div_hover_layer');
	if( temp){
		// looks like user is clicking to fast
		temp.innerHTML = '';
		temp = temp.remove();
		temp = null;
	}
	// hide flash
	flash_show(true, $(div_name));
	
	slided_out = false;

	// create hover layer
	hover_layer = new Element("div")
		.setStyle('position', 'absolute')
		.setStyles($(div_name).getCoordinates())
		.injectInside(document.body)
		.setOpacity(0.3)
		.setStyles({
				'background-color':'black',
				'position': 'absolute',
				'z-index': '5'
			});
	// we need this id for multiple clicks
	hover_layer.id = 'div_hover_layer';
	
	if (div_name == 'vsection_content_margin')
	{
		hover_layer.setStyles({
				'margin-left': '10px'
			});
	}

	// create ajax loader
	ajax_load = new Element("img")
	ajax_load.src = '/static/shared/img/icons/ajax.gif';
	move_top  =   ($(div_name).getSize()['size']['y']/2) - (ajax_load.height/2);
	move_left =   ($(div_name).getSize()['size']['x']/2) - (ajax_load.width/2);
	ajax_load.setStyles({
			"position": 	'absolute',
			"top": 		 	move_top,
			"left":			move_left,
			"z-index": 		'10'
		}).injectInside(hover_layer);	
	
	// call ajax script
	popajax = new Ajax(script_name, {
		method: 'get',
		encoding: 'UTF-8',
		onComplete: function(response)
		{
			$(div_name).innerHTML = response;

			if (div_name == 'videosection' || div_name == 'video_section_main_video' || div_name == 'only_main') {
				if (media_id != undefined) { //if media id is not defined do not put this in url
					//put # tag into location
					var url_temp = window.location.href; //parse fixed location
					url_temp = url_temp.substring(0,url_temp.indexOf('#')); 
					var media_idx = script_name; //parse media_id
					media_idx = media_idx.substring(media_idx.indexOf('media_id=')+9);
					media_idx = parseInt(media_idx.substring(0,media_idx.indexOf('section_id')-1));
					window.location = url_temp + '#media_id=' + media_idx;

				}
			}

			//if video page
			if (div_name == 'videosection' || div_name == 'video_section_main_video' || div_name == 'embed_flvvideo' || div_name == 'only_main') {
				//replace title of the window - for ajax calls
				if (div_name != 'embed_flvvideo') {
					var explodestring = document.title;
					explodestring = explodestring.split('-');
					explodestring = explodestring[explodestring.length-1];
					explodestring = explodestring.split('#');
					explodestring = explodestring[0];
					if (media_title) {
						document.title = media_title + ' - ' + explodestring.trim();
					}
				}
				else
				{
					autostart = true; // we automaticaly start video if requested through ajax in article
					window.location.href = '#video';
				}
			}
			
			//change style of active media
			if (media_id) {
				try {
					//remove background of non-active media
					$ES('.small_video').each ( function(el) 
					{
						el.setStyles({background: ''});			  
					});
					$("media_id_"+media_id).setStyles({background: 'url(/static/'+app_lang+'/main/img/backgrounds/back_video.gif) repeat-y'});
					
				} catch(e) {
					null;
				}
				
			}

			// show flash back
			flash_show(true, $(div_name));
			
			// destroy ajax loader & div layer
			hover_layer.remove();

			ajax_load.remove();
			popajax.evalScripts();
			
			/*if (div_name == 'embed_flvvideo')
				video_player_setup();*/
			

			if (div_name == 'only_main' && !isNaN(media_id)) //if media_id is set & video should start playing (only_main)
			{
				//TODO - need to check id div is populated
				video_at_thumb(media_id, 'div_big_video',440,248);
			}

			try	{
				$('video_main_box').setStyle("visibility",'visible');					
			} catch (e) {null;}
			
			//proceed gemius
			if (response.indexOf('gemius_to_proceed') !=-1 && typeof(gemius_proceed) != 'undefined' ) {
				gemius_proceed();
			}

			// Call callback user function
			if (typeof callbackFn == 'function') {
				// Execute with scope
				var scope = callbackFnScope || this || document;
				callbackFn.call(scope);
			}

		},
		// do eval scripts inside the AJAX response
		evalScripts: false 
	}).request();

}

function do_slide() {

	if (!slided_out)
	{
		setTimeout(do_slide,300);
		return true;
	}
	mySlide.slideIn();
}

/**
 * REGISTRATION FUNCTIONS
 */

function close_banner() {}
function open_banner() {}
function pre_fullscreen() {
	if (typeof(reload_tmout) != 'undefined')
	{
		if (reload_tmout != null)
		{
			clearTimeout(reload_tmout);
		}
	}
}
function post_fullscreen() {}

function login_show()
{
    close_banner();
    mbox_open(500, 500);
    pre_fullscreen();

    step_1_help = new Array("main_help");
    active_step = 1;
    help_displayed = 0;

    new Ajax('/bin/registration2/login.php', {
	     method: 'get',
	     encoding: 'utf-8',
	     update: $('MBOX_window'),
	     evalScripts: true
	}).request();
}


function register_show()
{
    close_banner();
    mbox_open(500, 500);
    pre_fullscreen();

    // help boxes in step 1
    step_1_help = new Array("username_help", "password_help", "email_help", "main_help");

    // url of script for ajax purposes
    registration_script_url = '/bin/registration2/';

    // how many steps are there
    all_steps = 3;
    active_step = 1;

    // help box visibility status
    help_displayed = false;

    password_renewal = false;

    load_settings();

    url = '/bin/registration2/' + '?action=display' + '&what=1' + '&return=' + location.href;
    new Ajax(url, {
	     method: 'get',
	     encoding: 'utf-8',
	     update: $('MBOX_window'),
	     onComplete: register_show_complete,
	     evalScripts: true
	    }).request();
}


function register_show_complete( result )
{
    active_step = $('active_step').value;

    // get HTML code of ajax loader
    ajax_loader     = $('ajax_loader_div').innerHTML;
    ajax_loader_big = $('ajax_loader_big_div').innerHTML;

    build_indicators( $('active_step').value );
}


function load_settings()
{
    new Ajax('/bin/registration2/' + '?action=javascript' + '&what=register', {
	     method: 'get',
	     encoding: 'utf-8',
	     onComplete: load_settings_complete
	    }).request();
}


function load_settings_complete( result )
{
    eval( result );
}

/*
 * Function send article
 * @param div_name Name of the div to write in
 * @param script_name name of the script to execute
 * @param text_ok text if article was sent
 * @param text_error text if there goes something wrong
 *
*/
function articleSend(div_name,script_name,text_ok, text_error) {

	new Ajax(script_name, {
		method: 'post',
		encoding: 'utf-8',
		postBody: document.article_send,
		onComplete: function(response) {
			if (response == 'OK') {
				$(div_name).innerHTML = text_ok;
				try	{
					$("email_to").value = "";
				} catch (r) {null;}
			} else {
				$(div_name).innerHTML = text_error;
			}
		}
	}).request();
}


/**
 * This function execute PHP file,
 * which writes into database rating for current article comment
 * and shows current rating.
 */
function ajax_put_comment_vote(comment_id, vote) {

	var url = '/bin/ajax/article_comment_vote.php?comment_id=' + comment_id + '&rating=' + vote;
	var div = 'comment_vote_' + comment_id;
	var already_voted = 'comment_already_vote_' + comment_id;

	new Ajax(url, {
		method: 'get',
		onComplete: function(response) {
			if(response == 'already'){
				$(already_voted).innerHTML = "Вие вече гласувахте";
			}else if ($(div)){
				// Choice of class depends on rate (negative - red, positive - green)
				if(response > 0)
					$(div).setProperty('class', 'green');
				else if(response < 0)
					$(div).setProperty('class', 'red');
				else
					$(div).setProperty('class', '');

				// we show rating
				$(div).innerHTML = response;
			}
		}
	}).request();
}



/**
 * This function execute PHP file, which write into database rating for current article
 */
function ajax_put_vote(article_id, vote) {

	var url = '/bin/ajax/article_vote.php?article_id=' + article_id + '&rate=' + vote;

	new Ajax(url, {
		method: 'get',
		onComplete: function(response) {
			if ($("vote_stars_tnx"))
				$("vote_stars_tnx").src = response;
		}
	}).request();
}


/**
 * Function sends comment on article to server
 */
function ajax_comment_send(text_wait, text_saved, text_pwd, text_bnd, text_pnd, text_err, text_act, text_sent, text_dirty, text_another, $text_cap) {
	
	var url = '/bin/ajax/comment_save.php';
	var r = Math.random();
	
	if (document.comment_send.txt.value == '')
		return false;

	//write "wait" message
	span_comment_msg_1 = $('span_comment_msg');
	if (!span_comment_msg_1)
		return false;
	span_comment_msg_1.innerHTML = text_wait;

	new Ajax(url, {
		method: 'get',
		postBody: document.comment_send,
		onComplete: function(response) {

			var result_1 = response.substring(0,3);
			var answer_1 = response.substring(3);

			//comment saved
			if (result_1 == 'OK-') {

				comment_1 = $('comment');
				if (!comment_1)
					return false;

				comment_1.innerHTML = answer_1;
				

				article_comment_form_1 = $('article_comment_form_id');
				if (!article_comment_form_1)
					return false;

				article_comment_form_1.innerHTML = "<span class='message'>" + text_saved + "<br /><br /><a href='#' onclick='ajax_comment_box("+$("article_id").value+"); return false;'>"+text_another+"</a></span>";

			}

			//user banned temp
			if (result_1 == 'BND')
				span_comment_msg_1.innerHTML = text_bnd;


			//password inavlid
			if (response == 'PWD')
				span_comment_msg_1.innerHTML = text_pwd;

			//comment already sent
			if (response == 'OK')
				span_comment_msg_1.innerHTML = text_sent;

			//user banned
			if (response == 'PND')
				span_comment_msg_1.innerHTML = text_pnd;

			//common error
			if (response == 'ERR')
				span_comment_msg_1.innerHTML = text_err;

			//dirty words error
			if (response == 'DIRTY')
				span_comment_msg_1.innerHTML = text_dirty;

			//user is not activated
			if (response == 'ACT')
				span_comment_msg_1.innerHTML = text_act;
				
			//wrong captcha
			if (response == 'CAP'){
				span_comment_msg_1.innerHTML = text_cap;
				img_src_1 = $('captcha');
				if (!img_src_1)
					return false;
				
				img_src_1.src = "/bin/ajax/generate_captcha.php?r="+r;
			}
		}
	}).request();
}

/**
 * Function returns empty article comment box
 */
function ajax_comment_box(article_id) {

	var url = '/bin/ajax/comment_box.php?article_id='+article_id;

	new Ajax(url, {
		method: "get",
		onComplete: function(response) {
			try	{
				$('comment_form').innerHTML = response;
				reload_user_info();
			} catch (r) {}

		}
	}).request();
}

function show_article_comments(article_id, page, order, max_number) {
	
	if(!max_number)
		max_number = 10;
	
	var url = '/bin/ajax/article_comments.php?article_id=' + article_id + '&page=' + page + '&order=' + order + '&max_number='+ max_number +'&ajax=1';
		
	new Ajax(url, {
		method: 'get',
		onComplete: function(response) {

			article_comment_div = $('article_comment_id');
			if (!article_comment_div)
				return false;
			
			article_comment_div.innerHTML = response;

			window.location.href = '#comment';

			//proceed gemius
			if (response.indexOf('gemius_to_proceed') !=-1 && typeof(gemius_proceed) != 'undefined' ) {
				gemius_proceed();
			}
				
		}
	}).request();

}

function homepage_img_change(browser) {
	$ES('.homepage_button').each ( function (el) {
		curr_browser = el.id.split("_")[1];
		el.src = '/static/shared/img/icons/ico_home_page_'+curr_browser+'_on.gif';
	});
	if (!browser)
		browser = selected_browser;

	$("image_"+browser).src = '/static/shared/img/icons/ico_home_page_'+browser+'_off.gif';

}

function homepage_browser(browser_name)
{
	new Ajax('/bin/ajax/homepage.php?browser='+browser_name, {
		method: 'get',
		encoding: 'utf-8',
		update: $('MBOX_window'),
		onComplete: function () { homepage_insert(browser_name); }
	}).request();

}

function homepage_get_browser()
{
	if (window.ie)
		return "ie";
	if (window.gecko)
		return "ff";
	if (window.webkit)
		return "safari";
	if (window.opera)
		return "opera";

}
//insert text into MBOX
function homepage_insert(browser_name)
{
	if (browser_name=="firefox") browser_name="ff";
	if (browser_name=="explorer") browser_name="ie";

	selected_browser = browser_name;
	homepage_img_change(browser_name);
}

function bookmark_show(siteURL)
{


	if (window.ie)
	{

		var html_body = document.getElementsByTagName('body').item(0);
		var homepage_link = document.createElement('a');
		html_body.appendChild(homepage_link);
		homepage_link.style.display = 'none';

		homepage_link.style.behavior='url(#default#homepage)';
		homepage_link.setHomePage(siteURL);

	}
	else
	{
		// hide for now - not translated yet
		mbox_open(450,200);
		if (window.gecko)
		{
			homepage_browser('firefox');
		}
		else if (window.webkit || window.webkit419 || window.webkit420)
		{
			homepage_browser('safari');
		}
		else if (window.opera == 'Opera')
		{
			homepage_browser('opera');
		}
/*		else if (browser_name == 'Netscape')
		{
			homepage_browser('netscape');
		}*/
		else {
			homepage_browser('explorer');
		}
	}

}


/* Opens MBOX on the webpage
  @author Matej Balantič <matej@balantic.si>
*/
function mbox_open(MBOX_WIDTH,MBOX_HEIGHT,IS_DRAGGABLE)
{
	flash_show(false);

    if ( typeof(IS_DRAGGABLE) == "undefined" )
                IS_DRAGGABLE = true;

	// create holders if there isn't any
	mbox_create_holders( IS_DRAGGABLE );

	left_s = 330 - MBOX_WIDTH/2;
	top_s = window.getScrollTop() +(window.getHeight() - MBOX_HEIGHT)/2;

	// push down if it is still above content
	if (top_s < 230)
		top_s = 230;

	$("MBOX_window").setStyles('left:'+left_s+'px; top: '+top_s+'px; display:block;');
	$("MBOX_dragger").setStyles('left:'+left_s+'px; top: '+top_s+'px; display:block;');

	$("MBOX_overlay").setStyles('display:block;');

	$("MBOX_overlay").setStyles({"height": window.getScrollHeight()+'px', "width": window.getScrollWidth()+'px'});
	$("MBOX_window").setStyles({"width": MBOX_WIDTH+'px'});
	$("MBOX_dragger").setStyles({"width": MBOX_WIDTH+'px'});



	new Fx.Style('MBOX_overlay', 'opacity',{duration: 400, transition: Fx.Transitions.sineInOut}).start(0,0.6);
	new Fx.Style('MBOX_window',  'opacity',{duration: 250, transition: Fx.Transitions.sineInOut, onComplete:function(){  } }).start(0,1);
}


/* closes mbox
  @author Matej Balantič <matej@balantic.si>
*/
function mbox_close()
{

	new Fx.Style('MBOX_overlay', 'opacity',{duration: 400, transition: Fx.Transitions.sineInOut, onComplete:function(){ $("MBOX_overlay").setStyles('display:none;'); }}).start(0.6,0);
	new Fx.Style('MBOX_window',  'opacity',{duration: 250, transition: Fx.Transitions.sineInOut, onComplete:function(  )
		    {
			$("MBOX_window").setStyles('display:none;');
			$("MBOX_window").innerHTML = '';
			flash_show(true);

		    } }).start(1,0);
	$("MBOX_dragger").setStyles({"display": 'none'});

}
/**
 * Shows / hides all FLASH & IFRAME objects on the page
 * @param bool $display True when showing, false when hiding
 * @author Matej Balantič <matej@balantic.si>
 */
function flash_show(display, div_name)
{
	if (display)
	{
		stats = 'visible';
		IS_FLASH_SHOWN = true;
	}
	else
	{
		stats = 'hidden';
		IS_FLASH_SHOWN = false;
	}

	if (window.ie)
		flash_container = 'object';
	else
		flash_container = 'embed';

	// don't set style with mootools; doesn't work in IE6	
	$ES(flash_container,div_name).each ( function (el) {
		el.style.visibility = stats;
	});
	
	$ES('iframe', div_name).each ( function (el) {
		el.style.visibility = stats;
	});
}
/* makes mbox draggable & creates mbox holders
  @author Matej
*/
function mbox_create_holders( is_draggable )
{
	if ($('MBOX_overlay'))
	{
                $("MBOX_overlay").remove();
                $("MBOX_dragger").remove();
                $("MBOX_window").remove();
	}

	include_css('/static/shared/css/mbox.css');
	// CREATE MBOX HOLDERS

	var mbox_overlay = new Element('div', {
		'id' : 'MBOX_overlay'
	})
	.injectInside(document.body);

	var mbox_dragger = new Element('div', {
		'id': 'MBOX_dragger'
	})
	.injectInside(document.body);

	var mbox_window = new Element('div', {
		'id': 'MBOX_window'
	})
	.injectInside(document.body);

	var mbox_window_loading = new Element('div', {
		'id': 'MBOX_loading'
	})
	.injectInside(mbox_window);

	var mbox_window_loading_img = new Element('img', {
		'src': "/static/shared/img/ajax-loader-white.gif",
		'alt': 'Loading'
	})
	.injectInside(mbox_window_loading);

	// CREATE DROP
    if ( is_draggable ) {
		var main_content = $('left');

		mbox_dragger.addEvent('mousedown', function(e) {
			e = new Event(e).stop();
			mbox_window.setStyles({
				'opacity':0.7
			});
			drag = mbox_window.makeDraggable({
				container: main_content
			}); // this returns the dragged element
			drag.start(e); // start the event manual
		});

		mbox_window.addEvent('emptydrop', function() 
		{
			mbox_dragger.setStyles({
				'left': this.getCoordinates().left,
				'top': this.getCoordinates().top
			});
			mbox_window.setStyles({'opacity':1});
			drag.detach();
		});
	}
}

/*
 * Image pool function - auto change images
   @author Matej
 *
*/
 function image_change(div_name, image_array, current_img)
 {
	var container = $(div_name);
	var all_imgs = image_array.length;

	container.empty();
	myImg = new Element("img", {
		src: image_array[current_img]['url'],
		alt: image_array[current_img]['title'],
		title: image_array[current_img]['title']
	})
	.setStyle("border", 0)
	.injectInside(container);

	current_img = current_img+1;
	if (current_img>=all_imgs)
	{
		current_img = 0;
	}

	return current_img;
 }

 //special back functionallty
function back_mod() {

	if (document.referrer != '')
	{
		var host = location.href.split('/');
		if (document.referrer.match(host[2])) //here shold be part of domain, where should be in use normal history
		{
			history.go(-1);	
		} else {
			//fake history to current front page
			location.href = 'http://' + host[2] + '/bin/front.php?section_id='+section_id; 
		}
	}
}

//ajax function for voting
function poll_vote(formx,voteResponse,answerx,tnx_div) {
	
	if (typeof(tnx_div) == 'undefined')
		tnx_div = 'tnx_for_vote';

	formx.answer_id.value = answerx;

	formx.send ({
		encoding: 'UTF-8',
		onComplete: function(response)
		{
			if (voteResponse[response] != 'undefined')
			{
				formx.getElements("div[rel=" + tnx_div + "]")[0].setHTML(voteResponse[response]);
			}
		}
	});
}

/*
Function change font size for article
*/

function change_font_size1(type) {
	
	var resize = 0;
	
	//limit increse to 1
	if (type == 'increase' && default_font_size == 4) {
		return false;
	}

	//limit decrese to 0
	if (type == 'decrease' && default_font_size == 0) {
		return false;	
	}
	
	//set changes
	if (type == 'decrease') {
		default_font_size = parseInt(default_font_size) - 1;
		resize = -2;
	} else if (type == 'increase') {
		default_font_size = parseInt(default_font_size) + 1;
		resize = 2;
	} else if (type == 'default') {
		resize = (1 - default_font_size) * 2;
		default_font_size = 1; 
	} else
		resize = (default_font_size-1) * 2; 
		
	//do resize
	$ES('h1,h2,h3.source1,p,div.summary','article').each ( function (el) {
		temp_size = parseInt(el.getStyle('fontSize')) + resize;
		el.style.fontSize = temp_size+'px';
	});

	//disable buttons
	if (default_font_size == 4) {
		$('increase').innerHTML = '<img src="/static/'+app_lang+'/main/img/backgrounds/zoom_in_font_size.gif" />';
		$('decrease').innerHTML = '<a href="" onclick="change_font_size1(\'decrease\'); return false;">&nbsp;</a>';
		$('default').innerHTML = '<a href="" onclick="change_font_size1(\'default\'); return false;">&nbsp;</a>';
	} else if (default_font_size == 0) {
		$('increase').innerHTML = '<a href="" onclick="change_font_size1(\'increase\'); return false;">&nbsp;</a>';
		$('decrease').innerHTML = '<img src="/static/'+app_lang+'/main/img/backgrounds/zoom_out_font_size.gif"/>';
		$('default').innerHTML = '<a href="" onclick="change_font_size1(\'default\'); return false;">&nbsp;</a>';
	} else if (default_font_size == 1) {
		$('increase').innerHTML = '<a href="" onclick="change_font_size1(\'increase\'); return false;" >&nbsp;</a>';
		$('decrease').innerHTML = '<a href="" onclick="change_font_size1(\'decrease\'); return false;" >&nbsp;</a>';
		$('default').innerHTML = '<img src="/static/'+app_lang+'/main/img/backgrounds/reset_font_size.gif" />';
	} else {
		$('increase').innerHTML = '<a href="" onclick="change_font_size1(\'increase\'); return false;" >&nbsp;</a>';
		$('decrease').innerHTML = '<a href="" onclick="change_font_size1(\'decrease\'); return false;" >&nbsp;</a>';
		$('default').innerHTML = '<a href="" onclick="change_font_size1(\'default\'); return false;" >&nbsp;</a>';
	}
	
	//sets cookie
	var myCookieSize = Cookie.set('default_font_size', default_font_size,{path: '/'});
	
}
