function welcome(){
  pageTitle = "Holidays in Beautiful Cornwall";

  var current_date = new Date();
  var hour_value = current_date.getHours();
  if (hour_value < 12)
    {
      greeting = "Good Morning and Welcome to ";    
    }
  else if (hour_value == 12)
    {
      greeting = "Good Afternoon and Welcome to ";   
    }
  else if (hour_value < 17)
    {
      greeting = "Good Afternoon and Welcome to ";    
    }
  else
    {
      greeting = "Good Evening and Welcome to ";   
    }

  document.write(greeting + pageTitle);
}

function todaysdate(){
  var day = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
  var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');

  var current_date = new Date();
  month_value = current_date.getMonth();
  date_value = current_date.getDate();
  year_value = current_date.getFullYear();
  day_value = current_date.getDay();

  dateText = " on " + day[day_value] + ", " + months[month_value] + " " + date_value + ", " + year_value;

  document.write(dateText + " at ");
}

function currenttime(){

  ct=document.currenttime;
  var current_date = new Date();

  ct.hours.value = current_date.getHours();
  ct.mins.value = current_date.getMinutes();
  ct.secs.value = current_date.getSeconds();

  setTimeout("currenttime()",500);
}

function date(){
  var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');

  var current_date = new Date();
  month_value = current_date.getMonth();
  day_value = current_date.getDate();
  year_value = current_date.getFullYear();

  document.write(months[month_value] + " " + day_value + ", " + year_value);

}


function time(){
var current_date = new Date();
var hour_value = current_date.getHours();
var minute_value = current_date.getMinutes();
var second_value = current_date.getSeconds();

document.write(hour_value + ":" + minute_value + " " + second_value + " seconds");

}

function lastmodified(){

  // Specify the month and days arrays to use
  var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
  var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');

  //store the last modified date
  var date = new Date(document.lastModified);

  // extract the information from the last modified date
  month_value = date.getMonth();
  date_value = date.getDate();
  year_value = date.getFullYear();
  day_value = date.getDay();

  // finally output the information
  document.write(days[day_value] + " " + date_value + " "+ months[month_value] + " "+ year_value); 
}

function printWindow() {
bV = parseInt(navigator.appVersion);
if (bV >= 4) window.print();
}

function emailpage(){
var SubjectLine='Take a look at this web page I found, '+top.document.title; 
var BodyText='You can see this page at: '+top.location.href;

var Message='Send <A CLASS=contact HREF="mailto:?SUBJECT='+escape(SubjectLine)+'&BODY='+escape(BodyText)+'" OnMouseOver="status=\'Envoyer cette page à vos amis\'; return true;" TITLE="Send your friends e-mail about this page">this page<\/A> to a friend.';

var MessageIE='Send <A CLASS=contact HREF="mailto:?SUBJECT='+(SubjectLine)+'&BODY='+(BodyText)+'" OnMouseOver="status=\'Envoyer cette page à vos amis\'; 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 addbookmark(){
if (document.all)
  window.external.AddFavorite(bookmarkurl,bookmarktitle)
}

function NoRightClick(b) {
   if(((navigator.appName=="Microsoft Internet Explorer")&&(event.button > 1))
   ||((navigator.appName=="Netscape")&&(b.which > 1))){
   alert("Function Disabled!");
   return false;
   }
}
document.onmousedown = NoRightClick;

function showAppName(){
    alert(navigator.appName);
}

function showAppCodeName(){
    alert(navigator.appCodename);
}

function showAppVersion(){
    alert(navigator.appVersion);
}

function showJavaEnabled(){
    alert(navigator.javaEnabled());
}

function showMimeTypes(){
    alert(navigator.mimeTypes);
}

function showTaintEnabled(){
    alert(navigator.taintEnabled());
}

// ============================================================
// Start of image flip code

var count = 0;
var imgs = new Array();
var links = new Array();
var img_text = new Array();
var thisimg=0;

imgs[count]="Images/flip/Hayle_Beach2.jpg";
links[count]="http://www.beautifulcornwallholidays.co.uk";
img_text[count++]="Hayle Towans - Beautiful sandy beach";

imgs[count]="Images/flip/Hayle_Beach4.jpg";
links[count]="http://www.beautifulcornwallholidays.co.ukk";
img_text[count++]="Hayle Towans - 3 miles of golden beaches";

imgs[count]="Images/flip/Floral_Dance.jpg";
links[count]="http://www.beautifulcornwallholidays.co.uk";
img_text[count++]="Helston Floral Dance";

imgs[count]="Images/flip/glendurgan2.jpg";
links[count]="http://www.beautifulcornwallholidays.co.uk";
img_text[count++]="National Trust - Glendurgan Beach";

imgs[count]="Images/flip/glendurgan3.jpg";
links[count]="http://www.beautifulcornwallholidays.co.uk";
img_text[count++]="National Trust - House in Glendurgan maze";

imgs[count]="Images/flip/lappa_valley_1.jpg";
links[count]="http://www.beautifulcornwallholidays.co.uk";
img_text[count++]="Lappa Valley Railway - The arrival train";

