﻿// Presentation Common JScript Functions
		
var horizontal_offset="9px"; 
//horizontal offset of hint box from anchor link


var vertical_offset="0" ;
//horizontal offset of hint box from anchor link. No need to change.
var ie=document.all;
var ns6=document.getElementById&&!document.all;

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1;
var windowedge;
if (whichedge=="rightedge"){
windowedge=ie && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-30 : window.pageXOffset+window.innerWidth-40;
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth;
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth+parseInt(horizontal_offset);
}
else{
windowedge=ie && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18;
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight;
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight;
}
return edgeoffset;
}

function showhint(menucontents, obj, e, tipwidth){
if ((ie||ns6) && document.getElementById("hintbox")){
dropmenuobj=document.getElementById("hintbox");
dropmenuobj.innerHTML=menucontents;
dropmenuobj.style.left=dropmenuobj.style.top=-500;
if (tipwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style;
dropmenuobj.widthobj.width=tipwidth;
}
dropmenuobj.x=getposOffset(obj, "left");
dropmenuobj.y=getposOffset(obj, "top");
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+"px";
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px";
dropmenuobj.style.visibility="visible";
obj.onmouseout=hidetip;
}
}

function hidetip(e){
dropmenuobj.style.visibility="hidden";
dropmenuobj.style.left="-500px";
}

function createhintbox(){
var divblock=document.createElement("div");
divblock.setAttribute("id", "hintbox");
document.body.appendChild(divblock);
}

if (window.addEventListener)
window.addEventListener("load", createhintbox, false);
else if (window.attachEvent)
window.attachEvent("onload", createhintbox);
else if (document.getElementById)
window.onload=createhintbox;

function Wait(millis) 
{
    var date = new Date();
    var curDate = null;

    do 
    {
        curDate = new Date();
    } 
    while(curDate-date < millis);
}

function MM_swapImgRestore()
{ 
//v3.0
    var i,x,a=document.MM_sr; 
    for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function move_in(img_name,img_src)
{
    document[img_name].src=img_src;
}

function move_out(img_name,img_src)
{
    document[img_name].src=img_src;
}


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];
            }
    }
}

function MM_findObj(n, d) 
{ //v4.01
    var p,i,x;
    if(!d)
        d=document;
    if((p=n.indexOf("?"))>0&&parent.frames.length)
    {
        d=parent.frames[n.substring(p+1)].document;
        n=n.substring(0,p);
    }
    if(!(x=d[n])&&d.all)
        x=d.all[n];
    for (i=0;!x&&i<d.forms.length;i++)
        x=d.forms[i][n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++)
        x=MM_findObj(n,d.layers[i].document);
    if(!x && d.getElementById)
        x=d.getElementById(n);
    return x;
}

function MM_swapImage()
{ //v3.0
    var i,j=0,x,a=MM_swapImage.arguments; 
    document.MM_sr=new Array; 
    for(i=0;i<(a.length-2);i+=3)
        if ((x=MM_findObj(a[i]))!=null)
        {
            document.MM_sr[j++]=x;
            if(!x.oSrc)
                x.oSrc=x.src;
            x.src=a[i+2];
        }
}

function ClientMapLoaded(sender)
{
    //The sender parameter gets passed the instance of the Map that has finished loading.
    alert("Map has finished loading");     
    
}     

function uploadpop(inForm)
{
	
	strUniqueID = Math.floor(Math.random() * 1000000) * ((new Date()).getTime() % 1000);				
	thePos = inForm.action.indexOf("?");
	if (thePos >= 0)
		inForm.action = inForm.action.substring(0, thePos);
	inForm.action += "?guid=" + strUniqueID;
	window.open("ProgressBar.aspx?guid=" + strUniqueID,"","toolbar=0,scrollbars=0,location=0,status=0,menubar=0,resizable=0,height=275,width=600,top=70,left=100");
	inForm.submit();
	return true;
	     
}


// GLOBALS 
// Define var at global page level scope and not at a local function 
// level when there is no persistent reference to it. They may be GC'd
// anytime after the function completes since there is no persistent reference to it.

var p;
    
