/* ---------------------------------------------------------------
   Copyright © 2010, ECO Services International
   --------------------------------------------------------------- */

function CalDn() {
	var n = new Date();
	var d = n.getDate();
	var m = n.getMonth() + 1;
	var y = n.getFullYear();
	window.location = "/cgi-local/cal/calendar.pl?calendar=std&public_access_op=on&action=view_day&day=" + d + "&year=" + y + "&month=" + m;
}
function CalDt() {
	var n = new Date();
	var d = n.getDate() + 1;
	var m = n.getMonth() + 1;
	var y = n.getFullYear();
	window.location = "/cgi-local/cal/calendar.pl?calendar=std&public_access_op=on&action=view_day&day=" + d + "&year=" + y + "&month=" + m;
}

function CalWe() {
	var n = new Date();
	var d = n.getDate();
	var w = n.getDay();
	var m = n.getMonth() + 1;
	var y = n.getFullYear();
	var s = ((d - w) + 1 < 1) ? 1 : (d - w) + 1;
	var x = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
	var z = x[m-1];
	if (m == 2) {
		if (y%4 == 0) z = 29;
	}
	var e = ((7 - w) + d > z) ? z : (7 - w) + d;
	window.location = "/cgi-local/cal/calendar.pl?calendar=std&public_access_op=on&action=view_week&month=" + m + "&year=" + y + "&start=" + s + "&end=" + e;
}

function CalMo() {
	var n = new Date();
	var m = n.getMonth() + 1;
	var y = n.getFullYear();
	window.location = "/cgi-local/cal/calendar.pl?calendar=std&public_access_op=on&action=view_month&month=" + m + "&year=" + y;
}

function CalHlp(hlp) {
//	var wW = 480;
//	var wH = 360;
	var sX = (top.screenLeft) ? top.screenLeft : top.screenX;
	var sY = (top.screenTop) ? (top.screenTop-64) : top.screenY;
	if (window.outerWidth) var wX = top.window.outerWidth;
		else if (document.body.offsetWidth) var wX = top.document.body.offsetWidth;
	if (window.outerHeight) var wY = top.window.outerHeight;
		else if (document.all) var wY = (document.documentElement.clientHeight) ? top.document.documentElement.clientHeight : top.document.body.offsetHeight;
	var wW = wX * 0.66;
	var wH = wY / 2;
	var Hlp = window.open(hlp,"cal_hlp","dependent=1,scrollbars=1,width=" + wW + ",height=" + wH + ",left=" + (((wX/2)-(wW/2))+sX) + "px,top=" + (((wY/2)-(wH/2))+sY) + "px");
	Hlp.focus();
}

function aci(e) {
	var e = e.srcElement || e.target;
	e = e.parentNode.parentNode;
	var d = e.getElementsByTagName("SPAN");
	d = "DTSTART:" + d[0].innerHTML.replace(/-/g,"") + "\n";
	var l = e.getElementsByTagName("A");
	l = "URL;VALUE=URI:" + l[0].href + "\n";
	var s = "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//EcoWeb//NONSGML v1.0//EN\nBEGIN:VEVENT\n";
	for (var i = 0; i < e.childNodes.length; i++) {
		if (e.childNodes[i].className == "evt") {
			var t =  e.childNodes[i].innerHTML.replace(/\&amp;/g,"and");
			s += "SUMMARY:" + t.replace(/ \u221e/,"") + "\n" + d;
		}
		if (e.childNodes[i].className == "evl") {
			var t =  e.childNodes[i].innerHTML.replace(/\&amp;/g,"and");
			s += "LOCATION:" + t.replace("Location:&nbsp;","") + "\n";
		}
		if (e.childNodes[i].className == "evd") s += "DESCRIPTION:" + e.childNodes[i].innerHTML.replace(/\&amp;/g,"and") + "\n" + l;
	}
	s += "END:VEVENT\nEND:VCALENDAR\n";
	s = encodeURI(s);
	var h = "http://www.eco-web.com/eve/ics.php?e=";
	window.location.href = h + s;
}

function acg(e) {
	var e = e.srcElement || e.target;
	e = e.parentNode.parentNode;
	var d = e.getElementsByTagName("SPAN");
	d = d[0].innerHTML.replace(/-/g,"");
	d = "&dates=" + d + "/" + d;
	var l = e.getElementsByTagName("A");
	l = "&trp=true&sprop=" + l[0].href + "&sprop=name:Official Website";
//	l = "sprop=" + l[0].href + "&sprop=name:Official Website";
	var s = "http://www.google.com/calendar/event?action=TEMPLATE";
	for (var i = 0; i < e.childNodes.length; i++) {
		if (e.childNodes[i].className == "evt") {
			var t =  e.childNodes[i].innerHTML.replace(/\&amp;/g,"and");
			s += "&text=" + t.replace(/ \u221e/,"") + d;
		}
		if (e.childNodes[i].className == "evl") {
			var t =  e.childNodes[i].innerHTML.replace(/\&amp;/g,"and");
			s += "&location=" + t.replace("Location:&nbsp;","");
		}
		if (e.childNodes[i].className == "evd") s += "&details=" + e.childNodes[i].innerHTML.replace(/\&amp;/g,"and") + "\n" + l;
	}
	s = encodeURI(s);
	window.open(s);
}

function MaxLen(e) {
	var m = e.getAttribute ? parseInt(e.getAttribute("maxlength")) : ""
	if (e.getAttribute && e.value.length>m) e.value=e.value.substring(0,m)
}

google_ad_client = "pub-9467312996761334";
google_ad_type = "text_image";
google_page_url = document.location;
google_color_bg = "005040";
google_color_border = "005040";
google_color_link = "FFC040";
google_color_text = "F0F0F0";
google_color_url = "50F0B0";
google_ad_width = 160;
google_ad_height = 600;
google_ad_format = "160x600_as";

