var map,icon,fxResponse, Ticker;
var arrowAnimation = new Array();

new Asset.images(['/images/clipart/emailBW.png', '/images/clipart/friendBW.png', '/images/clipart/heartBW.png']);


function loadMap() {
	if (google.maps.BrowserIsCompatible()) {
		icon = new google.maps.Icon();
		icon.iconSize = new google.maps.Size(20, 34);
		icon.iconAnchor = new google.maps.Point(10,34);
		icon.infoWindowAnchor = new google.maps.Point(10,17);
		var iconColor =  ['/images/gmapsIcons/icong.png', '/images/gmapsIcons/icony.png', '/images/gmapsIcons/iconr.png'];		
		icon.image = iconColor[0];
		icon.shadow = "/images/gmapsIcons/shadow.png";
		icon.shadowSize = new google.maps.Size(38, 34);

/*		
		icon = new GIcon();
		icon.image = '/images/mapFlag/image.png';
		//icon.shadow = '/images/mapFlag/shadow.png';
		icon.iconSize = new GSize(100,100);
		//icon.shadowSize = new GSize(150,100);
		icon.iconAnchor = new GPoint(0,100);
		icon.infoWindowAnchor = new GPoint(100,5);
		icon.printImage = '/images/mapFlag/printImage.gif';
		icon.mozPrintImage = '/images/mapFlag/mozPrintImage.gif';
		icon.printShadow = '/images/mapFlag/printShadow.gif';
		icon.transparent = '/images/mapFlag/transparent.png';
		icon.imageMap = [32,1,38,2,42,3,94,4,94,5,95,6,95,7,95,8,96,9,96,10,96,11,97,12,97,13,97,14,97,15,97,16,97,17,98,18,98,19,98,20,98,21,98,22,98,23,98,24,98,25,98,26,98,27,98,28,98,29,98,30,98,31,98,32,98,33,98,34,98,35,98,36,98,37,98,38,98,39,98,40,98,41,98,42,98,43,98,44,98,45,98,46,97,47,97,48,97,49,97,50,97,51,97,52,97,53,97,54,97,55,97,56,97,57,97,58,97,59,97,60,97,61,97,62,97,63,97,64,97,65,97,66,97,67,97,68,97,69,97,70,97,71,97,72,97,73,96,74,93,75,89,76,84,77,4,78,4,79,4,80,4,81,4,82,4,83,4,84,4,85,4,86,4,87,4,88,4,89,4,90,4,91,4,92,4,93,4,94,4,95,4,96,4,97,4,98,4,99,0,99,0,98,0,97,0,96,0,95,0,94,0,93,0,92,0,91,0,90,0,89,0,88,0,87,0,86,0,85,0,84,0,83,0,82,0,81,0,80,0,79,0,78,0,77,0,76,0,75,0,74,0,73,0,72,0,71,0,70,0,69,0,68,0,67,0,66,0,65,0,64,0,63,0,62,0,61,0,60,0,59,0,58,0,57,0,56,0,55,0,54,0,53,0,52,0,51,0,50,0,49,0,48,0,47,0,46,0,45,0,44,0,43,0,42,0,41,0,40,0,39,0,38,0,37,0,36,0,35,0,34,0,33,0,32,0,31,0,30,0,29,0,28,0,27,0,26,0,25,0,24,0,23,0,22,0,21,0,20,0,19,0,18,0,17,0,16,0,15,0,14,0,13,0,12,0,11,0,10,0,9,0,8,0,7,0,6,0,5,0,4,0,3,0,2,20,1];
*/	
		
		
		map = new google.maps.Map2($("map"));
		var center = new google.maps.LatLng(parseFloat(latitude), parseFloat(longitude));
		map.setCenter(center, 14, ((city == 'Ensenada')?G_PHYSICAL_MAP:G_PHYSICAL_MAP));//G_NORMAL_MAP));
		var marker = new google.maps.Marker(center, icon);
		map.addOverlay(marker);
		marker.bindInfoWindow($('infoWindowContent'));
		marker.openInfoWindow($('infoWindowContent'));		
		map.addControl(new google.maps.ScaleControl());
		//map.addControl(new GLargeMapControl());
		var ctrl  = new GMapKitMapControls3d();
    map.addControl(ctrl);
		map.addControl(new google.maps.MapTypeControl());
		map.addMapType(G_PHYSICAL_MAP);
		map.addControl(new google.maps.OverviewMapControl());
		
		if(window.nearbyPlaces){
		nearbyPlaces.each(function(item, index){
			var point = new google.maps.LatLng(parseFloat(item.lat), parseFloat(item.lon));
			icon.image = iconColor[1];
			var nearby = new google.maps.Marker(point, icon);
			map.addOverlay(nearby);
			var tooltip = new Tooltip(nearby,item.p,4);
			nearby.tooltip = tooltip;
			map.addOverlay(tooltip);
			google.maps.Event.addListener(nearby,'mouseover',function(){this.tooltip.show();});
			google.maps.Event.addListener(nearby,'mouseout',function(){this.tooltip.hide();});
			google.maps.Event.addListener(nearby, 'click', function() {nearby.openInfoWindowHtml('<p>'+item.p+'</p>');});			
			google.maps.Event.addDomListener($("nearby"+index), 'mouseover', function() {google.maps.Event.trigger(nearby, 'mouseover');});
			google.maps.Event.addDomListener($("nearby"+index), 'mouseout', function() {google.maps.Event.trigger(nearby, 'mouseout');});
			google.maps.Event.addDomListener($("nearbyMap"+index), 'click', function() {google.maps.Event.trigger(nearby, 'click');});
		});
		}
		
		if(window.branches){
		branches.each(function(item, index){
			var point = new google.maps.LatLng(parseFloat(item.lat), parseFloat(item.lon));
			icon.image = iconColor[1];
			var branch = new google.maps.Marker(point, icon);
			map.addOverlay(branch);			
			var tooltip = new Tooltip(branch,item.p,4);
			branch.tooltip = tooltip;
			map.addOverlay(tooltip);
			google.maps.Event.addListener(branch,'mouseover',function(){this.tooltip.show();});
			google.maps.Event.addListener(branch,'mouseout',function(){this.tooltip.hide();});
			google.maps.Event.addListener(branch, 'click', function() {branch.openInfoWindowHtml('<p>'+item.p+'</p>');});			
			google.maps.Event.addDomListener($("branch"+index), 'mouseover', function() {google.maps.Event.trigger(branch, 'mouseover');});
			google.maps.Event.addDomListener($("branch"+index), 'mouseout', function() {google.maps.Event.trigger(branch, 'mouseout');});
			google.maps.Event.addDomListener($("branchMap"+index), 'click', function() {google.maps.Event.trigger(branch, 'click');});
		});
		}
		
		

		window.addEvent('unload', function(){google.maps.Unload();});	
	}
							
}