function trapMe()
{
    var k = window.event.keyCode;
    if (navigator.appName == 'Netscape') 
        k = e.which;
    else
        k = window.event.keyCode;
    if (window.event && (k > 112 && k <= 123))
    {
        //window.event.keyCode = 8;
        //alert("you hit a function key: " + k);
               
        if (confirm("Select OK to continue, Cancel to abort" + '\n' + "Function Key: " + k))
        {            
            //document.getElementById("ctl00_btn_AppInfo").click();            
            //createNewDoc();
        }
        else
        {
            //window.document.forms[0].ctl00_tb_Status.value = "alert";
            show_popup();
        }
    }
    else
    {
        //if (navigator.appName == 'Netscape') 
        //    k = e.which;
        //else
        //    k = window.event.keyCode;

        //if (k == 13) 
        //{
        //    alert("you hit a function key: " + k);
        //    document.aspnetForm.submit();
        //    return false;
        //}
    }    
}

function getF1()
{
    var k = window.event.keyCode;
    window.event.cancelBubble = true;
    event.returnValue = false;
    alert("you hit F1");
    parent.opener = top;
    //window.open ("screen100.aspx","new_window","location=0");
    //parent.close();
}

function show_popup()
{
  // p is a global variable
  p = window.createPopup();
  var pbody = p.document.body;
  pbody.style.backgroundColor = "lime";
  pbody.style.border = "solid black 1px";
  pbody.innerHTML = "This is a pop-up! Click outside the pop-up to close.";
  p.show(500,500,200,50,document.body);
}

function createNewDoc()
{
  var newDoc = document.open("text/html"); 
  //,"replace");
  var txt = "<html><body>New Document Loaded, use the back button to return to previous document!</body></html>";
  newDoc.write(txt);
  newDoc.close();
}

function restart()
{
    var k = window.event.keyCode;
    window.event.cancelBubble = true;
    event.returnValue = false;
    alert("Application is restarting!!");
    parent.opener = top;
    window.open ("../../default.aspx","new_window","location=0");
    parent.close();
}

function window_onunload()
{
//window.open("../../../default.aspx");
}

function copyit(control)
{

    if(typeof document.selection != 'undefined')
    {

        var selectedText = document.selection;
        if (selectedText.type == 'Text')
        {
            var newRange = selectedText.createRange();
            document.getElementById('ctl00_ContentPlaceHolder1_ctl06_txb_AffiliateBanner1').focus();
            document.getElementById('ctl00_ContentPlaceHolder1_ctl06_txb_AffiliateBanner1').select();
            document.getElementById('ctl00_ContentPlaceHolder1_ctl06_txb_AffiliateBanner1').value = newRange.text; 
        }
        else
        {
            alert('Alert: Select The text in the first textbox then click on button'); 
        }

    }
    else
    {
        var input = document.forms['form1'].elements['ctl00_ContentPlaceHolder1_ctl06_txb_AffiliateBanner1'];var output = document.forms['form1'].elements['ctl00_ContentPlaceHolder1_ctl06_txb_AffiliateBanner1']; 
        var start = input.selectionStart;
        var end = input.selectionEnd;var insText = input.value.substring(start, end); 
        output.focus();
        output.value = insText;

    }

    return false; 
}

function CopyToClipboard(controlId)

{

   document.getElementById(controlId).focus();
   
   document.getElementById(controlId).select();
   
   
   //document.getElementById('ctl00_ContentPlaceHolder1_ctl06_txb_AffiliateBanner1').focus();
   
   //document.getElementById('ctl00_ContentPlaceHolder1_ctl06_txb_AffiliateBanner1').select();
   

   CopiedTxt = document.selection.createRange();

   CopiedTxt.execCommand("Copy");

}



//function copyit() 
//{
//    var selectedText = document.selection;
//    if (selectedText.type == 'Text') 
//    {
//        var newRange = selectedText.createRange();
       // document.getElementById('ctl00_ContentPlaceHolder1_ctl06_txb_AffiliateBanner1').focus();
//        document.getElementById('ctl00_ContentPlaceHolder1_ctl06_txb_AffiliateBanner1').value = newRange.text;
//    } 
//    else 
//    {
//      alert('Alert: Select The text in the first textbox then click on button');
//    }
//    return false;
//}

function printit()
{
    var NS = (navigator.appName == "Netscape");

    if (NS)
    {
        window.print() ;
    }
    else
    {
        var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
        document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
        WebBrowser1.ExecWB(6, 2); 
        //Use a 1 vs. a 2 for a prompting dialog box WebBrowser1.outerHTML = "";
    }
}

