/*
Copyright (c) 2007, Parosweb O.E. All rights reserved.
version: 2007-06-18
*/
////////////////////////////////////////////////////////////////////////////////
// Shortcuts ///////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
var $U = YAHOO.util;
var $D = YAHOO.util.Dom;
var $E = YAHOO.util.Event;


////////////////////////////////////////////////////////////////////////////////
// Details Object //////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
function SyMap() {
	this.oSpot = false;
	this.sAppendAt = 'rtls_spot';
	this.sTable    = 'rtls_places';
	this.sSpotId   = 'rtls_map_spot';
	this.oLocations = {}
	this.oLocations[ 'alyki' ]            = [ 201, 328, 0 ];
	this.oLocations[ 'ambelas' ]          = [ 422, 123, 0 ];
	this.oLocations[ 'antiparos' ]        = [ 123, 244, 0 ];
	this.oLocations[ 'boudari' ]          = [ 360, 318, 0 ];
	this.oLocations[ 'drios' ]            = [ 351, 326, 0 ];
	this.oLocations[ 'golden-beach' ]     = [ 363, 314, 0 ];
	this.oLocations[ 'kolimbithres' ]     = [ 341, 64, 0 ];
	this.oLocations[ 'lefkes' ]           = [ 327, 209, 0 ];
	this.oLocations[ 'logaras' ]          = [ 387, 278, 0 ];
	this.oLocations[ 'lolandonis' ]       = [ 328, 336, 0 ];
	this.oLocations[ 'marpissa' ]         = [ 397, 237, 0 ];
	this.oLocations[ 'molos' ]            = [ 417, 217, 0 ];
	this.oLocations[ 'naoussa' ]          = [ 379, 79, 0 ];
	this.oLocations[ 'new-golden-beach' ] = [ 260, 300, 1 ];
	this.oLocations[ 'parasporos' ]       = [ 208, 166, 0 ];
	this.oLocations[ 'parikia' ]          = [ 241, 145, 0 ];
	this.oLocations[ 'pisso-livadi' ]     = [ 330, 249, 1 ];
	this.oLocations[ 'pounda' ]           = [ 152, 247, 0 ];
	this.oLocations[ 'prodromos' ]        = [ 376, 222, 0 ];
	this.oLocations[ 'santa-maria' ]      = [ 355, 59, 1 ];

	//<div class="spot" id="rtls_map_spot" style="left:241px; top:145px;"><p>Parikia</p></div>
	//<div class="spot spr" id="rtls_map_spot" style="left:100px; top:100px;"><p>Parikia</p></div>
}
SyMap.version = '2007-06-20';
SyMap.ident   = 'SyMap';

// init ////////////////////////////////////////////////////////////////////////
SyMap.prototype.init = function() {
	var o = this;
	o.oTable = $D.get( o.sTable );
	if ( !o.oSpot ) {
		o.oSpot = document.createElement( 'div' );
		o.oSpot.id = o.sSpotId;
		$D.setStyle( o.oSpot, 'display', 'none' );
		o.appendElement( $D.get( o.sAppendAt ), o.oSpot );
		$E.on( o.oTable, 'mouseover', o.spotHandler, o, true );
		$E.on( o.oTable, 'mouseout', o.spotHandler, o, true );
	}
}

// navHandler //////////////////////////////////////////////////////////////////
SyMap.prototype.spotHandler = function( e ) {
	var o = this;
	$E.stopEvent( e );
	var oE = $E.getTarget( e );
	while ( oE.id != o.sTable ) {
		if( e.type=='mouseover' && oE.nodeName.toUpperCase()=='A' ) {
			var location = oE.href.match( /\/([^\/]+?)-1.html/ )[1];
			o.oSpot.innerHTML = '<p>' + oE.innerHTML.replace( /\s/g, '&nbsp;' ) + '</p>';
			var coords = o.oLocations[ location ] ? o.oLocations[ location ] : false;
			if ( coords ) {
				$D.setStyle( o.oSpot, 'left', coords[0]+'px' );
				$D.setStyle( o.oSpot, 'top', coords[1]+'px' );
				if ( coords[2] ) {
					o.oSpot.className = 'spot spr';
				} else {
					o.oSpot.className = 'spot';
				}
				$D.setStyle( o.oSpot, 'height', 0 );
				$D.setStyle( o.oSpot, 'display', 'block' );
				var Fade = new $U.Anim( o.oSpot, { height: { from:1, to:22, unit:'px' }  }, 0.2, $U.Easing.easeOut );
				Fade.animate();
			}
			break;
		} else if ( e.type=='mouseout' && oE.nodeName.toUpperCase()=='A' ) {
			$D.setStyle( o.oSpot, 'display', 'none' );
			break;
		} else { 
			oE = oE.parentNode; 
		}
	}
}


// append //////////////////////////////////////////////////////////////////////
SyMap.prototype.appendElement = function( element, addElement ) {
    var father = element.parentNode;
    father.insertBefore( addElement, element.nextSibling );
}

