/* --------------- STUDIO CONNECTIONS EXTERNAL JAVASCRIPT FILE -------------- */
/*                                                                            */
/*    Description: JavaScript for Bottom frame                                */
/*         Client: Cloud Studios - info@cloudstudios.com                      */
/*        Website: www.cloudstudios.com                                       */
/*         Author: Colin Abrahams - colin@studioconnections.net.au            */
/*      Copyright: 2008 Colin Abrahams, Studio Connections                    */
/*       Location: Wyong, NSW, Australia                                      */
/*        Version: SC-5.8                                                     */
/*   Last Updated: 2008-11-25                                                 */


function QuikMenu() {
  if (document.getElementById) {
    document.write('<span class="QuikBDL">&nbsp;</span>');
  }
  if (window.print) {
    document.write('<a '
                 + 'onmouseover="QuikSel(this)" '
                 + 'onmouseout= "QuikOut(this)" '
                 + 'onmousedown="QuikDep(this)" '
                 + 'onclick="QuikClick(this); QuikPrint(top.Main); return false" '
                 + 'title="Print printer-friendly version of current page" '
                 + 'href="javascript:void(0)"><span><img '
                 + 'src="Styles/Print.gif" '
                 + 'alt="Print printer-friendly version of current page" '
                 + 'width="13" height="11" border="0" /></span></a>');
    document.write('<span class="QuikSep">&nbsp;&nbsp;&nbsp;</span>');
  }
  document.write('<a '
               + 'onmouseover="QuikSel(this)" '
               + 'onmouseout= "QuikOut(this)" '
               + 'onmousedown="QuikDep(this)" '
               + 'onclick="QuikClick(this); QuikEmail(top.Main); return false" '
               + 'title="Email URL of current page to a friend" '
               + 'href="javascript:void(0)"><span><img '
               + 'src="Styles/Email.gif" '
               + 'alt="Email URL of current page to a friend" '
               + 'width="13" height="11" border="0" /></span></a>');
  if (window.external) {
    document.write('<span class="QuikSep">&nbsp;&nbsp;&nbsp;</span>');
    document.write('<a id="QuikPage" '
                 + 'onmouseover="QuikSel(this)" '
                 + 'onmouseout= "QuikOut(this)" '
                 + 'onmousedown="QuikDep(this)" '
                 + 'onclick="QuikClick(this); QuikSave(top.Main); return false" '
                 + 'title="Add current page to your Favorites" '
                 + 'href="javascript:void(0)"><span><img '
                 + 'src="Styles/FavPage.gif" '
                 + 'alt="Add current page to your Favorites" '
                 + 'width="13" height="11" border="0" /></span></a>');
    document.write('<span class="QuikSep">&nbsp;&nbsp;&nbsp;</span>');
    document.write('<a id="QuikSite" '
                 + 'onmouseover="QuikSel(this)" '
                 + 'onmouseout= "QuikOut(this)" '
                 + 'onmousedown="QuikDep(this)" '
                 + 'onclick="QuikClick(this); QuikSave(top); return false" '
                 + 'title="Add main site to your Favorites" '
                 + 'href="javascript:void(0)"><span><img '
                 + 'src="Styles/FavSite.gif" '
                 + 'alt="Add main site to your Favorites" '
                 + 'width="13" height="11" border="0" /></a></span>');
  }
  if (document.getElementById) {
    document.write('<span class="QuikBDR">&nbsp;</span>');
  }
}

function QuikSel(Button) {                        // called by onmouseover event

  // Call corresponding Menu button to disturb pet
  if (top.frames.length > 0 && top.BTSel) {
    top.BTSel();
  }
}

function QuikOut(Button) {                         // called by onmouseout event

  // Call corresponding Menu button to settle pet
  if (top.frames.length > 0 && top.BTOut) {
    top.BTOut();
  }
}

function QuikDep(Button) {                        // called by onmousedown event

  // Depress button
  Button.className = "Dep";
}

function QuikClick(Button) {                          // called by onclick event

  // Return button to normal
  Button.className = "";
}

function QuikEmail(PageFram) {

  // Extract website name and page name from document title
  // Standard SC document title format: websitename + " - " + pagetitle
  var PageTitl = PageFram.document.title;
  var i = PageTitl.indexOf("-");
  var SiteName = i > 0 ? PageTitl.substr(0, i - 1) : "";
  var PageName = i > 0 ? PageTitl.substr(i + 2) : "";

  // Extract description from document meta tag
  var PageDesc = document.getElementById ?
                 PageFram.document.getElementById("Description") : null;

  // Build email string, based on information available
  var EmailStr = "mailto:?";
  if (PageTitl != "") {
    EmailStr += "subject="
    if (SiteName != "") {
      EmailStr += escape(SiteName) + " Website";
    }
    else {
      EmailStr += escape(PageTitl);
    }
    EmailStr += "&";
  }
  EmailStr += "body=" + escape("Here's something you might be interested in");
  if (SiteName != "") {
    EmailStr += escape(" on the " + SiteName + " website");
  }
  EmailStr += ": " + String.fromCharCode(13) + String.fromCharCode(13);
  if (PageTitl != "") {
    if (PageName != "") {
      EmailStr += escape(PageName);
    }
    else {
      EmailStr += escape(PageTitl);
    }
    EmailStr += " " + String.fromCharCode(13);
  }
  if (PageDesc && PageDesc != null && PageDesc.content != "") {
    EmailStr += escape(PageDesc.content) + " " + String.fromCharCode(13);
  }
  EmailStr += escape(PageFram.location.href);

  // Create new email
  PageFram.location.href = EmailStr;
  return false;
}

function QuikPrint(PageFram) {
  if (window.print) {
    PageFram.focus();
    PageFram.print();
  }
}

function QuikSave(PageFram) {
  var PageTitl = PageFram.document.title;
  if (window.external) {
    external.AddFavorite(PageFram.location.href, PageTitl);
  }
}
