
/*
 * Script to Increase and decrease
 * text size, with cookie support
 */


$(document).ready(function(){
	
	// reset font to normal size
	var originalFontSize = $('html').css('font-size');
	$(".default").click(function(){
		$('html').css('font-size', originalFontSize);
		$.cookie('TextSize', originalFontSize, { expires:7})
	});
	
	// If cookie exists set font size on page load from cookie
	if($.cookie("TextSize")) {
																				// fix for having multiple px's
		$('html').css('font-size', $.cookie("TextSize") + ($.cookie("TextSize").indexOf("px")!=-1 ? "" : "px"));
	// else create it
	} else {
		$.cookie('TextSize', originalFontSize);
	}
	
	// increase size and save to cookie
	$(".increase").click(function(){
		var currentFontSize = $('html').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		var newFontSize = currentFontSizeNum*1.2;
		$('html').css('font-size', newFontSize);
		$.cookie('TextSize', newFontSize, { expires:7})
		return false;
	});

	// decrease size and save to cookie
	$(".decrease").click(function(){
		var currentFontSize = $('html').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		var newFontSize = currentFontSizeNum*0.8;
		$('html').css('font-size', newFontSize);
		$.cookie('TextSize', newFontSize, { expires:7})
		return false;
	});

});


//Disclaimer

var path = "";
function ReadCookie(cookieName) {
    var theCookie = "" + document.cookie;
    var ind = theCookie.indexOf(cookieName);
    if (ind == -1 || cookieName == "") return "";
    var ind1 = theCookie.indexOf(';', ind);
    if (ind1 == -1) ind1 = theCookie.length;
    return unescape(theCookie.substring(ind + cookieName.length + 1, ind1));
}
function fnDisclaimer(str) {
    CurrPath = ReadCookie('Path')
    if (str == 'TRUE') {
        document.cookie = "Disclaimer=TRUE";
        window.location.href = CurrPath;
    }
    else {
        document.cookie = "Disclaimer=FALSE";
        window.location.href = 'private-wealth-management.aspx';
    }


}
function fnonloadtest(str) {
    document.cookie = "Path=" + window.location;
    str = str.replace('amp;', '');
    ResultFlag = ReadCookie('Disclaimer')
    if (ResultFlag != 'TRUE')
        window.location.href = str;
}
function fnonloadCreate() {
    ResultFlag = ReadCookie('Disclaimer')
    if (ResultFlag == "")
        document.cookie = "Disclaimer=FALSE";


} // JavaScript Document
