
    var openingtimer=null;
    var thisOpeningObject=null;
    var thisOpeningObjectHeight=0;
    var thisOpeningObjectOpacity=0;
    var closingtimer=null;
    var thisClosingObject=null;
    var thisClosingObjectHeight=0;
    var thisClosingObjectOpacity=0;
    var searchGAN=true;
    var searchBlog=true;
    var searchForum=true;

/************************************************************\
*   id = the element id of the whole box
*   boxwidth = width of the containing element
*   content = the html content of the box
*   zindex = if not NULL then the box is positioned absolutely with z-index:zindex
\************************************************************/
function returnRoundedBox(id,boxwidth,content,zindex,stylePrefix)
{
    boxStyle="";
    if (boxwidth!=null) boxStyle+="width:"+boxwidth+"px;";
    if (zindex!=null) boxStyle+="position:absolute;z-index:"+zindex;
    toInsert="<div id=\""+id+"\" style=\"overflow: visible;"+boxStyle+"\"\ ><b class=\""+stylePrefix+"1f\"></b><b class=\""+stylePrefix+"2f\"></b><b class=\""+stylePrefix+"3f\"></b><b class=\""+stylePrefix+"4f\"></b>";
    toInsert+="<div class=\""+stylePrefix+"contentf\"><center><table><tr><td>"+content+"</td></tr></table></center></div><b class=\""+stylePrefix+"4f\"></b><b class=\""+stylePrefix+"3f\"></b><b class=\""+stylePrefix+"2f\"></b><b class=\""+stylePrefix+"1f\"></b></div>";
    return toInsert;
}

/************************************************************\
*   id = the element id of the whole box
*   boxwidth = width of the containing element
*   content = the html content of the box
*   zindex = if not NULL then the box is positioned absolutely with z-index:zindex
\************************************************************/
function returnRoundedBottomBox(id,boxwidth,content,zindex,stylePrefix)
{
    boxStyle="";
    if (boxwidth!=null) boxStyle+="width:"+boxwidth+"px;";
    if (zindex!=null) boxStyle+="position:absolute;z-index:"+zindex;
    toInsert="<div id=\""+id+"\" style=\""+boxStyle+"\"\ >";
    toInsert+="<div class=\""+stylePrefix+"contentf\">"+content+"</div><b class=\""+stylePrefix+"b4f\"></b><b class=\""+stylePrefix+"b3f\"></b><b class=\""+stylePrefix+"b2f\"></b><b class=\""+stylePrefix+"b1f\"></b></div>";
    return toInsert;
}

