// ---------------- Below are the functions that do everything ------------
// ---------------- Do not edit until "EDIT BELOW HERE" message -----------
// browser sniffer
agt = navigator.userAgent.toLowerCase();
verReal = navigator.appVersion;
ver = parseInt(verReal);
app = navigator.appName.toLowerCase();
ie = (agt.indexOf('msie') != -1 || agt.indexOf('microsoft') != -1)?1:0;
ns = (agt.indexOf('netscape') != -1 || app.indexOf('netscape') != -1)?1:0;
ie4 = (ie && ver==4 && !(agt.indexOf('msie 5')!=-1))?1:0;
ie5 = (ie && (ver==5 || agt.indexOf('msie 5')!=-1))?1:0;
ie6 = (ie && ver==6)?1:0;
ns4 = (ns && ver==4)?1:0;
ns6 =(ns && ver==5)?1:0
win = (agt.indexOf('win')!=-1)?1:0
mac=(agt.indexOf('mac')!=-1)?1:0

//to reduce file size
function dw(theText){
  document.writeln(theText)
}

//Reload window onResize for Netscape

var Nav_browser = document.layers
if (Nav_browser) {
var beginWidth = innerWidth;
var beginHeight = innerHeight;
}

function reloadWindow() {
if (innerWidth != beginWidth || innerHeight != beginHeight)
location.reload();
}
if (Nav_browser) onresize = reloadWindow

//preload images function

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];}}
}

// height extender
var imageHeight = screen.availHeight-226;
function heightextender(){
  dw('<img src="http://www.hemscott.net/images/transparent.gif" border="0" width="5" height="' + imageHeight + '">');
}

// disclaimer popup
function disclaimWin(page) {
    OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,height=500,width=658,location=no,scrollbars=no,resizable=no,status=no,left=100,top=100");
}



//  popup window
function popup(page) {
    OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,height=600,width=700,location=no,scrollbars=yes,resizable=no,status=no,left=100,top=100");
}
//used in refs
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
// open window ie target blank
function openInTargetBlank(page) {
    OpenWin = this.open(page, "NewWindow", "toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes,status=yes,left=0,top=0");
}
//top location change
function goToNewUrl(newUrl){
  top.location.href = newUrl;
}
// Date on top right 
function addDate(){
   var mydate=new Date()
   var year=mydate.getYear()

   if (year<2000){
     year=1900+year
   }
   
   var month=mydate.getMonth()
   var daym=mydate.getDate()

   var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
   dw(""+montharray[month]+" "+daym+", "+year+"")
}
function navTopOver(theId){
  eval('document.all.'+theId+'.style.backgroundColor = "#ff6600";');
}
function navTopOut(theId){
  eval('document.all.'+theId+'.style.backgroundColor = "#003399";');
}
// ------------------------------------------------
// This stuff writes all the top table.
// ------------------------------------------------
function aLine(theClass,theHeight){
  dw('  <tr> ');
  dw('    <td height="1" colspan="5" valign="middle" class="' + theClass + '"><img src="http://www.hemscott.net/images/transparent.gif" width="1" height="' + theHeight + '"></td>');
  dw('  </tr>');
}

function topnavCells(theName,id,theLink){
  dw('            <td height="17" id="td'+id+'" onmouseover="navTopOver(\'td'+id+'\')" onmouseout="navTopOut(\'td'+id+'\')" onclick="goToNewUrl(\'' + theLink + '\')" class="tablenavtop" align="center" valign="middle"><a class="navtop" href="' + theLink + '" border="0" target="_top">' + theName + '</a></td>');
  dw('            <td width="2" height="17"><img src="http://www.hemscott.net/images/transparent.gif" width="2" height="17"></td>');
}

function writeTopOne(){
  dw('<table width="100%" border="0" cellspacing="0" cellpadding="0">');
  aLine('tabletopandnav',12);
  aLine('tablefooterandpopup',1);
  dw('  <tr>');
  dw('    <td width="12" bgcolor="#000066" ><img src="http://www.hemscott.net/images/transparent.gif" width="12" height="8"></td>');
  dw('    <td width="184" valign="middle" bgcolor="#000066"><a href="http://www.hemscott.net/" target="_top"><img src="http://www.hemscott.net/images/portal_logo.gif" width="184" height="29" alt="Hemscott logo" border="0"></a></td>');
  dw('    <td width="81" bgcolor="#000066"><img src="http://www.hemscott.net/images/transparent.gif" width="81" height="15"></td>');
  dw('    <td align="right" width="478" bgcolor="#000066"><!-- top banner -->');
  dw('      <table width="100%" border="0" cellspacing="0" cellpadding="0" height="60">');
  dw('        <tr> ');
  dw('          <td>');
}