function updateWeather()
{
    var labelL = document.getElementById('ctl00_currentLoc');
    var labelD = document.getElementById('ctl00_currentDesc');
    var labelT = document.getElementById('ctl00_currentTemp');
    
    if (labelD && labelT) {
        var loc = new String();
        var desc = new String();
        var temp = new String();
        labelL.innerHTML = loc;
        labelD.innerHTML = desc;
        labelT.innerHTML = temp;       
    }
}

function updateTimeMaster()
{
    var labelT = document.getElementById('ctl00_currentTime');
    var labelD = document.getElementById('ctl00_currentDate');
    //var now = new Date();

    
    if (labelT && labelD) {
        var time = (new Date()).localeFormat("T"); 
        //("h:MM TT"); //.localeFormat("T");
        var date = (new Date()).localeFormat("D");
        // now.format("h:MM TT");
        time = dateFormat("shortTime");

        labelT.innerHTML = time;
        //labelD.innerHTML = date;       
    }
}

updateTimeMaster();
window.setInterval(updateTimeMaster, 1000);

function updateTime()
{
    var labelT = document.getElementById('currentTime');
    var labelD = document.getElementById('currentDate');
    //var now = new Date();

    
    if (labelT && labelD) {
        var time = (new Date()).localeFormat("T") 
        //("h:MM TT"); //.localeFormat("T");
        var date = (new Date()).localeFormat("D");
        //now.format("h:MM TT");
        time = dateFormat("shortTime");

        labelT.innerHTML = time;
        labelD.innerHTML = date;       
    }
}

updateTime();
window.setInterval(updateTime, 1000);
var timeZoneHold;
//var tick = 0;

function setTick()
{
    //tick = 1;
    timeZoneHold = '';
}

function updateAreaTime()
{
    var labelAT = document.getElementById('lblTime'); 
    // the lable to update
    var timeZone = document.getElementById('hiddenTime'); 
    // the timezone from server
    //var timeZoneInd = document.getElementById('hiddenZoneInd');
    var dst = 0;       
    // set to 1 for daylight savings time
                       // update this as you go on and off daylight saving time
    //var loc = labelAT.innerHTML; //'Sydney, Australia'; // set to your location
    //var mtz = labelAT.innerHTML;      // set to your local timezone (hours ahead of UTC, negative if behind)
    
    var stdz = 'AEST'; 
    // standard time indicator
    
    var dayz = 'ADST'; 
    // daylight saving time indicator (blank if you dont have daylight saving)
    
    if (labelAT && timeZone)
    {
        // has the timezone changed?
        //if (tick > 0)
        //{
            if (timeZone.innerHTML != '')
            {
                // if timezone actually is different then update
                if (timeZoneHold != timeZone.innerHTML)
                { 
                    timeZoneHold = timeZone.innerHTML;
                    timeZone.innerHTML = '';
                    //tick = 0;
                }               
            }
        //}
        // mlk test
        timeZone.innerHTML = '';
        var mtz = timeZoneHold; 
        //timeZone.innerHTML;
        if(mtz)
        {
            if(mtz != '')
            {
                mtz = parseInt(mtz);
                var time = setDsp(mtz,dst,stdz,dayz);
                //(new Date()).localeFormat("T");
                labelAT.innerHTML = time;
                
            
            }
        }            
    }
    
}

updateAreaTime();
window.setInterval(updateAreaTime, 1000);

function displaybackday(offset)
{
    var pastdate=new Date();
    pastdate.setDate(new Date().getDate()+offset);
    document.write('<p>'+pastdate.toLocaleString()+'</p>');
}
//displaybackday(-30) //display date/ time -30 days from today
//displaybackday(-60) //display date/ time -30 days from today

function setHourglass()
{
    document.body.style.cursor = 'wait';
}

function ieAjaxBeginRequest(sender, args)
{
    document.body.style.cursor = "wait";
}

function ieAjaxPageLoaded(sender, args)
{		
    document.body.style.cursor = "default";
} 


function OpenChild() 
{
    var ParmA = retvalA.value;
    var ParmB = retvalB.value;
    var ParmC = retvalC.value;
    var MyArgs = new Array(ParmA, ParmB, ParmC);
    var WinSettings = "center:yes;resizable:no;dialogHeight:300px"
    
    MyArgs = window.showModalDialog(
   "http://localhost/Presentation/Common/ModalDialog.aspx", MyArgs, WinSettings);
    if (MyArgs == null)
    {
        window.alert(
          "Nothing returned from child. No changes made to input boxes")
    }
    else
    {
        retvalA.value=MyArgs[0].toString();
        retvalB.value=MyArgs[1].toString();
        retvalC.value=MyArgs[2].toString();
    }
}

