var sendLinkWindow = '';
var sendLinkDisplayed = 0;

function showSendLink(detailId) {
	
  var openUrl = location.href
  try {
	  openUrl = parent.location.href
  } catch (e) {
	  
  }
  

  if (detailId) {
	if (openUrl.indexOf('?') != -1) {
		openUrl = openUrl + '&id=' + detailId;
	} else {
		openUrl = openUrl + '?id=' + detailId;
	}
  }  

  sendLinkWindow = window.open("/PostCard/CreateCard.asp?url=" + escape(openUrl),"sendLink","width=565,height=350,left=100,top=100,resizable,status=yes");
  sendLinkWindow.focus();	
  sendLinkDisplayed = 1;
}

function hideSendLink() {
  if (sendLinkDisplayed == 1) {
  	sendLinkWindow.close();
  }
}

function closeWindow() {
  hideSendLink();
}

function CreateBookmarkLink(detailId) {
	var openUrl = 'http://' + window.location.hostname + '/' + parent.gui_url;
	var url = window.location.href;
	if (url.toLowerCase().indexOf('uploadedasp') != -1) {
		openUrl = url;
	}
	
  if (detailId) {
	if (openUrl.indexOf('?') != -1) {
		openUrl = openUrl + '&id=' + detailId;
	} else {
		openUrl = openUrl + '?id=' + detailId;
	}
  }
	
	//ff
	if (window.sidebar) {
		window.sidebar.addPanel('Ville de Lausanne', openUrl, "");
	//ie
	} else if (window.external) {
		window.external.AddFavorite(openUrl, 'Ville de Lausanne');
	}
}

function sayIt() {
	if (document.getElementById('buffer')) var urlPage = document.getElementById('buffer').src;
	else var urlPage = document.location + "";
	urlPage = escape(urlPage);
	window.open('http://voice.dixerit.com/lausannedix?lang='+gui_lang+'&url='+urlPage,'dixerit','width=282, height=117, top=100, left=100');
}

function zoomIn() {
	if ($.browser.safari) {
		$('body').css('zoom', '120%');
	} else {
		var msg = '';
		switch(gui_lang) {
			case 'E':
				msg = 'Press the keys "Ctrl" and "+" to use the browser\'s built-in zoom function.';
				break;
				
			case 'D':
				msg = 'Mit der Tastenkombination "Ctrl" und "+" können Sie die Ansicht verkleinern.';
				break;
				
			default:
				msg = 'Utilisez la combinaison de touches "Ctrl" et "+" afin d\'utiliser le zoom avancé du navigateur.';
		}
		alert(msg);
	}
}

function zoomOut() {
	if ($.browser.safari) {
		$('body').css('zoom', '100%');
	} else {
		var msg = '';
		switch(gui_lang) {
			case 'E':
				msg = 'Press the keys "Ctrl" and "-" to use the browser\'s built-in zoom function.';
				break;
				
			case 'D':
				msg = 'Mit der Tastenkombination "Ctrl" und "-" können Sie die Ansicht verkleinern.';
				break;
				
			default:
				msg = 'Utilisez la combinaison de touches "Ctrl" et "-" afin d\'utiliser le zoom avancé du navigateur.';
		}
		alert(msg);
	}
}

function doPrint() {
		var buffer = frames['buffer'];
		
		if (buffer) {
			buffer.focus();
			buffer.print();
		
		} else {
			$('.contextual_elements .gui_box:not(#gui_tools)').appendTo('.content_area');
			window.print();
			setTimeout(function() { $('.content_area .gui_box').appendTo('.contextual_elements') }, 0);
			
		}
}