function writeTopOneOne(){
  dw('<table width="100%" border="0" cellspacing="0" cellpadding="0">');
  aLine('tabletopandnav',12);
  aLine('tablefooterandpopup',1);
  dw('  <tr>');
  dw('    <td width="12" bgcolor="#000066" ><img src="http://www.hemscott.net/images/transparent.gif" width="12" height="8"></td>');
  dw('    <td width="184" valign="middle" bgcolor="#000066"><a href="http://www.hemscott.net/" target="_top"><img src="http://www.hemscott.net/images/Hem_One_logo.gif" alt="Hemscott One" border="0"></a></td>');
  dw('    <td width="81" bgcolor="#000066"><img src="http://www.hemscott.net/images/transparent.gif" width="81" height="15"></td>');
  dw('    <td align="right" width="478" bgcolor="#000066"><!-- top banner -->');
  dw('      <table width="100%" border="0" cellspacing="0" cellpadding="0" height="60">');
  dw('        <tr> ');
  dw('          <td>');
}

function writeTopOnePremium(){
  dw('<table width="100%" border="0" cellspacing="0" cellpadding="0">');
  aLine('tabletopandnav',12);
  aLine('tablefooterandpopup',1);
  dw('  <tr>');
  dw('    <td width="12" bgcolor="#000066" ><img src="http://www.hemscott.net/images/transparent.gif" width="12" height="8"></td>');
  dw('    <td width="184" valign="middle" bgcolor="#000066"><a href="http://www.hemscott.net/" target="_top"><img src="http://www.hemscott.net/images/Hem_Premium_logo.gif" alt="Hemscott Premium" border="0"></a></td>');
  dw('    <td width="81" bgcolor="#000066"><img src="http://www.hemscott.net/images/transparent.gif" width="81" height="15"></td>');
  dw('    <td align="right" width="478" bgcolor="#000066"><!-- top banner -->');
  dw('      <table width="100%" border="0" cellspacing="0" cellpadding="0" height="60">');
  dw('        <tr> ');
  dw('          <td>');
}

function writeTopOnePlus(){
  dw('<table width="100%" border="0" cellspacing="0" cellpadding="0">');
  aLine('tabletopandnav',12);
  aLine('tablefooterandpopup',1);
  dw('  <tr>');
  dw('    <td width="12" bgcolor="#000066" ><img src="http://www.hemscott.net/images/transparent.gif" width="12" height="8"></td>');
  dw('    <td width="184" valign="middle" bgcolor="#000066"><a href="http://www.hemscott.net/" target="_top"><img src="http://www.hemscott.net/images/Hem_Premium_plus_logo.gif" alt="Hemscott Premium Plus" border="0"></a></td>');
  dw('    <td width="81" bgcolor="#000066"><img src="http://www.hemscott.net/images/transparent.gif" width="81" height="15"></td>');
  dw('    <td align="right" width="478" bgcolor="#000066"><!-- top banner -->');
  dw('      <table width="100%" border="0" cellspacing="0" cellpadding="0" height="60">');
  dw('        <tr> ');
  dw('          <td>');
}

function writeTopTwo(){

  dw('</td>');
  dw('          <td>');
}

