// JavaScript Document

$(document).ready(function() {		
		$("#siteselector").change( function() { if($(this).val()!=''){location.href=$(this).val();} } );
		
		//var a = $("body").html();		
		//a = replaceAll(a, "&reg;", "<sup>&reg;</sup>");	
		//a = replaceAll(a, "®", "<sup>&reg;</sup>");	
		//a = replaceAll(a, "&#174;", "<sup>&reg;</sup>");	
		//a = replaceAll(a, "(r)", "<sup>&reg;</sup>");	
		//a = replaceAll(a, "%ef%bf%bd", "<sup>&reg;</sup>");	
		//a = replaceAll(a, utf8("®"), "<sup>&reg;</sup>");	
		//alert(utf8("®"));
		//alert("®");
		//alert(a);
		//$("body").html(a);
		
});

function replaceAll(oldStr,findStr,repStr) {
	var srchNdx = 0;  // srchNdx will keep track of where in the whole line
	// of oldStr are we searching.
	var newStr = "";  // newStr will hold the altered version of oldStr.
	while (oldStr.indexOf(findStr,srchNdx) != -1)  
	// As long as there are strings to replace, this loop
	// will run. 
	{
		newStr += oldStr.substring(srchNdx,oldStr.indexOf(findStr,srchNdx));
		// Put it all the unaltered text from one findStr to
		// the next findStr into newStr.
		newStr += repStr;
		// Instead of putting the old string, put in the
		// new string instead. 
		srchNdx = (oldStr.indexOf(findStr,srchNdx) + findStr.length);
		// Now jump to the next chunk of text till the next findStr.           
	}
	newStr += oldStr.substring(srchNdx,oldStr.length);
	// Put whatever's left into newStr.             
	return newStr;
}

function utf8(text) 
{
    // NB this function is valid up to uFFFF; would need extending
    // for >2 byte characters 
    var enc = "";
    for(var pos=0; pos<text.length; pos++)
    {
        var c=text.charCodeAt(pos);
	if (c<128)
	{
	    enc += escape(text.charAt(pos));
	}
	else if(c<2048)
	{
	    enc += hex((c>>6)|192);
	    enc += hex((c&63)|128);
	}
	else
	{
	    enc += hex((c>>12)|224);
	    enc += hex(((c>>6)&63)|128);
	    enc += hex((c&63)|128);
	}
    }
    return enc;
}

function hex(n)
{
    lcdigits=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");
	return "%"+lcdigits[n>>4]+lcdigits[n&15];
}

