
function toggleTextOut(e,txtval) {
	if(e.value=="") e.value = txtval;

}
function toggleTextIn(e,txtval) {
	if(e.value==txtval) e.value="";
	else e.select();
}
function searchboxValidate(id){
	sb = document.getElementById(id).value;
	if(sb=="Enter keyword..."){
	alert('Please enter a search query');
	document.getElementById(id).focus();
	return false;
	}
	return true;
}
$(document).ready(function() {
		 /*Global navigation hover effect IE*/
		$("#nav-global li").mouseover(function() {
			$(this).addClass("hover");
		});
		$("#nav-global li").mouseout(function() {
			$(this).removeClass("hover");
		});

	});

$( function () {
	
		$('#nav-left h3').click(function() {
		var cs=this.className;
		$('#nav-left h3').next('div:visible').slideUp();
		//$('#comments h4').removeClass('selected');
		$('#nav-left h3').addClass('selected');
		
		
		if(cs=="minus")
		{
		this.className="plus";
		}
		else{
			$('#nav-left h3').removeClass('selected');
			this.className="selected";
		$(this).next('div').slideDown( "slow");}
		});
		
	
});


function increaseFont(){

	// get the current value from the cookie

	var cv1 = readCookie("ihtuserdata");

	cookieValues = parseCookie(cv1);

	var currentFontSize = parseInt(cookieValues[0]);

	var newFontSize = currentFontSize + 1;

	if (newFontSize > 17){

		newFontSize = 10;

	}

	// save new value in the cookie

	var cv = "fontSize:" + newFontSize;

	createCookie("ihtuserdata",cv,7);



	// re-draw article

	obj = document.getElementById("content");

	obj.style.fontSize = newFontSize + "px";

}



// increases the font and adjusts the article layout

function decreaseFont(){

	// get the current value from the cookie

	var cv1 = readCookie("ihtuserdata");

	cookieValues = parseCookie(cv1);

	var currentFontSize = parseInt(cookieValues[0]);

	var newFontSize = currentFontSize - 1;

	if (newFontSize < 10){

		newFontSize = 10;

	}

	// save new value in the cookie

	var cv = "fontSize:" + newFontSize;

	createCookie("ihtuserdata",cv,7);

	// re-draw article

	obj = document.getElementById("content");

	obj.style.fontSize = newFontSize + "px";

}



function articleSetup(){

	// get the fontSize value from the cookie

	var cv1 = readCookie("ihtuserdata");

	cookieValues = parseCookie(cv1);

	var fontSize = cookieValues[0];

	var parentDiv = document.getElementById("content");

	if(parentDiv) {

	parentDiv.style.fontSize = fontSize + "px";

	}

}



function initArticle(){

	if (document.getElementById("content") != null){

		articleSetup();

	}

}


// creates a cookie with the given parameters

function createCookie(name,value,days){

	if (days){

		var date = new Date();

		date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));

		var expires = "; expires=" + date.toGMTString();

	} else {

		var expires = "";

	}

	document.cookie = name + "=" + value + expires + "; path=/";

}



// locates and reads the value of a cookie with a specified name

function readCookie(name){

	var nameEQ = name + "=";

	var ca = document.cookie.split(';');

	for(var i=0;i < ca.length;i++)	{

		var c = ca[i];

		while (c.charAt(0)==' ') c = c.substring(1,c.length);

		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);

	}

	return null;

}



// deletes a cookie with a specified name

function eraseCookie(name){

	createCookie(name,"",-1);

}

function parseCookie(cookievalues){

	if (cookieValues.length > 0){

		var cookieValuesArray = new Array(3);

		var CookiesArray = cookievalues.split("&");

		for (var i = 0; i < CookiesArray.length; i++){

			var v = CookiesArray[i].split(":");

			cookieValuesArray[i] = v[1];

		}

		return cookieValuesArray;

	} else {

		return null;

	}

}



var cookieValues = new Array(3);

var cv = readCookie("ihtuserdata");

if (cv){

	cookieValues = parseCookie(cv);



} else {

	createCookie("ihtuserdata","fontSize:13",7);

	cv = readCookie("ihtuserdata");

	if (cv){

		// the cookie was created, parse the values

		cookieValues = parseCookie(cv);

	} else {

			cookieValues[0] = "13"; // font size

	}

}