// JavaScript Document

document.observe('dom:loaded', function(){

    Shadowbox.init({
        resizeLgImages:     true,
        displayNav:         true,
        handleUnsupported:  'remove',
        keysClose:          ['c', 27], // c or esc
        autoplayMovies:     true,
		flvPlayer: '/swf/flvplayer.swf',
		loadingImage: '/images/loading.gif'
    });
	


});

function imgHover(id,src){
	//alert(src);
	document.getElementById('close_button').src = src;
}

/*
var $j = jQuery.noConflict()

$j(document).ready(function(){ 
							
	$j("#nav-one li").hover(
		function(){ $j(this).children("ul").fadeIn("slow"); },
		function(){ $j(this).children("ul").hide(); }
	);
	if (document.all) {
		$j("#nav-one li").hoverClass ("sfHover");
	}
});

$.fn.hoverClass = function(c) {
	return this.each(function(){
		$(this).hover( 
			function() { $(this).addClass(c);  },
			function() { $(this).removeClass(c); }
		);
	});
};
	
*/

function reload(){
	parent.window.location.reload();	
}

function jsConfirm(question,path){
	if (confirm(question)){
			window.location = path;
	}
}


function textCounter(name, count, charlimit) {
	if (name.value.length > charlimit) // if too long...trim it!
	name.value = name.value.substring(0, charlimit);
	// otherwise, update 'characters left' counter
	else
	count.value = charlimit - name.value.length;
}

function getCoords(e){
	var el = e.target || e.srcElement;
	
	// Get mouse click co-ords
	var ePos = {x:0, y:0};
	if ('number' == typeof e.pageX){
	ePos.x = e.pageX;
	ePos.y = e.pageY;
	} else if ('number' == typeof e.clientX){
	ePos.x = e.clientX + document.body.scrollLeft
	+ document.documentElement.scrollLeft;
	ePos.y = e.clientY + document.body.scrollTop
	+ document.documentElement.scrollTop;
	}
	
	// Get image top left co-ords
	var elPos = {x:0, y:0};
	if (el.offsetParent) {
	elPos.x = el.offsetLeft;
	elPos.y = el.offsetTop;
	while (el = el.offsetParent) {
	elPos.x += el.offsetLeft;
	elPos.y += el.offsetTop;
	}
	}
  document.getElementById('map_x').value = (ePos.x - elPos.x);
  document.getElementById('map_y').value = (ePos.y - elPos.y);
  //alert (X + '' + Y);
}