if (window.addEventListener)
   window.addEventListener("resize", resized, false)
else if (window.attachEvent)
   window.attachEvent("onresize", resized)
else if (document.getElementById)
   window.onresize=resized;

function resized() {

   var screenHeight,screenWidth;

   if(self.innerHeight > 0) {
      screenWidth = self.innerWidth;
      screenHeight = self.innerHeight;
   } else if(document.documentElement.clientWidth > 0) {
      screenWidth = document.documentElement.clientWidth;
      screenHeight = document.documentElement.clientHeight;
   } else  {
      screenWidth = document.body.offsetWidth;
      screenHeight = document.body.offsetHeight;
   }


   if(screenWidth < 770) {
       document.getElementById('frame').style.marginLeft = '0px';
       document.getElementById('frame').style.left = '20px';
   } else {
       document.getElementById('frame').style.marginLeft = '-375px';
       document.getElementById('frame').style.left = '50%';
   }

   if(screenHeight < 570) {
       document.getElementById('frame').style.marginTop = '0px';
       document.getElementById('frame').style.top = '20px';
  } else {
       document.getElementById('frame').style.marginTop = '-275px';
       document.getElementById('frame').style.top = '50%';
  }
      
}

	function changeContent(id,shtml) {
   	  if (document.getElementById || document.all) {
      	    var el = document.getElementById? document.getElementById(id): document.all[id];
      	    if (el && typeof el.innerHTML != "undefined") el.innerHTML = shtml;
            
          }
   	}

function getMessage() {
    var qs = location.search.substring(1);
    var nv = qs.split('&');
    var url = new Object();
    
    for(i = 0; i < nv.length; i++) {
               eq = nv[i].indexOf('=');
               url[nv[i].substring(0,eq).toLowerCase()] = unescape(nv[i].substring(eq +1));
     }
     return url['message'];
}

// ====================================================================
//       URLEncode and URLDecode functions
//
// Copyright Albion Research Ltd. 2002
// http://www.albionresearch.com/
//
// You may copy these functions providing that 
// (a) you leave this copyright notice intact, and 
// (b) if you use these functions on a publicly accessible
//     web site you include a credit somewhere on the web site 
//     with a link back to http://www.albionresarch.com/
//
// If you find or fix any bugs, please let us know at albionresearch.com
//
// SpecialThanks to Neelesh Thakur for being the first to
// report a bug in URLDecode() - now fixed 2003-02-19.
// ====================================================================


function URLDecode(encoded)
{
   // Replace + with ' '
   // Replace %xx with equivalent character
   // Put [ERROR] in output if %xx is invalid.
   var HEXCHARS = "0123456789ABCDEFabcdef"; 
   var plaintext = "";
   var i = 0;
   while (i < encoded.length) {
       var ch = encoded.charAt(i);
	   if (ch == "+") {
	       plaintext += " ";
		   i++;
	   } else if (ch == "%") {
			if (i < (encoded.length-2) 
					&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1 
					&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
				plaintext += unescape( encoded.substr(i,3) );
				i += 3;
			} else {
				alert( 'Bad escape combination near ...' + encoded.substr(i) );
				plaintext += "%[ERROR]";
				i++;
			}
		} else {
		   plaintext += ch;
		   i++;
		}
	} // while
   return plaintext;
}


