// urbanstudio Oliver Feiler

function showvideo(clipid) {
  window.open('clip.php?clip=' + clipid + '','clip','width=320,height=400');
}

function US_swapImgRestore() { //v3.0
  var i,x,a=document.US_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function US_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.US_p) d.US_p=new Array();
    var i,j=d.US_p.length,a=US_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.US_p[j]=new Image; d.US_p[j++].src=a[i];}}
}

function US_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=US_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function US_swapImage() { //v3.0
  var i,j=0,x,a=US_swapImage.arguments; document.US_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=US_findObj(a[i]))!=null){document.US_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function US_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.US_pgW=innerWidth; document.US_pgH=innerHeight; onresize=US_reloadPage; }}
  else if (innerWidth!=document.US_pgW || innerHeight!=document.US_pgH) location.reload();
}

function US_addBookmark() {
  window.external.AddFavorite(document.location.href, 'urbanhosting.de');
}

function US_printsite(URL) {
  window.open(URL,'us_pop','width=650,height=500,scrollbars=yes');
}

function US_popImage(image, w, h) {
  window.open('popup.php?IMG='+image,'us_popImage','width=' + w + ',height=' + h + ',scrollbars=no');
}

function US_showLayer(x) {
	document.getElementById(x).style.display="inline";
}

function US_hideLayer(x) {
	document.getElementById(x).style.display="none";
}
function US_changeLayer(x, y, z) {
	document.getElementById(x).style.display=z; //block or inline
	document.getElementById(y).style.display="none";
}
function US_clearLayer(x) {
	document.getElementById(x).innerHTML="";
}

function US_showTooltip(tooltip) {
	switch (tooltip){

	  case "back":
	  	ustooltext = "zum vorherigen Bild";
		break;

	  case "forward":
	  	ustooltext = "zum nächsten Bild";
		break;

	  case "next":
	  	ustooltext = "zur nächsten Seite";
		break;

	  case "before":
	  	ustooltext = "zur letzten Seite";
		break;

	  case "index":
	  	ustooltext = "Bilder-Übersicht";
		break;

	  case "repindex":
	  	ustooltext = "Reportage-Übersicht";
		break;

	  case "serieindex":
	  	ustooltext = "Serie-Übersicht";
		break;

	  case "essenindex":
	  	ustooltext = "Essen-Übersicht";
		break;

	  case "restindex":
	  	ustooltext = "Rest-Übersicht";
		break;

	  case "text":
	  	ustooltext = "weitere Informationen";
		break;

	  case "first":
	  	ustooltext = "zum ersten Bild";
		break;

	  case "last":
	  	ustooltext = "zum letzten Bild";
		break;
		
	  case "lightbox":
	  	ustooltext = "Bild in Lightbox";
		break;

	  default:
	  	ustooltext = "";
	  	break;
	}
	document.getElementById("mktooltiptext").innerHTML = ustooltext;
}
function US_showText() {
	document.getElementById("mkoverlay").style.display="block";
}
function US_hideText() {
	document.getElementById("mkoverlay").style.display="none";
}
function US_setFocus(x) {
	document.getElementById(x).focus();
}
function US_setChangedTimeOut() {
	window.setTimeout('US_clearLayer("lightbox-status")', 5000);
}
	// in die lightbox legen
	var http_request_lightbox_in = false;
    function US_lightboxRequest(pic) {
		http_request_lightbox_in = false;
        if (window.XMLHttpRequest) { // Mozilla, Safari,...
            http_request_lightbox_in = new XMLHttpRequest();
            if (http_request_lightbox_in.overrideMimeType) { http_request_lightbox_in.overrideMimeType('text/xml'); }
        } else if (window.ActiveXObject) { // IE
            try { http_request_lightbox_in = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try { http_request_lightbox_in = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }
        if (!http_request_lightbox_in) { alert('Ende :( Kann keine XMLHTTP-Instanz erzeugen'); return false; }
		urlx = 'ajax_lightbox_in.php?&pic=' + pic + '&pib=save';
        http_request_lightbox_in.onreadystatechange = US_pushContent_lightbox_in;
        http_request_lightbox_in.open('GET', urlx, true);
        http_request_lightbox_in.send(null);
    }
    function US_pushContent_lightbox_in() {
        if (http_request_lightbox_in.readyState == 4) {
            if (http_request_lightbox_in.status == 200) {
                if (http_request_lightbox_in.responseText != "0") {
					document.getElementById('lightbox-status').innerHTML = http_request_lightbox_in.responseText;
					US_setChangedTimeOut();
				} else { document.getElementById('lightbox-status').innerHTML = "Fehler beim Laden..."; }
            } else { alert('Bei dem Request ist ein Problem aufgetreten.'); }
        } else { /* Preload */ }
    }

function US_checkMail(mailValue) {
	var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i
	var returnval=emailfilter.test(mailValue)
	if (returnval==false){
		return false;
	}
	else {
		return true;
	}
}

function US_MailIn() {
	US_mailValue = document.getElementById('email').value;
	if (US_mailValue != "") {
		if (US_checkMail(US_mailValue)) {
			document.forms['sendbox'].submit();
		}
		else {
			alert('Bitte geben Sie eine gültige E-Mail-Adresse ein,\num diese Lightbox versenden zu können.\nVielen Dank!');
		}
	}
	else {
		alert('Bitte geben Sie Ihre E-Mail-Adresse ein,\num diese Lightbox versenden zu können.\nVielen Dank!');
	}
}
US_reloadPage(true);



standardtatus = "Martin Kath. Fotografie.";
window.defaultStatus = standardtatus;
