
//Top Functions
function findurl(savetype)
{//function to get printer friendly (whole procedure copied from left panel includes make this my homepage, bookmark and email to friend, shared
    var indexhref=window.location.href //Get index href
    indexhref = indexhref.split ("?");//Split on ? if there are any
    indexhref =indexhref [0]; //Take 1st member of array, left hand string
    lenindexhref =indexhref.length; //Get length
    var righturl =window.location.href;//Get OilmainFrame href
    StartIndexString = "Sales" //Define search string to find where subfolders start
    StartIndexNo = righturl.indexOf(StartIndexString)//Find starting index and add 6 below to find end of string + /
    var righturltxt = new String(righturl);//setup
    var lenrighttxt= righturltxt.length;//get right length
    var url = indexhref+"?"+righturltxt.slice (StartIndexNo+6,lenrighttxt); //+6 =join to subfolders as querystring
    var who = window.document.title// Get Title of document in OilmainFrame
    if (savetype == "bookmark")
        {    // If saving Bookmark
        var txt = "Bookmark this page";
        window.external.AddFavorite(url,who);
    }
    if (savetype == "homepage")
        {    // If saving Homepage
        // alert("homepage")
        document.getElementById("MyHomepage").style.behavior='url(#default#homepage)';
        document.getElementById("MyHomepage").sethomepage(url
        )
    }
    if (savetype == "url")
        {    // If saving sendfriend
        return url
    }
    if (savetype == "title")
        {    // If saving sendfriend
        return who
    }
}
//-----------Left Functions---------------
function findurl(savetype)
{
    var printerswitch
    var indexhref=window.location.href //Get index href
    indexhref = indexhref.split ("?");//Split on ? if there are any
    indexhref =indexhref [0]; //Take 1st member of array, left hand string
    lenindexhref =indexhref.length; //Get length
    var righturl =window.location.href;//Get OilmainFrame href
    StartIndexString = "Sales" //Define search string to find where subfolders start
    StartIndexNo = righturl.indexOf(StartIndexString)//Find starting index and add 6 below to find end of string + /
    var righturltxt = new String(righturl);//setup
    var lenrighttxt= righturltxt.length;//get right length
    var url = indexhref+"?"+righturltxt.slice (StartIndexNo+6,lenrighttxt); //+6 =join to subfolders as querystring
    var who = window.document.title// Get Title of document in OilmainFrame
    if (savetype == "bookmark")    {    // If saving Bookmark
        var txt = "Bookmark this page";
        window.external.AddFavorite(url,who);}
    if (savetype == "homepage")    {    // If saving Homepage
        //alert("homepage")
        document.getElementById("MyHomepage").style.behavior='url(#default#homepage)';
        document.getElementById("MyHomepage").sethomepage(url)}
    if (savetype == "url")    {    // If saving sendfriend
        return url}
    if (savetype == "title")    {    // If saving sendfriend
        return who}
    if (savetype == "printerfriendly")    
        {    // If saving sendfriend
        window.location.href = window.location.href+"?printerswitch=1"}
}

function KPHomeShow()        {document.getElementById('KPHome').style.visibility="visible";document.getElementById('KPHome').style.display="block"}
function KPHomeHide()       {document.getElementById('KPHome').style.display="none"}
function TreeOfLifeShow()           {document.getElementById('TreeOfLife').style.visibility="visible";document.getElementById('TreeOfLife').style.display="block"}
function TreeOfLifeHide()           {document.getElementById('TreeOfLife').style.display="none"}
function ProductsShow()    {document.getElementById('Products').style.visibility="visible";document.getElementById('Products').style.display="block"}
function ProductsHide()     {document.getElementById('Products').style.display="none"}
function ToolsShow()      {document.getElementById('Tools').style.visibility="visible";document.getElementById('Tools').style.display="block"}
function ToolsHide()     {document.getElementById('Tools').style.display="none"}
function ProducerShow()      {document.getElementById('Producer').style.visibility="visible";document.getElementById('Producer').style.display="block"}
function ProducerHide()      {document.getElementById('Producer').style.display="none"}
function NewsOptionsShow()   {document.getElementById('NewsOptions').style.visibility="visible";document.getElementById('NewsOptions').style.display="block"}
function NewsOptionsHide()   {document.getElementById('NewsOptions').style.display="none"}
function SocialJusticeShow()     {document.getElementById('SocialJustice').style.visibility = "visible";document.getElementById('SocialJustice').style.display="block"}
function SocialJusticeHide()     {document.getElementById('SocialJustice').style.display="none"}
function ContactShow()    {document.getElementById('Contact').style.visibility="visible";document.getElementById('Contact').style.display="block"}
function ContactHide()    {document.getElementById('Contact').style.display="none"}