function ajaxStart(indicator){}
function ajaxStop(indicator){}


function focusOnPoint(space){
	window.location = "http://www.elmesero.com/link-"+space+".html";
}
		
function editOpinion(ref){
	progress('pause');
	$('dropOpinion').setStyle('display', 'inline');
	$('resumeTimer').setStyle('display', 'inline');
	$('frmCommentsAction').value= 'modifyComment';
	$('txOpinion').value = theOpinion;
	$('frmComments').rdMood[theMood].checked = true;
	$('frmComments').setStyle('display', 'block');
	var toForm = new Fx.Scroll(window).toElement('frmComments');
	return false;
}

function resetOpinion(){
	$('frmComments').txOpinion.value = '';
	$('frmComments').operation.value = 'addComment';
	for (var i = 0; i < $('frmComments').rdMood.length; i++) {
    	$('frmComments').rdMood[i].checked = false;
    }
	if($('dropOpinion')){$('dropOpinion').setStyle('display', 'none');}
	if($('resumeTimer')){$('resumeTimer').setStyle('display', 'none');}
}

function dropOpinion(ref){
	var answer = confirm("¿Borrar Comentario?")
	if (answer){
		new Ajax('/restaurante/ajax.php',{postBody:'ref='+ref+'&operation=dropComment', evalScripts:'true', update:'commentsTable'}).request();
		resetOpinion();
	}
	return false;
}

var time = 180000;
var steps = 50; 
var step = 1;
var timerStatus = 'on';
var theLoop;

function progress(theAction) { 
	var bar = $( "barwrap"); 
	var aStep = (bar.offsetWidth -2)/steps;
	var x = Math.round( aStep *step); 
	var outer = $( "outer"); 
	var inner = $( "inner");
	
	if(theAction == 'pause') timerStatus = 'pause'; 
	if(theAction == 'on') timerStatus = 'on'; 
	
	if(timerStatus == 'on'){
		inner.style.width = x +"px"; 
		step++;
	
		inner.firstChild.innerHTML = outer.firstChild.innerHTML;		
		
		if( step > steps) timesUp(); 
		else{  
			theLoop = setTimeout( "progress();", time /steps); 
		}
	}
}