/************************************************************\
* Display a tabbed section
\************************************************************/
function displayItem(srcObj)
{
    divBlock=document.getElementById(srcObj.id+"Block");
    divBlock.style.display="block";
    pattern=/Block/;
    for (i=0;i<divBlock.parentNode.childNodes.length;i++) {
        kid=divBlock.parentNode.childNodes.item(i);
        if (pattern.test(kid.id) && kid!=divBlock && kid.style.display=="block") kid.style.display="none";
    }
    pattern=/tab/;
    for (i=0;i<srcObj.parentNode.childNodes.length;i++) {
        kid=srcObj.parentNode.childNodes.item(i);
        if (pattern.test(kid.className)) {
            if (kid!=srcObj) {
                kid.onmouseover=function() {setMyClass(this,'tabover');}
                kid.onmouseout=function() {setMyClass(this,'taboff');}
                kid.onclick=function() {displayItem(this);}
                kid.className="taboff";
            }else{
                kid.onmouseover="";
                kid.onmouseout="";
                kid.onclick="";
                kid.className="tabon";
            }
        }
    }
}
/************************************************************\
* Display a tabbed section
\************************************************************/
function displayTabItem(callingObj)
{
    srcObj=callingObj;
    divBlock=document.getElementById(srcObj.id+"Block");
    divBlock.style.display="block";
    pattern=/Block/;
    for (i=0;i<divBlock.parentNode.childNodes.length;i++) {
        kid=divBlock.parentNode.childNodes.item(i);
        if (pattern.test(kid.id) && kid!=divBlock && kid.style.display=="block") kid.style.display="none";
    }
    pattern=/tab/;
    for (i=0;i<srcObj.parentNode.childNodes.length;i++) {
        kid=srcObj.parentNode.childNodes.item(i);
        //alert(kid.tagName);
        if (kid.tagName.toLowerCase()=="table") {
            if (kid!=callingObj) {
                kid.onmouseover=function() {setTabClass(this,'roomoffover');}
                kid.onmouseout=function() {setTabClass(this,'roomoff');}
                kid.onclick=function() {displayTabItem(this);}
                kid.className="roomoff";
            }else{
                callingObj.onmouseover="";
                callingObj.onmouseout="";
                callingObj.onclick="";
                kid.className="roomon";
            }
        }
    }
}
function setMyClass(srcObj,newClass) {
    srcObj.className=newClass;
}
function setTabClass(srcObj,newClass) {
    srcObj.className=newClass;
}
/************************************************************\
* Expand a menu block
\************************************************************/
function expandMenu(srcObj)
{
    divBlock=document.getElementById(srcObj.id+"Block");
    arrowObj=document.getElementById(srcObj.id+"arrow");
    if (divBlock.style.display=="none") {
        pattern=/Block/;
        for (i=0;i<srcObj.parentNode.childNodes.length;i++) {
            kid=srcObj.parentNode.childNodes.item(i);
            if (pattern.test(kid.id) && kid!=divBlock && kid.style.display=="block") closeBlock(kid);
        }
        openBlock(divBlock);
        //divBlock.style.display="block";
        //arrowObj.src="/skin/collapse.gif";
    }else{
        closeBlock(divBlock);
    }
}
function collapseBlock(blockObj) {
    document.getElementById(blockObj.id.replace(/Block/,"arrow")).src="/skin/expand.gif";
    blockObj.style.display="none";
}
function toggleSearchBlock(srcObj) {
    divBlock=document.getElementById(srcObj.id+"Block");
    if (divBlock.style.display=="none") {
        divBlock.style.display="block";
        srcObj.innerHTML="Less...";
        //startFadeIn(divBlock);
        //openBlock(divBlock);
    }else{
        divBlock.style.display="none";
        srcObj.innerHTML="More...";
        //startFadeOut(divBlock);
        //closeBlock(divBlock);
    }


}
/************************************************************\
*
\************************************************************/
function hexColourFromRGB(r,g,b)
{
    var hexr=r.toString(16);
    if (hexr.length==1) hexr="0"+hexr;
    var hexg=g.toString(16);
    if (hexg.length==1) hexg="0"+hexg;
    var hexb=b.toString(16);
    if (hexb.length==1) hexb="0"+hexb;
    return hexr+hexg+hexb;
    //return r+" "+g+" "+b;
}
/************************************************************\
*
\************************************************************/
function highlightText(obj)
{
    obj.style.color="#ff0000";
}
/************************************************************\
*
\************************************************************/
function unhighlightText(obj)
{
    obj.style.color="#0000cc";
}
/************************************************************\
*
\************************************************************/
function highlightLink(obj)
{
    obj.style.color="#ff0000";
    if (obj.parentNode.tagName!="SPAN")
    {
        obj.parentNode.style.backgroundColor="#faf0f0";
    }
}
/************************************************************\
*
\************************************************************/
function unhighlightLink(obj)
{
    obj.style.color="#0000cc";
    if (obj.parentNode.tagName!="SPAN")
    {
        obj.parentNode.style.backgroundColor="#fafafa";
    }
}
/************************************************************\
*
\************************************************************/
function removeTheNode(idname)
{
    if (document.getElementById(idname)!=null)
    {
        thisNode=document.getElementById(idname);
        //alert(thisNode.id);
        thisNode.parentNode.removeChild(thisNode);
    }
    sizeFader();
}
/************************************************************\
*
\************************************************************/
function pasteRawHTML(theHTML,destinationObj)
{
    var hiddenArea=null;
    if (document.getElementById("ParseArea")==null)
    {
        hiddenArea=document.createElement("div");
        hiddenArea.style.display="none";
        hiddenArea.ID="ParseArea";
    }
    else
    {
        hiddenArea = document.getElementById("ParseArea");
    }
    hiddenArea.innerHTML=theHTML;
    for (c=0;c<hiddenArea.childNodes.length;c++)
    {
        destinationObj.appendChild(hiddenArea.childNodes[c]);
    }
    hiddenArea.innerHTML="";
}
/************************************************************\
*
\************************************************************/
function MM_swapImgRestore()
{
    //v3.0
    var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
/************************************************************\
*
\************************************************************/
function MM_preloadImages()
{
    //v3.0
    var d=document; if(d.images)
    {
        if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0)
        {
            d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];
        }
    }
}
/************************************************************\
*
\************************************************************/
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 MM_swapImage()
{
    //v3.0
    var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
    if ((x=MM_findObj(a[i]))!=null)
    {
        document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];
    }
}
/************************************************************\
*
\************************************************************/
function theSrcElement(e)
{
    if (!e) var e = window.event;
    if (e.target) target = e.target
    else if (e.srcElement) target = e.srcElement
    return target;
}
/************************************************************\
*
\************************************************************/
function flashGetHref()
{
    return location.href;
}
/************************************************************\
*
\************************************************************/
function flashPutHref(href)
{
    location.href = href;
}
/************************************************************\
*
\************************************************************/
function flashGetTitle()
{
    return document.title;
}
/************************************************************\
*
\************************************************************/
function flashPutTitle(title)
{
    document.title = title;
}
/************************************************************\
*
\************************************************************/
function swapMe(e)
{
    target=theSrcElement(e);
    comp=target.src.split('/');
    var re=new RegExp("Over");
    if (comp[comp.length-1].match(re))
    {
        fn=comp[comp.length-1].split('Over');
        comp[comp.length-1]=fn[0]+fn[1];
    }
    else
    {
        fn=comp[comp.length-1].split('.');
        comp[comp.length-1]=fn[0]+"Over."+fn[1];
    }
    target.src=comp.join('/');
}
/************************************************************\
*
\************************************************************/
function openLink(url)
{
    window.location=url;
}
/************************************************************\
*
\************************************************************/
function replaceMe(obj,flashfile,flashWidth,flashHeight,alignment,title)
{
    var toembed="";
    toembed="<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\" width=\""+flashWidth+"\" height=\""+flashHeight+"\" id=\""+title+"\" align=\""+alignment+"\">";
    toembed+="<param name=\"allowScriptAccess\" value=\"sameDomain\" />";
    toembed+="<param name=\"movie\" value=\""+flashfile+"\" /><param name=\"quality\" value=\"high\" /><param name=\"wmode\" value=\"opaque\" /><param name=\"bgcolor\" value=\"#ffffff\" />";
    toembed+="<embed src=\""+flashfile+"\" quality=\"high\" wmode=\"opaque\" bgcolor=\"#ffffff\" width=\""+flashWidth+"\" height=\""+flashHeight+"\" name=\""+title+"\" align=\""+alignment+"\" swLiveConnect=\"true\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />";
    toembed+="</object>";
    pobj=obj.parentNode;
    pobj.innerHTML=toembed;
}
/************************************************************\
*
\************************************************************/
function centerObject(obj)
{
    var st = (window.pageYOffset)?(window.pageYOffset):(document.documentElement)?document.documentElement.scrollTop:document.body.scrollTop;
    var wh = getWindowHeight();
    var t=(obj.clientHeight>wh)?st:((wh-obj.clientHeight)/2)+st;
    if (t<10) t=10;
    l=((document.body.offsetWidth-obj.clientWidth)/2);
    if (l<0) l=0;
    obj.style.left=l+"px";
    obj.style.top=t+"px";
}
/************************************************************\
*
\************************************************************/
function alignObjectLeftTopWithTargetRightMiddle(obj,target)
{
    src=target;
    var curleft = curtop = 0;
    if (target.offsetParent)
    {
        curleft = target.offsetLeft;
        curtop = target.offsetTop;
        while (target = target.offsetParent)
        {
            curleft += target.offsetLeft;
            curtop += target.offsetTop;
        }
    }
    obj.style.left=(src.offsetWidth+curleft+1)+"px";
    obj.style.top=((src.offsetHeight/2)+curtop)+"px";
}
/************************************************************\
*
\************************************************************/
function alignObjectLeftTopWithTargetRightMiddleOffset(obj,target,xoffset,yoffset)
{
    src=target;
    var curleft = curtop = 0;
    if (target.offsetParent)
    {
        curleft = target.offsetLeft;
        curtop = target.offsetTop;
        while (target = target.offsetParent)
        {
            curleft += target.offsetLeft;
            curtop += target.offsetTop;
        }
    }
    obj.style.left=(src.offsetWidth+curleft+1+xoffset)+"px";
    obj.style.top=((src.offsetHeight/2)+curtop+yoffset)+"px";
}
/************************************************************\
*
\************************************************************/
function alignObjectWithTargetBottomLeft(obj,target)
{
    src=target;
    var curleft = curtop = 0;
    if (target.offsetParent)
    {
        curleft = target.offsetLeft;
        curtop = target.offsetTop;
        while (target = target.offsetParent)
        {
            curleft += target.offsetLeft;
            curtop += target.offsetTop;
        }
    }
    obj.style.left=(curleft+3)+"px";
    obj.style.top=(src.offsetHeight+curtop-3)+"px";
}
/************************************************************\
*
\************************************************************/
function alignObjectWithTargetBottomRight(obj,target,offsety)
{
    src=target;
    var curleft = curtop = 0;
    if (target.offsetParent)
    {
        curleft = target.offsetLeft;
        curtop = target.offsetTop;
        while (target = target.offsetParent)
        {
            curleft += target.offsetLeft;
            curtop += target.offsetTop;
        }
    }
    obj.style.left=(curleft+src.offsetWidth-obj.offsetWidth)+"px";
    obj.style.top=(src.offsetHeight+curtop+offsety)+"px";
}
/************************************************************\
*
\************************************************************/
function getElementTop(elem)
{
    yPos = elem.offsetTop;
    tempEl = elem.offsetParent;
    while (tempEl != null)
    {
        yPos += tempEl.offsetTop;
        tempEl = tempEl.offsetParent;
    }
    return yPos;
}
/************************************************************\
*
\************************************************************/
function getElementRight(elem)
{
    xPos = elem.offsetLeft;
    tempEl = elem.offsetParent;
    while (tempEl != null)
    {
        xPos += tempEl.offsetLeft;
        tempEl = tempEl.offsetParent;
    }
    xPos+=elem.clientWidth;
    return xPos;
}
/************************************************************\
*
\************************************************************/
function checkChars(e)
{
    rv=true;
    if (window.event)
    {
        e=window.event;
        keycode=window.event.keyCode;
    }
    else
    {
        keycode=e.which;
    }
    if (e.shiftKey)
    {
        if (keycode==188 || keycode==190)
        {
            rv=false;
        }
    }
    if (window.event)
    {
        e.returnValue=rv;
    }
    else
    {
        if (!rv)
        {
            e.preventDefault();
        }
    }
}
/************************************************************\
*
\************************************************************/
function hexify(ip)
{
    op="";
    for (c=0;c<ip.length;c++)
    {
        theChar=ip.substr(c,1);
        val=theChar.charCodeAt(0);
        hex=val.toString(16);
        if (hex.length<2)
        {
            hex="0"+hex.toString();
        }
        op+=hex;
    }
    return op;
}
/************************************************************\
*
\************************************************************/
function alignObjectUnderTarget(obj,target,offset)
{
    src=target;
    var curleft = curtop = 0;
    if (target.offsetParent)
    {
        curleft = target.offsetLeft;
        curtop = target.offsetTop;
        while (target = target.offsetParent)
        {
            curleft += target.offsetLeft;
            curtop += target.offsetTop;
        }
    }
    obj.style.left=(curleft)+"px";
    obj.style.top=(curtop+src.clientHeight+offset)+"px";
}
/************************************************************\
*
\************************************************************/
function getScrollXY()
{
    var scrOfX = 0, scrOfY = 0;
    if( typeof( window.scrollX ) == 'number' )
    {
        //Mozilla compliant
        //scrOfY = window.scrollY;
        //scrOfX = window.scrollX;
        }
    else if( typeof( window.pageYOffset ) == 'number' )
    {
        //Netscape compliant
        scrOfY = window.pageYOffset;
        scrOfX = window.pageXOffset;
    }
    else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) )
    {
        //DOM compliant
        scrOfY = document.body.scrollTop;
        scrOfX = document.body.scrollLeft;
    }
    else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) )
    {
        //IE6 standards compliant mode
        scrOfY = document.documentElement.scrollTop;
        scrOfX = document.documentElement.scrollLeft;
    }
    return [ scrOfX, scrOfY ];
}
/************************************************************\
*
\************************************************************/
function checkAlphaNumeric(toTest)
{
    alpharegex=new RegExp(/[a-zA-Z0-9]/);
    return alpharegex.test(toTest);
}
/************************************************************\
*
\************************************************************/
function validateOverLength(srcObj,theLength)
{
    if (srcObj.value.length>=theLength)
    {
        srcObj.style.backgroundImage="url(/skin/inputValid.gif)";
    }
    else
    {
        srcObj.style.backgroundImage="url(/skin/inputRequired.gif)";
    }
}
/************************************************************\
*
\************************************************************/
function removeShortlist(e)
{
	var targ;
	if (!e) var e = window.event;
	if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
    if (targ.tagName!="INPUT") removeTheNode("shortlist");
}
function openBlock(blockObject) {
    if (thisOpeningObject==null) {
        openingtimer=null;
        thisOpeningObject=blockObject;
        blockObject.style.visibility="hidden";
        blockObject.style.display="block";
        thisOpeningObjectHeight=blockObject.offsetHeight;
        blockObject.style.width=blockObject.offsetWidth+"px";
        blockObject.style.display="none";
        blockObject.style.visibility="visible";
        var filler=document.getElementById(thisOpeningObject.id.replace(/Block/,"Filler"));
        filler.style.display='block';
        if (document.getElementById(blockObject.id.replace(/Block/,"arrow"))) {
            document.getElementById(blockObject.id.replace(/Block/,"arrow")).src="/skin/collapse.gif";
        }
        openingtimer = setTimeout("openingBlock()",5);
    }
}
function openingBlock() {
    var filler=document.getElementById(thisOpeningObject.id.replace(/Block/,"Filler"));
    if (thisOpeningObject.offsetHeight==thisOpeningObjectHeight) {
        if (thisOpeningObjectOpacity<100) {
            thisOpeningObjectOpacity+=10;
            setOpacity(thisOpeningObject,thisOpeningObjectOpacity);
            openingtimer = setTimeout("openingBlock()",5);
        }else{
            thisOpeningObject=null;
            openingtimer=null;
        }
    }else{
        var dh=(thisOpeningObjectHeight-filler.clientHeight)/5;
        if ((dh*dh)<2) {
            filler.style.height=thisOpeningObjectHeight+"px";
            thisOpeningObjectOpacity=0;
            setOpacity(thisOpeningObject,thisOpeningObjectOpacity);
            filler.style.height="0px";
            thisOpeningObject.style.display="block";
            filler.style.display="none";
            openingtimer = setTimeout("openingBlock()",5);
        }else{
            filler.style.height=(filler.clientHeight+dh)+"px";
            openingtimer = setTimeout("openingBlock()",5);
        }
    }
}
function closeBlock(blockObject) {
    if (thisClosingObject==null) {
        closingtimer=null;
        thisClosingObjectOpacity=100;
        thisClosingObject=blockObject;
        var filler=document.getElementById(thisClosingObject.id.replace(/Block/,"Filler"));
        filler.style.display='none';
        filler.style.height="0px";
        if (document.getElementById(blockObject.id.replace(/Block/,"arrow"))) {
            document.getElementById(blockObject.id.replace(/Block/,"arrow")).src="/skin/expand.gif";
        }
        closingtimer = setTimeout("closingBlock()",5);
    }
}
function closingBlock() {
    var filler=document.getElementById(thisClosingObject.id.replace(/Block/,"Filler"));
    if (thisClosingObjectOpacity>0) {
        thisClosingObjectOpacity-=10;
        setOpacity(thisClosingObject,thisClosingObjectOpacity);
        closingtimer = setTimeout("closingBlock()",5);
    }else{
        if (thisClosingObject.style.display=="block") {  
            filler.style.display="block";
            filler.style.height=thisClosingObject.offsetHeight+"px";
            thisClosingObject.style.display="none";
            closingtimer = setTimeout("closingBlock()",5);
        }else{
            var dh=filler.offsetHeight/3;
            if ((dh*dh)<1) {
                filler.style.height="0px";
                filler.style.display="none";
                thisClosingObject=null;
                closingtimer=null;
            }else{
                newH=filler.offsetHeight-dh;
                filler.style.height=newH+"px";
                closingtimer = setTimeout("closingBlock()",5);
            }
        }
    }
}
function writeComment(str) {
    document.getElementById("outputComment").innerHTML+="<br />"+str;
}
function setOpacity(obj,fullscaleopacity)
{
    if (obj.style)
    {
        if (obj.style.MozOpacity!=null)
        {
            obj.style.MozOpacity = (fullscaleopacity/100);
        }
        else if (obj.style.opacity!=null)
        {
            obj.style.opacity = (fullscaleopacity/100);
        }
        else if (obj.style.KhtmlOpacity !=null)
        {
            obj.style.KhtmlOpacity  = (fullscaleopacity/100);
        }
        else if (obj.style.filter!=null)
        {
            obj.style.filter = "alpha(opacity="+fullscaleopacity+")";
        }
    }
}
function startSearch(srcObj) {
    //srcObj.style.color="#000000";
    if (document.getElementById("SearchResultBox")==null) {
        drawSearchResultBox();
    }
    if (srcObj.style.color!="#000000") {
        srcObj.value=srcObj.value.replace('search here...','');
        srcObj.style.color="#000000";
    }
    if (srcObj.value!="") searchDatabase(srcObj);
}
function drawSearchResultBox() {
    if (document.getElementById("loadingMessage")) {
        //do nothing
    }else{
        toInsert="<div style=\"padding:6px;background-color:#fff\"><div class=\"selectorTitle\">";
        toInsert+="<img src=\"/skin/close.gif\" alt=\"Close\" title=\"Close\" onclick=\"closeSearchBox()\" style=\"cursor:pointer\" align=\"right\" />";
        toInsert+="SEARCH RESULTS</div>";
        toInsert+="<div class=\"searchDiv\">Search areas: ";
        toInsert+="<img id=\"GANradio\" align=\"absmiddle\" src=\"/skin/"+(searchGAN?"radioOn":"radio")+".gif\" />&nbsp;";
        toInsert+="<span onclick=\"toggleSearchArea(this)\" class=\""+(searchGAN?"searchAreaOn":"searchAreaOff")+"\">GAN</span>&nbsp;|&nbsp;";
        toInsert+="<img id=\"Forumradio\" align=\"absmiddle\" src=\"/skin/"+(searchForum?"radioOn":"radio")+".gif\" />&nbsp;";
        toInsert+="<span onclick=\"toggleSearchArea(this)\" class=\""+(searchForum?"searchAreaOn":"searchAreaOff")+"\">Forum</span>&nbsp;|&nbsp;";
        toInsert+="<img id=\"Blogradio\" align=\"absmiddle\" src=\"/skin/"+(searchBlog?"radioOn":"radio")+".gif\" />&nbsp;";
        toInsert+="<span onclick=\"toggleSearchArea(this)\" class=\""+(searchBlog?"searchAreaOn":"searchAreaOff")+"\">Blog</span>";
        //toInsert+="</td><td align=\"right\">";
        //toInsert+="<span onclick=\"closeSearchBox()\" style=\"color:#999;cursor:pointer\" onmouseover=\"javascript:this.style.color='#fff'\" onmouseout=\"javascript:this.style.color='#999'\" >close</span>";
        toInsert+="</div>";
        toInsert+="<div id=\"receivedResults\" class=\"receivedResults\">"+emptySearchField()+"</div></div>";
        
        toInsert=returnRoundedBottomBox("SearchResultBox",300,toInsert,51,"w");
        pasteRawHTML(toInsert,document.body);
        alignObjectWithTargetBottomRight(document.getElementById("SearchResultBox"),document.getElementById("searchTable"),5)
        startFadeIn(document.getElementById("SearchResultBox"));
    }
}
function emptySearchField() {
    return "<span style=\"color:2f2727\">No search text entered...</span>";
}
function closeSearchBox() {
    startFadeOut(document.getElementById("SearchResultBox"));
}
    