function writeTopThree(){
  dw('</td>');
  dw('          <td align="right">');
}
var pageName;
function writeTopFour(pageName){
  if (pageName == null){
    pageName = '<img src="http://www.hemscott.net/images/transparent.gif" width="148" height="6">'
  }
  dw('</td>');
  dw('        </tr>');
  dw('      </table><!-- end of top banner --></td>');
  dw('    <td width="100%" bgcolor="#000066">&nbsp;</td>');
  dw('  </tr>');
  aLine('tablefooterandpopup',1);
  dw('  <!-- top level navigation -->');
  dw('  <tr> ');
  dw('    <td colspan="4" height="17" align="right" bgcolor="#000066"> ');
  dw('      <table cellspacing="0" cellpadding="0" border="0" width="755" height="17">');
  dw('        <tr>');
  dw('          <td bgcolor="#000066" width="160" height="17" class="orange11pxbold" align="left"><img src="http://www.hemscott.net/images/transparent.gif" width="12" height="6">' + pageName + '</td>');
//  Change these to change the topnav rollover images.  Also add the rollover names at the bottom in the preloadAllImages function.
  topnavCells('Home','home','http://www.hemscott.net/');
  topnavCells('Sitemap','sitemap','http://www.hemscott.com/sitemap/map.htm');
  topnavCells('Support','support','http://www.hemscott.com/HelpService/index.htm');
  topnavCells('Email','email','http://www.hemscott.com/equities/adv'+'erts/hpemail.htm');
  topnavCells('Registration','registration','http://businessplus.hemscott.net/register/index.asp');
  topnavCells('About Us','aboutus','http://www.hemscottplc.com');
  dw('          <td class="orange11pxbold" width="201" bgcolor="#000066" height="17" align="right">&nbsp;');
  addDate()
  dw('          </td>');
  dw('        </tr>');
  dw('      </table>');
  dw('      <!-- end top level navigation -->');
  dw('    </td>');
  dw('    <td bgcolor="#000066" height="17"><img src="http://www.hemscott.net/images/transparent.gif" width="1" height="17" ></td>');
  dw('  </tr>');
  dw('  <tr> ');
  dw('    <td height="1" colspan="5" bgcolor="#003399"><img src="http://www.hemscott.net/images/transparent.gif" width="1" height="1"></td>');
  dw('  </tr>');
  dw('</table>');
}
function writeTop(doesnothing,theTitle){
  writeTopOne();
  dw('&nbsp;');
  writeTopTwo();
  dw('&nbsp;');
  writeTopThree();
  dw('&nbsp;');
  writeTopFour(theTitle)
}
function writeTopNoAd(theTitle){
    writeTop('doesnothing',theTitle)
}
function writeTopOneAdOpen(){
  writeTopOne();
  dw('&nbsp;');
  writeTopTwo();
  dw('&nbsp;');
  writeTopThree();
}
function writeTopOneAdOpenOne(){
  writeTopOneOne();
  dw('&nbsp;');
  writeTopTwo();
  dw('&nbsp;');
  writeTopThree();
}
function writeTopOneAdOpenPremium(){
  writeTopOnePremium();
  dw('&nbsp;');
  writeTopTwo();
  dw('&nbsp;');
  writeTopThree();
}
function writeTopOneAdOpenPlus(){
  writeTopOnePlus();
  dw('&nbsp;');
  writeTopTwo();
  dw('&nbsp;');
  writeTopThree();
}
function writeTopOneAdClose(theTitle){
  writeTopFour(theTitle)
}
// ------------------------------------------------
// End of - This stuff writes all the top table.
// ------------------------------------------------

// This writes the company search box.
function writeSearchTop(){
  dw('      <table width="160" border="0" cellspacing="0" cellpadding="0">');
  dw('        <form action="http://www.hemscott.com/scripts/search_frameset.asp" method=GET>');
  dw('          <tr> ');
  dw('            <td class="white11pxbold" colspan="3" bgcolor="#000066"><img src="http://www.hemscott.net/images/transparent.gif" width="12" height="6" border="0"><span class="orange12pxbold">&#149;</span><img src="http://www.hemscott.net/images/transparent.gif" width="4" height="6" border="0">Company Search</td>');
  dw('          </tr>');
  dw('          <tr> ');
  dw('            <td valign="middle" bgcolor="#000066"><img src="http://www.hemscott.net/images/transparent.gif" width="25" height="8"></td>');
  dw('            <td align="left" width="76" bgcolor="#000066"> ');
  dw('              <input type=text name=name value="" class="search" size="8">');
  dw('            </td>');
  dw('            <td width="59" bgcolor="#000066">&nbsp;&nbsp; ');
  dw('              <input type="image" src="http://www.hemscott.net/images/go.gif" value="go" border="0" name=SrchSub alt="go" align="middle">');
  dw('            </td>');
  dw('          </tr>');
}