function resumeTimer(){
	$('frmComments').setStyle('display', 'none');
	progress('on');
	var toBottom = new Fx.Scroll(window).toBottom('commentsTable');
}

function timesUp() { 
	$('frmComments').setStyle('display', 'block');
	var theRow = $('wrap');
	theRow.parentNode.removeChild(theRow);
	resetOpinion();
	timerStatus ='on';	
}

function phoneRating(ref, rating, place){
	new Ajax('/restaurante/ajax.php',{postBody:'operation=phoneRating&ref='+ref+'&rating='+rating+'&place='+place, evalScripts:'true', update:'telephoneTable'}).request();
}



// Phone Validator
function isInteger(s){
	var i;
  for (i = 0; i < s.length; i++){   
  	var c = s.charAt(i);
    if (((c < "0") || (c > "9"))) return false;
  }
  return true;
}

function stripCharsInBag(s, bag){
	var i;
  var returnString = "";
  for (i = 0; i < s.length; i++){
	  var c = s.charAt(i);
    if (bag.indexOf(c) == -1) returnString += c;
  }
  return returnString;
}

function checkInternationalPhone(strPhone){
	var validWorldPhoneChars = "[]()- +*";
	var minDigitsInIPhoneNumber = 5;
	s=stripCharsInBag(strPhone,validWorldPhoneChars);
	return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}

function validateContribution(Phone){
	if ((Phone.value==null)||(Phone.value=="")){
		alert('Por favor ingrese un numero de telefono')
		Phone.focus()
		return false
	}
	if (checkInternationalPhone(Phone.value)==false){
		alert("Por favor ingrese un numero de telefono valido")
		Phone.value=""
		Phone.focus()
		return false
	}
	return true
 }
// Phone Validator End



// Thumb Animation
function raterOver(theItem, state){ // onMouseOver
	switch (state){
		case 1:	$(theItem).src = "/images/thumbs/up.png";	break;
		case 2:	$(theItem).src = "/images/thumbs/up.png";	break;
		case 3:	$(theItem).src = "/images/thumbs/down.png";	break;
		case 4:	$(theItem).src = "/images/thumbs/down.png";	break;		
	}
}

function raterOut(theItem, state){ // onMouseOut
	switch (state){
		case 1:	$(theItem).src = "/images/thumbs/up.png";	break;
		case 2:	$(theItem).src = "/images/thumbs/upblank.png";	break;
		case 3:	$(theItem).src = "/images/thumbs/down.png";	break;
		case 4:	$(theItem).src = "/images/thumbs/downblank.png";	break;		
	}
}
		
