mainPage = 0;

function e(el){
	return document.getElementById(el);
}

function ef(el){
    return parent.window.frames.document.getElementById(el);
}

function launchBook(n)
{
    openWin("content/book"+n+".pdf", 800, 600, 'Book', 1)
}

function launchShirt(n)
{
    openWin("gfx/tshirt0"+n+"_large.jpg", 365, 620)
}

function unarchiveNews()
{
    if (e("archive").style.display == "none")
    {
        top.document.getElementById("contentFrame").style.height= "3500px";
        //e("pageContent").style.display = "none";

        e("archive").style.height = e("archive").style.scrollHeight;
        e("archive").style.display = "block";
        e("footer").style.marginTop = "2850px";
    }
    else
    {
        top.document.getElementById("contentFrame").style.height= "497px";
        e("pageContent").style.height = "287px";
        e("footer").style.marginTop = "1px";
        //e("pageContent").style.display = "block";        
        e("archive").style.height = "287px";                
        e("archive").style.display = "none";

    }
}

function c_menuButton(topicNum)
{
    mainPage = topicNum;
    
    for (i=1; i!=10; i++)
    {
        if (i == topicNum)
        {
            e("ls"+i).style.backgroundImage = "url(interface/bt_" + i + "_ovr.jpg)"; 
        }
        else
        {
            e("ls"+i).style.backgroundImage = "none"; 
        }
    }

 
   if (topicNum >= 4 && topicNum <= 5)
   {
        if (topicNum == 5)
        {
            openWin("http://excoboard.com/exco/index.php?boardid=24333",600,800,"Forum", 1);
        }
        else
        {
            e("mainContent").innerHTML = "<iframe id='contentFrame' name='contentFrame2' width='500' height='516' src='sanctuary/index.php' scrolling='no' frameborder='0'></iframe>";      
        }
   }   
   else
   {
       if (topicNum >= 10 && topicNum <= 12)
       {
           
       }  
       else
       {
         e("mainContent").innerHTML = "<iframe id='contentFrame' name='contentFrame2' width='500' height='496' src='" + "page" +topicNum + ".htm" + "' scrolling='no' frameborder='0'></iframe>";
       }  
   } 
      
   if (topicNum == 3)
   {
        e("mainContent").innerHTML = "<iframe id='contentFrame' name='contentFrame2' width='500' height='1510' src='" + "page" +topicNum + ".htm" + "' scrolling='no' frameborder='0'></iframe>";
   } 
   
   if (topicNum == 6)
   {
        e("mainContent").innerHTML = "<iframe id='contentFrame' name='contentFrame2' width='500' height='580' src='" + "page" +topicNum + ".htm" + "' scrolling='no' frameborder='0'></iframe>";
   }   
   
   if (topicNum == 8)
   {
        e("mainContent").innerHTML = "<iframe id='contentFrame' name='contentFrame2' width='800' height='659' src='" + "page" +topicNum + ".htm" + "' scrolling='auto' frameborder='0'></iframe>";
   }             
}

function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}


function c_mOver(s){v_mOver(s);}

function c_mOff(s){v_mOff(s);}

function v_mOver(s)
{
    if(s != mainPage)
    {
        e("ls"+s).style.backgroundImage = "url(interface/bt_" + s + "_ovr.jpg)";  
    }
}
function v_mOff(s)
{
    if(s != mainPage)
    {
         e("ls"+s).style.backgroundImage = "none";    
    }   
}

function openWin(sFileName, iHeight, iWidth, sName, iScroll)
{

	iHpos = (((screen.availHeight-200)/2)-(iHeight/2));
	iWpos = ((screen.availWidth/2)-(iWidth/2));
	
	if (navigator.appName == "Microsoft Internet Explorer")	
	{
		objWin = window.open(sFileName,sName,"top=" + iHpos + ", left=" + iWpos + ", height=" + iHeight + ",width=" + iWidth + ",resizable=yes,status=no,toolbar=no,menubar=no,location=no,scrollbars=" + iScroll + "");
	}	
	else
	{
		objWin = window.open(sFileName,sName,"height=" + iHeight + ",width=" + iWidth + ",status=no,toolbar=no,menubar=no,location=no,scrollbars=" + iScroll + "");	
		objWin.moveTo(iWpos, iHpos);
	}
	objWin.opener = parent;
}				