function ContactsubShow()    {document.getElementById('Contactsub').style.visibility="visible";}
function ContactsubHide()     {document.getElementById('Contactsub').style.visibility="hidden";}

function BreakChainsShow()    {document.getElementById('BreakChainsOptions').style.visibility="visible";}
function BreakChainsHide()  {document.getElementById('BreakChainsOptions').style.visibility="hidden";}
function DMEShow()            {document.getElementById('DMESolutionOptions').style.visibility="visible";}
function DMEHide()             {document.getElementById('DMESolutionOptions').style.visibility="hidden";}
function SitePrepSubShow()    {document.getElementById('SitePrepSub').style.visibility="visible";}
function SitePrepSubHide()     {document.getElementById('SitePrepSub').style.visibility="hidden";}
function AboutsubShow()        {document.getElementById('AboutSub').style.visibility="visible";}
function AboutsubHide()     {document.getElementById('AboutSub').style.visibility="hidden";}
function KyotosubShow()        {document.getElementById('KyotoSub').style.visibility="visible";}
function KyotosubHide()     {document.getElementById('KyotoSub').style.visibility="hidden";}
function DonorsShow()        {document.getElementById('Donors').style.visibility="visible";}
function DonorsHide()         {document.getElementById('Donors').style.visibility="hidden";}
function HomeworkShow()        {document.getElementById('Homework').style.visibility="visible";}
function HomeworkHide()     {document.getElementById('Homework').style.visibility="hidden";}
function BrochuresShow()        {document.getElementById('Brochures').style.visibility="visible";}
function BrochuresHide()     {document.getElementById('Brochures').style.visibility="hidden";}

function KPMenuShow()        {document.getElementById('KPHome').style.visibility="visible";document.getElementById('KPHome').style.display="block"}
function KPMenuHide()        {document.getElementById('KPHome').style.display="none"}
function BreakChainsShow()   {document.getElementById('BreakChainsOptions').style.visibility="visible";document.getElementById('BreakChainsOptions').style.display="block"}
function BreakChainsHide()   {document.getElementById('BreakChainsOptions').style.display="none"}
function ShoppingShow()      {document.getElementById('ShoppingOptions').style.visibility="visible";document.getElementById('ShoppingOptions').style.display="block"}
function ShoppingHide()      {document.getElementById('ShoppingOptions').style.display="none"}
function BrochuresShow()     {document.getElementById('BrochuresOptions').style.visibility="visible";document.getElementById('BrochuresOptions').style.display="block"}
function BrochuresHide()     {document.getElementById('BrochuresOptions').style.display="none"}
function HealthShow()        {document.getElementById('HealthOptions').style.visibility="visible";document.getElementById('HealthOptions').style.display="block"}
function HealthHide()        {document.getElementById('HealthOptions').style.display="none"}
function HomeworkShow()      {document.getElementById('Homework').style.visibility="visible";document.getElementById('Homework').style.display="block"}
function HomeworkHide()      {document.getElementById('Homework').style.display="none"}
function ProducerOptionsShow()    {document.getElementById('ProducerOptions').style.visibility="visible";document.getElementById('ProducerOptions').style.display="block"}
function ProducerOptionsHide()    {document.getElementById('ProducerOptions').style.display="none"}