function splitterOnResize(width)
{
	// do any other work that needs to happen when the 
	// splitter resizes. this is a good place to handle 
	// any complex resizing rules, etc.

	// make sure the width is in number format
	if (typeof width == "string")
	{
		width = new Number(width.replace("px",""));
	}

}

//if ((navigator.appVersion.indexOf("MSIE") > 0)
//  && (parseInt(navigator.appVersion) >= 4)) {
//    var sText = "<u><span style='color:blue;cursor:hand;'";
//    sText += "onclick='window.external.AddFavorite(location.href,";
//    sText += "document.title);'>Add this page to your favorites</span></u>";
//    document.write(sText);
//    }

function cancelClick(e) 
{
    //if (e.type=='click')
    //{
    //  alert('Disabled');
        //window.event.returnValue = false;
    //}
}

        function PanelClick(sender, e) {
            var Messages = $get('<%=Messages.ClientID%>');
            //Highlight(Messages);
        }

        function ActiveTabChanged(sender, e) {
            var CurrentTab = $get('<%=CurrentTab.ClientID%>');
            // CurrentTab.innerHTML = sender.get_activeTab().get_headerText();
            // Highlight(CurrentTab);
        }

        var HighlightAnimations = {};
        
        //function Highlight(el) {
        //    if (HighlightAnimations[el.uniqueID] == null) {
        //        HighlightAnimations[el.uniqueID] = AjaxControlToolkit.Animation.createAnimation({
        //            AnimationName : "color",
        //            duration : 0.5,
        //            property : "style",
        //            propertyKey : "backgroundColor",
        //            startValue : "#FFFF90",
        //            endValue : "#FFFFFF"
        //        }, el);
        //    }
        //    HighlightAnimations[el.uniqueID].stop();
        //    HighlightAnimations[el.uniqueID].play();
        //}
        
        
        function ToggleHidden(value) {
            $find('<%=Tabs.ClientID%>').get_tabs()[2].set_enabled(value);
        }
          

function Upper(e,r)
{
    if (e.keyCode > 96 && e.keyCode < 123)
    {
        r.value = r.value.toUpperCase() + String.fromCharCode(e.keyCode-32).toUpperCase();
        return false;
    }
}