function toggleSearchArea(srcObj) {
    switch(srcObj.innerHTML) {
        case "GAN":
            searchGAN=!searchGAN;
            srcObj.className=searchGAN?"searchAreaOn":"searchAreaOff";
            document.getElementById(srcObj.innerHTML+"radio").src="/skin/"+(searchGAN?"radioOn":"radio")+".gif";
            break;
        case "Blog":
            searchBlog=!searchBlog;
            srcObj.className=searchBlog?"searchAreaOn":"searchAreaOff";
            document.getElementById(srcObj.innerHTML+"radio").src="/skin/"+(searchBlog?"radioOn":"radio")+".gif";
            break;
        case "Forum":
            searchForum=!searchForum;
            srcObj.className=searchForum?"searchAreaOn":"searchAreaOff";
            document.getElementById(srcObj.innerHTML+"radio").src="/skin/"+(searchForum?"radioOn":"radio")+".gif";
            break;
    }
    searchDatabase(document.getElementById("searchField"));
}
function searchDatabase(srcObj) {
    if (srcObj.value=="") {
        document.getElementById("receivedResults").innerHTML=emptySearchField();
    }else{
        docUrl="/resource/search.php?q="+srcObj.value+(searchGAN?"&gan=1":"")+(searchBlog?"&blog=1":"")+(searchForum?"&forum=1":"")+"&v="+new Date().valueOf();
        sendRequest(docUrl,searchResultsReceived);
    }
}
function searchResultsReceived() {
    if (requesthttp.readyState==4) {
        if (requesthttp.status==200) {
            document.getElementById("receivedResults").innerHTML=requesthttp.responseText;
        }else{
            alert("Problem retrieving XML data:" + requesthttp.statusText+"\n"+requesthttp.responseText);
        }
        requesthttp=null;
    }
}
function displayMessage(e,title,message){
    insert="<center><span class=\"menuItem\">"+title+"</span><br /><span style=\"font-size:10px\">"+message+"</span></center>";
    insert=returnRoundedBox("message",100,insert,51,"s")
    pasteRawHTML(insert,document.body)
    fader(document.getElementById("message"),90);
    alignMessage(e);
}
function alignMessage(e){

    if (document.getElementById("message")!=null) {
        var posx = 0;
        var posy = 0;
        if (!e) var e = window.event;
        if (e.pageX || e.pageY)
        {
            posx = e.pageX;
            posy = e.pageY;
        }
        else if (e.clientX || e.clientY)
        {
            posx = e.clientX;
            posy = e.clientY;
        }
        var offset=10;
        var obj=document.getElementById("message");
        var windowOffset=getScrollXY();
        obj.style.top=(posy-obj.offsetHeight-offset+windowOffset[1])+"px";
        obj.style.left=(posx-(obj.offsetWidth/2)+windowOffset[0])+"px";
    }
}
function toggleStyleDisplay(id) {
    obj=document.getElementById(id);
    if (obj.style.display=='none') {
        obj.style.display='block';
    }else{
        obj.style.display='none';
    }
}
function reloadEventCalendar(m,y) {
        docUrl="/resource/loadEvents.php?m="+m+"&y="+y+"&v="+new Date().valueOf();
        sendRequest(docUrl,reloadEventCalendarReceived);
}
function reloadEventCalendarReceived() {
    if (requesthttp.readyState==4) {
        if (requesthttp.status==200) {
            document.getElementById("eventsCalendar").innerHTML=requesthttp.responseText;
        }else{
            alert("Problem retrieving XML data:" + requesthttp.statusText+"\n"+requesthttp.responseText);
        }
        requesthttp=null;
    }
}