function menufunct(mno)  
{   
    if(mno)   
        {
        var mnum 
        menudepth=8;
        submenudepth=2
        if(mno.length>1)
            {      
            mnum=mno.substr(0,1);
            msub=mno.substr(1,2);
            Len=2   
        } 
        else 
            {
            Len=1
            mnum=mno.substr(0,1);
        }

        for(i=1;i<=menudepth;i++)
        {      
            if(i!=mnum)
                {
                document.getElementById('Menu'+i).style.visibility="hidden";document.getElementById('Menu'+i).style.display="none";

                if(Len==2&&submenudepth<=submenudepth)
                    {
                    if(document.getElementById('Menu'+i+msub))
                        {document.getElementById('Menu'+i+msub).style.visibility="hidden";document.getElementById('Menu'+i+msub).style.display="none";}
                }
            }
        }
        //document.getElementById('Menu'+mnum).style.visibility="visible";document.getElementById('Menu'+mnum).style.display="list-item"; 
        if(Len=="1")
            {    
            if(document.getElementById('Menu'+mnum).style.visibility=="visible") 
                {document.getElementById('Menu'+mnum).style.visibility="hidden";document.getElementById('Menu'+mnum).style.display="none";}
            else
                {document.getElementById('Menu'+mnum).style.visibility="visible";document.getElementById('Menu'+mnum).style.display="block";}  // list-item
        }  
        else
            {       // alert(mnum+" "+msub)
            //if(document.getElementById('Menu'+mnum).style.visibility=="visible") 
            // {document.getElementById('Menu'+mnum).style.visibility="hidden";document.getElementById('Menu'+mnum).style.display="none";}
            //  else
            {document.getElementById('Menu'+mnum).style.visibility="visible";document.getElementById('Menu'+mnum).style.display="block";}  // list-item


            if(document.getElementById('Menu'+mnum+msub).style.visibility=="visible") 
                {document.getElementById('Menu'+mnum+msub).style.visibility="hidden";document.getElementById('Menu'+mnum+msub).style.display="none";}
            else
                {document.getElementById('Menu'+mnum+msub).style.visibility="visible";document.getElementById('Menu'+mnum+msub).style.display="block";} // list-item
        }  
    }
}

function sendfriend(url,title){
    var SubjectLine="Check out this web Page I just found called '"+window.document.title+"'"; 
    var BodyText1="The site is all about the hidden health benefits of coconut oil, bio fuel, social justice and health issues. Click this link to see it "+url
    //var Message='Send <A CLASS=contact HREF="mailto:?SUBJECT='+escape(SubjectLine)+'&BODY='+escape(BodyText)+'" OnMouseOver="status=\'Send email to a friend\'; return true;" TITLE="Send your friends e-mail about this page">this page<\/A> to a friend.';
    window.location.href = "mailto:?SUBJECT="+SubjectLine+"&BODY="+BodyText1//+"&BODY="+BodyText2//+"&BODY="+BodyText3
    //var MessageIE='Send <A CLASS=contact HREF="mailto:?SUBJECT='+(SubjectLine)+'&BODY='+(BodyText)+'" OnMouseOver="status=\'Send email to a friend\'; return true;" TITLE="Send your friends e-mail about this page">this page<\/A> to a friend.';

    //if(document.all) { document.write(MessageIE); }

    //else { document.write(Message); }
}

function sendfriendKP(url,title){
    var SubjectLine="Check out this web Page I just found called '"+window.document.title+"'"; 
    var BodyText1="The site is all about the hidden health benefits of coconut oil, bio fuel, social justice and health issues. Click this link to see it "+url
    window.location.href = "mailto:?SUBJECT="+SubjectLine+"&BODY="+BodyText1//+"&BODY="+BodyText2//+"&BODY="+BodyText3
}
function viewNewsletter(){
    selectedNL=document.getElementById('ViewThisNewsletter').value
    document.location.href="NewsletterSender.php?NewsletterNo="+selectedNL+".php&NewsletterDisplay=View";
}