function writeSearchBottom(){
  dw('          <tr> ');
  dw('            <td colspan="3" valign="bottom" bgcolor="#000066"><img src="http://www.hemscott.net/images/003399.gif" width="160" height="1"> ');
  dw('              <input type=hidden name=URL value="http://www.hemscott.com/equities/company/cd@COYID@.htm">');
  dw('            </td>');
  dw('          </tr>');
  dw('        </form>');
  dw('      </table>');
}
function writeSearch(){
writeSearchTop()
writeSearchBottom()
}
// This writes the footer.
function writeFooter(){
  dw('<table width="100%" cellspacing="0" cellpadding="0" bgcolor="#003399" border="0">');
  dw('  <tr>');
  dw('    <td bgcolor="#ffcc99" height="2" colspan="3"><img src="http://www.hemscott.net/images/transparent.gif" width="1" height="2" border="0"></td>');
  dw('  </tr>');
  dw('  <tr>');
  dw('    <td height="30" width="12" bgcolor="#003399" valign="middle"><img src="http://www.hemscott.net/images/transparent.gif" width="1" height="1" border="0"></td>');
  dw('    <td class="white11pxbold" bgcolor="#003399" width="610"><a href="javascript:disclaimWin(\'http://www.hemscott.com/equities/cust_disclaim.htm\')" target="_self" class="leftnav">Terms of Use</a> | <a href="http://www.hemscott.com/equities/Privacy/priv_index.htm" target="_blank" class="leftnav">Privacy Policy</a> | <a href="http://www.hemscott.com/equities/main.htm" target="_blank" class="leftnav">Sources &amp; Disclaimer</a></td>');
  dw('    <td class="white11pxbold" bgcolor="#003399"> <a href="http://www.hemscott.com/new_online_brochures/new_media_online_pack/indexnew.htm" target="_blank" class="leftnav">Advertise with us</a></td>');
  dw('  </tr>');
  dw('  <tr>');
  dw('    <td height="30" width="12" bgcolor="#003399" valign="middle"><img src="http://www.hemscott.net/images/transparent.gif" width="1" height="1" border="0"></td>');
  dw('    <td class="white9pxplain" bgcolor="#003399" colspan="2">© 2005 Hemscott Group Limited<br>Hemscott is the UK registered trademark of Hemscott Group Limited</td>');
  dw('  </tr>');
  dw('</table>');
}

// This is the stuff that makes our menus work.  Please dont alter.
var lastMouseOutTime = new Date().getTime();
var closePending=false;
var running = false;

function findDiv(name) {
    if(name != null) {
    if (document.layers)
        layer = eval("document." + "menu"+name);
    else if (document.all)
        layer = eval("document.all." + "menu"+name + ".style");
        return(layer);
    }
}

function _handleMouseOver(evt) {
    if(document.layers) {
        var handledHere=false;
        for(var i=0; i<menuLayers.length;i++) {
            if (menuLayers[i] != null) {
                if (evt.target.id == ("menu"+menuLayers[i])) {
                    closePending=false;
                    handledHere=true;
                }
            }
        }
        if (!handledHere) routeEvent(evt);
    }
    else {
    closePending=false;
    }
}

function _handleMouseOut(evt) {
    if(document.layers) {
        var handledHere=false;
        for(var i=0; i<menuLayers.length;i++) {
            if (menuLayers[i] != null) {
                if (evt.target.id == ("menu"+menuLayers[i])) {
                    mouseOutMenu();
                    handledHere=true;
                }
            }
        }
        if (!handledHere) routeEvent(evt);
    }
    else {
        mouseOutMenu();
    }
}

function mouseOverMenu(menuItem) {
    if (menuItem != null) {
        closePending=false;
        for(var i=0; i<menuLayers.length;i++) {
            if (menuLayers[i] != null) {
            if (menuLayers[i] == menuItem)
                findDiv(menuItem).visibility="visible";
            else
                findDiv(menuLayers[i]).visibility="hidden";
            }
        }
    }
}
function mouseOutMenu(menuItem) {
    lastMouseOutTime = new Date().getTime();
    closePending=true;
}