imgs[count]="Images/flip/lappa_valley_2.jpg";
links[count]="http://www.beautifulcornwallholidays.co.uk";
img_text[count++]="Lappa Valley Railway - The Mine Engine";

imgs[count]="Images/flip/Lost_Gardens_Heligan1.jpg";
links[count]="http://www.beautifulcornwallholidays.co.uk";
img_text[count++]="The Lost Gardens of Heligan";

imgs[count]="Images/flip/mevagissey1.jpg";
links[count]="http://www.beautifulcornwallholidays.co.uk";
img_text[count++]="Mevagissey - Fishing nets";

imgs[count]="Images/flip/mevagissey2.jpg";
links[count]="http://www.beautifulcornwallholidays.co.uk";
img_text[count++]="Mevagissey - Sunset at Mevagissey";

imgs[count]="Images/flip/godrevy1.jpg";
links[count]="http://www.beautifulcornwallholidays.co.uk";
img_text[count++]="National Trust - Tin Mine at Godrevy";

imgs[count]="Images/flip/godrevy2.jpg";
links[count]="http://www.beautifulcornwallholidays.co.uk";
img_text[count++]="National Trust - Godrevy Lighthouse";

imgs[count]="Images/flip/seal_sanctuary2.jpg";
links[count]="http://www.beautifulcornwallholidays.co.uk";
img_text[count++]="Gweek Seal Sanctuary";

imgs[count]="Images/flip/St_Agnes_cliffs.jpg";
links[count]="http://www.beautifulcornwallholidays.co.uk";
img_text[count++]="St Agnes Cliffs";

imgs[count]="Images/flip/St_Michaels_Mount1.jpg";
links[count]="http://www.beautifulcornwallholidays.co.uk";
img_text[count++]="National Trust - St Michaels Mount";

imgs[count]="Images/flip/St_Michaels_Mount2.jpg";
links[count]="http://www.beautifulcornwallholidays.co.uk";
img_text[count++]="National Trust - Sunset at St Michaels Mount";

imgs[count]="Images/flip/Tehidy_Woods.jpg";
links[count]="http://www.beautifulcornwallholidays.co.uk";
img_text[count++]="Tehidy Woods";

imgs[count]="Images/flip/Trerice.jpg";
links[count]="http://www.beautifulcornwallholidays.co.uk";
img_text[count++]="National Trust - Trerice House";

function imageflip(imageName)
{
    if (document.images) {
        
        if (thisimg >= count)
        thisimg = 0;
        
        // Change the image source to the current picture
        document.images[imageName].src = imgs[thisimg];
        
        // Output the text for this picture
//        imagetext(thisimg);
        document.ImageFlip_Form.ImgText.value=img_text[thisimg];
//        alert(img_text[thisimg]);
        
        // Increment the image index ready for the next loop
        thisimg++;

        // Finally wait 3 seconds then call us again for next image
        setTimeout("imageflip('ImgFlip')",3000);
    }
}

function imagetext(imageIndex){

    document.ImageFlip_Form.value=img_text[imageIndex];
}

function imagelink(imageName){

    document.location.href=links[thisimg];
}

// End of Image flip code
// ============================================================

// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this notice.

// SETUPS:
// ===============================

// Set the horizontal and vertical position for the popup

PositionX = 20;
PositionY = 10;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)

defaultWidth  = 750;
defaultHeight = 750;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = true;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
writeln('<sc'+'ript>');
writeln('var clickmessage="All images on the Wise Action Website are copyright protected"');
writeln('function disableclick(e) {');
writeln('if (document.all) {');
writeln('if (event.button==2||event.button==3) {');
writeln('if (event.srcElement.tagName=="IMG"){');
writeln('alert(clickmessage);');
writeln('return false;');
writeln('}');
writeln('}');
writeln('}');
writeln('else if (document.layers) {');
writeln('if (e.which == 3) {');
writeln('alert(clickmessage);');
writeln('return false;');
writeln('}');
writeln('}');
writeln('else if (document.getElementById){');
writeln('if (e.which==3&&e.target.tagName=="IMG"){');
writeln('alert(clickmessage)');
writeln('return false');
writeln('}');
writeln('}');
writeln('}');
writeln('function associateimages(){');
writeln('for(i=0;i<document.images.length;i++)');
writeln('document.images[i].onmousedown=disableclick;');
writeln('}');
writeln('if (document.all)');
writeln('document.onmousedown=disableclick');
writeln('else if (document.getElementById)');
writeln('document.onmouseup=disableclick');
writeln('else if (document.layers)');
writeln('associateimages()');
writeln('</sc'+'ript>');
writeln('<sc'+'ript>');
writeln('var isNN,isIE;');
writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');
writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');
writeln('if (isIE){');
writeln('window.resizeTo(300,300);');
writeln('width=300-(document.body.clientWidth-document.images[0].width);');
writeln('height=300-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');
writeln('if (isNN){');       
writeln('window.innerWidth=document.images["George"].width;');
writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');
writeln('</sc'+'ript>');
if (!AutoClose) 
writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
close();		
}}

function mouseOver(name, image)
{
document.images[name].src = image;
}
function mouseOut(name, image)
{
document.images[name].src = image;
}

