// JavaScript Document

// map popup
function map_popup(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=600,left = 400,top = 192');");
	return false;
}

function setText(obj) {
	if (obj.value.length == 0) {
		obj.value = defValues[obj.id];
	}
	else if (obj.value == defValues[obj.id])
		obj.value = "";
}

function chkForm(obj) {
	obj.getElements("input").each(function(el) {
		if (defValues[el.id]!=undefined) {
			if (el.value == defValues[el.id])
				el.value = "";
		}
	});
}

var defValues = {
	"username":"username",
	"password":"password",
	"subemail":"email",
	"name":"event name",
	"locname":"location",
	"event_date":"date",
	"event_enddate":"end date",
	"event_address":"address",
	"event_city":"city",
	"event_email":"email",
	"event_website":"website",
	"event_phone":"phone",
	"event_contact":"contact person",
	"event_descript":"description",
	"name":"name",
	"website":"website",
	"firstname":"first name",
	"lastname":"last name",
	"address":"address",
	"city":"city",
	"zippost":"postal code",
	"message":"comments",
	"phone":"phone number",
	"email":"email",
	"address1":"address line 1",
	"address2":"address line 2",
	"password_confirm":"password confirm",
	"email_confirm":"email confirm"
};

window.addEvent("domready",function() {
	Cufon.now();
});

// BLOG PAGINATION
function commentpage(id, page) {
	var url = '?ajax=commentpage&id='+id+'&page='+page;
	new Ajax(url, {
			 method: 'get',
			 update: $('blog_comments'),
			 evalScripts: true
	}).request();
	return false;
}

// BLOG COMMENT RATINGS
function thumbsup(id) {
	var r = new Request({
		url: '/index.php?ajax=thumbsup',
		method: 'get',
		data: {'id':id,'count':1,'template':'ajax.html'},
		evalScripts: true
	}).send();
	return false;
}

function thumbsdown(id) {
	var r = new Request({
		url:'/index.php?ajax=thumbsdown',
		method: 'get',
		data: {'id':id,'count':1,'template':'ajax.html'},
		evalScripts: true
	}).send();
	return false;
}