function closeMenus() {
    for(var i=0; i<menuLayers.length;i++) {
        if (menuLayers[i] != null) {
            findDiv(menuLayers[i]).visibility="hidden";
        }
    }
    closePending=false;
}

function advance() {
    if (closePending && (lastMouseOutTime < (new Date().getTime() - optionsHideDelay)))
        closeMenus();
}

function thread() {
    advance();
    if (running) setTimeout('thread()',100);
}

function start() {
    if (!running) {
        running=true;
        thread();
    }
    if (!(document.layers)) {
        for(i=0; i<menuLayers.length;i++) {
            if (menuLayers[i] != null) {
                layer = eval("document.all." + "menu"+menuLayers[i]);
                layer.onmouseover = _handleMouseOver;
                layer.onmouseout = _handleMouseOut;
            }
        }
    }
    if (!running) {
        running=true;
        thread();
    }
}

function stop() {
    running=false;
}

function init() {
    if(document.layers) {
        captureEvents(Event.MOUSEOVER|Event.MOUSEOUT);
        onmouseover = _handleMouseOver;
        onmouseout = _handleMouseOut;
    }
    start();
}
            
//end of dhtml script

// -------------------------- New menu JavaScript Below ------------------

// This specifies how long the pop-up menus appear after mouse out.
var optionsHideDelay=500;

// This defines all active layers.  null layers need not be defined.
var menuLayers=new Array();
function definelayers(menuNo){
    if (menuNo != null){
        menuLayers[menuNo]=menuNo;
    }
}
// Opens the main nav table  -----------------------------------------------------
function openMainTable(){
    dw('<table cellspacing="0" cellpadding="0" border="0" width="160">');
    dw('  <tr>');
    dw('    <td><img src="http://www.hemscott.net/images/transparent.gif" width="9" height="12"></td>');
    dw('    <td width="16"><img src="http://www.hemscott.net/images/transparent.gif" width="1" height="12"></td>');
    dw('    <td><img src="http://www.hemscott.net/images/transparent.gif" width="9" height="12"></td>');
    dw('  </tr>');
}
// Creates each main nav row
function mainTable(itemName,theLink,menuNo){
  mainTableTarget(itemName,theLink,menuNo,'_top')
}
function mainTableTarget(itemName,theLink,menuNo,theTarget){
    definelayers(menuNo);
    outmenuNo = "menu" + menuNo
    dw('  <tr>');
    dw('    <td colspan="3"><span class="mainnav" height="15"><a onMouseOver="mouseOverMenu(\'' + menuNo + '\')" onMouseOut="mouseOutMenu(\'' + outmenuNo + '\')" href="' + theLink + '" class="mainnav" target="' + theTarget + '"><img src="http://www.hemscott.net/images/transparent.gif" width="12" height="12" border="0"><span class="orange12pxbold">&#149;</span><img src="http://www.hemscott.net/images/transparent.gif" width="4" height="12" border="0">' + itemName + '</a></span></td>');
    dw('  </tr>');
}

// Ends the main nav table
function closeMainTable(){
    dw('</table>');
}
// Defines the pop-up layer positions.  Done this way due to the NN 4.5 Ttyle error.
// (YOU CAN EDIT THE NEXT FEW LINES)
function divarray(menuNo,heightPosition,startHeight){
    if (startHeight == "default"){
        startHeightPosition = 171;//Change to alter the height of the first menu item.
    } else if (startHeight == "noSearch"){
        startHeightPosition = 103;//Change to alter the height of the first menu item when no company search box is used.
    } else {
        startHeightPosition = startHeight;
    }
    if (ie){
        topPosition = startHeightPosition + (heightPosition - 1)*14;//Change this number to edit the spacing of each menu.
    } else {
        topPosition = startHeightPosition + (heightPosition - 1)*14;//and for Netscape.
    }
    dw('<style>');
    dw('#menu' +  menuNo + ' {z-index: 1; position: absolute; left: 160px; top: ' +  topPosition + 'px; width: 123px; visibility: hidden}');
    dw('</style>');
}
// Opens the pop-up layer and table.  ---------------------------------------------------
function openPopupTable(menuNo,heightPosition,startHeight){
    divarray(menuNo,heightPosition,startHeight)
    dw('<div id="menu' +  menuNo + '"><img src="http://www.hemscott.net/images/transparent.gif" width="1" height="1"><br>'); 
    dw('  <table cellspacing="0" cellpadding="0" border="0" width="123" bgcolor="#003399">'); 
    dw('    <tr>'); 
    dw('      <td>'); 
    dw('        <table cellspacing="0" cellpadding="0" border="0" width="100%">'); 
}
// Writes each pop-up layer row.
function popupTable(itemName,theLink){
    dw('          <tr>'); 
    dw('            <td><a href="' + theLink + '" class="popupnav" target="_top">&nbsp;&nbsp;' + itemName + '</a></td>'); 
    dw('          </tr>');
}
// closes the pop-up layers table and row.
function closePopupTable(){
    dw('        </table>');
    dw('      </td>');
    dw('    </tr>');
    dw('  </table>');
    dw('</div>');
}
// ---------------- EDIT BELOW HERE  -----------

