// javascript functions to handle the display personalization

function switchRsltPerPage(question) {

var usrValue = question;
box = document.getElementById("rpp");
//alert("the box element is  " + box);
var page = "";
page = box.options[box.selectedIndex].text;

 setCookie("rsltPerPage", page, 365, ".tycoelectronics.com", "/");

var currentLocation = window.location.href;

window.location = window.location.href;	

}


function setCookie(c_name, value, expiredays, domain, path)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" + escape(value) + ";expires=" +exdate.toGMTString() + ";domain=" + domain + ";path=" + path + ";"
}

function getCookie(cookie_name) {
	var cookiestring=""+document.cookie;
	var index1=cookiestring.indexOf(cookie_name);
	if (index1==-1 || cookie_name=="") return ""; 
	var index2=cookiestring.indexOf(';',index1);
	if (index2==-1) index2=cookiestring.length; 
	return unescape(cookiestring.substring(index1+cookie_name.length+1,index2));

}

function selectRsltPerPage() {
var box;
if( document.getElementById("rpp"))
	{
		box = document.getElementById("rpp");
	}


rsltPerPage = getCookie("rsltPerPage");


if (( rsltPerPage != null && rsltPerPage !="") && (box != null))
{
	for (i = 0; i < box.options.length; i++) {
		if (box.options[i].value == rsltPerPage || box.options[i].text == rsltPerPage) {
			box.options[i].selected = true;
		} else {
			box.options[i].selected = false;
		}
	}
} 
}

TE_AddToPageLoad('selectRsltPerPage();')




