//======================================
// @Description: 
function small_fontsize(){
	var currentFontSize = jQuery('#content').css('font-size');
	var currentFontSizeNum = parseFloat(currentFontSize, 10);
	var newFontSize = '1.0em';
	var newFontSizeMenus = '1.0em';
	var path = create_path();
	// Change highlighting
	/*$('#resizer .active').removeClass('active');
	$('#small').addClass('active');*/
	// Change Fontsize
	jQuery('#content').css('font-size', newFontSize);
	jQuery('#content').css('line-height', '1.45em');
	
	jQuery('#menus').css('font-size', newFontSizeMenus);
	jQuery('#sidebar').css('font-size', newFontSizeMenus);
	// Ajax Request
	//jQuery.post(path + "wp-content/themes/ikk/js/ajax.php", { fontsize: "small"});
	//alert("Small") ;
	return false;
}

//======================================	
// @Description: 
function default_fontsize(){
	var originalFontSize = jQuery('#content').css('font-size');
	//alert(originalFontSize);
	var originalFontSize = "1.2em";
	var originalFontSizeMenus = "1.2em";
	var path = create_path();
	// Change highlighting
	/*$('#resizer .active').removeClass('active');
	$('#normal').addClass('active');*/
	// Change Fontsize
	jQuery('#content').css('font-size', originalFontSize);
	jQuery('#content').css('line-height', "1.45em");
	
	jQuery('#menus').css('font-size', originalFontSizeMenus);
	jQuery('#sidebar').css('font-size', originalFontSizeMenus);
	// Ajax Request
	//jQuery.post(path + "wp-content/themes/ikk/js/ajax.php", { fontsize: "normal"});
	
	return false;
}

//======================================
// @Description: 
function big_fontsize(){
	var currentFontSize = jQuery('#content').css('font-size');
	var currentFontSizeNum = parseFloat(currentFontSize, 10);
	var newFontSize = '1.4em';
	var newFontSizeMenus = '1.4em';
	var path = create_path();
	// Change highlighting
	/*$('#resizer .active').removeClass('active');
	$('#big').addClass('active');*/
	// Change Fontsize
	jQuery('#content').css('font-size', newFontSize);
	jQuery('#content').css('line-height', '1.5em');
	
	jQuery('#menus').css('font-size', newFontSizeMenus);
	jQuery('#sidebar').css('font-size', newFontSizeMenus);
	// Ajax Request
	//jQuery.post(path + "wp-content/themes/ikk/js/ajax.php", { fontsize: "big"});
	
	return false;
}


//======================================
// @Description: 
function create_path(){
	var counter = 0;
	var path = '';
	url = window.location.href;
	for(i=0;i<url.length;i++) {
		if (url[i] == '/') counter++
		if (counter > 3) {
			path = path + '../';
		}
	}
	return path;
}


function default_val(id, value) {
	jQuery('#'+id).click(function(){
		if (jQuery('#'+id).val() == value) jQuery('#'+id).val('');
	});
	jQuery('#'+id).blur(function(){
		if (jQuery('#'+id).val() == '') jQuery('#'+id).val(value);
	});
	if (jQuery('#'+id).val() == '') jQuery('#'+id).val(value);
}

linklabel = function (el, str, link)
{
	jQuery(el).each(function(){
		this.innerHTML = this.innerHTML.replace(
			new RegExp(str, "g"),
			"<a target=\"_blank\" class=\"fancy\" href=\"" + link + "\">" + str + "</a>"
		);		
	})
};


/*=onDOMready
======================================*/
jQuery(function(){	
	/* FANCY BOX */
	jQuery('#content a:has(img)').fancybox();
	jQuery('.fancy').fancybox({
		'frameWidth': 700,
		'frameHeight': 500,
		'hideOnContentClick' : false
	});
	jQuery('.fancyform').fancybox({
		'frameWidth': 480,
		'frameHeight': 500,
		'hideOnContentClick' : false
	});
	linklabel('label', "Datenschutz-Erklärung", "https://www.ikk-suedwest.de/datenschutz/");
	linklabel('label', "Datenschutzerklärung", "https://www.ikk-suedwest.de/datenschutz/");
	linklabel('label', "Teilnahmebedingungen", "https://www.ikk-suedwest.de/teilnahmebedingungen/");
	
	var postId = $(".post").attr("id");
	if('post-12908' == postId)
		linklabel('label', "Teilnahmebedingungen", "https://www.ikk-suedwest.de/teilnahmebedingungen-2/");
	else
		linklabel('label', "Teilnahmebedingungen", "https://www.ikk-suedwest.de/teilnahmebedingungen/");
		
	// default_val('s', 'Suche')
});