function formatDate(dateValue, format)
{ 


//The variable dateValue is a JavaScript date/time value. The variable format is a string. The string holds the format. There are two allowed separators between months, days, and years - they are the dash (aka hyphen) and the slash. Between the separators are the months, days, and years. If you want to force a leading zero for the month, then you should include MM for the month value. A single M for the month value will drop the leading zero. It works the same way for days - you can include either DD or D for the days. The year value is always four digits, so YYYY needs to be used. 

//For example, the following are valid format strings: 
//MM/DD/YYYY This will be a two digit month, then a slash, then a two digit day, then a slash, then a four digit year. 
//DD-MM-YYYY This will be a two digit day, then a dash, then a two digit month, then a dash, then a four digit year. 
//YYYY/M/D This will be a four digit year, then a slash, then the month without a leading zero, then a slash, then a day without a leading zero. 

//The following are not valid format strings: 
//MM/DD-YYYY This is not valid because the separator needs to be the same in both positions. 
//MM~DD~YYYY This is not valid because the tilde is not a valid separator. 
//MM/DD/YY This is not valid because the year has to be 4 digits. 

//Any invalid format is converted to MM/DD/YYYY (the US format). Obviously, you can change the code if you want to make the default be another format or allow for additional formats. 

//The first part of the code validates the format: 

    var fmt = format.toUpperCase(); 
    var re = /^(M|MM|D|DD|YYYY)([\-\/]{1})(M|MM|D|DD|YYYY)(\2)(M|MM|D|DD|YYYY)$/; 
    if (!re.test(fmt)) { fmt = "MM/DD/YYYY"; } 
    if (fmt.indexOf("M") == -1) { fmt = "MM/DD/YYYY"; } 
    if (fmt.indexOf("D") == -1) { fmt = "MM/DD/YYYY"; } 
    if (fmt.indexOf("YYYY") == -1) { fmt = "MM/DD/YYYY"; } 

//I use a regular expression to do the first part of the validation, then make sure that all three pieces (month, day, and year) are included. This is because a format string of MM/MM/MM would pass the validation but is not a valid format string. 

//The next thing the code does is get one and two digit months, one and two digit days, and a four digit year: 

    var M = "" + (dateValue.getMonth()+1); 
    var MM = "0" + M; 
    MM = MM.substring(MM.length-2, MM.length); 
    var D = "" + (dateValue.getDate()); 
    var DD = "0" + D; 
    DD = DD.substring(DD.length-2, DD.length); 
    var YYYY = "" + (dateValue.getFullYear()); 


//To get the single digit and two digit values, I first create the "without leading zero" value. Let's look at the month as an example. I want it to be a string, so I force the empty string at the start and then append the month value. So the variable M has a value of "0" through "12". Then I put a leading zero on the front to get MM. That leading zero is fine for "01" through "09", but it isn't right for "010" through "012". So the second statement takes the last two characters. 

//The next thing to do is figure out what separator was used and split up the format string into three pieces based on the separator. 

    var sep = "/"; 
    if (fmt.indexOf("-") != -1) { sep = "-"; } 
    var pieces = fmt.split(sep); 
    var result = ""; 

//Finally, the variable result is built with the three pieces. Each piece needs to be looked at independently and the correct variable added to the result string. For example, here is the first part of the result: 
 switch (pieces[0]) { 
         case "M" : result += M + sep; break; 
         case "MM" : result += MM + sep; break; 
         case "D" : result += D + sep; break; 
         case "DD" : result += DD + sep; break; 
         case "YYYY" : result += YYYY + sep; break; 
    } 

//If the first piece is the month without a leading zero, then the variable M and the separator are added to the result string. The second and third pieces of the result string are added in a similar fashion: 

    switch (pieces[1]) { 
         case "M" : result += M + sep; break; 
         case "MM" : result += MM + sep; break; 
         case "D" : result += D + sep; break; 
         case "DD" : result += DD + sep; break; 
         case "YYYY" : result += YYYY + sep; break; 
    } 
    switch (pieces[2]) { 
         case "M" : result += M; break; 
         case "MM" : result += MM; break; 
         case "D" : result += D; break; 
         case "DD" : result += DD; break; 
         case "YYYY" : result += YYYY; break; 
    } 
//When the full result string is built, that is returned as the value of the function: 
    return result; 
} 

//So, this function should be able to give you the text representation of a date value in the desired format. Like I said earlier, this code can be modified to include other separators, or change the default format, or include the possibility of a two digit year.



var urlAddress = "http://www.allaboutthearea.com"; 
var pageName = "All About The Area - The Site To Be Seen"; 
function addToFavorites()
{ 
    if (window.external)
    { 
        window.external.AddFavorite(urlAddress,pageName);
    } 
    else
    { 
        alert("Sorry! Your browser doesn't support this feature.");
    }
} 

// display current time at author location
// =======================================
// copyright Stephen Chapman, Felgall Pty Ltd, 11 July 2001, 25th November 2004
// http://www.felgall.com/ and http://javascript.about.com/
// permission is given to use this script
// provided that all comment lines in the script are retained

function myTime() {
var dst = 0;       
// set to 1 for daylight savings time
                   // update this as you go on and off daylight saving time

var loc = 'Sydney, Australia'; 
// set to your location
var mtz = 10;      
// set to your local timezone (hours ahead of UTC, negative if behind)
var stdz = 'AEST'; 
// standard time indicator
var dayz = 'ADST'; 
// daylight saving time indicator (blank if you dont have daylight saving)

// do not alter anything below this line
document.writeln('The time in ' + loc + ' is <span id="time">' + setDsp(mtz,dst,stdz,dayz) + '<\/span>');
if (DOMsupported) setTimeout('updDsp('+mtz+',' +dst+',"' +stdz+'","' +dayz+'")', 5000);
}

var DOMsupported = 0;var standardDOMsupported = 0;var ieDOMsupported = 0;
if (document.getElementById) { standardDOMsupported = 1; DOMsupported = 1;}
else { if (document.all) {ieDOMsupported = 1; DOMsupported = 1;}
}
function findDOM(objectId) {
if (standardDOMsupported) {return (document.getElementById(objectId));}
if (ieDOMsupported) {return (document.all[objectId]);}
}