function checkForDefaults() {
    if (document.getElementById("defaultMessage")!=null) {
        toInsert=document.getElementById("defaultMessage").value;
        toInsert="<center><h1>Message</h1>"+toInsert+"<br /><br />";
        toInsert+="<span style=\"border:1px solid #5d5252;color:#5d5252;font-size:12px;cursor:pointer\" onmouseover=\"javascript:this.style.color='#fff'\" onmouseout=\"javascript:this.style.color='#5d5252'\" onclick=\"startFadeDown()\">&nbsp;OK&nbsp;</span>";
   
        pasteRawHTML(returnRoundedBox("dialogBox",300,toInsert,55,"l"),document.body);
        fader(document.getElementById("dialogBox"),0);
        centerObject(document.getElementById("dialogBox"));
        startFadeUp();
    }
}

function displayContext(e,message){
    
    toInsert="<div id=\"bubble\" class=\"bubble\" ><b class=\"sb1f\"></b><b class=\"sb2f\"></b><b class=\"sb3f\"></b><b class=\"sb4f\"></b>";
    toInsert+="<div class=\"scontentf\">"+message+"</div><b class=\"sb4f\"></b><b class=\"sb3f\"></b><b class=\"sb2f\"></b><b class=\"sb1f\"></b>";
    toInsert+="<img src=\"/skin/orangetick.gif\" /></div>";
        
    pasteRawHTML(toInsert,document.body)
    fader(document.getElementById("bubble"),90);
    moveContext(e);
}
function displayTitle(e,message){
    toInsert="<table id=\"bubble\" cellspacing=0 cellpadding=0 style=\"position:absolute;z-index:60\"><tr><td>"+returnPNGTag('otl')+"</td><td rowspan=\"2\" style=\"background-color:fe9d5d;color:#000;text-align:center;font-size:11px\">"+message+"</td><td>"+returnPNGTag('otr')+"</td></tr>";
    toInsert+="<tr><td>"+returnPNGTag('obl')+"</td><td>"+returnPNGTag('obr')+"</td></tr>";
    toInsert+="<tr><td colspan=\"3\" style=\"text-align:center\">"+returnPNGTag('otick')+"</td></tr></table>";
    pasteRawHTML(toInsert,document.body)
    fader(document.getElementById("bubble"),90);
    moveContext(e);
}
function returnPNGTag(filename){
    //return filename;
    //return "<img src=\"/skin/"+filename+".png\" />";
    return "<img src=\"/skin/"+filename+".png\" style=\"filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/skin/"+filename+".png', sizingMethod='scale');\" alt=\"\" />";
}
function moveContext(e){

    if (document.getElementById("bubble")!=null) {
        var posx = 0;
        var posy = 0;
        if (!e) var e = window.event;
        if (e.pageX || e.pageY)
        {
            posx = e.pageX;
            posy = e.pageY;
        }
        else if (e.clientX || e.clientY)
        {
            posx = e.clientX;
            posy = e.clientY;
        }
        var offset=1;
        var obj=document.getElementById("bubble");
        var windowOffset=getScrollXY();
        obj.style.top=(posy-obj.offsetHeight-offset+windowOffset[1]-5)+"px";
        obj.style.left=(posx-(obj.offsetWidth/2)+windowOffset[0])+"px";
    }
}
function drawLanguageSelector(srcObj) {
    if (document.getElementById("languageBox")) {
        //do nothing
    }else{
        document.getElementById("languageArrow").src="/skin/topCollapse.gif";
        toInsert="<div class=\"selectorTitle\"><img src=\"/skin/close.gif\" align=\"right\" style=\"cursor:pointer\" onclick=\"closeLanguage()\" />CHOOSE LANGUAGE</div>";
        code=["gb","fr","de","it","es","dk","se","jp","cn"];
        language=["English","French","German","Italian","Spanish","Danish","Swedish","Japanese","Chinese"];
        edging=";border-top:1px dotted #a8acb0";
        for (c=0;c<code.length;c++) {
            edge=";border-top:1px solid #a8acb0";
            if (c>0) edge=edging;
            toInsert+="<div style=\"cursor:pointer"+edge+";padding:4px;font-size:12px;color:#00c1ff\" onmouseout=\"javascript:this.style.color='#00c1ff'\" onmouseover=\"javascript:this.style.color='#000'\" onclick=\"setLanguage('"+code[c]+"')\"><img src=\"/resource/miniflag.php?country="+code[c]+"\" align=\"absmiddle\" />&nbsp;&nbsp;"+language[c]+"</div>";
        }
        //toInsert+="<center><span style=\"font-size:12px;color:#999999;cursor:pointer\" onmouseout=\"javascript:this.style.color='#999999'\" onmouseover=\"javascript:this.style.color='#00c1ff'\" onclick=\"startFadeOut(document.getElementById('dialogBox'))\">Cancel</span></center>";
        pasteRawHTML(returnRoundedBottomBox("languageBox",180,toInsert,55,"w"),document.body);
        fader(document.getElementById("languageBox"),0);
        //centerObject(document.getElementById("dialogBox"));
        alignObjectWithTargetBottomRight(document.getElementById("languageBox"),srcObj,0)
        startFadeIn(document.getElementById("languageBox"));
    }
}
function setLanguage(code) {
    window.location="/setLanguage.php?code="+code+"&referer="+window.location.href;
}
function closeLanguage() {
    document.getElementById('languageArrow').src='/skin/topExpand.gif';
    startFadeOut(document.getElementById('languageBox'));
}
function emailGAN() {
    errors=new Array();
    if (document.getElementById("queryname").value=="") errors.push("Name not given");
    if (document.getElementById("queryemail").value=="") errors.push("Email address not given");
    if (document.getElementById("queryinterest").value=="") errors.push("No interest specified");
    if (document.getElementById("querycomment").value=="") errors.push("No comment supplied");
    if (errors.length>0) {
        alert(errors.join("\n"));
    }else{
        document.getElementById("query").submit();
    }
}