//rollovers on top menu
if (document.images) {
homeOff = new Image
sitemapOff = new Image
supportOff = new Image
emailOff = new Image
registrationOff = new Image
aboutusOff = new Image

tabsLink = "http://www.hemscott.net/images/tabs/"
homeOff.src = tabsLink + "home1.gif"
sitemapOff.src = tabsLink + "sitemap1.gif"
supportOff.src = tabsLink + "support1.gif"
emailOff.src = tabsLink + "email1.gif"
registrationOff.src = tabsLink + "registration1.gif"
aboutusOff.src = tabsLink + "aboutus1.gif"

homeOn = new Image
sitemapOn = new Image
supportOn = new Image
emailOn = new Image
registrationOn = new Image
aboutusOn = new Image

homeOn.src = tabsLink + "home2.gif"
sitemapOn.src = tabsLink + "sitemap2.gif"
supportOn.src = tabsLink + "support2.gif"
emailOn.src = tabsLink + "email2.gif"
registrationOn.src = tabsLink + "registration2.gif"
aboutusOn.src = tabsLink + "aboutus2.gif"

}

function chgImg(imgField, newImg) {
    if (document.images) {
        document [imgField].src= eval (newImg + ".src")
    }
}

function preloadAllImages(){
    MM_preloadImages(tabsLink + 'home2.gif',tabsLink + 'sitemap2.gif',tabsLink + 'support2.gif',tabsLink + 'email2.gif',tabsLink + 'registration2.gif',tabsLink + 'aboutus2.gif');
}

// end of rollovers    

//new framesets

function loadFrames2(page1, page2) {
framecode = "<frameset rows='150,*' frameborder='NO' framespacing='0' marginwidth='0' marginheight='0' 'noresize'>"
+ "<frame src='" + page1 + "' scrolling='NO'>"
+ "<frame src='" + page2 + "' scrolling='AUTO'>"
+ "</frameset>";

page = window.open("");
page.document.open();
page.dw(framecode);
page.document.close();
}

function checkRememberMe(){

  nowDate = new Date()
  futureDate = new Date()
  futureDate.setFullYear(nowDate.getFullYear()+20)
  if(document.loginform.rememberme.checked){
    document.cookie = "premiumUsername=" + document.loginform.username.value + "; expires="+futureDate.toGMTString()+";";
  } else {
    deleteCookieByName('premiumUsername')
  }
}
function getUsernameFromCookie(){
  cookieName = 'premiumUsername'
  var aCookie = document.cookie.split("; ");
  for (var i=0; i < aCookie.length; i++){
    var nameValuePair = aCookie[i].split("=");
    if (nameValuePair[0] == cookieName && '' == '' && nameValuePair[1] != null){
      document.loginform.username.value = nameValuePair[1]
      document.loginform.password.focus()
      document.loginform.rememberme.checked = true
    }
  }
}

//deletes a cookie given its name.
function deleteCookieByName(cookieName){
  var aCookie = document.cookie.split("; ");
  for (var i=0; i < aCookie.length; i++){
    var nameValuePair = aCookie[i].split("=");
    if (nameValuePair[0] == cookieName){
      document.cookie = cookieName + '=' + nameValuePair[1] + "; expires=Fri, 31 Dec 1999 23:59:59 GMT;";
    }
  }
}
function onloadAll(){
  init();
  preloadAllImages();
  //getUsernameFromCookie();

}