function set_cookie(name,value) {
		expire_date = new Date();
		in_one_year = expire_date.getTime() + (365 * 24 * 60 * 60 * 1000);
		expire_date.setTime(in_one_year);
		document.cookie = name + "=" + value + "; expires=" + expire_date.toGMTString() + ";path=/;";
}

function read_cookie_value(cookie_name) {
		if(document.cookie.match(cookie_name)) {
				cookie_name_length = cookie_name.length;
				var cookie_position = document.cookie.indexOf(cookie_name);
				var start_value_reading = cookie_position + cookie_name_length + 1;
				var interim_value = document.cookie.substr(start_value_reading);
				var position_next_separator = interim_value.indexOf(";");

				if(position_next_separator != "-1") {
						var stop_value_reading = position_next_separator;
						var cookie_value = document.cookie.substr(start_value_reading,stop_value_reading);
				} else {
						var cookie_value = document.cookie.substr(start_value_reading);
				}
				return cookie_value;
		}
}

function change_body_font(span) {
		var font_size = span.substr(5,7);
		var new_font_size = font_size.replace("_",".");
		set_cookie("accessibility_font_size",new_font_size);
		location.reload();
}

function show_font_switcher_de() {
		document.write("<span id=\"font_switcher\">");
		document.write("<span><dfn>3:<\/dfn><a href=\"javascript:history.go(0)\" id=\"font_1_2\" onclick=\"change_body_font(this.id);\" onkeypress=\"this.onclick\" title=\"gro&szlig;e Schriftgr&ouml;&szlig;e\">A<\/a><\/span>");
		document.write("<span><dfn>2:<\/dfn><a href=\"javascript:history.go(0)\" id=\"font_1_0\" onclick=\"change_body_font(this.id);\" onkeypress=\"this.onclick\" title=\"normale Schriftgr&ouml;&szlig;e\">A<\/a> <\/span>");
		document.write("<span><dfn>1:<\/dfn><a href=\"javascript:history.go(0)\" id=\"font_0_85\" onclick=\"change_body_font(this.id);\" onkeypress=\"this.onclick\" title=\"kleine Schriftgr&ouml;&szlig;e\">A<\/a> <\/span>");
		document.write("<\/span>");
}

function show_font_switcher() {
	/*
		document.write("<span id=\"font_switcher\">");
		document.write("<span style=\"font-size:1.2em\"><dfn>3:<\/dfn><a href=\"javascript:history.go(0)\" id=\"font_1_2\" onclick=\"change_body_font(this.id);\" onkeypress=\"this.onclick\" title=\"big fontsize\">A<\/a> <\/span>");
		document.write("<span style=\"font-size:1em\"><dfn>2:<\/dfn><a href=\"javascript:history.go(0)\" id=\"font_1_0\" onclick=\"change_body_font(this.id);\" onkeypress=\"this.onclick\" title=\"medium fontsize\">A<\/a> <\/span>");
		document.write("<span style=\"font-size:0.85em\"><dfn>1:<\/dfn><a href=\"javascript:history.go(0)\" id=\"font_0_85\" onclick=\"change_body_font(this.id);\" onkeypress=\"this.onclick\" title=\"small fontsize\">A<\/a> <\/span>");
		document.write("<\/span>");
	 */
	document.write("<span id=\"font_switcher\">");
	//alert('#'+read_cookie_value("accessibility_font_size")+'#');
	if(read_cookie_value("accessibility_font_size")=='1.0') document.write("<span style=\"font-size:1em;\"><dfn>1:<\/dfn><a style=\"color:#6D9537;text-decoration:underline;\" href=\"javascript:history.go(0)\" id=\"font_1_0\" onclick=\"change_body_font(this.id);\" onkeypress=\"this.onclick\" title=\"small fontsize\">A<\/a> <\/span>");
	else document.write("<span style=\"font-size:1em\"><dfn>1:<\/dfn><a href=\"javascript:history.go(0)\" id=\"font_1_0\" onclick=\"change_body_font(this.id);\" onkeypress=\"this.onclick\" title=\"small fontsize\">A<\/a> <\/span>");

	if(read_cookie_value("accessibility_font_size")=='1.15') document.write("<span style=\"font-size:1.15em\"><dfn>2:<\/dfn><a style=\"color:#6D9537;text-decoration:underline;\" href=\"javascript:history.go(0)\" id=\"font_1_15\" onclick=\"change_body_font(this.id);\" onkeypress=\"this.onclick\" title=\"medium fontsize\">A<\/a> <\/span>");
	else document.write("<span style=\"font-size:1.15em\"><dfn>2:<\/dfn><a href=\"javascript:history.go(0)\" id=\"font_1_15\" onclick=\"change_body_font(this.id);\" onkeypress=\"this.onclick\" title=\"medium fontsize\">A<\/a> <\/span>");

	if(read_cookie_value("accessibility_font_size")=='1.3') document.write("<span style=\"font-size:1.3em\"><dfn>3:<\/dfn><a style=\"color:#6D9537;text-decoration:underline;\" href=\"javascript:history.go(0)\" id=\"font_1_3\" onclick=\"change_body_font(this.id);\" onkeypress=\"this.onclick\" title=\"big fontsize\">A<\/a> <\/span>");
	else document.write("<span style=\"font-size:1.3em\"><dfn>3:<\/dfn><a href=\"javascript:history.go(0)\" id=\"font_1_3\" onclick=\"change_body_font(this.id);\" onkeypress=\"this.onclick\" title=\"big fontsize\">A<\/a> <\/span>");
		document.write("<\/span>");

}