function updDsp(mtz,dst,stdz,dayz) {
var obj = findDOM('time');
obj.innerHTML = setDsp(mtz,dst,stdz,dayz);
setTimeout('updDsp('+mtz+ ','+dst+ ',"'+stdz+ '","'+dayz+ '")', 5000);
}

function setDsp(mtz,dst,stdz,dayz) {
var dayname = new Array ('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday','Friday', 'Saturday', 'Sunday');
var now = new Date;
now.setUTCMinutes(now.getUTCMinutes() + (mtz + dst)*60);

var dow = now.getUTCDay();
var minute = now.getUTCMinutes();
var hour = now.getUTCHours();
var sec = now.getUTCSeconds();
if (hour > 11) {ampm = 'PM'; hour -= 12;} else {ampm = 'AM'}
if (hour == 0) {hour = 12;} if (minute < 10) {pad = ':0';} else {pad = ':';}if (sec < 10) {pads = ':0';} else {pads = ':';}
//var txt = dayname[dow].substring(0,3) + ', ' + hour + pad + minute + pads + sec + ' ' + ampm + ' ';
var txt = dayname[dow].substring(0,3) + ', ' + hour + pad + minute + ' ' + ampm + ' ';
//if (dst) txt += dayz; else txt += stdz;
//txt += ' on ' + dayname[dow];
return (txt);
}
                  

//
 //* Date Format 1.2.2
 //* (c) 2007-2008 Steven Levithan <stevenlevithan.com>
 //* MIT license
 //* Includes enhancements by Scott Trenda <scott.trenda.net> and Kris Kowal <cixar.com/~kris.kowal/>
// *
// * Accepts a date, a mask, or a date and a mask.
// * Returns a formatted version of the given date.
// * The date defaults to the current date/time.
 //* The mask defaults to dateFormat.masks.default.
 //*/
var dateFormat = function () {
	var	token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
		timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
		timezoneClip = /[^-+\dA-Z]/g,
		pad = function (val, len) {
			val = String(val);
			len = len || 2;
			while (val.length < len) val = "0" + val;
			return val;
		};

	// Regexes and supporting functions are cached through closure
	return function (date, mask, utc) {
		var dF = dateFormat;

		// You can't provide utc if you skip other args (use the "UTC:" mask prefix)
		if (arguments.length == 1 && (typeof date == "string" || date instanceof String) && !/\d/.test(date)) {
			mask = date;
			date = undefined;
		}

		// Passing date through Date applies Date.parse, if necessary
		date = date ? new Date(date) : new Date();
		if (isNaN(date)) throw new SyntaxError("invalid date");

		mask = String(dF.masks[mask] || mask || dF.masks["default"]);

		// Allow setting the utc argument via the mask
		if (mask.slice(0, 4) == "UTC:") {
			mask = mask.slice(4);
			utc = true;
		}

		var	_ = utc ? "getUTC" : "get",
			d = date[_ + "Date"](),
			D = date[_ + "Day"](),
			m = date[_ + "Month"](),
			y = date[_ + "FullYear"](),
			H = date[_ + "Hours"](),
			M = date[_ + "Minutes"](),
			s = date[_ + "Seconds"](),
			L = date[_ + "Milliseconds"](),
			o = utc ? 0 : date.getTimezoneOffset(),
			flags = {
				d:    d,
				dd:   pad(d),
				ddd:  dF.i18n.dayNames[D],
				dddd: dF.i18n.dayNames[D + 7],
				m:    m + 1,
				mm:   pad(m + 1),
				mmm:  dF.i18n.monthNames[m],
				mmmm: dF.i18n.monthNames[m + 12],
				yy:   String(y).slice(2),
				yyyy: y,
				h:    H % 12 || 12,
				hh:   pad(H % 12 || 12),
				H:    H,
				HH:   pad(H),
				M:    M,
				MM:   pad(M),
				s:    s,
				ss:   pad(s),
				l:    pad(L, 3),
				L:    pad(L > 99 ? Math.round(L / 10) : L),
				t:    H < 12 ? "a"  : "p",
				tt:   H < 12 ? "am" : "pm",
				T:    H < 12 ? "A"  : "P",
				TT:   H < 12 ? "AM" : "PM",
				Z:    utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""),
				o:    (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
				S:    ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10]
			};

		return mask.replace(token, function ($0) {
			return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);
		});
	};
}();

