function getattrinfo(attrval) {
  if (attrval.indexOf('-') > -1) {
	  attrval = attrval.substr(attrval.indexOf('-')+1);
		if (attrval.indexOf('-') > -1) {
			return attrval.split('-');
		}
	}
	return attrval;
}

function getanchor(href) {
  if (href.indexOf('#') > -1) {
	  href = href.substr(href.indexOf('#')+1);
	}
	return href;
}

String.prototype.asInt = function() {
  return parseInt(this) ? parseInt(this) : 0;
}
function asInt(s) {
  return parseInt(s) ? parseInt(s) : 0;
}

$(document).ready(function() {
   var site = String(document.location)
       .replace(/^(https?:\/\/[^:\/]+).*$/, "$1")
       .replace(/^((site)?(file:\/\/.+\/))[^\/]+$/, "$3")
       .replace(/(\\.)/g, "\\$1");
   $("a", this).filter(function (i) {
     if ($(this).attr('rel')=='external') 
			 return false;
     var href = $(this).attr("href");
     if (href == null)
       return false;
     return (href.match(RegExp("^("+site+"|(https?:)?/[^/])")) == null && 
					 href.match(RegExp("^(https?|ftp)://.+")) != null);
   }).each(function () {
     $(this).click(function() {
		   //window.open('/externalurl.php?source='+escape(document.location)+'&destination='+escape($(this).attr('href')));
       window.open($(this).attr('href'));
	     return false;
  	 });
   });													 
   if ($('a[rel="external"]').length) {
		 $('a[rel="external"]').click(function() {
		 	 window.open($(this).attr('href'));
			 return false;
		 });
	 }
	 if ($('form.external').length) {
	   $('form.external').attr('target', '_blank');
	 }
	 if ($('a.zoom').length) {
	 if ($('a.zoom').length) {
		 switch(language) {
			 case 'it':
			  $('a.zoom').lightbox(
				 {strings : {
						help: ' \u2190 / P - n&auml;chstes Bild\u00a0\u00a0\u00a0\u00a0\u2192 / N -vorheriges Bild\u00a0\u00a0\u00a0\u00a0ESC / X - Bildergalerie schlie&szlig;en',
						prevLinkTitle: 'Immagine precedente',
						nextLinkTitle: 'Immagine successiva',
						prevLinkText:  '&laquo; indietro',
						nextLinkText:  'avanti &raquo;',
						closeTitle: 'Chiudi galleria d\'immagini',
						closeHint: 'Cliccare per chiudere.',
						image: 'Immagine ',
						of: ' di '
					}}									
				);
			 break;
			 case 'en':
			  $('a.zoom').lightbox(
				 {strings : {
						help: ' \u2190 / P - next picture\u00a0\u00a0\u00a0\u00a0\u2192 / N -n&auml;chstes Bild\u00a0\u00a0\u00a0\u00a0ESC / X - Bildergalerie schlie&szlig;en',
						prevLinkTitle: 'previous picture',
						nextLinkTitle: 'next picture',
						prevLinkText:  '&laquo; back',
						nextLinkText:  'next &raquo;',
						closeTitle: 'close gallery',
						closeHint: 'click to close.',
						image: 'picture ',
						of: ' of '
					}}									
				);
			 break;
			 default:
			   $('a.zoom').lightbox();
			 break;
		 }
	 }
	 }
     $('div#footer').after('<div id="familotel-banner"><a target="_blank" href="http://www.familotel.com/hotelinfo/suedtirol/sonnwies.html"><span>Familotel</span></a></div>');

});