function MM_findObj(n, d) { //v4.01
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function YLink() {
    if($("#YLink").css("display")!="block"){
    $('#YLink').fadeIn("fast");
    $('#YLink').focus();
    }
    else {
    $('#YLink').fadeOut("fast");
    }
};


function RandomPoem(Xwidth,Yheight,divid) {

var scrolledX, scrolledY;
if( self.pageYOffset ) {
scrolledX = self.pageXOffset;
scrolledY = self.pageYOffset;
} else if( document.documentElement && document.documentElement.scrollTop ) {
scrolledX = document.documentElement.scrollLeft;
scrolledY = document.documentElement.scrollTop;
} else if( document.body ) {
scrolledX = document.body.scrollLeft;
scrolledY = document.body.scrollTop;
}

var centerX, centerY;
if( self.innerHeight ) {
centerX = self.innerWidth;
centerY = self.innerHeight;
} else if( document.documentElement && document.documentElement.clientHeight ) {
centerX = document.documentElement.clientWidth;
centerY = document.documentElement.clientHeight;
} else if( document.body ) {
centerX = document.body.clientWidth;
centerY = document.body.clientHeight;
}

var leftOffset = scrolledX + (centerX - Xwidth) / 2;
var topOffset = scrolledY + (centerY - Yheight) / 2;
var o=document.getElementById(divid);
var r=o.style;
r.position='absolute';
r.top = topOffset + 'px';
r.left = leftOffset + 'px';
    if($("#RandomPoem").css("display")!="block"){
    $('#RandomPoem').fadeIn("fast");
    $('#RandomPoem').focus();
    }
    else {
    $('#RandomPoem').fadeOut("fast");
    }
} 

function TellAFriend(lang)
{
	var leftPos = screen.availWidth/2-(400/2);
	var topPos  = screen.availHeight/2-(540/2);
	var tellWin = window.open ("tellafriend-" + lang + ".html", "TellAFriend", 'left=' + leftPos + ', top=' + topPos + ', width=400, height=540, location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=no');
}

function OpenCenterWindow(sUrl,sName,iHeight,iWidth)
{
	var top		= (screen.height-iHeight)/2;
	var left	= (screen.width-iWidth)/2;
	window.open(sUrl,sName,"'status=yes,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=yes,"+"width="+iWidth+",height="+iHeight+",top="+top+",left="+left+"'");
}

function RightClose(id)
{
	tbl = MM_findObj(id);
	if (tbl)
	{
		var display = tbl.style.display ? '' : 'none';
		tbl.style.display = display;
	}
}

function SetFocus(id)
{
	ctl = MM_findObj(id);
	if (ctl)
	{
		ctl.focus();
	}
}

function clickButton(e, buttonid){ 
      var bt = document.getElementById(buttonid); 
      if (typeof bt == 'object'){ 
            if(navigator.appName.indexOf("Netscape")>(-1)){ 
                  if (e.keyCode == 13){ 
                        bt.click(); 
                        return false; 
                  } 
            } 
            if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1)){ 
                  if (event.keyCode == 13){ 
                        bt.click(); 
                        return false; 
                  } 
            } 
      } 
} 

function loadflash(holderid, theurl,width,height) 
{
	holder = MM_findObj(holderid);
	if (holder)
	{
		holder.innerHTML ='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width='+ width +'" height="'+ height +'"><param name="movie" value="'+ theurl +'" \/><param name="quality" value="high" \/><param name="wmode" value="transparent" \/><embed src="'+ theurl + '" width="'+ width + '" height="'+ height + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" \/><\/embed><\/object>';
	}
}


function ShowTip(strTip)
{
	Tip(strTip, BALLOON, true, ABOVE, true, OFFSETX, -10, WIDTH, 360, TEXTALIGN, 'justify', FADEIN, 600, FADEOUT, 600, PADDING, 8);
}