// Some common format strings
dateFormat.masks = {
	"default":      "ddd mmm dd yyyy HH:MM:ss",
	shortDate:      "m/d/yy",
	mediumDate:     "mmm d, yyyy",
	longDate:       "mmmm d, yyyy",
	fullDate:       "dddd, mmmm d, yyyy",
	shortTime:      "h:MM TT",
	mediumTime:     "h:MM:ss TT",
	longTime:       "h:MM:ss TT Z",
	isoDate:        "yyyy-mm-dd",
	isoTime:        "HH:MM:ss",
	isoDateTime:    "yyyy-mm-dd'T'HH:MM:ss",
	isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
};

// Internationalization strings
dateFormat.i18n = {
	dayNames: [
		"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
		"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
	],
	monthNames: [
		"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
		"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
	]
};

// For convenience...
Date.prototype.format = function (mask, utc) {
	return dateFormat(this, mask, utc);
}

/*
Script Name: Full Featured Javascript Browser/OS detection
Authors: Harald Hope, Tapio Markula, Websites: http://techpatterns.com/
http://www.nic.fi/~tapio1/Teaching/index1.php3
Script Source URI: http://techpatterns.com/downloads/javascript_browser_detection.php
Version 4.2.4
Copyright (C) 29 June 2007

This program is free software; you can redistribute it and/or modify it under 
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Get the full text of the GPL here: http://www.gnu.org/licenses/gpl.txt

Coding conventions:
http://cvs.sourceforge.net/viewcvs.py/phpbb/phpBB2/docs/codingstandards.htm?rev=1.3
*/

/*************************************************************
Full version, use it if you are pushing css to its functional limits, and/or are using 
specialized javascript.

Remember, always use method or object testing as your first choice, for example, if ( dom ) { statement; };

This browser detection includes all possibilities I think for most browsers.
Let me know if you find an error or a failure to properly detect, or if there
is a relevant browser that has special needs for detection at our tech forum:
http://techpatterns.com/forums/forum-11.html
The main script is separated from the initial netscape 4 detection due to certain bugs in
netscape 4 when it comes to unknown things like d.getElementById. The variable declarations
of course are made first to make sure that all the variables are global through the page, 
otherwise a javascript error will occur because you are trying to use an undeclared variable.

We test for both browser type (ie, op, or moz/netscape > 6) and version number, then place 
the version number into a variable which can be tested for < or > values, such as 
if (moz && nu> 1.1){....statement....;}
This seems quite reliable, especially for Opera and Mozilla, where there is no other
easy way to get the actual version number.

For more in depth discussion of css and browser issues go to:
http://www.nic.fi/~tapio1/Teaching/DynamicMenusb.php#detections
http://www.nic.fi/~tapio1/Teaching/FAQ.php3

***************************************************************/
//initialization, browser, os detection
var d, dom, nu='', brow='', ie, ie4, ie5, ie5x, ie6, ie7;
var ns4, moz, moz_rv_sub, release_date='', moz_brow, moz_brow_nu='', moz_brow_nu_sub='', rv_full=''; 
var mac, win, old, lin, ie5mac, ie5xwin, konq, saf, op, op4, op5, op6, op7;

d=document;
n=navigator;
nav=n.appVersion;
nan=n.appName;
nua=n.userAgent;
old=(nav.substring(0,1)<4);
mac=(nav.indexOf('Mac')!=-1);
win=( ( (nav.indexOf('Win')!=-1) || (nav.indexOf('NT')!=-1) ) && !mac)?true:false;
lin=(nua.indexOf('Linux')!=-1);
// begin primary dom/ns4 test
// this is the most important test on the page
if ( !document.layers )
{
	dom = ( d.getElementById ) ? d.getElementById : false;
}
else { 
	dom = false; 
	ns4 = true;// only netscape 4 supports document layers
}
// end main dom/ns4 test