window.addEvent('load', function(){
	$('logo').addReflection({height: 0.15, opacity: 0.5});
	
	$('map').setStyle('height', ($('mapBlock').getSize().size.y - 73) +'px');
	loadMap();
	
	if(isSpace==0){
		new Ajax('/map/refreshAds.php',{postBody:'action=refreshAds&city='+city, evalScripts:'true', method: 'post', update:'elMeseroNews'}).request();
	}
	
	Ticker = new Class({
		setOptions: function(options) {
			var mytimer = null;
			this.options = Object.extend({
				speed: 1000,
				delay: 5000,
				direction: 'vertical',
				onComplete: Class.empty,
				onStart: Class.empty
			}, options || {});
		},
		initialize: function(el,options){
			this.setOptions(options);
			this.el = $(el);
			this.items = this.el.getElements('li');
			var w = 0;
			var h = 0;
			if(this.options.direction.toLowerCase()=='horizontal') {
				h = this.el.getSize().size.y;
				this.items.each(function(li,index) {
					w += li.getSize().size.x;
				});
			} else {
				w = this.el.getSize().size.x;
				this.items.each(function(li,index) {
					h += li.getSize().size.y;
				});
			}
			this.el.setStyles({
				position: 'absolute',
				top: 0,
				left: 0,
				width: w,
				height: h
			});
			this.fx = new Fx.Styles(this.el,{
				duration:this.options.speed,
				onComplete:function() {
					var iq = (this.current==0)?this.items.length:this.current;
					this.items[iq-1].injectInside(this.el);
					this.el.setStyles({
						left:0,
						top:0
					});
				}.bind(this)});
			this.current = 0;
			this.next();
		},
		next: function() {
			this.current++;
			if (this.current >= this.items.length) this.current = 0;
			var pos = this.items[this.current];
			this.fx.start({
				top: 0, //-pos.offsetTop,
				left: (pos.offsetLeft<=240)?-pos.offsetLeft:-240//-pos.offsetLeft
			});
			mytimer = this.next.bind(this).delay(this.options.delay+this.options.speed);
			//this.next.bind(this).delay(this.options.delay+this.options.speed);
		},
		pause: function() {
			$clear(mytimer);
			mytimer = null;
			this.current--;
		},
		resume: function() {
			if (mytimer == null) {
			this.next();}
		}
	});
});	
	
			
window.addEvent('domready', function(){	
																		 
	Shadowbox.init();

	
	$('pNavigationMenuContainer').setStyle('width', $ES('li', 'pNavigationMenuContainer').length * 147);
	
	
	$ES('li', 'pNavigation').addEvent('click', function(){
		var goToTop = new Fx.Scroll(window).toElement(this.title);
	});
	
	
	
	$$('h4').forEach(function(item){
			var topButton = new Element('img', {
			'src': '../images/arrows/up.png',
			'class': 'toTop',
			'alt': 'arriba',
			'title': 'hacia arriba',
			'events': { 					
				'click': function(){ 
					var windowTop = new Fx.Scroll(window).toTop();
				},
				'mouseover': function(){
					this.setStyle('cursor', 'pointer');
				}
			}
		});
			topButton.injectInside(item);
	});
	
	
	// Iconography
	myTips = new Tips($$('.toolTips'), {maxTitleChars: 50});
	

	// MenuIndex
	if($('menuIndex')){
		$ES('li', 'menuIndex').setStyle('opacity', '.5');
		$ES('img', 'menuIndex').setStyle('opacity', '0');
		$('menuIndex').getFirst().setStyles('opacity', '1').addClass('currentMenuItem');
		$('menuArrow0').setStyles('opacity', '1');
		$ES('li', 'menuIndex').each(function(e, index){		
			arrowAnimation[index] = new Fx.Styles('menuArrow'+index, {duration: 1000, transition: Fx.Transitions.linear, wait: false}); 
		});
	
		$ES('li', 'menuIndex').addEvent('mouseover', function(e){
			if(this.getStyle('opacity')<1){this.setStyle('opacity', '.8')}
			arrowAnimation[this.value].start({ 
				'opacity': [0, .8] 
			});
		});
		
		$ES('li', 'menuIndex').addEvent('mouseout', function(){
			if(!this.hasClass('currentMenuItem')){
				this.setStyle('opacity', '.5');			
				arrowAnimation[this.value].start({ 
					'opacity': [.8, 0] 
				});		
			}
		});
		$ES('li', 'menuIndex').addEvent('click', function(){
			$ES('li', 'menuIndex').setStyle('opacity','.5');
			this.setStyle('opacity', '1');
			$ES('li', 'menuIndex').removeClass('currentMenuItem');
			this.addClass('currentMenuItem');
			$$('.menuSection').setStyle('display', 'none');
			$('menuSection'+this.value).setStyle('display', 'block');
			$ES('img', 'menuIndex').setStyle('opacity', '0');
			$('menuArrow'+this.value).setStyle('opacity', '1');	
		});
		
		$('menuIndexComplete').addEvent('click', function(){
			$$('.menuSection').setStyle('display', 'block');
			$ES('li', 'menuIndex').setStyle('opacity', '1');
			$ES('li', 'menuIndex').addClass('currentMenuItem');
			$ES('img', 'menuIndex').setStyle('opacity', '1');
		});
		
		$('menuIndexCompleteTop').cloneEvents($('menuIndexComplete'));
	}
	
	/* Menu Stars	
	var plateRatings = $$('.p');
	plateRatings.each(function(item){		
		var plateStarsContainer, plateStarsImages, plateRating;
		var plateInfo = new Array();
		plateInfo = item.id.split('-');
		plateRating = item.getFirst().getText();
		plateStarsContainer = new Element('div', { 'id': 'plateStars'+plateInfo[1], 'class': 'menuStars'});
		for(var i=1;i<6;i++){
			plateStarsImages = new Element('img', {
				'src': template+'/images/stars/plate/star'+((plateRating>=i)?'On':'Off')+'.gif',
				'id': 'plateStar'+plateInfo[1]+'-'+i,
				'class': 'plateStar',
				'width': '16',
				'height': '16',
				'alt': plateInfo[1],
				'title': i,
				'name': (plateRating>=i)?'on':'off',
				'events': { 
					'mouseenter': function(){ 
						var e = this;
						var star;
						$$('img[id^=plateStar'+e.alt+'-]').each(function(star, index){star.src = (index+1<=e.title)?template+"/images/stars/plate/starOn.gif":template+"/images/stars/plate/starOff.gif";});
					}, 
					'mouseout': function(){ 
						var e = this;
						var star;
						$$('img[id^=plateStar'+e.alt+'-]').each(function(star, index){star.src = (star.name == "on")?template+"/images/stars/plate/starOn.gif":template+"/images/stars/plate/starOff.gif";});			 
					},
					'click': function(){ 
						new Ajax('/restaurante/ajax.php',{postBody:'rating='+this.title+'&row='+this.alt+'&operation=menuStarRating', evalScripts:'true', update:'plateStars'+this.alt}).request();
					}
				}
			});
			plateStarsImages.injectInside(plateStarsContainer);	
		}
		$('plate-'+plateInfo[1]).getFirst().replaceWith(plateStarsContainer);
	});
	*/
	
	// My Rating
	if($('myRating')){
		var myRating = $('myRating').getText()
		$('myRating').empty();
		var ratingStars;
		for(var i=1;i<6;i++){
			ratingStars = new Element('img', {
				'src': template+'/images/stars/my/star'+((myRating>=i)?'On':'Off')+'.gif',
				'id': 'ratingStar'+i,
				'class': 'ratingStar',
				'width': '16',
				'height': '16',
				'alt': i,
				'title': i,
				'name': (myRating>=i)?'on':'off',
				'events': { 
					'mouseenter': function(){ 
						var e = this;
						var star;
						$$('img[id^=ratingStar]').each(function(star, index){star.src = (index+1<=e.title)?template+"/images/stars/my/starOn.gif":template+"/images/stars/my/starOff.gif";});
					}, 
					'mouseout': function(){ 
						var e = this;
						var star;
						$$('img[id^=ratingStar]').each(function(star, index){star.src = (star.name == "on")?template+"/images/stars/my/starOn.gif":template+"/images/stars/my/starOff.gif";});			 
					},
					'click': function(){ 
						new Ajax('/restaurante/ajax.php',{postBody:'rating='+this.title+'&operation=myRating&point='+point, evalScripts:'true', update:'myRating'}).request();
					}
				}
			});
			ratingStars.injectInside($('myRating'));	
		}
	}


					
	// Point Ratings
	$$('.star').addEvent('mouseenter', function(){var e = this;$$('img[id^=star'+e.alt+'-]').each(function(item, index){item.src = (index+1<=e.title)?template+"/images/stars/aspect/starOn.gif":template+"/images/stars/aspect/starOff.gif";});});
	$$('.star').addEvent('mouseout', function(){var e = this;$$('img[id^=star'+e.alt+'-]').each(function(item, index){item.src = (item.name == "on")?template+"/images/stars/aspect/starOn.gif":template+"/images/stars/aspect/starOff.gif";});});
	$$('.star').addEvent('click', function(){ajaxStart('main');new Ajax('/restaurante/ajax.php',{postBody:'rating='+this.title+'&row='+this.alt+'&point='+point+'&operation=ratePoint', evalScripts:'true', update:'starTableRow'+this.alt}).request();});
	
	
	// Thumbs Up/Down	
	$$('.ok').addEvent('mouseenter',  function(){this.src = "/images/thumbs/up.png";});
	$$('.ok').addEvent('mouseleave',  function(){this.src = "/images/thumbs/upblank.png";});
	$$('.no').addEvent('mouseenter',  function(){this.src = "/images/thumbs/down.png";});
	$$('.no').addEvent('mouseleave',  function(){this.src = "/images/thumbs/downblank.png";});
	$$('.rater').addEvent('click', function(){
		var param = new Array();
		param = this.id.split('-');
		new Ajax('/restaurante/ajax.php',{postBody:'action=commentVote&ref='+param[1]+'&rating='+param[3]+'&place='+point+'&row='+param[2], evalScripts:'true', update:'commentRow'+param[2]}).request();
	});
	
	
	// Comment
	$('frmComments').addEvent('submit', function(e){
		var e = new Event(e).stop();
		if(window.isUser<1){
			if ($('txName').value=="" || $('txEmail').value==""){
				alert("Por favor escriba su nombre/email");
				return;
			}
		}
		if ($('txOpinion').value==""){
			alert("Por favor escriba el comentario");		
		} else {
			this.send({update:'commentsTable', evalScripts:'true', onComplete: function(){var toBottom = new Fx.Scroll(window).toBottom('commentsTable');}});
			this.setStyle('display', 'none');		
		}		
	});
	
	
	// Subscriptions
	if($('frmSubscription')){
		$('frmSubscription').addEvent('submit', function(e){
			var e = new Event(e).stop();
			this.send({update:'subscribe', evalScripts:'true'});	
		});	
		$('txEmail').addEvent('focus', function(){this.value = (this.value == "email")?this.value = "":this.value;});	
		$('txEmail').addEvent('blur', function(){this.value = (this.value == "")?this.value = "email":this.value;});
	}
	
	if($('addSubscription') && (!($('frmSubscription')))){
		$('addSubscription').addEvent('click', function(){
			new Ajax('/restaurante/ajax.php',{postBody:'operation=subscribe&hdPoint='+point, evalScripts:'true', update:'subscribe'}).request();
		});
	}
	
	if($('cancelSubscription')){
		$('cancelSubscription').addEvent('click', function(){
			new Ajax('/restaurante/ajax.php',{postBody:'operation=unsubscribe&hdPoint='+point, evalScripts:'true', update:'subscribe'}).request();
		});
	}
	
	
	// Friend Recommendations
	var recommendationSlider =  new Fx.Slide('frmFriend').hide();
	$ES('span', 'recommendFriend').addEvent('click', function() { recommendationSlider.toggle(); });
	
	if($('frmFriend')){
		$('frmFriend').addEvent('submit', function(e){
			var e = new Event(e).stop();
			this.send({update:'recommendFriend', evalScripts:'true'});	
		});
		if($('txFrom')){$('txFrom').addEvent('focus', function(){this.value = (this.value == "su nombre")?this.value = "":this.value;});}
		if($('txFrom')){$('txFrom').addEvent('blur', function(){this.value = (this.value == "")?this.value = "su nombre":this.value;});}
		if($('txFromEmail')){$('txFromEmail').addEvent('focus', function(){this.value = (this.value == "su email")?this.value = "":this.value;});}
		if($('txFromEmail')){$('txFromEmail').addEvent('blur', function(){this.value = (this.value == "")?this.value = "su email":this.value;});}
		$('txFriend').addEvent('focus', function(){this.value = (this.value == "email de amigo")?this.value = "":this.value;});	
		$('txFriend').addEvent('blur', function(){this.value = (this.value == "")?this.value = "email de amigo":this.value;});
	}
	
	
	// Social Bookmarking
	//var socialSlider =  new Fx.Slide('socialIcons').hide();
	//$ES('span', 'socialBookmark').addEvent('click', function() { socialSlider.toggle(); });
	
	
	
	// Add Phones
	if($('frmPhones')){
		$('frmPhones').addEvent('submit', function(e){
			var e = new Event(e).stop();
			if (validateContribution($('phoneInput'))){
				this.send({evalScripts:'true', update:'telephoneTable'});
				$('phoneInput').value="";
			}
		});
	}
	
	if($('phoneInput')){
		$('phoneInput').addEvent('focus', function(){this.value = (this.value == "sugerir teléfono nuevo")?this.value = "":this.value;});
		$('phoneInput').addEvent('blur', function(){this.value = (this.value == "")?this.value = "sugerir teléfono nuevo":this.value;});
	}
	
	
	
	// My Favorite
	if($('addToMine')){
		$('addToMine').addEvent('click', function(){
			ajaxStart('main');
			new Ajax('/restaurante/ajax.php', {postBody:'action=addToMine&point='+point, evalScripts:'true', update:'addFavorite'}).request();
		});
	}
	
	if($('removeFromMine')){
		$('removeFromMine').addEvent('click', function(){
			ajaxStart('main');
			new Ajax('/restaurante/ajax.php', {postBody:'action=removeFromMine&point='+point, evalScripts:'true', update:'addFavorite'}).request();
		});
	}
	
	
	
	if($('login')){
		$('login').addEvent('click', function(){
			Shadowbox.open({
				title:      'mi cuenta',
				type:       'iframe',
				content:	'/restaurante/loginPopup.php',
				height:     350,
				width:      450
			});
			
			Shadowbox.applyOptions({
				onClose:	function(){window.location = window.location;}
			});
			
		});
	}
	
	
	
	
	//GLog.write(item.id);
});
