// Various date formats - FyneWeb-Design February 2009 //

var theSuffix = "th",  theWeek = 1, theDate = new Date(), ampm="", ampmhour="";
var NowTime = "", NowDay = "", NowDate = "", ShortDate = "", UpDate = "";
var theSeason = "", theComment= "", CountDown= "";

	thehours = theDate.getHours();
	ampmhour  =  (thehours > 12) ? thehours - 12 : thehours;
	ampm =  (thehours >= 12) ? 'pm' : 'am';
	thetime = theDate.getMinutes();
	theminutes =  ((thetime < 10) ? ':0' : ':') + thetime;
NowTime = (ampmhour + theminutes + ampm + " ");

	theDay = theDate.getDay();
	theNum = theDate.getDate();
	theMonth = theDate.getMonth();
	theYear = theDate.getFullYear();
	year = theYear;

var Days = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
// var Days = new Array("Sun","Mon","Tues","Wed","Thurs","Frid","Sat")
NowDay = (Days[theDay] + " ");

var Months = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
// var Months = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
	if (theNum == '1' || theNum == '21' || theNum == '31') var theSuffix = 'st';
	else if (theNum == '2' || theNum == '22')  var theSuffix = 'nd';
	else if (theNum == '3' || theNum == '23')  var theSuffix = 'rd';
	if (theNum > 0) var theWeek = 0
	// if (theNum > 15) var theWeek = 0

NowDate = (theNum +  theSuffix +  " " + Months[theMonth] + " " + theYear);
ShortDate =  (theNum +  "/" + (theMonth + 1) + "/" + theYear);
TimeDate = (NowTime + " " + NowDay + " " + NowDate);
UpDate= (Months[theMonth - theWeek]) + " " + (theYear);

// The Client
function mClick(src) {
	src.children.tags('a')[0].click();
}
// Hide e-mail address

var who = "info";
var aat = "&#64;"
var url = "cairnbaan.com";
var subj = "?subject=Cairnbaan Web site Enquiry";
var eml = who + aat + url;

// Tele/Fax/e-mail
// document.write("<link rel='stylesheet' type='text/css' href='fyne-style.css'>");
// document.oncontextmenu=new Function("return false");
var fyneweb = "Website designed by <a class='fyneweb' href='http://www.fyneweb-design.com/'>FyneWeb-Design</a> " + theDate.getFullYear() + ".";
var client = "Cairnbaan Hotel &#169;" + " " + theDate.getFullYear() + ".";
var vatreg= "VAT Registration No. xxxxxxxxx"
var tele = "Tele:<br>+44 (0) 1546 603668";
var tele1 = "<b>Tele:</b> +44 (0) 1546 603668<p><b>Fax:</b> +44 (0) 1546 606045";
var tele2 = "<b>Tele:</b>  +44 (0) 1546 603668 or <b>Fax:</b> +44 (0) 1546 606045";
var emale = "Email: <a class='fynelnk' href='mailto:" + eml + subj + "'>" + eml + "</a>";
var email0 = "<b>Email:</b> <a href='mailto:" + eml + subj + "'>" + eml + "</a>";
var email1 = "<a href='mailto:" + eml + "'><img border='0' src='images/email.gif' title='Email'>"+eml+"</a>";
var email2 = "Email: <a href='mailto:" + eml + "'><img border='0' src='images/email.gif' title='Email'><br>"+eml+"</a>";
var PostComm = "<a href=&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#111;&#102;&#102;&#105;&#99;&#101;&#49;&#64;&#97;&#114;&#103;&#121;&#108;&#108;&#52;&#115;&#97;&#108;&#101;&#46;&#110;&#101;&#116;&#63;&#83;&#117;&#98;&#106;&#101;&#99;&#116;&#61;&#87;&#101;&#98;&#32;&#69;&#110;&#113;&#117;&#105;&#114;&#121;&#32;&#97;&#98;&#111;&#117;&#116;"

// Christmas Menu Automation 10thNov - 18thDec
var today=new Date()
var trigger =new Date(today.getFullYear(), 10, 10) // Year, Month, Day - 10thNov
var christmas=new Date(today.getFullYear(), 11, 25) //Year, Month, Day - 25thDec
var one_day=1000*60*60*24

// Calculate difference btw the two dates, and convert to days
var leadtime=(Math.ceil((christmas.getTime()-today.getTime())/(one_day)))

// What to print on the page
if (leadtime > 6 && leadtime < 46) // 18thDec - End Menu option
theSeason = ("<a href='xmas.htm' class='fyneweb'>Festive Menu</a>&nbsp;<a href='xmas.htm' class='fyneweb'><img border='0' src='images/bellani.gif' width='22' height='23'></a>");
if (leadtime > 0 && leadtime < 46) // 10thNov - 25thDec
CountDown= (leadtime + " days left until Christmas!\n");
if (leadtime == 0 ) // 25th December
CountDown= ("Happy Christmas everyone !\n");



//<script language="javascript">document.write(CountDown)</script>
//<script language="javascript">document.write(theSeason)</script>