op=(nua.indexOf('Opera')!=-1);
saf=(nua.indexOf('Safari')!=-1);
konq=(!saf && (nua.indexOf('Konqueror')!=-1) ) ? true : false;
moz=( (!saf && !konq ) && ( nua.indexOf('Gecko')!=-1 ) ) ? true : false;
ie=((nua.indexOf('MSIE')!=-1)&&!op);
if (op)
{
	str_pos=nua.indexOf('Opera');
	nu=nua.substr((str_pos+6),4);
	brow = 'Opera';
}
else if (saf)
{
	str_pos=nua.indexOf('Safari');
	nu=nua.substr((str_pos+7),5);
	brow = 'Safari';
	//document.write('<b>' + (new Date).toLocaleString() + '</b>');
	// Hack for menu not showing up
	document.write('');
}
else if (konq)
{
	str_pos=nua.indexOf('Konqueror');
	nu=nua.substr((str_pos+10),3);
	brow = 'Konqueror';
}
// this part is complicated a bit, don't mess with it unless you understand regular expressions
// note, for most comparisons that are practical, compare the 3 digit rv nubmer, that is the output
// placed into 'nu'.
else if (moz)
{
	// regular expression pattern that will be used to extract main version/rv numbers
	pattern = /[(); \n]/;
	// moz type array, add to this if you need to
	moz_types = new Array( 'Firebird', 'Phoenix', 'Firefox', 'Iceweasel', 'Galeon', 'K-Meleon', 'Camino', 'Epiphany', 'Netscape6', 'Netscape', 'MultiZilla', 'Gecko Debian', 'rv' );
	rv_pos = nua.indexOf( 'rv' );// find 'rv' position in nua string
	rv_full = nua.substr( rv_pos + 3, 6 );// cut out maximum size it can be, eg: 1.8a2, 1.0.0 etc
	// search for occurance of any of characters in pattern, if found get position of that character
	rv_slice = ( rv_full.search( pattern ) != -1 ) ? rv_full.search( pattern ) : '';
	//check to make sure there was a result, if not do  nothing
	// otherwise slice out the part that you want if there is a slice position
	( rv_slice ) ? rv_full = rv_full.substr( 0, rv_slice ) : '';
	// this is the working id number, 3 digits, you'd use this for 
	// number comparison, like if nu >= 1.3 do something
	nu = rv_full.substr( 0, 3 );
	for (i=0; i < moz_types.length; i++)
	{
		if ( nua.indexOf( moz_types[i]) !=-1 )
		{
			moz_brow = moz_types[i];
			break;
		}
	}
	if ( moz_brow )// if it was found in the array
	{
		str_pos=nua.indexOf(moz_brow);// extract string position
		moz_brow_nu = nua.substr( (str_pos + moz_brow.length + 1 ) ,3);// slice out working number, 3 digit
		// if you got it, use it, else use nu
		moz_brow_nu = ( isNaN( moz_brow_nu ) ) ? moz_brow_nu = nu: moz_brow_nu;
		moz_brow_nu_sub = nua.substr( (str_pos + moz_brow.length + 1 ), 8);
		// this makes sure that it's only the id number
		sub_nu_slice = ( moz_brow_nu_sub.search( pattern ) != -1 ) ? moz_brow_nu_sub.search( pattern ) : '';
		//check to make sure there was a result, if not do  nothing
		( sub_nu_slice ) ? moz_brow_nu_sub = moz_brow_nu_sub.substr( 0, sub_nu_slice ) : '';
	}
	if ( moz_brow == 'Netscape6' )
	{
		moz_brow = 'Netscape';
	}
	else if ( moz_brow == 'rv' || moz_brow == '' )// default value if no other gecko name fit
	{
		moz_brow = 'Mozilla';
	} 
	if ( !moz_brow_nu )// use rv number if nothing else is available
	{
		moz_brow_nu = nu;
		moz_brow_nu_sub = nu;
	}
	if (n.productSub)
	{
		release_date = n.productSub;
	}
}
else if (ie)
{
	str_pos=nua.indexOf('MSIE');
	nu=nua.substr((str_pos+5),3);
	brow = 'Microsoft Internet Explorer';
}
// default to navigator app name
else 
{
	brow = nan;
}
op5=(op&&(nu.substring(0,1)==5));
op6=(op&&(nu.substring(0,1)==6));
op7=(op&&(nu.substring(0,1)==7));
op8=(op&&(nu.substring(0,1)==8));
op9=(op&&(nu.substring(0,1)==9));
ie4=(ie&&!dom);
ie5=(ie&&(nu.substring(0,1)==5));
ie6=(ie&&(nu.substring(0,1)==6));
ie7=(ie&&(nu.substring(0,1)==7));
// default to get number from navigator app version.
if(!nu) 
{
	nu = nav.substring(0,1);
}
/*ie5x tests only for functionavlity. dom or ie5x would be default settings. 
Opera will register true in this test if set to identify as IE 5*/
ie5x=(d.all&&dom);
ie5mac=(mac&&ie5);
ie5xwin=(win&&ie5x);
