function getVars(name)
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
	return "";
  else
	return results[1];
}

	//check for daylight savings time - functions thanks to http://www.codeproject.com/KB/datetime/DSTCalculator.aspx
    function DisplayDstSwitchDates()
    {
        var nd = new Date();
        var year = new Date().getYear();
        if (year < 1000)
            year += 1900;

        var firstSwitch = 0;
        var secondSwitch = 0;
        var lastOffset = 99;

        // Loop through every month of the current year
        for (i = 0; i < 12; i++)
        {
            // Fetch the timezone value for the month
            var newDate = new Date(Date.UTC(year, i, 0, 0, 0, 0, 0));
            var tz = -1 * newDate.getTimezoneOffset() / 60;

            // Capture when a timzezone change occurs
            if (tz > lastOffset)
                firstSwitch = i-1;
            else if (tz < lastOffset)
                secondSwitch = i-1;

            lastOffset = tz;
        }

        // Go figure out date/time occurences a minute before
        // a DST adjustment occurs
        var secondDstDate = FindDstSwitchDate(year, secondSwitch);
        var firstDstDate = FindDstSwitchDate(year, firstSwitch);

        //if (firstDstDate == null && secondDstDate == null)
        //    return 'Daylight Savings is not observed in your timezone.';
        //else
        //    return 'Last minute before DST change occurs in ' +
        //       year + ': ' + firstDstDate + ' and ' + secondDstDate;
        
        //Just want yes or no answer, no actual dates of change:
        if (firstDstDate == null && secondDstDate == null || nd > secondDstDate && nd < firstDstDate)
        	return 0;
        else
        	return 1;
    }

    function FindDstSwitchDate(year, month)
    {
        // Set the starting date
        var baseDate = new Date(Date.UTC(year, month, 0, 0, 0, 0, 0));
        var changeDay = 0;
        var changeMinute = -1;
        var baseOffset = -1 * baseDate.getTimezoneOffset() / 60;
        var dstDate;

        // Loop to find the exact day a timezone adjust occurs
        for (day = 0; day < 50; day++)
        {
            var tmpDate = new Date(Date.UTC(year, month, day, 0, 0, 0, 0));
            var tmpOffset = -1 * tmpDate.getTimezoneOffset() / 60;

            // Check if the timezone changed from one day to the next
            if (tmpOffset != baseOffset)
            {
                var minutes = 0;
                changeDay = day;

                // Back-up one day and grap the offset
                tmpDate = new Date(Date.UTC(year, month, day-1, 0, 0, 0, 0));
                tmpOffset = -1 * tmpDate.getTimezoneOffset() / 60;

                // Count the minutes until a timezone chnage occurs
                while (changeMinute == -1)
                {
                    tmpDate = new Date(Date.UTC(year, month, day-1, 0, minutes, 0, 0));
                    tmpOffset = -1 * tmpDate.getTimezoneOffset() / 60;

                    // Determine the exact minute a timezone change
                    // occurs
                    if (tmpOffset != baseOffset)
                    {
                        // Back-up a minute to get the date/time just
                        // before a timezone change occurs
                        tmpOffset = new Date(Date.UTC(year, month,
                                             day-1, 0, minutes-1, 0, 0));
                        changeMinute = minutes;
                        break;
                    }
                    else
                        minutes++;
                }

                // Add a month (for display) since JavaScript counts
                // months from 0 to 11
                dstDate = tmpOffset.getMonth() + 1;

                // Pad the month as needed
                if (dstDate < 10) dstDate = "0" + dstDate;

                // Add the day and year
                dstDate += '/' + tmpOffset.getDate() + '/' + year + ' ';
 
                // Capture the time stamp
                tmpDate = new Date(Date.UTC(year, month,
                                   day-1, 0, minutes-1, 0, 0));
                dstDate += tmpDate.toTimeString().split(' ')[0];
                return dstDate;
            }
        }
    }





function getDT(){
	var currentTime = new Date();
	var year = currentTime.getFullYear();
	var month = currentTime.getMonth() + 1;
	var day = currentTime.getDate();
	var hr = currentTime.getHours();
	var min = currentTime.getMinutes();

	if(month < 10){month = "0" + month}
	var ds = DisplayDstSwitchDates();
	if (ds == 1)
		hr = hr + 4;
	else
		hr = hr + 5;
	if(day < 10){day = "0" + day}
	if(hr < 10){hr = "0" + hr}
	min = Math.floor(Math.round(min)/10)*10;
	if(min < 10){min = "0" + min};
	var d = String(year) + String(month) + String(day) + String(hr) + String(min);

	return d;
}


function Right(str, n){
	if (n <= 0)
	   return "";
	else if (n > String(str).length)
	   return str;
	else {
	   var iLen = String(str).length;
	   return String(str).substring(iLen, iLen - n);
	}
}

function Left(str, n){
	if (n <= 0)
		return "";
	else if (n > String(str).length)
		return str;
	else
		return String(str).substring(0,n);
}


function getDold() {
	var ddt = getDT();
	var m = Right(ddt,2);
	var hh = "";

	if(m == 00){
		m = 50;
		hh = Right(ddt,4);
		hh = Left(String(hh),2);
		hh = hh - 1;
	}
	else {
		m = m - 10;
		if(m == 0){m = "0" + m}
		hh = Right(ddt,4);
		hh = Left(hh,2)
	}

	var dd = Left(ddt,8);
	dd = String(dd) + String(hh) + String(m);

	return dd;
}