function printCookies(w){
	cStr = "";
	pCOOKIES = new Array();
	pCOOKIES = document.cookie.split('; ');
	for(bb = 0; bb < pCOOKIES.length; bb++){
		NmeVal  = new Array();
		NmeVal  = pCOOKIES[bb].split('=');
		if(NmeVal[0]){
			cStr += NmeVal[0] + '=' + unescape(NmeVal[1]) + '; ';
		}
	}
	return cStr;
}


function apply_accessibility_font() {
		cookie_value = read_cookie_value("accessibility_font_size");
		document.getElementById("maincontainer").style.fontSize = cookie_value + "em";
		//alert(printCookies() + ' - ' + document.getElementById("maincontainer").style.fontSize);
}


/*
 * This function are used to show and hide map
 */

function Show_hide_map(map_obj,link_obj){
	if(map_obj.style.display!='none'){
		map_obj.style.display='none';
		link_obj.innerHTML="PEER locations";
	}else{
		map_obj.style.display='block';
		link_obj.innerHTML="close map";
	}
}

function toggle_display(obj){
	if(obj.style.display!='none') obj.style.display='none';
	else obj.style.display='block';
}

/*
 * This function is used to detect screen height and width
 */

function getWindowDimentions(str){
	var myWidth = 0, myHeight = 0;
		if( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			myWidth = window.innerWidth;
			myHeight = window.innerHeight;
		} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
		} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
		}
		//window.alert( 'Width = ' + myWidth );
		//window.alert( 'Height = ' + myHeight );
		return myHeight;
}

//call: setFooterToBottom(document.getElementById('maincontainer'));
function setFooterToBottom(divElement){
	var minHeight = getWindowDimentions('height');
	if(minHeight>document.getElementById('content').clientHeight){
		//alert(minHeight+' - '+document.getElementById('header').clientHeight+' - '+(document.getElementById('servicemenu').clientHeight+document.getElementById('search').clientHeight));
		//minHeight = minHeight-(2.5*document.getElementById('header').clientHeight);
		minHeight = minHeight-22-(document.getElementById('servicemenu').clientHeight+document.getElementById('search').clientHeight+document.getElementById('footer').clientHeight+document.getElementById('menu-div').clientHeight)
		if(document.getElementById('breadcrump')) minHeight = minHeight-document.getElementById('breadcrump').clientHeight-10;
		//alert(minHeight);
		minHeight = minHeight-146;
		divElement.style.minHeight=minHeight+'px';
	}else{
		divElement.style.minHeight=document.getElementById('content').clientHeight+'px';
	}
	divElement.style.height='100%';
}

/*
document.body.onresize = function (){
	alert("Thanks for resizing!");
}

onResize="alert('Thanks For Resizing');"
*/

/*------------------------------------------------------------
Document Text Sizer- Copyright 2003 - Taewook Kang.  All rights reserved.
Coded by: Taewook Kang (txkang.REMOVETHIS@hotmail.com)
Web Site: http://txkang.com
Script featured on Dynamic Drive (http://www.dynamicdrive.com)

Please retain this copyright notice in the script.
License is granted to user to reuse this code on
their own website if, and only if,
this entire copyright notice is included.
--------------------------------------------------------------*/

//Specify affected tags. Add or remove from list:
var tgs = new Array( 'div','td','tr');

//Specify spectrum of different font sizes:
var szs = new Array( 'xx-small','x-small','small','medium','large','x-large','xx-large' );
var startSz = 2;

function ts( trgt,inc ) {
if (!document.getElementById) return
var d = document,cEl = null,sz = startSz,i,j,cTags;

sz += inc;
if ( sz < 0 ) sz = 0;
if ( sz > 6 ) sz = 6;
startSz = sz;

if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

cEl.style.fontSize = szs[ sz ];

for ( i = 0 ; i < tgs.length ; i++ ) {
	cTags = cEl.getElementsByTagName( tgs[ i ] );
	for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
}
}


