function show_hide(Table)
{
	if(Table.style.display=="none")
	{
		Table.style.display="";
	}
	else
	{
		Table.style.display="none";
	}
}


current=0;
function secBoard(n)
{
	for(i=1;i<4;i++)
	{	
		eval("document.getElementById('cl0"+i+"').className='s02'");
	}
eval("document.getElementById('cl0"+n+"').className='s01'");
eval("document.getElementById('secTable')");
current=n;
for(i=1;i<4;i++)

eval("tbx0"+i+".style.display='none'");
eval("tbx0"+n+".style.display='block'");

}

function changebg(n)
{
for(i=1;i<4;i++)
{
	eval("document.getElementById('cl0"+i+"').className='s02'");
}
if (current!=n)
{
	eval("document.getElementById('cl0"+n+"').className='s01'");
}
}

function resetbg(obj,n)
{
if (current!=n)
	{
	eval("obj.className='s02'");
	}
}

/****************************************************************************************************/
/*

	cookies handy functions

*/
function setCookie(name, value)
         {
         //If name is the empty string, it places a ; at the beginning
         //of document.cookie, causing clearCookies() to malfunction.
         if(name != '')
            document.cookie = name + '=' + value;
         }

function getCookie(name)
         {
         //Without this, it will return the first value 
         //in document.cookie when name is the empty string.
         if(name == '')
            return('');
         
         name_index = document.cookie.indexOf(name + '=');
         
         if(name_index == -1)
            return('');
         
         cookie_value =  document.cookie.substr(name_index + name.length + 1, 
                                                document.cookie.length);
         
         //All cookie name-value pairs end with a semi-colon, except the last one.
         end_of_cookie = cookie_value.indexOf(';');
         if(end_of_cookie != -1)
            cookie_value = cookie_value.substr(0, end_of_cookie);

         //Restores all the blank spaces.
         space = cookie_value.indexOf('+');
         while(space != -1)
              { 
              cookie_value = cookie_value.substr(0, space) + ' ' + 
              cookie_value.substr(space + 1, cookie_value.length);
							 
              space = cookie_value.indexOf('+');
              }

         return(cookie_value);
         }

function clearCookie(name)
         {                  
         expires = new Date();
         expires.setYear(expires.getYear() - 1);

         document.cookie = name + '=null' + '; expires=' + expires; 		 
         }
         
function clearCookies()
         {
         Cookies = document.cookie;
         Cookie = Cookies;
         expires = new Date();
         expires.setYear(expires.getYear() - 1);

         while(Cookie.length > 0)
              {
              //All cookie name-value pairs end with a semi-colon, except the last one.
              Cookie = Cookies.substr(0, Cookies.indexOf(';'));
              Cookies = Cookies.substr(Cookies.indexOf(';') + 1, Cookies.length);

              if(Cookie != '')
                 document.cookie = Cookie + '; expires=' + expires;
              else
                 document.cookie = Cookies + '; expires=' + expires;			  			  	  
              }		 		 
         }
/****************************************************************************************************/
/*

	decode cookies values

*/
function decode64(input) {
    var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
    var output = "";
    var chr1, chr2, chr3;
    var enc1, enc2, enc3, enc4;
    var i = 0;
    // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
    input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
    flag = 0; // flag of Bytes follows.
    ucs2_code = 0;
    do {
        enc1 = keyStr.indexOf(input.charAt(i++));
        enc2 = keyStr.indexOf(input.charAt(i++));
        enc3 = keyStr.indexOf(input.charAt(i++));
        enc4 = keyStr.indexOf(input.charAt(i++));
        chr1 = (enc1 << 2) | (enc2 >> 4);
        chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
        chr3 = ((enc3 & 3) << 6) | enc4;
        if ( chr1 <= 0x80) {
            // single byte ASCII, output directly
        ucs2_code = chr1;
        } else if (chr1 <= 0xC0) {
            // multi byte --flag;
                if (flag ==1)
                {
                    ucs2_code += ( chr1-0x80 ) << 6;
                }else {
                    ucs2_code += chr1-0x80;
                }
        } else if (chr1 <= 0xE0)
         {
                 // double byte utf-8 encoding
        flag = 1;
                ucs2_code = ( chr1-0xC0 ) << 6;
        } else if (chr1 <=0xF0)
        {
             // triple byte utf-8 encoding
        flag = 2;
                ucs2_code = ( chr1-0xE0 ) << 12;
        }
        if (flag == 0)
        {
            output = output + String.fromCharCode(ucs2_code);
        }
      if (enc3 != 64) {
        if ( chr2 <= 0x80) {
            ucs2_code = chr2;
        } else if (chr2 <= 0xC0)
        {
            --flag;
             if (flag == 1)
            {
                ucs2_code += ( chr2-0x80 ) << 6;
            }else {
                ucs2_code += chr2-0x80;
            }
        } else if (chr2 <= 0xE0)
         {
            flag = 1;
            ucs2_code = ( chr2-0xC0 ) << 6;
        } else if (chr2 <=0xF0)
         {
            flag = 2;
            ucs2_code = ( chr2-0xE0 ) << 12;
        }
        if (flag == 0)
         {
            output = output + String.fromCharCode(ucs2_code);
        }
    }
    if (enc4 != 64) {
        if ( chr3 <= 0x80) {
            ucs2_code = chr3;
        } else if (chr3 <= 0xC0)
        {
            --flag;
            if (flag==1)
            {
                ucs2_code += ( chr3-0x80 ) << 6;
            }else {
            ucs2_code += chr3-0x80;
             }
        } else if (chr3 <= 0xE0)
        {
            flag = 1;
            ucs2_code = ( chr3-0xC0 ) << 6;
        } else if (chr3 <=0xF0)
        {
            flag = 2;
            ucs2_code = ( chr3-0xE0 ) << 12;
        }
        if (flag == 0)
        {
            output = output + String.fromCharCode(ucs2_code);
        }
    }
} while (i < input.length);
    return output;
}
/****************************************************************************************************/









